@vallum/registry 0.0.0-prerelease → 0.0.1-prerelease.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.
- package/dist/a2aCard.d.ts +3 -1
- package/dist/a2aCard.js +10 -2
- package/package.json +1 -1
package/dist/a2aCard.d.ts
CHANGED
|
@@ -27,7 +27,9 @@ export interface A2AAgentCapabilities {
|
|
|
27
27
|
readonly extendedAgentCard?: boolean;
|
|
28
28
|
}
|
|
29
29
|
export interface A2ASecurityRequirement {
|
|
30
|
-
readonly schemes: Record<string,
|
|
30
|
+
readonly schemes: Record<string, {
|
|
31
|
+
readonly list?: readonly string[];
|
|
32
|
+
}>;
|
|
31
33
|
}
|
|
32
34
|
export type A2ASecurityScheme = {
|
|
33
35
|
readonly apiKeySecurityScheme: {
|
package/dist/a2aCard.js
CHANGED
|
@@ -28,7 +28,7 @@ export function createA2AAgentCardFromProfile(value, options = {}) {
|
|
|
28
28
|
const securitySchemeName = nonEmptyString(options.securitySchemeName ?? "vallumBearer", "$.securitySchemeName");
|
|
29
29
|
const securitySchemes = options.securitySchemes ?? defaultSecuritySchemes(securitySchemeName);
|
|
30
30
|
assertValidSecuritySchemes(securitySchemes);
|
|
31
|
-
const securityRequirements = options.securityRequirements ?? [{ schemes: { [securitySchemeName]: [] } }];
|
|
31
|
+
const securityRequirements = options.securityRequirements ?? [{ schemes: { [securitySchemeName]: { list: [] } } }];
|
|
32
32
|
assertValidSecurityRequirements(securityRequirements, securitySchemes);
|
|
33
33
|
const profile = validation.profile;
|
|
34
34
|
const card = {
|
|
@@ -230,12 +230,20 @@ function assertValidSecurityRequirements(requirements, schemes) {
|
|
|
230
230
|
throw new A2AAgentCardError("A2A_SECURITY_SCHEME_INVALID", "A2A security requirements must declare scheme scopes.", `$.securityRequirements[${index}].schemes`);
|
|
231
231
|
}
|
|
232
232
|
for (const [schemeName, scopes] of Object.entries(requirement.schemes)) {
|
|
233
|
-
if (!knownSchemes.has(schemeName) || !
|
|
233
|
+
if (!knownSchemes.has(schemeName) || !isStringListWrapper(scopes)) {
|
|
234
234
|
throw new A2AAgentCardError("A2A_SECURITY_SCHEME_INVALID", "A2A security requirements must reference declared security schemes.", `$.securityRequirements[${index}].schemes.${schemeName}`);
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
|
+
function isStringListWrapper(value) {
|
|
240
|
+
return isRecord(value)
|
|
241
|
+
&& Object.keys(value).every((key) => key === "list")
|
|
242
|
+
&& isOptionalStringList(value.list);
|
|
243
|
+
}
|
|
244
|
+
function isOptionalStringList(value) {
|
|
245
|
+
return value === undefined || (Array.isArray(value) && value.every((item) => typeof item === "string"));
|
|
246
|
+
}
|
|
239
247
|
function assertNoPrivateProfileFields(value, path = "$") {
|
|
240
248
|
if (Array.isArray(value)) {
|
|
241
249
|
value.forEach((child, index) => assertNoPrivateProfileFields(child, `${path}[${index}]`));
|