@agents-txt/core 0.1.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.
@@ -0,0 +1,681 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * agents.txt — Core Type System
5
+ *
6
+ * These types define the complete agents.txt document structure.
7
+ * A document declares what AI agents can DO on a website.
8
+ */
9
+ type DeclarationType = "platform" | "agent";
10
+ interface AgentsTxtDocument {
11
+ /** Spec version (semver). Currently "1.0". */
12
+ specVersion: string;
13
+ /** ISO 8601 timestamp of when this file was generated. */
14
+ generatedAt?: string;
15
+ /** Declaration type: "platform" (what agents can do here) or "agent" (what my agent does elsewhere). */
16
+ declarationType?: DeclarationType;
17
+ /** URLs of platforms this agent operates on (only for declarationType: "agent"). */
18
+ operatesOn?: string[];
19
+ /** Site identity and metadata. */
20
+ site: SiteInfo;
21
+ /** Capabilities the site offers to AI agents (platform), or capabilities the agent uses (agent). */
22
+ capabilities: Capability[];
23
+ /** Path-based access control. */
24
+ access: AccessControl;
25
+ /** Per-agent policies (keyed by agent name, "*" = default). */
26
+ agents: Record<string, AgentPolicy>;
27
+ /** Optional free-form metadata. */
28
+ metadata?: Record<string, string>;
29
+ }
30
+ interface SiteInfo {
31
+ /** Human-readable site name. */
32
+ name: string;
33
+ /** Canonical site URL (must be HTTPS). */
34
+ url: string;
35
+ /** Brief description of the site. */
36
+ description?: string;
37
+ /** Contact email for AI agent partnerships/issues. */
38
+ contact?: string;
39
+ /** URL to the site's privacy policy. */
40
+ privacyPolicy?: string;
41
+ }
42
+ interface Capability {
43
+ /** Unique identifier (lowercase, hyphens, e.g. "product-search"). */
44
+ id: string;
45
+ /** Human-readable description of what this capability does. */
46
+ description: string;
47
+ /** Full URL of the endpoint. */
48
+ endpoint: string;
49
+ /** HTTP method (for REST). */
50
+ method?: string;
51
+ /** Communication protocol. */
52
+ protocol: Protocol;
53
+ /** Authentication configuration (describes mechanism, never secrets). */
54
+ auth?: AuthConfig;
55
+ /** Rate limit for this specific capability. */
56
+ rateLimit?: RateLimit;
57
+ /** URL to an OpenAPI spec for this capability. */
58
+ openapi?: string;
59
+ /** Parameter definitions for REST endpoints. */
60
+ parameters?: ParameterDef[];
61
+ /** Required OAuth2 scopes. */
62
+ scopes?: string[];
63
+ }
64
+ type Protocol = "REST" | "MCP" | "A2A" | "GraphQL" | "WebSocket";
65
+ interface AuthConfig {
66
+ /** Authentication type. Never include actual secrets. */
67
+ type: AuthType;
68
+ /** URL to obtain tokens (for bearer-token or oauth2). */
69
+ tokenEndpoint?: string;
70
+ /** URL to documentation describing the authentication flow. */
71
+ docsUrl?: string;
72
+ /** OAuth2 scopes available. */
73
+ scopes?: string[];
74
+ }
75
+ type AuthType = "none" | "api-key" | "bearer-token" | "oauth2" | "hmac";
76
+ interface RateLimit {
77
+ /** Number of allowed requests per window. */
78
+ requests: number;
79
+ /** Time window. */
80
+ window: RateLimitWindow;
81
+ }
82
+ type RateLimitWindow = "second" | "minute" | "hour" | "day";
83
+ interface AccessControl {
84
+ /** Glob patterns of allowed paths. */
85
+ allow: string[];
86
+ /** Glob patterns of disallowed paths. */
87
+ disallow: string[];
88
+ }
89
+ interface AgentPolicy {
90
+ /** Override rate limit for this agent. */
91
+ rateLimit?: RateLimit;
92
+ /** List of capability IDs this agent is allowed to use. If omitted, all capabilities are allowed. */
93
+ capabilities?: string[];
94
+ /** URL to the agent operator's agents.txt declaration. */
95
+ agentDeclaration?: string;
96
+ }
97
+ interface ParameterDef {
98
+ /** Parameter name. */
99
+ name: string;
100
+ /** Where the parameter is sent. */
101
+ in: "query" | "path" | "header" | "body";
102
+ /** Data type. */
103
+ type: string;
104
+ /** Whether the parameter is required. */
105
+ required?: boolean;
106
+ /** Default value. */
107
+ default?: unknown;
108
+ /** Human-readable description. */
109
+ description?: string;
110
+ /** Maximum value (for numbers) or length (for strings). */
111
+ max?: number;
112
+ /** Minimum value (for numbers) or length (for strings). */
113
+ min?: number;
114
+ }
115
+ interface ParseResult {
116
+ success: boolean;
117
+ document?: AgentsTxtDocument;
118
+ errors: ParseError[];
119
+ warnings: ParseWarning[];
120
+ }
121
+ interface ParseError {
122
+ line?: number;
123
+ field?: string;
124
+ message: string;
125
+ }
126
+ interface ParseWarning {
127
+ line?: number;
128
+ field?: string;
129
+ message: string;
130
+ }
131
+ interface ValidationResult {
132
+ valid: boolean;
133
+ errors: ValidationError[];
134
+ warnings: ValidationWarning[];
135
+ }
136
+ interface ValidationError {
137
+ path: string;
138
+ message: string;
139
+ code: string;
140
+ }
141
+ interface ValidationWarning {
142
+ path: string;
143
+ message: string;
144
+ code: string;
145
+ }
146
+
147
+ /**
148
+ * Parse an agents.txt text document into a structured AgentsTxtDocument.
149
+ */
150
+ declare function parse(input: string): ParseResult;
151
+
152
+ /**
153
+ * Parse an agents.json string into a validated AgentsTxtDocument.
154
+ */
155
+ declare function parseJSON(input: string): ParseResult;
156
+
157
+ /**
158
+ * Generate agents.txt text format from a document object.
159
+ */
160
+ declare function generate(doc: AgentsTxtDocument): string;
161
+
162
+ /**
163
+ * Generate agents.json from a document object.
164
+ */
165
+ declare function generateJSON(doc: AgentsTxtDocument): string;
166
+
167
+ /**
168
+ * Validate an AgentsTxtDocument object against the spec.
169
+ */
170
+ declare function validate(doc: AgentsTxtDocument): ValidationResult;
171
+ /**
172
+ * Parse and validate an agents.txt text string.
173
+ */
174
+ declare function validateText(text: string): ValidationResult;
175
+ /**
176
+ * Parse and validate an agents.json string.
177
+ */
178
+ declare function validateJSON(json: string): ValidationResult;
179
+
180
+ interface ClientOptions {
181
+ /** Request timeout in ms. Default: 10000. */
182
+ timeout?: number;
183
+ /** User-Agent header. Default: "agents-txt-client/0.1". */
184
+ userAgent?: string;
185
+ }
186
+ /**
187
+ * Client for discovering and fetching agents.txt from websites.
188
+ */
189
+ declare class AgentsTxtClient {
190
+ private timeout;
191
+ private userAgent;
192
+ constructor(options?: ClientOptions);
193
+ /**
194
+ * Discover agents.txt from a site. Tries /.well-known/agents.txt first,
195
+ * falls back to /agents.txt.
196
+ */
197
+ discover(baseUrl: string): Promise<ParseResult>;
198
+ /**
199
+ * Discover agents.json from a site. Tries /.well-known/agents.json first,
200
+ * falls back to /agents.json.
201
+ */
202
+ discoverJSON(baseUrl: string): Promise<ParseResult>;
203
+ private fetchText;
204
+ }
205
+
206
+ declare const RateLimitSchema: z.ZodObject<{
207
+ requests: z.ZodNumber;
208
+ window: z.ZodEnum<["second", "minute", "hour", "day"]>;
209
+ }, "strip", z.ZodTypeAny, {
210
+ requests: number;
211
+ window: "second" | "minute" | "hour" | "day";
212
+ }, {
213
+ requests: number;
214
+ window: "second" | "minute" | "hour" | "day";
215
+ }>;
216
+ declare const AuthConfigSchema: z.ZodObject<{
217
+ type: z.ZodEnum<["none", "api-key", "bearer-token", "oauth2", "hmac"]>;
218
+ tokenEndpoint: z.ZodOptional<z.ZodString>;
219
+ docsUrl: z.ZodOptional<z.ZodString>;
220
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
221
+ }, "strip", z.ZodTypeAny, {
222
+ type: "none" | "api-key" | "bearer-token" | "oauth2" | "hmac";
223
+ scopes?: string[] | undefined;
224
+ tokenEndpoint?: string | undefined;
225
+ docsUrl?: string | undefined;
226
+ }, {
227
+ type: "none" | "api-key" | "bearer-token" | "oauth2" | "hmac";
228
+ scopes?: string[] | undefined;
229
+ tokenEndpoint?: string | undefined;
230
+ docsUrl?: string | undefined;
231
+ }>;
232
+ declare const ProtocolSchema: z.ZodEnum<["REST", "MCP", "A2A", "GraphQL", "WebSocket"]>;
233
+ declare const CapabilitySchema: z.ZodObject<{
234
+ id: z.ZodString;
235
+ description: z.ZodString;
236
+ endpoint: z.ZodString;
237
+ method: z.ZodOptional<z.ZodString>;
238
+ protocol: z.ZodEnum<["REST", "MCP", "A2A", "GraphQL", "WebSocket"]>;
239
+ auth: z.ZodOptional<z.ZodObject<{
240
+ type: z.ZodEnum<["none", "api-key", "bearer-token", "oauth2", "hmac"]>;
241
+ tokenEndpoint: z.ZodOptional<z.ZodString>;
242
+ docsUrl: z.ZodOptional<z.ZodString>;
243
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
244
+ }, "strip", z.ZodTypeAny, {
245
+ type: "none" | "api-key" | "bearer-token" | "oauth2" | "hmac";
246
+ scopes?: string[] | undefined;
247
+ tokenEndpoint?: string | undefined;
248
+ docsUrl?: string | undefined;
249
+ }, {
250
+ type: "none" | "api-key" | "bearer-token" | "oauth2" | "hmac";
251
+ scopes?: string[] | undefined;
252
+ tokenEndpoint?: string | undefined;
253
+ docsUrl?: string | undefined;
254
+ }>>;
255
+ rateLimit: z.ZodOptional<z.ZodObject<{
256
+ requests: z.ZodNumber;
257
+ window: z.ZodEnum<["second", "minute", "hour", "day"]>;
258
+ }, "strip", z.ZodTypeAny, {
259
+ requests: number;
260
+ window: "second" | "minute" | "hour" | "day";
261
+ }, {
262
+ requests: number;
263
+ window: "second" | "minute" | "hour" | "day";
264
+ }>>;
265
+ openapi: z.ZodOptional<z.ZodString>;
266
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
267
+ name: z.ZodString;
268
+ in: z.ZodEnum<["query", "path", "header", "body"]>;
269
+ type: z.ZodString;
270
+ required: z.ZodOptional<z.ZodBoolean>;
271
+ default: z.ZodOptional<z.ZodUnknown>;
272
+ description: z.ZodOptional<z.ZodString>;
273
+ max: z.ZodOptional<z.ZodNumber>;
274
+ min: z.ZodOptional<z.ZodNumber>;
275
+ }, "strip", z.ZodTypeAny, {
276
+ type: string;
277
+ name: string;
278
+ in: "query" | "path" | "header" | "body";
279
+ description?: string | undefined;
280
+ required?: boolean | undefined;
281
+ default?: unknown;
282
+ max?: number | undefined;
283
+ min?: number | undefined;
284
+ }, {
285
+ type: string;
286
+ name: string;
287
+ in: "query" | "path" | "header" | "body";
288
+ description?: string | undefined;
289
+ required?: boolean | undefined;
290
+ default?: unknown;
291
+ max?: number | undefined;
292
+ min?: number | undefined;
293
+ }>, "many">>;
294
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
295
+ }, "strip", z.ZodTypeAny, {
296
+ id: string;
297
+ description: string;
298
+ endpoint: string;
299
+ protocol: "REST" | "MCP" | "A2A" | "GraphQL" | "WebSocket";
300
+ method?: string | undefined;
301
+ auth?: {
302
+ type: "none" | "api-key" | "bearer-token" | "oauth2" | "hmac";
303
+ scopes?: string[] | undefined;
304
+ tokenEndpoint?: string | undefined;
305
+ docsUrl?: string | undefined;
306
+ } | undefined;
307
+ rateLimit?: {
308
+ requests: number;
309
+ window: "second" | "minute" | "hour" | "day";
310
+ } | undefined;
311
+ openapi?: string | undefined;
312
+ parameters?: {
313
+ type: string;
314
+ name: string;
315
+ in: "query" | "path" | "header" | "body";
316
+ description?: string | undefined;
317
+ required?: boolean | undefined;
318
+ default?: unknown;
319
+ max?: number | undefined;
320
+ min?: number | undefined;
321
+ }[] | undefined;
322
+ scopes?: string[] | undefined;
323
+ }, {
324
+ id: string;
325
+ description: string;
326
+ endpoint: string;
327
+ protocol: "REST" | "MCP" | "A2A" | "GraphQL" | "WebSocket";
328
+ method?: string | undefined;
329
+ auth?: {
330
+ type: "none" | "api-key" | "bearer-token" | "oauth2" | "hmac";
331
+ scopes?: string[] | undefined;
332
+ tokenEndpoint?: string | undefined;
333
+ docsUrl?: string | undefined;
334
+ } | undefined;
335
+ rateLimit?: {
336
+ requests: number;
337
+ window: "second" | "minute" | "hour" | "day";
338
+ } | undefined;
339
+ openapi?: string | undefined;
340
+ parameters?: {
341
+ type: string;
342
+ name: string;
343
+ in: "query" | "path" | "header" | "body";
344
+ description?: string | undefined;
345
+ required?: boolean | undefined;
346
+ default?: unknown;
347
+ max?: number | undefined;
348
+ min?: number | undefined;
349
+ }[] | undefined;
350
+ scopes?: string[] | undefined;
351
+ }>;
352
+ declare const SiteInfoSchema: z.ZodObject<{
353
+ name: z.ZodString;
354
+ url: z.ZodString;
355
+ description: z.ZodOptional<z.ZodString>;
356
+ contact: z.ZodOptional<z.ZodString>;
357
+ privacyPolicy: z.ZodOptional<z.ZodString>;
358
+ }, "strip", z.ZodTypeAny, {
359
+ name: string;
360
+ url: string;
361
+ description?: string | undefined;
362
+ contact?: string | undefined;
363
+ privacyPolicy?: string | undefined;
364
+ }, {
365
+ name: string;
366
+ url: string;
367
+ description?: string | undefined;
368
+ contact?: string | undefined;
369
+ privacyPolicy?: string | undefined;
370
+ }>;
371
+ declare const DeclarationTypeSchema: z.ZodEnum<["platform", "agent"]>;
372
+ declare const AgentsTxtDocumentSchema: z.ZodObject<{
373
+ specVersion: z.ZodString;
374
+ generatedAt: z.ZodOptional<z.ZodString>;
375
+ declarationType: z.ZodOptional<z.ZodEnum<["platform", "agent"]>>;
376
+ operatesOn: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
377
+ site: z.ZodObject<{
378
+ name: z.ZodString;
379
+ url: z.ZodString;
380
+ description: z.ZodOptional<z.ZodString>;
381
+ contact: z.ZodOptional<z.ZodString>;
382
+ privacyPolicy: z.ZodOptional<z.ZodString>;
383
+ }, "strip", z.ZodTypeAny, {
384
+ name: string;
385
+ url: string;
386
+ description?: string | undefined;
387
+ contact?: string | undefined;
388
+ privacyPolicy?: string | undefined;
389
+ }, {
390
+ name: string;
391
+ url: string;
392
+ description?: string | undefined;
393
+ contact?: string | undefined;
394
+ privacyPolicy?: string | undefined;
395
+ }>;
396
+ capabilities: z.ZodArray<z.ZodObject<{
397
+ id: z.ZodString;
398
+ description: z.ZodString;
399
+ endpoint: z.ZodString;
400
+ method: z.ZodOptional<z.ZodString>;
401
+ protocol: z.ZodEnum<["REST", "MCP", "A2A", "GraphQL", "WebSocket"]>;
402
+ auth: z.ZodOptional<z.ZodObject<{
403
+ type: z.ZodEnum<["none", "api-key", "bearer-token", "oauth2", "hmac"]>;
404
+ tokenEndpoint: z.ZodOptional<z.ZodString>;
405
+ docsUrl: z.ZodOptional<z.ZodString>;
406
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
407
+ }, "strip", z.ZodTypeAny, {
408
+ type: "none" | "api-key" | "bearer-token" | "oauth2" | "hmac";
409
+ scopes?: string[] | undefined;
410
+ tokenEndpoint?: string | undefined;
411
+ docsUrl?: string | undefined;
412
+ }, {
413
+ type: "none" | "api-key" | "bearer-token" | "oauth2" | "hmac";
414
+ scopes?: string[] | undefined;
415
+ tokenEndpoint?: string | undefined;
416
+ docsUrl?: string | undefined;
417
+ }>>;
418
+ rateLimit: z.ZodOptional<z.ZodObject<{
419
+ requests: z.ZodNumber;
420
+ window: z.ZodEnum<["second", "minute", "hour", "day"]>;
421
+ }, "strip", z.ZodTypeAny, {
422
+ requests: number;
423
+ window: "second" | "minute" | "hour" | "day";
424
+ }, {
425
+ requests: number;
426
+ window: "second" | "minute" | "hour" | "day";
427
+ }>>;
428
+ openapi: z.ZodOptional<z.ZodString>;
429
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
430
+ name: z.ZodString;
431
+ in: z.ZodEnum<["query", "path", "header", "body"]>;
432
+ type: z.ZodString;
433
+ required: z.ZodOptional<z.ZodBoolean>;
434
+ default: z.ZodOptional<z.ZodUnknown>;
435
+ description: z.ZodOptional<z.ZodString>;
436
+ max: z.ZodOptional<z.ZodNumber>;
437
+ min: z.ZodOptional<z.ZodNumber>;
438
+ }, "strip", z.ZodTypeAny, {
439
+ type: string;
440
+ name: string;
441
+ in: "query" | "path" | "header" | "body";
442
+ description?: string | undefined;
443
+ required?: boolean | undefined;
444
+ default?: unknown;
445
+ max?: number | undefined;
446
+ min?: number | undefined;
447
+ }, {
448
+ type: string;
449
+ name: string;
450
+ in: "query" | "path" | "header" | "body";
451
+ description?: string | undefined;
452
+ required?: boolean | undefined;
453
+ default?: unknown;
454
+ max?: number | undefined;
455
+ min?: number | undefined;
456
+ }>, "many">>;
457
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
458
+ }, "strip", z.ZodTypeAny, {
459
+ id: string;
460
+ description: string;
461
+ endpoint: string;
462
+ protocol: "REST" | "MCP" | "A2A" | "GraphQL" | "WebSocket";
463
+ method?: string | undefined;
464
+ auth?: {
465
+ type: "none" | "api-key" | "bearer-token" | "oauth2" | "hmac";
466
+ scopes?: string[] | undefined;
467
+ tokenEndpoint?: string | undefined;
468
+ docsUrl?: string | undefined;
469
+ } | undefined;
470
+ rateLimit?: {
471
+ requests: number;
472
+ window: "second" | "minute" | "hour" | "day";
473
+ } | undefined;
474
+ openapi?: string | undefined;
475
+ parameters?: {
476
+ type: string;
477
+ name: string;
478
+ in: "query" | "path" | "header" | "body";
479
+ description?: string | undefined;
480
+ required?: boolean | undefined;
481
+ default?: unknown;
482
+ max?: number | undefined;
483
+ min?: number | undefined;
484
+ }[] | undefined;
485
+ scopes?: string[] | undefined;
486
+ }, {
487
+ id: string;
488
+ description: string;
489
+ endpoint: string;
490
+ protocol: "REST" | "MCP" | "A2A" | "GraphQL" | "WebSocket";
491
+ method?: string | undefined;
492
+ auth?: {
493
+ type: "none" | "api-key" | "bearer-token" | "oauth2" | "hmac";
494
+ scopes?: string[] | undefined;
495
+ tokenEndpoint?: string | undefined;
496
+ docsUrl?: string | undefined;
497
+ } | undefined;
498
+ rateLimit?: {
499
+ requests: number;
500
+ window: "second" | "minute" | "hour" | "day";
501
+ } | undefined;
502
+ openapi?: string | undefined;
503
+ parameters?: {
504
+ type: string;
505
+ name: string;
506
+ in: "query" | "path" | "header" | "body";
507
+ description?: string | undefined;
508
+ required?: boolean | undefined;
509
+ default?: unknown;
510
+ max?: number | undefined;
511
+ min?: number | undefined;
512
+ }[] | undefined;
513
+ scopes?: string[] | undefined;
514
+ }>, "many">;
515
+ access: z.ZodObject<{
516
+ allow: z.ZodArray<z.ZodString, "many">;
517
+ disallow: z.ZodArray<z.ZodString, "many">;
518
+ }, "strip", z.ZodTypeAny, {
519
+ allow: string[];
520
+ disallow: string[];
521
+ }, {
522
+ allow: string[];
523
+ disallow: string[];
524
+ }>;
525
+ agents: z.ZodRecord<z.ZodString, z.ZodObject<{
526
+ rateLimit: z.ZodOptional<z.ZodObject<{
527
+ requests: z.ZodNumber;
528
+ window: z.ZodEnum<["second", "minute", "hour", "day"]>;
529
+ }, "strip", z.ZodTypeAny, {
530
+ requests: number;
531
+ window: "second" | "minute" | "hour" | "day";
532
+ }, {
533
+ requests: number;
534
+ window: "second" | "minute" | "hour" | "day";
535
+ }>>;
536
+ capabilities: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
537
+ agentDeclaration: z.ZodOptional<z.ZodString>;
538
+ }, "strip", z.ZodTypeAny, {
539
+ rateLimit?: {
540
+ requests: number;
541
+ window: "second" | "minute" | "hour" | "day";
542
+ } | undefined;
543
+ capabilities?: string[] | undefined;
544
+ agentDeclaration?: string | undefined;
545
+ }, {
546
+ rateLimit?: {
547
+ requests: number;
548
+ window: "second" | "minute" | "hour" | "day";
549
+ } | undefined;
550
+ capabilities?: string[] | undefined;
551
+ agentDeclaration?: string | undefined;
552
+ }>>;
553
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
554
+ }, "strip", z.ZodTypeAny, {
555
+ capabilities: {
556
+ id: string;
557
+ description: string;
558
+ endpoint: string;
559
+ protocol: "REST" | "MCP" | "A2A" | "GraphQL" | "WebSocket";
560
+ method?: string | undefined;
561
+ auth?: {
562
+ type: "none" | "api-key" | "bearer-token" | "oauth2" | "hmac";
563
+ scopes?: string[] | undefined;
564
+ tokenEndpoint?: string | undefined;
565
+ docsUrl?: string | undefined;
566
+ } | undefined;
567
+ rateLimit?: {
568
+ requests: number;
569
+ window: "second" | "minute" | "hour" | "day";
570
+ } | undefined;
571
+ openapi?: string | undefined;
572
+ parameters?: {
573
+ type: string;
574
+ name: string;
575
+ in: "query" | "path" | "header" | "body";
576
+ description?: string | undefined;
577
+ required?: boolean | undefined;
578
+ default?: unknown;
579
+ max?: number | undefined;
580
+ min?: number | undefined;
581
+ }[] | undefined;
582
+ scopes?: string[] | undefined;
583
+ }[];
584
+ specVersion: string;
585
+ site: {
586
+ name: string;
587
+ url: string;
588
+ description?: string | undefined;
589
+ contact?: string | undefined;
590
+ privacyPolicy?: string | undefined;
591
+ };
592
+ access: {
593
+ allow: string[];
594
+ disallow: string[];
595
+ };
596
+ agents: Record<string, {
597
+ rateLimit?: {
598
+ requests: number;
599
+ window: "second" | "minute" | "hour" | "day";
600
+ } | undefined;
601
+ capabilities?: string[] | undefined;
602
+ agentDeclaration?: string | undefined;
603
+ }>;
604
+ generatedAt?: string | undefined;
605
+ declarationType?: "platform" | "agent" | undefined;
606
+ operatesOn?: string[] | undefined;
607
+ metadata?: Record<string, string> | undefined;
608
+ }, {
609
+ capabilities: {
610
+ id: string;
611
+ description: string;
612
+ endpoint: string;
613
+ protocol: "REST" | "MCP" | "A2A" | "GraphQL" | "WebSocket";
614
+ method?: string | undefined;
615
+ auth?: {
616
+ type: "none" | "api-key" | "bearer-token" | "oauth2" | "hmac";
617
+ scopes?: string[] | undefined;
618
+ tokenEndpoint?: string | undefined;
619
+ docsUrl?: string | undefined;
620
+ } | undefined;
621
+ rateLimit?: {
622
+ requests: number;
623
+ window: "second" | "minute" | "hour" | "day";
624
+ } | undefined;
625
+ openapi?: string | undefined;
626
+ parameters?: {
627
+ type: string;
628
+ name: string;
629
+ in: "query" | "path" | "header" | "body";
630
+ description?: string | undefined;
631
+ required?: boolean | undefined;
632
+ default?: unknown;
633
+ max?: number | undefined;
634
+ min?: number | undefined;
635
+ }[] | undefined;
636
+ scopes?: string[] | undefined;
637
+ }[];
638
+ specVersion: string;
639
+ site: {
640
+ name: string;
641
+ url: string;
642
+ description?: string | undefined;
643
+ contact?: string | undefined;
644
+ privacyPolicy?: string | undefined;
645
+ };
646
+ access: {
647
+ allow: string[];
648
+ disallow: string[];
649
+ };
650
+ agents: Record<string, {
651
+ rateLimit?: {
652
+ requests: number;
653
+ window: "second" | "minute" | "hour" | "day";
654
+ } | undefined;
655
+ capabilities?: string[] | undefined;
656
+ agentDeclaration?: string | undefined;
657
+ }>;
658
+ generatedAt?: string | undefined;
659
+ declarationType?: "platform" | "agent" | undefined;
660
+ operatesOn?: string[] | undefined;
661
+ metadata?: Record<string, string> | undefined;
662
+ }>;
663
+
664
+ /**
665
+ * Sanitize a value for the agents.txt text format.
666
+ * Prevents newline injection and strips control characters.
667
+ */
668
+ declare function sanitizeValue(value: unknown, maxLength?: number): string;
669
+ /**
670
+ * Parse a rate limit string like "60/minute" into a RateLimit object.
671
+ */
672
+ declare function parseRateLimit(value: string): {
673
+ requests: number;
674
+ window: string;
675
+ } | null;
676
+ /**
677
+ * Format a RateLimit object as a string like "60/minute".
678
+ */
679
+ declare function formatRateLimit(requests: number, window: string): string;
680
+
681
+ export { type AccessControl, type AgentPolicy, AgentsTxtClient, type AgentsTxtDocument, AgentsTxtDocumentSchema, type AuthConfig, AuthConfigSchema, type AuthType, type Capability, CapabilitySchema, type ClientOptions, type DeclarationType, DeclarationTypeSchema, type ParameterDef, type ParseError, type ParseResult, type ParseWarning, type Protocol, ProtocolSchema, type RateLimit, RateLimitSchema, type RateLimitWindow, type SiteInfo, SiteInfoSchema, type ValidationError, type ValidationResult, type ValidationWarning, formatRateLimit, generate, generateJSON, parse, parseJSON, parseRateLimit, sanitizeValue, validate, validateJSON, validateText };