@adcp/sdk 13.0.2 → 13.0.4
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/bin/adcp.js +37 -2
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/decisioning/capabilities.d.mts +5 -5
- package/dist/lib/server/decisioning/capabilities.d.ts +5 -5
- package/dist/lib/server/decisioning/capabilities.js.map +1 -1
- package/dist/lib/server/decisioning/capabilities.mjs.map +1 -1
- package/dist/lib/testing/client.d.ts.map +1 -1
- package/dist/lib/testing/client.js +6 -2
- package/dist/lib/testing/client.js.map +1 -1
- package/dist/lib/testing/client.mjs +6 -2
- package/dist/lib/testing/client.mjs.map +1 -1
- package/dist/lib/testing/compliance/comply.d.ts.map +1 -1
- package/dist/lib/testing/compliance/comply.js +27 -18
- package/dist/lib/testing/compliance/comply.js.map +1 -1
- package/dist/lib/testing/compliance/comply.mjs +25 -17
- package/dist/lib/testing/compliance/comply.mjs.map +1 -1
- package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/runner.js +18 -4
- package/dist/lib/testing/storyboard/runner.js.map +1 -1
- package/dist/lib/testing/storyboard/runner.mjs +18 -4
- package/dist/lib/testing/storyboard/runner.mjs.map +1 -1
- package/dist/lib/testing/storyboard/types.d.mts +83 -29
- package/dist/lib/testing/storyboard/types.d.ts +83 -29
- package/dist/lib/testing/storyboard/types.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/types.js.map +1 -1
- package/dist/lib/testing/storyboard/types.mjs.map +1 -1
- package/dist/lib/testing/storyboard/validations.d.mts +3 -1
- package/dist/lib/testing/storyboard/validations.d.ts +3 -1
- package/dist/lib/testing/storyboard/validations.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/validations.js +83 -23
- package/dist/lib/testing/storyboard/validations.js.map +1 -1
- package/dist/lib/testing/storyboard/validations.mjs +83 -24
- package/dist/lib/testing/storyboard/validations.mjs.map +1 -1
- package/dist/lib/testing/types.d.mts +11 -0
- package/dist/lib/testing/types.d.ts +11 -0
- package/dist/lib/testing/types.d.ts.map +1 -1
- package/dist/lib/testing/types.js.map +1 -1
- package/dist/lib/validation/schema-loader.d.ts.map +1 -1
- package/dist/lib/validation/schema-loader.js +9 -0
- package/dist/lib/validation/schema-loader.js.map +1 -1
- package/dist/lib/validation/schema-loader.mjs +8 -0
- package/dist/lib/validation/schema-loader.mjs.map +1 -1
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.js.map +1 -1
- package/dist/lib/version.mjs +3 -3
- package/dist/lib/version.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -23,6 +23,8 @@ export interface ValidationContext {
|
|
|
23
23
|
adcpVersion?: string;
|
|
24
24
|
/** Server-declared AdCP version to use for response-shape compatibility decisions. */
|
|
25
25
|
responseAdcpVersion?: string;
|
|
26
|
+
/** Make a strict AJV response-schema rejection fail the validation. */
|
|
27
|
+
strictResponseSchemaValidation?: boolean;
|
|
26
28
|
taskResult?: TaskResult;
|
|
27
29
|
httpResult?: HttpProbeResult;
|
|
28
30
|
agentUrl: string;
|
|
@@ -195,7 +197,7 @@ export interface UpstreamTrafficQueryResult {
|
|
|
195
197
|
*/
|
|
196
198
|
export declare function runValidations(validations: StoryboardValidation[], context: ValidationContext): ValidationResult[];
|
|
197
199
|
/** Capability semver emitted in run summaries and used for advisory expiry. */
|
|
198
|
-
export declare const RUNNER_CAPABILITY_VERSION = "13.0.
|
|
200
|
+
export declare const RUNNER_CAPABILITY_VERSION = "13.0.4";
|
|
199
201
|
/** True when a failed validation contributes to the owning step's grade. */
|
|
200
202
|
export declare function validationFailsStep(result: ValidationResult): boolean;
|
|
201
203
|
/**
|
|
@@ -23,6 +23,8 @@ export interface ValidationContext {
|
|
|
23
23
|
adcpVersion?: string;
|
|
24
24
|
/** Server-declared AdCP version to use for response-shape compatibility decisions. */
|
|
25
25
|
responseAdcpVersion?: string;
|
|
26
|
+
/** Make a strict AJV response-schema rejection fail the validation. */
|
|
27
|
+
strictResponseSchemaValidation?: boolean;
|
|
26
28
|
taskResult?: TaskResult;
|
|
27
29
|
httpResult?: HttpProbeResult;
|
|
28
30
|
agentUrl: string;
|
|
@@ -195,7 +197,7 @@ export interface UpstreamTrafficQueryResult {
|
|
|
195
197
|
*/
|
|
196
198
|
export declare function runValidations(validations: StoryboardValidation[], context: ValidationContext): ValidationResult[];
|
|
197
199
|
/** Capability semver emitted in run summaries and used for advisory expiry. */
|
|
198
|
-
export declare const RUNNER_CAPABILITY_VERSION = "13.0.
|
|
200
|
+
export declare const RUNNER_CAPABILITY_VERSION = "13.0.4";
|
|
199
201
|
/** True when a failed validation contributes to the owning step's grade. */
|
|
200
202
|
export declare function validationFailsStep(result: ValidationResult): boolean;
|
|
201
203
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validations.d.ts","sourceRoot":"","sources":["../../../../src/lib/testing/storyboard/validations.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EAEpB,iBAAiB,EACjB,oBAAoB,EAGpB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAgB,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAe/E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAGtE;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sFAAsF;IACtF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,e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0BAA0B;IACzC,OAAO,EAAE,mBAAmB,CAAC;IAC7B,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,4FAA4F;IAC5F,OAAO,EAAE,sBAAsB,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,oBAAoB,EAAE,EAAE,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,EAAE,CAElH;AAED,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB,WAAkB,CAAC;AAEzD,4EAA4E;AAC5E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAErE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,iBAAiB,EAC1B,UAAU,EAAE,oBAAoB,GAC/B,gBAAgB,CAqBlB;AA8iBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAE3F;AAED,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AA6+FzD,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -22,6 +22,7 @@ __export(validations_exports, {
|
|
|
22
22
|
RUNNER_CAPABILITY_VERSION: () => RUNNER_CAPABILITY_VERSION,
|
|
23
23
|
decorateValidationResult: () => decorateValidationResult,
|
|
24
24
|
detectShapeDriftHint: () => detectShapeDriftHint,
|
|
25
|
+
isExternalResponseSchemaAuthoritative: () => isExternalResponseSchemaAuthoritative,
|
|
25
26
|
resolvePath: () => import_path2.resolvePath,
|
|
26
27
|
runValidations: () => runValidations,
|
|
27
28
|
validationFailsStep: () => validationFailsStep
|
|
@@ -200,10 +201,10 @@ function resolveTarget(ctx) {
|
|
|
200
201
|
return { success: false, data: void 0 };
|
|
201
202
|
}
|
|
202
203
|
const SCHEMA_URL_BASE = "https://adcontextprotocol.org";
|
|
203
|
-
function resolveSchemaIdentity(schemaRef) {
|
|
204
|
+
function resolveSchemaIdentity(schemaRef, adcpVersion = import_version.ADCP_VERSION) {
|
|
204
205
|
if (!schemaRef) return { schema_id: null, schema_url: null };
|
|
205
206
|
const trimmed = schemaRef.replace(/^\/+/, "");
|
|
206
|
-
const schemaId = `/schemas/${
|
|
207
|
+
const schemaId = `/schemas/${adcpVersion}/${trimmed}`;
|
|
207
208
|
const schemaUrl = `${SCHEMA_URL_BASE}${schemaId}`;
|
|
208
209
|
return { schema_id: schemaId, schema_url: schemaUrl };
|
|
209
210
|
}
|
|
@@ -256,34 +257,54 @@ function mapZodIssueToSchemaKeyword(issue) {
|
|
|
256
257
|
}
|
|
257
258
|
function validateResponseSchema(validation, ctx, taskResult) {
|
|
258
259
|
const taskName = ctx.taskName;
|
|
259
|
-
const
|
|
260
|
-
const
|
|
261
|
-
if (!schema) {
|
|
262
|
-
return {
|
|
263
|
-
check: "response_schema",
|
|
264
|
-
passed: false,
|
|
265
|
-
description: validation.description,
|
|
266
|
-
error: `No schema registered for task "${taskName}"`,
|
|
267
|
-
json_pointer: null,
|
|
268
|
-
expected: schema_id ?? `response schema for ${taskName}`,
|
|
269
|
-
// The runner failed before observing the agent — distinguish that from
|
|
270
|
-
// "agent returned null" so implementors don't chase a phantom agent bug.
|
|
271
|
-
actual: { reason: "no_schema_registered", task: taskName },
|
|
272
|
-
schema_id,
|
|
273
|
-
schema_url
|
|
274
|
-
};
|
|
275
|
-
}
|
|
260
|
+
const schemaIdentityVersion = ctx.adcpVersion ?? ctx.responseAdcpVersion ?? import_version.ADCP_VERSION;
|
|
261
|
+
const { schema_id, schema_url } = resolveSchemaIdentity(ctx.responseSchemaRef, schemaIdentityVersion);
|
|
276
262
|
const rawData = taskResult.data ?? {};
|
|
277
263
|
const dataWithoutMessage = Array.isArray(rawData) ? rawData : (() => {
|
|
278
264
|
const { _message, ...rest } = rawData;
|
|
279
265
|
return rest;
|
|
280
266
|
})();
|
|
267
|
+
const schema = import_response_schemas.TOOL_RESPONSE_SCHEMAS[taskName];
|
|
281
268
|
const dataForValidation = Array.isArray(dataWithoutMessage) ? dataWithoutMessage : (0, import_envelope_status_compat.injectLegacyEnvelopeStatus)(dataWithoutMessage, { toolName: taskName });
|
|
282
269
|
const responseAdcpVersion = ctx.responseAdcpVersion ?? ctx.adcpVersion;
|
|
283
|
-
const parseResult = schema
|
|
270
|
+
const parseResult = schema?.safeParse(
|
|
284
271
|
(0, import_response_schemas.prepareResponseForSchemaValidation)(taskName, dataForValidation, responseAdcpVersion)
|
|
285
272
|
);
|
|
286
|
-
const
|
|
273
|
+
const computedStrict = computeStrictVerdict(taskName, dataWithoutMessage, ctx.adcpVersion, ctx.responseAdcpVersion);
|
|
274
|
+
const strict = computedStrict ? { ...computedStrict, lenient_valid: parseResult?.success ?? null } : void 0;
|
|
275
|
+
const externalSchemaIsAuthoritative = isExternalResponseSchemaAuthoritative(ctx);
|
|
276
|
+
if (externalSchemaIsAuthoritative && strict) {
|
|
277
|
+
if (strict.valid) {
|
|
278
|
+
const base = {
|
|
279
|
+
check: "response_schema",
|
|
280
|
+
passed: true,
|
|
281
|
+
description: validation.description,
|
|
282
|
+
schema_id,
|
|
283
|
+
schema_url,
|
|
284
|
+
strict
|
|
285
|
+
};
|
|
286
|
+
const warning = buildStrictWarning(strict);
|
|
287
|
+
return warning ? { ...base, warning } : base;
|
|
288
|
+
}
|
|
289
|
+
const issues2 = strict.issues ?? [];
|
|
290
|
+
const firstIssue2 = issues2[0];
|
|
291
|
+
return {
|
|
292
|
+
check: "response_schema",
|
|
293
|
+
passed: false,
|
|
294
|
+
description: validation.description,
|
|
295
|
+
error: issues2.length > 0 ? issues2.slice(0, 5).map((issue) => `${issue.instance_path || "/"}: ${issue.message}`).join("; ") : `External JSON Schema rejected the ${taskName} response`,
|
|
296
|
+
json_pointer: firstIssue2?.instance_path || null,
|
|
297
|
+
expected: schema_id ?? `response schema for ${taskName}`,
|
|
298
|
+
actual: issues2,
|
|
299
|
+
schema_id,
|
|
300
|
+
schema_url,
|
|
301
|
+
strict
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
if (!schema) {
|
|
305
|
+
return noResponseSchemaResult(validation, taskName, schema_id, schema_url, strict);
|
|
306
|
+
}
|
|
307
|
+
if (!parseResult) return noResponseSchemaResult(validation, taskName, schema_id, schema_url, strict);
|
|
287
308
|
if (parseResult.success) {
|
|
288
309
|
const base = {
|
|
289
310
|
check: "response_schema",
|
|
@@ -292,6 +313,19 @@ function validateResponseSchema(validation, ctx, taskResult) {
|
|
|
292
313
|
schema_id,
|
|
293
314
|
schema_url
|
|
294
315
|
};
|
|
316
|
+
if (strict && !strict.valid && ctx.strictResponseSchemaValidation === true) {
|
|
317
|
+
const issues2 = strict.issues ?? [];
|
|
318
|
+
const firstIssue2 = issues2[0];
|
|
319
|
+
return {
|
|
320
|
+
...base,
|
|
321
|
+
passed: false,
|
|
322
|
+
error: issues2.length > 0 ? issues2.slice(0, 5).map((issue) => `${issue.instance_path || "/"}: ${issue.message}`).join("; ") : `Strict JSON Schema rejected the ${taskName} response`,
|
|
323
|
+
json_pointer: firstIssue2?.instance_path || null,
|
|
324
|
+
expected: schema_id ?? `response schema for ${taskName}`,
|
|
325
|
+
actual: issues2,
|
|
326
|
+
strict
|
|
327
|
+
};
|
|
328
|
+
}
|
|
295
329
|
const warning = strict ? buildStrictWarning(strict) : void 0;
|
|
296
330
|
if (!strict && !warning) return base;
|
|
297
331
|
if (!strict) return { ...base, warning };
|
|
@@ -314,9 +348,34 @@ function validateResponseSchema(validation, ctx, taskResult) {
|
|
|
314
348
|
};
|
|
315
349
|
return strict ? { ...failed, strict } : failed;
|
|
316
350
|
}
|
|
351
|
+
function isExternalResponseSchemaAuthoritative(ctx) {
|
|
352
|
+
const validationVersion = responseSchemaValidationVersion(ctx.adcpVersion, ctx.responseAdcpVersion);
|
|
353
|
+
return validationVersion !== void 0 && (0, import_schema_loader.isExternalSchemaRootActive)(validationVersion);
|
|
354
|
+
}
|
|
355
|
+
function responseSchemaValidationVersion(adcpVersion, responseAdcpVersion) {
|
|
356
|
+
if (adcpVersion && (0, import_schema_loader.isExternalSchemaRootActive)(adcpVersion)) return adcpVersion;
|
|
357
|
+
return responseAdcpVersion && (0, import_schema_loader.hasSchemaBundle)(responseAdcpVersion) ? responseAdcpVersion : adcpVersion;
|
|
358
|
+
}
|
|
359
|
+
function noResponseSchemaResult(validation, taskName, schema_id, schema_url, strict) {
|
|
360
|
+
const result = {
|
|
361
|
+
check: "response_schema",
|
|
362
|
+
passed: false,
|
|
363
|
+
description: validation.description,
|
|
364
|
+
error: `No schema registered for task "${taskName}"`,
|
|
365
|
+
json_pointer: null,
|
|
366
|
+
expected: schema_id ?? `response schema for ${taskName}`,
|
|
367
|
+
// The runner failed before observing the agent — distinguish that from
|
|
368
|
+
// "agent returned null" so implementors don't chase a phantom agent bug.
|
|
369
|
+
actual: { reason: "no_schema_registered", task: taskName },
|
|
370
|
+
schema_id,
|
|
371
|
+
schema_url
|
|
372
|
+
};
|
|
373
|
+
return strict ? { ...result, strict } : result;
|
|
374
|
+
}
|
|
317
375
|
function computeStrictVerdict(taskName, payload, adcpVersion, responseAdcpVersion) {
|
|
318
|
-
const
|
|
319
|
-
|
|
376
|
+
const externalVersionSelected = adcpVersion !== void 0 && (0, import_schema_loader.isExternalSchemaRootActive)(adcpVersion);
|
|
377
|
+
const validationVersion = responseSchemaValidationVersion(adcpVersion, responseAdcpVersion);
|
|
378
|
+
if (!externalVersionSelected && responseAdcpVersion && (0, import_adcp_version_config.isPre31AdcpVersion)(responseAdcpVersion) && !(0, import_schema_loader.hasSchemaBundle)(responseAdcpVersion)) {
|
|
320
379
|
return void 0;
|
|
321
380
|
}
|
|
322
381
|
const payloadForValidation = (0, import_response_schemas.prepareResponseForSchemaValidation)(taskName, payload, responseAdcpVersion);
|
|
@@ -2562,6 +2621,7 @@ function validateCrossResponseCountDistinct(validation, ctx) {
|
|
|
2562
2621
|
RUNNER_CAPABILITY_VERSION,
|
|
2563
2622
|
decorateValidationResult,
|
|
2564
2623
|
detectShapeDriftHint,
|
|
2624
|
+
isExternalResponseSchemaAuthoritative,
|
|
2565
2625
|
resolvePath,
|
|
2566
2626
|
runValidations,
|
|
2567
2627
|
validationFailsStep
|