@farming-labs/docs 0.2.65 → 0.2.66

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.
Files changed (37) hide show
  1. package/dist/{agent-CQTH7NFu.mjs → agent-B81ztzxZ.mjs} +2 -2
  2. package/dist/{agent-DKKptIgy.mjs → agent-CcR8_Yyd.mjs} +1 -1
  3. package/dist/{agent-evals-B7MIxuEX.mjs → agent-evals-Bn_dA1_A.mjs} +1 -1
  4. package/dist/{agent-export-CBgWgPvH.mjs → agent-export-CyhCaE8J.mjs} +7 -7
  5. package/dist/agent-skills-bundle.d.mts +1 -1
  6. package/dist/{agent-skills-server-CPja6Syt.d.mts → agent-skills-server-CHvqnM4R.d.mts} +2 -2
  7. package/dist/{agent-skills-server-DraIb6FV.mjs → agent-skills-server-Cuoqu8Jv.mjs} +1 -1
  8. package/dist/agent-skills-vite.d.mts +3 -3
  9. package/dist/agent-skills-vite.mjs +2 -2
  10. package/dist/{agents-XWZBub6f.mjs → agents-BZ_hXI_Z.mjs} +6 -6
  11. package/dist/cli/index.mjs +14 -14
  12. package/dist/client/react.d.mts +1 -1
  13. package/dist/{cloud-ask-ai-zpwkdwnF.d.mts → cloud-ask-ai-BD1SeVZv.d.mts} +1 -1
  14. package/dist/docs-cloud-server.d.mts +2 -2
  15. package/dist/{doctor-DtGYZ41i.mjs → doctor-BJt0ZFkJ.mjs} +11 -11
  16. package/dist/{golden-evaluations-Dj-9Eo3v.mjs → golden-evaluations-D7lSUeQl.mjs} +1 -1
  17. package/dist/index.d.mts +4 -4
  18. package/dist/index.mjs +7 -7
  19. package/dist/{mcp-B9dcsivk.mjs → mcp-jGoU4pLD.mjs} +6 -6
  20. package/dist/mcp.d.mts +2 -2
  21. package/dist/mcp.mjs +314 -14
  22. package/dist/{metadata-DWExHQnx.mjs → metadata-Cna0CtWZ.mjs} +1 -1
  23. package/dist/{reading-time-CYZ5VvKU.mjs → reading-time-oAnc4Brq.mjs} +3 -3
  24. package/dist/{review-CLoHTywU.mjs → review-CUo6iXMw.mjs} +6 -6
  25. package/dist/{robots-CUTahhoY.mjs → robots-NL_OsxEC.mjs} +3 -3
  26. package/dist/{robots-BIpC4j4P.mjs → robots-vU80KRFy.mjs} +2 -2
  27. package/dist/{search-CaSyi6H6.d.mts → search-B-BfnROL.d.mts} +2 -2
  28. package/dist/{search-DSjCeOk7.mjs → search-B_CixCu9.mjs} +6 -6
  29. package/dist/{search-B6V6qtiI.mjs → search-D0A9lRGJ.mjs} +1 -1
  30. package/dist/server.d.mts +4 -4
  31. package/dist/server.mjs +6 -6
  32. package/dist/{sitemap-Cykpe3Tz.mjs → sitemap-B4mIK0ka.mjs} +6 -6
  33. package/dist/{sitemap-server-C_6Wes83.mjs → sitemap-server-atbbiVzW.mjs} +1 -1
  34. package/dist/{standards-discovery-jkykaXq1.mjs → standards-discovery-C7p5lBhc.mjs} +314 -37
  35. package/dist/{standards-discovery-C4HUqMd2.d.mts → standards-discovery-iOmUel-o.d.mts} +21 -38
  36. package/dist/{types-lMBIdZg0.d.mts → types-BQC05SQm.d.mts} +203 -9
  37. package/package.json +1 -1
@@ -19,6 +19,8 @@ const DEFAULT_LEGACY_SKILLS_INDEX_FORMAT = "legacy-skills";
19
19
  const DEFAULT_LEGACY_SKILLS_ROUTE_PREFIX = "/.well-known/skills";
20
20
  const DEFAULT_A2A_AGENT_CARD_ROUTE = "/.well-known/agent-card.json";
21
21
  const DEFAULT_A2A_AGENT_CARD_FORMAT = "agent-card";
22
+ const DEFAULT_A2A_PROTOCOL_BINDING = "HTTP+JSON";
23
+ const DEFAULT_A2A_PROTOCOL_VERSION = "1.0";
22
24
  const AGENT_SKILLS_DISCOVERY_SCHEMA_URI = "https://schemas.agentskills.io/discovery/0.2.0/schema.json";
23
25
  const DEFAULT_DOCS_API_ROUTE = "/api/docs";
24
26
  const DEFAULT_AGENT_MANIFEST_ROUTE = "/.well-known/agent.json";
@@ -26,6 +28,7 @@ const AGENT_SKILL_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
26
28
  const AGENT_SKILL_NAME_MAX_LENGTH = 64;
27
29
  const AGENT_SKILL_DESCRIPTION_MAX_LENGTH = 1024;
28
30
  const DISCOVERY_CACHE_CONTROL = "public, max-age=0, s-maxage=3600";
31
+ const LEGACY_A2A_PROTOCOL_VERSION = "0.3";
29
32
  function normalizeDocsRoute(value) {
30
33
  const normalized = `/${value.trim()}`.replace(/\/{2,}/g, "/");
31
34
  return normalized === "/" ? normalized : normalized.replace(/\/+$/, "");
@@ -210,45 +213,319 @@ function buildDocsLegacySkillsIndex(skills) {
210
213
  }).map((file) => file.path)
211
214
  })).sort((left, right) => left.name.localeCompare(right.name)) };
212
215
  }
216
+ function requireA2AText(value, label) {
217
+ const normalized = value.trim();
218
+ if (!normalized) throw new Error(`${label} must not be empty.`);
219
+ return normalized;
220
+ }
221
+ function isA2ALoopbackHostname(hostname) {
222
+ return hostname === "localhost" || hostname.endsWith(".localhost") || hostname === "[::1]" || hostname === "::1" || /^127(?:\.\d{1,3}){3}$/.test(hostname);
223
+ }
224
+ function parseAbsoluteA2AUrl(value, label) {
225
+ let url;
226
+ try {
227
+ url = new URL(value);
228
+ } catch {
229
+ throw new Error(`${label} must be an absolute URL.`);
230
+ }
231
+ if (url.username || url.password) throw new Error(`${label} must not contain credentials.`);
232
+ return url;
233
+ }
234
+ function resolveA2ASecureHttpUrl(value, label) {
235
+ const url = parseAbsoluteA2AUrl(value, label);
236
+ if (url.protocol !== "https:" && !(url.protocol === "http:" && isA2ALoopbackHostname(url.hostname))) throw new Error(`${label} must use HTTPS (HTTP is allowed only for loopback development).`);
237
+ return url.toString();
238
+ }
239
+ function resolveA2AInterfaceUrl(value, protocolBinding, label) {
240
+ const url = parseAbsoluteA2AUrl(value, label);
241
+ if ([
242
+ "JSONRPC",
243
+ "GRPC",
244
+ "HTTP+JSON"
245
+ ].includes(protocolBinding)) {
246
+ if (url.protocol !== "https:" && !(url.protocol === "http:" && isA2ALoopbackHostname(url.hostname))) throw new Error(`${label} must use HTTPS for core A2A bindings (HTTP is allowed only for loopback development).`);
247
+ } else if (new Set([
248
+ "file:",
249
+ "data:",
250
+ "javascript:",
251
+ "blob:",
252
+ "ftp:",
253
+ "mqtt:",
254
+ "amqp:"
255
+ ]).has(url.protocol) || (url.protocol === "http:" || url.protocol === "ws:") && !isA2ALoopbackHostname(url.hostname)) throw new Error(`${label} must use a secure binding-appropriate URL outside loopback development.`);
256
+ return url.toString();
257
+ }
258
+ function normalizeA2AStringList(values, label, options = {}) {
259
+ if (!Array.isArray(values) || !options.allowEmpty && values.length === 0) throw new Error(`${label} must contain at least one value.`);
260
+ return values.map((value, index) => requireA2AText(value, `${label}[${index}]`));
261
+ }
262
+ function normalizeA2AStringMap(values, label) {
263
+ if (!values || typeof values !== "object" || Array.isArray(values)) throw new Error(`${label} must be an object.`);
264
+ const normalized = [];
265
+ const normalizedKeys = /* @__PURE__ */ new Set();
266
+ for (const [key, value] of Object.entries(values)) {
267
+ const normalizedKey = requireA2AText(key, `${label} key`);
268
+ if (normalizedKeys.has(normalizedKey)) throw new Error(`${label} must not contain duplicate keys after trimming.`);
269
+ normalizedKeys.add(normalizedKey);
270
+ normalized.push([normalizedKey, requireA2AText(value, `${label}.${normalizedKey}`)]);
271
+ }
272
+ return Object.fromEntries(normalized);
273
+ }
274
+ function normalizeA2AInterface(value, index) {
275
+ const label = `agent.a2a.supportedInterfaces[${index}]`;
276
+ const protocolBinding = requireA2AText(value.protocolBinding ?? DEFAULT_A2A_PROTOCOL_BINDING, `${label}.protocolBinding`);
277
+ if (![
278
+ "JSONRPC",
279
+ "GRPC",
280
+ "HTTP+JSON"
281
+ ].includes(protocolBinding)) try {
282
+ new URL(protocolBinding);
283
+ } catch {
284
+ throw new Error(`${label}.protocolBinding must be a core A2A binding or an absolute URI.`);
285
+ }
286
+ const url = resolveA2AInterfaceUrl(value.url, protocolBinding, `${label}.url`);
287
+ const protocolVersion = requireA2AText(value.protocolVersion ?? DEFAULT_A2A_PROTOCOL_VERSION, `${label}.protocolVersion`);
288
+ if (!/^\d+\.\d+$/.test(protocolVersion)) throw new Error(`${label}.protocolVersion must use A2A major.minor form (for example, "1.0").`);
289
+ const tenant = value.tenant === void 0 ? void 0 : requireA2AText(value.tenant, `${label}.tenant`);
290
+ return {
291
+ url,
292
+ protocolBinding,
293
+ protocolVersion,
294
+ ...tenant ? { tenant } : {}
295
+ };
296
+ }
297
+ function normalizeA2AExtension(extension, index) {
298
+ const label = `agent.a2a.capabilities.extensions[${index}]`;
299
+ const uri = requireA2AText(extension.uri, `${label}.uri`);
300
+ try {
301
+ new URL(uri);
302
+ } catch {
303
+ throw new Error(`${label}.uri must be an absolute URI.`);
304
+ }
305
+ let params;
306
+ if (extension.params !== void 0) {
307
+ if (!extension.params || typeof extension.params !== "object" || Array.isArray(extension.params)) throw new Error(`${label}.params must be a JSON object.`);
308
+ try {
309
+ params = JSON.parse(JSON.stringify(extension.params));
310
+ } catch {
311
+ throw new Error(`${label}.params must be JSON serializable.`);
312
+ }
313
+ }
314
+ return {
315
+ uri,
316
+ ...extension.description !== void 0 ? { description: requireA2AText(extension.description, `${label}.description`) } : {},
317
+ ...extension.required !== void 0 ? { required: extension.required } : {},
318
+ ...params ? { params } : {}
319
+ };
320
+ }
321
+ function normalizeA2ACapabilities(capabilities) {
322
+ return {
323
+ streaming: capabilities?.streaming ?? false,
324
+ pushNotifications: capabilities?.pushNotifications ?? false,
325
+ ...capabilities?.extensions ? { extensions: capabilities.extensions.map((extension, index) => normalizeA2AExtension(extension, index)) } : {},
326
+ ...capabilities?.extendedAgentCard !== void 0 ? { extendedAgentCard: capabilities.extendedAgentCard } : {}
327
+ };
328
+ }
329
+ function normalizeA2ASecurityRequirements(requirements, label) {
330
+ if (requirements === void 0) return void 0;
331
+ return requirements.map((requirement, requirementIndex) => {
332
+ if (!requirement.schemes || typeof requirement.schemes !== "object" || Array.isArray(requirement.schemes)) throw new Error(`${label}[${requirementIndex}].schemes must be an object.`);
333
+ const schemes = [];
334
+ const schemeNames = /* @__PURE__ */ new Set();
335
+ for (const [name, scopes] of Object.entries(requirement.schemes)) {
336
+ const schemeName = requireA2AText(name, `${label}[${requirementIndex}].schemes key`);
337
+ if (schemeNames.has(schemeName)) throw new Error(`${label}[${requirementIndex}].schemes must not contain duplicate keys after trimming.`);
338
+ schemeNames.add(schemeName);
339
+ schemes.push([schemeName, { list: normalizeA2AStringList(scopes.list, `${label}[${requirementIndex}].schemes.${schemeName}.list`, { allowEmpty: true }) }]);
340
+ }
341
+ return { schemes: Object.fromEntries(schemes) };
342
+ });
343
+ }
344
+ function normalizeA2AOAuthFlows(flows, label) {
345
+ if ([
346
+ flows.authorizationCode ? "authorizationCode" : null,
347
+ flows.clientCredentials ? "clientCredentials" : null,
348
+ flows.deviceCode ? "deviceCode" : null,
349
+ flows.implicit ? "implicit" : null,
350
+ flows.password ? "password" : null
351
+ ].filter((name) => Boolean(name)).length !== 1) throw new Error(`${label} must configure exactly one OAuth flow.`);
352
+ if (flows.authorizationCode) {
353
+ const flow = flows.authorizationCode;
354
+ return { authorizationCode: {
355
+ authorizationUrl: resolveA2ASecureHttpUrl(flow.authorizationUrl, `${label}.authorizationCode.authorizationUrl`),
356
+ tokenUrl: resolveA2ASecureHttpUrl(flow.tokenUrl, `${label}.authorizationCode.tokenUrl`),
357
+ ...flow.refreshUrl !== void 0 ? { refreshUrl: resolveA2ASecureHttpUrl(flow.refreshUrl, `${label}.authorizationCode.refreshUrl`) } : {},
358
+ scopes: normalizeA2AStringMap(flow.scopes, `${label}.authorizationCode.scopes`),
359
+ ...flow.pkceRequired !== void 0 ? { pkceRequired: flow.pkceRequired } : {}
360
+ } };
361
+ }
362
+ if (flows.clientCredentials) {
363
+ const flow = flows.clientCredentials;
364
+ return { clientCredentials: {
365
+ tokenUrl: resolveA2ASecureHttpUrl(flow.tokenUrl, `${label}.clientCredentials.tokenUrl`),
366
+ ...flow.refreshUrl !== void 0 ? { refreshUrl: resolveA2ASecureHttpUrl(flow.refreshUrl, `${label}.clientCredentials.refreshUrl`) } : {},
367
+ scopes: normalizeA2AStringMap(flow.scopes, `${label}.clientCredentials.scopes`)
368
+ } };
369
+ }
370
+ if (flows.deviceCode) {
371
+ const flow = flows.deviceCode;
372
+ return { deviceCode: {
373
+ deviceAuthorizationUrl: resolveA2ASecureHttpUrl(flow.deviceAuthorizationUrl, `${label}.deviceCode.deviceAuthorizationUrl`),
374
+ tokenUrl: resolveA2ASecureHttpUrl(flow.tokenUrl, `${label}.deviceCode.tokenUrl`),
375
+ ...flow.refreshUrl !== void 0 ? { refreshUrl: resolveA2ASecureHttpUrl(flow.refreshUrl, `${label}.deviceCode.refreshUrl`) } : {},
376
+ scopes: normalizeA2AStringMap(flow.scopes, `${label}.deviceCode.scopes`)
377
+ } };
378
+ }
379
+ if (flows.implicit) {
380
+ const flow = flows.implicit;
381
+ return { implicit: {
382
+ authorizationUrl: resolveA2ASecureHttpUrl(flow.authorizationUrl, `${label}.implicit.authorizationUrl`),
383
+ ...flow.refreshUrl !== void 0 ? { refreshUrl: resolveA2ASecureHttpUrl(flow.refreshUrl, `${label}.implicit.refreshUrl`) } : {},
384
+ scopes: normalizeA2AStringMap(flow.scopes, `${label}.implicit.scopes`)
385
+ } };
386
+ }
387
+ const flow = flows.password;
388
+ return { password: {
389
+ tokenUrl: resolveA2ASecureHttpUrl(flow.tokenUrl, `${label}.password.tokenUrl`),
390
+ ...flow.refreshUrl !== void 0 ? { refreshUrl: resolveA2ASecureHttpUrl(flow.refreshUrl, `${label}.password.refreshUrl`) } : {},
391
+ scopes: normalizeA2AStringMap(flow.scopes, `${label}.password.scopes`)
392
+ } };
393
+ }
394
+ function normalizeA2ASecurityScheme(scheme, name) {
395
+ const label = `agent.a2a.securitySchemes.${name}`;
396
+ if ([
397
+ scheme.apiKeySecurityScheme ? "apiKeySecurityScheme" : null,
398
+ scheme.httpAuthSecurityScheme ? "httpAuthSecurityScheme" : null,
399
+ scheme.oauth2SecurityScheme ? "oauth2SecurityScheme" : null,
400
+ scheme.openIdConnectSecurityScheme ? "openIdConnectSecurityScheme" : null,
401
+ scheme.mtlsSecurityScheme ? "mtlsSecurityScheme" : null
402
+ ].filter((key) => Boolean(key)).length !== 1) throw new Error(`${label} must configure exactly one A2A security scheme.`);
403
+ if (scheme.apiKeySecurityScheme) {
404
+ const value = scheme.apiKeySecurityScheme;
405
+ if (![
406
+ "query",
407
+ "header",
408
+ "cookie"
409
+ ].includes(value.location)) throw new Error(`${label}.apiKeySecurityScheme.location is invalid.`);
410
+ return { apiKeySecurityScheme: {
411
+ ...value.description !== void 0 ? { description: requireA2AText(value.description, `${label}.apiKeySecurityScheme.description`) } : {},
412
+ location: value.location,
413
+ name: requireA2AText(value.name, `${label}.apiKeySecurityScheme.name`)
414
+ } };
415
+ }
416
+ if (scheme.httpAuthSecurityScheme) {
417
+ const value = scheme.httpAuthSecurityScheme;
418
+ return { httpAuthSecurityScheme: {
419
+ ...value.description !== void 0 ? { description: requireA2AText(value.description, `${label}.httpAuthSecurityScheme.description`) } : {},
420
+ scheme: requireA2AText(value.scheme, `${label}.httpAuthSecurityScheme.scheme`),
421
+ ...value.bearerFormat !== void 0 ? { bearerFormat: requireA2AText(value.bearerFormat, `${label}.httpAuthSecurityScheme.bearerFormat`) } : {}
422
+ } };
423
+ }
424
+ if (scheme.oauth2SecurityScheme) {
425
+ const value = scheme.oauth2SecurityScheme;
426
+ return { oauth2SecurityScheme: {
427
+ ...value.description !== void 0 ? { description: requireA2AText(value.description, `${label}.oauth2SecurityScheme.description`) } : {},
428
+ flows: normalizeA2AOAuthFlows(value.flows, `${label}.oauth2SecurityScheme.flows`),
429
+ ...value.oauth2MetadataUrl !== void 0 ? { oauth2MetadataUrl: resolveA2ASecureHttpUrl(value.oauth2MetadataUrl, `${label}.oauth2SecurityScheme.oauth2MetadataUrl`) } : {}
430
+ } };
431
+ }
432
+ if (scheme.openIdConnectSecurityScheme) {
433
+ const value = scheme.openIdConnectSecurityScheme;
434
+ return { openIdConnectSecurityScheme: {
435
+ ...value.description !== void 0 ? { description: requireA2AText(value.description, `${label}.openIdConnectSecurityScheme.description`) } : {},
436
+ openIdConnectUrl: resolveA2ASecureHttpUrl(value.openIdConnectUrl, `${label}.openIdConnectSecurityScheme.openIdConnectUrl`)
437
+ } };
438
+ }
439
+ const value = scheme.mtlsSecurityScheme;
440
+ return { mtlsSecurityScheme: value.description !== void 0 ? { description: requireA2AText(value.description, `${label}.mtlsSecurityScheme.description`) } : {} };
441
+ }
442
+ function validateA2ARequirementReferences(requirements, schemeNames, label) {
443
+ for (const [requirementIndex, requirement] of (requirements ?? []).entries()) for (const schemeName of Object.keys(requirement.schemes)) if (!schemeNames.has(schemeName)) throw new Error(`${label}[${requirementIndex}] references undefined security scheme "${schemeName}".`);
444
+ }
445
+ function normalizeA2ASkill(skill, index) {
446
+ const label = `agent.a2a.skills[${index}]`;
447
+ return {
448
+ id: requireA2AText(skill.id, `${label}.id`),
449
+ name: requireA2AText(skill.name, `${label}.name`),
450
+ description: requireA2AText(skill.description, `${label}.description`),
451
+ tags: normalizeA2AStringList(skill.tags, `${label}.tags`),
452
+ ...skill.examples !== void 0 ? { examples: normalizeA2AStringList(skill.examples, `${label}.examples`, { allowEmpty: true }) } : {},
453
+ ...skill.inputModes !== void 0 ? { inputModes: normalizeA2AStringList(skill.inputModes, `${label}.inputModes`) } : {},
454
+ ...skill.outputModes !== void 0 ? { outputModes: normalizeA2AStringList(skill.outputModes, `${label}.outputModes`) } : {},
455
+ ...skill.securityRequirements !== void 0 ? { securityRequirements: normalizeA2ASecurityRequirements(skill.securityRequirements, `${label}.securityRequirements`) } : {}
456
+ };
457
+ }
213
458
  /** Build an A2A Agent Card only when a real A2A interface is explicitly configured. */
214
459
  function buildDocsA2AAgentCard(options, skills) {
215
- const interfaceUrl = resolveHttpUrl(options.interfaceUrl, options.interfaceUrl);
216
- const documentationUrl = resolveHttpUrl(options.documentationUrl, options.interfaceUrl);
217
- const providerUrl = resolveHttpUrl(options.provider.url, options.interfaceUrl);
218
- if (!interfaceUrl || !documentationUrl || !providerUrl) throw new Error("A2A Agent Card URLs must use HTTP(S).");
219
- const protocolVersion = options.protocolVersion ?? "0.3";
220
- const protocolBinding = options.protocolBinding ?? "HTTP+JSON";
460
+ const usesSupportedInterfaces = options.supportedInterfaces !== void 0;
461
+ if (usesSupportedInterfaces && ("interfaceUrl" in options || "protocolBinding" in options || "protocolVersion" in options)) throw new Error("agent.a2a.supportedInterfaces cannot be combined with the deprecated interfaceUrl shorthand.");
462
+ const interfaceConfigs = options.supportedInterfaces ?? ("interfaceUrl" in options ? [{
463
+ url: options.interfaceUrl,
464
+ protocolBinding: options.protocolBinding,
465
+ protocolVersion: options.protocolVersion ?? LEGACY_A2A_PROTOCOL_VERSION
466
+ }] : []);
467
+ if (interfaceConfigs.length === 0) throw new Error("agent.a2a.supportedInterfaces must contain at least one interface.");
468
+ const supportedInterfaces = interfaceConfigs.map(normalizeA2AInterface);
469
+ const interfaceKeys = /* @__PURE__ */ new Set();
470
+ for (const value of supportedInterfaces) {
471
+ const key = `${value.url}\u0000${value.protocolBinding}\u0000${value.protocolVersion}\u0000${value.tenant ?? ""}`;
472
+ if (interfaceKeys.has(key)) throw new Error("agent.a2a.supportedInterfaces must not contain duplicate interfaces.");
473
+ interfaceKeys.add(key);
474
+ }
475
+ const provider = options.provider ? {
476
+ organization: requireA2AText(options.provider.organization, "agent.a2a.provider.organization"),
477
+ url: resolveA2ASecureHttpUrl(options.provider.url, "agent.a2a.provider.url")
478
+ } : void 0;
479
+ const documentationUrl = options.documentationUrl !== void 0 ? resolveA2ASecureHttpUrl(options.documentationUrl, "agent.a2a.documentationUrl") : void 0;
480
+ const iconUrl = options.iconUrl !== void 0 ? resolveA2ASecureHttpUrl(options.iconUrl, "agent.a2a.iconUrl") : void 0;
481
+ const capabilities = normalizeA2ACapabilities(options.capabilities);
482
+ let securitySchemes;
483
+ if (options.securitySchemes !== void 0) {
484
+ const entries = Object.entries(options.securitySchemes);
485
+ if (entries.length === 0) throw new Error("agent.a2a.securitySchemes must contain at least one scheme when configured.");
486
+ const normalizedSchemes = [];
487
+ const normalizedNames = /* @__PURE__ */ new Set();
488
+ for (const [name, scheme] of entries) {
489
+ const normalizedName = requireA2AText(name, "agent.a2a.securitySchemes key");
490
+ if (normalizedNames.has(normalizedName)) throw new Error("agent.a2a.securitySchemes must not contain duplicate keys after trimming.");
491
+ normalizedNames.add(normalizedName);
492
+ normalizedSchemes.push([normalizedName, normalizeA2ASecurityScheme(scheme, normalizedName)]);
493
+ }
494
+ securitySchemes = Object.fromEntries(normalizedSchemes);
495
+ }
496
+ const securityRequirements = normalizeA2ASecurityRequirements(options.securityRequirements, "agent.a2a.securityRequirements");
497
+ const securitySchemeNames = new Set(Object.keys(securitySchemes ?? {}));
498
+ validateA2ARequirementReferences(securityRequirements, securitySchemeNames, "agent.a2a.securityRequirements");
499
+ if (capabilities.extendedAgentCard && (!securitySchemes || !securityRequirements?.some((requirement) => Object.keys(requirement.schemes).length > 0))) throw new Error("agent.a2a.capabilities.extendedAgentCard requires a configured security scheme and a non-empty security requirement.");
500
+ if (usesSupportedInterfaces && options.skills === void 0) throw new Error("agent.a2a.skills is required with supportedInterfaces so the card advertises only implemented A2A capabilities.");
501
+ const configuredSkills = options.skills === void 0 ? toPublishedSkillArray(skills).map((skill) => ({
502
+ id: skill.name,
503
+ name: skill.name,
504
+ description: skill.description,
505
+ tags: ["documentation"],
506
+ examples: []
507
+ })).sort((left, right) => left.name.localeCompare(right.name)) : options.skills.map(normalizeA2ASkill);
508
+ if (configuredSkills.length === 0) throw new Error("agent.a2a.skills must contain at least one skill.");
509
+ const skillIds = /* @__PURE__ */ new Set();
510
+ for (const [index, skill] of configuredSkills.entries()) {
511
+ if (skillIds.has(skill.id)) throw new Error(`agent.a2a.skills[${index}].id must be unique.`);
512
+ skillIds.add(skill.id);
513
+ validateA2ARequirementReferences(skill.securityRequirements, securitySchemeNames, `agent.a2a.skills[${index}].securityRequirements`);
514
+ }
221
515
  return {
222
- protocolVersion,
223
- preferredTransport: protocolBinding,
224
- supportedInterfaces: [{
225
- url: interfaceUrl,
226
- protocolBinding,
227
- protocolVersion
228
- }],
229
- name: options.name,
230
- description: options.description,
231
- url: interfaceUrl,
232
- provider: {
233
- organization: options.provider.organization,
234
- url: providerUrl
235
- },
236
- version: options.version ?? "1.0.0",
237
- documentationUrl,
238
- capabilities: {
239
- streaming: false,
240
- pushNotifications: false
241
- },
242
- defaultInputModes: ["text/plain"],
243
- defaultOutputModes: ["text/plain"],
244
- skills: toPublishedSkillArray(skills).map((skill) => ({
245
- id: skill.name,
246
- name: skill.name,
247
- description: skill.description,
248
- tags: ["documentation"],
249
- examples: [],
250
- url: skill.url
251
- })).sort((left, right) => left.name.localeCompare(right.name))
516
+ name: requireA2AText(options.name, "agent.a2a.name"),
517
+ description: requireA2AText(options.description, "agent.a2a.description"),
518
+ supportedInterfaces,
519
+ ...provider ? { provider } : {},
520
+ version: requireA2AText(options.version ?? "1.0.0", "agent.a2a.version"),
521
+ ...documentationUrl ? { documentationUrl } : {},
522
+ capabilities,
523
+ defaultInputModes: normalizeA2AStringList(options.defaultInputModes ?? ["text/plain"], "agent.a2a.defaultInputModes"),
524
+ defaultOutputModes: normalizeA2AStringList(options.defaultOutputModes ?? ["text/plain"], "agent.a2a.defaultOutputModes"),
525
+ skills: configuredSkills,
526
+ ...securitySchemes ? { securitySchemes } : {},
527
+ ...securityRequirements ? { securityRequirements } : {},
528
+ ...iconUrl ? { iconUrl } : {}
252
529
  };
253
530
  }
254
531
  function resolveDocsStandardsDiscoveryRequest(url, options = {}) {
@@ -516,4 +793,4 @@ async function createDocsStandardsResponse({ request, apiCatalog, apiCatalogEnab
516
793
  }
517
794
 
518
795
  //#endregion
519
- export { resolveDocsPublishedAgentSkill as A, buildDocsApiCatalog as C, getDocsDiscoveryLinkHeader as D, createDocsStandardsResponse as E, sha256DocsDiscoveryContent as M, isDocsStandardsDiscoveryRequest as O, buildDocsAgentSkillsIndex as S, buildDocsPublishedAgentSkill as T, DEFAULT_LEGACY_SKILLS_INDEX_FORMAT as _, DEFAULT_A2A_AGENT_CARD_ROUTE as a, appendDocsDiscoveryLinkHeader as b, DEFAULT_AGENT_SKILLS_INDEX_ROUTE as c, DEFAULT_AGENT_SKILL_ARCHIVE_FORMAT as d, DEFAULT_AGENT_SKILL_FILE_FORMAT as f, DEFAULT_API_CATALOG_ROUTE as g, DEFAULT_API_CATALOG_FORMAT as h, DEFAULT_A2A_AGENT_CARD_FORMAT as i, resolveDocsStandardsDiscoveryRequest as j, resolveDocsDiscoveryApiRoute as k, DEFAULT_AGENT_SKILLS_ROUTE_PATTERN as l, DEFAULT_AGENT_SKILL_RESOURCE_FORMAT as m, API_CATALOG_MEDIA_TYPE as n, DEFAULT_AGENT_SKILLS_ARCHIVE_ROUTE_PATTERN as o, DEFAULT_AGENT_SKILL_FORMAT as p, API_CATALOG_PROFILE_URI as r, DEFAULT_AGENT_SKILLS_INDEX_FORMAT as s, AGENT_SKILLS_DISCOVERY_SCHEMA_URI as t, DEFAULT_AGENT_SKILLS_ROUTE_PREFIX as u, DEFAULT_LEGACY_SKILLS_INDEX_ROUTE as v, buildDocsLegacySkillsIndex as w, buildDocsA2AAgentCard as x, DEFAULT_LEGACY_SKILLS_ROUTE_PREFIX as y };
796
+ export { isDocsStandardsDiscoveryRequest as A, buildDocsA2AAgentCard as C, buildDocsPublishedAgentSkill as D, buildDocsLegacySkillsIndex as E, resolveDocsPublishedAgentSkill as M, resolveDocsStandardsDiscoveryRequest as N, createDocsStandardsResponse as O, sha256DocsDiscoveryContent as P, appendDocsDiscoveryLinkHeader as S, buildDocsApiCatalog as T, DEFAULT_API_CATALOG_FORMAT as _, DEFAULT_A2A_AGENT_CARD_ROUTE as a, DEFAULT_LEGACY_SKILLS_INDEX_ROUTE as b, DEFAULT_AGENT_SKILLS_ARCHIVE_ROUTE_PATTERN as c, DEFAULT_AGENT_SKILLS_ROUTE_PATTERN as d, DEFAULT_AGENT_SKILLS_ROUTE_PREFIX as f, DEFAULT_AGENT_SKILL_RESOURCE_FORMAT as g, DEFAULT_AGENT_SKILL_FORMAT as h, DEFAULT_A2A_AGENT_CARD_FORMAT as i, resolveDocsDiscoveryApiRoute as j, getDocsDiscoveryLinkHeader as k, DEFAULT_AGENT_SKILLS_INDEX_FORMAT as l, DEFAULT_AGENT_SKILL_FILE_FORMAT as m, API_CATALOG_MEDIA_TYPE as n, DEFAULT_A2A_PROTOCOL_BINDING as o, DEFAULT_AGENT_SKILL_ARCHIVE_FORMAT as p, API_CATALOG_PROFILE_URI as r, DEFAULT_A2A_PROTOCOL_VERSION as s, AGENT_SKILLS_DISCOVERY_SCHEMA_URI as t, DEFAULT_AGENT_SKILLS_INDEX_ROUTE as u, DEFAULT_API_CATALOG_ROUTE as v, buildDocsAgentSkillsIndex as w, DEFAULT_LEGACY_SKILLS_ROUTE_PREFIX as x, DEFAULT_LEGACY_SKILLS_INDEX_FORMAT as y };
@@ -1,3 +1,5 @@
1
+ import { A as DocsAgentA2ASecurityScheme, M as DocsAgentA2ASkill, O as DocsAgentA2AProtocolBinding, h as DocsAgentA2AConfig, k as DocsAgentA2ASecurityRequirement, m as DocsAgentA2ACapabilities } from "./types-BQC05SQm.mjs";
2
+
1
3
  //#region src/standards-discovery.d.ts
2
4
  declare const DEFAULT_API_CATALOG_ROUTE = "/.well-known/api-catalog";
3
5
  declare const DEFAULT_API_CATALOG_FORMAT = "api-catalog";
@@ -17,6 +19,8 @@ declare const DEFAULT_LEGACY_SKILLS_INDEX_FORMAT = "legacy-skills";
17
19
  declare const DEFAULT_LEGACY_SKILLS_ROUTE_PREFIX = "/.well-known/skills";
18
20
  declare const DEFAULT_A2A_AGENT_CARD_ROUTE = "/.well-known/agent-card.json";
19
21
  declare const DEFAULT_A2A_AGENT_CARD_FORMAT = "agent-card";
22
+ declare const DEFAULT_A2A_PROTOCOL_BINDING = "HTTP+JSON";
23
+ declare const DEFAULT_A2A_PROTOCOL_VERSION = "1.0";
20
24
  declare const AGENT_SKILLS_DISCOVERY_SCHEMA_URI = "https://schemas.agentskills.io/discovery/0.2.0/schema.json";
21
25
  interface DocsAgentSkillIndexEntry {
22
26
  name: string;
@@ -55,51 +59,30 @@ interface DocsLegacySkillsIndex {
55
59
  files: string[];
56
60
  }>;
57
61
  }
58
- interface DocsA2AAgentCardOptions {
59
- /** URL of a real A2A interface. Merely exposing docs or MCP is not sufficient. */
60
- interfaceUrl: string;
61
- name: string;
62
- description: string;
63
- documentationUrl: string;
64
- provider: {
65
- organization: string;
66
- url: string;
67
- };
68
- version?: string;
69
- protocolVersion?: string;
70
- protocolBinding?: string;
62
+ type DocsA2AAgentCardOptions = DocsAgentA2AConfig;
63
+ interface DocsA2AAgentInterface {
64
+ url: string;
65
+ protocolBinding: DocsAgentA2AProtocolBinding;
66
+ protocolVersion: string;
67
+ tenant?: string;
71
68
  }
72
69
  interface DocsA2AAgentCard {
73
- protocolVersion: string;
74
- preferredTransport: string;
75
- supportedInterfaces: Array<{
76
- url: string;
77
- protocolBinding: string;
78
- protocolVersion: string;
79
- }>;
80
70
  name: string;
81
71
  description: string;
82
- url: string;
83
- provider: {
72
+ supportedInterfaces: DocsA2AAgentInterface[];
73
+ provider?: {
84
74
  organization: string;
85
75
  url: string;
86
76
  };
87
77
  version: string;
88
- documentationUrl: string;
89
- capabilities: {
90
- streaming: false;
91
- pushNotifications: false;
92
- };
93
- defaultInputModes: ["text/plain"];
94
- defaultOutputModes: ["text/plain"];
95
- skills: Array<{
96
- id: string;
97
- name: string;
98
- description: string;
99
- tags: string[];
100
- examples: string[];
101
- url: string;
102
- }>;
78
+ documentationUrl?: string;
79
+ capabilities: DocsAgentA2ACapabilities;
80
+ defaultInputModes: string[];
81
+ defaultOutputModes: string[];
82
+ skills: DocsAgentA2ASkill[];
83
+ securitySchemes?: Record<string, DocsAgentA2ASecurityScheme>;
84
+ securityRequirements?: DocsAgentA2ASecurityRequirement[];
85
+ iconUrl?: string;
103
86
  }
104
87
  interface DocsPublishedAgentSkillOptions {
105
88
  preferredDocument?: string | null;
@@ -224,4 +207,4 @@ declare function createDocsStandardsResponse({
224
207
  agentCard
225
208
  }: CreateDocsStandardsResponseOptions): Promise<Response | null>;
226
209
  //#endregion
227
- export { DocsPublishedAgentSkill as A, createDocsStandardsResponse as B, DocsAgentSkillIndexEntry as C, DocsApiCatalogLinkTarget as D, DocsApiCatalogLinkContext as E, appendDocsDiscoveryLinkHeader as F, resolveDocsStandardsDiscoveryRequest as G, isDocsStandardsDiscoveryRequest as H, buildDocsA2AAgentCard as I, sha256DocsDiscoveryContent as K, buildDocsAgentSkillsIndex as L, DocsPublishedAgentSkillOptions as M, DocsStandardsDiscoveryRequest as N, DocsApiCatalogOptions as O, DocsStandardsDiscoveryRouteOptions as P, buildDocsApiCatalog as R, DocsA2AAgentCardOptions as S, DocsApiCatalog as T, resolveDocsDiscoveryApiRoute as U, getDocsDiscoveryLinkHeader as V, resolveDocsPublishedAgentSkill as W, DEFAULT_API_CATALOG_ROUTE as _, DEFAULT_A2A_AGENT_CARD_FORMAT as a, DEFAULT_LEGACY_SKILLS_ROUTE_PREFIX as b, DEFAULT_AGENT_SKILLS_INDEX_FORMAT as c, DEFAULT_AGENT_SKILLS_ROUTE_PREFIX as d, DEFAULT_AGENT_SKILL_ARCHIVE_FORMAT as f, DEFAULT_API_CATALOG_FORMAT as g, DEFAULT_AGENT_SKILL_RESOURCE_FORMAT as h, CreateDocsStandardsResponseOptions as i, DocsPublishedAgentSkillFile as j, DocsDiscoveryApiRouteOptions as k, DEFAULT_AGENT_SKILLS_INDEX_ROUTE as l, DEFAULT_AGENT_SKILL_FORMAT as m, API_CATALOG_MEDIA_TYPE as n, DEFAULT_A2A_AGENT_CARD_ROUTE as o, DEFAULT_AGENT_SKILL_FILE_FORMAT as p, API_CATALOG_PROFILE_URI as r, DEFAULT_AGENT_SKILLS_ARCHIVE_ROUTE_PATTERN as s, AGENT_SKILLS_DISCOVERY_SCHEMA_URI as t, DEFAULT_AGENT_SKILLS_ROUTE_PATTERN as u, DEFAULT_LEGACY_SKILLS_INDEX_FORMAT as v, DocsAgentSkillsIndex as w, DocsA2AAgentCard as x, DEFAULT_LEGACY_SKILLS_INDEX_ROUTE as y, buildDocsLegacySkillsIndex as z };
210
+ export { DocsApiCatalogLinkTarget as A, buildDocsAgentSkillsIndex as B, DocsA2AAgentCard as C, DocsAgentSkillsIndex as D, DocsAgentSkillIndexEntry as E, DocsPublishedAgentSkillOptions as F, isDocsStandardsDiscoveryRequest as G, buildDocsLegacySkillsIndex as H, DocsStandardsDiscoveryRequest as I, resolveDocsStandardsDiscoveryRequest as J, resolveDocsDiscoveryApiRoute as K, DocsStandardsDiscoveryRouteOptions as L, DocsDiscoveryApiRouteOptions as M, DocsPublishedAgentSkill as N, DocsApiCatalog as O, DocsPublishedAgentSkillFile as P, appendDocsDiscoveryLinkHeader as R, DEFAULT_LEGACY_SKILLS_ROUTE_PREFIX as S, DocsA2AAgentInterface as T, createDocsStandardsResponse as U, buildDocsApiCatalog as V, getDocsDiscoveryLinkHeader as W, sha256DocsDiscoveryContent as Y, DEFAULT_AGENT_SKILL_RESOURCE_FORMAT as _, DEFAULT_A2A_AGENT_CARD_FORMAT as a, DEFAULT_LEGACY_SKILLS_INDEX_FORMAT as b, DEFAULT_A2A_PROTOCOL_VERSION as c, DEFAULT_AGENT_SKILLS_INDEX_ROUTE as d, DEFAULT_AGENT_SKILLS_ROUTE_PATTERN as f, DEFAULT_AGENT_SKILL_FORMAT as g, DEFAULT_AGENT_SKILL_FILE_FORMAT as h, CreateDocsStandardsResponseOptions as i, DocsApiCatalogOptions as j, DocsApiCatalogLinkContext as k, DEFAULT_AGENT_SKILLS_ARCHIVE_ROUTE_PATTERN as l, DEFAULT_AGENT_SKILL_ARCHIVE_FORMAT as m, API_CATALOG_MEDIA_TYPE as n, DEFAULT_A2A_AGENT_CARD_ROUTE as o, DEFAULT_AGENT_SKILLS_ROUTE_PREFIX as p, resolveDocsPublishedAgentSkill as q, API_CATALOG_PROFILE_URI as r, DEFAULT_A2A_PROTOCOL_BINDING as s, AGENT_SKILLS_DISCOVERY_SCHEMA_URI as t, DEFAULT_AGENT_SKILLS_INDEX_FORMAT as u, DEFAULT_API_CATALOG_FORMAT as v, DocsA2AAgentCardOptions as w, DEFAULT_LEGACY_SKILLS_INDEX_ROUTE as x, DEFAULT_API_CATALOG_ROUTE as y, buildDocsA2AAgentCard as z };