@roll-agent/core 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,20 @@
1
1
  import { z } from "zod";
2
+ export declare const browserWindowBoundsSchema: z.ZodObject<{
3
+ x: z.ZodOptional<z.ZodNumber>;
4
+ y: z.ZodOptional<z.ZodNumber>;
5
+ width: z.ZodOptional<z.ZodNumber>;
6
+ height: z.ZodOptional<z.ZodNumber>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ x?: number | undefined;
9
+ y?: number | undefined;
10
+ width?: number | undefined;
11
+ height?: number | undefined;
12
+ }, {
13
+ x?: number | undefined;
14
+ y?: number | undefined;
15
+ width?: number | undefined;
16
+ height?: number | undefined;
17
+ }>;
2
18
  export declare const providerConfigSchema: z.ZodObject<{
3
19
  apiKey: z.ZodString;
4
20
  baseUrl: z.ZodOptional<z.ZodString>;
@@ -58,6 +74,323 @@ export declare const agentsConfigSchema: z.ZodObject<{
58
74
  dataDir: string;
59
75
  env?: Record<string, Record<string, string>> | undefined;
60
76
  }>;
77
+ export declare const browserInstanceConfigSchema: z.ZodEffects<z.ZodObject<{
78
+ platform: z.ZodOptional<z.ZodEnum<["zhipin", "yupao"]>>;
79
+ mode: z.ZodDefault<z.ZodEnum<["managed-cdp", "remote-cdp", "existing-session"]>>;
80
+ headless: z.ZodOptional<z.ZodBoolean>;
81
+ cdpUrl: z.ZodOptional<z.ZodString>;
82
+ cdpHost: z.ZodDefault<z.ZodString>;
83
+ cdpPort: z.ZodOptional<z.ZodNumber>;
84
+ channel: z.ZodDefault<z.ZodEnum<["chrome", "chromium", "msedge"]>>;
85
+ executablePath: z.ZodOptional<z.ZodString>;
86
+ userDataDir: z.ZodString;
87
+ sessionsDir: z.ZodOptional<z.ZodString>;
88
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
89
+ profileName: z.ZodOptional<z.ZodString>;
90
+ windowBounds: z.ZodOptional<z.ZodObject<{
91
+ x: z.ZodOptional<z.ZodNumber>;
92
+ y: z.ZodOptional<z.ZodNumber>;
93
+ width: z.ZodOptional<z.ZodNumber>;
94
+ height: z.ZodOptional<z.ZodNumber>;
95
+ }, "strip", z.ZodTypeAny, {
96
+ x?: number | undefined;
97
+ y?: number | undefined;
98
+ width?: number | undefined;
99
+ height?: number | undefined;
100
+ }, {
101
+ x?: number | undefined;
102
+ y?: number | undefined;
103
+ width?: number | undefined;
104
+ height?: number | undefined;
105
+ }>>;
106
+ trackingAgentId: z.ZodOptional<z.ZodString>;
107
+ }, "strip", z.ZodTypeAny, {
108
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
109
+ cdpHost: string;
110
+ channel: "chrome" | "chromium" | "msedge";
111
+ userDataDir: string;
112
+ platform?: "zhipin" | "yupao" | undefined;
113
+ headless?: boolean | undefined;
114
+ cdpUrl?: string | undefined;
115
+ cdpPort?: number | undefined;
116
+ executablePath?: string | undefined;
117
+ sessionsDir?: string | undefined;
118
+ args?: string[] | undefined;
119
+ profileName?: string | undefined;
120
+ windowBounds?: {
121
+ x?: number | undefined;
122
+ y?: number | undefined;
123
+ width?: number | undefined;
124
+ height?: number | undefined;
125
+ } | undefined;
126
+ trackingAgentId?: string | undefined;
127
+ }, {
128
+ userDataDir: string;
129
+ platform?: "zhipin" | "yupao" | undefined;
130
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
131
+ headless?: boolean | undefined;
132
+ cdpUrl?: string | undefined;
133
+ cdpHost?: string | undefined;
134
+ cdpPort?: number | undefined;
135
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
136
+ executablePath?: string | undefined;
137
+ sessionsDir?: string | undefined;
138
+ args?: string[] | undefined;
139
+ profileName?: string | undefined;
140
+ windowBounds?: {
141
+ x?: number | undefined;
142
+ y?: number | undefined;
143
+ width?: number | undefined;
144
+ height?: number | undefined;
145
+ } | undefined;
146
+ trackingAgentId?: string | undefined;
147
+ }>, {
148
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
149
+ cdpHost: string;
150
+ channel: "chrome" | "chromium" | "msedge";
151
+ userDataDir: string;
152
+ platform?: "zhipin" | "yupao" | undefined;
153
+ headless?: boolean | undefined;
154
+ cdpUrl?: string | undefined;
155
+ cdpPort?: number | undefined;
156
+ executablePath?: string | undefined;
157
+ sessionsDir?: string | undefined;
158
+ args?: string[] | undefined;
159
+ profileName?: string | undefined;
160
+ windowBounds?: {
161
+ x?: number | undefined;
162
+ y?: number | undefined;
163
+ width?: number | undefined;
164
+ height?: number | undefined;
165
+ } | undefined;
166
+ trackingAgentId?: string | undefined;
167
+ }, {
168
+ userDataDir: string;
169
+ platform?: "zhipin" | "yupao" | undefined;
170
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
171
+ headless?: boolean | undefined;
172
+ cdpUrl?: string | undefined;
173
+ cdpHost?: string | undefined;
174
+ cdpPort?: number | undefined;
175
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
176
+ executablePath?: string | undefined;
177
+ sessionsDir?: string | undefined;
178
+ args?: string[] | undefined;
179
+ profileName?: string | undefined;
180
+ windowBounds?: {
181
+ x?: number | undefined;
182
+ y?: number | undefined;
183
+ width?: number | undefined;
184
+ height?: number | undefined;
185
+ } | undefined;
186
+ trackingAgentId?: string | undefined;
187
+ }>;
188
+ export declare const browserConfigSchema: z.ZodEffects<z.ZodObject<{
189
+ defaultInstance: z.ZodOptional<z.ZodString>;
190
+ instances: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
191
+ platform: z.ZodOptional<z.ZodEnum<["zhipin", "yupao"]>>;
192
+ mode: z.ZodDefault<z.ZodEnum<["managed-cdp", "remote-cdp", "existing-session"]>>;
193
+ headless: z.ZodOptional<z.ZodBoolean>;
194
+ cdpUrl: z.ZodOptional<z.ZodString>;
195
+ cdpHost: z.ZodDefault<z.ZodString>;
196
+ cdpPort: z.ZodOptional<z.ZodNumber>;
197
+ channel: z.ZodDefault<z.ZodEnum<["chrome", "chromium", "msedge"]>>;
198
+ executablePath: z.ZodOptional<z.ZodString>;
199
+ userDataDir: z.ZodString;
200
+ sessionsDir: z.ZodOptional<z.ZodString>;
201
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
202
+ profileName: z.ZodOptional<z.ZodString>;
203
+ windowBounds: z.ZodOptional<z.ZodObject<{
204
+ x: z.ZodOptional<z.ZodNumber>;
205
+ y: z.ZodOptional<z.ZodNumber>;
206
+ width: z.ZodOptional<z.ZodNumber>;
207
+ height: z.ZodOptional<z.ZodNumber>;
208
+ }, "strip", z.ZodTypeAny, {
209
+ x?: number | undefined;
210
+ y?: number | undefined;
211
+ width?: number | undefined;
212
+ height?: number | undefined;
213
+ }, {
214
+ x?: number | undefined;
215
+ y?: number | undefined;
216
+ width?: number | undefined;
217
+ height?: number | undefined;
218
+ }>>;
219
+ trackingAgentId: z.ZodOptional<z.ZodString>;
220
+ }, "strip", z.ZodTypeAny, {
221
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
222
+ cdpHost: string;
223
+ channel: "chrome" | "chromium" | "msedge";
224
+ userDataDir: string;
225
+ platform?: "zhipin" | "yupao" | undefined;
226
+ headless?: boolean | undefined;
227
+ cdpUrl?: string | undefined;
228
+ cdpPort?: number | undefined;
229
+ executablePath?: string | undefined;
230
+ sessionsDir?: string | undefined;
231
+ args?: string[] | undefined;
232
+ profileName?: string | undefined;
233
+ windowBounds?: {
234
+ x?: number | undefined;
235
+ y?: number | undefined;
236
+ width?: number | undefined;
237
+ height?: number | undefined;
238
+ } | undefined;
239
+ trackingAgentId?: string | undefined;
240
+ }, {
241
+ userDataDir: string;
242
+ platform?: "zhipin" | "yupao" | undefined;
243
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
244
+ headless?: boolean | undefined;
245
+ cdpUrl?: string | undefined;
246
+ cdpHost?: string | undefined;
247
+ cdpPort?: number | undefined;
248
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
249
+ executablePath?: string | undefined;
250
+ sessionsDir?: string | undefined;
251
+ args?: string[] | undefined;
252
+ profileName?: string | undefined;
253
+ windowBounds?: {
254
+ x?: number | undefined;
255
+ y?: number | undefined;
256
+ width?: number | undefined;
257
+ height?: number | undefined;
258
+ } | undefined;
259
+ trackingAgentId?: string | undefined;
260
+ }>, {
261
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
262
+ cdpHost: string;
263
+ channel: "chrome" | "chromium" | "msedge";
264
+ userDataDir: string;
265
+ platform?: "zhipin" | "yupao" | undefined;
266
+ headless?: boolean | undefined;
267
+ cdpUrl?: string | undefined;
268
+ cdpPort?: number | undefined;
269
+ executablePath?: string | undefined;
270
+ sessionsDir?: string | undefined;
271
+ args?: string[] | undefined;
272
+ profileName?: string | undefined;
273
+ windowBounds?: {
274
+ x?: number | undefined;
275
+ y?: number | undefined;
276
+ width?: number | undefined;
277
+ height?: number | undefined;
278
+ } | undefined;
279
+ trackingAgentId?: string | undefined;
280
+ }, {
281
+ userDataDir: string;
282
+ platform?: "zhipin" | "yupao" | undefined;
283
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
284
+ headless?: boolean | undefined;
285
+ cdpUrl?: string | undefined;
286
+ cdpHost?: string | undefined;
287
+ cdpPort?: number | undefined;
288
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
289
+ executablePath?: string | undefined;
290
+ sessionsDir?: string | undefined;
291
+ args?: string[] | undefined;
292
+ profileName?: string | undefined;
293
+ windowBounds?: {
294
+ x?: number | undefined;
295
+ y?: number | undefined;
296
+ width?: number | undefined;
297
+ height?: number | undefined;
298
+ } | undefined;
299
+ trackingAgentId?: string | undefined;
300
+ }>>>;
301
+ }, "strip", z.ZodTypeAny, {
302
+ instances: Record<string, {
303
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
304
+ cdpHost: string;
305
+ channel: "chrome" | "chromium" | "msedge";
306
+ userDataDir: string;
307
+ platform?: "zhipin" | "yupao" | undefined;
308
+ headless?: boolean | undefined;
309
+ cdpUrl?: string | undefined;
310
+ cdpPort?: number | undefined;
311
+ executablePath?: string | undefined;
312
+ sessionsDir?: string | undefined;
313
+ args?: string[] | undefined;
314
+ profileName?: string | undefined;
315
+ windowBounds?: {
316
+ x?: number | undefined;
317
+ y?: number | undefined;
318
+ width?: number | undefined;
319
+ height?: number | undefined;
320
+ } | undefined;
321
+ trackingAgentId?: string | undefined;
322
+ }>;
323
+ defaultInstance?: string | undefined;
324
+ }, {
325
+ defaultInstance?: string | undefined;
326
+ instances?: Record<string, {
327
+ userDataDir: string;
328
+ platform?: "zhipin" | "yupao" | undefined;
329
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
330
+ headless?: boolean | undefined;
331
+ cdpUrl?: string | undefined;
332
+ cdpHost?: string | undefined;
333
+ cdpPort?: number | undefined;
334
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
335
+ executablePath?: string | undefined;
336
+ sessionsDir?: string | undefined;
337
+ args?: string[] | undefined;
338
+ profileName?: string | undefined;
339
+ windowBounds?: {
340
+ x?: number | undefined;
341
+ y?: number | undefined;
342
+ width?: number | undefined;
343
+ height?: number | undefined;
344
+ } | undefined;
345
+ trackingAgentId?: string | undefined;
346
+ }> | undefined;
347
+ }>, {
348
+ instances: Record<string, {
349
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
350
+ cdpHost: string;
351
+ channel: "chrome" | "chromium" | "msedge";
352
+ userDataDir: string;
353
+ platform?: "zhipin" | "yupao" | undefined;
354
+ headless?: boolean | undefined;
355
+ cdpUrl?: string | undefined;
356
+ cdpPort?: number | undefined;
357
+ executablePath?: string | undefined;
358
+ sessionsDir?: string | undefined;
359
+ args?: string[] | undefined;
360
+ profileName?: string | undefined;
361
+ windowBounds?: {
362
+ x?: number | undefined;
363
+ y?: number | undefined;
364
+ width?: number | undefined;
365
+ height?: number | undefined;
366
+ } | undefined;
367
+ trackingAgentId?: string | undefined;
368
+ }>;
369
+ defaultInstance?: string | undefined;
370
+ }, {
371
+ defaultInstance?: string | undefined;
372
+ instances?: Record<string, {
373
+ userDataDir: string;
374
+ platform?: "zhipin" | "yupao" | undefined;
375
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
376
+ headless?: boolean | undefined;
377
+ cdpUrl?: string | undefined;
378
+ cdpHost?: string | undefined;
379
+ cdpPort?: number | undefined;
380
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
381
+ executablePath?: string | undefined;
382
+ sessionsDir?: string | undefined;
383
+ args?: string[] | undefined;
384
+ profileName?: string | undefined;
385
+ windowBounds?: {
386
+ x?: number | undefined;
387
+ y?: number | undefined;
388
+ width?: number | undefined;
389
+ height?: number | undefined;
390
+ } | undefined;
391
+ trackingAgentId?: string | undefined;
392
+ }> | undefined;
393
+ }>;
61
394
  export declare const rollConfigSchema: z.ZodObject<{
62
395
  llm: z.ZodObject<{
63
396
  defaultProvider: z.ZodString;
@@ -108,11 +441,241 @@ export declare const rollConfigSchema: z.ZodObject<{
108
441
  dataDir: string;
109
442
  env?: Record<string, Record<string, string>> | undefined;
110
443
  }>;
444
+ browser: z.ZodDefault<z.ZodEffects<z.ZodObject<{
445
+ defaultInstance: z.ZodOptional<z.ZodString>;
446
+ instances: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
447
+ platform: z.ZodOptional<z.ZodEnum<["zhipin", "yupao"]>>;
448
+ mode: z.ZodDefault<z.ZodEnum<["managed-cdp", "remote-cdp", "existing-session"]>>;
449
+ headless: z.ZodOptional<z.ZodBoolean>;
450
+ cdpUrl: z.ZodOptional<z.ZodString>;
451
+ cdpHost: z.ZodDefault<z.ZodString>;
452
+ cdpPort: z.ZodOptional<z.ZodNumber>;
453
+ channel: z.ZodDefault<z.ZodEnum<["chrome", "chromium", "msedge"]>>;
454
+ executablePath: z.ZodOptional<z.ZodString>;
455
+ userDataDir: z.ZodString;
456
+ sessionsDir: z.ZodOptional<z.ZodString>;
457
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
458
+ profileName: z.ZodOptional<z.ZodString>;
459
+ windowBounds: z.ZodOptional<z.ZodObject<{
460
+ x: z.ZodOptional<z.ZodNumber>;
461
+ y: z.ZodOptional<z.ZodNumber>;
462
+ width: z.ZodOptional<z.ZodNumber>;
463
+ height: z.ZodOptional<z.ZodNumber>;
464
+ }, "strip", z.ZodTypeAny, {
465
+ x?: number | undefined;
466
+ y?: number | undefined;
467
+ width?: number | undefined;
468
+ height?: number | undefined;
469
+ }, {
470
+ x?: number | undefined;
471
+ y?: number | undefined;
472
+ width?: number | undefined;
473
+ height?: number | undefined;
474
+ }>>;
475
+ trackingAgentId: z.ZodOptional<z.ZodString>;
476
+ }, "strip", z.ZodTypeAny, {
477
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
478
+ cdpHost: string;
479
+ channel: "chrome" | "chromium" | "msedge";
480
+ userDataDir: string;
481
+ platform?: "zhipin" | "yupao" | undefined;
482
+ headless?: boolean | undefined;
483
+ cdpUrl?: string | undefined;
484
+ cdpPort?: number | undefined;
485
+ executablePath?: string | undefined;
486
+ sessionsDir?: string | undefined;
487
+ args?: string[] | undefined;
488
+ profileName?: string | undefined;
489
+ windowBounds?: {
490
+ x?: number | undefined;
491
+ y?: number | undefined;
492
+ width?: number | undefined;
493
+ height?: number | undefined;
494
+ } | undefined;
495
+ trackingAgentId?: string | undefined;
496
+ }, {
497
+ userDataDir: string;
498
+ platform?: "zhipin" | "yupao" | undefined;
499
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
500
+ headless?: boolean | undefined;
501
+ cdpUrl?: string | undefined;
502
+ cdpHost?: string | undefined;
503
+ cdpPort?: number | undefined;
504
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
505
+ executablePath?: string | undefined;
506
+ sessionsDir?: string | undefined;
507
+ args?: string[] | undefined;
508
+ profileName?: string | undefined;
509
+ windowBounds?: {
510
+ x?: number | undefined;
511
+ y?: number | undefined;
512
+ width?: number | undefined;
513
+ height?: number | undefined;
514
+ } | undefined;
515
+ trackingAgentId?: string | undefined;
516
+ }>, {
517
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
518
+ cdpHost: string;
519
+ channel: "chrome" | "chromium" | "msedge";
520
+ userDataDir: string;
521
+ platform?: "zhipin" | "yupao" | undefined;
522
+ headless?: boolean | undefined;
523
+ cdpUrl?: string | undefined;
524
+ cdpPort?: number | undefined;
525
+ executablePath?: string | undefined;
526
+ sessionsDir?: string | undefined;
527
+ args?: string[] | undefined;
528
+ profileName?: string | undefined;
529
+ windowBounds?: {
530
+ x?: number | undefined;
531
+ y?: number | undefined;
532
+ width?: number | undefined;
533
+ height?: number | undefined;
534
+ } | undefined;
535
+ trackingAgentId?: string | undefined;
536
+ }, {
537
+ userDataDir: string;
538
+ platform?: "zhipin" | "yupao" | undefined;
539
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
540
+ headless?: boolean | undefined;
541
+ cdpUrl?: string | undefined;
542
+ cdpHost?: string | undefined;
543
+ cdpPort?: number | undefined;
544
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
545
+ executablePath?: string | undefined;
546
+ sessionsDir?: string | undefined;
547
+ args?: string[] | undefined;
548
+ profileName?: string | undefined;
549
+ windowBounds?: {
550
+ x?: number | undefined;
551
+ y?: number | undefined;
552
+ width?: number | undefined;
553
+ height?: number | undefined;
554
+ } | undefined;
555
+ trackingAgentId?: string | undefined;
556
+ }>>>;
557
+ }, "strip", z.ZodTypeAny, {
558
+ instances: Record<string, {
559
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
560
+ cdpHost: string;
561
+ channel: "chrome" | "chromium" | "msedge";
562
+ userDataDir: string;
563
+ platform?: "zhipin" | "yupao" | undefined;
564
+ headless?: boolean | undefined;
565
+ cdpUrl?: string | undefined;
566
+ cdpPort?: number | undefined;
567
+ executablePath?: string | undefined;
568
+ sessionsDir?: string | undefined;
569
+ args?: string[] | undefined;
570
+ profileName?: string | undefined;
571
+ windowBounds?: {
572
+ x?: number | undefined;
573
+ y?: number | undefined;
574
+ width?: number | undefined;
575
+ height?: number | undefined;
576
+ } | undefined;
577
+ trackingAgentId?: string | undefined;
578
+ }>;
579
+ defaultInstance?: string | undefined;
580
+ }, {
581
+ defaultInstance?: string | undefined;
582
+ instances?: Record<string, {
583
+ userDataDir: string;
584
+ platform?: "zhipin" | "yupao" | undefined;
585
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
586
+ headless?: boolean | undefined;
587
+ cdpUrl?: string | undefined;
588
+ cdpHost?: string | undefined;
589
+ cdpPort?: number | undefined;
590
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
591
+ executablePath?: string | undefined;
592
+ sessionsDir?: string | undefined;
593
+ args?: string[] | undefined;
594
+ profileName?: string | undefined;
595
+ windowBounds?: {
596
+ x?: number | undefined;
597
+ y?: number | undefined;
598
+ width?: number | undefined;
599
+ height?: number | undefined;
600
+ } | undefined;
601
+ trackingAgentId?: string | undefined;
602
+ }> | undefined;
603
+ }>, {
604
+ instances: Record<string, {
605
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
606
+ cdpHost: string;
607
+ channel: "chrome" | "chromium" | "msedge";
608
+ userDataDir: string;
609
+ platform?: "zhipin" | "yupao" | undefined;
610
+ headless?: boolean | undefined;
611
+ cdpUrl?: string | undefined;
612
+ cdpPort?: number | undefined;
613
+ executablePath?: string | undefined;
614
+ sessionsDir?: string | undefined;
615
+ args?: string[] | undefined;
616
+ profileName?: string | undefined;
617
+ windowBounds?: {
618
+ x?: number | undefined;
619
+ y?: number | undefined;
620
+ width?: number | undefined;
621
+ height?: number | undefined;
622
+ } | undefined;
623
+ trackingAgentId?: string | undefined;
624
+ }>;
625
+ defaultInstance?: string | undefined;
626
+ }, {
627
+ defaultInstance?: string | undefined;
628
+ instances?: Record<string, {
629
+ userDataDir: string;
630
+ platform?: "zhipin" | "yupao" | undefined;
631
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
632
+ headless?: boolean | undefined;
633
+ cdpUrl?: string | undefined;
634
+ cdpHost?: string | undefined;
635
+ cdpPort?: number | undefined;
636
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
637
+ executablePath?: string | undefined;
638
+ sessionsDir?: string | undefined;
639
+ args?: string[] | undefined;
640
+ profileName?: string | undefined;
641
+ windowBounds?: {
642
+ x?: number | undefined;
643
+ y?: number | undefined;
644
+ width?: number | undefined;
645
+ height?: number | undefined;
646
+ } | undefined;
647
+ trackingAgentId?: string | undefined;
648
+ }> | undefined;
649
+ }>>;
111
650
  }, "strip", z.ZodTypeAny, {
112
651
  ask: {
113
652
  llmModel?: string | undefined;
114
653
  confirmThreshold?: number | undefined;
115
654
  };
655
+ browser: {
656
+ instances: Record<string, {
657
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
658
+ cdpHost: string;
659
+ channel: "chrome" | "chromium" | "msedge";
660
+ userDataDir: string;
661
+ platform?: "zhipin" | "yupao" | undefined;
662
+ headless?: boolean | undefined;
663
+ cdpUrl?: string | undefined;
664
+ cdpPort?: number | undefined;
665
+ executablePath?: string | undefined;
666
+ sessionsDir?: string | undefined;
667
+ args?: string[] | undefined;
668
+ profileName?: string | undefined;
669
+ windowBounds?: {
670
+ x?: number | undefined;
671
+ y?: number | undefined;
672
+ width?: number | undefined;
673
+ height?: number | undefined;
674
+ } | undefined;
675
+ trackingAgentId?: string | undefined;
676
+ }>;
677
+ defaultInstance?: string | undefined;
678
+ };
116
679
  llm: {
117
680
  defaultProvider: string;
118
681
  defaultModel: string;
@@ -142,5 +705,30 @@ export declare const rollConfigSchema: z.ZodObject<{
142
705
  dataDir: string;
143
706
  env?: Record<string, Record<string, string>> | undefined;
144
707
  };
708
+ browser?: {
709
+ defaultInstance?: string | undefined;
710
+ instances?: Record<string, {
711
+ userDataDir: string;
712
+ platform?: "zhipin" | "yupao" | undefined;
713
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
714
+ headless?: boolean | undefined;
715
+ cdpUrl?: string | undefined;
716
+ cdpHost?: string | undefined;
717
+ cdpPort?: number | undefined;
718
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
719
+ executablePath?: string | undefined;
720
+ sessionsDir?: string | undefined;
721
+ args?: string[] | undefined;
722
+ profileName?: string | undefined;
723
+ windowBounds?: {
724
+ x?: number | undefined;
725
+ y?: number | undefined;
726
+ width?: number | undefined;
727
+ height?: number | undefined;
728
+ } | undefined;
729
+ trackingAgentId?: string | undefined;
730
+ }> | undefined;
731
+ } | undefined;
145
732
  }>;
146
733
  export type RollConfig = z.infer<typeof rollConfigSchema>;
734
+ export type BrowserConfig = z.infer<typeof browserConfigSchema>;
@@ -1 +1 @@
1
- import{z as o}from"zod";export const providerConfigSchema=o.object({apiKey:o.string(),baseUrl:o.string().optional()});export const llmConfigSchema=o.object({defaultProvider:o.string(),defaultModel:o.string(),providers:o.record(o.string(),providerConfigSchema)});export const askConfigSchema=o.object({llmModel:o.string().optional(),confirmThreshold:o.number().optional()});export const agentsConfigSchema=o.object({dataDir:o.string(),env:o.record(o.string(),o.record(o.string(),o.string())).optional()});export const rollConfigSchema=o.object({llm:llmConfigSchema,ask:askConfigSchema,agents:agentsConfigSchema});
1
+ import{z as e}from"zod";const o=["zhipin","yupao"],t=["managed-cdp","remote-cdp","existing-session"],n=["chrome","chromium","msedge"];export const browserWindowBoundsSchema=e.object({x:e.number().int().optional(),y:e.number().int().optional(),width:e.number().int().positive().optional(),height:e.number().int().positive().optional()});export const providerConfigSchema=e.object({apiKey:e.string(),baseUrl:e.string().optional()});export const llmConfigSchema=e.object({defaultProvider:e.string(),defaultModel:e.string(),providers:e.record(e.string(),providerConfigSchema)});export const askConfigSchema=e.object({llmModel:e.string().optional(),confirmThreshold:e.number().optional()});export const agentsConfigSchema=e.object({dataDir:e.string(),env:e.record(e.string(),e.record(e.string(),e.string())).optional()});export const browserInstanceConfigSchema=e.object({platform:e.enum(o).optional(),mode:e.enum(t).default("managed-cdp"),headless:e.boolean().optional(),cdpUrl:e.string().optional(),cdpHost:e.string().default("127.0.0.1"),cdpPort:e.number().int().min(1).max(65535).optional(),channel:e.enum(n).default("chrome"),executablePath:e.string().optional(),userDataDir:e.string().trim().min(1),sessionsDir:e.string().trim().min(1).optional(),args:e.array(e.string()).optional(),profileName:e.string().trim().min(1).optional(),windowBounds:browserWindowBoundsSchema.optional(),trackingAgentId:e.string().trim().min(1).optional()}).superRefine((o,t)=>{"managed-cdp"===o.mode&&void 0===o.cdpPort&&t.addIssue({code:e.ZodIssueCode.custom,path:["cdpPort"],message:"managed-cdp browser instance requires cdpPort"}),"remote-cdp"!==o.mode&&"existing-session"!==o.mode||void 0!==o.cdpUrl||t.addIssue({code:e.ZodIssueCode.custom,path:["cdpUrl"],message:`${o.mode} browser instance requires cdpUrl`})});export const browserConfigSchema=e.object({defaultInstance:e.string().trim().min(1).optional(),instances:e.record(e.string(),browserInstanceConfigSchema).default({})}).superRefine((o,t)=>{const n=Object.entries(o.instances);void 0!==o.defaultInstance&&void 0===o.instances[o.defaultInstance]&&t.addIssue({code:e.ZodIssueCode.custom,path:["defaultInstance"],message:`defaultInstance "${o.defaultInstance}" is not declared in browser.instances`});const s=new Map,r=new Map;for(const[o,i]of n){if(void 0!==i.cdpPort){const n=s.get(i.cdpPort);void 0!==n?t.addIssue({code:e.ZodIssueCode.custom,path:["instances",o,"cdpPort"],message:`cdpPort ${String(i.cdpPort)} is already used by browser instance "${n}"`}):s.set(i.cdpPort,o)}const n=r.get(i.userDataDir);void 0!==n?t.addIssue({code:e.ZodIssueCode.custom,path:["instances",o,"userDataDir"],message:`userDataDir is already used by browser instance "${n}"`}):r.set(i.userDataDir,o)}});export const rollConfigSchema=e.object({llm:llmConfigSchema,ask:askConfigSchema,agents:agentsConfigSchema,browser:browserConfigSchema.default({})});
@@ -2,6 +2,7 @@ import { type AgentRuntimeEnvInspection } from "../config/runtime-env.ts";
2
2
  import type { RegisteredAgent } from "../types/agent.ts";
3
3
  import type { RollConfig } from "../config/schema.ts";
4
4
  export declare function inspectAgentRuntimeEnv(agent: RegisteredAgent, options: {
5
- readonly agentsConfig: RollConfig["agents"];
5
+ readonly config?: RollConfig;
6
+ readonly agentsConfig?: RollConfig["agents"];
6
7
  readonly timeoutMs?: number;
7
8
  }): Promise<AgentRuntimeEnvInspection>;
@@ -1 +1 @@
1
- import{getAgentEnvFromAgentsConfig as t}from"../config/helpers.js";import{AgentRuntimeEnvDiagnosticPayloadSchema as n,DIAGNOSTIC_TOOL_CANDIDATES as e}from"../config/runtime-env.js";import{resolveTransportWithDevSpawnSpec as o}from"../registry/dev-spawn.js";import{getAgentPid as r}from"../registry/process-manager.js";import{McpClientManager as i}from"./client-manager.js";export async function inspectAgentRuntimeEnv(a,c){if("core-managed"===a.runtime.ownership){if(void 0===r(c.agentsConfig.dataDir,a.skill.name))return{status:"unverified",reason:"agent-not-running",message:"agent 未运行(缺少活动 PID)"}}const f=new i;try{const r=o(a),i=t(c.agentsConfig,a.skill.name),l=await f.connect(a.skill.name,r,a.installPath,{...void 0!==c.timeoutMs?{timeoutMs:c.timeoutMs}:{},...i?{env:i}:{}}),{tools:m}=await l.listTools(),u=e.find(t=>m.some(n=>n.name===t));if(!u)return{status:"unverified",reason:"diagnostic-tool-unavailable",message:"agent 未暴露 diagnostic_status / browser_status.effectiveEnvSources"};const g=await l.callTool({name:u,arguments:{}});return{status:"verified",toolName:u,payload:n.parse(s(g))}}catch(t){return{status:"unverified",reason:"connection-failed",message:`无法校验运行态: ${t instanceof Error?t.message:String(t)}`}}finally{await f.disconnectAll()}}function s(t){const n=a(t,"诊断 tool 未返回 text content");try{return JSON.parse(n)}catch(t){throw new Error(`诊断 tool 返回了不可解析的 JSON: ${t instanceof Error?t.message:String(t)}`)}}function a(t,n){const e=c(t);for(const t of e)if("object"==typeof t&&null!==t&&"type"in t&&"text"===t.type&&"text"in t&&"string"==typeof t.text)return t.text;throw new Error(n)}function c(t){if("object"!=typeof t||null===t||!("content"in t))throw new Error("诊断 tool 未返回 MCP content 数组");const n=t.content;if(!Array.isArray(n))throw new Error("诊断 tool 返回的 content 不是数组");return n}
1
+ import{getAgentEnv as t,getAgentEnvFromAgentsConfig as n}from"../config/helpers.js";import{AgentRuntimeEnvDiagnosticPayloadSchema as e,DIAGNOSTIC_TOOL_CANDIDATES as o}from"../config/runtime-env.js";import{resolveTransportWithDevSpawnSpec as r}from"../registry/dev-spawn.js";import{getAgentPid as i}from"../registry/process-manager.js";import{McpClientManager as s}from"./client-manager.js";export async function inspectAgentRuntimeEnv(c,f){const l=f.config?.agents??f.agentsConfig;if(void 0===l)throw new Error("inspectAgentRuntimeEnv requires config or agentsConfig.");if("core-managed"===c.runtime.ownership){if(void 0===i(l.dataDir,c.skill.name))return{status:"unverified",reason:"agent-not-running",message:"agent 未运行(缺少活动 PID)"}}const m=new s;try{const i=r(c),s=void 0!==f.config?t(f.config,c.skill.name):n(l,c.skill.name),u=await m.connect(c.skill.name,i,c.installPath,{...void 0!==f.timeoutMs?{timeoutMs:f.timeoutMs}:{},...s?{env:s}:{}}),{tools:g}=await u.listTools(),p=o.find(t=>g.some(n=>n.name===t));if(!p)return{status:"unverified",reason:"diagnostic-tool-unavailable",message:"agent 未暴露 diagnostic_status / browser_status.effectiveEnvSources"};const w=await u.callTool({name:p,arguments:{}});return{status:"verified",toolName:p,payload:e.parse(a(w))}}catch(t){return{status:"unverified",reason:"connection-failed",message:`无法校验运行态: ${t instanceof Error?t.message:String(t)}`}}finally{await m.disconnectAll()}}function a(t){const n=c(t,"诊断 tool 未返回 text content");try{return JSON.parse(n)}catch(t){throw new Error(`诊断 tool 返回了不可解析的 JSON: ${t instanceof Error?t.message:String(t)}`)}}function c(t,n){const e=f(t);for(const t of e)if("object"==typeof t&&null!==t&&"type"in t&&"text"===t.type&&"text"in t&&"string"==typeof t.text)return t.text;throw new Error(n)}function f(t){if("object"!=typeof t||null===t||!("content"in t))throw new Error("诊断 tool 未返回 MCP content 数组");const n=t.content;if(!Array.isArray(n))throw new Error("诊断 tool 返回的 content 不是数组");return n}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roll-agent/core",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",