Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,31 @@ All notable changes are documented in this file. The format is based on
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.0] - 2026-11-27

### Added

- AWP `v1alpha4` (decision D23 of the specification): `v1alpha3` plus step
conditions (`when`, spec 3.12) and workflow steps (`type: workflow`, spec 5.6.6), with the new
diagnostics `when.syntax`, `when.limit-exceeded`, `when.forbidden-segment`, `when.unknown-root`,
`when.unknown-step`, `when.not-a-dependency`, `when.undeclared-output`, `step.workflow-output`
and the warning `when.undeclared-input`.
- `schemas.v1alpha4`, the export `./schema/v1alpha4.json` and `migrateToV1alpha4` (mechanical
migration of `v1alpha1`, `v1alpha2` and `v1alpha3` manifests).
- Tests run the `v1alpha4` conformance suite and examples against the Node.js build and the
browser bundle.

### Changed

- **Breaking:** `v1alpha4` is the current draft (decision D24 of the specification). `API_VERSION`,
the default `schema` and the export `./schema.json` are now `v1alpha4`; an unsupported
`apiVersion` is checked against `v1alpha4` and rejected at `/apiVersion`. Use
`./schema/v1alpha3.json` or `schemas.v1alpha3` for the previous default.
- `v1alpha1`, `v1alpha2` and `v1alpha3` documents are validated exactly as before, against the
schema of their own `apiVersion`. The vendored specification includes `conformance/conditions.mjs`
and is updated to commit `058c267` (D23 merged); D24 changes no vendored schema or rule.
- The website starts with a `v1alpha4` manifest and shows the `v1alpha4` examples.

## [0.3.0] - 2026-11-25

### Changed
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
[![npm](https://img.shields.io/npm/v/@agenticworkflowprotocol/validator?label=npm)](https://www.npmjs.com/package/@agenticworkflowprotocol/validator) [![ci](https://github.com/agenticworkflowprotocol/awp-validator/actions/workflows/ci.yml/badge.svg)](https://github.com/agenticworkflowprotocol/awp-validator/actions/workflows/ci.yml) [![license](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)

Reference validator for [Agentic Workflow Protocol (AWP)](https://agenticworkflowprotocol.org)
manifests: the YAML restrictions, the JSON Schema and the semantic rules of AWP `v1alpha3` (the
current draft), `v1alpha2` and `v1alpha1` (each document is checked against the schema of its own
manifests: the YAML restrictions, the JSON Schema and the semantic rules of AWP `v1alpha4` (the
current draft: `v1alpha3` plus step conditions `when` and workflow steps), `v1alpha3`, `v1alpha2`
and `v1alpha1` (each document is checked against the schema of its own
`apiVersion`), per
conformance profile, with digest verification and machine-readable diagnostics.

Expand Down Expand Up @@ -82,10 +83,10 @@ Diagnostics follow [section 3 of the CLI output formats](https://github.com/agen
`severity`, `code` (stable), `message`, `path` (JSON Pointer), `section`, `document`, `source`.

Further exports: `formatText`, `formatJson` (the `awp validate` formats), `manifestDigest`, `jcs`,
`migrateToV1alpha3`, `schemas` (by API version), `schema` (current draft `v1alpha3`), `provenance`, `KNOWN_PROFILES`, `API_VERSIONS`. Each
`migrateToV1alpha3`, `migrateToV1alpha4` (from every older version), `schemas` (by API version), `schema` (current draft `v1alpha4`), `provenance`, `KNOWN_PROFILES`, `API_VERSIONS`. Each
document result carries `awp`, the API version it was validated as. Types are included
(`types/index.d.ts`). The schema files are also available as
`@agenticworkflowprotocol/validator/schema/v1alpha1.json`, `.../schema/v1alpha2.json`, `.../schema/v1alpha3.json` and
`@agenticworkflowprotocol/validator/schema/v1alpha1.json`, `.../schema/v1alpha2.json`, `.../schema/v1alpha3.json`, `.../schema/v1alpha4.json` and
`.../schema.json` (current draft).

### Embedding in a runtime
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agenticworkflowprotocol/validator",
"version": "0.3.0",
"version": "0.4.0",
"description": "Reference validator and CLI for Agentic Workflow Protocol (AWP) manifests: YAML rules, JSON Schema and semantic checks per conformance profile, digest verification and machine-readable diagnostics.",
"license": "Apache-2.0",
"type": "module",
Expand Down Expand Up @@ -35,10 +35,11 @@
"types": "./types/index.d.ts",
"default": "./dist/browser/awp-validator.mjs"
},
"./schema.json": "./vendor/awp/schema/awp.v1alpha3.json",
"./schema.json": "./vendor/awp/schema/awp.v1alpha4.json",
"./schema/v1alpha1.json": "./vendor/awp/schema/awp.v1alpha1.json",
"./schema/v1alpha2.json": "./vendor/awp/schema/awp.v1alpha2.json",
"./schema/v1alpha3.json": "./vendor/awp/schema/awp.v1alpha3.json",
"./schema/v1alpha4.json": "./vendor/awp/schema/awp.v1alpha4.json",
"./provenance.json": "./vendor/awp/PROVENANCE.json",
"./package.json": "./package.json"
},
Expand Down
1 change: 1 addition & 0 deletions scripts/sync-spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const SOURCES = [
...API_VERSIONS.map((v) => `schema/awp.${v}.json`),
'conformance/semantic.mjs',
'conformance/human-input.mjs',
'conformance/conditions.mjs',
'conformance/migrate.mjs',
'conformance/index.json',
'conformance/valid',
Expand Down
2 changes: 1 addition & 1 deletion site/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { KNOWN_PROFILES, formatJson, isOk, validateText } from './lib/awp-valida

const SPEC_URL = 'https://agenticworkflowprotocol.org/specification/';
const DEBOUNCE_MS = 300;
const STARTER = `apiVersion: awp.agenticworkflowprotocol.org/v1alpha3
const STARTER = `apiVersion: awp.agenticworkflowprotocol.org/v1alpha4
kind: Workflow
metadata:
name: hello-workflow
Expand Down
5 changes: 3 additions & 2 deletions src/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import * as schemaValidators from '../build/schema-validator.mjs';
import v1alpha1 from '../vendor/awp/schema/awp.v1alpha1.json';
import v1alpha2 from '../vendor/awp/schema/awp.v1alpha2.json';
import v1alpha3 from '../vendor/awp/schema/awp.v1alpha3.json';
import v1alpha4 from '../vendor/awp/schema/awp.v1alpha4.json';
import provenanceJson from '../vendor/awp/PROVENANCE.json';
import { createValidator } from './validator.js';
import { API_VERSION } from './versions.js';
export { API_VERSION, API_VERSIONS, KNOWN_PROFILES, UsageError, resolveProfiles, summarize } from './validator.js';
export { jcs, manifestDigest } from '../vendor/awp/conformance/semantic.mjs';
export { migrateToV1alpha3 } from '../vendor/awp/conformance/migrate.mjs';
export { migrateToV1alpha3, migrateToV1alpha4 } from '../vendor/awp/conformance/migrate.mjs';
export { formatDiagnostic, formatJson, formatText, isOk } from './format.js';
export const schemas = { v1alpha1, v1alpha2, v1alpha3 };
export const schemas = { v1alpha1, v1alpha2, v1alpha3, v1alpha4 };
export const schema = schemas[API_VERSION]; // the current draft
export const provenance = provenanceJson;
export const { validateManifest, validateText } = createValidator({ schemaValidators });
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { API_VERSION, API_VERSIONS } from './versions.js';

export { API_VERSION, API_VERSIONS, KNOWN_PROFILES, UsageError, resolveProfiles, summarize } from './validator.js';
export { jcs, manifestDigest } from '../vendor/awp/conformance/semantic.mjs';
export { migrateToV1alpha3 } from '../vendor/awp/conformance/migrate.mjs';
export { migrateToV1alpha3, migrateToV1alpha4 } from '../vendor/awp/conformance/migrate.mjs';
export { formatDiagnostic, formatJson, formatText, isOk } from './format.js';

const vendor = new URL('../vendor/awp/', import.meta.url);
Expand Down
4 changes: 2 additions & 2 deletions src/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// uses a precompiled one (no eval). Results follow the diagnostics of the AWP CLI output formats,
// section 3 (docs/cli.md in the specification repository).
import { KNOWN_PROFILES, semanticCheck } from '../vendor/awp/conformance/semantic.mjs';
import { versionOf } from './versions.js';
import { API_VERSIONS, versionOf } from './versions.js';
import { loadDocuments, positionAt, positionOf } from './yaml.js';

export { API_VERSION, API_VERSIONS } from './versions.js';
Expand Down Expand Up @@ -58,7 +58,7 @@ function identity(value) {
const meta = value.metadata && typeof value.metadata === 'object' ? value.metadata : {};
const spec = value.spec && typeof value.spec === 'object' ? value.spec : {};
// From v1alpha3 on the version is a spec field (Kubernetes resource model, spec 4.2).
const version = versionOf(value) === 'v1alpha3' ? spec.version : meta.version;
const version = API_VERSIONS.indexOf(versionOf(value)) >= API_VERSIONS.indexOf('v1alpha3') ? spec.version : meta.version;
return {
...(typeof value.kind === 'string' ? { kind: value.kind } : {}),
...(typeof meta.name === 'string' ? { name: meta.name } : {}),
Expand Down
6 changes: 3 additions & 3 deletions src/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
// v1alpha1, vendor/awp/conformance/<v>/ for later versions); the semantic rules are shared.

/** Supported API versions, oldest first. */
export const API_VERSIONS = ['v1alpha1', 'v1alpha2', 'v1alpha3'];
export const API_VERSIONS = ['v1alpha1', 'v1alpha2', 'v1alpha3', 'v1alpha4'];

/**
* The current draft (decision D22 of the specification): the default schema export, the version an
* The current draft (decision D24 of the specification): the default schema export, the version an
* unsupported apiVersion is checked against, and the examples of the website.
*/
export const API_VERSION = 'v1alpha3';
export const API_VERSION = 'v1alpha4';

const API_GROUP = 'awp.agenticworkflowprotocol.org/';

Expand Down
41 changes: 34 additions & 7 deletions test/api.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'node:assert/strict';
import { test } from 'node:test';
import { API_VERSION, API_VERSIONS, KNOWN_PROFILES, UsageError, migrateToV1alpha3, provenance, schema, schemas, validateManifest, validateText } from '../src/index.js';
import { API_VERSION, API_VERSIONS, KNOWN_PROFILES, UsageError, migrateToV1alpha3, migrateToV1alpha4, provenance, schema, schemas, validateManifest, validateText } from '../src/index.js';
import { parse as parseFirst, stringify } from 'yaml';

const VALID = `apiVersion: awp.agenticworkflowprotocol.org/v1alpha1
Expand Down Expand Up @@ -38,13 +38,13 @@ const ITERATING = `${V2.trimEnd()}
`;

test('each document is validated against the schema of its own apiVersion', () => {
assert.deepEqual(API_VERSIONS, ['v1alpha1', 'v1alpha2', 'v1alpha3']);
assert.deepEqual(API_VERSIONS, ['v1alpha1', 'v1alpha2', 'v1alpha3', 'v1alpha4']);
assert.equal(validateText(V2).documents[0].awp, 'v1alpha2');
assert.equal(validateText(V2).documents[0].valid, true);
// A document in the layout of the current draft with an unsupported apiVersion: only the version is wrong.
const current = stringify(migrateToV1alpha3(parseFirst(VALID)).document);
const unknown = validateText(current.replace('/v1alpha3', '/v1alpha99')).documents[0];
assert.equal(unknown.awp, 'v1alpha3', 'an unsupported version is checked against the current draft');
const current = stringify(migrateToV1alpha4(parseFirst(VALID)).document);
const unknown = validateText(current.replace('/v1alpha4', '/v1alpha99')).documents[0];
assert.equal(unknown.awp, 'v1alpha4', 'an unsupported version is checked against the current draft');
assert.deepEqual(unknown.diagnostics.map((d) => [d.code, d.path]), [['schema.const', '/apiVersion']]);
});

Expand Down Expand Up @@ -108,8 +108,8 @@ test('unknown profiles are a usage error', () => {
test('schema, profiles and provenance are exported', () => {
assert.equal(schema.$schema, 'https://json-schema.org/draft/2020-12/schema');
assert.deepEqual(KNOWN_PROFILES, ['core', 'governance', 'audit', 'security', 'mcp', 'a2a', 'interaction']);
assert.equal(schema.$id, 'https://agenticworkflowprotocol.org/schema/awp.v1alpha3.json', 'the default schema is the current draft');
assert.equal(API_VERSION, 'v1alpha3');
assert.equal(schema.$id, 'https://agenticworkflowprotocol.org/schema/awp.v1alpha4.json', 'the default schema is the current draft');
assert.equal(API_VERSION, 'v1alpha4');
assert.match(provenance.source.commit, /^[0-9a-f]{40}$/);
});

Expand All @@ -129,3 +129,30 @@ test('v1alpha3: governance fields in spec, forEach as in v1alpha2, migration fro
const oldLayout = validateText(withInput.replace('/v1alpha2', '/v1alpha3')).documents[0];
assert.equal(oldLayout.valid, false);
});

test('v1alpha4: when conditions and workflow steps, migration from every older version', () => {
for (const source of [VALID, V2, stringify(migrateToV1alpha3(parseFirst(VALID)).document)]) {
const { document } = migrateToV1alpha4(parseFirst(source));
assert.equal(document.apiVersion, 'awp.agenticworkflowprotocol.org/v1alpha4');
const v4 = validateText(stringify(document)).documents[0];
assert.equal(v4.awp, 'v1alpha4');
assert.equal(v4.version, '0.1.0', 'the version comes from spec in v1alpha4');
assert.deepEqual(v4.diagnostics.filter((d) => d.severity === 'error'), []);
}
const base = migrateToV1alpha4(parseFirst(VALID)).document;
const withSteps = structuredClone(base);
withSteps.spec.workflow[0].outputs = [{ name: 'affected' }];
withSteps.spec.workflow.push(
{ id: 'fix', type: 'workflow', dependsOn: ['greet'], when: 'steps.greet.outputs.affected == true', workflow: { ref: 'cve-fixer', version: '^0.5.0', wait: true } },
);
const ok = validateText(stringify(withSteps)).documents[0];
assert.deepEqual(ok.diagnostics.filter((d) => d.severity === 'error'), []);
const notDependency = structuredClone(withSteps);
notDependency.spec.workflow[1].dependsOn = [];
const bad = validateText(stringify(notDependency)).documents[0];
assert.ok(bad.diagnostics.some((d) => d.code === 'when.not-a-dependency' && d.path === '/spec/workflow/1/when'));
// when is a v1alpha4 field: the same step is rejected in v1alpha3.
const inV3 = validateText(stringify({ ...withSteps, apiVersion: 'awp.agenticworkflowprotocol.org/v1alpha3' })).documents[0];
assert.equal(inV3.valid, false);
assert.ok(schemas.v1alpha4.$id.endsWith('awp.v1alpha4.json'));
});
2 changes: 1 addition & 1 deletion test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ test('--strict fails on warnings, --quiet prints only errors', () => {
});

test('--version and --help', () => {
assert.match(run(['--version']).out, /^awp-validator \d+\.\d+\.\d+ \(AWP v1alpha1, v1alpha2, v1alpha3, specification [0-9a-f]{7}\)\n$/);
assert.match(run(['--version']).out, /^awp-validator \d+\.\d+\.\d+ \(AWP v1alpha1, v1alpha2, v1alpha3, v1alpha4, specification [0-9a-f]{7}\)\n$/);
assert.match(run(['--help']).out, /Usage: awp validate/);
});

Expand Down
8 changes: 5 additions & 3 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Types of @agenticworkflowprotocol/validator (Node.js entry and the `./browser` entry).

/** Supported AWP API versions. */
export type ApiVersion = 'v1alpha1' | 'v1alpha2' | 'v1alpha3';
export type ApiVersion = 'v1alpha1' | 'v1alpha2' | 'v1alpha3' | 'v1alpha4';
/** Conformance profiles of AWP (spec 11.2); `interaction` exists from v1alpha3 on. */
export type Profile = 'core' | 'governance' | 'audit' | 'security' | 'mcp' | 'a2a' | 'interaction';

Expand Down Expand Up @@ -68,6 +68,8 @@ export class UsageError extends Error {}

/** Mechanical migration of a v1alpha1 or v1alpha2 manifest to v1alpha3 (spec v1alpha3 section 14). */
export function migrateToV1alpha3(manifest: unknown): { document: Record<string, unknown>; notes: string[] };
/** Mechanical migration of a v1alpha1, v1alpha2 or v1alpha3 manifest to v1alpha4 (spec v1alpha4 section 14). */
export function migrateToV1alpha4(manifest: unknown): { document: Record<string, unknown>; notes: string[] };

/** JSON Canonicalization Scheme (RFC 8785) for manifest values. */
export function jcs(value: unknown): string;
Expand All @@ -76,12 +78,12 @@ export function manifestDigest(manifest: unknown, algorithm?: 'sha256' | 'sha384

/** Supported API versions, oldest first. */
export const API_VERSIONS: ApiVersion[];
/** The latest supported API version. */
/** The current draft (`v1alpha4`, decision D24 of the specification). */
export const API_VERSION: ApiVersion;
export const KNOWN_PROFILES: Profile[];
/** The AWP JSON Schemas (draft 2020-12) used by the validator, by API version. */
export const schemas: Record<ApiVersion, Record<string, unknown>>;
/** The JSON Schema of the latest supported API version. */
/** The JSON Schema of the current draft (`API_VERSION`). */
export const schema: Record<string, unknown>;
/** Commit and file hashes of the vendored specification artefacts. */
export const provenance: {
Expand Down
Loading