@google/gemini-cli-core 0.36.0-preview.3 → 0.36.0-preview.5

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.
@@ -3,66 +3,8 @@
3
3
  * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import { z } from 'zod';
6
7
  import { type AgentDefinition } from './types.js';
7
- /**
8
- * DTO for Markdown parsing - represents the structure from frontmatter.
9
- */
10
- interface FrontmatterBaseAgentDefinition {
11
- name: string;
12
- display_name?: string;
13
- }
14
- interface FrontmatterMCPServerConfig {
15
- command?: string;
16
- args?: string[];
17
- env?: Record<string, string>;
18
- cwd?: string;
19
- url?: string;
20
- http_url?: string;
21
- headers?: Record<string, string>;
22
- tcp?: string;
23
- type?: 'sse' | 'http';
24
- timeout?: number;
25
- trust?: boolean;
26
- description?: string;
27
- include_tools?: string[];
28
- exclude_tools?: string[];
29
- }
30
- interface FrontmatterLocalAgentDefinition extends FrontmatterBaseAgentDefinition {
31
- kind: 'local';
32
- description: string;
33
- tools?: string[];
34
- mcp_servers?: Record<string, FrontmatterMCPServerConfig>;
35
- system_prompt: string;
36
- model?: string;
37
- temperature?: number;
38
- max_turns?: number;
39
- timeout_mins?: number;
40
- }
41
- /**
42
- * Authentication configuration for remote agents in frontmatter format.
43
- */
44
- interface FrontmatterAuthConfig {
45
- type: 'apiKey' | 'http' | 'google-credentials' | 'oauth';
46
- key?: string;
47
- name?: string;
48
- scheme?: string;
49
- token?: string;
50
- username?: string;
51
- password?: string;
52
- value?: string;
53
- scopes?: string[];
54
- client_id?: string;
55
- client_secret?: string;
56
- authorization_url?: string;
57
- token_url?: string;
58
- }
59
- interface FrontmatterRemoteAgentDefinition extends FrontmatterBaseAgentDefinition {
60
- kind: 'remote';
61
- description?: string;
62
- agent_card_url: string;
63
- auth?: FrontmatterAuthConfig;
64
- }
65
- type FrontmatterAgentDefinition = FrontmatterLocalAgentDefinition | FrontmatterRemoteAgentDefinition;
66
8
  /**
67
9
  * Error thrown when an agent definition is invalid or cannot be loaded.
68
10
  */
@@ -77,6 +19,465 @@ export interface AgentLoadResult {
77
19
  agents: AgentDefinition[];
78
20
  errors: AgentLoadError[];
79
21
  }
22
+ declare const localAgentSchema: z.ZodObject<{
23
+ kind: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"local">>>;
24
+ name: z.ZodString;
25
+ description: z.ZodString;
26
+ display_name: z.ZodOptional<z.ZodString>;
27
+ tools: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
28
+ mcp_servers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
29
+ command: z.ZodOptional<z.ZodString>;
30
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
31
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
32
+ cwd: z.ZodOptional<z.ZodString>;
33
+ url: z.ZodOptional<z.ZodString>;
34
+ http_url: z.ZodOptional<z.ZodString>;
35
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
36
+ tcp: z.ZodOptional<z.ZodString>;
37
+ type: z.ZodOptional<z.ZodEnum<["sse", "http"]>>;
38
+ timeout: z.ZodOptional<z.ZodNumber>;
39
+ trust: z.ZodOptional<z.ZodBoolean>;
40
+ description: z.ZodOptional<z.ZodString>;
41
+ include_tools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
42
+ exclude_tools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
43
+ }, "strip", z.ZodTypeAny, {
44
+ args?: string[] | undefined;
45
+ env?: Record<string, string> | undefined;
46
+ cwd?: string | undefined;
47
+ type?: "http" | "sse" | undefined;
48
+ command?: string | undefined;
49
+ headers?: Record<string, string> | undefined;
50
+ url?: string | undefined;
51
+ description?: string | undefined;
52
+ timeout?: number | undefined;
53
+ trust?: boolean | undefined;
54
+ http_url?: string | undefined;
55
+ tcp?: string | undefined;
56
+ include_tools?: string[] | undefined;
57
+ exclude_tools?: string[] | undefined;
58
+ }, {
59
+ args?: string[] | undefined;
60
+ env?: Record<string, string> | undefined;
61
+ cwd?: string | undefined;
62
+ type?: "http" | "sse" | undefined;
63
+ command?: string | undefined;
64
+ headers?: Record<string, string> | undefined;
65
+ url?: string | undefined;
66
+ description?: string | undefined;
67
+ timeout?: number | undefined;
68
+ trust?: boolean | undefined;
69
+ http_url?: string | undefined;
70
+ tcp?: string | undefined;
71
+ include_tools?: string[] | undefined;
72
+ exclude_tools?: string[] | undefined;
73
+ }>>>;
74
+ model: z.ZodOptional<z.ZodString>;
75
+ temperature: z.ZodOptional<z.ZodNumber>;
76
+ max_turns: z.ZodOptional<z.ZodNumber>;
77
+ timeout_mins: z.ZodOptional<z.ZodNumber>;
78
+ }, "strict", z.ZodTypeAny, {
79
+ name: string;
80
+ description: string;
81
+ kind: "local";
82
+ model?: string | undefined;
83
+ tools?: string[] | undefined;
84
+ temperature?: number | undefined;
85
+ mcp_servers?: Record<string, {
86
+ args?: string[] | undefined;
87
+ env?: Record<string, string> | undefined;
88
+ cwd?: string | undefined;
89
+ type?: "http" | "sse" | undefined;
90
+ command?: string | undefined;
91
+ headers?: Record<string, string> | undefined;
92
+ url?: string | undefined;
93
+ description?: string | undefined;
94
+ timeout?: number | undefined;
95
+ trust?: boolean | undefined;
96
+ http_url?: string | undefined;
97
+ tcp?: string | undefined;
98
+ include_tools?: string[] | undefined;
99
+ exclude_tools?: string[] | undefined;
100
+ }> | undefined;
101
+ display_name?: string | undefined;
102
+ max_turns?: number | undefined;
103
+ timeout_mins?: number | undefined;
104
+ }, {
105
+ name: string;
106
+ description: string;
107
+ model?: string | undefined;
108
+ tools?: string[] | undefined;
109
+ kind?: "local" | undefined;
110
+ temperature?: number | undefined;
111
+ mcp_servers?: Record<string, {
112
+ args?: string[] | undefined;
113
+ env?: Record<string, string> | undefined;
114
+ cwd?: string | undefined;
115
+ type?: "http" | "sse" | undefined;
116
+ command?: string | undefined;
117
+ headers?: Record<string, string> | undefined;
118
+ url?: string | undefined;
119
+ description?: string | undefined;
120
+ timeout?: number | undefined;
121
+ trust?: boolean | undefined;
122
+ http_url?: string | undefined;
123
+ tcp?: string | undefined;
124
+ include_tools?: string[] | undefined;
125
+ exclude_tools?: string[] | undefined;
126
+ }> | undefined;
127
+ display_name?: string | undefined;
128
+ max_turns?: number | undefined;
129
+ timeout_mins?: number | undefined;
130
+ }>;
131
+ type FrontmatterLocalAgentDefinition = z.infer<typeof localAgentSchema> & {
132
+ system_prompt: string;
133
+ };
134
+ declare const remoteAgentSchema: z.ZodUnion<[z.ZodObject<{
135
+ kind: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"remote">>>;
136
+ name: z.ZodString;
137
+ description: z.ZodOptional<z.ZodString>;
138
+ display_name: z.ZodOptional<z.ZodString>;
139
+ auth: z.ZodOptional<z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
140
+ type: z.ZodLiteral<"apiKey">;
141
+ key: z.ZodString;
142
+ name: z.ZodOptional<z.ZodString>;
143
+ }, "strip", z.ZodTypeAny, {
144
+ type: "apiKey";
145
+ key: string;
146
+ name?: string | undefined;
147
+ }, {
148
+ type: "apiKey";
149
+ key: string;
150
+ name?: string | undefined;
151
+ }>, z.ZodObject<{
152
+ type: z.ZodLiteral<"http">;
153
+ scheme: z.ZodString;
154
+ token: z.ZodOptional<z.ZodString>;
155
+ username: z.ZodOptional<z.ZodString>;
156
+ password: z.ZodOptional<z.ZodString>;
157
+ value: z.ZodOptional<z.ZodString>;
158
+ }, "strip", z.ZodTypeAny, {
159
+ type: "http";
160
+ scheme: string;
161
+ value?: string | undefined;
162
+ token?: string | undefined;
163
+ password?: string | undefined;
164
+ username?: string | undefined;
165
+ }, {
166
+ type: "http";
167
+ scheme: string;
168
+ value?: string | undefined;
169
+ token?: string | undefined;
170
+ password?: string | undefined;
171
+ username?: string | undefined;
172
+ }>, z.ZodObject<{
173
+ type: z.ZodLiteral<"google-credentials">;
174
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
175
+ }, "strip", z.ZodTypeAny, {
176
+ type: "google-credentials";
177
+ scopes?: string[] | undefined;
178
+ }, {
179
+ type: "google-credentials";
180
+ scopes?: string[] | undefined;
181
+ }>, z.ZodObject<{
182
+ type: z.ZodLiteral<"oauth">;
183
+ client_id: z.ZodOptional<z.ZodString>;
184
+ client_secret: z.ZodOptional<z.ZodString>;
185
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
186
+ authorization_url: z.ZodOptional<z.ZodString>;
187
+ token_url: z.ZodOptional<z.ZodString>;
188
+ }, "strip", z.ZodTypeAny, {
189
+ type: "oauth";
190
+ scopes?: string[] | undefined;
191
+ client_id?: string | undefined;
192
+ client_secret?: string | undefined;
193
+ token_url?: string | undefined;
194
+ authorization_url?: string | undefined;
195
+ }, {
196
+ type: "oauth";
197
+ scopes?: string[] | undefined;
198
+ client_id?: string | undefined;
199
+ client_secret?: string | undefined;
200
+ token_url?: string | undefined;
201
+ authorization_url?: string | undefined;
202
+ }>]>, {
203
+ type: "apiKey";
204
+ key: string;
205
+ name?: string | undefined;
206
+ } | {
207
+ type: "http";
208
+ scheme: string;
209
+ value?: string | undefined;
210
+ token?: string | undefined;
211
+ password?: string | undefined;
212
+ username?: string | undefined;
213
+ } | {
214
+ type: "google-credentials";
215
+ scopes?: string[] | undefined;
216
+ } | {
217
+ type: "oauth";
218
+ scopes?: string[] | undefined;
219
+ client_id?: string | undefined;
220
+ client_secret?: string | undefined;
221
+ token_url?: string | undefined;
222
+ authorization_url?: string | undefined;
223
+ }, {
224
+ type: "apiKey";
225
+ key: string;
226
+ name?: string | undefined;
227
+ } | {
228
+ type: "http";
229
+ scheme: string;
230
+ value?: string | undefined;
231
+ token?: string | undefined;
232
+ password?: string | undefined;
233
+ username?: string | undefined;
234
+ } | {
235
+ type: "google-credentials";
236
+ scopes?: string[] | undefined;
237
+ } | {
238
+ type: "oauth";
239
+ scopes?: string[] | undefined;
240
+ client_id?: string | undefined;
241
+ client_secret?: string | undefined;
242
+ token_url?: string | undefined;
243
+ authorization_url?: string | undefined;
244
+ }>>;
245
+ } & {
246
+ agent_card_url: z.ZodString;
247
+ agent_card_json: z.ZodOptional<z.ZodUndefined>;
248
+ }, "strict", z.ZodTypeAny, {
249
+ name: string;
250
+ kind: "remote";
251
+ agent_card_url: string;
252
+ auth?: {
253
+ type: "apiKey";
254
+ key: string;
255
+ name?: string | undefined;
256
+ } | {
257
+ type: "http";
258
+ scheme: string;
259
+ value?: string | undefined;
260
+ token?: string | undefined;
261
+ password?: string | undefined;
262
+ username?: string | undefined;
263
+ } | {
264
+ type: "google-credentials";
265
+ scopes?: string[] | undefined;
266
+ } | {
267
+ type: "oauth";
268
+ scopes?: string[] | undefined;
269
+ client_id?: string | undefined;
270
+ client_secret?: string | undefined;
271
+ token_url?: string | undefined;
272
+ authorization_url?: string | undefined;
273
+ } | undefined;
274
+ description?: string | undefined;
275
+ display_name?: string | undefined;
276
+ agent_card_json?: undefined;
277
+ }, {
278
+ name: string;
279
+ agent_card_url: string;
280
+ auth?: {
281
+ type: "apiKey";
282
+ key: string;
283
+ name?: string | undefined;
284
+ } | {
285
+ type: "http";
286
+ scheme: string;
287
+ value?: string | undefined;
288
+ token?: string | undefined;
289
+ password?: string | undefined;
290
+ username?: string | undefined;
291
+ } | {
292
+ type: "google-credentials";
293
+ scopes?: string[] | undefined;
294
+ } | {
295
+ type: "oauth";
296
+ scopes?: string[] | undefined;
297
+ client_id?: string | undefined;
298
+ client_secret?: string | undefined;
299
+ token_url?: string | undefined;
300
+ authorization_url?: string | undefined;
301
+ } | undefined;
302
+ description?: string | undefined;
303
+ kind?: "remote" | undefined;
304
+ display_name?: string | undefined;
305
+ agent_card_json?: undefined;
306
+ }>, z.ZodObject<{
307
+ kind: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"remote">>>;
308
+ name: z.ZodString;
309
+ description: z.ZodOptional<z.ZodString>;
310
+ display_name: z.ZodOptional<z.ZodString>;
311
+ auth: z.ZodOptional<z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
312
+ type: z.ZodLiteral<"apiKey">;
313
+ key: z.ZodString;
314
+ name: z.ZodOptional<z.ZodString>;
315
+ }, "strip", z.ZodTypeAny, {
316
+ type: "apiKey";
317
+ key: string;
318
+ name?: string | undefined;
319
+ }, {
320
+ type: "apiKey";
321
+ key: string;
322
+ name?: string | undefined;
323
+ }>, z.ZodObject<{
324
+ type: z.ZodLiteral<"http">;
325
+ scheme: z.ZodString;
326
+ token: z.ZodOptional<z.ZodString>;
327
+ username: z.ZodOptional<z.ZodString>;
328
+ password: z.ZodOptional<z.ZodString>;
329
+ value: z.ZodOptional<z.ZodString>;
330
+ }, "strip", z.ZodTypeAny, {
331
+ type: "http";
332
+ scheme: string;
333
+ value?: string | undefined;
334
+ token?: string | undefined;
335
+ password?: string | undefined;
336
+ username?: string | undefined;
337
+ }, {
338
+ type: "http";
339
+ scheme: string;
340
+ value?: string | undefined;
341
+ token?: string | undefined;
342
+ password?: string | undefined;
343
+ username?: string | undefined;
344
+ }>, z.ZodObject<{
345
+ type: z.ZodLiteral<"google-credentials">;
346
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
347
+ }, "strip", z.ZodTypeAny, {
348
+ type: "google-credentials";
349
+ scopes?: string[] | undefined;
350
+ }, {
351
+ type: "google-credentials";
352
+ scopes?: string[] | undefined;
353
+ }>, z.ZodObject<{
354
+ type: z.ZodLiteral<"oauth">;
355
+ client_id: z.ZodOptional<z.ZodString>;
356
+ client_secret: z.ZodOptional<z.ZodString>;
357
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
358
+ authorization_url: z.ZodOptional<z.ZodString>;
359
+ token_url: z.ZodOptional<z.ZodString>;
360
+ }, "strip", z.ZodTypeAny, {
361
+ type: "oauth";
362
+ scopes?: string[] | undefined;
363
+ client_id?: string | undefined;
364
+ client_secret?: string | undefined;
365
+ token_url?: string | undefined;
366
+ authorization_url?: string | undefined;
367
+ }, {
368
+ type: "oauth";
369
+ scopes?: string[] | undefined;
370
+ client_id?: string | undefined;
371
+ client_secret?: string | undefined;
372
+ token_url?: string | undefined;
373
+ authorization_url?: string | undefined;
374
+ }>]>, {
375
+ type: "apiKey";
376
+ key: string;
377
+ name?: string | undefined;
378
+ } | {
379
+ type: "http";
380
+ scheme: string;
381
+ value?: string | undefined;
382
+ token?: string | undefined;
383
+ password?: string | undefined;
384
+ username?: string | undefined;
385
+ } | {
386
+ type: "google-credentials";
387
+ scopes?: string[] | undefined;
388
+ } | {
389
+ type: "oauth";
390
+ scopes?: string[] | undefined;
391
+ client_id?: string | undefined;
392
+ client_secret?: string | undefined;
393
+ token_url?: string | undefined;
394
+ authorization_url?: string | undefined;
395
+ }, {
396
+ type: "apiKey";
397
+ key: string;
398
+ name?: string | undefined;
399
+ } | {
400
+ type: "http";
401
+ scheme: string;
402
+ value?: string | undefined;
403
+ token?: string | undefined;
404
+ password?: string | undefined;
405
+ username?: string | undefined;
406
+ } | {
407
+ type: "google-credentials";
408
+ scopes?: string[] | undefined;
409
+ } | {
410
+ type: "oauth";
411
+ scopes?: string[] | undefined;
412
+ client_id?: string | undefined;
413
+ client_secret?: string | undefined;
414
+ token_url?: string | undefined;
415
+ authorization_url?: string | undefined;
416
+ }>>;
417
+ } & {
418
+ agent_card_url: z.ZodOptional<z.ZodUndefined>;
419
+ agent_card_json: z.ZodEffects<z.ZodString, string, string>;
420
+ }, "strict", z.ZodTypeAny, {
421
+ name: string;
422
+ kind: "remote";
423
+ agent_card_json: string;
424
+ auth?: {
425
+ type: "apiKey";
426
+ key: string;
427
+ name?: string | undefined;
428
+ } | {
429
+ type: "http";
430
+ scheme: string;
431
+ value?: string | undefined;
432
+ token?: string | undefined;
433
+ password?: string | undefined;
434
+ username?: string | undefined;
435
+ } | {
436
+ type: "google-credentials";
437
+ scopes?: string[] | undefined;
438
+ } | {
439
+ type: "oauth";
440
+ scopes?: string[] | undefined;
441
+ client_id?: string | undefined;
442
+ client_secret?: string | undefined;
443
+ token_url?: string | undefined;
444
+ authorization_url?: string | undefined;
445
+ } | undefined;
446
+ description?: string | undefined;
447
+ display_name?: string | undefined;
448
+ agent_card_url?: undefined;
449
+ }, {
450
+ name: string;
451
+ agent_card_json: string;
452
+ auth?: {
453
+ type: "apiKey";
454
+ key: string;
455
+ name?: string | undefined;
456
+ } | {
457
+ type: "http";
458
+ scheme: string;
459
+ value?: string | undefined;
460
+ token?: string | undefined;
461
+ password?: string | undefined;
462
+ username?: string | undefined;
463
+ } | {
464
+ type: "google-credentials";
465
+ scopes?: string[] | undefined;
466
+ } | {
467
+ type: "oauth";
468
+ scopes?: string[] | undefined;
469
+ client_id?: string | undefined;
470
+ client_secret?: string | undefined;
471
+ token_url?: string | undefined;
472
+ authorization_url?: string | undefined;
473
+ } | undefined;
474
+ description?: string | undefined;
475
+ kind?: "remote" | undefined;
476
+ display_name?: string | undefined;
477
+ agent_card_url?: undefined;
478
+ }>]>;
479
+ type FrontmatterRemoteAgentDefinition = z.infer<typeof remoteAgentSchema>;
480
+ type FrontmatterAgentDefinition = FrontmatterLocalAgentDefinition | FrontmatterRemoteAgentDefinition;
80
481
  /**
81
482
  * Parses and validates an agent Markdown file with frontmatter.
82
483
  *