@av-pi-studio/protocol 0.0.107 → 0.0.109
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client-capabilities.d.ts +1 -0
- package/dist/client-capabilities.js +3 -0
- package/dist/messages.d.ts +366 -0
- package/dist/messages.js +22 -0
- package/package.json +1 -1
|
@@ -38,6 +38,7 @@ export declare const SERVER_FEATURES: {
|
|
|
38
38
|
readonly thinkingLevels: "thinkingLevels";
|
|
39
39
|
readonly viewerSettings: "viewerSettings";
|
|
40
40
|
readonly forkTimelineSync: "forkTimelineSync";
|
|
41
|
+
readonly compactionEvents: "compactionEvents";
|
|
41
42
|
};
|
|
42
43
|
export type ServerFeatureKey = keyof typeof SERVER_FEATURES;
|
|
43
44
|
export type ServerFeature = (typeof SERVER_FEATURES)[ServerFeatureKey];
|
|
@@ -42,6 +42,7 @@ export const SERVER_FEATURES = {
|
|
|
42
42
|
thinkingLevels: "thinkingLevels",
|
|
43
43
|
viewerSettings: "viewerSettings",
|
|
44
44
|
forkTimelineSync: "forkTimelineSync",
|
|
45
|
+
compactionEvents: "compactionEvents",
|
|
45
46
|
};
|
|
46
47
|
/**
|
|
47
48
|
* COMPAT annotations for each server feature flag (version added + removal date). The removal dates
|
|
@@ -79,6 +80,8 @@ export const SERVER_FEATURE_COMPAT = {
|
|
|
79
80
|
viewerSettings: COMPAT({ name: "viewerSettings", addedIn: "0.0.0", removeBy: "TBD" }),
|
|
80
81
|
// COMPAT(forkTimelineSync): added 0.0.0, remove by TBD
|
|
81
82
|
forkTimelineSync: COMPAT({ name: "forkTimelineSync", addedIn: "0.0.0", removeBy: "TBD" }),
|
|
83
|
+
// COMPAT(compactionEvents): added 0.0.0, remove by TBD
|
|
84
|
+
compactionEvents: COMPAT({ name: "compactionEvents", addedIn: "0.0.0", removeBy: "TBD" }),
|
|
82
85
|
};
|
|
83
86
|
/**
|
|
84
87
|
* Returns true only if `flag` is advertised by `caps`. Used at serialization time to gate new wire
|
package/dist/messages.d.ts
CHANGED
|
@@ -927,6 +927,36 @@ export declare const agentStreamEventSchema: z.ZodDiscriminatedUnion<"kind", [z.
|
|
|
927
927
|
kind: "queue_update";
|
|
928
928
|
steering?: string[] | undefined;
|
|
929
929
|
followUp?: string[] | undefined;
|
|
930
|
+
}>, z.ZodObject<{
|
|
931
|
+
kind: z.ZodLiteral<"compaction">;
|
|
932
|
+
compactionId: z.ZodString;
|
|
933
|
+
phase: z.ZodEnum<["started", "completed", "failed", "canceled"]>;
|
|
934
|
+
reason: z.ZodOptional<z.ZodEnum<["manual", "threshold", "overflow"]>>;
|
|
935
|
+
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
936
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
937
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
938
|
+
error: z.ZodOptional<z.ZodString>;
|
|
939
|
+
willRetry: z.ZodOptional<z.ZodBoolean>;
|
|
940
|
+
}, "strip", z.ZodTypeAny, {
|
|
941
|
+
kind: "compaction";
|
|
942
|
+
compactionId: string;
|
|
943
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
944
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
945
|
+
tokensBefore?: number | undefined;
|
|
946
|
+
estimatedTokensAfter?: number | undefined;
|
|
947
|
+
summary?: string | undefined;
|
|
948
|
+
error?: string | undefined;
|
|
949
|
+
willRetry?: boolean | undefined;
|
|
950
|
+
}, {
|
|
951
|
+
kind: "compaction";
|
|
952
|
+
compactionId: string;
|
|
953
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
954
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
955
|
+
tokensBefore?: number | undefined;
|
|
956
|
+
estimatedTokensAfter?: number | undefined;
|
|
957
|
+
summary?: string | undefined;
|
|
958
|
+
error?: string | undefined;
|
|
959
|
+
willRetry?: boolean | undefined;
|
|
930
960
|
}>]>;
|
|
931
961
|
export type AgentStreamEvent = z.infer<typeof agentStreamEventSchema>;
|
|
932
962
|
export declare const agentStreamSchema: z.ZodObject<{
|
|
@@ -1220,6 +1250,36 @@ export declare const agentStreamSchema: z.ZodObject<{
|
|
|
1220
1250
|
kind: "queue_update";
|
|
1221
1251
|
steering?: string[] | undefined;
|
|
1222
1252
|
followUp?: string[] | undefined;
|
|
1253
|
+
}>, z.ZodObject<{
|
|
1254
|
+
kind: z.ZodLiteral<"compaction">;
|
|
1255
|
+
compactionId: z.ZodString;
|
|
1256
|
+
phase: z.ZodEnum<["started", "completed", "failed", "canceled"]>;
|
|
1257
|
+
reason: z.ZodOptional<z.ZodEnum<["manual", "threshold", "overflow"]>>;
|
|
1258
|
+
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
1259
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
1260
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
1261
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1262
|
+
willRetry: z.ZodOptional<z.ZodBoolean>;
|
|
1263
|
+
}, "strip", z.ZodTypeAny, {
|
|
1264
|
+
kind: "compaction";
|
|
1265
|
+
compactionId: string;
|
|
1266
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
1267
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
1268
|
+
tokensBefore?: number | undefined;
|
|
1269
|
+
estimatedTokensAfter?: number | undefined;
|
|
1270
|
+
summary?: string | undefined;
|
|
1271
|
+
error?: string | undefined;
|
|
1272
|
+
willRetry?: boolean | undefined;
|
|
1273
|
+
}, {
|
|
1274
|
+
kind: "compaction";
|
|
1275
|
+
compactionId: string;
|
|
1276
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
1277
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
1278
|
+
tokensBefore?: number | undefined;
|
|
1279
|
+
estimatedTokensAfter?: number | undefined;
|
|
1280
|
+
summary?: string | undefined;
|
|
1281
|
+
error?: string | undefined;
|
|
1282
|
+
willRetry?: boolean | undefined;
|
|
1223
1283
|
}>]>;
|
|
1224
1284
|
}, "strip", z.ZodTypeAny, {
|
|
1225
1285
|
type: "agent_stream";
|
|
@@ -1297,6 +1357,16 @@ export declare const agentStreamSchema: z.ZodObject<{
|
|
|
1297
1357
|
kind: "queue_update";
|
|
1298
1358
|
steering?: string[] | undefined;
|
|
1299
1359
|
followUp?: string[] | undefined;
|
|
1360
|
+
} | {
|
|
1361
|
+
kind: "compaction";
|
|
1362
|
+
compactionId: string;
|
|
1363
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
1364
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
1365
|
+
tokensBefore?: number | undefined;
|
|
1366
|
+
estimatedTokensAfter?: number | undefined;
|
|
1367
|
+
summary?: string | undefined;
|
|
1368
|
+
error?: string | undefined;
|
|
1369
|
+
willRetry?: boolean | undefined;
|
|
1300
1370
|
};
|
|
1301
1371
|
}, {
|
|
1302
1372
|
type: "agent_stream";
|
|
@@ -1374,6 +1444,16 @@ export declare const agentStreamSchema: z.ZodObject<{
|
|
|
1374
1444
|
kind: "queue_update";
|
|
1375
1445
|
steering?: string[] | undefined;
|
|
1376
1446
|
followUp?: string[] | undefined;
|
|
1447
|
+
} | {
|
|
1448
|
+
kind: "compaction";
|
|
1449
|
+
compactionId: string;
|
|
1450
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
1451
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
1452
|
+
tokensBefore?: number | undefined;
|
|
1453
|
+
estimatedTokensAfter?: number | undefined;
|
|
1454
|
+
summary?: string | undefined;
|
|
1455
|
+
error?: string | undefined;
|
|
1456
|
+
willRetry?: boolean | undefined;
|
|
1377
1457
|
};
|
|
1378
1458
|
}>;
|
|
1379
1459
|
export declare const timelineDirectionEnum: z.ZodEnum<["before", "after"]>;
|
|
@@ -2277,16 +2357,22 @@ export declare const agentCompactResponseSchema: z.ZodObject<{
|
|
|
2277
2357
|
summary: z.ZodOptional<z.ZodString>;
|
|
2278
2358
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
2279
2359
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
2360
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
2361
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
2280
2362
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
2281
2363
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
2282
2364
|
summary: z.ZodOptional<z.ZodString>;
|
|
2283
2365
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
2284
2366
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
2367
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
2368
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
2285
2369
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
2286
2370
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
2287
2371
|
summary: z.ZodOptional<z.ZodString>;
|
|
2288
2372
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
2289
2373
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
2374
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
2375
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
2290
2376
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
2291
2377
|
}, z.ZodTypeAny, "passthrough">>;
|
|
2292
2378
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
@@ -2296,16 +2382,22 @@ export declare const agentCompactResponseSchema: z.ZodObject<{
|
|
|
2296
2382
|
summary: z.ZodOptional<z.ZodString>;
|
|
2297
2383
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
2298
2384
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
2385
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
2386
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
2299
2387
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
2300
2388
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
2301
2389
|
summary: z.ZodOptional<z.ZodString>;
|
|
2302
2390
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
2303
2391
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
2392
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
2393
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
2304
2394
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
2305
2395
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
2306
2396
|
summary: z.ZodOptional<z.ZodString>;
|
|
2307
2397
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
2308
2398
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
2399
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
2400
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
2309
2401
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
2310
2402
|
}, z.ZodTypeAny, "passthrough">>;
|
|
2311
2403
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
@@ -2315,16 +2407,22 @@ export declare const agentCompactResponseSchema: z.ZodObject<{
|
|
|
2315
2407
|
summary: z.ZodOptional<z.ZodString>;
|
|
2316
2408
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
2317
2409
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
2410
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
2411
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
2318
2412
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
2319
2413
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
2320
2414
|
summary: z.ZodOptional<z.ZodString>;
|
|
2321
2415
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
2322
2416
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
2417
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
2418
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
2323
2419
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
2324
2420
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
2325
2421
|
summary: z.ZodOptional<z.ZodString>;
|
|
2326
2422
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
2327
2423
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
2424
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
2425
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
2328
2426
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
2329
2427
|
}, z.ZodTypeAny, "passthrough">>;
|
|
2330
2428
|
}, z.ZodTypeAny, "passthrough">>;
|
|
@@ -8609,6 +8707,36 @@ export declare const sessionMessageSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
8609
8707
|
kind: "queue_update";
|
|
8610
8708
|
steering?: string[] | undefined;
|
|
8611
8709
|
followUp?: string[] | undefined;
|
|
8710
|
+
}>, z.ZodObject<{
|
|
8711
|
+
kind: z.ZodLiteral<"compaction">;
|
|
8712
|
+
compactionId: z.ZodString;
|
|
8713
|
+
phase: z.ZodEnum<["started", "completed", "failed", "canceled"]>;
|
|
8714
|
+
reason: z.ZodOptional<z.ZodEnum<["manual", "threshold", "overflow"]>>;
|
|
8715
|
+
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
8716
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
8717
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
8718
|
+
error: z.ZodOptional<z.ZodString>;
|
|
8719
|
+
willRetry: z.ZodOptional<z.ZodBoolean>;
|
|
8720
|
+
}, "strip", z.ZodTypeAny, {
|
|
8721
|
+
kind: "compaction";
|
|
8722
|
+
compactionId: string;
|
|
8723
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
8724
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
8725
|
+
tokensBefore?: number | undefined;
|
|
8726
|
+
estimatedTokensAfter?: number | undefined;
|
|
8727
|
+
summary?: string | undefined;
|
|
8728
|
+
error?: string | undefined;
|
|
8729
|
+
willRetry?: boolean | undefined;
|
|
8730
|
+
}, {
|
|
8731
|
+
kind: "compaction";
|
|
8732
|
+
compactionId: string;
|
|
8733
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
8734
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
8735
|
+
tokensBefore?: number | undefined;
|
|
8736
|
+
estimatedTokensAfter?: number | undefined;
|
|
8737
|
+
summary?: string | undefined;
|
|
8738
|
+
error?: string | undefined;
|
|
8739
|
+
willRetry?: boolean | undefined;
|
|
8612
8740
|
}>]>;
|
|
8613
8741
|
}, "strip", z.ZodTypeAny, {
|
|
8614
8742
|
type: "agent_stream";
|
|
@@ -8686,6 +8814,16 @@ export declare const sessionMessageSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
8686
8814
|
kind: "queue_update";
|
|
8687
8815
|
steering?: string[] | undefined;
|
|
8688
8816
|
followUp?: string[] | undefined;
|
|
8817
|
+
} | {
|
|
8818
|
+
kind: "compaction";
|
|
8819
|
+
compactionId: string;
|
|
8820
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
8821
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
8822
|
+
tokensBefore?: number | undefined;
|
|
8823
|
+
estimatedTokensAfter?: number | undefined;
|
|
8824
|
+
summary?: string | undefined;
|
|
8825
|
+
error?: string | undefined;
|
|
8826
|
+
willRetry?: boolean | undefined;
|
|
8689
8827
|
};
|
|
8690
8828
|
}, {
|
|
8691
8829
|
type: "agent_stream";
|
|
@@ -8763,6 +8901,16 @@ export declare const sessionMessageSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
8763
8901
|
kind: "queue_update";
|
|
8764
8902
|
steering?: string[] | undefined;
|
|
8765
8903
|
followUp?: string[] | undefined;
|
|
8904
|
+
} | {
|
|
8905
|
+
kind: "compaction";
|
|
8906
|
+
compactionId: string;
|
|
8907
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
8908
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
8909
|
+
tokensBefore?: number | undefined;
|
|
8910
|
+
estimatedTokensAfter?: number | undefined;
|
|
8911
|
+
summary?: string | undefined;
|
|
8912
|
+
error?: string | undefined;
|
|
8913
|
+
willRetry?: boolean | undefined;
|
|
8766
8914
|
};
|
|
8767
8915
|
}>, z.ZodObject<{
|
|
8768
8916
|
type: z.ZodLiteral<"fetch_agent_timeline_request">;
|
|
@@ -9593,16 +9741,22 @@ export declare const sessionMessageSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
9593
9741
|
summary: z.ZodOptional<z.ZodString>;
|
|
9594
9742
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
9595
9743
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
9744
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
9745
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
9596
9746
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
9597
9747
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
9598
9748
|
summary: z.ZodOptional<z.ZodString>;
|
|
9599
9749
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
9600
9750
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
9751
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
9752
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
9601
9753
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
9602
9754
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
9603
9755
|
summary: z.ZodOptional<z.ZodString>;
|
|
9604
9756
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
9605
9757
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
9758
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
9759
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
9606
9760
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
9607
9761
|
}, z.ZodTypeAny, "passthrough">>;
|
|
9608
9762
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
@@ -9612,16 +9766,22 @@ export declare const sessionMessageSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
9612
9766
|
summary: z.ZodOptional<z.ZodString>;
|
|
9613
9767
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
9614
9768
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
9769
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
9770
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
9615
9771
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
9616
9772
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
9617
9773
|
summary: z.ZodOptional<z.ZodString>;
|
|
9618
9774
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
9619
9775
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
9776
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
9777
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
9620
9778
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
9621
9779
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
9622
9780
|
summary: z.ZodOptional<z.ZodString>;
|
|
9623
9781
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
9624
9782
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
9783
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
9784
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
9625
9785
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
9626
9786
|
}, z.ZodTypeAny, "passthrough">>;
|
|
9627
9787
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
@@ -9631,16 +9791,22 @@ export declare const sessionMessageSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
9631
9791
|
summary: z.ZodOptional<z.ZodString>;
|
|
9632
9792
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
9633
9793
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
9794
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
9795
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
9634
9796
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
9635
9797
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
9636
9798
|
summary: z.ZodOptional<z.ZodString>;
|
|
9637
9799
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
9638
9800
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
9801
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
9802
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
9639
9803
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
9640
9804
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
9641
9805
|
summary: z.ZodOptional<z.ZodString>;
|
|
9642
9806
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
9643
9807
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
9808
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
9809
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
9644
9810
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
9645
9811
|
}, z.ZodTypeAny, "passthrough">>;
|
|
9646
9812
|
}, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
|
|
@@ -15115,6 +15281,36 @@ export declare const sessionEnvelopeSchema: z.ZodObject<{
|
|
|
15115
15281
|
kind: "queue_update";
|
|
15116
15282
|
steering?: string[] | undefined;
|
|
15117
15283
|
followUp?: string[] | undefined;
|
|
15284
|
+
}>, z.ZodObject<{
|
|
15285
|
+
kind: z.ZodLiteral<"compaction">;
|
|
15286
|
+
compactionId: z.ZodString;
|
|
15287
|
+
phase: z.ZodEnum<["started", "completed", "failed", "canceled"]>;
|
|
15288
|
+
reason: z.ZodOptional<z.ZodEnum<["manual", "threshold", "overflow"]>>;
|
|
15289
|
+
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
15290
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
15291
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
15292
|
+
error: z.ZodOptional<z.ZodString>;
|
|
15293
|
+
willRetry: z.ZodOptional<z.ZodBoolean>;
|
|
15294
|
+
}, "strip", z.ZodTypeAny, {
|
|
15295
|
+
kind: "compaction";
|
|
15296
|
+
compactionId: string;
|
|
15297
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
15298
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
15299
|
+
tokensBefore?: number | undefined;
|
|
15300
|
+
estimatedTokensAfter?: number | undefined;
|
|
15301
|
+
summary?: string | undefined;
|
|
15302
|
+
error?: string | undefined;
|
|
15303
|
+
willRetry?: boolean | undefined;
|
|
15304
|
+
}, {
|
|
15305
|
+
kind: "compaction";
|
|
15306
|
+
compactionId: string;
|
|
15307
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
15308
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
15309
|
+
tokensBefore?: number | undefined;
|
|
15310
|
+
estimatedTokensAfter?: number | undefined;
|
|
15311
|
+
summary?: string | undefined;
|
|
15312
|
+
error?: string | undefined;
|
|
15313
|
+
willRetry?: boolean | undefined;
|
|
15118
15314
|
}>]>;
|
|
15119
15315
|
}, "strip", z.ZodTypeAny, {
|
|
15120
15316
|
type: "agent_stream";
|
|
@@ -15192,6 +15388,16 @@ export declare const sessionEnvelopeSchema: z.ZodObject<{
|
|
|
15192
15388
|
kind: "queue_update";
|
|
15193
15389
|
steering?: string[] | undefined;
|
|
15194
15390
|
followUp?: string[] | undefined;
|
|
15391
|
+
} | {
|
|
15392
|
+
kind: "compaction";
|
|
15393
|
+
compactionId: string;
|
|
15394
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
15395
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
15396
|
+
tokensBefore?: number | undefined;
|
|
15397
|
+
estimatedTokensAfter?: number | undefined;
|
|
15398
|
+
summary?: string | undefined;
|
|
15399
|
+
error?: string | undefined;
|
|
15400
|
+
willRetry?: boolean | undefined;
|
|
15195
15401
|
};
|
|
15196
15402
|
}, {
|
|
15197
15403
|
type: "agent_stream";
|
|
@@ -15269,6 +15475,16 @@ export declare const sessionEnvelopeSchema: z.ZodObject<{
|
|
|
15269
15475
|
kind: "queue_update";
|
|
15270
15476
|
steering?: string[] | undefined;
|
|
15271
15477
|
followUp?: string[] | undefined;
|
|
15478
|
+
} | {
|
|
15479
|
+
kind: "compaction";
|
|
15480
|
+
compactionId: string;
|
|
15481
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
15482
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
15483
|
+
tokensBefore?: number | undefined;
|
|
15484
|
+
estimatedTokensAfter?: number | undefined;
|
|
15485
|
+
summary?: string | undefined;
|
|
15486
|
+
error?: string | undefined;
|
|
15487
|
+
willRetry?: boolean | undefined;
|
|
15272
15488
|
};
|
|
15273
15489
|
}>, z.ZodObject<{
|
|
15274
15490
|
type: z.ZodLiteral<"fetch_agent_timeline_request">;
|
|
@@ -16099,16 +16315,22 @@ export declare const sessionEnvelopeSchema: z.ZodObject<{
|
|
|
16099
16315
|
summary: z.ZodOptional<z.ZodString>;
|
|
16100
16316
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
16101
16317
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
16318
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
16319
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
16102
16320
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
16103
16321
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
16104
16322
|
summary: z.ZodOptional<z.ZodString>;
|
|
16105
16323
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
16106
16324
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
16325
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
16326
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
16107
16327
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
16108
16328
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
16109
16329
|
summary: z.ZodOptional<z.ZodString>;
|
|
16110
16330
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
16111
16331
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
16332
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
16333
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
16112
16334
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
16113
16335
|
}, z.ZodTypeAny, "passthrough">>;
|
|
16114
16336
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
@@ -16118,16 +16340,22 @@ export declare const sessionEnvelopeSchema: z.ZodObject<{
|
|
|
16118
16340
|
summary: z.ZodOptional<z.ZodString>;
|
|
16119
16341
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
16120
16342
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
16343
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
16344
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
16121
16345
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
16122
16346
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
16123
16347
|
summary: z.ZodOptional<z.ZodString>;
|
|
16124
16348
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
16125
16349
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
16350
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
16351
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
16126
16352
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
16127
16353
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
16128
16354
|
summary: z.ZodOptional<z.ZodString>;
|
|
16129
16355
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
16130
16356
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
16357
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
16358
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
16131
16359
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
16132
16360
|
}, z.ZodTypeAny, "passthrough">>;
|
|
16133
16361
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
@@ -16137,16 +16365,22 @@ export declare const sessionEnvelopeSchema: z.ZodObject<{
|
|
|
16137
16365
|
summary: z.ZodOptional<z.ZodString>;
|
|
16138
16366
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
16139
16367
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
16368
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
16369
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
16140
16370
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
16141
16371
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
16142
16372
|
summary: z.ZodOptional<z.ZodString>;
|
|
16143
16373
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
16144
16374
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
16375
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
16376
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
16145
16377
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
16146
16378
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
16147
16379
|
summary: z.ZodOptional<z.ZodString>;
|
|
16148
16380
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
16149
16381
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
16382
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
16383
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
16150
16384
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
16151
16385
|
}, z.ZodTypeAny, "passthrough">>;
|
|
16152
16386
|
}, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
|
|
@@ -21191,6 +21425,16 @@ export declare const sessionEnvelopeSchema: z.ZodObject<{
|
|
|
21191
21425
|
kind: "queue_update";
|
|
21192
21426
|
steering?: string[] | undefined;
|
|
21193
21427
|
followUp?: string[] | undefined;
|
|
21428
|
+
} | {
|
|
21429
|
+
kind: "compaction";
|
|
21430
|
+
compactionId: string;
|
|
21431
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
21432
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
21433
|
+
tokensBefore?: number | undefined;
|
|
21434
|
+
estimatedTokensAfter?: number | undefined;
|
|
21435
|
+
summary?: string | undefined;
|
|
21436
|
+
error?: string | undefined;
|
|
21437
|
+
willRetry?: boolean | undefined;
|
|
21194
21438
|
};
|
|
21195
21439
|
} | {
|
|
21196
21440
|
type: "fetch_agent_timeline_request";
|
|
@@ -21457,16 +21701,22 @@ export declare const sessionEnvelopeSchema: z.ZodObject<{
|
|
|
21457
21701
|
summary: z.ZodOptional<z.ZodString>;
|
|
21458
21702
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
21459
21703
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
21704
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
21705
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
21460
21706
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
21461
21707
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
21462
21708
|
summary: z.ZodOptional<z.ZodString>;
|
|
21463
21709
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
21464
21710
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
21711
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
21712
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
21465
21713
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
21466
21714
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
21467
21715
|
summary: z.ZodOptional<z.ZodString>;
|
|
21468
21716
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
21469
21717
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
21718
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
21719
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
21470
21720
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
21471
21721
|
}, z.ZodTypeAny, "passthrough">>;
|
|
21472
21722
|
}, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
|
|
@@ -23243,6 +23493,16 @@ export declare const sessionEnvelopeSchema: z.ZodObject<{
|
|
|
23243
23493
|
kind: "queue_update";
|
|
23244
23494
|
steering?: string[] | undefined;
|
|
23245
23495
|
followUp?: string[] | undefined;
|
|
23496
|
+
} | {
|
|
23497
|
+
kind: "compaction";
|
|
23498
|
+
compactionId: string;
|
|
23499
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
23500
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
23501
|
+
tokensBefore?: number | undefined;
|
|
23502
|
+
estimatedTokensAfter?: number | undefined;
|
|
23503
|
+
summary?: string | undefined;
|
|
23504
|
+
error?: string | undefined;
|
|
23505
|
+
willRetry?: boolean | undefined;
|
|
23246
23506
|
};
|
|
23247
23507
|
} | {
|
|
23248
23508
|
type: "fetch_agent_timeline_request";
|
|
@@ -23509,16 +23769,22 @@ export declare const sessionEnvelopeSchema: z.ZodObject<{
|
|
|
23509
23769
|
summary: z.ZodOptional<z.ZodString>;
|
|
23510
23770
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
23511
23771
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
23772
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
23773
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
23512
23774
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
23513
23775
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
23514
23776
|
summary: z.ZodOptional<z.ZodString>;
|
|
23515
23777
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
23516
23778
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
23779
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
23780
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
23517
23781
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
23518
23782
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
23519
23783
|
summary: z.ZodOptional<z.ZodString>;
|
|
23520
23784
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
23521
23785
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
23786
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
23787
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
23522
23788
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
23523
23789
|
}, z.ZodTypeAny, "passthrough">>;
|
|
23524
23790
|
}, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
|
|
@@ -25815,6 +26081,36 @@ export declare const topLevelEnvelopeSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
25815
26081
|
kind: "queue_update";
|
|
25816
26082
|
steering?: string[] | undefined;
|
|
25817
26083
|
followUp?: string[] | undefined;
|
|
26084
|
+
}>, z.ZodObject<{
|
|
26085
|
+
kind: z.ZodLiteral<"compaction">;
|
|
26086
|
+
compactionId: z.ZodString;
|
|
26087
|
+
phase: z.ZodEnum<["started", "completed", "failed", "canceled"]>;
|
|
26088
|
+
reason: z.ZodOptional<z.ZodEnum<["manual", "threshold", "overflow"]>>;
|
|
26089
|
+
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
26090
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
26091
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
26092
|
+
error: z.ZodOptional<z.ZodString>;
|
|
26093
|
+
willRetry: z.ZodOptional<z.ZodBoolean>;
|
|
26094
|
+
}, "strip", z.ZodTypeAny, {
|
|
26095
|
+
kind: "compaction";
|
|
26096
|
+
compactionId: string;
|
|
26097
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
26098
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
26099
|
+
tokensBefore?: number | undefined;
|
|
26100
|
+
estimatedTokensAfter?: number | undefined;
|
|
26101
|
+
summary?: string | undefined;
|
|
26102
|
+
error?: string | undefined;
|
|
26103
|
+
willRetry?: boolean | undefined;
|
|
26104
|
+
}, {
|
|
26105
|
+
kind: "compaction";
|
|
26106
|
+
compactionId: string;
|
|
26107
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
26108
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
26109
|
+
tokensBefore?: number | undefined;
|
|
26110
|
+
estimatedTokensAfter?: number | undefined;
|
|
26111
|
+
summary?: string | undefined;
|
|
26112
|
+
error?: string | undefined;
|
|
26113
|
+
willRetry?: boolean | undefined;
|
|
25818
26114
|
}>]>;
|
|
25819
26115
|
}, "strip", z.ZodTypeAny, {
|
|
25820
26116
|
type: "agent_stream";
|
|
@@ -25892,6 +26188,16 @@ export declare const topLevelEnvelopeSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
25892
26188
|
kind: "queue_update";
|
|
25893
26189
|
steering?: string[] | undefined;
|
|
25894
26190
|
followUp?: string[] | undefined;
|
|
26191
|
+
} | {
|
|
26192
|
+
kind: "compaction";
|
|
26193
|
+
compactionId: string;
|
|
26194
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
26195
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
26196
|
+
tokensBefore?: number | undefined;
|
|
26197
|
+
estimatedTokensAfter?: number | undefined;
|
|
26198
|
+
summary?: string | undefined;
|
|
26199
|
+
error?: string | undefined;
|
|
26200
|
+
willRetry?: boolean | undefined;
|
|
25895
26201
|
};
|
|
25896
26202
|
}, {
|
|
25897
26203
|
type: "agent_stream";
|
|
@@ -25969,6 +26275,16 @@ export declare const topLevelEnvelopeSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
25969
26275
|
kind: "queue_update";
|
|
25970
26276
|
steering?: string[] | undefined;
|
|
25971
26277
|
followUp?: string[] | undefined;
|
|
26278
|
+
} | {
|
|
26279
|
+
kind: "compaction";
|
|
26280
|
+
compactionId: string;
|
|
26281
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
26282
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
26283
|
+
tokensBefore?: number | undefined;
|
|
26284
|
+
estimatedTokensAfter?: number | undefined;
|
|
26285
|
+
summary?: string | undefined;
|
|
26286
|
+
error?: string | undefined;
|
|
26287
|
+
willRetry?: boolean | undefined;
|
|
25972
26288
|
};
|
|
25973
26289
|
}>, z.ZodObject<{
|
|
25974
26290
|
type: z.ZodLiteral<"fetch_agent_timeline_request">;
|
|
@@ -26799,16 +27115,22 @@ export declare const topLevelEnvelopeSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
26799
27115
|
summary: z.ZodOptional<z.ZodString>;
|
|
26800
27116
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
26801
27117
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
27118
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
27119
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
26802
27120
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
26803
27121
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
26804
27122
|
summary: z.ZodOptional<z.ZodString>;
|
|
26805
27123
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
26806
27124
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
27125
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
27126
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
26807
27127
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
26808
27128
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
26809
27129
|
summary: z.ZodOptional<z.ZodString>;
|
|
26810
27130
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
26811
27131
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
27132
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
27133
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
26812
27134
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
26813
27135
|
}, z.ZodTypeAny, "passthrough">>;
|
|
26814
27136
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
@@ -26818,16 +27140,22 @@ export declare const topLevelEnvelopeSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
26818
27140
|
summary: z.ZodOptional<z.ZodString>;
|
|
26819
27141
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
26820
27142
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
27143
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
27144
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
26821
27145
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
26822
27146
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
26823
27147
|
summary: z.ZodOptional<z.ZodString>;
|
|
26824
27148
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
26825
27149
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
27150
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
27151
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
26826
27152
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
26827
27153
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
26828
27154
|
summary: z.ZodOptional<z.ZodString>;
|
|
26829
27155
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
26830
27156
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
27157
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
27158
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
26831
27159
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
26832
27160
|
}, z.ZodTypeAny, "passthrough">>;
|
|
26833
27161
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
@@ -26837,16 +27165,22 @@ export declare const topLevelEnvelopeSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
26837
27165
|
summary: z.ZodOptional<z.ZodString>;
|
|
26838
27166
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
26839
27167
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
27168
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
27169
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
26840
27170
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
26841
27171
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
26842
27172
|
summary: z.ZodOptional<z.ZodString>;
|
|
26843
27173
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
26844
27174
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
27175
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
27176
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
26845
27177
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
26846
27178
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
26847
27179
|
summary: z.ZodOptional<z.ZodString>;
|
|
26848
27180
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
26849
27181
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
27182
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
27183
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
26850
27184
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
26851
27185
|
}, z.ZodTypeAny, "passthrough">>;
|
|
26852
27186
|
}, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
|
|
@@ -31891,6 +32225,16 @@ export declare const topLevelEnvelopeSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
31891
32225
|
kind: "queue_update";
|
|
31892
32226
|
steering?: string[] | undefined;
|
|
31893
32227
|
followUp?: string[] | undefined;
|
|
32228
|
+
} | {
|
|
32229
|
+
kind: "compaction";
|
|
32230
|
+
compactionId: string;
|
|
32231
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
32232
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
32233
|
+
tokensBefore?: number | undefined;
|
|
32234
|
+
estimatedTokensAfter?: number | undefined;
|
|
32235
|
+
summary?: string | undefined;
|
|
32236
|
+
error?: string | undefined;
|
|
32237
|
+
willRetry?: boolean | undefined;
|
|
31894
32238
|
};
|
|
31895
32239
|
} | {
|
|
31896
32240
|
type: "fetch_agent_timeline_request";
|
|
@@ -32157,16 +32501,22 @@ export declare const topLevelEnvelopeSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
32157
32501
|
summary: z.ZodOptional<z.ZodString>;
|
|
32158
32502
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
32159
32503
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
32504
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
32505
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
32160
32506
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
32161
32507
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
32162
32508
|
summary: z.ZodOptional<z.ZodString>;
|
|
32163
32509
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
32164
32510
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
32511
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
32512
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
32165
32513
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
32166
32514
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
32167
32515
|
summary: z.ZodOptional<z.ZodString>;
|
|
32168
32516
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
32169
32517
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
32518
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
32519
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
32170
32520
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
32171
32521
|
}, z.ZodTypeAny, "passthrough">>;
|
|
32172
32522
|
}, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{
|
|
@@ -33943,6 +34293,16 @@ export declare const topLevelEnvelopeSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
33943
34293
|
kind: "queue_update";
|
|
33944
34294
|
steering?: string[] | undefined;
|
|
33945
34295
|
followUp?: string[] | undefined;
|
|
34296
|
+
} | {
|
|
34297
|
+
kind: "compaction";
|
|
34298
|
+
compactionId: string;
|
|
34299
|
+
phase: "canceled" | "completed" | "failed" | "started";
|
|
34300
|
+
reason?: "manual" | "overflow" | "threshold" | undefined;
|
|
34301
|
+
tokensBefore?: number | undefined;
|
|
34302
|
+
estimatedTokensAfter?: number | undefined;
|
|
34303
|
+
summary?: string | undefined;
|
|
34304
|
+
error?: string | undefined;
|
|
34305
|
+
willRetry?: boolean | undefined;
|
|
33946
34306
|
};
|
|
33947
34307
|
} | {
|
|
33948
34308
|
type: "fetch_agent_timeline_request";
|
|
@@ -34209,16 +34569,22 @@ export declare const topLevelEnvelopeSchema: z.ZodDiscriminatedUnion<"type", [z.
|
|
|
34209
34569
|
summary: z.ZodOptional<z.ZodString>;
|
|
34210
34570
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
34211
34571
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
34572
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
34573
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
34212
34574
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
34213
34575
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
34214
34576
|
summary: z.ZodOptional<z.ZodString>;
|
|
34215
34577
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
34216
34578
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
34579
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
34580
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
34217
34581
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
34218
34582
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
34219
34583
|
summary: z.ZodOptional<z.ZodString>;
|
|
34220
34584
|
firstKeptEntryId: z.ZodOptional<z.ZodString>;
|
|
34221
34585
|
tokensBefore: z.ZodOptional<z.ZodNumber>;
|
|
34586
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
34587
|
+
estimatedTokensAfter: z.ZodOptional<z.ZodNumber>;
|
|
34222
34588
|
details: z.ZodOptional<z.ZodUnknown>;
|
|
34223
34589
|
}, z.ZodTypeAny, "passthrough">>;
|
|
34224
34590
|
}, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
|
package/dist/messages.js
CHANGED
|
@@ -256,6 +256,26 @@ export const agentStreamEventSchema = z.discriminatedUnion("kind", [
|
|
|
256
256
|
steering: z.array(z.string()).optional(),
|
|
257
257
|
followUp: z.array(z.string()).optional(),
|
|
258
258
|
}),
|
|
259
|
+
/**
|
|
260
|
+
* One context compaction (manual or Pi's automatic threshold/overflow), upserted by
|
|
261
|
+
* `compactionId`: a `started` event opens it and exactly one terminal phase (`completed`,
|
|
262
|
+
* `failed`, `canceled`) closes it. `reason` and `willRetry` ride `started`/terminal events;
|
|
263
|
+
* `tokensBefore`, `estimatedTokensAfter` and `summary` appear on `completed` only; `error` on
|
|
264
|
+
* `failed` only. Rows rebuilt from Pi's session file (hydration) are a lone `completed` carrying
|
|
265
|
+
* `tokensBefore` + `summary` — Pi persists neither `reason` nor `estimatedTokensAfter`.
|
|
266
|
+
* Deliberately NOT `kind: "error"`: a failed compaction must not flip an agent to `error`.
|
|
267
|
+
*/
|
|
268
|
+
z.object({
|
|
269
|
+
kind: z.literal("compaction"),
|
|
270
|
+
compactionId: z.string(),
|
|
271
|
+
phase: z.enum(["started", "completed", "failed", "canceled"]),
|
|
272
|
+
reason: z.enum(["manual", "threshold", "overflow"]).optional(),
|
|
273
|
+
tokensBefore: z.number().optional(),
|
|
274
|
+
estimatedTokensAfter: z.number().optional(),
|
|
275
|
+
summary: z.string().optional(),
|
|
276
|
+
error: z.string().optional(),
|
|
277
|
+
willRetry: z.boolean().optional(),
|
|
278
|
+
}),
|
|
259
279
|
]);
|
|
260
280
|
export const agentStreamSchema = z.object({
|
|
261
281
|
type: z.literal("agent_stream"),
|
|
@@ -427,6 +447,8 @@ export const agentCompactResponseSchema = z
|
|
|
427
447
|
summary: z.string().optional(),
|
|
428
448
|
firstKeptEntryId: z.string().optional(),
|
|
429
449
|
tokensBefore: z.number().optional(),
|
|
450
|
+
/** Pi's estimate of the context size after compaction (not persisted by Pi). */
|
|
451
|
+
estimatedTokensAfter: z.number().optional(),
|
|
430
452
|
details: z.unknown().optional(),
|
|
431
453
|
})
|
|
432
454
|
.passthrough(),
|