@roll-agent/runtime 0.7.0 → 0.8.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.
Files changed (73) hide show
  1. package/dist/bash/classifier/compound.d.ts +2 -1
  2. package/dist/bash/classifier/compound.js +1 -1
  3. package/dist/bash/classifier/flag-audit.js +1 -1
  4. package/dist/bash/classifier/git-audit.d.ts +9 -1
  5. package/dist/bash/classifier/git-audit.js +1 -1
  6. package/dist/bash/classifier/index.d.ts +0 -1
  7. package/dist/bash/classifier/index.js +1 -1
  8. package/dist/bash/classifier/path-audit.d.ts +1 -1
  9. package/dist/bash/classifier/path-audit.js +1 -1
  10. package/dist/bash/classifier/safe-list.d.ts +6 -0
  11. package/dist/bash/classifier/safe-list.js +1 -1
  12. package/dist/bash/clean-env.d.ts +2 -0
  13. package/dist/bash/clean-env.js +1 -1
  14. package/dist/bash/format-result.d.ts +1 -1
  15. package/dist/bash/format-result.js +1 -1
  16. package/dist/bash/profile.js +1 -1
  17. package/dist/bash/session/session-manager.d.ts +1 -0
  18. package/dist/bash/session/session-manager.js +1 -1
  19. package/dist/bash/workdir.js +1 -1
  20. package/dist/engine/agent-session.d.ts +88 -3
  21. package/dist/engine/agent-session.js +1 -1
  22. package/dist/engine/cancelled-turn-recovery.d.ts +34 -0
  23. package/dist/engine/cancelled-turn-recovery.js +1 -0
  24. package/dist/engine/capability-manifest.d.ts +160 -0
  25. package/dist/engine/capability-manifest.js +1 -0
  26. package/dist/engine/compaction-checkpoint.d.ts +3827 -0
  27. package/dist/engine/compaction-checkpoint.js +1 -0
  28. package/dist/engine/compaction-semantic-state.d.ts +1741 -0
  29. package/dist/engine/compaction-semantic-state.js +1 -0
  30. package/dist/engine/compactor.d.ts +35 -3
  31. package/dist/engine/compactor.js +1 -1
  32. package/dist/engine/context-window.js +1 -1
  33. package/dist/engine/conversation-engine.d.ts +17 -4
  34. package/dist/engine/conversation-engine.js +1 -1
  35. package/dist/engine/explicit-skill-context.d.ts +103 -0
  36. package/dist/engine/explicit-skill-context.js +1 -0
  37. package/dist/engine/system-prompt.d.ts +4 -0
  38. package/dist/engine/system-prompt.js +1 -1
  39. package/dist/engine/tool-protocol-repair.d.ts +21 -0
  40. package/dist/engine/tool-protocol-repair.js +1 -0
  41. package/dist/engine/vcs-context.d.ts +3 -0
  42. package/dist/engine/vcs-context.js +1 -0
  43. package/dist/index.d.ts +6 -4
  44. package/dist/index.js +1 -1
  45. package/dist/server/protocol.d.ts +31 -0
  46. package/dist/server/protocol.js +1 -1
  47. package/dist/server/runtime-server.d.ts +21 -1
  48. package/dist/server/runtime-server.js +1 -1
  49. package/dist/store/thread-store.d.ts +96 -0
  50. package/dist/store/thread-store.js +1 -1
  51. package/dist/tool-bridge/agent-install-tool.js +1 -1
  52. package/dist/tool-bridge/bash-tool.d.ts +1 -0
  53. package/dist/tool-bridge/bash-tool.js +1 -1
  54. package/dist/tool-bridge/build-tools.d.ts +10 -1
  55. package/dist/tool-bridge/build-tools.js +1 -1
  56. package/dist/tool-bridge/naming.d.ts +10 -2
  57. package/dist/tool-bridge/naming.js +1 -1
  58. package/dist/tool-bridge/normalize-result.d.ts +73 -1
  59. package/dist/tool-bridge/normalize-result.js +1 -1
  60. package/dist/tool-bridge/session-exec-tool.d.ts +3 -2
  61. package/dist/tool-bridge/session-exec-tool.js +1 -1
  62. package/dist/tool-bridge/skill-tool.d.ts +3 -2
  63. package/dist/tool-bridge/skill-tool.js +1 -1
  64. package/dist/tool-bridge/tool-execution-coordinator.d.ts +69 -0
  65. package/dist/tool-bridge/tool-execution-coordinator.js +1 -0
  66. package/dist/tool-bridge/tool-execution-record.d.ts +148 -0
  67. package/dist/tool-bridge/tool-execution-record.js +1 -0
  68. package/dist/tool-bridge/transcript-tool.d.ts +30 -0
  69. package/dist/tool-bridge/transcript-tool.js +1 -0
  70. package/dist/types/cancellation.d.ts +18 -0
  71. package/dist/types/cancellation.js +1 -1
  72. package/dist/types/events.d.ts +20 -0
  73. package/package.json +2 -2
@@ -0,0 +1,3827 @@
1
+ import { type ModelMessage } from "ai";
2
+ import { z } from "zod";
3
+ import type { ToolExecutionRecord } from "../tool-bridge/tool-execution-record.ts";
4
+ import { createCompactionSemanticReminderProjection, type CompactionSemanticState } from "./compaction-semantic-state.ts";
5
+ export declare const COMPACTION_CHECKPOINT_VERSION: 2;
6
+ export declare const COMPACTION_CHECKPOINT_V1_VERSION: 1;
7
+ export declare class UnsupportedCompactionCheckpointVersionError extends Error {
8
+ readonly checkpointVersion: number;
9
+ constructor(checkpointVersion: number);
10
+ }
11
+ export declare const COMPACTION_GOAL_STATUSES: readonly ["active", "interrupted", "unknown"];
12
+ export declare const COMPACTION_SUMMARY_STATUSES: readonly ["valid", "fallback", "skipped"];
13
+ export declare const COMPACTION_TRANSCRIPT_COMPLETENESS: readonly ["complete", "legacy_snapshot"];
14
+ export declare const COMPACTION_SESSION_RECOVERABILITY: readonly ["live", "stale", "unavailable"];
15
+ export declare const COMPACTION_TOOL_INTEGRITY_STATUSES: readonly ["valid", "sanitized", "invalid"];
16
+ export declare const COMPACTION_TOOL_ANOMALY_KINDS: readonly ["orphan_result", "dangling_call", "duplicate_call", "duplicate_result", "record_without_call", "record_without_result", "result_without_record"];
17
+ export declare const TRANSCRIPT_MESSAGE_PROVENANCES: readonly ["native", "legacy_snapshot"];
18
+ export declare const compactionCheckpointIdSchema: z.ZodBranded<z.ZodString, "CompactionCheckpointId">;
19
+ export type CompactionCheckpointId = z.infer<typeof compactionCheckpointIdSchema>;
20
+ declare const compactionGoalSchema: z.ZodReadonly<z.ZodObject<{
21
+ verbatimRequest: z.ZodString;
22
+ sourceSequence: z.ZodNumber;
23
+ status: z.ZodEnum<["active", "interrupted", "unknown"]>;
24
+ }, "strict", z.ZodTypeAny, {
25
+ status: "unknown" | "active" | "interrupted";
26
+ sourceSequence: number;
27
+ verbatimRequest: string;
28
+ }, {
29
+ status: "unknown" | "active" | "interrupted";
30
+ sourceSequence: number;
31
+ verbatimRequest: string;
32
+ }>>;
33
+ declare const compactionConstraintSchema: z.ZodReadonly<z.ZodObject<{
34
+ quote: z.ZodString;
35
+ sourceSequence: z.ZodNumber;
36
+ }, "strict", z.ZodTypeAny, {
37
+ sourceSequence: number;
38
+ quote: string;
39
+ }, {
40
+ sourceSequence: number;
41
+ quote: string;
42
+ }>>;
43
+ declare const compactionResourceSchema: z.ZodReadonly<z.ZodObject<{
44
+ key: z.ZodString;
45
+ mode: z.ZodEnum<["read", "write"]>;
46
+ evidenceToolCallId: z.ZodString;
47
+ evidenceExecutionId: z.ZodString;
48
+ }, "strict", z.ZodTypeAny, {
49
+ mode: "read" | "write";
50
+ key: string;
51
+ evidenceToolCallId: string;
52
+ evidenceExecutionId: string;
53
+ }, {
54
+ mode: "read" | "write";
55
+ key: string;
56
+ evidenceToolCallId: string;
57
+ evidenceExecutionId: string;
58
+ }>>;
59
+ declare const compactionToolStateSchema: z.ZodReadonly<z.ZodObject<{
60
+ countsByOutcome: z.ZodReadonly<z.ZodObject<{
61
+ success: z.ZodNumber;
62
+ user_rejected: z.ZodNumber;
63
+ policy_denied: z.ZodNumber;
64
+ invalid_input: z.ZodNumber;
65
+ cancelled: z.ZodNumber;
66
+ tool_failed: z.ZodNumber;
67
+ }, "strict", z.ZodTypeAny, {
68
+ cancelled: number;
69
+ success: number;
70
+ user_rejected: number;
71
+ policy_denied: number;
72
+ invalid_input: number;
73
+ tool_failed: number;
74
+ }, {
75
+ cancelled: number;
76
+ success: number;
77
+ user_rejected: number;
78
+ policy_denied: number;
79
+ invalid_input: number;
80
+ tool_failed: number;
81
+ }>>;
82
+ recentRecords: z.ZodArray<z.ZodReadonly<z.ZodObject<{
83
+ executionId: z.ZodString;
84
+ sequence: z.ZodNumber;
85
+ toolCallId: z.ZodString;
86
+ agentName: z.ZodString;
87
+ toolName: z.ZodString;
88
+ outcome: z.ZodReadonly<z.ZodObject<{
89
+ kind: z.ZodEnum<["success", "user_rejected", "policy_denied", "invalid_input", "cancelled", "tool_failed"]>;
90
+ reason: z.ZodOptional<z.ZodString>;
91
+ }, "strict", z.ZodTypeAny, {
92
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
93
+ reason?: string | undefined;
94
+ }, {
95
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
96
+ reason?: string | undefined;
97
+ }>>;
98
+ }, "strict", z.ZodTypeAny, {
99
+ toolCallId: string;
100
+ toolName: string;
101
+ agentName: string;
102
+ outcome: Readonly<{
103
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
104
+ reason?: string | undefined;
105
+ }>;
106
+ sequence: number;
107
+ executionId: string;
108
+ }, {
109
+ toolCallId: string;
110
+ toolName: string;
111
+ agentName: string;
112
+ outcome: Readonly<{
113
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
114
+ reason?: string | undefined;
115
+ }>;
116
+ sequence: number;
117
+ executionId: string;
118
+ }>>, "many">;
119
+ integrityStatus: z.ZodEnum<["valid", "sanitized", "invalid"]>;
120
+ anomalies: z.ZodArray<z.ZodReadonly<z.ZodObject<{
121
+ kind: z.ZodEnum<["orphan_result", "dangling_call", "duplicate_call", "duplicate_result", "record_without_call", "record_without_result", "result_without_record"]>;
122
+ toolCallId: z.ZodString;
123
+ count: z.ZodOptional<z.ZodNumber>;
124
+ }, "strict", z.ZodTypeAny, {
125
+ toolCallId: string;
126
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
127
+ count?: number | undefined;
128
+ }, {
129
+ toolCallId: string;
130
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
131
+ count?: number | undefined;
132
+ }>>, "many">;
133
+ }, "strict", z.ZodTypeAny, {
134
+ countsByOutcome: Readonly<{
135
+ cancelled: number;
136
+ success: number;
137
+ user_rejected: number;
138
+ policy_denied: number;
139
+ invalid_input: number;
140
+ tool_failed: number;
141
+ }>;
142
+ recentRecords: Readonly<{
143
+ toolCallId: string;
144
+ toolName: string;
145
+ agentName: string;
146
+ outcome: Readonly<{
147
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
148
+ reason?: string | undefined;
149
+ }>;
150
+ sequence: number;
151
+ executionId: string;
152
+ }>[];
153
+ integrityStatus: "invalid" | "valid" | "sanitized";
154
+ anomalies: Readonly<{
155
+ toolCallId: string;
156
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
157
+ count?: number | undefined;
158
+ }>[];
159
+ }, {
160
+ countsByOutcome: Readonly<{
161
+ cancelled: number;
162
+ success: number;
163
+ user_rejected: number;
164
+ policy_denied: number;
165
+ invalid_input: number;
166
+ tool_failed: number;
167
+ }>;
168
+ recentRecords: Readonly<{
169
+ toolCallId: string;
170
+ toolName: string;
171
+ agentName: string;
172
+ outcome: Readonly<{
173
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
174
+ reason?: string | undefined;
175
+ }>;
176
+ sequence: number;
177
+ executionId: string;
178
+ }>[];
179
+ integrityStatus: "invalid" | "valid" | "sanitized";
180
+ anomalies: Readonly<{
181
+ toolCallId: string;
182
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
183
+ count?: number | undefined;
184
+ }>[];
185
+ }>>;
186
+ declare const compactionRunningWorkSchema: z.ZodReadonly<z.ZodObject<{
187
+ managerInstanceId: z.ZodString;
188
+ sessionId: z.ZodNumber;
189
+ state: z.ZodEnum<["running", "draining", "stopping", "completed", "cleanup-failed"]>;
190
+ recoverability: z.ZodEnum<["live", "stale", "unavailable"]>;
191
+ commandPreview: z.ZodString;
192
+ workdir: z.ZodString;
193
+ observedAt: z.ZodString;
194
+ wallTimeMs: z.ZodOptional<z.ZodNumber>;
195
+ exitCode: z.ZodOptional<z.ZodNumber>;
196
+ terminationCause: z.ZodOptional<z.ZodString>;
197
+ cleanupError: z.ZodOptional<z.ZodString>;
198
+ }, "strict", z.ZodTypeAny, {
199
+ workdir: string;
200
+ managerInstanceId: string;
201
+ sessionId: number;
202
+ state: "completed" | "running" | "draining" | "stopping" | "cleanup-failed";
203
+ recoverability: "live" | "stale" | "unavailable";
204
+ commandPreview: string;
205
+ observedAt: string;
206
+ terminationCause?: string | undefined;
207
+ wallTimeMs?: number | undefined;
208
+ exitCode?: number | undefined;
209
+ cleanupError?: string | undefined;
210
+ }, {
211
+ workdir: string;
212
+ managerInstanceId: string;
213
+ sessionId: number;
214
+ state: "completed" | "running" | "draining" | "stopping" | "cleanup-failed";
215
+ recoverability: "live" | "stale" | "unavailable";
216
+ commandPreview: string;
217
+ observedAt: string;
218
+ terminationCause?: string | undefined;
219
+ wallTimeMs?: number | undefined;
220
+ exitCode?: number | undefined;
221
+ cleanupError?: string | undefined;
222
+ }>>;
223
+ declare const compactionContextSchema: z.ZodReadonly<z.ZodObject<{
224
+ cwd: z.ZodString;
225
+ stableRuleIds: z.ZodArray<z.ZodString, "many">;
226
+ systemPromptSha256: z.ZodOptional<z.ZodString>;
227
+ skills: z.ZodArray<z.ZodReadonly<z.ZodObject<{
228
+ name: z.ZodString;
229
+ source: z.ZodEnum<["agent", "project", "user", "config"]>;
230
+ }, "strict", z.ZodTypeAny, {
231
+ name: string;
232
+ source: "config" | "user" | "agent" | "project";
233
+ }, {
234
+ name: string;
235
+ source: "config" | "user" | "agent" | "project";
236
+ }>>, "many">;
237
+ explicitSkillNames: z.ZodArray<z.ZodString, "many">;
238
+ }, "strict", z.ZodTypeAny, {
239
+ skills: Readonly<{
240
+ name: string;
241
+ source: "config" | "user" | "agent" | "project";
242
+ }>[];
243
+ cwd: string;
244
+ stableRuleIds: string[];
245
+ explicitSkillNames: string[];
246
+ systemPromptSha256?: string | undefined;
247
+ }, {
248
+ skills: Readonly<{
249
+ name: string;
250
+ source: "config" | "user" | "agent" | "project";
251
+ }>[];
252
+ cwd: string;
253
+ stableRuleIds: string[];
254
+ explicitSkillNames: string[];
255
+ systemPromptSha256?: string | undefined;
256
+ }>>;
257
+ export declare const compactionTranscriptRangeSchema: z.ZodEffects<z.ZodObject<{
258
+ fromSequenceExclusive: z.ZodNumber;
259
+ throughSequence: z.ZodNumber;
260
+ }, "strict", z.ZodTypeAny, {
261
+ fromSequenceExclusive: number;
262
+ throughSequence: number;
263
+ }, {
264
+ fromSequenceExclusive: number;
265
+ throughSequence: number;
266
+ }>, {
267
+ fromSequenceExclusive: number;
268
+ throughSequence: number;
269
+ }, {
270
+ fromSequenceExclusive: number;
271
+ throughSequence: number;
272
+ }>;
273
+ declare const compactionTranscriptSchema: z.ZodReadonly<z.ZodObject<{
274
+ messages: z.ZodEffects<z.ZodObject<{
275
+ fromSequenceExclusive: z.ZodNumber;
276
+ throughSequence: z.ZodNumber;
277
+ }, "strict", z.ZodTypeAny, {
278
+ fromSequenceExclusive: number;
279
+ throughSequence: number;
280
+ }, {
281
+ fromSequenceExclusive: number;
282
+ throughSequence: number;
283
+ }>, {
284
+ fromSequenceExclusive: number;
285
+ throughSequence: number;
286
+ }, {
287
+ fromSequenceExclusive: number;
288
+ throughSequence: number;
289
+ }>;
290
+ toolExecutions: z.ZodEffects<z.ZodObject<{
291
+ fromSequenceExclusive: z.ZodNumber;
292
+ throughSequence: z.ZodNumber;
293
+ }, "strict", z.ZodTypeAny, {
294
+ fromSequenceExclusive: number;
295
+ throughSequence: number;
296
+ }, {
297
+ fromSequenceExclusive: number;
298
+ throughSequence: number;
299
+ }>, {
300
+ fromSequenceExclusive: number;
301
+ throughSequence: number;
302
+ }, {
303
+ fromSequenceExclusive: number;
304
+ throughSequence: number;
305
+ }>;
306
+ completeness: z.ZodEnum<["complete", "legacy_snapshot"]>;
307
+ }, "strict", z.ZodTypeAny, {
308
+ messages: {
309
+ fromSequenceExclusive: number;
310
+ throughSequence: number;
311
+ };
312
+ toolExecutions: {
313
+ fromSequenceExclusive: number;
314
+ throughSequence: number;
315
+ };
316
+ completeness: "legacy_snapshot" | "complete";
317
+ }, {
318
+ messages: {
319
+ fromSequenceExclusive: number;
320
+ throughSequence: number;
321
+ };
322
+ toolExecutions: {
323
+ fromSequenceExclusive: number;
324
+ throughSequence: number;
325
+ };
326
+ completeness: "legacy_snapshot" | "complete";
327
+ }>>;
328
+ export declare const compactionSemanticEvidenceWatermarksSchema: z.ZodReadonly<z.ZodObject<{
329
+ messagesThroughSequence: z.ZodNumber;
330
+ toolExecutionsThroughSequence: z.ZodNumber;
331
+ }, "strict", z.ZodTypeAny, {
332
+ messagesThroughSequence: number;
333
+ toolExecutionsThroughSequence: number;
334
+ }, {
335
+ messagesThroughSequence: number;
336
+ toolExecutionsThroughSequence: number;
337
+ }>>;
338
+ declare const compactionSummarySchema: z.ZodReadonly<z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
339
+ status: z.ZodLiteral<"valid">;
340
+ digest: z.ZodString;
341
+ }, "strict", z.ZodTypeAny, {
342
+ status: "valid";
343
+ digest: string;
344
+ }, {
345
+ status: "valid";
346
+ digest: string;
347
+ }>, z.ZodObject<{
348
+ status: z.ZodLiteral<"fallback">;
349
+ reason: z.ZodString;
350
+ lastValidCheckpointId: z.ZodOptional<z.ZodBranded<z.ZodString, "CompactionCheckpointId">>;
351
+ }, "strict", z.ZodTypeAny, {
352
+ status: "fallback";
353
+ reason: string;
354
+ lastValidCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
355
+ }, {
356
+ status: "fallback";
357
+ reason: string;
358
+ lastValidCheckpointId?: string | undefined;
359
+ }>, z.ZodObject<{
360
+ status: z.ZodLiteral<"skipped">;
361
+ lastValidCheckpointId: z.ZodOptional<z.ZodBranded<z.ZodString, "CompactionCheckpointId">>;
362
+ }, "strict", z.ZodTypeAny, {
363
+ status: "skipped";
364
+ lastValidCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
365
+ }, {
366
+ status: "skipped";
367
+ lastValidCheckpointId?: string | undefined;
368
+ }>]>>;
369
+ export declare const compactionCheckpointDraftSchema: z.ZodReadonly<z.ZodObject<{
370
+ goal: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
371
+ verbatimRequest: z.ZodString;
372
+ sourceSequence: z.ZodNumber;
373
+ status: z.ZodEnum<["active", "interrupted", "unknown"]>;
374
+ }, "strict", z.ZodTypeAny, {
375
+ status: "unknown" | "active" | "interrupted";
376
+ sourceSequence: number;
377
+ verbatimRequest: string;
378
+ }, {
379
+ status: "unknown" | "active" | "interrupted";
380
+ sourceSequence: number;
381
+ verbatimRequest: string;
382
+ }>>>;
383
+ constraints: z.ZodArray<z.ZodReadonly<z.ZodObject<{
384
+ quote: z.ZodString;
385
+ sourceSequence: z.ZodNumber;
386
+ }, "strict", z.ZodTypeAny, {
387
+ sourceSequence: number;
388
+ quote: string;
389
+ }, {
390
+ sourceSequence: number;
391
+ quote: string;
392
+ }>>, "many">;
393
+ resources: z.ZodArray<z.ZodReadonly<z.ZodObject<{
394
+ key: z.ZodString;
395
+ mode: z.ZodEnum<["read", "write"]>;
396
+ evidenceToolCallId: z.ZodString;
397
+ evidenceExecutionId: z.ZodString;
398
+ }, "strict", z.ZodTypeAny, {
399
+ mode: "read" | "write";
400
+ key: string;
401
+ evidenceToolCallId: string;
402
+ evidenceExecutionId: string;
403
+ }, {
404
+ mode: "read" | "write";
405
+ key: string;
406
+ evidenceToolCallId: string;
407
+ evidenceExecutionId: string;
408
+ }>>, "many">;
409
+ toolState: z.ZodReadonly<z.ZodObject<{
410
+ countsByOutcome: z.ZodReadonly<z.ZodObject<{
411
+ success: z.ZodNumber;
412
+ user_rejected: z.ZodNumber;
413
+ policy_denied: z.ZodNumber;
414
+ invalid_input: z.ZodNumber;
415
+ cancelled: z.ZodNumber;
416
+ tool_failed: z.ZodNumber;
417
+ }, "strict", z.ZodTypeAny, {
418
+ cancelled: number;
419
+ success: number;
420
+ user_rejected: number;
421
+ policy_denied: number;
422
+ invalid_input: number;
423
+ tool_failed: number;
424
+ }, {
425
+ cancelled: number;
426
+ success: number;
427
+ user_rejected: number;
428
+ policy_denied: number;
429
+ invalid_input: number;
430
+ tool_failed: number;
431
+ }>>;
432
+ recentRecords: z.ZodArray<z.ZodReadonly<z.ZodObject<{
433
+ executionId: z.ZodString;
434
+ sequence: z.ZodNumber;
435
+ toolCallId: z.ZodString;
436
+ agentName: z.ZodString;
437
+ toolName: z.ZodString;
438
+ outcome: z.ZodReadonly<z.ZodObject<{
439
+ kind: z.ZodEnum<["success", "user_rejected", "policy_denied", "invalid_input", "cancelled", "tool_failed"]>;
440
+ reason: z.ZodOptional<z.ZodString>;
441
+ }, "strict", z.ZodTypeAny, {
442
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
443
+ reason?: string | undefined;
444
+ }, {
445
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
446
+ reason?: string | undefined;
447
+ }>>;
448
+ }, "strict", z.ZodTypeAny, {
449
+ toolCallId: string;
450
+ toolName: string;
451
+ agentName: string;
452
+ outcome: Readonly<{
453
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
454
+ reason?: string | undefined;
455
+ }>;
456
+ sequence: number;
457
+ executionId: string;
458
+ }, {
459
+ toolCallId: string;
460
+ toolName: string;
461
+ agentName: string;
462
+ outcome: Readonly<{
463
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
464
+ reason?: string | undefined;
465
+ }>;
466
+ sequence: number;
467
+ executionId: string;
468
+ }>>, "many">;
469
+ integrityStatus: z.ZodEnum<["valid", "sanitized", "invalid"]>;
470
+ anomalies: z.ZodArray<z.ZodReadonly<z.ZodObject<{
471
+ kind: z.ZodEnum<["orphan_result", "dangling_call", "duplicate_call", "duplicate_result", "record_without_call", "record_without_result", "result_without_record"]>;
472
+ toolCallId: z.ZodString;
473
+ count: z.ZodOptional<z.ZodNumber>;
474
+ }, "strict", z.ZodTypeAny, {
475
+ toolCallId: string;
476
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
477
+ count?: number | undefined;
478
+ }, {
479
+ toolCallId: string;
480
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
481
+ count?: number | undefined;
482
+ }>>, "many">;
483
+ }, "strict", z.ZodTypeAny, {
484
+ countsByOutcome: Readonly<{
485
+ cancelled: number;
486
+ success: number;
487
+ user_rejected: number;
488
+ policy_denied: number;
489
+ invalid_input: number;
490
+ tool_failed: number;
491
+ }>;
492
+ recentRecords: Readonly<{
493
+ toolCallId: string;
494
+ toolName: string;
495
+ agentName: string;
496
+ outcome: Readonly<{
497
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
498
+ reason?: string | undefined;
499
+ }>;
500
+ sequence: number;
501
+ executionId: string;
502
+ }>[];
503
+ integrityStatus: "invalid" | "valid" | "sanitized";
504
+ anomalies: Readonly<{
505
+ toolCallId: string;
506
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
507
+ count?: number | undefined;
508
+ }>[];
509
+ }, {
510
+ countsByOutcome: Readonly<{
511
+ cancelled: number;
512
+ success: number;
513
+ user_rejected: number;
514
+ policy_denied: number;
515
+ invalid_input: number;
516
+ tool_failed: number;
517
+ }>;
518
+ recentRecords: Readonly<{
519
+ toolCallId: string;
520
+ toolName: string;
521
+ agentName: string;
522
+ outcome: Readonly<{
523
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
524
+ reason?: string | undefined;
525
+ }>;
526
+ sequence: number;
527
+ executionId: string;
528
+ }>[];
529
+ integrityStatus: "invalid" | "valid" | "sanitized";
530
+ anomalies: Readonly<{
531
+ toolCallId: string;
532
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
533
+ count?: number | undefined;
534
+ }>[];
535
+ }>>;
536
+ runningWork: z.ZodArray<z.ZodReadonly<z.ZodObject<{
537
+ managerInstanceId: z.ZodString;
538
+ sessionId: z.ZodNumber;
539
+ state: z.ZodEnum<["running", "draining", "stopping", "completed", "cleanup-failed"]>;
540
+ recoverability: z.ZodEnum<["live", "stale", "unavailable"]>;
541
+ commandPreview: z.ZodString;
542
+ workdir: z.ZodString;
543
+ observedAt: z.ZodString;
544
+ wallTimeMs: z.ZodOptional<z.ZodNumber>;
545
+ exitCode: z.ZodOptional<z.ZodNumber>;
546
+ terminationCause: z.ZodOptional<z.ZodString>;
547
+ cleanupError: z.ZodOptional<z.ZodString>;
548
+ }, "strict", z.ZodTypeAny, {
549
+ workdir: string;
550
+ managerInstanceId: string;
551
+ sessionId: number;
552
+ state: "completed" | "running" | "draining" | "stopping" | "cleanup-failed";
553
+ recoverability: "live" | "stale" | "unavailable";
554
+ commandPreview: string;
555
+ observedAt: string;
556
+ terminationCause?: string | undefined;
557
+ wallTimeMs?: number | undefined;
558
+ exitCode?: number | undefined;
559
+ cleanupError?: string | undefined;
560
+ }, {
561
+ workdir: string;
562
+ managerInstanceId: string;
563
+ sessionId: number;
564
+ state: "completed" | "running" | "draining" | "stopping" | "cleanup-failed";
565
+ recoverability: "live" | "stale" | "unavailable";
566
+ commandPreview: string;
567
+ observedAt: string;
568
+ terminationCause?: string | undefined;
569
+ wallTimeMs?: number | undefined;
570
+ exitCode?: number | undefined;
571
+ cleanupError?: string | undefined;
572
+ }>>, "many">;
573
+ context: z.ZodReadonly<z.ZodObject<{
574
+ cwd: z.ZodString;
575
+ stableRuleIds: z.ZodArray<z.ZodString, "many">;
576
+ systemPromptSha256: z.ZodOptional<z.ZodString>;
577
+ skills: z.ZodArray<z.ZodReadonly<z.ZodObject<{
578
+ name: z.ZodString;
579
+ source: z.ZodEnum<["agent", "project", "user", "config"]>;
580
+ }, "strict", z.ZodTypeAny, {
581
+ name: string;
582
+ source: "config" | "user" | "agent" | "project";
583
+ }, {
584
+ name: string;
585
+ source: "config" | "user" | "agent" | "project";
586
+ }>>, "many">;
587
+ explicitSkillNames: z.ZodArray<z.ZodString, "many">;
588
+ }, "strict", z.ZodTypeAny, {
589
+ skills: Readonly<{
590
+ name: string;
591
+ source: "config" | "user" | "agent" | "project";
592
+ }>[];
593
+ cwd: string;
594
+ stableRuleIds: string[];
595
+ explicitSkillNames: string[];
596
+ systemPromptSha256?: string | undefined;
597
+ }, {
598
+ skills: Readonly<{
599
+ name: string;
600
+ source: "config" | "user" | "agent" | "project";
601
+ }>[];
602
+ cwd: string;
603
+ stableRuleIds: string[];
604
+ explicitSkillNames: string[];
605
+ systemPromptSha256?: string | undefined;
606
+ }>>;
607
+ summary: z.ZodReadonly<z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
608
+ status: z.ZodLiteral<"valid">;
609
+ digest: z.ZodString;
610
+ }, "strict", z.ZodTypeAny, {
611
+ status: "valid";
612
+ digest: string;
613
+ }, {
614
+ status: "valid";
615
+ digest: string;
616
+ }>, z.ZodObject<{
617
+ status: z.ZodLiteral<"fallback">;
618
+ reason: z.ZodString;
619
+ lastValidCheckpointId: z.ZodOptional<z.ZodBranded<z.ZodString, "CompactionCheckpointId">>;
620
+ }, "strict", z.ZodTypeAny, {
621
+ status: "fallback";
622
+ reason: string;
623
+ lastValidCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
624
+ }, {
625
+ status: "fallback";
626
+ reason: string;
627
+ lastValidCheckpointId?: string | undefined;
628
+ }>, z.ZodObject<{
629
+ status: z.ZodLiteral<"skipped">;
630
+ lastValidCheckpointId: z.ZodOptional<z.ZodBranded<z.ZodString, "CompactionCheckpointId">>;
631
+ }, "strict", z.ZodTypeAny, {
632
+ status: "skipped";
633
+ lastValidCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
634
+ }, {
635
+ status: "skipped";
636
+ lastValidCheckpointId?: string | undefined;
637
+ }>]>>;
638
+ }, "strict", z.ZodTypeAny, {
639
+ context: Readonly<{
640
+ skills: Readonly<{
641
+ name: string;
642
+ source: "config" | "user" | "agent" | "project";
643
+ }>[];
644
+ cwd: string;
645
+ stableRuleIds: string[];
646
+ explicitSkillNames: string[];
647
+ systemPromptSha256?: string | undefined;
648
+ }>;
649
+ summary: Readonly<{
650
+ status: "valid";
651
+ digest: string;
652
+ }> | Readonly<{
653
+ status: "fallback";
654
+ reason: string;
655
+ lastValidCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
656
+ }> | Readonly<{
657
+ status: "skipped";
658
+ lastValidCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
659
+ }>;
660
+ resources: Readonly<{
661
+ mode: "read" | "write";
662
+ key: string;
663
+ evidenceToolCallId: string;
664
+ evidenceExecutionId: string;
665
+ }>[];
666
+ constraints: Readonly<{
667
+ sourceSequence: number;
668
+ quote: string;
669
+ }>[];
670
+ toolState: Readonly<{
671
+ countsByOutcome: Readonly<{
672
+ cancelled: number;
673
+ success: number;
674
+ user_rejected: number;
675
+ policy_denied: number;
676
+ invalid_input: number;
677
+ tool_failed: number;
678
+ }>;
679
+ recentRecords: Readonly<{
680
+ toolCallId: string;
681
+ toolName: string;
682
+ agentName: string;
683
+ outcome: Readonly<{
684
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
685
+ reason?: string | undefined;
686
+ }>;
687
+ sequence: number;
688
+ executionId: string;
689
+ }>[];
690
+ integrityStatus: "invalid" | "valid" | "sanitized";
691
+ anomalies: Readonly<{
692
+ toolCallId: string;
693
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
694
+ count?: number | undefined;
695
+ }>[];
696
+ }>;
697
+ runningWork: Readonly<{
698
+ workdir: string;
699
+ managerInstanceId: string;
700
+ sessionId: number;
701
+ state: "completed" | "running" | "draining" | "stopping" | "cleanup-failed";
702
+ recoverability: "live" | "stale" | "unavailable";
703
+ commandPreview: string;
704
+ observedAt: string;
705
+ terminationCause?: string | undefined;
706
+ wallTimeMs?: number | undefined;
707
+ exitCode?: number | undefined;
708
+ cleanupError?: string | undefined;
709
+ }>[];
710
+ goal?: Readonly<{
711
+ status: "unknown" | "active" | "interrupted";
712
+ sourceSequence: number;
713
+ verbatimRequest: string;
714
+ }> | undefined;
715
+ }, {
716
+ context: Readonly<{
717
+ skills: Readonly<{
718
+ name: string;
719
+ source: "config" | "user" | "agent" | "project";
720
+ }>[];
721
+ cwd: string;
722
+ stableRuleIds: string[];
723
+ explicitSkillNames: string[];
724
+ systemPromptSha256?: string | undefined;
725
+ }>;
726
+ summary: Readonly<{
727
+ status: "valid";
728
+ digest: string;
729
+ }> | Readonly<{
730
+ status: "fallback";
731
+ reason: string;
732
+ lastValidCheckpointId?: string | undefined;
733
+ }> | Readonly<{
734
+ status: "skipped";
735
+ lastValidCheckpointId?: string | undefined;
736
+ }>;
737
+ resources: Readonly<{
738
+ mode: "read" | "write";
739
+ key: string;
740
+ evidenceToolCallId: string;
741
+ evidenceExecutionId: string;
742
+ }>[];
743
+ constraints: Readonly<{
744
+ sourceSequence: number;
745
+ quote: string;
746
+ }>[];
747
+ toolState: Readonly<{
748
+ countsByOutcome: Readonly<{
749
+ cancelled: number;
750
+ success: number;
751
+ user_rejected: number;
752
+ policy_denied: number;
753
+ invalid_input: number;
754
+ tool_failed: number;
755
+ }>;
756
+ recentRecords: Readonly<{
757
+ toolCallId: string;
758
+ toolName: string;
759
+ agentName: string;
760
+ outcome: Readonly<{
761
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
762
+ reason?: string | undefined;
763
+ }>;
764
+ sequence: number;
765
+ executionId: string;
766
+ }>[];
767
+ integrityStatus: "invalid" | "valid" | "sanitized";
768
+ anomalies: Readonly<{
769
+ toolCallId: string;
770
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
771
+ count?: number | undefined;
772
+ }>[];
773
+ }>;
774
+ runningWork: Readonly<{
775
+ workdir: string;
776
+ managerInstanceId: string;
777
+ sessionId: number;
778
+ state: "completed" | "running" | "draining" | "stopping" | "cleanup-failed";
779
+ recoverability: "live" | "stale" | "unavailable";
780
+ commandPreview: string;
781
+ observedAt: string;
782
+ terminationCause?: string | undefined;
783
+ wallTimeMs?: number | undefined;
784
+ exitCode?: number | undefined;
785
+ cleanupError?: string | undefined;
786
+ }>[];
787
+ goal?: Readonly<{
788
+ status: "unknown" | "active" | "interrupted";
789
+ sourceSequence: number;
790
+ verbatimRequest: string;
791
+ }> | undefined;
792
+ }>>;
793
+ export declare const compactionCheckpointV1Schema: z.ZodReadonly<z.ZodObject<{
794
+ version: z.ZodLiteral<1>;
795
+ id: z.ZodBranded<z.ZodString, "CompactionCheckpointId">;
796
+ generation: z.ZodNumber;
797
+ previousCheckpointId: z.ZodOptional<z.ZodBranded<z.ZodString, "CompactionCheckpointId">>;
798
+ createdAt: z.ZodString;
799
+ transcript: z.ZodReadonly<z.ZodObject<{
800
+ messages: z.ZodEffects<z.ZodObject<{
801
+ fromSequenceExclusive: z.ZodNumber;
802
+ throughSequence: z.ZodNumber;
803
+ }, "strict", z.ZodTypeAny, {
804
+ fromSequenceExclusive: number;
805
+ throughSequence: number;
806
+ }, {
807
+ fromSequenceExclusive: number;
808
+ throughSequence: number;
809
+ }>, {
810
+ fromSequenceExclusive: number;
811
+ throughSequence: number;
812
+ }, {
813
+ fromSequenceExclusive: number;
814
+ throughSequence: number;
815
+ }>;
816
+ toolExecutions: z.ZodEffects<z.ZodObject<{
817
+ fromSequenceExclusive: z.ZodNumber;
818
+ throughSequence: z.ZodNumber;
819
+ }, "strict", z.ZodTypeAny, {
820
+ fromSequenceExclusive: number;
821
+ throughSequence: number;
822
+ }, {
823
+ fromSequenceExclusive: number;
824
+ throughSequence: number;
825
+ }>, {
826
+ fromSequenceExclusive: number;
827
+ throughSequence: number;
828
+ }, {
829
+ fromSequenceExclusive: number;
830
+ throughSequence: number;
831
+ }>;
832
+ completeness: z.ZodEnum<["complete", "legacy_snapshot"]>;
833
+ }, "strict", z.ZodTypeAny, {
834
+ messages: {
835
+ fromSequenceExclusive: number;
836
+ throughSequence: number;
837
+ };
838
+ toolExecutions: {
839
+ fromSequenceExclusive: number;
840
+ throughSequence: number;
841
+ };
842
+ completeness: "legacy_snapshot" | "complete";
843
+ }, {
844
+ messages: {
845
+ fromSequenceExclusive: number;
846
+ throughSequence: number;
847
+ };
848
+ toolExecutions: {
849
+ fromSequenceExclusive: number;
850
+ throughSequence: number;
851
+ };
852
+ completeness: "legacy_snapshot" | "complete";
853
+ }>>;
854
+ goal: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
855
+ verbatimRequest: z.ZodString;
856
+ sourceSequence: z.ZodNumber;
857
+ status: z.ZodEnum<["active", "interrupted", "unknown"]>;
858
+ }, "strict", z.ZodTypeAny, {
859
+ status: "unknown" | "active" | "interrupted";
860
+ sourceSequence: number;
861
+ verbatimRequest: string;
862
+ }, {
863
+ status: "unknown" | "active" | "interrupted";
864
+ sourceSequence: number;
865
+ verbatimRequest: string;
866
+ }>>>;
867
+ constraints: z.ZodArray<z.ZodReadonly<z.ZodObject<{
868
+ quote: z.ZodString;
869
+ sourceSequence: z.ZodNumber;
870
+ }, "strict", z.ZodTypeAny, {
871
+ sourceSequence: number;
872
+ quote: string;
873
+ }, {
874
+ sourceSequence: number;
875
+ quote: string;
876
+ }>>, "many">;
877
+ resources: z.ZodArray<z.ZodReadonly<z.ZodObject<{
878
+ key: z.ZodString;
879
+ mode: z.ZodEnum<["read", "write"]>;
880
+ evidenceToolCallId: z.ZodString;
881
+ evidenceExecutionId: z.ZodString;
882
+ }, "strict", z.ZodTypeAny, {
883
+ mode: "read" | "write";
884
+ key: string;
885
+ evidenceToolCallId: string;
886
+ evidenceExecutionId: string;
887
+ }, {
888
+ mode: "read" | "write";
889
+ key: string;
890
+ evidenceToolCallId: string;
891
+ evidenceExecutionId: string;
892
+ }>>, "many">;
893
+ toolState: z.ZodReadonly<z.ZodObject<{
894
+ countsByOutcome: z.ZodReadonly<z.ZodObject<{
895
+ success: z.ZodNumber;
896
+ user_rejected: z.ZodNumber;
897
+ policy_denied: z.ZodNumber;
898
+ invalid_input: z.ZodNumber;
899
+ cancelled: z.ZodNumber;
900
+ tool_failed: z.ZodNumber;
901
+ }, "strict", z.ZodTypeAny, {
902
+ cancelled: number;
903
+ success: number;
904
+ user_rejected: number;
905
+ policy_denied: number;
906
+ invalid_input: number;
907
+ tool_failed: number;
908
+ }, {
909
+ cancelled: number;
910
+ success: number;
911
+ user_rejected: number;
912
+ policy_denied: number;
913
+ invalid_input: number;
914
+ tool_failed: number;
915
+ }>>;
916
+ recentRecords: z.ZodArray<z.ZodReadonly<z.ZodObject<{
917
+ executionId: z.ZodString;
918
+ sequence: z.ZodNumber;
919
+ toolCallId: z.ZodString;
920
+ agentName: z.ZodString;
921
+ toolName: z.ZodString;
922
+ outcome: z.ZodReadonly<z.ZodObject<{
923
+ kind: z.ZodEnum<["success", "user_rejected", "policy_denied", "invalid_input", "cancelled", "tool_failed"]>;
924
+ reason: z.ZodOptional<z.ZodString>;
925
+ }, "strict", z.ZodTypeAny, {
926
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
927
+ reason?: string | undefined;
928
+ }, {
929
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
930
+ reason?: string | undefined;
931
+ }>>;
932
+ }, "strict", z.ZodTypeAny, {
933
+ toolCallId: string;
934
+ toolName: string;
935
+ agentName: string;
936
+ outcome: Readonly<{
937
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
938
+ reason?: string | undefined;
939
+ }>;
940
+ sequence: number;
941
+ executionId: string;
942
+ }, {
943
+ toolCallId: string;
944
+ toolName: string;
945
+ agentName: string;
946
+ outcome: Readonly<{
947
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
948
+ reason?: string | undefined;
949
+ }>;
950
+ sequence: number;
951
+ executionId: string;
952
+ }>>, "many">;
953
+ integrityStatus: z.ZodEnum<["valid", "sanitized", "invalid"]>;
954
+ anomalies: z.ZodArray<z.ZodReadonly<z.ZodObject<{
955
+ kind: z.ZodEnum<["orphan_result", "dangling_call", "duplicate_call", "duplicate_result", "record_without_call", "record_without_result", "result_without_record"]>;
956
+ toolCallId: z.ZodString;
957
+ count: z.ZodOptional<z.ZodNumber>;
958
+ }, "strict", z.ZodTypeAny, {
959
+ toolCallId: string;
960
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
961
+ count?: number | undefined;
962
+ }, {
963
+ toolCallId: string;
964
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
965
+ count?: number | undefined;
966
+ }>>, "many">;
967
+ }, "strict", z.ZodTypeAny, {
968
+ countsByOutcome: Readonly<{
969
+ cancelled: number;
970
+ success: number;
971
+ user_rejected: number;
972
+ policy_denied: number;
973
+ invalid_input: number;
974
+ tool_failed: number;
975
+ }>;
976
+ recentRecords: Readonly<{
977
+ toolCallId: string;
978
+ toolName: string;
979
+ agentName: string;
980
+ outcome: Readonly<{
981
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
982
+ reason?: string | undefined;
983
+ }>;
984
+ sequence: number;
985
+ executionId: string;
986
+ }>[];
987
+ integrityStatus: "invalid" | "valid" | "sanitized";
988
+ anomalies: Readonly<{
989
+ toolCallId: string;
990
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
991
+ count?: number | undefined;
992
+ }>[];
993
+ }, {
994
+ countsByOutcome: Readonly<{
995
+ cancelled: number;
996
+ success: number;
997
+ user_rejected: number;
998
+ policy_denied: number;
999
+ invalid_input: number;
1000
+ tool_failed: number;
1001
+ }>;
1002
+ recentRecords: Readonly<{
1003
+ toolCallId: string;
1004
+ toolName: string;
1005
+ agentName: string;
1006
+ outcome: Readonly<{
1007
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
1008
+ reason?: string | undefined;
1009
+ }>;
1010
+ sequence: number;
1011
+ executionId: string;
1012
+ }>[];
1013
+ integrityStatus: "invalid" | "valid" | "sanitized";
1014
+ anomalies: Readonly<{
1015
+ toolCallId: string;
1016
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
1017
+ count?: number | undefined;
1018
+ }>[];
1019
+ }>>;
1020
+ runningWork: z.ZodArray<z.ZodReadonly<z.ZodObject<{
1021
+ managerInstanceId: z.ZodString;
1022
+ sessionId: z.ZodNumber;
1023
+ state: z.ZodEnum<["running", "draining", "stopping", "completed", "cleanup-failed"]>;
1024
+ recoverability: z.ZodEnum<["live", "stale", "unavailable"]>;
1025
+ commandPreview: z.ZodString;
1026
+ workdir: z.ZodString;
1027
+ observedAt: z.ZodString;
1028
+ wallTimeMs: z.ZodOptional<z.ZodNumber>;
1029
+ exitCode: z.ZodOptional<z.ZodNumber>;
1030
+ terminationCause: z.ZodOptional<z.ZodString>;
1031
+ cleanupError: z.ZodOptional<z.ZodString>;
1032
+ }, "strict", z.ZodTypeAny, {
1033
+ workdir: string;
1034
+ managerInstanceId: string;
1035
+ sessionId: number;
1036
+ state: "completed" | "running" | "draining" | "stopping" | "cleanup-failed";
1037
+ recoverability: "live" | "stale" | "unavailable";
1038
+ commandPreview: string;
1039
+ observedAt: string;
1040
+ terminationCause?: string | undefined;
1041
+ wallTimeMs?: number | undefined;
1042
+ exitCode?: number | undefined;
1043
+ cleanupError?: string | undefined;
1044
+ }, {
1045
+ workdir: string;
1046
+ managerInstanceId: string;
1047
+ sessionId: number;
1048
+ state: "completed" | "running" | "draining" | "stopping" | "cleanup-failed";
1049
+ recoverability: "live" | "stale" | "unavailable";
1050
+ commandPreview: string;
1051
+ observedAt: string;
1052
+ terminationCause?: string | undefined;
1053
+ wallTimeMs?: number | undefined;
1054
+ exitCode?: number | undefined;
1055
+ cleanupError?: string | undefined;
1056
+ }>>, "many">;
1057
+ context: z.ZodReadonly<z.ZodObject<{
1058
+ cwd: z.ZodString;
1059
+ stableRuleIds: z.ZodArray<z.ZodString, "many">;
1060
+ systemPromptSha256: z.ZodOptional<z.ZodString>;
1061
+ skills: z.ZodArray<z.ZodReadonly<z.ZodObject<{
1062
+ name: z.ZodString;
1063
+ source: z.ZodEnum<["agent", "project", "user", "config"]>;
1064
+ }, "strict", z.ZodTypeAny, {
1065
+ name: string;
1066
+ source: "config" | "user" | "agent" | "project";
1067
+ }, {
1068
+ name: string;
1069
+ source: "config" | "user" | "agent" | "project";
1070
+ }>>, "many">;
1071
+ explicitSkillNames: z.ZodArray<z.ZodString, "many">;
1072
+ }, "strict", z.ZodTypeAny, {
1073
+ skills: Readonly<{
1074
+ name: string;
1075
+ source: "config" | "user" | "agent" | "project";
1076
+ }>[];
1077
+ cwd: string;
1078
+ stableRuleIds: string[];
1079
+ explicitSkillNames: string[];
1080
+ systemPromptSha256?: string | undefined;
1081
+ }, {
1082
+ skills: Readonly<{
1083
+ name: string;
1084
+ source: "config" | "user" | "agent" | "project";
1085
+ }>[];
1086
+ cwd: string;
1087
+ stableRuleIds: string[];
1088
+ explicitSkillNames: string[];
1089
+ systemPromptSha256?: string | undefined;
1090
+ }>>;
1091
+ summary: z.ZodReadonly<z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
1092
+ status: z.ZodLiteral<"valid">;
1093
+ digest: z.ZodString;
1094
+ }, "strict", z.ZodTypeAny, {
1095
+ status: "valid";
1096
+ digest: string;
1097
+ }, {
1098
+ status: "valid";
1099
+ digest: string;
1100
+ }>, z.ZodObject<{
1101
+ status: z.ZodLiteral<"fallback">;
1102
+ reason: z.ZodString;
1103
+ lastValidCheckpointId: z.ZodOptional<z.ZodBranded<z.ZodString, "CompactionCheckpointId">>;
1104
+ }, "strict", z.ZodTypeAny, {
1105
+ status: "fallback";
1106
+ reason: string;
1107
+ lastValidCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
1108
+ }, {
1109
+ status: "fallback";
1110
+ reason: string;
1111
+ lastValidCheckpointId?: string | undefined;
1112
+ }>, z.ZodObject<{
1113
+ status: z.ZodLiteral<"skipped">;
1114
+ lastValidCheckpointId: z.ZodOptional<z.ZodBranded<z.ZodString, "CompactionCheckpointId">>;
1115
+ }, "strict", z.ZodTypeAny, {
1116
+ status: "skipped";
1117
+ lastValidCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
1118
+ }, {
1119
+ status: "skipped";
1120
+ lastValidCheckpointId?: string | undefined;
1121
+ }>]>>;
1122
+ }, "strict", z.ZodTypeAny, {
1123
+ version: 1;
1124
+ createdAt: string;
1125
+ id: string & z.BRAND<"CompactionCheckpointId">;
1126
+ context: Readonly<{
1127
+ skills: Readonly<{
1128
+ name: string;
1129
+ source: "config" | "user" | "agent" | "project";
1130
+ }>[];
1131
+ cwd: string;
1132
+ stableRuleIds: string[];
1133
+ explicitSkillNames: string[];
1134
+ systemPromptSha256?: string | undefined;
1135
+ }>;
1136
+ summary: Readonly<{
1137
+ status: "valid";
1138
+ digest: string;
1139
+ }> | Readonly<{
1140
+ status: "fallback";
1141
+ reason: string;
1142
+ lastValidCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
1143
+ }> | Readonly<{
1144
+ status: "skipped";
1145
+ lastValidCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
1146
+ }>;
1147
+ resources: Readonly<{
1148
+ mode: "read" | "write";
1149
+ key: string;
1150
+ evidenceToolCallId: string;
1151
+ evidenceExecutionId: string;
1152
+ }>[];
1153
+ constraints: Readonly<{
1154
+ sourceSequence: number;
1155
+ quote: string;
1156
+ }>[];
1157
+ toolState: Readonly<{
1158
+ countsByOutcome: Readonly<{
1159
+ cancelled: number;
1160
+ success: number;
1161
+ user_rejected: number;
1162
+ policy_denied: number;
1163
+ invalid_input: number;
1164
+ tool_failed: number;
1165
+ }>;
1166
+ recentRecords: Readonly<{
1167
+ toolCallId: string;
1168
+ toolName: string;
1169
+ agentName: string;
1170
+ outcome: Readonly<{
1171
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
1172
+ reason?: string | undefined;
1173
+ }>;
1174
+ sequence: number;
1175
+ executionId: string;
1176
+ }>[];
1177
+ integrityStatus: "invalid" | "valid" | "sanitized";
1178
+ anomalies: Readonly<{
1179
+ toolCallId: string;
1180
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
1181
+ count?: number | undefined;
1182
+ }>[];
1183
+ }>;
1184
+ runningWork: Readonly<{
1185
+ workdir: string;
1186
+ managerInstanceId: string;
1187
+ sessionId: number;
1188
+ state: "completed" | "running" | "draining" | "stopping" | "cleanup-failed";
1189
+ recoverability: "live" | "stale" | "unavailable";
1190
+ commandPreview: string;
1191
+ observedAt: string;
1192
+ terminationCause?: string | undefined;
1193
+ wallTimeMs?: number | undefined;
1194
+ exitCode?: number | undefined;
1195
+ cleanupError?: string | undefined;
1196
+ }>[];
1197
+ generation: number;
1198
+ transcript: Readonly<{
1199
+ messages: {
1200
+ fromSequenceExclusive: number;
1201
+ throughSequence: number;
1202
+ };
1203
+ toolExecutions: {
1204
+ fromSequenceExclusive: number;
1205
+ throughSequence: number;
1206
+ };
1207
+ completeness: "legacy_snapshot" | "complete";
1208
+ }>;
1209
+ goal?: Readonly<{
1210
+ status: "unknown" | "active" | "interrupted";
1211
+ sourceSequence: number;
1212
+ verbatimRequest: string;
1213
+ }> | undefined;
1214
+ previousCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
1215
+ }, {
1216
+ version: 1;
1217
+ createdAt: string;
1218
+ id: string;
1219
+ context: Readonly<{
1220
+ skills: Readonly<{
1221
+ name: string;
1222
+ source: "config" | "user" | "agent" | "project";
1223
+ }>[];
1224
+ cwd: string;
1225
+ stableRuleIds: string[];
1226
+ explicitSkillNames: string[];
1227
+ systemPromptSha256?: string | undefined;
1228
+ }>;
1229
+ summary: Readonly<{
1230
+ status: "valid";
1231
+ digest: string;
1232
+ }> | Readonly<{
1233
+ status: "fallback";
1234
+ reason: string;
1235
+ lastValidCheckpointId?: string | undefined;
1236
+ }> | Readonly<{
1237
+ status: "skipped";
1238
+ lastValidCheckpointId?: string | undefined;
1239
+ }>;
1240
+ resources: Readonly<{
1241
+ mode: "read" | "write";
1242
+ key: string;
1243
+ evidenceToolCallId: string;
1244
+ evidenceExecutionId: string;
1245
+ }>[];
1246
+ constraints: Readonly<{
1247
+ sourceSequence: number;
1248
+ quote: string;
1249
+ }>[];
1250
+ toolState: Readonly<{
1251
+ countsByOutcome: Readonly<{
1252
+ cancelled: number;
1253
+ success: number;
1254
+ user_rejected: number;
1255
+ policy_denied: number;
1256
+ invalid_input: number;
1257
+ tool_failed: number;
1258
+ }>;
1259
+ recentRecords: Readonly<{
1260
+ toolCallId: string;
1261
+ toolName: string;
1262
+ agentName: string;
1263
+ outcome: Readonly<{
1264
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
1265
+ reason?: string | undefined;
1266
+ }>;
1267
+ sequence: number;
1268
+ executionId: string;
1269
+ }>[];
1270
+ integrityStatus: "invalid" | "valid" | "sanitized";
1271
+ anomalies: Readonly<{
1272
+ toolCallId: string;
1273
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
1274
+ count?: number | undefined;
1275
+ }>[];
1276
+ }>;
1277
+ runningWork: Readonly<{
1278
+ workdir: string;
1279
+ managerInstanceId: string;
1280
+ sessionId: number;
1281
+ state: "completed" | "running" | "draining" | "stopping" | "cleanup-failed";
1282
+ recoverability: "live" | "stale" | "unavailable";
1283
+ commandPreview: string;
1284
+ observedAt: string;
1285
+ terminationCause?: string | undefined;
1286
+ wallTimeMs?: number | undefined;
1287
+ exitCode?: number | undefined;
1288
+ cleanupError?: string | undefined;
1289
+ }>[];
1290
+ generation: number;
1291
+ transcript: Readonly<{
1292
+ messages: {
1293
+ fromSequenceExclusive: number;
1294
+ throughSequence: number;
1295
+ };
1296
+ toolExecutions: {
1297
+ fromSequenceExclusive: number;
1298
+ throughSequence: number;
1299
+ };
1300
+ completeness: "legacy_snapshot" | "complete";
1301
+ }>;
1302
+ goal?: Readonly<{
1303
+ status: "unknown" | "active" | "interrupted";
1304
+ sourceSequence: number;
1305
+ verbatimRequest: string;
1306
+ }> | undefined;
1307
+ previousCheckpointId?: string | undefined;
1308
+ }>>;
1309
+ export declare const compactionCheckpointV2Schema: z.ZodReadonly<z.ZodEffects<z.ZodObject<{
1310
+ version: z.ZodLiteral<2>;
1311
+ id: z.ZodBranded<z.ZodString, "CompactionCheckpointId">;
1312
+ generation: z.ZodNumber;
1313
+ previousCheckpointId: z.ZodOptional<z.ZodBranded<z.ZodString, "CompactionCheckpointId">>;
1314
+ createdAt: z.ZodString;
1315
+ transcript: z.ZodReadonly<z.ZodObject<{
1316
+ messages: z.ZodEffects<z.ZodObject<{
1317
+ fromSequenceExclusive: z.ZodNumber;
1318
+ throughSequence: z.ZodNumber;
1319
+ }, "strict", z.ZodTypeAny, {
1320
+ fromSequenceExclusive: number;
1321
+ throughSequence: number;
1322
+ }, {
1323
+ fromSequenceExclusive: number;
1324
+ throughSequence: number;
1325
+ }>, {
1326
+ fromSequenceExclusive: number;
1327
+ throughSequence: number;
1328
+ }, {
1329
+ fromSequenceExclusive: number;
1330
+ throughSequence: number;
1331
+ }>;
1332
+ toolExecutions: z.ZodEffects<z.ZodObject<{
1333
+ fromSequenceExclusive: z.ZodNumber;
1334
+ throughSequence: z.ZodNumber;
1335
+ }, "strict", z.ZodTypeAny, {
1336
+ fromSequenceExclusive: number;
1337
+ throughSequence: number;
1338
+ }, {
1339
+ fromSequenceExclusive: number;
1340
+ throughSequence: number;
1341
+ }>, {
1342
+ fromSequenceExclusive: number;
1343
+ throughSequence: number;
1344
+ }, {
1345
+ fromSequenceExclusive: number;
1346
+ throughSequence: number;
1347
+ }>;
1348
+ completeness: z.ZodEnum<["complete", "legacy_snapshot"]>;
1349
+ }, "strict", z.ZodTypeAny, {
1350
+ messages: {
1351
+ fromSequenceExclusive: number;
1352
+ throughSequence: number;
1353
+ };
1354
+ toolExecutions: {
1355
+ fromSequenceExclusive: number;
1356
+ throughSequence: number;
1357
+ };
1358
+ completeness: "legacy_snapshot" | "complete";
1359
+ }, {
1360
+ messages: {
1361
+ fromSequenceExclusive: number;
1362
+ throughSequence: number;
1363
+ };
1364
+ toolExecutions: {
1365
+ fromSequenceExclusive: number;
1366
+ throughSequence: number;
1367
+ };
1368
+ completeness: "legacy_snapshot" | "complete";
1369
+ }>>;
1370
+ semanticState: z.ZodReadonly<z.ZodEffects<z.ZodObject<{
1371
+ version: z.ZodLiteral<1>;
1372
+ goal: z.ZodNullable<z.ZodReadonly<z.ZodObject<{
1373
+ id: z.ZodBranded<z.ZodString, "CompactionSemanticItemId">;
1374
+ text: z.ZodString;
1375
+ provenance: z.ZodArray<z.ZodReadonly<z.ZodEffects<z.ZodObject<{
1376
+ kind: z.ZodEnum<["message", "tool_execution", "resource", "running_session", "legacy_snapshot"]>;
1377
+ messageSequence: z.ZodNullable<z.ZodNumber>;
1378
+ toolExecutionId: z.ZodNullable<z.ZodString>;
1379
+ resourceKey: z.ZodNullable<z.ZodString>;
1380
+ managerInstanceId: z.ZodNullable<z.ZodString>;
1381
+ sessionId: z.ZodNullable<z.ZodNumber>;
1382
+ checkpointId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1383
+ snapshotIndex: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1384
+ }, "strict", z.ZodTypeAny, {
1385
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1386
+ messageSequence: number | null;
1387
+ toolExecutionId: string | null;
1388
+ resourceKey: string | null;
1389
+ managerInstanceId: string | null;
1390
+ sessionId: number | null;
1391
+ checkpointId: string | null;
1392
+ snapshotIndex: number | null;
1393
+ }, {
1394
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1395
+ messageSequence: number | null;
1396
+ toolExecutionId: string | null;
1397
+ resourceKey: string | null;
1398
+ managerInstanceId: string | null;
1399
+ sessionId: number | null;
1400
+ checkpointId?: string | null | undefined;
1401
+ snapshotIndex?: number | null | undefined;
1402
+ }>, {
1403
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1404
+ messageSequence: number | null;
1405
+ toolExecutionId: string | null;
1406
+ resourceKey: string | null;
1407
+ managerInstanceId: string | null;
1408
+ sessionId: number | null;
1409
+ checkpointId: string | null;
1410
+ snapshotIndex: number | null;
1411
+ }, {
1412
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1413
+ messageSequence: number | null;
1414
+ toolExecutionId: string | null;
1415
+ resourceKey: string | null;
1416
+ managerInstanceId: string | null;
1417
+ sessionId: number | null;
1418
+ checkpointId?: string | null | undefined;
1419
+ snapshotIndex?: number | null | undefined;
1420
+ }>>, "many">;
1421
+ sourceQuotes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1422
+ }, "strict", z.ZodTypeAny, {
1423
+ text: string;
1424
+ id: string & z.BRAND<"CompactionSemanticItemId">;
1425
+ sourceQuotes: string[];
1426
+ provenance: Readonly<{
1427
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1428
+ messageSequence: number | null;
1429
+ toolExecutionId: string | null;
1430
+ resourceKey: string | null;
1431
+ managerInstanceId: string | null;
1432
+ sessionId: number | null;
1433
+ checkpointId: string | null;
1434
+ snapshotIndex: number | null;
1435
+ }>[];
1436
+ }, {
1437
+ text: string;
1438
+ id: string;
1439
+ provenance: Readonly<{
1440
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1441
+ messageSequence: number | null;
1442
+ toolExecutionId: string | null;
1443
+ resourceKey: string | null;
1444
+ managerInstanceId: string | null;
1445
+ sessionId: number | null;
1446
+ checkpointId?: string | null | undefined;
1447
+ snapshotIndex?: number | null | undefined;
1448
+ }>[];
1449
+ sourceQuotes?: string[] | undefined;
1450
+ }>>>;
1451
+ constraints: z.ZodDefault<z.ZodArray<z.ZodReadonly<z.ZodObject<{
1452
+ id: z.ZodBranded<z.ZodString, "CompactionSemanticItemId">;
1453
+ text: z.ZodString;
1454
+ provenance: z.ZodArray<z.ZodReadonly<z.ZodEffects<z.ZodObject<{
1455
+ kind: z.ZodEnum<["message", "tool_execution", "resource", "running_session", "legacy_snapshot"]>;
1456
+ messageSequence: z.ZodNullable<z.ZodNumber>;
1457
+ toolExecutionId: z.ZodNullable<z.ZodString>;
1458
+ resourceKey: z.ZodNullable<z.ZodString>;
1459
+ managerInstanceId: z.ZodNullable<z.ZodString>;
1460
+ sessionId: z.ZodNullable<z.ZodNumber>;
1461
+ checkpointId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1462
+ snapshotIndex: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1463
+ }, "strict", z.ZodTypeAny, {
1464
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1465
+ messageSequence: number | null;
1466
+ toolExecutionId: string | null;
1467
+ resourceKey: string | null;
1468
+ managerInstanceId: string | null;
1469
+ sessionId: number | null;
1470
+ checkpointId: string | null;
1471
+ snapshotIndex: number | null;
1472
+ }, {
1473
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1474
+ messageSequence: number | null;
1475
+ toolExecutionId: string | null;
1476
+ resourceKey: string | null;
1477
+ managerInstanceId: string | null;
1478
+ sessionId: number | null;
1479
+ checkpointId?: string | null | undefined;
1480
+ snapshotIndex?: number | null | undefined;
1481
+ }>, {
1482
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1483
+ messageSequence: number | null;
1484
+ toolExecutionId: string | null;
1485
+ resourceKey: string | null;
1486
+ managerInstanceId: string | null;
1487
+ sessionId: number | null;
1488
+ checkpointId: string | null;
1489
+ snapshotIndex: number | null;
1490
+ }, {
1491
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1492
+ messageSequence: number | null;
1493
+ toolExecutionId: string | null;
1494
+ resourceKey: string | null;
1495
+ managerInstanceId: string | null;
1496
+ sessionId: number | null;
1497
+ checkpointId?: string | null | undefined;
1498
+ snapshotIndex?: number | null | undefined;
1499
+ }>>, "many">;
1500
+ sourceQuotes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1501
+ }, "strict", z.ZodTypeAny, {
1502
+ text: string;
1503
+ id: string & z.BRAND<"CompactionSemanticItemId">;
1504
+ sourceQuotes: string[];
1505
+ provenance: Readonly<{
1506
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1507
+ messageSequence: number | null;
1508
+ toolExecutionId: string | null;
1509
+ resourceKey: string | null;
1510
+ managerInstanceId: string | null;
1511
+ sessionId: number | null;
1512
+ checkpointId: string | null;
1513
+ snapshotIndex: number | null;
1514
+ }>[];
1515
+ }, {
1516
+ text: string;
1517
+ id: string;
1518
+ provenance: Readonly<{
1519
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1520
+ messageSequence: number | null;
1521
+ toolExecutionId: string | null;
1522
+ resourceKey: string | null;
1523
+ managerInstanceId: string | null;
1524
+ sessionId: number | null;
1525
+ checkpointId?: string | null | undefined;
1526
+ snapshotIndex?: number | null | undefined;
1527
+ }>[];
1528
+ sourceQuotes?: string[] | undefined;
1529
+ }>>, "many">>;
1530
+ decisions: z.ZodArray<z.ZodReadonly<z.ZodObject<{
1531
+ id: z.ZodBranded<z.ZodString, "CompactionSemanticItemId">;
1532
+ text: z.ZodString;
1533
+ provenance: z.ZodArray<z.ZodReadonly<z.ZodEffects<z.ZodObject<{
1534
+ kind: z.ZodEnum<["message", "tool_execution", "resource", "running_session", "legacy_snapshot"]>;
1535
+ messageSequence: z.ZodNullable<z.ZodNumber>;
1536
+ toolExecutionId: z.ZodNullable<z.ZodString>;
1537
+ resourceKey: z.ZodNullable<z.ZodString>;
1538
+ managerInstanceId: z.ZodNullable<z.ZodString>;
1539
+ sessionId: z.ZodNullable<z.ZodNumber>;
1540
+ checkpointId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1541
+ snapshotIndex: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1542
+ }, "strict", z.ZodTypeAny, {
1543
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1544
+ messageSequence: number | null;
1545
+ toolExecutionId: string | null;
1546
+ resourceKey: string | null;
1547
+ managerInstanceId: string | null;
1548
+ sessionId: number | null;
1549
+ checkpointId: string | null;
1550
+ snapshotIndex: number | null;
1551
+ }, {
1552
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1553
+ messageSequence: number | null;
1554
+ toolExecutionId: string | null;
1555
+ resourceKey: string | null;
1556
+ managerInstanceId: string | null;
1557
+ sessionId: number | null;
1558
+ checkpointId?: string | null | undefined;
1559
+ snapshotIndex?: number | null | undefined;
1560
+ }>, {
1561
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1562
+ messageSequence: number | null;
1563
+ toolExecutionId: string | null;
1564
+ resourceKey: string | null;
1565
+ managerInstanceId: string | null;
1566
+ sessionId: number | null;
1567
+ checkpointId: string | null;
1568
+ snapshotIndex: number | null;
1569
+ }, {
1570
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1571
+ messageSequence: number | null;
1572
+ toolExecutionId: string | null;
1573
+ resourceKey: string | null;
1574
+ managerInstanceId: string | null;
1575
+ sessionId: number | null;
1576
+ checkpointId?: string | null | undefined;
1577
+ snapshotIndex?: number | null | undefined;
1578
+ }>>, "many">;
1579
+ sourceQuotes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1580
+ }, "strict", z.ZodTypeAny, {
1581
+ text: string;
1582
+ id: string & z.BRAND<"CompactionSemanticItemId">;
1583
+ sourceQuotes: string[];
1584
+ provenance: Readonly<{
1585
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1586
+ messageSequence: number | null;
1587
+ toolExecutionId: string | null;
1588
+ resourceKey: string | null;
1589
+ managerInstanceId: string | null;
1590
+ sessionId: number | null;
1591
+ checkpointId: string | null;
1592
+ snapshotIndex: number | null;
1593
+ }>[];
1594
+ }, {
1595
+ text: string;
1596
+ id: string;
1597
+ provenance: Readonly<{
1598
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1599
+ messageSequence: number | null;
1600
+ toolExecutionId: string | null;
1601
+ resourceKey: string | null;
1602
+ managerInstanceId: string | null;
1603
+ sessionId: number | null;
1604
+ checkpointId?: string | null | undefined;
1605
+ snapshotIndex?: number | null | undefined;
1606
+ }>[];
1607
+ sourceQuotes?: string[] | undefined;
1608
+ }>>, "many">;
1609
+ completedWork: z.ZodArray<z.ZodReadonly<z.ZodObject<{
1610
+ id: z.ZodBranded<z.ZodString, "CompactionSemanticItemId">;
1611
+ text: z.ZodString;
1612
+ provenance: z.ZodArray<z.ZodReadonly<z.ZodEffects<z.ZodObject<{
1613
+ kind: z.ZodEnum<["message", "tool_execution", "resource", "running_session", "legacy_snapshot"]>;
1614
+ messageSequence: z.ZodNullable<z.ZodNumber>;
1615
+ toolExecutionId: z.ZodNullable<z.ZodString>;
1616
+ resourceKey: z.ZodNullable<z.ZodString>;
1617
+ managerInstanceId: z.ZodNullable<z.ZodString>;
1618
+ sessionId: z.ZodNullable<z.ZodNumber>;
1619
+ checkpointId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1620
+ snapshotIndex: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1621
+ }, "strict", z.ZodTypeAny, {
1622
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1623
+ messageSequence: number | null;
1624
+ toolExecutionId: string | null;
1625
+ resourceKey: string | null;
1626
+ managerInstanceId: string | null;
1627
+ sessionId: number | null;
1628
+ checkpointId: string | null;
1629
+ snapshotIndex: number | null;
1630
+ }, {
1631
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1632
+ messageSequence: number | null;
1633
+ toolExecutionId: string | null;
1634
+ resourceKey: string | null;
1635
+ managerInstanceId: string | null;
1636
+ sessionId: number | null;
1637
+ checkpointId?: string | null | undefined;
1638
+ snapshotIndex?: number | null | undefined;
1639
+ }>, {
1640
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1641
+ messageSequence: number | null;
1642
+ toolExecutionId: string | null;
1643
+ resourceKey: string | null;
1644
+ managerInstanceId: string | null;
1645
+ sessionId: number | null;
1646
+ checkpointId: string | null;
1647
+ snapshotIndex: number | null;
1648
+ }, {
1649
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1650
+ messageSequence: number | null;
1651
+ toolExecutionId: string | null;
1652
+ resourceKey: string | null;
1653
+ managerInstanceId: string | null;
1654
+ sessionId: number | null;
1655
+ checkpointId?: string | null | undefined;
1656
+ snapshotIndex?: number | null | undefined;
1657
+ }>>, "many">;
1658
+ sourceQuotes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1659
+ }, "strict", z.ZodTypeAny, {
1660
+ text: string;
1661
+ id: string & z.BRAND<"CompactionSemanticItemId">;
1662
+ sourceQuotes: string[];
1663
+ provenance: Readonly<{
1664
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1665
+ messageSequence: number | null;
1666
+ toolExecutionId: string | null;
1667
+ resourceKey: string | null;
1668
+ managerInstanceId: string | null;
1669
+ sessionId: number | null;
1670
+ checkpointId: string | null;
1671
+ snapshotIndex: number | null;
1672
+ }>[];
1673
+ }, {
1674
+ text: string;
1675
+ id: string;
1676
+ provenance: Readonly<{
1677
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1678
+ messageSequence: number | null;
1679
+ toolExecutionId: string | null;
1680
+ resourceKey: string | null;
1681
+ managerInstanceId: string | null;
1682
+ sessionId: number | null;
1683
+ checkpointId?: string | null | undefined;
1684
+ snapshotIndex?: number | null | undefined;
1685
+ }>[];
1686
+ sourceQuotes?: string[] | undefined;
1687
+ }>>, "many">;
1688
+ pendingWork: z.ZodArray<z.ZodReadonly<z.ZodObject<{
1689
+ id: z.ZodBranded<z.ZodString, "CompactionSemanticItemId">;
1690
+ text: z.ZodString;
1691
+ provenance: z.ZodArray<z.ZodReadonly<z.ZodEffects<z.ZodObject<{
1692
+ kind: z.ZodEnum<["message", "tool_execution", "resource", "running_session", "legacy_snapshot"]>;
1693
+ messageSequence: z.ZodNullable<z.ZodNumber>;
1694
+ toolExecutionId: z.ZodNullable<z.ZodString>;
1695
+ resourceKey: z.ZodNullable<z.ZodString>;
1696
+ managerInstanceId: z.ZodNullable<z.ZodString>;
1697
+ sessionId: z.ZodNullable<z.ZodNumber>;
1698
+ checkpointId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1699
+ snapshotIndex: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1700
+ }, "strict", z.ZodTypeAny, {
1701
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1702
+ messageSequence: number | null;
1703
+ toolExecutionId: string | null;
1704
+ resourceKey: string | null;
1705
+ managerInstanceId: string | null;
1706
+ sessionId: number | null;
1707
+ checkpointId: string | null;
1708
+ snapshotIndex: number | null;
1709
+ }, {
1710
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1711
+ messageSequence: number | null;
1712
+ toolExecutionId: string | null;
1713
+ resourceKey: string | null;
1714
+ managerInstanceId: string | null;
1715
+ sessionId: number | null;
1716
+ checkpointId?: string | null | undefined;
1717
+ snapshotIndex?: number | null | undefined;
1718
+ }>, {
1719
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1720
+ messageSequence: number | null;
1721
+ toolExecutionId: string | null;
1722
+ resourceKey: string | null;
1723
+ managerInstanceId: string | null;
1724
+ sessionId: number | null;
1725
+ checkpointId: string | null;
1726
+ snapshotIndex: number | null;
1727
+ }, {
1728
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1729
+ messageSequence: number | null;
1730
+ toolExecutionId: string | null;
1731
+ resourceKey: string | null;
1732
+ managerInstanceId: string | null;
1733
+ sessionId: number | null;
1734
+ checkpointId?: string | null | undefined;
1735
+ snapshotIndex?: number | null | undefined;
1736
+ }>>, "many">;
1737
+ sourceQuotes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1738
+ }, "strict", z.ZodTypeAny, {
1739
+ text: string;
1740
+ id: string & z.BRAND<"CompactionSemanticItemId">;
1741
+ sourceQuotes: string[];
1742
+ provenance: Readonly<{
1743
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1744
+ messageSequence: number | null;
1745
+ toolExecutionId: string | null;
1746
+ resourceKey: string | null;
1747
+ managerInstanceId: string | null;
1748
+ sessionId: number | null;
1749
+ checkpointId: string | null;
1750
+ snapshotIndex: number | null;
1751
+ }>[];
1752
+ }, {
1753
+ text: string;
1754
+ id: string;
1755
+ provenance: Readonly<{
1756
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1757
+ messageSequence: number | null;
1758
+ toolExecutionId: string | null;
1759
+ resourceKey: string | null;
1760
+ managerInstanceId: string | null;
1761
+ sessionId: number | null;
1762
+ checkpointId?: string | null | undefined;
1763
+ snapshotIndex?: number | null | undefined;
1764
+ }>[];
1765
+ sourceQuotes?: string[] | undefined;
1766
+ }>>, "many">;
1767
+ resources: z.ZodArray<z.ZodReadonly<z.ZodObject<{
1768
+ id: z.ZodBranded<z.ZodString, "CompactionSemanticItemId">;
1769
+ resourceKey: z.ZodString;
1770
+ provenance: z.ZodArray<z.ZodReadonly<z.ZodEffects<z.ZodObject<{
1771
+ kind: z.ZodEnum<["message", "tool_execution", "resource", "running_session", "legacy_snapshot"]>;
1772
+ messageSequence: z.ZodNullable<z.ZodNumber>;
1773
+ toolExecutionId: z.ZodNullable<z.ZodString>;
1774
+ resourceKey: z.ZodNullable<z.ZodString>;
1775
+ managerInstanceId: z.ZodNullable<z.ZodString>;
1776
+ sessionId: z.ZodNullable<z.ZodNumber>;
1777
+ checkpointId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1778
+ snapshotIndex: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1779
+ }, "strict", z.ZodTypeAny, {
1780
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1781
+ messageSequence: number | null;
1782
+ toolExecutionId: string | null;
1783
+ resourceKey: string | null;
1784
+ managerInstanceId: string | null;
1785
+ sessionId: number | null;
1786
+ checkpointId: string | null;
1787
+ snapshotIndex: number | null;
1788
+ }, {
1789
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1790
+ messageSequence: number | null;
1791
+ toolExecutionId: string | null;
1792
+ resourceKey: string | null;
1793
+ managerInstanceId: string | null;
1794
+ sessionId: number | null;
1795
+ checkpointId?: string | null | undefined;
1796
+ snapshotIndex?: number | null | undefined;
1797
+ }>, {
1798
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1799
+ messageSequence: number | null;
1800
+ toolExecutionId: string | null;
1801
+ resourceKey: string | null;
1802
+ managerInstanceId: string | null;
1803
+ sessionId: number | null;
1804
+ checkpointId: string | null;
1805
+ snapshotIndex: number | null;
1806
+ }, {
1807
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1808
+ messageSequence: number | null;
1809
+ toolExecutionId: string | null;
1810
+ resourceKey: string | null;
1811
+ managerInstanceId: string | null;
1812
+ sessionId: number | null;
1813
+ checkpointId?: string | null | undefined;
1814
+ snapshotIndex?: number | null | undefined;
1815
+ }>>, "many">;
1816
+ }, "strict", z.ZodTypeAny, {
1817
+ id: string & z.BRAND<"CompactionSemanticItemId">;
1818
+ resourceKey: string;
1819
+ provenance: Readonly<{
1820
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1821
+ messageSequence: number | null;
1822
+ toolExecutionId: string | null;
1823
+ resourceKey: string | null;
1824
+ managerInstanceId: string | null;
1825
+ sessionId: number | null;
1826
+ checkpointId: string | null;
1827
+ snapshotIndex: number | null;
1828
+ }>[];
1829
+ }, {
1830
+ id: string;
1831
+ resourceKey: string;
1832
+ provenance: Readonly<{
1833
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1834
+ messageSequence: number | null;
1835
+ toolExecutionId: string | null;
1836
+ resourceKey: string | null;
1837
+ managerInstanceId: string | null;
1838
+ sessionId: number | null;
1839
+ checkpointId?: string | null | undefined;
1840
+ snapshotIndex?: number | null | undefined;
1841
+ }>[];
1842
+ }>>, "many">;
1843
+ runningSessions: z.ZodArray<z.ZodReadonly<z.ZodObject<{
1844
+ id: z.ZodBranded<z.ZodString, "CompactionSemanticItemId">;
1845
+ managerInstanceId: z.ZodString;
1846
+ sessionId: z.ZodNumber;
1847
+ provenance: z.ZodArray<z.ZodReadonly<z.ZodEffects<z.ZodObject<{
1848
+ kind: z.ZodEnum<["message", "tool_execution", "resource", "running_session", "legacy_snapshot"]>;
1849
+ messageSequence: z.ZodNullable<z.ZodNumber>;
1850
+ toolExecutionId: z.ZodNullable<z.ZodString>;
1851
+ resourceKey: z.ZodNullable<z.ZodString>;
1852
+ managerInstanceId: z.ZodNullable<z.ZodString>;
1853
+ sessionId: z.ZodNullable<z.ZodNumber>;
1854
+ checkpointId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1855
+ snapshotIndex: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1856
+ }, "strict", z.ZodTypeAny, {
1857
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1858
+ messageSequence: number | null;
1859
+ toolExecutionId: string | null;
1860
+ resourceKey: string | null;
1861
+ managerInstanceId: string | null;
1862
+ sessionId: number | null;
1863
+ checkpointId: string | null;
1864
+ snapshotIndex: number | null;
1865
+ }, {
1866
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1867
+ messageSequence: number | null;
1868
+ toolExecutionId: string | null;
1869
+ resourceKey: string | null;
1870
+ managerInstanceId: string | null;
1871
+ sessionId: number | null;
1872
+ checkpointId?: string | null | undefined;
1873
+ snapshotIndex?: number | null | undefined;
1874
+ }>, {
1875
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1876
+ messageSequence: number | null;
1877
+ toolExecutionId: string | null;
1878
+ resourceKey: string | null;
1879
+ managerInstanceId: string | null;
1880
+ sessionId: number | null;
1881
+ checkpointId: string | null;
1882
+ snapshotIndex: number | null;
1883
+ }, {
1884
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1885
+ messageSequence: number | null;
1886
+ toolExecutionId: string | null;
1887
+ resourceKey: string | null;
1888
+ managerInstanceId: string | null;
1889
+ sessionId: number | null;
1890
+ checkpointId?: string | null | undefined;
1891
+ snapshotIndex?: number | null | undefined;
1892
+ }>>, "many">;
1893
+ }, "strict", z.ZodTypeAny, {
1894
+ id: string & z.BRAND<"CompactionSemanticItemId">;
1895
+ managerInstanceId: string;
1896
+ sessionId: number;
1897
+ provenance: Readonly<{
1898
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1899
+ messageSequence: number | null;
1900
+ toolExecutionId: string | null;
1901
+ resourceKey: string | null;
1902
+ managerInstanceId: string | null;
1903
+ sessionId: number | null;
1904
+ checkpointId: string | null;
1905
+ snapshotIndex: number | null;
1906
+ }>[];
1907
+ }, {
1908
+ id: string;
1909
+ managerInstanceId: string;
1910
+ sessionId: number;
1911
+ provenance: Readonly<{
1912
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1913
+ messageSequence: number | null;
1914
+ toolExecutionId: string | null;
1915
+ resourceKey: string | null;
1916
+ managerInstanceId: string | null;
1917
+ sessionId: number | null;
1918
+ checkpointId?: string | null | undefined;
1919
+ snapshotIndex?: number | null | undefined;
1920
+ }>[];
1921
+ }>>, "many">;
1922
+ uncertainties: z.ZodArray<z.ZodReadonly<z.ZodObject<{
1923
+ id: z.ZodBranded<z.ZodString, "CompactionSemanticItemId">;
1924
+ text: z.ZodString;
1925
+ provenance: z.ZodArray<z.ZodReadonly<z.ZodEffects<z.ZodObject<{
1926
+ kind: z.ZodEnum<["message", "tool_execution", "resource", "running_session", "legacy_snapshot"]>;
1927
+ messageSequence: z.ZodNullable<z.ZodNumber>;
1928
+ toolExecutionId: z.ZodNullable<z.ZodString>;
1929
+ resourceKey: z.ZodNullable<z.ZodString>;
1930
+ managerInstanceId: z.ZodNullable<z.ZodString>;
1931
+ sessionId: z.ZodNullable<z.ZodNumber>;
1932
+ checkpointId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1933
+ snapshotIndex: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1934
+ }, "strict", z.ZodTypeAny, {
1935
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1936
+ messageSequence: number | null;
1937
+ toolExecutionId: string | null;
1938
+ resourceKey: string | null;
1939
+ managerInstanceId: string | null;
1940
+ sessionId: number | null;
1941
+ checkpointId: string | null;
1942
+ snapshotIndex: number | null;
1943
+ }, {
1944
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1945
+ messageSequence: number | null;
1946
+ toolExecutionId: string | null;
1947
+ resourceKey: string | null;
1948
+ managerInstanceId: string | null;
1949
+ sessionId: number | null;
1950
+ checkpointId?: string | null | undefined;
1951
+ snapshotIndex?: number | null | undefined;
1952
+ }>, {
1953
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1954
+ messageSequence: number | null;
1955
+ toolExecutionId: string | null;
1956
+ resourceKey: string | null;
1957
+ managerInstanceId: string | null;
1958
+ sessionId: number | null;
1959
+ checkpointId: string | null;
1960
+ snapshotIndex: number | null;
1961
+ }, {
1962
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1963
+ messageSequence: number | null;
1964
+ toolExecutionId: string | null;
1965
+ resourceKey: string | null;
1966
+ managerInstanceId: string | null;
1967
+ sessionId: number | null;
1968
+ checkpointId?: string | null | undefined;
1969
+ snapshotIndex?: number | null | undefined;
1970
+ }>>, "many">;
1971
+ sourceQuotes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1972
+ }, "strict", z.ZodTypeAny, {
1973
+ text: string;
1974
+ id: string & z.BRAND<"CompactionSemanticItemId">;
1975
+ sourceQuotes: string[];
1976
+ provenance: Readonly<{
1977
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1978
+ messageSequence: number | null;
1979
+ toolExecutionId: string | null;
1980
+ resourceKey: string | null;
1981
+ managerInstanceId: string | null;
1982
+ sessionId: number | null;
1983
+ checkpointId: string | null;
1984
+ snapshotIndex: number | null;
1985
+ }>[];
1986
+ }, {
1987
+ text: string;
1988
+ id: string;
1989
+ provenance: Readonly<{
1990
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
1991
+ messageSequence: number | null;
1992
+ toolExecutionId: string | null;
1993
+ resourceKey: string | null;
1994
+ managerInstanceId: string | null;
1995
+ sessionId: number | null;
1996
+ checkpointId?: string | null | undefined;
1997
+ snapshotIndex?: number | null | undefined;
1998
+ }>[];
1999
+ sourceQuotes?: string[] | undefined;
2000
+ }>>, "many">;
2001
+ prunedItemCounts: z.ZodDefault<z.ZodReadonly<z.ZodObject<{
2002
+ constraint: z.ZodDefault<z.ZodNumber>;
2003
+ decision: z.ZodNumber;
2004
+ completed_work: z.ZodNumber;
2005
+ pending_work: z.ZodNumber;
2006
+ resource: z.ZodNumber;
2007
+ running_session: z.ZodNumber;
2008
+ uncertainty: z.ZodNumber;
2009
+ }, "strict", z.ZodTypeAny, {
2010
+ resource: number;
2011
+ running_session: number;
2012
+ constraint: number;
2013
+ decision: number;
2014
+ completed_work: number;
2015
+ pending_work: number;
2016
+ uncertainty: number;
2017
+ }, {
2018
+ resource: number;
2019
+ running_session: number;
2020
+ decision: number;
2021
+ completed_work: number;
2022
+ pending_work: number;
2023
+ uncertainty: number;
2024
+ constraint?: number | undefined;
2025
+ }>>>;
2026
+ }, "strict", z.ZodTypeAny, {
2027
+ version: 1;
2028
+ resources: Readonly<{
2029
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2030
+ resourceKey: string;
2031
+ provenance: Readonly<{
2032
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2033
+ messageSequence: number | null;
2034
+ toolExecutionId: string | null;
2035
+ resourceKey: string | null;
2036
+ managerInstanceId: string | null;
2037
+ sessionId: number | null;
2038
+ checkpointId: string | null;
2039
+ snapshotIndex: number | null;
2040
+ }>[];
2041
+ }>[];
2042
+ goal: Readonly<{
2043
+ text: string;
2044
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2045
+ sourceQuotes: string[];
2046
+ provenance: Readonly<{
2047
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2048
+ messageSequence: number | null;
2049
+ toolExecutionId: string | null;
2050
+ resourceKey: string | null;
2051
+ managerInstanceId: string | null;
2052
+ sessionId: number | null;
2053
+ checkpointId: string | null;
2054
+ snapshotIndex: number | null;
2055
+ }>[];
2056
+ }> | null;
2057
+ constraints: Readonly<{
2058
+ text: string;
2059
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2060
+ sourceQuotes: string[];
2061
+ provenance: Readonly<{
2062
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2063
+ messageSequence: number | null;
2064
+ toolExecutionId: string | null;
2065
+ resourceKey: string | null;
2066
+ managerInstanceId: string | null;
2067
+ sessionId: number | null;
2068
+ checkpointId: string | null;
2069
+ snapshotIndex: number | null;
2070
+ }>[];
2071
+ }>[];
2072
+ decisions: Readonly<{
2073
+ text: string;
2074
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2075
+ sourceQuotes: string[];
2076
+ provenance: Readonly<{
2077
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2078
+ messageSequence: number | null;
2079
+ toolExecutionId: string | null;
2080
+ resourceKey: string | null;
2081
+ managerInstanceId: string | null;
2082
+ sessionId: number | null;
2083
+ checkpointId: string | null;
2084
+ snapshotIndex: number | null;
2085
+ }>[];
2086
+ }>[];
2087
+ completedWork: Readonly<{
2088
+ text: string;
2089
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2090
+ sourceQuotes: string[];
2091
+ provenance: Readonly<{
2092
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2093
+ messageSequence: number | null;
2094
+ toolExecutionId: string | null;
2095
+ resourceKey: string | null;
2096
+ managerInstanceId: string | null;
2097
+ sessionId: number | null;
2098
+ checkpointId: string | null;
2099
+ snapshotIndex: number | null;
2100
+ }>[];
2101
+ }>[];
2102
+ pendingWork: Readonly<{
2103
+ text: string;
2104
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2105
+ sourceQuotes: string[];
2106
+ provenance: Readonly<{
2107
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2108
+ messageSequence: number | null;
2109
+ toolExecutionId: string | null;
2110
+ resourceKey: string | null;
2111
+ managerInstanceId: string | null;
2112
+ sessionId: number | null;
2113
+ checkpointId: string | null;
2114
+ snapshotIndex: number | null;
2115
+ }>[];
2116
+ }>[];
2117
+ runningSessions: Readonly<{
2118
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2119
+ managerInstanceId: string;
2120
+ sessionId: number;
2121
+ provenance: Readonly<{
2122
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2123
+ messageSequence: number | null;
2124
+ toolExecutionId: string | null;
2125
+ resourceKey: string | null;
2126
+ managerInstanceId: string | null;
2127
+ sessionId: number | null;
2128
+ checkpointId: string | null;
2129
+ snapshotIndex: number | null;
2130
+ }>[];
2131
+ }>[];
2132
+ uncertainties: Readonly<{
2133
+ text: string;
2134
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2135
+ sourceQuotes: string[];
2136
+ provenance: Readonly<{
2137
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2138
+ messageSequence: number | null;
2139
+ toolExecutionId: string | null;
2140
+ resourceKey: string | null;
2141
+ managerInstanceId: string | null;
2142
+ sessionId: number | null;
2143
+ checkpointId: string | null;
2144
+ snapshotIndex: number | null;
2145
+ }>[];
2146
+ }>[];
2147
+ prunedItemCounts: Readonly<{
2148
+ resource: number;
2149
+ running_session: number;
2150
+ constraint: number;
2151
+ decision: number;
2152
+ completed_work: number;
2153
+ pending_work: number;
2154
+ uncertainty: number;
2155
+ }>;
2156
+ }, {
2157
+ version: 1;
2158
+ resources: Readonly<{
2159
+ id: string;
2160
+ resourceKey: string;
2161
+ provenance: Readonly<{
2162
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2163
+ messageSequence: number | null;
2164
+ toolExecutionId: string | null;
2165
+ resourceKey: string | null;
2166
+ managerInstanceId: string | null;
2167
+ sessionId: number | null;
2168
+ checkpointId?: string | null | undefined;
2169
+ snapshotIndex?: number | null | undefined;
2170
+ }>[];
2171
+ }>[];
2172
+ goal: Readonly<{
2173
+ text: string;
2174
+ id: string;
2175
+ provenance: Readonly<{
2176
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2177
+ messageSequence: number | null;
2178
+ toolExecutionId: string | null;
2179
+ resourceKey: string | null;
2180
+ managerInstanceId: string | null;
2181
+ sessionId: number | null;
2182
+ checkpointId?: string | null | undefined;
2183
+ snapshotIndex?: number | null | undefined;
2184
+ }>[];
2185
+ sourceQuotes?: string[] | undefined;
2186
+ }> | null;
2187
+ decisions: Readonly<{
2188
+ text: string;
2189
+ id: string;
2190
+ provenance: Readonly<{
2191
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2192
+ messageSequence: number | null;
2193
+ toolExecutionId: string | null;
2194
+ resourceKey: string | null;
2195
+ managerInstanceId: string | null;
2196
+ sessionId: number | null;
2197
+ checkpointId?: string | null | undefined;
2198
+ snapshotIndex?: number | null | undefined;
2199
+ }>[];
2200
+ sourceQuotes?: string[] | undefined;
2201
+ }>[];
2202
+ completedWork: Readonly<{
2203
+ text: string;
2204
+ id: string;
2205
+ provenance: Readonly<{
2206
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2207
+ messageSequence: number | null;
2208
+ toolExecutionId: string | null;
2209
+ resourceKey: string | null;
2210
+ managerInstanceId: string | null;
2211
+ sessionId: number | null;
2212
+ checkpointId?: string | null | undefined;
2213
+ snapshotIndex?: number | null | undefined;
2214
+ }>[];
2215
+ sourceQuotes?: string[] | undefined;
2216
+ }>[];
2217
+ pendingWork: Readonly<{
2218
+ text: string;
2219
+ id: string;
2220
+ provenance: Readonly<{
2221
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2222
+ messageSequence: number | null;
2223
+ toolExecutionId: string | null;
2224
+ resourceKey: string | null;
2225
+ managerInstanceId: string | null;
2226
+ sessionId: number | null;
2227
+ checkpointId?: string | null | undefined;
2228
+ snapshotIndex?: number | null | undefined;
2229
+ }>[];
2230
+ sourceQuotes?: string[] | undefined;
2231
+ }>[];
2232
+ runningSessions: Readonly<{
2233
+ id: string;
2234
+ managerInstanceId: string;
2235
+ sessionId: number;
2236
+ provenance: Readonly<{
2237
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2238
+ messageSequence: number | null;
2239
+ toolExecutionId: string | null;
2240
+ resourceKey: string | null;
2241
+ managerInstanceId: string | null;
2242
+ sessionId: number | null;
2243
+ checkpointId?: string | null | undefined;
2244
+ snapshotIndex?: number | null | undefined;
2245
+ }>[];
2246
+ }>[];
2247
+ uncertainties: Readonly<{
2248
+ text: string;
2249
+ id: string;
2250
+ provenance: Readonly<{
2251
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2252
+ messageSequence: number | null;
2253
+ toolExecutionId: string | null;
2254
+ resourceKey: string | null;
2255
+ managerInstanceId: string | null;
2256
+ sessionId: number | null;
2257
+ checkpointId?: string | null | undefined;
2258
+ snapshotIndex?: number | null | undefined;
2259
+ }>[];
2260
+ sourceQuotes?: string[] | undefined;
2261
+ }>[];
2262
+ constraints?: Readonly<{
2263
+ text: string;
2264
+ id: string;
2265
+ provenance: Readonly<{
2266
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2267
+ messageSequence: number | null;
2268
+ toolExecutionId: string | null;
2269
+ resourceKey: string | null;
2270
+ managerInstanceId: string | null;
2271
+ sessionId: number | null;
2272
+ checkpointId?: string | null | undefined;
2273
+ snapshotIndex?: number | null | undefined;
2274
+ }>[];
2275
+ sourceQuotes?: string[] | undefined;
2276
+ }>[] | undefined;
2277
+ prunedItemCounts?: Readonly<{
2278
+ resource: number;
2279
+ running_session: number;
2280
+ decision: number;
2281
+ completed_work: number;
2282
+ pending_work: number;
2283
+ uncertainty: number;
2284
+ constraint?: number | undefined;
2285
+ }> | undefined;
2286
+ }>, {
2287
+ version: 1;
2288
+ resources: Readonly<{
2289
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2290
+ resourceKey: string;
2291
+ provenance: Readonly<{
2292
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2293
+ messageSequence: number | null;
2294
+ toolExecutionId: string | null;
2295
+ resourceKey: string | null;
2296
+ managerInstanceId: string | null;
2297
+ sessionId: number | null;
2298
+ checkpointId: string | null;
2299
+ snapshotIndex: number | null;
2300
+ }>[];
2301
+ }>[];
2302
+ goal: Readonly<{
2303
+ text: string;
2304
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2305
+ sourceQuotes: string[];
2306
+ provenance: Readonly<{
2307
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2308
+ messageSequence: number | null;
2309
+ toolExecutionId: string | null;
2310
+ resourceKey: string | null;
2311
+ managerInstanceId: string | null;
2312
+ sessionId: number | null;
2313
+ checkpointId: string | null;
2314
+ snapshotIndex: number | null;
2315
+ }>[];
2316
+ }> | null;
2317
+ constraints: Readonly<{
2318
+ text: string;
2319
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2320
+ sourceQuotes: string[];
2321
+ provenance: Readonly<{
2322
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2323
+ messageSequence: number | null;
2324
+ toolExecutionId: string | null;
2325
+ resourceKey: string | null;
2326
+ managerInstanceId: string | null;
2327
+ sessionId: number | null;
2328
+ checkpointId: string | null;
2329
+ snapshotIndex: number | null;
2330
+ }>[];
2331
+ }>[];
2332
+ decisions: Readonly<{
2333
+ text: string;
2334
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2335
+ sourceQuotes: string[];
2336
+ provenance: Readonly<{
2337
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2338
+ messageSequence: number | null;
2339
+ toolExecutionId: string | null;
2340
+ resourceKey: string | null;
2341
+ managerInstanceId: string | null;
2342
+ sessionId: number | null;
2343
+ checkpointId: string | null;
2344
+ snapshotIndex: number | null;
2345
+ }>[];
2346
+ }>[];
2347
+ completedWork: Readonly<{
2348
+ text: string;
2349
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2350
+ sourceQuotes: string[];
2351
+ provenance: Readonly<{
2352
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2353
+ messageSequence: number | null;
2354
+ toolExecutionId: string | null;
2355
+ resourceKey: string | null;
2356
+ managerInstanceId: string | null;
2357
+ sessionId: number | null;
2358
+ checkpointId: string | null;
2359
+ snapshotIndex: number | null;
2360
+ }>[];
2361
+ }>[];
2362
+ pendingWork: Readonly<{
2363
+ text: string;
2364
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2365
+ sourceQuotes: string[];
2366
+ provenance: Readonly<{
2367
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2368
+ messageSequence: number | null;
2369
+ toolExecutionId: string | null;
2370
+ resourceKey: string | null;
2371
+ managerInstanceId: string | null;
2372
+ sessionId: number | null;
2373
+ checkpointId: string | null;
2374
+ snapshotIndex: number | null;
2375
+ }>[];
2376
+ }>[];
2377
+ runningSessions: Readonly<{
2378
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2379
+ managerInstanceId: string;
2380
+ sessionId: number;
2381
+ provenance: Readonly<{
2382
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2383
+ messageSequence: number | null;
2384
+ toolExecutionId: string | null;
2385
+ resourceKey: string | null;
2386
+ managerInstanceId: string | null;
2387
+ sessionId: number | null;
2388
+ checkpointId: string | null;
2389
+ snapshotIndex: number | null;
2390
+ }>[];
2391
+ }>[];
2392
+ uncertainties: Readonly<{
2393
+ text: string;
2394
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2395
+ sourceQuotes: string[];
2396
+ provenance: Readonly<{
2397
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2398
+ messageSequence: number | null;
2399
+ toolExecutionId: string | null;
2400
+ resourceKey: string | null;
2401
+ managerInstanceId: string | null;
2402
+ sessionId: number | null;
2403
+ checkpointId: string | null;
2404
+ snapshotIndex: number | null;
2405
+ }>[];
2406
+ }>[];
2407
+ prunedItemCounts: Readonly<{
2408
+ resource: number;
2409
+ running_session: number;
2410
+ constraint: number;
2411
+ decision: number;
2412
+ completed_work: number;
2413
+ pending_work: number;
2414
+ uncertainty: number;
2415
+ }>;
2416
+ }, {
2417
+ version: 1;
2418
+ resources: Readonly<{
2419
+ id: string;
2420
+ resourceKey: string;
2421
+ provenance: Readonly<{
2422
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2423
+ messageSequence: number | null;
2424
+ toolExecutionId: string | null;
2425
+ resourceKey: string | null;
2426
+ managerInstanceId: string | null;
2427
+ sessionId: number | null;
2428
+ checkpointId?: string | null | undefined;
2429
+ snapshotIndex?: number | null | undefined;
2430
+ }>[];
2431
+ }>[];
2432
+ goal: Readonly<{
2433
+ text: string;
2434
+ id: string;
2435
+ provenance: Readonly<{
2436
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2437
+ messageSequence: number | null;
2438
+ toolExecutionId: string | null;
2439
+ resourceKey: string | null;
2440
+ managerInstanceId: string | null;
2441
+ sessionId: number | null;
2442
+ checkpointId?: string | null | undefined;
2443
+ snapshotIndex?: number | null | undefined;
2444
+ }>[];
2445
+ sourceQuotes?: string[] | undefined;
2446
+ }> | null;
2447
+ decisions: Readonly<{
2448
+ text: string;
2449
+ id: string;
2450
+ provenance: Readonly<{
2451
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2452
+ messageSequence: number | null;
2453
+ toolExecutionId: string | null;
2454
+ resourceKey: string | null;
2455
+ managerInstanceId: string | null;
2456
+ sessionId: number | null;
2457
+ checkpointId?: string | null | undefined;
2458
+ snapshotIndex?: number | null | undefined;
2459
+ }>[];
2460
+ sourceQuotes?: string[] | undefined;
2461
+ }>[];
2462
+ completedWork: Readonly<{
2463
+ text: string;
2464
+ id: string;
2465
+ provenance: Readonly<{
2466
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2467
+ messageSequence: number | null;
2468
+ toolExecutionId: string | null;
2469
+ resourceKey: string | null;
2470
+ managerInstanceId: string | null;
2471
+ sessionId: number | null;
2472
+ checkpointId?: string | null | undefined;
2473
+ snapshotIndex?: number | null | undefined;
2474
+ }>[];
2475
+ sourceQuotes?: string[] | undefined;
2476
+ }>[];
2477
+ pendingWork: Readonly<{
2478
+ text: string;
2479
+ id: string;
2480
+ provenance: Readonly<{
2481
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2482
+ messageSequence: number | null;
2483
+ toolExecutionId: string | null;
2484
+ resourceKey: string | null;
2485
+ managerInstanceId: string | null;
2486
+ sessionId: number | null;
2487
+ checkpointId?: string | null | undefined;
2488
+ snapshotIndex?: number | null | undefined;
2489
+ }>[];
2490
+ sourceQuotes?: string[] | undefined;
2491
+ }>[];
2492
+ runningSessions: Readonly<{
2493
+ id: string;
2494
+ managerInstanceId: string;
2495
+ sessionId: number;
2496
+ provenance: Readonly<{
2497
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2498
+ messageSequence: number | null;
2499
+ toolExecutionId: string | null;
2500
+ resourceKey: string | null;
2501
+ managerInstanceId: string | null;
2502
+ sessionId: number | null;
2503
+ checkpointId?: string | null | undefined;
2504
+ snapshotIndex?: number | null | undefined;
2505
+ }>[];
2506
+ }>[];
2507
+ uncertainties: Readonly<{
2508
+ text: string;
2509
+ id: string;
2510
+ provenance: Readonly<{
2511
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2512
+ messageSequence: number | null;
2513
+ toolExecutionId: string | null;
2514
+ resourceKey: string | null;
2515
+ managerInstanceId: string | null;
2516
+ sessionId: number | null;
2517
+ checkpointId?: string | null | undefined;
2518
+ snapshotIndex?: number | null | undefined;
2519
+ }>[];
2520
+ sourceQuotes?: string[] | undefined;
2521
+ }>[];
2522
+ constraints?: Readonly<{
2523
+ text: string;
2524
+ id: string;
2525
+ provenance: Readonly<{
2526
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2527
+ messageSequence: number | null;
2528
+ toolExecutionId: string | null;
2529
+ resourceKey: string | null;
2530
+ managerInstanceId: string | null;
2531
+ sessionId: number | null;
2532
+ checkpointId?: string | null | undefined;
2533
+ snapshotIndex?: number | null | undefined;
2534
+ }>[];
2535
+ sourceQuotes?: string[] | undefined;
2536
+ }>[] | undefined;
2537
+ prunedItemCounts?: Readonly<{
2538
+ resource: number;
2539
+ running_session: number;
2540
+ decision: number;
2541
+ completed_work: number;
2542
+ pending_work: number;
2543
+ uncertainty: number;
2544
+ constraint?: number | undefined;
2545
+ }> | undefined;
2546
+ }>>;
2547
+ semanticEvidence: z.ZodDefault<z.ZodReadonly<z.ZodObject<{
2548
+ messagesThroughSequence: z.ZodNumber;
2549
+ toolExecutionsThroughSequence: z.ZodNumber;
2550
+ }, "strict", z.ZodTypeAny, {
2551
+ messagesThroughSequence: number;
2552
+ toolExecutionsThroughSequence: number;
2553
+ }, {
2554
+ messagesThroughSequence: number;
2555
+ toolExecutionsThroughSequence: number;
2556
+ }>>>;
2557
+ goal: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
2558
+ verbatimRequest: z.ZodString;
2559
+ sourceSequence: z.ZodNumber;
2560
+ status: z.ZodEnum<["active", "interrupted", "unknown"]>;
2561
+ }, "strict", z.ZodTypeAny, {
2562
+ status: "unknown" | "active" | "interrupted";
2563
+ sourceSequence: number;
2564
+ verbatimRequest: string;
2565
+ }, {
2566
+ status: "unknown" | "active" | "interrupted";
2567
+ sourceSequence: number;
2568
+ verbatimRequest: string;
2569
+ }>>>;
2570
+ constraints: z.ZodArray<z.ZodReadonly<z.ZodObject<{
2571
+ quote: z.ZodString;
2572
+ sourceSequence: z.ZodNumber;
2573
+ }, "strict", z.ZodTypeAny, {
2574
+ sourceSequence: number;
2575
+ quote: string;
2576
+ }, {
2577
+ sourceSequence: number;
2578
+ quote: string;
2579
+ }>>, "many">;
2580
+ resources: z.ZodArray<z.ZodReadonly<z.ZodObject<{
2581
+ key: z.ZodString;
2582
+ mode: z.ZodEnum<["read", "write"]>;
2583
+ evidenceToolCallId: z.ZodString;
2584
+ evidenceExecutionId: z.ZodString;
2585
+ }, "strict", z.ZodTypeAny, {
2586
+ mode: "read" | "write";
2587
+ key: string;
2588
+ evidenceToolCallId: string;
2589
+ evidenceExecutionId: string;
2590
+ }, {
2591
+ mode: "read" | "write";
2592
+ key: string;
2593
+ evidenceToolCallId: string;
2594
+ evidenceExecutionId: string;
2595
+ }>>, "many">;
2596
+ toolState: z.ZodReadonly<z.ZodObject<{
2597
+ countsByOutcome: z.ZodReadonly<z.ZodObject<{
2598
+ success: z.ZodNumber;
2599
+ user_rejected: z.ZodNumber;
2600
+ policy_denied: z.ZodNumber;
2601
+ invalid_input: z.ZodNumber;
2602
+ cancelled: z.ZodNumber;
2603
+ tool_failed: z.ZodNumber;
2604
+ }, "strict", z.ZodTypeAny, {
2605
+ cancelled: number;
2606
+ success: number;
2607
+ user_rejected: number;
2608
+ policy_denied: number;
2609
+ invalid_input: number;
2610
+ tool_failed: number;
2611
+ }, {
2612
+ cancelled: number;
2613
+ success: number;
2614
+ user_rejected: number;
2615
+ policy_denied: number;
2616
+ invalid_input: number;
2617
+ tool_failed: number;
2618
+ }>>;
2619
+ recentRecords: z.ZodArray<z.ZodReadonly<z.ZodObject<{
2620
+ executionId: z.ZodString;
2621
+ sequence: z.ZodNumber;
2622
+ toolCallId: z.ZodString;
2623
+ agentName: z.ZodString;
2624
+ toolName: z.ZodString;
2625
+ outcome: z.ZodReadonly<z.ZodObject<{
2626
+ kind: z.ZodEnum<["success", "user_rejected", "policy_denied", "invalid_input", "cancelled", "tool_failed"]>;
2627
+ reason: z.ZodOptional<z.ZodString>;
2628
+ }, "strict", z.ZodTypeAny, {
2629
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
2630
+ reason?: string | undefined;
2631
+ }, {
2632
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
2633
+ reason?: string | undefined;
2634
+ }>>;
2635
+ }, "strict", z.ZodTypeAny, {
2636
+ toolCallId: string;
2637
+ toolName: string;
2638
+ agentName: string;
2639
+ outcome: Readonly<{
2640
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
2641
+ reason?: string | undefined;
2642
+ }>;
2643
+ sequence: number;
2644
+ executionId: string;
2645
+ }, {
2646
+ toolCallId: string;
2647
+ toolName: string;
2648
+ agentName: string;
2649
+ outcome: Readonly<{
2650
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
2651
+ reason?: string | undefined;
2652
+ }>;
2653
+ sequence: number;
2654
+ executionId: string;
2655
+ }>>, "many">;
2656
+ integrityStatus: z.ZodEnum<["valid", "sanitized", "invalid"]>;
2657
+ anomalies: z.ZodArray<z.ZodReadonly<z.ZodObject<{
2658
+ kind: z.ZodEnum<["orphan_result", "dangling_call", "duplicate_call", "duplicate_result", "record_without_call", "record_without_result", "result_without_record"]>;
2659
+ toolCallId: z.ZodString;
2660
+ count: z.ZodOptional<z.ZodNumber>;
2661
+ }, "strict", z.ZodTypeAny, {
2662
+ toolCallId: string;
2663
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
2664
+ count?: number | undefined;
2665
+ }, {
2666
+ toolCallId: string;
2667
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
2668
+ count?: number | undefined;
2669
+ }>>, "many">;
2670
+ }, "strict", z.ZodTypeAny, {
2671
+ countsByOutcome: Readonly<{
2672
+ cancelled: number;
2673
+ success: number;
2674
+ user_rejected: number;
2675
+ policy_denied: number;
2676
+ invalid_input: number;
2677
+ tool_failed: number;
2678
+ }>;
2679
+ recentRecords: Readonly<{
2680
+ toolCallId: string;
2681
+ toolName: string;
2682
+ agentName: string;
2683
+ outcome: Readonly<{
2684
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
2685
+ reason?: string | undefined;
2686
+ }>;
2687
+ sequence: number;
2688
+ executionId: string;
2689
+ }>[];
2690
+ integrityStatus: "invalid" | "valid" | "sanitized";
2691
+ anomalies: Readonly<{
2692
+ toolCallId: string;
2693
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
2694
+ count?: number | undefined;
2695
+ }>[];
2696
+ }, {
2697
+ countsByOutcome: Readonly<{
2698
+ cancelled: number;
2699
+ success: number;
2700
+ user_rejected: number;
2701
+ policy_denied: number;
2702
+ invalid_input: number;
2703
+ tool_failed: number;
2704
+ }>;
2705
+ recentRecords: Readonly<{
2706
+ toolCallId: string;
2707
+ toolName: string;
2708
+ agentName: string;
2709
+ outcome: Readonly<{
2710
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
2711
+ reason?: string | undefined;
2712
+ }>;
2713
+ sequence: number;
2714
+ executionId: string;
2715
+ }>[];
2716
+ integrityStatus: "invalid" | "valid" | "sanitized";
2717
+ anomalies: Readonly<{
2718
+ toolCallId: string;
2719
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
2720
+ count?: number | undefined;
2721
+ }>[];
2722
+ }>>;
2723
+ runningWork: z.ZodArray<z.ZodReadonly<z.ZodObject<{
2724
+ managerInstanceId: z.ZodString;
2725
+ sessionId: z.ZodNumber;
2726
+ state: z.ZodEnum<["running", "draining", "stopping", "completed", "cleanup-failed"]>;
2727
+ recoverability: z.ZodEnum<["live", "stale", "unavailable"]>;
2728
+ commandPreview: z.ZodString;
2729
+ workdir: z.ZodString;
2730
+ observedAt: z.ZodString;
2731
+ wallTimeMs: z.ZodOptional<z.ZodNumber>;
2732
+ exitCode: z.ZodOptional<z.ZodNumber>;
2733
+ terminationCause: z.ZodOptional<z.ZodString>;
2734
+ cleanupError: z.ZodOptional<z.ZodString>;
2735
+ }, "strict", z.ZodTypeAny, {
2736
+ workdir: string;
2737
+ managerInstanceId: string;
2738
+ sessionId: number;
2739
+ state: "completed" | "running" | "draining" | "stopping" | "cleanup-failed";
2740
+ recoverability: "live" | "stale" | "unavailable";
2741
+ commandPreview: string;
2742
+ observedAt: string;
2743
+ terminationCause?: string | undefined;
2744
+ wallTimeMs?: number | undefined;
2745
+ exitCode?: number | undefined;
2746
+ cleanupError?: string | undefined;
2747
+ }, {
2748
+ workdir: string;
2749
+ managerInstanceId: string;
2750
+ sessionId: number;
2751
+ state: "completed" | "running" | "draining" | "stopping" | "cleanup-failed";
2752
+ recoverability: "live" | "stale" | "unavailable";
2753
+ commandPreview: string;
2754
+ observedAt: string;
2755
+ terminationCause?: string | undefined;
2756
+ wallTimeMs?: number | undefined;
2757
+ exitCode?: number | undefined;
2758
+ cleanupError?: string | undefined;
2759
+ }>>, "many">;
2760
+ context: z.ZodReadonly<z.ZodObject<{
2761
+ cwd: z.ZodString;
2762
+ stableRuleIds: z.ZodArray<z.ZodString, "many">;
2763
+ systemPromptSha256: z.ZodOptional<z.ZodString>;
2764
+ skills: z.ZodArray<z.ZodReadonly<z.ZodObject<{
2765
+ name: z.ZodString;
2766
+ source: z.ZodEnum<["agent", "project", "user", "config"]>;
2767
+ }, "strict", z.ZodTypeAny, {
2768
+ name: string;
2769
+ source: "config" | "user" | "agent" | "project";
2770
+ }, {
2771
+ name: string;
2772
+ source: "config" | "user" | "agent" | "project";
2773
+ }>>, "many">;
2774
+ explicitSkillNames: z.ZodArray<z.ZodString, "many">;
2775
+ }, "strict", z.ZodTypeAny, {
2776
+ skills: Readonly<{
2777
+ name: string;
2778
+ source: "config" | "user" | "agent" | "project";
2779
+ }>[];
2780
+ cwd: string;
2781
+ stableRuleIds: string[];
2782
+ explicitSkillNames: string[];
2783
+ systemPromptSha256?: string | undefined;
2784
+ }, {
2785
+ skills: Readonly<{
2786
+ name: string;
2787
+ source: "config" | "user" | "agent" | "project";
2788
+ }>[];
2789
+ cwd: string;
2790
+ stableRuleIds: string[];
2791
+ explicitSkillNames: string[];
2792
+ systemPromptSha256?: string | undefined;
2793
+ }>>;
2794
+ summary: z.ZodReadonly<z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
2795
+ status: z.ZodLiteral<"valid">;
2796
+ digest: z.ZodString;
2797
+ }, "strict", z.ZodTypeAny, {
2798
+ status: "valid";
2799
+ digest: string;
2800
+ }, {
2801
+ status: "valid";
2802
+ digest: string;
2803
+ }>, z.ZodObject<{
2804
+ status: z.ZodLiteral<"fallback">;
2805
+ reason: z.ZodString;
2806
+ lastValidCheckpointId: z.ZodOptional<z.ZodBranded<z.ZodString, "CompactionCheckpointId">>;
2807
+ }, "strict", z.ZodTypeAny, {
2808
+ status: "fallback";
2809
+ reason: string;
2810
+ lastValidCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
2811
+ }, {
2812
+ status: "fallback";
2813
+ reason: string;
2814
+ lastValidCheckpointId?: string | undefined;
2815
+ }>, z.ZodObject<{
2816
+ status: z.ZodLiteral<"skipped">;
2817
+ lastValidCheckpointId: z.ZodOptional<z.ZodBranded<z.ZodString, "CompactionCheckpointId">>;
2818
+ }, "strict", z.ZodTypeAny, {
2819
+ status: "skipped";
2820
+ lastValidCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
2821
+ }, {
2822
+ status: "skipped";
2823
+ lastValidCheckpointId?: string | undefined;
2824
+ }>]>>;
2825
+ }, "strict", z.ZodTypeAny, {
2826
+ version: 2;
2827
+ createdAt: string;
2828
+ id: string & z.BRAND<"CompactionCheckpointId">;
2829
+ context: Readonly<{
2830
+ skills: Readonly<{
2831
+ name: string;
2832
+ source: "config" | "user" | "agent" | "project";
2833
+ }>[];
2834
+ cwd: string;
2835
+ stableRuleIds: string[];
2836
+ explicitSkillNames: string[];
2837
+ systemPromptSha256?: string | undefined;
2838
+ }>;
2839
+ summary: Readonly<{
2840
+ status: "valid";
2841
+ digest: string;
2842
+ }> | Readonly<{
2843
+ status: "fallback";
2844
+ reason: string;
2845
+ lastValidCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
2846
+ }> | Readonly<{
2847
+ status: "skipped";
2848
+ lastValidCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
2849
+ }>;
2850
+ resources: Readonly<{
2851
+ mode: "read" | "write";
2852
+ key: string;
2853
+ evidenceToolCallId: string;
2854
+ evidenceExecutionId: string;
2855
+ }>[];
2856
+ constraints: Readonly<{
2857
+ sourceSequence: number;
2858
+ quote: string;
2859
+ }>[];
2860
+ toolState: Readonly<{
2861
+ countsByOutcome: Readonly<{
2862
+ cancelled: number;
2863
+ success: number;
2864
+ user_rejected: number;
2865
+ policy_denied: number;
2866
+ invalid_input: number;
2867
+ tool_failed: number;
2868
+ }>;
2869
+ recentRecords: Readonly<{
2870
+ toolCallId: string;
2871
+ toolName: string;
2872
+ agentName: string;
2873
+ outcome: Readonly<{
2874
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
2875
+ reason?: string | undefined;
2876
+ }>;
2877
+ sequence: number;
2878
+ executionId: string;
2879
+ }>[];
2880
+ integrityStatus: "invalid" | "valid" | "sanitized";
2881
+ anomalies: Readonly<{
2882
+ toolCallId: string;
2883
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
2884
+ count?: number | undefined;
2885
+ }>[];
2886
+ }>;
2887
+ runningWork: Readonly<{
2888
+ workdir: string;
2889
+ managerInstanceId: string;
2890
+ sessionId: number;
2891
+ state: "completed" | "running" | "draining" | "stopping" | "cleanup-failed";
2892
+ recoverability: "live" | "stale" | "unavailable";
2893
+ commandPreview: string;
2894
+ observedAt: string;
2895
+ terminationCause?: string | undefined;
2896
+ wallTimeMs?: number | undefined;
2897
+ exitCode?: number | undefined;
2898
+ cleanupError?: string | undefined;
2899
+ }>[];
2900
+ generation: number;
2901
+ transcript: Readonly<{
2902
+ messages: {
2903
+ fromSequenceExclusive: number;
2904
+ throughSequence: number;
2905
+ };
2906
+ toolExecutions: {
2907
+ fromSequenceExclusive: number;
2908
+ throughSequence: number;
2909
+ };
2910
+ completeness: "legacy_snapshot" | "complete";
2911
+ }>;
2912
+ semanticState: Readonly<{
2913
+ version: 1;
2914
+ resources: Readonly<{
2915
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2916
+ resourceKey: string;
2917
+ provenance: Readonly<{
2918
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2919
+ messageSequence: number | null;
2920
+ toolExecutionId: string | null;
2921
+ resourceKey: string | null;
2922
+ managerInstanceId: string | null;
2923
+ sessionId: number | null;
2924
+ checkpointId: string | null;
2925
+ snapshotIndex: number | null;
2926
+ }>[];
2927
+ }>[];
2928
+ goal: Readonly<{
2929
+ text: string;
2930
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2931
+ sourceQuotes: string[];
2932
+ provenance: Readonly<{
2933
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2934
+ messageSequence: number | null;
2935
+ toolExecutionId: string | null;
2936
+ resourceKey: string | null;
2937
+ managerInstanceId: string | null;
2938
+ sessionId: number | null;
2939
+ checkpointId: string | null;
2940
+ snapshotIndex: number | null;
2941
+ }>[];
2942
+ }> | null;
2943
+ constraints: Readonly<{
2944
+ text: string;
2945
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2946
+ sourceQuotes: string[];
2947
+ provenance: Readonly<{
2948
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2949
+ messageSequence: number | null;
2950
+ toolExecutionId: string | null;
2951
+ resourceKey: string | null;
2952
+ managerInstanceId: string | null;
2953
+ sessionId: number | null;
2954
+ checkpointId: string | null;
2955
+ snapshotIndex: number | null;
2956
+ }>[];
2957
+ }>[];
2958
+ decisions: Readonly<{
2959
+ text: string;
2960
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2961
+ sourceQuotes: string[];
2962
+ provenance: Readonly<{
2963
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2964
+ messageSequence: number | null;
2965
+ toolExecutionId: string | null;
2966
+ resourceKey: string | null;
2967
+ managerInstanceId: string | null;
2968
+ sessionId: number | null;
2969
+ checkpointId: string | null;
2970
+ snapshotIndex: number | null;
2971
+ }>[];
2972
+ }>[];
2973
+ completedWork: Readonly<{
2974
+ text: string;
2975
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2976
+ sourceQuotes: string[];
2977
+ provenance: Readonly<{
2978
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2979
+ messageSequence: number | null;
2980
+ toolExecutionId: string | null;
2981
+ resourceKey: string | null;
2982
+ managerInstanceId: string | null;
2983
+ sessionId: number | null;
2984
+ checkpointId: string | null;
2985
+ snapshotIndex: number | null;
2986
+ }>[];
2987
+ }>[];
2988
+ pendingWork: Readonly<{
2989
+ text: string;
2990
+ id: string & z.BRAND<"CompactionSemanticItemId">;
2991
+ sourceQuotes: string[];
2992
+ provenance: Readonly<{
2993
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
2994
+ messageSequence: number | null;
2995
+ toolExecutionId: string | null;
2996
+ resourceKey: string | null;
2997
+ managerInstanceId: string | null;
2998
+ sessionId: number | null;
2999
+ checkpointId: string | null;
3000
+ snapshotIndex: number | null;
3001
+ }>[];
3002
+ }>[];
3003
+ runningSessions: Readonly<{
3004
+ id: string & z.BRAND<"CompactionSemanticItemId">;
3005
+ managerInstanceId: string;
3006
+ sessionId: number;
3007
+ provenance: Readonly<{
3008
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3009
+ messageSequence: number | null;
3010
+ toolExecutionId: string | null;
3011
+ resourceKey: string | null;
3012
+ managerInstanceId: string | null;
3013
+ sessionId: number | null;
3014
+ checkpointId: string | null;
3015
+ snapshotIndex: number | null;
3016
+ }>[];
3017
+ }>[];
3018
+ uncertainties: Readonly<{
3019
+ text: string;
3020
+ id: string & z.BRAND<"CompactionSemanticItemId">;
3021
+ sourceQuotes: string[];
3022
+ provenance: Readonly<{
3023
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3024
+ messageSequence: number | null;
3025
+ toolExecutionId: string | null;
3026
+ resourceKey: string | null;
3027
+ managerInstanceId: string | null;
3028
+ sessionId: number | null;
3029
+ checkpointId: string | null;
3030
+ snapshotIndex: number | null;
3031
+ }>[];
3032
+ }>[];
3033
+ prunedItemCounts: Readonly<{
3034
+ resource: number;
3035
+ running_session: number;
3036
+ constraint: number;
3037
+ decision: number;
3038
+ completed_work: number;
3039
+ pending_work: number;
3040
+ uncertainty: number;
3041
+ }>;
3042
+ }>;
3043
+ semanticEvidence: Readonly<{
3044
+ messagesThroughSequence: number;
3045
+ toolExecutionsThroughSequence: number;
3046
+ }>;
3047
+ goal?: Readonly<{
3048
+ status: "unknown" | "active" | "interrupted";
3049
+ sourceSequence: number;
3050
+ verbatimRequest: string;
3051
+ }> | undefined;
3052
+ previousCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
3053
+ }, {
3054
+ version: 2;
3055
+ createdAt: string;
3056
+ id: string;
3057
+ context: Readonly<{
3058
+ skills: Readonly<{
3059
+ name: string;
3060
+ source: "config" | "user" | "agent" | "project";
3061
+ }>[];
3062
+ cwd: string;
3063
+ stableRuleIds: string[];
3064
+ explicitSkillNames: string[];
3065
+ systemPromptSha256?: string | undefined;
3066
+ }>;
3067
+ summary: Readonly<{
3068
+ status: "valid";
3069
+ digest: string;
3070
+ }> | Readonly<{
3071
+ status: "fallback";
3072
+ reason: string;
3073
+ lastValidCheckpointId?: string | undefined;
3074
+ }> | Readonly<{
3075
+ status: "skipped";
3076
+ lastValidCheckpointId?: string | undefined;
3077
+ }>;
3078
+ resources: Readonly<{
3079
+ mode: "read" | "write";
3080
+ key: string;
3081
+ evidenceToolCallId: string;
3082
+ evidenceExecutionId: string;
3083
+ }>[];
3084
+ constraints: Readonly<{
3085
+ sourceSequence: number;
3086
+ quote: string;
3087
+ }>[];
3088
+ toolState: Readonly<{
3089
+ countsByOutcome: Readonly<{
3090
+ cancelled: number;
3091
+ success: number;
3092
+ user_rejected: number;
3093
+ policy_denied: number;
3094
+ invalid_input: number;
3095
+ tool_failed: number;
3096
+ }>;
3097
+ recentRecords: Readonly<{
3098
+ toolCallId: string;
3099
+ toolName: string;
3100
+ agentName: string;
3101
+ outcome: Readonly<{
3102
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
3103
+ reason?: string | undefined;
3104
+ }>;
3105
+ sequence: number;
3106
+ executionId: string;
3107
+ }>[];
3108
+ integrityStatus: "invalid" | "valid" | "sanitized";
3109
+ anomalies: Readonly<{
3110
+ toolCallId: string;
3111
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
3112
+ count?: number | undefined;
3113
+ }>[];
3114
+ }>;
3115
+ runningWork: Readonly<{
3116
+ workdir: string;
3117
+ managerInstanceId: string;
3118
+ sessionId: number;
3119
+ state: "completed" | "running" | "draining" | "stopping" | "cleanup-failed";
3120
+ recoverability: "live" | "stale" | "unavailable";
3121
+ commandPreview: string;
3122
+ observedAt: string;
3123
+ terminationCause?: string | undefined;
3124
+ wallTimeMs?: number | undefined;
3125
+ exitCode?: number | undefined;
3126
+ cleanupError?: string | undefined;
3127
+ }>[];
3128
+ generation: number;
3129
+ transcript: Readonly<{
3130
+ messages: {
3131
+ fromSequenceExclusive: number;
3132
+ throughSequence: number;
3133
+ };
3134
+ toolExecutions: {
3135
+ fromSequenceExclusive: number;
3136
+ throughSequence: number;
3137
+ };
3138
+ completeness: "legacy_snapshot" | "complete";
3139
+ }>;
3140
+ semanticState: Readonly<{
3141
+ version: 1;
3142
+ resources: Readonly<{
3143
+ id: string;
3144
+ resourceKey: string;
3145
+ provenance: Readonly<{
3146
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3147
+ messageSequence: number | null;
3148
+ toolExecutionId: string | null;
3149
+ resourceKey: string | null;
3150
+ managerInstanceId: string | null;
3151
+ sessionId: number | null;
3152
+ checkpointId?: string | null | undefined;
3153
+ snapshotIndex?: number | null | undefined;
3154
+ }>[];
3155
+ }>[];
3156
+ goal: Readonly<{
3157
+ text: string;
3158
+ id: string;
3159
+ provenance: Readonly<{
3160
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3161
+ messageSequence: number | null;
3162
+ toolExecutionId: string | null;
3163
+ resourceKey: string | null;
3164
+ managerInstanceId: string | null;
3165
+ sessionId: number | null;
3166
+ checkpointId?: string | null | undefined;
3167
+ snapshotIndex?: number | null | undefined;
3168
+ }>[];
3169
+ sourceQuotes?: string[] | undefined;
3170
+ }> | null;
3171
+ decisions: Readonly<{
3172
+ text: string;
3173
+ id: string;
3174
+ provenance: Readonly<{
3175
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3176
+ messageSequence: number | null;
3177
+ toolExecutionId: string | null;
3178
+ resourceKey: string | null;
3179
+ managerInstanceId: string | null;
3180
+ sessionId: number | null;
3181
+ checkpointId?: string | null | undefined;
3182
+ snapshotIndex?: number | null | undefined;
3183
+ }>[];
3184
+ sourceQuotes?: string[] | undefined;
3185
+ }>[];
3186
+ completedWork: Readonly<{
3187
+ text: string;
3188
+ id: string;
3189
+ provenance: Readonly<{
3190
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3191
+ messageSequence: number | null;
3192
+ toolExecutionId: string | null;
3193
+ resourceKey: string | null;
3194
+ managerInstanceId: string | null;
3195
+ sessionId: number | null;
3196
+ checkpointId?: string | null | undefined;
3197
+ snapshotIndex?: number | null | undefined;
3198
+ }>[];
3199
+ sourceQuotes?: string[] | undefined;
3200
+ }>[];
3201
+ pendingWork: Readonly<{
3202
+ text: string;
3203
+ id: string;
3204
+ provenance: Readonly<{
3205
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3206
+ messageSequence: number | null;
3207
+ toolExecutionId: string | null;
3208
+ resourceKey: string | null;
3209
+ managerInstanceId: string | null;
3210
+ sessionId: number | null;
3211
+ checkpointId?: string | null | undefined;
3212
+ snapshotIndex?: number | null | undefined;
3213
+ }>[];
3214
+ sourceQuotes?: string[] | undefined;
3215
+ }>[];
3216
+ runningSessions: Readonly<{
3217
+ id: string;
3218
+ managerInstanceId: string;
3219
+ sessionId: number;
3220
+ provenance: Readonly<{
3221
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3222
+ messageSequence: number | null;
3223
+ toolExecutionId: string | null;
3224
+ resourceKey: string | null;
3225
+ managerInstanceId: string | null;
3226
+ sessionId: number | null;
3227
+ checkpointId?: string | null | undefined;
3228
+ snapshotIndex?: number | null | undefined;
3229
+ }>[];
3230
+ }>[];
3231
+ uncertainties: Readonly<{
3232
+ text: string;
3233
+ id: string;
3234
+ provenance: Readonly<{
3235
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3236
+ messageSequence: number | null;
3237
+ toolExecutionId: string | null;
3238
+ resourceKey: string | null;
3239
+ managerInstanceId: string | null;
3240
+ sessionId: number | null;
3241
+ checkpointId?: string | null | undefined;
3242
+ snapshotIndex?: number | null | undefined;
3243
+ }>[];
3244
+ sourceQuotes?: string[] | undefined;
3245
+ }>[];
3246
+ constraints?: Readonly<{
3247
+ text: string;
3248
+ id: string;
3249
+ provenance: Readonly<{
3250
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3251
+ messageSequence: number | null;
3252
+ toolExecutionId: string | null;
3253
+ resourceKey: string | null;
3254
+ managerInstanceId: string | null;
3255
+ sessionId: number | null;
3256
+ checkpointId?: string | null | undefined;
3257
+ snapshotIndex?: number | null | undefined;
3258
+ }>[];
3259
+ sourceQuotes?: string[] | undefined;
3260
+ }>[] | undefined;
3261
+ prunedItemCounts?: Readonly<{
3262
+ resource: number;
3263
+ running_session: number;
3264
+ decision: number;
3265
+ completed_work: number;
3266
+ pending_work: number;
3267
+ uncertainty: number;
3268
+ constraint?: number | undefined;
3269
+ }> | undefined;
3270
+ }>;
3271
+ goal?: Readonly<{
3272
+ status: "unknown" | "active" | "interrupted";
3273
+ sourceSequence: number;
3274
+ verbatimRequest: string;
3275
+ }> | undefined;
3276
+ previousCheckpointId?: string | undefined;
3277
+ semanticEvidence?: Readonly<{
3278
+ messagesThroughSequence: number;
3279
+ toolExecutionsThroughSequence: number;
3280
+ }> | undefined;
3281
+ }>, {
3282
+ version: 2;
3283
+ createdAt: string;
3284
+ id: string & z.BRAND<"CompactionCheckpointId">;
3285
+ context: Readonly<{
3286
+ skills: Readonly<{
3287
+ name: string;
3288
+ source: "config" | "user" | "agent" | "project";
3289
+ }>[];
3290
+ cwd: string;
3291
+ stableRuleIds: string[];
3292
+ explicitSkillNames: string[];
3293
+ systemPromptSha256?: string | undefined;
3294
+ }>;
3295
+ summary: Readonly<{
3296
+ status: "valid";
3297
+ digest: string;
3298
+ }> | Readonly<{
3299
+ status: "fallback";
3300
+ reason: string;
3301
+ lastValidCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
3302
+ }> | Readonly<{
3303
+ status: "skipped";
3304
+ lastValidCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
3305
+ }>;
3306
+ resources: Readonly<{
3307
+ mode: "read" | "write";
3308
+ key: string;
3309
+ evidenceToolCallId: string;
3310
+ evidenceExecutionId: string;
3311
+ }>[];
3312
+ constraints: Readonly<{
3313
+ sourceSequence: number;
3314
+ quote: string;
3315
+ }>[];
3316
+ toolState: Readonly<{
3317
+ countsByOutcome: Readonly<{
3318
+ cancelled: number;
3319
+ success: number;
3320
+ user_rejected: number;
3321
+ policy_denied: number;
3322
+ invalid_input: number;
3323
+ tool_failed: number;
3324
+ }>;
3325
+ recentRecords: Readonly<{
3326
+ toolCallId: string;
3327
+ toolName: string;
3328
+ agentName: string;
3329
+ outcome: Readonly<{
3330
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
3331
+ reason?: string | undefined;
3332
+ }>;
3333
+ sequence: number;
3334
+ executionId: string;
3335
+ }>[];
3336
+ integrityStatus: "invalid" | "valid" | "sanitized";
3337
+ anomalies: Readonly<{
3338
+ toolCallId: string;
3339
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
3340
+ count?: number | undefined;
3341
+ }>[];
3342
+ }>;
3343
+ runningWork: Readonly<{
3344
+ workdir: string;
3345
+ managerInstanceId: string;
3346
+ sessionId: number;
3347
+ state: "completed" | "running" | "draining" | "stopping" | "cleanup-failed";
3348
+ recoverability: "live" | "stale" | "unavailable";
3349
+ commandPreview: string;
3350
+ observedAt: string;
3351
+ terminationCause?: string | undefined;
3352
+ wallTimeMs?: number | undefined;
3353
+ exitCode?: number | undefined;
3354
+ cleanupError?: string | undefined;
3355
+ }>[];
3356
+ generation: number;
3357
+ transcript: Readonly<{
3358
+ messages: {
3359
+ fromSequenceExclusive: number;
3360
+ throughSequence: number;
3361
+ };
3362
+ toolExecutions: {
3363
+ fromSequenceExclusive: number;
3364
+ throughSequence: number;
3365
+ };
3366
+ completeness: "legacy_snapshot" | "complete";
3367
+ }>;
3368
+ semanticState: Readonly<{
3369
+ version: 1;
3370
+ resources: Readonly<{
3371
+ id: string & z.BRAND<"CompactionSemanticItemId">;
3372
+ resourceKey: string;
3373
+ provenance: Readonly<{
3374
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3375
+ messageSequence: number | null;
3376
+ toolExecutionId: string | null;
3377
+ resourceKey: string | null;
3378
+ managerInstanceId: string | null;
3379
+ sessionId: number | null;
3380
+ checkpointId: string | null;
3381
+ snapshotIndex: number | null;
3382
+ }>[];
3383
+ }>[];
3384
+ goal: Readonly<{
3385
+ text: string;
3386
+ id: string & z.BRAND<"CompactionSemanticItemId">;
3387
+ sourceQuotes: string[];
3388
+ provenance: Readonly<{
3389
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3390
+ messageSequence: number | null;
3391
+ toolExecutionId: string | null;
3392
+ resourceKey: string | null;
3393
+ managerInstanceId: string | null;
3394
+ sessionId: number | null;
3395
+ checkpointId: string | null;
3396
+ snapshotIndex: number | null;
3397
+ }>[];
3398
+ }> | null;
3399
+ constraints: Readonly<{
3400
+ text: string;
3401
+ id: string & z.BRAND<"CompactionSemanticItemId">;
3402
+ sourceQuotes: string[];
3403
+ provenance: Readonly<{
3404
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3405
+ messageSequence: number | null;
3406
+ toolExecutionId: string | null;
3407
+ resourceKey: string | null;
3408
+ managerInstanceId: string | null;
3409
+ sessionId: number | null;
3410
+ checkpointId: string | null;
3411
+ snapshotIndex: number | null;
3412
+ }>[];
3413
+ }>[];
3414
+ decisions: Readonly<{
3415
+ text: string;
3416
+ id: string & z.BRAND<"CompactionSemanticItemId">;
3417
+ sourceQuotes: string[];
3418
+ provenance: Readonly<{
3419
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3420
+ messageSequence: number | null;
3421
+ toolExecutionId: string | null;
3422
+ resourceKey: string | null;
3423
+ managerInstanceId: string | null;
3424
+ sessionId: number | null;
3425
+ checkpointId: string | null;
3426
+ snapshotIndex: number | null;
3427
+ }>[];
3428
+ }>[];
3429
+ completedWork: Readonly<{
3430
+ text: string;
3431
+ id: string & z.BRAND<"CompactionSemanticItemId">;
3432
+ sourceQuotes: string[];
3433
+ provenance: Readonly<{
3434
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3435
+ messageSequence: number | null;
3436
+ toolExecutionId: string | null;
3437
+ resourceKey: string | null;
3438
+ managerInstanceId: string | null;
3439
+ sessionId: number | null;
3440
+ checkpointId: string | null;
3441
+ snapshotIndex: number | null;
3442
+ }>[];
3443
+ }>[];
3444
+ pendingWork: Readonly<{
3445
+ text: string;
3446
+ id: string & z.BRAND<"CompactionSemanticItemId">;
3447
+ sourceQuotes: string[];
3448
+ provenance: Readonly<{
3449
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3450
+ messageSequence: number | null;
3451
+ toolExecutionId: string | null;
3452
+ resourceKey: string | null;
3453
+ managerInstanceId: string | null;
3454
+ sessionId: number | null;
3455
+ checkpointId: string | null;
3456
+ snapshotIndex: number | null;
3457
+ }>[];
3458
+ }>[];
3459
+ runningSessions: Readonly<{
3460
+ id: string & z.BRAND<"CompactionSemanticItemId">;
3461
+ managerInstanceId: string;
3462
+ sessionId: number;
3463
+ provenance: Readonly<{
3464
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3465
+ messageSequence: number | null;
3466
+ toolExecutionId: string | null;
3467
+ resourceKey: string | null;
3468
+ managerInstanceId: string | null;
3469
+ sessionId: number | null;
3470
+ checkpointId: string | null;
3471
+ snapshotIndex: number | null;
3472
+ }>[];
3473
+ }>[];
3474
+ uncertainties: Readonly<{
3475
+ text: string;
3476
+ id: string & z.BRAND<"CompactionSemanticItemId">;
3477
+ sourceQuotes: string[];
3478
+ provenance: Readonly<{
3479
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3480
+ messageSequence: number | null;
3481
+ toolExecutionId: string | null;
3482
+ resourceKey: string | null;
3483
+ managerInstanceId: string | null;
3484
+ sessionId: number | null;
3485
+ checkpointId: string | null;
3486
+ snapshotIndex: number | null;
3487
+ }>[];
3488
+ }>[];
3489
+ prunedItemCounts: Readonly<{
3490
+ resource: number;
3491
+ running_session: number;
3492
+ constraint: number;
3493
+ decision: number;
3494
+ completed_work: number;
3495
+ pending_work: number;
3496
+ uncertainty: number;
3497
+ }>;
3498
+ }>;
3499
+ semanticEvidence: Readonly<{
3500
+ messagesThroughSequence: number;
3501
+ toolExecutionsThroughSequence: number;
3502
+ }>;
3503
+ goal?: Readonly<{
3504
+ status: "unknown" | "active" | "interrupted";
3505
+ sourceSequence: number;
3506
+ verbatimRequest: string;
3507
+ }> | undefined;
3508
+ previousCheckpointId?: (string & z.BRAND<"CompactionCheckpointId">) | undefined;
3509
+ }, {
3510
+ version: 2;
3511
+ createdAt: string;
3512
+ id: string;
3513
+ context: Readonly<{
3514
+ skills: Readonly<{
3515
+ name: string;
3516
+ source: "config" | "user" | "agent" | "project";
3517
+ }>[];
3518
+ cwd: string;
3519
+ stableRuleIds: string[];
3520
+ explicitSkillNames: string[];
3521
+ systemPromptSha256?: string | undefined;
3522
+ }>;
3523
+ summary: Readonly<{
3524
+ status: "valid";
3525
+ digest: string;
3526
+ }> | Readonly<{
3527
+ status: "fallback";
3528
+ reason: string;
3529
+ lastValidCheckpointId?: string | undefined;
3530
+ }> | Readonly<{
3531
+ status: "skipped";
3532
+ lastValidCheckpointId?: string | undefined;
3533
+ }>;
3534
+ resources: Readonly<{
3535
+ mode: "read" | "write";
3536
+ key: string;
3537
+ evidenceToolCallId: string;
3538
+ evidenceExecutionId: string;
3539
+ }>[];
3540
+ constraints: Readonly<{
3541
+ sourceSequence: number;
3542
+ quote: string;
3543
+ }>[];
3544
+ toolState: Readonly<{
3545
+ countsByOutcome: Readonly<{
3546
+ cancelled: number;
3547
+ success: number;
3548
+ user_rejected: number;
3549
+ policy_denied: number;
3550
+ invalid_input: number;
3551
+ tool_failed: number;
3552
+ }>;
3553
+ recentRecords: Readonly<{
3554
+ toolCallId: string;
3555
+ toolName: string;
3556
+ agentName: string;
3557
+ outcome: Readonly<{
3558
+ kind: "cancelled" | "success" | "user_rejected" | "policy_denied" | "invalid_input" | "tool_failed";
3559
+ reason?: string | undefined;
3560
+ }>;
3561
+ sequence: number;
3562
+ executionId: string;
3563
+ }>[];
3564
+ integrityStatus: "invalid" | "valid" | "sanitized";
3565
+ anomalies: Readonly<{
3566
+ toolCallId: string;
3567
+ kind: "orphan_result" | "dangling_call" | "duplicate_call" | "duplicate_result" | "record_without_call" | "record_without_result" | "result_without_record";
3568
+ count?: number | undefined;
3569
+ }>[];
3570
+ }>;
3571
+ runningWork: Readonly<{
3572
+ workdir: string;
3573
+ managerInstanceId: string;
3574
+ sessionId: number;
3575
+ state: "completed" | "running" | "draining" | "stopping" | "cleanup-failed";
3576
+ recoverability: "live" | "stale" | "unavailable";
3577
+ commandPreview: string;
3578
+ observedAt: string;
3579
+ terminationCause?: string | undefined;
3580
+ wallTimeMs?: number | undefined;
3581
+ exitCode?: number | undefined;
3582
+ cleanupError?: string | undefined;
3583
+ }>[];
3584
+ generation: number;
3585
+ transcript: Readonly<{
3586
+ messages: {
3587
+ fromSequenceExclusive: number;
3588
+ throughSequence: number;
3589
+ };
3590
+ toolExecutions: {
3591
+ fromSequenceExclusive: number;
3592
+ throughSequence: number;
3593
+ };
3594
+ completeness: "legacy_snapshot" | "complete";
3595
+ }>;
3596
+ semanticState: Readonly<{
3597
+ version: 1;
3598
+ resources: Readonly<{
3599
+ id: string;
3600
+ resourceKey: string;
3601
+ provenance: Readonly<{
3602
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3603
+ messageSequence: number | null;
3604
+ toolExecutionId: string | null;
3605
+ resourceKey: string | null;
3606
+ managerInstanceId: string | null;
3607
+ sessionId: number | null;
3608
+ checkpointId?: string | null | undefined;
3609
+ snapshotIndex?: number | null | undefined;
3610
+ }>[];
3611
+ }>[];
3612
+ goal: Readonly<{
3613
+ text: string;
3614
+ id: string;
3615
+ provenance: Readonly<{
3616
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3617
+ messageSequence: number | null;
3618
+ toolExecutionId: string | null;
3619
+ resourceKey: string | null;
3620
+ managerInstanceId: string | null;
3621
+ sessionId: number | null;
3622
+ checkpointId?: string | null | undefined;
3623
+ snapshotIndex?: number | null | undefined;
3624
+ }>[];
3625
+ sourceQuotes?: string[] | undefined;
3626
+ }> | null;
3627
+ decisions: Readonly<{
3628
+ text: string;
3629
+ id: string;
3630
+ provenance: Readonly<{
3631
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3632
+ messageSequence: number | null;
3633
+ toolExecutionId: string | null;
3634
+ resourceKey: string | null;
3635
+ managerInstanceId: string | null;
3636
+ sessionId: number | null;
3637
+ checkpointId?: string | null | undefined;
3638
+ snapshotIndex?: number | null | undefined;
3639
+ }>[];
3640
+ sourceQuotes?: string[] | undefined;
3641
+ }>[];
3642
+ completedWork: Readonly<{
3643
+ text: string;
3644
+ id: string;
3645
+ provenance: Readonly<{
3646
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3647
+ messageSequence: number | null;
3648
+ toolExecutionId: string | null;
3649
+ resourceKey: string | null;
3650
+ managerInstanceId: string | null;
3651
+ sessionId: number | null;
3652
+ checkpointId?: string | null | undefined;
3653
+ snapshotIndex?: number | null | undefined;
3654
+ }>[];
3655
+ sourceQuotes?: string[] | undefined;
3656
+ }>[];
3657
+ pendingWork: Readonly<{
3658
+ text: string;
3659
+ id: string;
3660
+ provenance: Readonly<{
3661
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3662
+ messageSequence: number | null;
3663
+ toolExecutionId: string | null;
3664
+ resourceKey: string | null;
3665
+ managerInstanceId: string | null;
3666
+ sessionId: number | null;
3667
+ checkpointId?: string | null | undefined;
3668
+ snapshotIndex?: number | null | undefined;
3669
+ }>[];
3670
+ sourceQuotes?: string[] | undefined;
3671
+ }>[];
3672
+ runningSessions: Readonly<{
3673
+ id: string;
3674
+ managerInstanceId: string;
3675
+ sessionId: number;
3676
+ provenance: Readonly<{
3677
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3678
+ messageSequence: number | null;
3679
+ toolExecutionId: string | null;
3680
+ resourceKey: string | null;
3681
+ managerInstanceId: string | null;
3682
+ sessionId: number | null;
3683
+ checkpointId?: string | null | undefined;
3684
+ snapshotIndex?: number | null | undefined;
3685
+ }>[];
3686
+ }>[];
3687
+ uncertainties: Readonly<{
3688
+ text: string;
3689
+ id: string;
3690
+ provenance: Readonly<{
3691
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3692
+ messageSequence: number | null;
3693
+ toolExecutionId: string | null;
3694
+ resourceKey: string | null;
3695
+ managerInstanceId: string | null;
3696
+ sessionId: number | null;
3697
+ checkpointId?: string | null | undefined;
3698
+ snapshotIndex?: number | null | undefined;
3699
+ }>[];
3700
+ sourceQuotes?: string[] | undefined;
3701
+ }>[];
3702
+ constraints?: Readonly<{
3703
+ text: string;
3704
+ id: string;
3705
+ provenance: Readonly<{
3706
+ kind: "resource" | "message" | "tool_execution" | "running_session" | "legacy_snapshot";
3707
+ messageSequence: number | null;
3708
+ toolExecutionId: string | null;
3709
+ resourceKey: string | null;
3710
+ managerInstanceId: string | null;
3711
+ sessionId: number | null;
3712
+ checkpointId?: string | null | undefined;
3713
+ snapshotIndex?: number | null | undefined;
3714
+ }>[];
3715
+ sourceQuotes?: string[] | undefined;
3716
+ }>[] | undefined;
3717
+ prunedItemCounts?: Readonly<{
3718
+ resource: number;
3719
+ running_session: number;
3720
+ decision: number;
3721
+ completed_work: number;
3722
+ pending_work: number;
3723
+ uncertainty: number;
3724
+ constraint?: number | undefined;
3725
+ }> | undefined;
3726
+ }>;
3727
+ goal?: Readonly<{
3728
+ status: "unknown" | "active" | "interrupted";
3729
+ sourceSequence: number;
3730
+ verbatimRequest: string;
3731
+ }> | undefined;
3732
+ previousCheckpointId?: string | undefined;
3733
+ semanticEvidence?: Readonly<{
3734
+ messagesThroughSequence: number;
3735
+ toolExecutionsThroughSequence: number;
3736
+ }> | undefined;
3737
+ }>>;
3738
+ export type CompactionGoal = z.infer<typeof compactionGoalSchema>;
3739
+ export type CompactionConstraint = z.infer<typeof compactionConstraintSchema>;
3740
+ export type CompactionResource = z.infer<typeof compactionResourceSchema>;
3741
+ export type CompactionToolState = z.infer<typeof compactionToolStateSchema>;
3742
+ export type CompactionRunningWork = z.infer<typeof compactionRunningWorkSchema>;
3743
+ export type CompactionContext = z.infer<typeof compactionContextSchema>;
3744
+ export type CompactionTranscriptRange = z.infer<typeof compactionTranscriptRangeSchema>;
3745
+ export type CompactionTranscript = z.infer<typeof compactionTranscriptSchema>;
3746
+ export type CompactionSemanticEvidenceWatermarks = z.infer<typeof compactionSemanticEvidenceWatermarksSchema>;
3747
+ export type CompactionSummary = z.infer<typeof compactionSummarySchema>;
3748
+ export type CompactionCheckpointDraft = z.infer<typeof compactionCheckpointDraftSchema>;
3749
+ export type CompactionCheckpointDraftInput = z.input<typeof compactionCheckpointDraftSchema>;
3750
+ export type CompactionCheckpointV1 = z.infer<typeof compactionCheckpointV1Schema>;
3751
+ export type CompactionCheckpointV2 = z.infer<typeof compactionCheckpointV2Schema>;
3752
+ export type CompactionCheckpoint = CompactionCheckpointV1 | CompactionCheckpointV2;
3753
+ export declare const archivedTranscriptMessageSchema: z.ZodReadonly<z.ZodObject<{
3754
+ sequence: z.ZodNumber;
3755
+ provenance: z.ZodEnum<["native", "legacy_snapshot"]>;
3756
+ createdAt: z.ZodString;
3757
+ message: z.ZodType<ModelMessage, z.ZodTypeDef, ModelMessage>;
3758
+ }, "strict", z.ZodTypeAny, {
3759
+ createdAt: string;
3760
+ message: ModelMessage;
3761
+ provenance: "legacy_snapshot" | "native";
3762
+ sequence: number;
3763
+ }, {
3764
+ createdAt: string;
3765
+ message: ModelMessage;
3766
+ provenance: "legacy_snapshot" | "native";
3767
+ sequence: number;
3768
+ }>>;
3769
+ export type ArchivedTranscriptMessage = z.infer<typeof archivedTranscriptMessageSchema>;
3770
+ export declare const compactionConstraintCandidateSchema: z.ZodReadonly<z.ZodObject<{
3771
+ quote: z.ZodString;
3772
+ sourceSequence: z.ZodNumber;
3773
+ }, "strict", z.ZodTypeAny, {
3774
+ sourceSequence: number;
3775
+ quote: string;
3776
+ }, {
3777
+ sourceSequence: number;
3778
+ quote: string;
3779
+ }>>;
3780
+ export type CompactionConstraintCandidate = z.infer<typeof compactionConstraintCandidateSchema>;
3781
+ export interface SequencedToolExecutionEvidence extends ToolExecutionRecord {
3782
+ readonly sequence: number;
3783
+ }
3784
+ export interface CreateCompactionCheckpointInput {
3785
+ readonly draft: CompactionCheckpointDraftInput;
3786
+ readonly generation: number;
3787
+ readonly transcript: CompactionTranscript;
3788
+ readonly id?: string;
3789
+ readonly previousCheckpointId?: string;
3790
+ readonly createdAt?: string;
3791
+ readonly semanticState?: CompactionSemanticState;
3792
+ readonly semanticEvidence?: CompactionSemanticEvidenceWatermarks;
3793
+ }
3794
+ /** Uses the exact semantic budget applied by the production checkpoint reminder. */
3795
+ export declare function createCheckpointSemanticReminderProjection(state: CompactionSemanticState): ReturnType<typeof createCompactionSemanticReminderProjection>;
3796
+ export declare function createEmptyCompactionToolState(): CompactionToolState;
3797
+ export declare function buildCompactionToolState(evidenceMessages: readonly ModelMessage[], evidenceRecords: readonly SequencedToolExecutionEvidence[], recentLimit?: number, completeness?: CompactionTranscript["completeness"]): CompactionToolState;
3798
+ export declare function findLatestRealUserGoal(entries: readonly ArchivedTranscriptMessage[], status?: CompactionGoal["status"]): CompactionGoal | undefined;
3799
+ /**
3800
+ * Extracts conservative, verbatim constraint clauses from persisted user transcript evidence.
3801
+ * Every returned quote remains directly verifiable by sourceSequence; continuation-only turns
3802
+ * and ordinary goal prose do not become constraints.
3803
+ */
3804
+ export declare function extractExplicitCompactionConstraintCandidates(entries: readonly ArchivedTranscriptMessage[]): readonly CompactionConstraintCandidate[];
3805
+ /**
3806
+ * Resolves the bounded set of currently-active explicit constraints.
3807
+ *
3808
+ * Priority is transcript sequence: a later assertion replaces an earlier assertion for the same
3809
+ * normalized scope, while a later explicit allowance/revocation removes that scope. Matching is
3810
+ * intentionally exact after directive/punctuation normalization; implicit paraphrases, synonyms,
3811
+ * and cross-scope contradictions remain outside this deterministic Harness layer.
3812
+ */
3813
+ export declare function resolveActiveCompactionConstraints(entries: readonly ArchivedTranscriptMessage[], previous?: readonly CompactionConstraint[]): readonly CompactionConstraint[];
3814
+ export declare function verifyCompactionConstraintCandidates(entries: readonly ArchivedTranscriptMessage[], candidates: readonly CompactionConstraintCandidate[], previous?: readonly CompactionConstraint[]): readonly CompactionConstraint[];
3815
+ export declare function createCompactionSummary(text: string | undefined): CompactionSummary;
3816
+ /**
3817
+ * A non-authoritative quality hint for debug telemetry only. Recovery facts come
3818
+ * from the structured checkpoint, Tool ledger and transcript evidence instead
3819
+ * of language-specific words in the generated prose.
3820
+ */
3821
+ export declare function compactionSummaryQualityAdvisory(text: string | undefined): string | undefined;
3822
+ export declare function createCompactionCheckpointDraft(input: CompactionCheckpointDraftInput): CompactionCheckpointDraft;
3823
+ export declare function createCompactionCheckpoint(input: CreateCompactionCheckpointInput): CompactionCheckpointV2;
3824
+ export declare function parseCompactionCheckpoint(value: unknown): CompactionCheckpoint;
3825
+ export declare function isCompactionCheckpoint(value: unknown): value is CompactionCheckpoint;
3826
+ export declare function buildCompactionCheckpointReminder(checkpoint: CompactionCheckpoint, currentManagerInstanceId?: string, transcriptToolId?: string): string;
3827
+ export {};