codebuff 1.0.172 → 1.0.173
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/browser-runner.js +7 -17
- package/dist/browser-runner.js.map +1 -1
- package/dist/chat-storage.js +7 -17
- package/dist/chat-storage.js.map +1 -1
- package/dist/checkpoint-file-manager.js +7 -17
- package/dist/checkpoint-file-manager.js.map +1 -1
- package/dist/checkpoints.js +7 -17
- package/dist/checkpoints.js.map +1 -1
- package/dist/cli.js +7 -17
- package/dist/cli.js.map +1 -1
- package/dist/client.js +11 -22
- package/dist/client.js.map +1 -1
- package/dist/code-map/languages.js +7 -17
- package/dist/code-map/languages.js.map +1 -1
- package/dist/code-map/parse.js +7 -17
- package/dist/code-map/parse.js.map +1 -1
- package/dist/code-map/tsconfig.tsbuildinfo +1 -1
- package/dist/common/advanced-analyzer.d.ts +19 -0
- package/dist/common/advanced-analyzer.js +140 -0
- package/dist/common/advanced-analyzer.js.map +1 -0
- package/dist/common/browser-actions.d.ts +44 -44
- package/dist/common/message-image-handling.d.ts +41 -0
- package/dist/common/message-image-handling.js +57 -0
- package/dist/common/message-image-handling.js.map +1 -0
- package/dist/common/types/agent-state.d.ts +20 -20
- package/dist/common/types/message.d.ts +22 -22
- package/dist/common/util/credentials.d.ts +2 -2
- package/dist/common/util/process-stream.d.ts +8 -0
- package/dist/common/util/process-stream.js +102 -0
- package/dist/common/util/process-stream.js.map +1 -0
- package/dist/create-template-project.js +7 -17
- package/dist/create-template-project.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/menu.js +7 -17
- package/dist/menu.js.map +1 -1
- package/dist/project-files.js +7 -17
- package/dist/project-files.js.map +1 -1
- package/dist/tool-handlers.js +7 -17
- package/dist/tool-handlers.js.map +1 -1
- package/dist/utils/spinner.js +7 -17
- package/dist/utils/spinner.js.map +1 -1
- package/dist/utils/terminal.js +7 -17
- package/dist/utils/terminal.js.map +1 -1
- package/dist/web-scraper.js +4 -8
- package/dist/web-scraper.js.map +1 -1
- package/package.json +2 -3
- package/dist/common/logger.d.ts +0 -1
- package/dist/common/logger.js +0 -7
- package/dist/common/logger.js.map +0 -1
- package/dist/common/util/constants.d.ts +0 -1
- package/dist/common/util/constants.js +0 -7
- package/dist/common/util/constants.js.map +0 -1
- package/dist/common/util/helpers.d.ts +0 -1
- package/dist/common/util/helpers.js +0 -6
- package/dist/common/util/helpers.js.map +0 -1
- package/dist/common/util/token-counter.d.ts +0 -3
- package/dist/common/util/token-counter.js +0 -27
- package/dist/common/util/token-counter.js.map +0 -1
|
@@ -250,13 +250,13 @@ export declare const BrowserResponseChunkSchema: z.ZodObject<{
|
|
|
250
250
|
index: z.ZodNumber;
|
|
251
251
|
data: z.ZodString;
|
|
252
252
|
}, "strip", z.ZodTypeAny, {
|
|
253
|
-
id: string;
|
|
254
253
|
data: string;
|
|
254
|
+
id: string;
|
|
255
255
|
total: number;
|
|
256
256
|
index: number;
|
|
257
257
|
}, {
|
|
258
|
-
id: string;
|
|
259
258
|
data: string;
|
|
259
|
+
id: string;
|
|
260
260
|
total: number;
|
|
261
261
|
index: number;
|
|
262
262
|
}>;
|
|
@@ -267,27 +267,27 @@ export declare const ImageContentSchema: z.ZodObject<{
|
|
|
267
267
|
media_type: z.ZodLiteral<"image/jpeg">;
|
|
268
268
|
data: z.ZodString;
|
|
269
269
|
}, "strip", z.ZodTypeAny, {
|
|
270
|
+
data: string;
|
|
270
271
|
type: "base64";
|
|
271
272
|
media_type: "image/jpeg";
|
|
272
|
-
data: string;
|
|
273
273
|
}, {
|
|
274
|
+
data: string;
|
|
274
275
|
type: "base64";
|
|
275
276
|
media_type: "image/jpeg";
|
|
276
|
-
data: string;
|
|
277
277
|
}>;
|
|
278
278
|
}, "strip", z.ZodTypeAny, {
|
|
279
279
|
type: "image";
|
|
280
280
|
source: {
|
|
281
|
+
data: string;
|
|
281
282
|
type: "base64";
|
|
282
283
|
media_type: "image/jpeg";
|
|
283
|
-
data: string;
|
|
284
284
|
};
|
|
285
285
|
}, {
|
|
286
286
|
type: "image";
|
|
287
287
|
source: {
|
|
288
|
+
data: string;
|
|
288
289
|
type: "base64";
|
|
289
290
|
media_type: "image/jpeg";
|
|
290
|
-
data: string;
|
|
291
291
|
};
|
|
292
292
|
}>;
|
|
293
293
|
export type ImageContent = z.infer<typeof ImageContentSchema>;
|
|
@@ -393,27 +393,27 @@ export declare const BrowserResponseSchema: z.ZodObject<{
|
|
|
393
393
|
media_type: z.ZodLiteral<"image/jpeg">;
|
|
394
394
|
data: z.ZodString;
|
|
395
395
|
}, "strip", z.ZodTypeAny, {
|
|
396
|
+
data: string;
|
|
396
397
|
type: "base64";
|
|
397
398
|
media_type: "image/jpeg";
|
|
398
|
-
data: string;
|
|
399
399
|
}, {
|
|
400
|
+
data: string;
|
|
400
401
|
type: "base64";
|
|
401
402
|
media_type: "image/jpeg";
|
|
402
|
-
data: string;
|
|
403
403
|
}>;
|
|
404
404
|
}, "strip", z.ZodTypeAny, {
|
|
405
405
|
type: "image";
|
|
406
406
|
source: {
|
|
407
|
+
data: string;
|
|
407
408
|
type: "base64";
|
|
408
409
|
media_type: "image/jpeg";
|
|
409
|
-
data: string;
|
|
410
410
|
};
|
|
411
411
|
}, {
|
|
412
412
|
type: "image";
|
|
413
413
|
source: {
|
|
414
|
+
data: string;
|
|
414
415
|
type: "base64";
|
|
415
416
|
media_type: "image/jpeg";
|
|
416
|
-
data: string;
|
|
417
417
|
};
|
|
418
418
|
}>>;
|
|
419
419
|
post: z.ZodObject<{
|
|
@@ -423,61 +423,61 @@ export declare const BrowserResponseSchema: z.ZodObject<{
|
|
|
423
423
|
media_type: z.ZodLiteral<"image/jpeg">;
|
|
424
424
|
data: z.ZodString;
|
|
425
425
|
}, "strip", z.ZodTypeAny, {
|
|
426
|
+
data: string;
|
|
426
427
|
type: "base64";
|
|
427
428
|
media_type: "image/jpeg";
|
|
428
|
-
data: string;
|
|
429
429
|
}, {
|
|
430
|
+
data: string;
|
|
430
431
|
type: "base64";
|
|
431
432
|
media_type: "image/jpeg";
|
|
432
|
-
data: string;
|
|
433
433
|
}>;
|
|
434
434
|
}, "strip", z.ZodTypeAny, {
|
|
435
435
|
type: "image";
|
|
436
436
|
source: {
|
|
437
|
+
data: string;
|
|
437
438
|
type: "base64";
|
|
438
439
|
media_type: "image/jpeg";
|
|
439
|
-
data: string;
|
|
440
440
|
};
|
|
441
441
|
}, {
|
|
442
442
|
type: "image";
|
|
443
443
|
source: {
|
|
444
|
+
data: string;
|
|
444
445
|
type: "base64";
|
|
445
446
|
media_type: "image/jpeg";
|
|
446
|
-
data: string;
|
|
447
447
|
};
|
|
448
448
|
}>;
|
|
449
449
|
}, "strip", z.ZodTypeAny, {
|
|
450
450
|
post: {
|
|
451
451
|
type: "image";
|
|
452
452
|
source: {
|
|
453
|
+
data: string;
|
|
453
454
|
type: "base64";
|
|
454
455
|
media_type: "image/jpeg";
|
|
455
|
-
data: string;
|
|
456
456
|
};
|
|
457
457
|
};
|
|
458
458
|
pre?: {
|
|
459
459
|
type: "image";
|
|
460
460
|
source: {
|
|
461
|
+
data: string;
|
|
461
462
|
type: "base64";
|
|
462
463
|
media_type: "image/jpeg";
|
|
463
|
-
data: string;
|
|
464
464
|
};
|
|
465
465
|
} | undefined;
|
|
466
466
|
}, {
|
|
467
467
|
post: {
|
|
468
468
|
type: "image";
|
|
469
469
|
source: {
|
|
470
|
+
data: string;
|
|
470
471
|
type: "base64";
|
|
471
472
|
media_type: "image/jpeg";
|
|
472
|
-
data: string;
|
|
473
473
|
};
|
|
474
474
|
};
|
|
475
475
|
pre?: {
|
|
476
476
|
type: "image";
|
|
477
477
|
source: {
|
|
478
|
+
data: string;
|
|
478
479
|
type: "base64";
|
|
479
480
|
media_type: "image/jpeg";
|
|
480
|
-
data: string;
|
|
481
481
|
};
|
|
482
482
|
} | undefined;
|
|
483
483
|
}>>;
|
|
@@ -521,17 +521,17 @@ export declare const BrowserResponseSchema: z.ZodObject<{
|
|
|
521
521
|
post: {
|
|
522
522
|
type: "image";
|
|
523
523
|
source: {
|
|
524
|
+
data: string;
|
|
524
525
|
type: "base64";
|
|
525
526
|
media_type: "image/jpeg";
|
|
526
|
-
data: string;
|
|
527
527
|
};
|
|
528
528
|
};
|
|
529
529
|
pre?: {
|
|
530
530
|
type: "image";
|
|
531
531
|
source: {
|
|
532
|
+
data: string;
|
|
532
533
|
type: "base64";
|
|
533
534
|
media_type: "image/jpeg";
|
|
534
|
-
data: string;
|
|
535
535
|
};
|
|
536
536
|
} | undefined;
|
|
537
537
|
} | undefined;
|
|
@@ -575,17 +575,17 @@ export declare const BrowserResponseSchema: z.ZodObject<{
|
|
|
575
575
|
post: {
|
|
576
576
|
type: "image";
|
|
577
577
|
source: {
|
|
578
|
+
data: string;
|
|
578
579
|
type: "base64";
|
|
579
580
|
media_type: "image/jpeg";
|
|
580
|
-
data: string;
|
|
581
581
|
};
|
|
582
582
|
};
|
|
583
583
|
pre?: {
|
|
584
584
|
type: "image";
|
|
585
585
|
source: {
|
|
586
|
+
data: string;
|
|
586
587
|
type: "base64";
|
|
587
588
|
media_type: "image/jpeg";
|
|
588
|
-
data: string;
|
|
589
589
|
};
|
|
590
590
|
} | undefined;
|
|
591
591
|
} | undefined;
|
|
@@ -832,12 +832,12 @@ export declare const RequiredBrowserTypeActionSchema: z.ZodObject<{
|
|
|
832
832
|
selector: z.ZodString;
|
|
833
833
|
text: z.ZodString;
|
|
834
834
|
}, "strip", z.ZodTypeAny, {
|
|
835
|
-
type: "type";
|
|
836
835
|
text: string;
|
|
836
|
+
type: "type";
|
|
837
837
|
selector: string;
|
|
838
838
|
}, {
|
|
839
|
-
type: "type";
|
|
840
839
|
text: string;
|
|
840
|
+
type: "type";
|
|
841
841
|
selector: string;
|
|
842
842
|
}>;
|
|
843
843
|
export declare const BrowserTypeActionSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
@@ -876,8 +876,8 @@ export declare const BrowserTypeActionSchema: z.ZodObject<z.objectUtil.extendSha
|
|
|
876
876
|
}>, {
|
|
877
877
|
delay: z.ZodOptional<z.ZodNumber>;
|
|
878
878
|
}>, "strip", z.ZodTypeAny, {
|
|
879
|
-
type: "type";
|
|
880
879
|
text: string;
|
|
880
|
+
type: "type";
|
|
881
881
|
selector: string;
|
|
882
882
|
debug?: boolean | undefined;
|
|
883
883
|
timeout?: number | undefined;
|
|
@@ -893,8 +893,8 @@ export declare const BrowserTypeActionSchema: z.ZodObject<z.objectUtil.extendSha
|
|
|
893
893
|
} | undefined;
|
|
894
894
|
delay?: number | undefined;
|
|
895
895
|
}, {
|
|
896
|
-
type: "type";
|
|
897
896
|
text: string;
|
|
897
|
+
type: "type";
|
|
898
898
|
selector: string;
|
|
899
899
|
debug?: boolean | undefined;
|
|
900
900
|
timeout?: number | undefined;
|
|
@@ -1380,8 +1380,8 @@ export declare const DiagnosticStepSchema: z.ZodObject<{
|
|
|
1380
1380
|
}>, {
|
|
1381
1381
|
delay: z.ZodOptional<z.ZodNumber>;
|
|
1382
1382
|
}>, "strip", z.ZodTypeAny, {
|
|
1383
|
-
type: "type";
|
|
1384
1383
|
text: string;
|
|
1384
|
+
type: "type";
|
|
1385
1385
|
selector: string;
|
|
1386
1386
|
debug?: boolean | undefined;
|
|
1387
1387
|
timeout?: number | undefined;
|
|
@@ -1397,8 +1397,8 @@ export declare const DiagnosticStepSchema: z.ZodObject<{
|
|
|
1397
1397
|
} | undefined;
|
|
1398
1398
|
delay?: number | undefined;
|
|
1399
1399
|
}, {
|
|
1400
|
-
type: "type";
|
|
1401
1400
|
text: string;
|
|
1401
|
+
type: "type";
|
|
1402
1402
|
selector: string;
|
|
1403
1403
|
debug?: boolean | undefined;
|
|
1404
1404
|
timeout?: number | undefined;
|
|
@@ -1665,8 +1665,8 @@ export declare const DiagnosticStepSchema: z.ZodObject<{
|
|
|
1665
1665
|
visualVerify?: boolean | undefined;
|
|
1666
1666
|
visualThreshold?: number | undefined;
|
|
1667
1667
|
} | {
|
|
1668
|
-
type: "type";
|
|
1669
1668
|
text: string;
|
|
1669
|
+
type: "type";
|
|
1670
1670
|
selector: string;
|
|
1671
1671
|
debug?: boolean | undefined;
|
|
1672
1672
|
timeout?: number | undefined;
|
|
@@ -1787,8 +1787,8 @@ export declare const DiagnosticStepSchema: z.ZodObject<{
|
|
|
1787
1787
|
visualVerify?: boolean | undefined;
|
|
1788
1788
|
visualThreshold?: number | undefined;
|
|
1789
1789
|
} | {
|
|
1790
|
-
type: "type";
|
|
1791
1790
|
text: string;
|
|
1791
|
+
type: "type";
|
|
1792
1792
|
selector: string;
|
|
1793
1793
|
debug?: boolean | undefined;
|
|
1794
1794
|
timeout?: number | undefined;
|
|
@@ -2132,8 +2132,8 @@ export declare const BrowserDiagnoseActionSchema: z.ZodObject<{
|
|
|
2132
2132
|
}>, {
|
|
2133
2133
|
delay: z.ZodOptional<z.ZodNumber>;
|
|
2134
2134
|
}>, "strip", z.ZodTypeAny, {
|
|
2135
|
-
type: "type";
|
|
2136
2135
|
text: string;
|
|
2136
|
+
type: "type";
|
|
2137
2137
|
selector: string;
|
|
2138
2138
|
debug?: boolean | undefined;
|
|
2139
2139
|
timeout?: number | undefined;
|
|
@@ -2149,8 +2149,8 @@ export declare const BrowserDiagnoseActionSchema: z.ZodObject<{
|
|
|
2149
2149
|
} | undefined;
|
|
2150
2150
|
delay?: number | undefined;
|
|
2151
2151
|
}, {
|
|
2152
|
-
type: "type";
|
|
2153
2152
|
text: string;
|
|
2153
|
+
type: "type";
|
|
2154
2154
|
selector: string;
|
|
2155
2155
|
debug?: boolean | undefined;
|
|
2156
2156
|
timeout?: number | undefined;
|
|
@@ -2417,8 +2417,8 @@ export declare const BrowserDiagnoseActionSchema: z.ZodObject<{
|
|
|
2417
2417
|
visualVerify?: boolean | undefined;
|
|
2418
2418
|
visualThreshold?: number | undefined;
|
|
2419
2419
|
} | {
|
|
2420
|
-
type: "type";
|
|
2421
2420
|
text: string;
|
|
2421
|
+
type: "type";
|
|
2422
2422
|
selector: string;
|
|
2423
2423
|
debug?: boolean | undefined;
|
|
2424
2424
|
timeout?: number | undefined;
|
|
@@ -2539,8 +2539,8 @@ export declare const BrowserDiagnoseActionSchema: z.ZodObject<{
|
|
|
2539
2539
|
visualVerify?: boolean | undefined;
|
|
2540
2540
|
visualThreshold?: number | undefined;
|
|
2541
2541
|
} | {
|
|
2542
|
-
type: "type";
|
|
2543
2542
|
text: string;
|
|
2543
|
+
type: "type";
|
|
2544
2544
|
selector: string;
|
|
2545
2545
|
debug?: boolean | undefined;
|
|
2546
2546
|
timeout?: number | undefined;
|
|
@@ -2667,8 +2667,8 @@ export declare const BrowserDiagnoseActionSchema: z.ZodObject<{
|
|
|
2667
2667
|
visualVerify?: boolean | undefined;
|
|
2668
2668
|
visualThreshold?: number | undefined;
|
|
2669
2669
|
} | {
|
|
2670
|
-
type: "type";
|
|
2671
2670
|
text: string;
|
|
2671
|
+
type: "type";
|
|
2672
2672
|
selector: string;
|
|
2673
2673
|
debug?: boolean | undefined;
|
|
2674
2674
|
timeout?: number | undefined;
|
|
@@ -2807,8 +2807,8 @@ export declare const BrowserDiagnoseActionSchema: z.ZodObject<{
|
|
|
2807
2807
|
visualVerify?: boolean | undefined;
|
|
2808
2808
|
visualThreshold?: number | undefined;
|
|
2809
2809
|
} | {
|
|
2810
|
-
type: "type";
|
|
2811
2810
|
text: string;
|
|
2811
|
+
type: "type";
|
|
2812
2812
|
selector: string;
|
|
2813
2813
|
debug?: boolean | undefined;
|
|
2814
2814
|
timeout?: number | undefined;
|
|
@@ -3136,8 +3136,8 @@ export declare const BrowserActionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
3136
3136
|
}>, {
|
|
3137
3137
|
delay: z.ZodOptional<z.ZodNumber>;
|
|
3138
3138
|
}>, "strip", z.ZodTypeAny, {
|
|
3139
|
-
type: "type";
|
|
3140
3139
|
text: string;
|
|
3140
|
+
type: "type";
|
|
3141
3141
|
selector: string;
|
|
3142
3142
|
debug?: boolean | undefined;
|
|
3143
3143
|
timeout?: number | undefined;
|
|
@@ -3153,8 +3153,8 @@ export declare const BrowserActionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
3153
3153
|
} | undefined;
|
|
3154
3154
|
delay?: number | undefined;
|
|
3155
3155
|
}, {
|
|
3156
|
-
type: "type";
|
|
3157
3156
|
text: string;
|
|
3157
|
+
type: "type";
|
|
3158
3158
|
selector: string;
|
|
3159
3159
|
debug?: boolean | undefined;
|
|
3160
3160
|
timeout?: number | undefined;
|
|
@@ -3638,8 +3638,8 @@ export declare const BrowserActionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
3638
3638
|
}>, {
|
|
3639
3639
|
delay: z.ZodOptional<z.ZodNumber>;
|
|
3640
3640
|
}>, "strip", z.ZodTypeAny, {
|
|
3641
|
-
type: "type";
|
|
3642
3641
|
text: string;
|
|
3642
|
+
type: "type";
|
|
3643
3643
|
selector: string;
|
|
3644
3644
|
debug?: boolean | undefined;
|
|
3645
3645
|
timeout?: number | undefined;
|
|
@@ -3655,8 +3655,8 @@ export declare const BrowserActionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
3655
3655
|
} | undefined;
|
|
3656
3656
|
delay?: number | undefined;
|
|
3657
3657
|
}, {
|
|
3658
|
-
type: "type";
|
|
3659
3658
|
text: string;
|
|
3659
|
+
type: "type";
|
|
3660
3660
|
selector: string;
|
|
3661
3661
|
debug?: boolean | undefined;
|
|
3662
3662
|
timeout?: number | undefined;
|
|
@@ -3923,8 +3923,8 @@ export declare const BrowserActionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
3923
3923
|
visualVerify?: boolean | undefined;
|
|
3924
3924
|
visualThreshold?: number | undefined;
|
|
3925
3925
|
} | {
|
|
3926
|
-
type: "type";
|
|
3927
3926
|
text: string;
|
|
3927
|
+
type: "type";
|
|
3928
3928
|
selector: string;
|
|
3929
3929
|
debug?: boolean | undefined;
|
|
3930
3930
|
timeout?: number | undefined;
|
|
@@ -4045,8 +4045,8 @@ export declare const BrowserActionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
4045
4045
|
visualVerify?: boolean | undefined;
|
|
4046
4046
|
visualThreshold?: number | undefined;
|
|
4047
4047
|
} | {
|
|
4048
|
-
type: "type";
|
|
4049
4048
|
text: string;
|
|
4049
|
+
type: "type";
|
|
4050
4050
|
selector: string;
|
|
4051
4051
|
debug?: boolean | undefined;
|
|
4052
4052
|
timeout?: number | undefined;
|
|
@@ -4173,8 +4173,8 @@ export declare const BrowserActionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
4173
4173
|
visualVerify?: boolean | undefined;
|
|
4174
4174
|
visualThreshold?: number | undefined;
|
|
4175
4175
|
} | {
|
|
4176
|
-
type: "type";
|
|
4177
4176
|
text: string;
|
|
4177
|
+
type: "type";
|
|
4178
4178
|
selector: string;
|
|
4179
4179
|
debug?: boolean | undefined;
|
|
4180
4180
|
timeout?: number | undefined;
|
|
@@ -4313,8 +4313,8 @@ export declare const BrowserActionSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
4313
4313
|
visualVerify?: boolean | undefined;
|
|
4314
4314
|
visualThreshold?: number | undefined;
|
|
4315
4315
|
} | {
|
|
4316
|
-
type: "type";
|
|
4317
4316
|
text: string;
|
|
4317
|
+
type: "type";
|
|
4318
4318
|
selector: string;
|
|
4319
4319
|
debug?: boolean | undefined;
|
|
4320
4320
|
timeout?: number | undefined;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Message } from './actions';
|
|
2
|
+
/**
|
|
3
|
+
* Contexts where message processing may occur
|
|
4
|
+
*/
|
|
5
|
+
export declare enum ProcessingContext {
|
|
6
|
+
ModelCall = "model-call",
|
|
7
|
+
FileCache = "file-cache",
|
|
8
|
+
WarmCache = "warm-cache"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Interface for provider-specific image handling
|
|
12
|
+
*/
|
|
13
|
+
export interface IImageHandler {
|
|
14
|
+
/**
|
|
15
|
+
* Returns whether images should be passed along in the given context
|
|
16
|
+
*/
|
|
17
|
+
supportsImages(context: ProcessingContext): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Transform a message by either stripping, replacing, or modifying image blocks
|
|
20
|
+
*/
|
|
21
|
+
transformMessage(message: Message, context: ProcessingContext): Message;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Base handler that removes all images unless explicitly allowed
|
|
25
|
+
*/
|
|
26
|
+
export declare class DefaultImageHandler implements IImageHandler {
|
|
27
|
+
supportsImages(context: ProcessingContext): boolean;
|
|
28
|
+
transformMessage(message: Message, context: ProcessingContext): Message;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Register a new image handler for a provider
|
|
32
|
+
*/
|
|
33
|
+
export declare function registerImageHandler(provider: string, handler: IImageHandler): void;
|
|
34
|
+
/**
|
|
35
|
+
* Transform a message for a specific provider and context
|
|
36
|
+
*/
|
|
37
|
+
export declare function transformMessageForProvider(message: Message, provider: string, context: ProcessingContext): Message;
|
|
38
|
+
/**
|
|
39
|
+
* Transform an array of messages for a specific provider and context
|
|
40
|
+
*/
|
|
41
|
+
export declare function transformMessagesForProvider(messages: Message[], provider: string, context: ProcessingContext): Message[];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultImageHandler = exports.ProcessingContext = void 0;
|
|
4
|
+
exports.registerImageHandler = registerImageHandler;
|
|
5
|
+
exports.transformMessageForProvider = transformMessageForProvider;
|
|
6
|
+
exports.transformMessagesForProvider = transformMessagesForProvider;
|
|
7
|
+
/**
|
|
8
|
+
* Contexts where message processing may occur
|
|
9
|
+
*/
|
|
10
|
+
var ProcessingContext;
|
|
11
|
+
(function (ProcessingContext) {
|
|
12
|
+
ProcessingContext["ModelCall"] = "model-call";
|
|
13
|
+
ProcessingContext["FileCache"] = "file-cache";
|
|
14
|
+
ProcessingContext["WarmCache"] = "warm-cache";
|
|
15
|
+
})(ProcessingContext || (exports.ProcessingContext = ProcessingContext = {}));
|
|
16
|
+
/**
|
|
17
|
+
* Base handler that removes all images unless explicitly allowed
|
|
18
|
+
*/
|
|
19
|
+
class DefaultImageHandler {
|
|
20
|
+
supportsImages(context) {
|
|
21
|
+
return context === ProcessingContext.FileCache;
|
|
22
|
+
}
|
|
23
|
+
transformMessage(message, context) {
|
|
24
|
+
if (!this.supportsImages(context)) {
|
|
25
|
+
const transformed = Array.isArray(message.content)
|
|
26
|
+
? message.content.filter(block => typeof block === 'string' ? true : block.type !== 'image')
|
|
27
|
+
: message.content;
|
|
28
|
+
return { ...message, content: transformed };
|
|
29
|
+
}
|
|
30
|
+
return message;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.DefaultImageHandler = DefaultImageHandler;
|
|
34
|
+
/**
|
|
35
|
+
* Registry mapping provider names to their image handlers
|
|
36
|
+
*/
|
|
37
|
+
const imageHandlerRegistry = {};
|
|
38
|
+
/**
|
|
39
|
+
* Register a new image handler for a provider
|
|
40
|
+
*/
|
|
41
|
+
function registerImageHandler(provider, handler) {
|
|
42
|
+
imageHandlerRegistry[provider] = handler;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Transform a message for a specific provider and context
|
|
46
|
+
*/
|
|
47
|
+
function transformMessageForProvider(message, provider, context) {
|
|
48
|
+
const handler = imageHandlerRegistry[provider] || new DefaultImageHandler();
|
|
49
|
+
return handler.transformMessage(message, context);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Transform an array of messages for a specific provider and context
|
|
53
|
+
*/
|
|
54
|
+
function transformMessagesForProvider(messages, provider, context) {
|
|
55
|
+
return messages.map(message => transformMessageForProvider(message, provider, context));
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=message-image-handling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-image-handling.js","sourceRoot":"","sources":["../src/message-image-handling.ts"],"names":[],"mappings":";;;AAuDA,oDAEC;AAKD,kEAOC;AAKD,oEAMC;AA9ED;;GAEG;AACH,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,6CAAwB,CAAA;IACxB,6CAAwB,CAAA;IACxB,6CAAwB,CAAA;AAC1B,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B;AAiBD;;GAEG;AACH,MAAa,mBAAmB;IAC9B,cAAc,CAAC,OAA0B;QACvC,OAAO,OAAO,KAAK,iBAAiB,CAAC,SAAS,CAAC;IACjD,CAAC;IAED,gBAAgB,CAAC,OAAgB,EAAE,OAA0B;QAC3D,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;YAClC,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;gBAChD,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC7B,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAC1D;gBACH,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;YACpB,OAAO,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;QAC9C,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAhBD,kDAgBC;AAED;;GAEG;AACH,MAAM,oBAAoB,GAAkC,EAAE,CAAC;AAE/D;;GAEG;AACH,SAAgB,oBAAoB,CAAC,QAAgB,EAAE,OAAsB;IAC3E,oBAAoB,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,SAAgB,2BAA2B,CACzC,OAAgB,EAChB,QAAgB,EAChB,OAA0B;IAE1B,MAAM,OAAO,GAAG,oBAAoB,CAAC,QAAQ,CAAC,IAAI,IAAI,mBAAmB,EAAE,CAAC;IAC5E,OAAO,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,SAAgB,4BAA4B,CAC1C,QAAmB,EACnB,QAAgB,EAChB,OAA0B;IAE1B,OAAO,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,2BAA2B,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -152,14 +152,14 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
152
152
|
type: "ephemeral";
|
|
153
153
|
}>>;
|
|
154
154
|
}, "strip", z.ZodTypeAny, {
|
|
155
|
-
type: "text";
|
|
156
155
|
text: string;
|
|
156
|
+
type: "text";
|
|
157
157
|
cache_control?: {
|
|
158
158
|
type: "ephemeral";
|
|
159
159
|
} | undefined;
|
|
160
160
|
}, {
|
|
161
|
-
type: "text";
|
|
162
161
|
text: string;
|
|
162
|
+
type: "text";
|
|
163
163
|
cache_control?: {
|
|
164
164
|
type: "ephemeral";
|
|
165
165
|
} | undefined;
|
|
@@ -203,15 +203,15 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
203
203
|
type: "ephemeral";
|
|
204
204
|
}>>;
|
|
205
205
|
}, "strip", z.ZodTypeAny, {
|
|
206
|
-
content: string;
|
|
207
206
|
type: "tool_result";
|
|
207
|
+
content: string;
|
|
208
208
|
tool_use_id: string;
|
|
209
209
|
cache_control?: {
|
|
210
210
|
type: "ephemeral";
|
|
211
211
|
} | undefined;
|
|
212
212
|
}, {
|
|
213
|
-
content: string;
|
|
214
213
|
type: "tool_result";
|
|
214
|
+
content: string;
|
|
215
215
|
tool_use_id: string;
|
|
216
216
|
cache_control?: {
|
|
217
217
|
type: "ephemeral";
|
|
@@ -223,13 +223,13 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
223
223
|
media_type: z.ZodLiteral<"image/jpeg">;
|
|
224
224
|
data: z.ZodString;
|
|
225
225
|
}, "strip", z.ZodTypeAny, {
|
|
226
|
+
data: string;
|
|
226
227
|
type: "base64";
|
|
227
228
|
media_type: "image/jpeg";
|
|
228
|
-
data: string;
|
|
229
229
|
}, {
|
|
230
|
+
data: string;
|
|
230
231
|
type: "base64";
|
|
231
232
|
media_type: "image/jpeg";
|
|
232
|
-
data: string;
|
|
233
233
|
}>;
|
|
234
234
|
cache_control: z.ZodOptional<z.ZodObject<{
|
|
235
235
|
type: z.ZodLiteral<"ephemeral">;
|
|
@@ -241,9 +241,9 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
241
241
|
}, "strip", z.ZodTypeAny, {
|
|
242
242
|
type: "image";
|
|
243
243
|
source: {
|
|
244
|
+
data: string;
|
|
244
245
|
type: "base64";
|
|
245
246
|
media_type: "image/jpeg";
|
|
246
|
-
data: string;
|
|
247
247
|
};
|
|
248
248
|
cache_control?: {
|
|
249
249
|
type: "ephemeral";
|
|
@@ -251,9 +251,9 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
251
251
|
}, {
|
|
252
252
|
type: "image";
|
|
253
253
|
source: {
|
|
254
|
+
data: string;
|
|
254
255
|
type: "base64";
|
|
255
256
|
media_type: "image/jpeg";
|
|
256
|
-
data: string;
|
|
257
257
|
};
|
|
258
258
|
cache_control?: {
|
|
259
259
|
type: "ephemeral";
|
|
@@ -261,8 +261,8 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
261
261
|
}>]>, "many">]>;
|
|
262
262
|
}, "strip", z.ZodTypeAny, {
|
|
263
263
|
content: string | ({
|
|
264
|
-
type: "text";
|
|
265
264
|
text: string;
|
|
265
|
+
type: "text";
|
|
266
266
|
cache_control?: {
|
|
267
267
|
type: "ephemeral";
|
|
268
268
|
} | undefined;
|
|
@@ -275,8 +275,8 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
275
275
|
type: "ephemeral";
|
|
276
276
|
} | undefined;
|
|
277
277
|
} | {
|
|
278
|
-
content: string;
|
|
279
278
|
type: "tool_result";
|
|
279
|
+
content: string;
|
|
280
280
|
tool_use_id: string;
|
|
281
281
|
cache_control?: {
|
|
282
282
|
type: "ephemeral";
|
|
@@ -284,9 +284,9 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
284
284
|
} | {
|
|
285
285
|
type: "image";
|
|
286
286
|
source: {
|
|
287
|
+
data: string;
|
|
287
288
|
type: "base64";
|
|
288
289
|
media_type: "image/jpeg";
|
|
289
|
-
data: string;
|
|
290
290
|
};
|
|
291
291
|
cache_control?: {
|
|
292
292
|
type: "ephemeral";
|
|
@@ -295,8 +295,8 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
295
295
|
role: "user" | "assistant";
|
|
296
296
|
}, {
|
|
297
297
|
content: string | ({
|
|
298
|
-
type: "text";
|
|
299
298
|
text: string;
|
|
299
|
+
type: "text";
|
|
300
300
|
cache_control?: {
|
|
301
301
|
type: "ephemeral";
|
|
302
302
|
} | undefined;
|
|
@@ -309,8 +309,8 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
309
309
|
type: "ephemeral";
|
|
310
310
|
} | undefined;
|
|
311
311
|
} | {
|
|
312
|
-
content: string;
|
|
313
312
|
type: "tool_result";
|
|
313
|
+
content: string;
|
|
314
314
|
tool_use_id: string;
|
|
315
315
|
cache_control?: {
|
|
316
316
|
type: "ephemeral";
|
|
@@ -318,9 +318,9 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
318
318
|
} | {
|
|
319
319
|
type: "image";
|
|
320
320
|
source: {
|
|
321
|
+
data: string;
|
|
321
322
|
type: "base64";
|
|
322
323
|
media_type: "image/jpeg";
|
|
323
|
-
data: string;
|
|
324
324
|
};
|
|
325
325
|
cache_control?: {
|
|
326
326
|
type: "ephemeral";
|
|
@@ -359,8 +359,8 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
359
359
|
};
|
|
360
360
|
messageHistory: {
|
|
361
361
|
content: string | ({
|
|
362
|
-
type: "text";
|
|
363
362
|
text: string;
|
|
363
|
+
type: "text";
|
|
364
364
|
cache_control?: {
|
|
365
365
|
type: "ephemeral";
|
|
366
366
|
} | undefined;
|
|
@@ -373,8 +373,8 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
373
373
|
type: "ephemeral";
|
|
374
374
|
} | undefined;
|
|
375
375
|
} | {
|
|
376
|
-
content: string;
|
|
377
376
|
type: "tool_result";
|
|
377
|
+
content: string;
|
|
378
378
|
tool_use_id: string;
|
|
379
379
|
cache_control?: {
|
|
380
380
|
type: "ephemeral";
|
|
@@ -382,9 +382,9 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
382
382
|
} | {
|
|
383
383
|
type: "image";
|
|
384
384
|
source: {
|
|
385
|
+
data: string;
|
|
385
386
|
type: "base64";
|
|
386
387
|
media_type: "image/jpeg";
|
|
387
|
-
data: string;
|
|
388
388
|
};
|
|
389
389
|
cache_control?: {
|
|
390
390
|
type: "ephemeral";
|
|
@@ -423,8 +423,8 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
423
423
|
};
|
|
424
424
|
messageHistory: {
|
|
425
425
|
content: string | ({
|
|
426
|
-
type: "text";
|
|
427
426
|
text: string;
|
|
427
|
+
type: "text";
|
|
428
428
|
cache_control?: {
|
|
429
429
|
type: "ephemeral";
|
|
430
430
|
} | undefined;
|
|
@@ -437,8 +437,8 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
437
437
|
type: "ephemeral";
|
|
438
438
|
} | undefined;
|
|
439
439
|
} | {
|
|
440
|
-
content: string;
|
|
441
440
|
type: "tool_result";
|
|
441
|
+
content: string;
|
|
442
442
|
tool_use_id: string;
|
|
443
443
|
cache_control?: {
|
|
444
444
|
type: "ephemeral";
|
|
@@ -446,9 +446,9 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
446
446
|
} | {
|
|
447
447
|
type: "image";
|
|
448
448
|
source: {
|
|
449
|
+
data: string;
|
|
449
450
|
type: "base64";
|
|
450
451
|
media_type: "image/jpeg";
|
|
451
|
-
data: string;
|
|
452
452
|
};
|
|
453
453
|
cache_control?: {
|
|
454
454
|
type: "ephemeral";
|