@roll-agent/core 0.7.1 → 0.9.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,337 @@ 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
+ profileColor: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
91
+ windowBounds: z.ZodOptional<z.ZodObject<{
92
+ x: z.ZodOptional<z.ZodNumber>;
93
+ y: z.ZodOptional<z.ZodNumber>;
94
+ width: z.ZodOptional<z.ZodNumber>;
95
+ height: z.ZodOptional<z.ZodNumber>;
96
+ }, "strip", z.ZodTypeAny, {
97
+ x?: number | undefined;
98
+ y?: number | undefined;
99
+ width?: number | undefined;
100
+ height?: number | undefined;
101
+ }, {
102
+ x?: number | undefined;
103
+ y?: number | undefined;
104
+ width?: number | undefined;
105
+ height?: number | undefined;
106
+ }>>;
107
+ trackingAgentId: z.ZodOptional<z.ZodString>;
108
+ }, "strip", z.ZodTypeAny, {
109
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
110
+ cdpHost: string;
111
+ channel: "chrome" | "chromium" | "msedge";
112
+ userDataDir: string;
113
+ platform?: "zhipin" | "yupao" | undefined;
114
+ headless?: boolean | undefined;
115
+ cdpUrl?: string | undefined;
116
+ cdpPort?: number | undefined;
117
+ executablePath?: string | undefined;
118
+ sessionsDir?: string | undefined;
119
+ args?: string[] | undefined;
120
+ profileName?: string | undefined;
121
+ profileColor?: string | undefined;
122
+ windowBounds?: {
123
+ x?: number | undefined;
124
+ y?: number | undefined;
125
+ width?: number | undefined;
126
+ height?: number | undefined;
127
+ } | undefined;
128
+ trackingAgentId?: string | undefined;
129
+ }, {
130
+ userDataDir: string;
131
+ platform?: "zhipin" | "yupao" | undefined;
132
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
133
+ headless?: boolean | undefined;
134
+ cdpUrl?: string | undefined;
135
+ cdpHost?: string | undefined;
136
+ cdpPort?: number | undefined;
137
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
138
+ executablePath?: string | undefined;
139
+ sessionsDir?: string | undefined;
140
+ args?: string[] | undefined;
141
+ profileName?: string | undefined;
142
+ profileColor?: string | undefined;
143
+ windowBounds?: {
144
+ x?: number | undefined;
145
+ y?: number | undefined;
146
+ width?: number | undefined;
147
+ height?: number | undefined;
148
+ } | undefined;
149
+ trackingAgentId?: string | undefined;
150
+ }>, {
151
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
152
+ cdpHost: string;
153
+ channel: "chrome" | "chromium" | "msedge";
154
+ userDataDir: string;
155
+ platform?: "zhipin" | "yupao" | undefined;
156
+ headless?: boolean | undefined;
157
+ cdpUrl?: string | undefined;
158
+ cdpPort?: number | undefined;
159
+ executablePath?: string | undefined;
160
+ sessionsDir?: string | undefined;
161
+ args?: string[] | undefined;
162
+ profileName?: string | undefined;
163
+ profileColor?: string | undefined;
164
+ windowBounds?: {
165
+ x?: number | undefined;
166
+ y?: number | undefined;
167
+ width?: number | undefined;
168
+ height?: number | undefined;
169
+ } | undefined;
170
+ trackingAgentId?: string | undefined;
171
+ }, {
172
+ userDataDir: string;
173
+ platform?: "zhipin" | "yupao" | undefined;
174
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
175
+ headless?: boolean | undefined;
176
+ cdpUrl?: string | undefined;
177
+ cdpHost?: string | undefined;
178
+ cdpPort?: number | undefined;
179
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
180
+ executablePath?: string | undefined;
181
+ sessionsDir?: string | undefined;
182
+ args?: string[] | undefined;
183
+ profileName?: string | undefined;
184
+ profileColor?: string | undefined;
185
+ windowBounds?: {
186
+ x?: number | undefined;
187
+ y?: number | undefined;
188
+ width?: number | undefined;
189
+ height?: number | undefined;
190
+ } | undefined;
191
+ trackingAgentId?: string | undefined;
192
+ }>;
193
+ export declare const browserConfigSchema: z.ZodEffects<z.ZodObject<{
194
+ defaultInstance: z.ZodOptional<z.ZodString>;
195
+ instances: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
196
+ platform: z.ZodOptional<z.ZodEnum<["zhipin", "yupao"]>>;
197
+ mode: z.ZodDefault<z.ZodEnum<["managed-cdp", "remote-cdp", "existing-session"]>>;
198
+ headless: z.ZodOptional<z.ZodBoolean>;
199
+ cdpUrl: z.ZodOptional<z.ZodString>;
200
+ cdpHost: z.ZodDefault<z.ZodString>;
201
+ cdpPort: z.ZodOptional<z.ZodNumber>;
202
+ channel: z.ZodDefault<z.ZodEnum<["chrome", "chromium", "msedge"]>>;
203
+ executablePath: z.ZodOptional<z.ZodString>;
204
+ userDataDir: z.ZodString;
205
+ sessionsDir: z.ZodOptional<z.ZodString>;
206
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
207
+ profileName: z.ZodOptional<z.ZodString>;
208
+ profileColor: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
209
+ windowBounds: z.ZodOptional<z.ZodObject<{
210
+ x: z.ZodOptional<z.ZodNumber>;
211
+ y: z.ZodOptional<z.ZodNumber>;
212
+ width: z.ZodOptional<z.ZodNumber>;
213
+ height: z.ZodOptional<z.ZodNumber>;
214
+ }, "strip", z.ZodTypeAny, {
215
+ x?: number | undefined;
216
+ y?: number | undefined;
217
+ width?: number | undefined;
218
+ height?: number | undefined;
219
+ }, {
220
+ x?: number | undefined;
221
+ y?: number | undefined;
222
+ width?: number | undefined;
223
+ height?: number | undefined;
224
+ }>>;
225
+ trackingAgentId: z.ZodOptional<z.ZodString>;
226
+ }, "strip", z.ZodTypeAny, {
227
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
228
+ cdpHost: string;
229
+ channel: "chrome" | "chromium" | "msedge";
230
+ userDataDir: string;
231
+ platform?: "zhipin" | "yupao" | undefined;
232
+ headless?: boolean | undefined;
233
+ cdpUrl?: string | undefined;
234
+ cdpPort?: number | undefined;
235
+ executablePath?: string | undefined;
236
+ sessionsDir?: string | undefined;
237
+ args?: string[] | undefined;
238
+ profileName?: string | undefined;
239
+ profileColor?: string | undefined;
240
+ windowBounds?: {
241
+ x?: number | undefined;
242
+ y?: number | undefined;
243
+ width?: number | undefined;
244
+ height?: number | undefined;
245
+ } | undefined;
246
+ trackingAgentId?: string | undefined;
247
+ }, {
248
+ userDataDir: string;
249
+ platform?: "zhipin" | "yupao" | undefined;
250
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
251
+ headless?: boolean | undefined;
252
+ cdpUrl?: string | undefined;
253
+ cdpHost?: string | undefined;
254
+ cdpPort?: number | undefined;
255
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
256
+ executablePath?: string | undefined;
257
+ sessionsDir?: string | undefined;
258
+ args?: string[] | undefined;
259
+ profileName?: string | undefined;
260
+ profileColor?: string | undefined;
261
+ windowBounds?: {
262
+ x?: number | undefined;
263
+ y?: number | undefined;
264
+ width?: number | undefined;
265
+ height?: number | undefined;
266
+ } | undefined;
267
+ trackingAgentId?: string | undefined;
268
+ }>, {
269
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
270
+ cdpHost: string;
271
+ channel: "chrome" | "chromium" | "msedge";
272
+ userDataDir: string;
273
+ platform?: "zhipin" | "yupao" | undefined;
274
+ headless?: boolean | undefined;
275
+ cdpUrl?: string | undefined;
276
+ cdpPort?: number | undefined;
277
+ executablePath?: string | undefined;
278
+ sessionsDir?: string | undefined;
279
+ args?: string[] | undefined;
280
+ profileName?: string | undefined;
281
+ profileColor?: string | undefined;
282
+ windowBounds?: {
283
+ x?: number | undefined;
284
+ y?: number | undefined;
285
+ width?: number | undefined;
286
+ height?: number | undefined;
287
+ } | undefined;
288
+ trackingAgentId?: string | undefined;
289
+ }, {
290
+ userDataDir: string;
291
+ platform?: "zhipin" | "yupao" | undefined;
292
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
293
+ headless?: boolean | undefined;
294
+ cdpUrl?: string | undefined;
295
+ cdpHost?: string | undefined;
296
+ cdpPort?: number | undefined;
297
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
298
+ executablePath?: string | undefined;
299
+ sessionsDir?: string | undefined;
300
+ args?: string[] | undefined;
301
+ profileName?: string | undefined;
302
+ profileColor?: string | undefined;
303
+ windowBounds?: {
304
+ x?: number | undefined;
305
+ y?: number | undefined;
306
+ width?: number | undefined;
307
+ height?: number | undefined;
308
+ } | undefined;
309
+ trackingAgentId?: string | undefined;
310
+ }>>>;
311
+ }, "strip", z.ZodTypeAny, {
312
+ instances: Record<string, {
313
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
314
+ cdpHost: string;
315
+ channel: "chrome" | "chromium" | "msedge";
316
+ userDataDir: string;
317
+ platform?: "zhipin" | "yupao" | undefined;
318
+ headless?: boolean | undefined;
319
+ cdpUrl?: string | undefined;
320
+ cdpPort?: number | undefined;
321
+ executablePath?: string | undefined;
322
+ sessionsDir?: string | undefined;
323
+ args?: string[] | undefined;
324
+ profileName?: string | undefined;
325
+ profileColor?: string | undefined;
326
+ windowBounds?: {
327
+ x?: number | undefined;
328
+ y?: number | undefined;
329
+ width?: number | undefined;
330
+ height?: number | undefined;
331
+ } | undefined;
332
+ trackingAgentId?: string | undefined;
333
+ }>;
334
+ defaultInstance?: string | undefined;
335
+ }, {
336
+ defaultInstance?: string | undefined;
337
+ instances?: Record<string, {
338
+ userDataDir: string;
339
+ platform?: "zhipin" | "yupao" | undefined;
340
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
341
+ headless?: boolean | undefined;
342
+ cdpUrl?: string | undefined;
343
+ cdpHost?: string | undefined;
344
+ cdpPort?: number | undefined;
345
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
346
+ executablePath?: string | undefined;
347
+ sessionsDir?: string | undefined;
348
+ args?: string[] | undefined;
349
+ profileName?: string | undefined;
350
+ profileColor?: string | undefined;
351
+ windowBounds?: {
352
+ x?: number | undefined;
353
+ y?: number | undefined;
354
+ width?: number | undefined;
355
+ height?: number | undefined;
356
+ } | undefined;
357
+ trackingAgentId?: string | undefined;
358
+ }> | undefined;
359
+ }>, {
360
+ instances: Record<string, {
361
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
362
+ cdpHost: string;
363
+ channel: "chrome" | "chromium" | "msedge";
364
+ userDataDir: string;
365
+ platform?: "zhipin" | "yupao" | undefined;
366
+ headless?: boolean | undefined;
367
+ cdpUrl?: string | undefined;
368
+ cdpPort?: number | undefined;
369
+ executablePath?: string | undefined;
370
+ sessionsDir?: string | undefined;
371
+ args?: string[] | undefined;
372
+ profileName?: string | undefined;
373
+ profileColor?: string | undefined;
374
+ windowBounds?: {
375
+ x?: number | undefined;
376
+ y?: number | undefined;
377
+ width?: number | undefined;
378
+ height?: number | undefined;
379
+ } | undefined;
380
+ trackingAgentId?: string | undefined;
381
+ }>;
382
+ defaultInstance?: string | undefined;
383
+ }, {
384
+ defaultInstance?: string | undefined;
385
+ instances?: Record<string, {
386
+ userDataDir: string;
387
+ platform?: "zhipin" | "yupao" | undefined;
388
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
389
+ headless?: boolean | undefined;
390
+ cdpUrl?: string | undefined;
391
+ cdpHost?: string | undefined;
392
+ cdpPort?: number | undefined;
393
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
394
+ executablePath?: string | undefined;
395
+ sessionsDir?: string | undefined;
396
+ args?: string[] | undefined;
397
+ profileName?: string | undefined;
398
+ profileColor?: string | undefined;
399
+ windowBounds?: {
400
+ x?: number | undefined;
401
+ y?: number | undefined;
402
+ width?: number | undefined;
403
+ height?: number | undefined;
404
+ } | undefined;
405
+ trackingAgentId?: string | undefined;
406
+ }> | undefined;
407
+ }>;
61
408
  export declare const rollConfigSchema: z.ZodObject<{
62
409
  llm: z.ZodObject<{
63
410
  defaultProvider: z.ZodString;
@@ -108,11 +455,251 @@ export declare const rollConfigSchema: z.ZodObject<{
108
455
  dataDir: string;
109
456
  env?: Record<string, Record<string, string>> | undefined;
110
457
  }>;
458
+ browser: z.ZodDefault<z.ZodEffects<z.ZodObject<{
459
+ defaultInstance: z.ZodOptional<z.ZodString>;
460
+ instances: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
461
+ platform: z.ZodOptional<z.ZodEnum<["zhipin", "yupao"]>>;
462
+ mode: z.ZodDefault<z.ZodEnum<["managed-cdp", "remote-cdp", "existing-session"]>>;
463
+ headless: z.ZodOptional<z.ZodBoolean>;
464
+ cdpUrl: z.ZodOptional<z.ZodString>;
465
+ cdpHost: z.ZodDefault<z.ZodString>;
466
+ cdpPort: z.ZodOptional<z.ZodNumber>;
467
+ channel: z.ZodDefault<z.ZodEnum<["chrome", "chromium", "msedge"]>>;
468
+ executablePath: z.ZodOptional<z.ZodString>;
469
+ userDataDir: z.ZodString;
470
+ sessionsDir: z.ZodOptional<z.ZodString>;
471
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
472
+ profileName: z.ZodOptional<z.ZodString>;
473
+ profileColor: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
474
+ windowBounds: z.ZodOptional<z.ZodObject<{
475
+ x: z.ZodOptional<z.ZodNumber>;
476
+ y: z.ZodOptional<z.ZodNumber>;
477
+ width: z.ZodOptional<z.ZodNumber>;
478
+ height: z.ZodOptional<z.ZodNumber>;
479
+ }, "strip", z.ZodTypeAny, {
480
+ x?: number | undefined;
481
+ y?: number | undefined;
482
+ width?: number | undefined;
483
+ height?: number | undefined;
484
+ }, {
485
+ x?: number | undefined;
486
+ y?: number | undefined;
487
+ width?: number | undefined;
488
+ height?: number | undefined;
489
+ }>>;
490
+ trackingAgentId: z.ZodOptional<z.ZodString>;
491
+ }, "strip", z.ZodTypeAny, {
492
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
493
+ cdpHost: string;
494
+ channel: "chrome" | "chromium" | "msedge";
495
+ userDataDir: string;
496
+ platform?: "zhipin" | "yupao" | undefined;
497
+ headless?: boolean | undefined;
498
+ cdpUrl?: string | undefined;
499
+ cdpPort?: number | undefined;
500
+ executablePath?: string | undefined;
501
+ sessionsDir?: string | undefined;
502
+ args?: string[] | undefined;
503
+ profileName?: string | undefined;
504
+ profileColor?: string | undefined;
505
+ windowBounds?: {
506
+ x?: number | undefined;
507
+ y?: number | undefined;
508
+ width?: number | undefined;
509
+ height?: number | undefined;
510
+ } | undefined;
511
+ trackingAgentId?: string | undefined;
512
+ }, {
513
+ userDataDir: string;
514
+ platform?: "zhipin" | "yupao" | undefined;
515
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
516
+ headless?: boolean | undefined;
517
+ cdpUrl?: string | undefined;
518
+ cdpHost?: string | undefined;
519
+ cdpPort?: number | undefined;
520
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
521
+ executablePath?: string | undefined;
522
+ sessionsDir?: string | undefined;
523
+ args?: string[] | undefined;
524
+ profileName?: string | undefined;
525
+ profileColor?: string | undefined;
526
+ windowBounds?: {
527
+ x?: number | undefined;
528
+ y?: number | undefined;
529
+ width?: number | undefined;
530
+ height?: number | undefined;
531
+ } | undefined;
532
+ trackingAgentId?: string | undefined;
533
+ }>, {
534
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
535
+ cdpHost: string;
536
+ channel: "chrome" | "chromium" | "msedge";
537
+ userDataDir: string;
538
+ platform?: "zhipin" | "yupao" | undefined;
539
+ headless?: boolean | undefined;
540
+ cdpUrl?: string | undefined;
541
+ cdpPort?: number | undefined;
542
+ executablePath?: string | undefined;
543
+ sessionsDir?: string | undefined;
544
+ args?: string[] | undefined;
545
+ profileName?: string | undefined;
546
+ profileColor?: string | undefined;
547
+ windowBounds?: {
548
+ x?: number | undefined;
549
+ y?: number | undefined;
550
+ width?: number | undefined;
551
+ height?: number | undefined;
552
+ } | undefined;
553
+ trackingAgentId?: string | undefined;
554
+ }, {
555
+ userDataDir: string;
556
+ platform?: "zhipin" | "yupao" | undefined;
557
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
558
+ headless?: boolean | undefined;
559
+ cdpUrl?: string | undefined;
560
+ cdpHost?: string | undefined;
561
+ cdpPort?: number | undefined;
562
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
563
+ executablePath?: string | undefined;
564
+ sessionsDir?: string | undefined;
565
+ args?: string[] | undefined;
566
+ profileName?: string | undefined;
567
+ profileColor?: string | undefined;
568
+ windowBounds?: {
569
+ x?: number | undefined;
570
+ y?: number | undefined;
571
+ width?: number | undefined;
572
+ height?: number | undefined;
573
+ } | undefined;
574
+ trackingAgentId?: string | undefined;
575
+ }>>>;
576
+ }, "strip", z.ZodTypeAny, {
577
+ instances: Record<string, {
578
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
579
+ cdpHost: string;
580
+ channel: "chrome" | "chromium" | "msedge";
581
+ userDataDir: string;
582
+ platform?: "zhipin" | "yupao" | undefined;
583
+ headless?: boolean | undefined;
584
+ cdpUrl?: string | undefined;
585
+ cdpPort?: number | undefined;
586
+ executablePath?: string | undefined;
587
+ sessionsDir?: string | undefined;
588
+ args?: string[] | undefined;
589
+ profileName?: string | undefined;
590
+ profileColor?: string | undefined;
591
+ windowBounds?: {
592
+ x?: number | undefined;
593
+ y?: number | undefined;
594
+ width?: number | undefined;
595
+ height?: number | undefined;
596
+ } | undefined;
597
+ trackingAgentId?: string | undefined;
598
+ }>;
599
+ defaultInstance?: string | undefined;
600
+ }, {
601
+ defaultInstance?: string | undefined;
602
+ instances?: Record<string, {
603
+ userDataDir: string;
604
+ platform?: "zhipin" | "yupao" | undefined;
605
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
606
+ headless?: boolean | undefined;
607
+ cdpUrl?: string | undefined;
608
+ cdpHost?: string | undefined;
609
+ cdpPort?: number | undefined;
610
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
611
+ executablePath?: string | undefined;
612
+ sessionsDir?: string | undefined;
613
+ args?: string[] | undefined;
614
+ profileName?: string | undefined;
615
+ profileColor?: string | undefined;
616
+ windowBounds?: {
617
+ x?: number | undefined;
618
+ y?: number | undefined;
619
+ width?: number | undefined;
620
+ height?: number | undefined;
621
+ } | undefined;
622
+ trackingAgentId?: string | undefined;
623
+ }> | undefined;
624
+ }>, {
625
+ instances: Record<string, {
626
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
627
+ cdpHost: string;
628
+ channel: "chrome" | "chromium" | "msedge";
629
+ userDataDir: string;
630
+ platform?: "zhipin" | "yupao" | undefined;
631
+ headless?: boolean | undefined;
632
+ cdpUrl?: string | undefined;
633
+ cdpPort?: number | undefined;
634
+ executablePath?: string | undefined;
635
+ sessionsDir?: string | undefined;
636
+ args?: string[] | undefined;
637
+ profileName?: string | undefined;
638
+ profileColor?: string | undefined;
639
+ windowBounds?: {
640
+ x?: number | undefined;
641
+ y?: number | undefined;
642
+ width?: number | undefined;
643
+ height?: number | undefined;
644
+ } | undefined;
645
+ trackingAgentId?: string | undefined;
646
+ }>;
647
+ defaultInstance?: string | undefined;
648
+ }, {
649
+ defaultInstance?: string | undefined;
650
+ instances?: Record<string, {
651
+ userDataDir: string;
652
+ platform?: "zhipin" | "yupao" | undefined;
653
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
654
+ headless?: boolean | undefined;
655
+ cdpUrl?: string | undefined;
656
+ cdpHost?: string | undefined;
657
+ cdpPort?: number | undefined;
658
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
659
+ executablePath?: string | undefined;
660
+ sessionsDir?: string | undefined;
661
+ args?: string[] | undefined;
662
+ profileName?: string | undefined;
663
+ profileColor?: string | undefined;
664
+ windowBounds?: {
665
+ x?: number | undefined;
666
+ y?: number | undefined;
667
+ width?: number | undefined;
668
+ height?: number | undefined;
669
+ } | undefined;
670
+ trackingAgentId?: string | undefined;
671
+ }> | undefined;
672
+ }>>;
111
673
  }, "strip", z.ZodTypeAny, {
112
674
  ask: {
113
675
  llmModel?: string | undefined;
114
676
  confirmThreshold?: number | undefined;
115
677
  };
678
+ browser: {
679
+ instances: Record<string, {
680
+ mode: "managed-cdp" | "remote-cdp" | "existing-session";
681
+ cdpHost: string;
682
+ channel: "chrome" | "chromium" | "msedge";
683
+ userDataDir: string;
684
+ platform?: "zhipin" | "yupao" | undefined;
685
+ headless?: boolean | undefined;
686
+ cdpUrl?: string | undefined;
687
+ cdpPort?: number | undefined;
688
+ executablePath?: string | undefined;
689
+ sessionsDir?: string | undefined;
690
+ args?: string[] | undefined;
691
+ profileName?: string | undefined;
692
+ profileColor?: string | undefined;
693
+ windowBounds?: {
694
+ x?: number | undefined;
695
+ y?: number | undefined;
696
+ width?: number | undefined;
697
+ height?: number | undefined;
698
+ } | undefined;
699
+ trackingAgentId?: string | undefined;
700
+ }>;
701
+ defaultInstance?: string | undefined;
702
+ };
116
703
  llm: {
117
704
  defaultProvider: string;
118
705
  defaultModel: string;
@@ -142,5 +729,31 @@ export declare const rollConfigSchema: z.ZodObject<{
142
729
  dataDir: string;
143
730
  env?: Record<string, Record<string, string>> | undefined;
144
731
  };
732
+ browser?: {
733
+ defaultInstance?: string | undefined;
734
+ instances?: Record<string, {
735
+ userDataDir: string;
736
+ platform?: "zhipin" | "yupao" | undefined;
737
+ mode?: "managed-cdp" | "remote-cdp" | "existing-session" | undefined;
738
+ headless?: boolean | undefined;
739
+ cdpUrl?: string | undefined;
740
+ cdpHost?: string | undefined;
741
+ cdpPort?: number | undefined;
742
+ channel?: "chrome" | "chromium" | "msedge" | undefined;
743
+ executablePath?: string | undefined;
744
+ sessionsDir?: string | undefined;
745
+ args?: string[] | undefined;
746
+ profileName?: string | undefined;
747
+ profileColor?: string | undefined;
748
+ windowBounds?: {
749
+ x?: number | undefined;
750
+ y?: number | undefined;
751
+ width?: number | undefined;
752
+ height?: number | undefined;
753
+ } | undefined;
754
+ trackingAgentId?: string | undefined;
755
+ }> | undefined;
756
+ } | undefined;
145
757
  }>;
146
758
  export type RollConfig = z.infer<typeof rollConfigSchema>;
759
+ 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"],s=e.string().trim().regex(/^#[\da-fA-F]{6}$/,"profileColor must be a hex RGB color such as #2563EB").transform(e=>e.toUpperCase());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(),profileColor:s.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.1",
3
+ "version": "0.9.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",