@adecore/agent-contracts 0.31.12 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat.d.ts +82 -0
- package/dist/chat.js +12 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/protocol.d.ts +54 -0
- package/dist/usage.d.ts +6 -0
- package/dist/usage.js +9 -0
- package/package.json +2 -2
- package/src/chat.ts +12 -2
- package/src/index.ts +3 -0
- package/src/usage.ts +19 -0
package/dist/chat.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export declare const ChatUsageSchema: z.ZodObject<{
|
|
|
19
19
|
conversation: z.ZodNumber;
|
|
20
20
|
system: z.ZodNumber;
|
|
21
21
|
}, z.core.$strip>>;
|
|
22
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
22
24
|
}, z.core.$strip>;
|
|
23
25
|
export type ChatUsage = z.infer<typeof ChatUsageSchema>;
|
|
24
26
|
export declare const CHAT_ATTACHMENTS_MAX_BYTES: number;
|
|
@@ -330,6 +332,8 @@ export declare const ChatInfoSchema: z.ZodObject<{
|
|
|
330
332
|
conversation: z.ZodNumber;
|
|
331
333
|
system: z.ZodNumber;
|
|
332
334
|
}, z.core.$strip>>;
|
|
335
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
336
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
333
337
|
}, z.core.$strip>;
|
|
334
338
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
335
339
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -724,6 +728,10 @@ export declare const ChatWorkflowAgentSchema: z.ZodObject<{
|
|
|
724
728
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
725
729
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
726
730
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
731
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
732
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
733
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
734
|
+
error: z.ZodOptional<z.ZodString>;
|
|
727
735
|
}, z.core.$strip>;
|
|
728
736
|
export type ChatWorkflowAgent = z.infer<typeof ChatWorkflowAgentSchema>;
|
|
729
737
|
export declare const ChatWorkflowSchema: z.ZodObject<{
|
|
@@ -746,6 +754,10 @@ export declare const ChatWorkflowSchema: z.ZodObject<{
|
|
|
746
754
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
747
755
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
748
756
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
757
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
758
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
759
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
760
|
+
error: z.ZodOptional<z.ZodString>;
|
|
749
761
|
}, z.core.$strip>>;
|
|
750
762
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
751
763
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -802,6 +814,10 @@ export declare const ChatToolItemSchema: z.ZodObject<{
|
|
|
802
814
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
803
815
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
804
816
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
817
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
818
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
819
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
820
|
+
error: z.ZodOptional<z.ZodString>;
|
|
805
821
|
}, z.core.$strip>>;
|
|
806
822
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
807
823
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1215,6 +1231,10 @@ export declare const ChatItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1215
1231
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
1216
1232
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
1217
1233
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
1234
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
1235
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
1236
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
1237
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1218
1238
|
}, z.core.$strip>>;
|
|
1219
1239
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
1220
1240
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1566,6 +1586,10 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1566
1586
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
1567
1587
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
1568
1588
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
1589
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
1590
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
1591
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
1592
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1569
1593
|
}, z.core.$strip>>;
|
|
1570
1594
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
1571
1595
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1890,6 +1914,8 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1890
1914
|
conversation: z.ZodNumber;
|
|
1891
1915
|
system: z.ZodNumber;
|
|
1892
1916
|
}, z.core.$strip>>;
|
|
1917
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
1918
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
1893
1919
|
}, z.core.$strip>;
|
|
1894
1920
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
1895
1921
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -2054,6 +2080,8 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2054
2080
|
conversation: z.ZodNumber;
|
|
2055
2081
|
system: z.ZodNumber;
|
|
2056
2082
|
}, z.core.$strip>>;
|
|
2083
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
2084
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
2057
2085
|
}, z.core.$strip>;
|
|
2058
2086
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
2059
2087
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -2298,6 +2326,10 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2298
2326
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
2299
2327
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
2300
2328
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
2329
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
2330
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
2331
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
2332
|
+
error: z.ZodOptional<z.ZodString>;
|
|
2301
2333
|
}, z.core.$strip>>;
|
|
2302
2334
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
2303
2335
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -2641,6 +2673,10 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
|
|
|
2641
2673
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
2642
2674
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
2643
2675
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
2676
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
2677
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
2678
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
2679
|
+
error: z.ZodOptional<z.ZodString>;
|
|
2644
2680
|
}, z.core.$strip>>;
|
|
2645
2681
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
2646
2682
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -2965,6 +3001,8 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
|
|
|
2965
3001
|
conversation: z.ZodNumber;
|
|
2966
3002
|
system: z.ZodNumber;
|
|
2967
3003
|
}, z.core.$strip>>;
|
|
3004
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
3005
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
2968
3006
|
}, z.core.$strip>;
|
|
2969
3007
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
2970
3008
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -3129,6 +3167,8 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
|
|
|
3129
3167
|
conversation: z.ZodNumber;
|
|
3130
3168
|
system: z.ZodNumber;
|
|
3131
3169
|
}, z.core.$strip>>;
|
|
3170
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
3171
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
3132
3172
|
}, z.core.$strip>;
|
|
3133
3173
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
3134
3174
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -3373,6 +3413,10 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
|
|
|
3373
3413
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
3374
3414
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
3375
3415
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
3416
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
3417
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
3418
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
3419
|
+
error: z.ZodOptional<z.ZodString>;
|
|
3376
3420
|
}, z.core.$strip>>;
|
|
3377
3421
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
3378
3422
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -3798,6 +3842,10 @@ export declare const ChatHistoryResultSchema: z.ZodObject<{
|
|
|
3798
3842
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
3799
3843
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
3800
3844
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
3845
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
3846
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
3847
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
3848
|
+
error: z.ZodOptional<z.ZodString>;
|
|
3801
3849
|
}, z.core.$strip>>;
|
|
3802
3850
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
3803
3851
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -4184,6 +4232,10 @@ export declare const ChatSubagentResultSchema: z.ZodObject<{
|
|
|
4184
4232
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
4185
4233
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
4186
4234
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
4235
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
4236
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
4237
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
4238
|
+
error: z.ZodOptional<z.ZodString>;
|
|
4187
4239
|
}, z.core.$strip>>;
|
|
4188
4240
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
4189
4241
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -4504,6 +4556,8 @@ export declare const ChatStatusEventSchema: z.ZodObject<{
|
|
|
4504
4556
|
conversation: z.ZodNumber;
|
|
4505
4557
|
system: z.ZodNumber;
|
|
4506
4558
|
}, z.core.$strip>>;
|
|
4559
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
4560
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
4507
4561
|
}, z.core.$strip>;
|
|
4508
4562
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
4509
4563
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -4766,6 +4820,8 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
|
|
|
4766
4820
|
conversation: z.ZodNumber;
|
|
4767
4821
|
system: z.ZodNumber;
|
|
4768
4822
|
}, z.core.$strip>>;
|
|
4823
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
4824
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
4769
4825
|
}, z.core.$strip>;
|
|
4770
4826
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
4771
4827
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -5010,6 +5066,10 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
|
|
|
5010
5066
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
5011
5067
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
5012
5068
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
5069
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
5070
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
5071
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
5072
|
+
error: z.ZodOptional<z.ZodString>;
|
|
5013
5073
|
}, z.core.$strip>>;
|
|
5014
5074
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
5015
5075
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -5351,6 +5411,10 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
|
|
|
5351
5411
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
5352
5412
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
5353
5413
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
5414
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
5415
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
5416
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
5417
|
+
error: z.ZodOptional<z.ZodString>;
|
|
5354
5418
|
}, z.core.$strip>>;
|
|
5355
5419
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
5356
5420
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -5691,6 +5755,10 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
|
|
|
5691
5755
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
5692
5756
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
5693
5757
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
5758
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
5759
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
5760
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
5761
|
+
error: z.ZodOptional<z.ZodString>;
|
|
5694
5762
|
}, z.core.$strip>>;
|
|
5695
5763
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
5696
5764
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -6015,6 +6083,8 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
|
|
|
6015
6083
|
conversation: z.ZodNumber;
|
|
6016
6084
|
system: z.ZodNumber;
|
|
6017
6085
|
}, z.core.$strip>>;
|
|
6086
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
6087
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
6018
6088
|
}, z.core.$strip>;
|
|
6019
6089
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
6020
6090
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -6179,6 +6249,8 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
|
|
|
6179
6249
|
conversation: z.ZodNumber;
|
|
6180
6250
|
system: z.ZodNumber;
|
|
6181
6251
|
}, z.core.$strip>>;
|
|
6252
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
6253
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
6182
6254
|
}, z.core.$strip>;
|
|
6183
6255
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
6184
6256
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -6423,6 +6495,10 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
|
|
|
6423
6495
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
6424
6496
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
6425
6497
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
6498
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
6499
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
6500
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
6501
|
+
error: z.ZodOptional<z.ZodString>;
|
|
6426
6502
|
}, z.core.$strip>>;
|
|
6427
6503
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
6428
6504
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -6906,6 +6982,8 @@ export declare const ChatForkResultSchema: z.ZodObject<{
|
|
|
6906
6982
|
conversation: z.ZodNumber;
|
|
6907
6983
|
system: z.ZodNumber;
|
|
6908
6984
|
}, z.core.$strip>>;
|
|
6985
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
6986
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
6909
6987
|
}, z.core.$strip>;
|
|
6910
6988
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
6911
6989
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -7101,6 +7179,8 @@ export declare const ChatContinueOnResultSchema: z.ZodObject<{
|
|
|
7101
7179
|
conversation: z.ZodNumber;
|
|
7102
7180
|
system: z.ZodNumber;
|
|
7103
7181
|
}, z.core.$strip>>;
|
|
7182
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
7183
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
7104
7184
|
}, z.core.$strip>;
|
|
7105
7185
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
7106
7186
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -7310,6 +7390,8 @@ export declare const ChatListResultSchema: z.ZodObject<{
|
|
|
7310
7390
|
conversation: z.ZodNumber;
|
|
7311
7391
|
system: z.ZodNumber;
|
|
7312
7392
|
}, z.core.$strip>>;
|
|
7393
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
7394
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
7313
7395
|
}, z.core.$strip>;
|
|
7314
7396
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
7315
7397
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
package/dist/chat.js
CHANGED
|
@@ -22,7 +22,11 @@ export const ChatUsageSchema = z.object({
|
|
|
22
22
|
costUsd: z.number().nonnegative(),
|
|
23
23
|
turns: z.number().int().nonnegative(),
|
|
24
24
|
// Absent while nothing is in the context yet, and from a daemon that does not estimate.
|
|
25
|
-
breakdown: ChatContextBreakdownSchema.optional()
|
|
25
|
+
breakdown: ChatContextBreakdownSchema.optional(),
|
|
26
|
+
// How long the prompt cache of the main agent's last request lives, in milliseconds; absent while the CLI names no lifetime.
|
|
27
|
+
cacheTtlMs: z.number().int().positive().optional(),
|
|
28
|
+
// When that cache goes cold, in milliseconds since the epoch: its lifetime from the moment that request started.
|
|
29
|
+
cacheExpiresAt: z.number().optional()
|
|
26
30
|
});
|
|
27
31
|
// Base64 for 10 MiB leaves room for the prompt and envelope inside the 16 MiB transport frame.
|
|
28
32
|
export const CHAT_ATTACHMENTS_MAX_BYTES = 10 * 1024 * 1024;
|
|
@@ -378,7 +382,13 @@ export const ChatWorkflowAgentSchema = z.object({
|
|
|
378
382
|
status: ChatSubagentStatusSchema,
|
|
379
383
|
startedAt: z.number().nullable(),
|
|
380
384
|
durationMs: z.number().int().nonnegative().nullable(),
|
|
381
|
-
lastTool: z.string().nullable()
|
|
385
|
+
lastTool: z.string().nullable(),
|
|
386
|
+
// What the last tool was called on, such as a command or a path.
|
|
387
|
+
lastToolSummary: z.string().optional(),
|
|
388
|
+
// The CLI's own previews of what the agent was asked and answered.
|
|
389
|
+
promptPreview: z.string().optional(),
|
|
390
|
+
resultPreview: z.string().optional(),
|
|
391
|
+
error: z.string().optional()
|
|
382
392
|
});
|
|
383
393
|
// What a Workflow call runs: every phase the script announced, and the agents it started so far.
|
|
384
394
|
export const ChatWorkflowSchema = z.object({
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ export { ProviderAccountIdSchema, type ProviderAccountId, ProviderAccountVariabl
|
|
|
9
9
|
export { isRecord } from './record.ts';
|
|
10
10
|
export { TaskStatusSchema, type TaskStatus, TaskResultSchema, type TaskResult, TaskSchema, type Task, TaskChangedEventSchema, type TaskChangedEvent } from './task.ts';
|
|
11
11
|
export { clipText, TOOL_OUTPUT_TAIL, appendToolOutput } from './text.ts';
|
|
12
|
-
export { UsageProviderSchema, type UsageProvider, USAGE_PROVIDERS, UsageResolutionSchema, type UsageResolution, UsageTotalsSchema, type UsageTotals, EMPTY_TOTALS, totalTokensOf, addTotals, UsageAccountSchema, type UsageAccount, UsageBucketSchema, type UsageBucket, UsagePriceBasisSchema, type UsagePriceBasis, UsageModelSchema, type UsageModel, UsageProjectSchema, type UsageProject, UsageSummaryPayloadSchema, type UsageSummaryPayload, UsageScanSchema, type UsageScan, UsagePricingSchema, type UsagePricing, UsageRootSchema, type UsageRoot, UsageRateSchema, type UsageRate, UsageSummaryResultSchema, type UsageSummaryResult, UsageChangedEventSchema, type UsageChangedEvent, UsageWindowSchema, type UsageWindow, UsageLimitsProviderSchema, type UsageLimitsProvider, UsageLimitsSnapshotSchema, type UsageLimitsSnapshot } from './usage.ts';
|
|
12
|
+
export { UsageProviderSchema, type UsageProvider, USAGE_PROVIDERS, UsageResolutionSchema, type UsageResolution, UsageTotalsSchema, type UsageTotals, EMPTY_TOTALS, totalTokensOf, addTotals, UsageAccountSchema, type UsageAccount, UsageBucketSchema, type UsageBucket, UsagePriceBasisSchema, type UsagePriceBasis, UsageModelSchema, type UsageModel, UsageProjectSchema, type UsageProject, UsageSummaryPayloadSchema, type UsageSummaryPayload, UsageScanSchema, type UsageScan, UsagePricingSchema, type UsagePricing, UsageRootSchema, type UsageRoot, UsageRateSchema, type UsageRate, UsageSummaryResultSchema, type UsageSummaryResult, UsageChangedEventSchema, type UsageChangedEvent, UsageWindowSchema, type UsageWindow, type PaceStanding, type EvenPace, evenPace, UsageLimitsProviderSchema, type UsageLimitsProvider, UsageLimitsSnapshotSchema, type UsageLimitsSnapshot } from './usage.ts';
|
|
13
13
|
export { VISUAL_LIMITS, VISUAL_MEASURE_WIDTHS, VisualHeightSchema, type VisualHeight, VisualLayoutSchema, type VisualLayout, ChatVisualSchema, type ChatVisual, ChatVisualsSchema, visualFrameHeight, VISUAL_BRIDGE_METHODS, type VisualAppearance, type VisualTheme, type VisualRequestId, type VisualViewport, type VisualScrollRequest, visualViewportMessage, visualScrollMessage, type VisualMessage, visualProxyReadyMessage, visualResourceReadyMessage, visualHostContextMessage, visualSizeChangedMessage, visualOpenLinkRequest, visualOpenLinkResult, parseVisualMessage, VISUAL_THEME_VARIABLES, type VisualThemeVariable, VISUAL_LIGHT_THEME, VISUAL_DARK_THEME, cleanVisualVariables, visualThemeFragment, VISUAL_PAGE_RULES, VISUAL_LAYOUT_GUIDE, VISUAL_THEME_GUIDE, injectVisualBootstrap, VISUAL_HOST_PAGE } from './visual.ts';
|
|
14
14
|
export { WorktreeWorkSchema, type WorktreeWork, WorktreeSchema, type Worktree } from './worktree.ts';
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,6 @@ export { ProviderAccountIdSchema, ProviderAccountVariableSchema, ProviderAccount
|
|
|
9
9
|
export { isRecord } from './record.js';
|
|
10
10
|
export { TaskStatusSchema, TaskResultSchema, TaskSchema, TaskChangedEventSchema } from './task.js';
|
|
11
11
|
export { clipText, TOOL_OUTPUT_TAIL, appendToolOutput } from './text.js';
|
|
12
|
-
export { UsageProviderSchema, USAGE_PROVIDERS, UsageResolutionSchema, UsageTotalsSchema, EMPTY_TOTALS, totalTokensOf, addTotals, UsageAccountSchema, UsageBucketSchema, UsagePriceBasisSchema, UsageModelSchema, UsageProjectSchema, UsageSummaryPayloadSchema, UsageScanSchema, UsagePricingSchema, UsageRootSchema, UsageRateSchema, UsageSummaryResultSchema, UsageChangedEventSchema, UsageWindowSchema, UsageLimitsProviderSchema, UsageLimitsSnapshotSchema } from './usage.js';
|
|
12
|
+
export { UsageProviderSchema, USAGE_PROVIDERS, UsageResolutionSchema, UsageTotalsSchema, EMPTY_TOTALS, totalTokensOf, addTotals, UsageAccountSchema, UsageBucketSchema, UsagePriceBasisSchema, UsageModelSchema, UsageProjectSchema, UsageSummaryPayloadSchema, UsageScanSchema, UsagePricingSchema, UsageRootSchema, UsageRateSchema, UsageSummaryResultSchema, UsageChangedEventSchema, UsageWindowSchema, evenPace, UsageLimitsProviderSchema, UsageLimitsSnapshotSchema } from './usage.js';
|
|
13
13
|
export { VISUAL_LIMITS, VISUAL_MEASURE_WIDTHS, VisualHeightSchema, VisualLayoutSchema, ChatVisualSchema, ChatVisualsSchema, visualFrameHeight, VISUAL_BRIDGE_METHODS, visualViewportMessage, visualScrollMessage, visualProxyReadyMessage, visualResourceReadyMessage, visualHostContextMessage, visualSizeChangedMessage, visualOpenLinkRequest, visualOpenLinkResult, parseVisualMessage, VISUAL_THEME_VARIABLES, VISUAL_LIGHT_THEME, VISUAL_DARK_THEME, cleanVisualVariables, visualThemeFragment, VISUAL_PAGE_RULES, VISUAL_LAYOUT_GUIDE, VISUAL_THEME_GUIDE, injectVisualBootstrap, VISUAL_HOST_PAGE } from './visual.js';
|
|
14
14
|
export { WorktreeWorkSchema, WorktreeSchema } from './worktree.js';
|
package/dist/protocol.d.ts
CHANGED
|
@@ -109,6 +109,8 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
109
109
|
conversation: z.ZodNumber;
|
|
110
110
|
system: z.ZodNumber;
|
|
111
111
|
}, z.core.$strip>>;
|
|
112
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
112
114
|
}, z.core.$strip>;
|
|
113
115
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
114
116
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -361,6 +363,10 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
361
363
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
362
364
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
363
365
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
366
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
367
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
368
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
369
|
+
error: z.ZodOptional<z.ZodString>;
|
|
364
370
|
}, z.core.$strip>>;
|
|
365
371
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
366
372
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -629,6 +635,8 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
629
635
|
conversation: z.ZodNumber;
|
|
630
636
|
system: z.ZodNumber;
|
|
631
637
|
}, z.core.$strip>>;
|
|
638
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
639
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
632
640
|
}, z.core.$strip>;
|
|
633
641
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
634
642
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -873,6 +881,10 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
873
881
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
874
882
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
875
883
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
884
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
885
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
886
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
887
|
+
error: z.ZodOptional<z.ZodString>;
|
|
876
888
|
}, z.core.$strip>>;
|
|
877
889
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
878
890
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1214,6 +1226,10 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
1214
1226
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
1215
1227
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
1216
1228
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
1229
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
1230
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
1231
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
1232
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1217
1233
|
}, z.core.$strip>>;
|
|
1218
1234
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
1219
1235
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1554,6 +1570,10 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
1554
1570
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
1555
1571
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
1556
1572
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
1573
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
1574
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
1575
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
1576
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1557
1577
|
}, z.core.$strip>>;
|
|
1558
1578
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
1559
1579
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -1878,6 +1898,8 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
1878
1898
|
conversation: z.ZodNumber;
|
|
1879
1899
|
system: z.ZodNumber;
|
|
1880
1900
|
}, z.core.$strip>>;
|
|
1901
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
1902
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
1881
1903
|
}, z.core.$strip>;
|
|
1882
1904
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
1883
1905
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -2042,6 +2064,8 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
2042
2064
|
conversation: z.ZodNumber;
|
|
2043
2065
|
system: z.ZodNumber;
|
|
2044
2066
|
}, z.core.$strip>>;
|
|
2067
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
2068
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
2045
2069
|
}, z.core.$strip>;
|
|
2046
2070
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
2047
2071
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -2286,6 +2310,10 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
2286
2310
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
2287
2311
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
2288
2312
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
2313
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
2314
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
2315
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
2316
|
+
error: z.ZodOptional<z.ZodString>;
|
|
2289
2317
|
}, z.core.$strip>>;
|
|
2290
2318
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
2291
2319
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -2808,6 +2836,8 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
2808
2836
|
conversation: z.ZodNumber;
|
|
2809
2837
|
system: z.ZodNumber;
|
|
2810
2838
|
}, z.core.$strip>>;
|
|
2839
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
2840
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
2811
2841
|
}, z.core.$strip>;
|
|
2812
2842
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
2813
2843
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -3052,6 +3082,8 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
3052
3082
|
conversation: z.ZodNumber;
|
|
3053
3083
|
system: z.ZodNumber;
|
|
3054
3084
|
}, z.core.$strip>>;
|
|
3085
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
3086
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
3055
3087
|
}, z.core.$strip>;
|
|
3056
3088
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
3057
3089
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -3247,6 +3279,8 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
3247
3279
|
conversation: z.ZodNumber;
|
|
3248
3280
|
system: z.ZodNumber;
|
|
3249
3281
|
}, z.core.$strip>>;
|
|
3282
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
3283
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
3250
3284
|
}, z.core.$strip>;
|
|
3251
3285
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
3252
3286
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -3546,6 +3580,10 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
3546
3580
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
3547
3581
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
3548
3582
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
3583
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
3584
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
3585
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
3586
|
+
error: z.ZodOptional<z.ZodString>;
|
|
3549
3587
|
}, z.core.$strip>>;
|
|
3550
3588
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
3551
3589
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -4531,6 +4569,8 @@ export declare const AGENT_REQUEST_SCHEMAS: {
|
|
|
4531
4569
|
conversation: z.ZodNumber;
|
|
4532
4570
|
system: z.ZodNumber;
|
|
4533
4571
|
}, z.core.$strip>>;
|
|
4572
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
4573
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
4534
4574
|
}, z.core.$strip>;
|
|
4535
4575
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
4536
4576
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -4783,6 +4823,10 @@ export declare const AGENT_EVENT_SCHEMAS: {
|
|
|
4783
4823
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
4784
4824
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
4785
4825
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
4826
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
4827
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
4828
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
4829
|
+
error: z.ZodOptional<z.ZodString>;
|
|
4786
4830
|
}, z.core.$strip>>;
|
|
4787
4831
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
4788
4832
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -5107,6 +5151,8 @@ export declare const AGENT_EVENT_SCHEMAS: {
|
|
|
5107
5151
|
conversation: z.ZodNumber;
|
|
5108
5152
|
system: z.ZodNumber;
|
|
5109
5153
|
}, z.core.$strip>>;
|
|
5154
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
5155
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
5110
5156
|
}, z.core.$strip>;
|
|
5111
5157
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
5112
5158
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -5271,6 +5317,8 @@ export declare const AGENT_EVENT_SCHEMAS: {
|
|
|
5271
5317
|
conversation: z.ZodNumber;
|
|
5272
5318
|
system: z.ZodNumber;
|
|
5273
5319
|
}, z.core.$strip>>;
|
|
5320
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
5321
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
5274
5322
|
}, z.core.$strip>;
|
|
5275
5323
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
5276
5324
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -5515,6 +5563,10 @@ export declare const AGENT_EVENT_SCHEMAS: {
|
|
|
5515
5563
|
startedAt: z.ZodNullable<z.ZodNumber>;
|
|
5516
5564
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
5517
5565
|
lastTool: z.ZodNullable<z.ZodString>;
|
|
5566
|
+
lastToolSummary: z.ZodOptional<z.ZodString>;
|
|
5567
|
+
promptPreview: z.ZodOptional<z.ZodString>;
|
|
5568
|
+
resultPreview: z.ZodOptional<z.ZodString>;
|
|
5569
|
+
error: z.ZodOptional<z.ZodString>;
|
|
5518
5570
|
}, z.core.$strip>>;
|
|
5519
5571
|
lastProgressAt: z.ZodOptional<z.ZodNumber>;
|
|
5520
5572
|
stalledAt: z.ZodOptional<z.ZodNumber>;
|
|
@@ -5775,6 +5827,8 @@ export declare const AGENT_EVENT_SCHEMAS: {
|
|
|
5775
5827
|
conversation: z.ZodNumber;
|
|
5776
5828
|
system: z.ZodNumber;
|
|
5777
5829
|
}, z.core.$strip>>;
|
|
5830
|
+
cacheTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
5831
|
+
cacheExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
5778
5832
|
}, z.core.$strip>;
|
|
5779
5833
|
suggestedTitle: z.ZodOptional<z.ZodString>;
|
|
5780
5834
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
package/dist/usage.d.ts
CHANGED
|
@@ -337,6 +337,12 @@ export declare const UsageWindowSchema: z.ZodObject<{
|
|
|
337
337
|
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
338
338
|
}, z.core.$strip>;
|
|
339
339
|
export type UsageWindow = z.infer<typeof UsageWindowSchema>;
|
|
340
|
+
export type PaceStanding = 'ahead' | 'behind' | 'even';
|
|
341
|
+
export interface EvenPace {
|
|
342
|
+
percent: number;
|
|
343
|
+
standing: PaceStanding;
|
|
344
|
+
}
|
|
345
|
+
export declare function evenPace(window: UsageWindow, now: number): EvenPace | null;
|
|
340
346
|
export declare const UsageLimitsProviderSchema: z.ZodObject<{
|
|
341
347
|
kind: z.ZodEnum<{
|
|
342
348
|
claude: "claude";
|
package/dist/usage.js
CHANGED
|
@@ -144,6 +144,15 @@ export const UsageWindowSchema = z.object({
|
|
|
144
144
|
resetsAt: z.number().int().nullable(),
|
|
145
145
|
durationMs: z.number().int().nullable()
|
|
146
146
|
});
|
|
147
|
+
/* Where an evenly spent window would stand by now, or null when the provider named no reset or no length to measure from. */
|
|
148
|
+
export function evenPace(window, now) {
|
|
149
|
+
if (window.resetsAt === null || window.durationMs === null || window.durationMs <= 0) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
const percent = Math.round(Math.min(1, Math.max(0, 1 - (window.resetsAt - now) / window.durationMs)) * 100);
|
|
153
|
+
const used = Math.round(window.used * 100);
|
|
154
|
+
return { percent, standing: used > percent ? 'ahead' : used < percent ? 'behind' : 'even' };
|
|
155
|
+
}
|
|
147
156
|
export const UsageLimitsProviderSchema = z.object({
|
|
148
157
|
kind: UsageProviderSchema,
|
|
149
158
|
/* The account these numbers are of. The default account of a kind comes first, in the shape an entry had before accounts. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adecore/agent-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "Schemas and port contracts for agent chats, provider accounts, models and usage.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"test": "bun --conditions=source test"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@adecore/intelligent-ui": "0.
|
|
89
|
+
"@adecore/intelligent-ui": "0.33.0",
|
|
90
90
|
"zod": "^4.6.5"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
package/src/chat.ts
CHANGED
|
@@ -27,7 +27,11 @@ export const ChatUsageSchema = z.object({
|
|
|
27
27
|
costUsd: z.number().nonnegative(),
|
|
28
28
|
turns: z.number().int().nonnegative(),
|
|
29
29
|
// Absent while nothing is in the context yet, and from a daemon that does not estimate.
|
|
30
|
-
breakdown: ChatContextBreakdownSchema.optional()
|
|
30
|
+
breakdown: ChatContextBreakdownSchema.optional(),
|
|
31
|
+
// How long the prompt cache of the main agent's last request lives, in milliseconds; absent while the CLI names no lifetime.
|
|
32
|
+
cacheTtlMs: z.number().int().positive().optional(),
|
|
33
|
+
// When that cache goes cold, in milliseconds since the epoch: its lifetime from the moment that request started.
|
|
34
|
+
cacheExpiresAt: z.number().optional()
|
|
31
35
|
});
|
|
32
36
|
export type ChatUsage = z.infer<typeof ChatUsageSchema>;
|
|
33
37
|
|
|
@@ -456,7 +460,13 @@ export const ChatWorkflowAgentSchema = z.object({
|
|
|
456
460
|
status: ChatSubagentStatusSchema,
|
|
457
461
|
startedAt: z.number().nullable(),
|
|
458
462
|
durationMs: z.number().int().nonnegative().nullable(),
|
|
459
|
-
lastTool: z.string().nullable()
|
|
463
|
+
lastTool: z.string().nullable(),
|
|
464
|
+
// What the last tool was called on, such as a command or a path.
|
|
465
|
+
lastToolSummary: z.string().optional(),
|
|
466
|
+
// The CLI's own previews of what the agent was asked and answered.
|
|
467
|
+
promptPreview: z.string().optional(),
|
|
468
|
+
resultPreview: z.string().optional(),
|
|
469
|
+
error: z.string().optional()
|
|
460
470
|
});
|
|
461
471
|
export type ChatWorkflowAgent = z.infer<typeof ChatWorkflowAgentSchema>;
|
|
462
472
|
|
package/src/index.ts
CHANGED
package/src/usage.ts
CHANGED
|
@@ -180,6 +180,25 @@ export const UsageWindowSchema = z.object({
|
|
|
180
180
|
});
|
|
181
181
|
export type UsageWindow = z.infer<typeof UsageWindowSchema>;
|
|
182
182
|
|
|
183
|
+
/* `ahead` has used more than an even spread over the window would by now, `behind` less. */
|
|
184
|
+
export type PaceStanding = 'ahead' | 'behind' | 'even';
|
|
185
|
+
|
|
186
|
+
export interface EvenPace {
|
|
187
|
+
/* Where the usage would stand had the window been spent evenly from its start, in whole percent. */
|
|
188
|
+
percent: number;
|
|
189
|
+
standing: PaceStanding;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/* Where an evenly spent window would stand by now, or null when the provider named no reset or no length to measure from. */
|
|
193
|
+
export function evenPace(window: UsageWindow, now: number): EvenPace | null {
|
|
194
|
+
if (window.resetsAt === null || window.durationMs === null || window.durationMs <= 0) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
const percent = Math.round(Math.min(1, Math.max(0, 1 - (window.resetsAt - now) / window.durationMs)) * 100);
|
|
198
|
+
const used = Math.round(window.used * 100);
|
|
199
|
+
return { percent, standing: used > percent ? 'ahead' : used < percent ? 'behind' : 'even' };
|
|
200
|
+
}
|
|
201
|
+
|
|
183
202
|
export const UsageLimitsProviderSchema = z.object({
|
|
184
203
|
kind: UsageProviderSchema,
|
|
185
204
|
/* The account these numbers are of. The default account of a kind comes first, in the shape an entry had before accounts. */
|