From 0059e584fdb5a261a427e2bd3a537ef31bdf4d97 Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 27 Nov 2026 07:35:44 +0100 Subject: [PATCH 1/3] feat: show AWP v1alpha4 step conditions and workflow steps The specification adds v1alpha4 as the next draft (D23, spec PR #31) with `when` conditions (spec 3.12) and `type: workflow` steps (5.6.6). The view model carries `when` and the child workflow (ref, version, inputs, wait defaulting to true); the graph marks conditional steps and names the called workflow on the node, the step card shows condition, child workflow and inputs, and workflow steps expose workflow.start. v1alpha4 reads governance fields from spec like v1alpha3. The site lists the v1alpha4 examples under examples/v1alpha4/; v1alpha3 stays the current draft. The validator dependency stays at 0.3.0 until validator 0.4.0 (v1alpha4) is released, because an unreleased git dependency has no browser bundle. Signed-off-by: Erik --- CHANGELOG.md | 16 ++++++++++++++++ README.md | 3 ++- package.json | 2 +- scripts/build.mjs | 3 ++- src/model/index.js | 17 ++++++++++++++++- src/ui/render-graph.js | 20 ++++++++++++++++---- src/ui/viewer.css | 3 +++ test/browser/run.mjs | 14 +++++++++++++- test/model.test.js | 30 +++++++++++++++++++++++++++++- types/model.d.ts | 4 ++++ 10 files changed, 102 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 165685f..304fad4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,22 @@ 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`, the next draft (decision D23 of the specification). Step conditions (`when`, + spec 3.12): the view model carries `when`; the graph marks a conditional step with `if` and + names the condition in the accessible name; the step card gets a "conditional" badge and a + "When" fact. Workflow steps (`type: workflow`, spec 5.6.6): the view model carries `workflow` + (`ref`, `version`, `inputs`, `wait`, default `true`); the graph node shows the called workflow; + the step card shows the child workflow and its inputs; the step exposes the action + `workflow.start`. +- Governance fields of `v1alpha4` manifests are read from `spec`, as in `v1alpha3`. +- The website lists the `v1alpha4` examples under `examples/v1alpha4/`; `v1alpha3` stays the + current draft at `examples/`. +- Requires `@agenticworkflowprotocol/validator` 0.4.0 (`v1alpha4`). + ## [0.3.0] - 2026-11-25 ### Changed diff --git a/README.md b/README.md index 11d4c75..b2b8a8a 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ Embeddable like Swagger UI; runs entirely in the browser. - **Embed:** two Web Components, `` and ``, for applications, developer portals and documentation ([embedding guide](https://editor.agenticworkflowprotocol.org/embed.html)). -Status: alpha, like the specification (AWP `v1alpha3`, the current draft, plus `v1alpha2` and `v1alpha1`). +Status: alpha, like the specification (AWP `v1alpha3`, the current draft, the next draft `v1alpha4` +with step conditions and workflow steps, plus `v1alpha2` and `v1alpha1`). ## What the viewer shows diff --git a/package.json b/package.json index 9885b19..a8f9897 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@agenticworkflowprotocol/editor", - "version": "0.3.0", + "version": "0.4.0", "description": "Viewer and editor for Agentic Workflow Protocol (AWP) manifests: step graph, agents, tools, permissions, approvals and budgets at a glance, with live validation. Embeddable like Swagger UI; runs entirely in the browser.", "license": "Apache-2.0", "type": "module", diff --git a/scripts/build.mjs b/scripts/build.mjs index 4cad837..ba46c13 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -36,9 +36,10 @@ async function bundle(entry, out) { // Examples on the site: the current draft (v1alpha3, decision D22 of the specification) at // examples/, older versions under examples//. The current draft is also // copied to examples/v1alpha3/ without being listed, so links from the time it was a proposed -// draft keep working. +// draft keep working. The next draft (v1alpha4, decision D23) is listed under examples/v1alpha4/. const EXAMPLE_SETS = [ { version: 'v1alpha3', dir: '' }, + { version: 'v1alpha4', dir: 'v1alpha4/' }, { version: 'v1alpha2', dir: 'v1alpha2/' }, { version: 'v1alpha3', dir: 'v1alpha3/', listed: false }, ]; diff --git a/src/model/index.js b/src/model/index.js index 960f4ae..9d07c56 100644 --- a/src/model/index.js +++ b/src/model/index.js @@ -63,6 +63,8 @@ function stepOf(s, i) { approval: isObj(s.approval) ? s.approval : undefined, input: isObj(s.input) ? s.input : undefined, forEach: forEachOf(s.forEach), + when: str(s.when), + workflow: workflowCallOf(s.workflow), // v1alpha1/v1alpha2: x- keys on the step; v1alpha3: keys of the step's `extensions` object. extensions: [...Object.keys(s).filter((k) => k.startsWith('x-')), ...Object.keys(isObj(s.extensions) ? s.extensions : {})], }; @@ -79,6 +81,17 @@ function forEachOf(f) { }; } +/** Child workflow of a `type: workflow` step (v1alpha4 spec 5.6.6); `wait` defaults to true. */ +function workflowCallOf(w) { + if (!isObj(w)) return undefined; + return { + ref: str(w.ref), + version: str(w.version), + inputs: isObj(w.inputs) ? w.inputs : undefined, + wait: w.wait !== false, + }; +} + /** Every `x-` field with its JSON Pointer (spec 3.3). */ export function extensionFields(value, pointer = '') { if (Array.isArray(value)) return value.flatMap((v, i) => extensionFields(v, `${pointer}/${i}`)); @@ -127,6 +140,8 @@ export function actionsOf({ agents, steps, spec }) { if (a.form === 'remote') add(`a2a.${a.id}.send`, a.id, 'listed'); } for (const s of steps) if (s.type === 'command') add('shell.execute', `step ${s.id}`, 'listed'); + // Starting the child execution of a workflow step is an action (v1alpha4 spec 5.6.6). + for (const s of steps) if (s.type === 'workflow') add('workflow.start', `step ${s.id}`, 'listed'); return [...rows.values()].sort((x, y) => x.action.localeCompare(y.action)).map((row) => { const perAgent = row.exposedTo.map((by) => { @@ -161,7 +176,7 @@ function governanceOf(spec) { return keys.filter((k) => spec[k] !== undefined).map((k) => ({ key: k, pointer: `/spec/${k}`, value: spec[k] })); } -const KRM_VERSIONS = ['v1alpha3']; +const KRM_VERSIONS = ['v1alpha3', 'v1alpha4']; /** Whether the governance fields of a document are in spec (v1alpha3 and later). */ function usesSpecGovernance(doc) { diff --git a/src/ui/render-graph.js b/src/ui/render-graph.js index 471f334..acc38c2 100644 --- a/src/ui/render-graph.js +++ b/src/ui/render-graph.js @@ -2,7 +2,7 @@ import { NODE } from '../model/index.js'; import { badge, cell, facts, h, s, section } from './dom.js'; -const TYPE_LABEL = { agent: 'agent', command: 'command', approval: 'approval', input: 'human input' }; +const TYPE_LABEL = { agent: 'agent', command: 'command', approval: 'approval', input: 'human input', workflow: 'workflow' }; function edgePath(from, to) { const x1 = from.x + NODE.width / 2; @@ -19,6 +19,7 @@ function stepLabel(step) { if (step.type === 'command') return step.command ? `$ ${step.command}` : 'command'; if (step.type === 'approval') return 'human approval'; if (step.type === 'input') return 'human input'; + if (step.type === 'workflow') return step.workflow?.ref ? `workflow ${step.workflow.ref}` : 'workflow'; return step.agent ? `agent ${step.agent}` : 'agent'; } @@ -30,6 +31,11 @@ function forEachText(f) { return `runs once per item of ${f.items}, at most ${f.maxItems ?? '?'} items, ${f.concurrency} at a time`; } +/** Spoken and written description of a child workflow call (v1alpha4 spec 5.6.6). */ +function workflowText(w) { + return `starts workflow ${w.ref ?? '?'}${w.version ? ` ${w.version}` : ''}, ${w.wait ? 'waits for it to finish' : 'does not wait'}`; +} + /** Two offset cards behind the node box: the step runs several times. */ function stackOf(step) { if (!step.forEach) return []; @@ -53,17 +59,19 @@ export function renderGraph(model, ctx) { const step = steps.get(n.id); const problems = ctx.problemsAt(step.pointer); const iteration = step.forEach ? `, ${forEachText(step.forEach)}` : ''; - const label = `Step ${step.id}, ${stepLabel(step)}${iteration}${step.dependsOn.length ? `, after ${step.dependsOn.join(', ')}` : ''}${problems ? `, ${problems} problem${problems === 1 ? '' : 's'}` : ''}`; + const condition = step.when ? `, only when ${step.when}` : ''; + const label = `Step ${step.id}, ${stepLabel(step)}${iteration}${condition}${step.dependsOn.length ? `, after ${step.dependsOn.join(', ')}` : ''}${problems ? `, ${problems} problem${problems === 1 ? '' : 's'}` : ''}`; const activate = () => ctx.select(step.pointer); return s('g', { - class: ['node', `type-${step.type}`, step.forEach ? 'for-each' : null, problems ? 'has-problems' : null], 'data-pointer': step.pointer, tabindex: 0, role: 'button', 'aria-label': label, + class: ['node', `type-${step.type}`, step.forEach ? 'for-each' : null, step.when ? 'conditional' : null, problems ? 'has-problems' : null], 'data-pointer': step.pointer, tabindex: 0, role: 'button', 'aria-label': label, transform: `translate(${n.x} ${n.y})`, onclick: activate, onkeydown: (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); activate(); } }, }, stackOf(step), s('rect', { class: 'node-box', width: NODE.width, height: NODE.height, rx: 8 }), - s('text', { class: 'node-title', x: 12, y: 22 }, truncate(step.id, 22)), + s('text', { class: 'node-title', x: 12, y: 22 }, truncate(step.id, step.when ? 19 : 22)), s('text', { class: 'node-sub', x: 12, y: 41 }, truncate(stepLabel(step), step.forEach ? 17 : 26)), step.forEach ? s('text', { class: 'node-each', x: NODE.width - 10, y: 41, 'text-anchor': 'end' }, forEachMark(step.forEach)) : null, + step.when ? s('text', { class: 'node-when', x: NODE.width - 10, y: 22, 'text-anchor': 'end' }, 'if') : null, problems ? s('circle', { class: 'node-alert', cx: NODE.width - 12, cy: 12, r: 6 }) : null, s('title', {}, label)); }); @@ -78,9 +86,13 @@ export function renderSteps(model, ctx) { const cards = model.steps.map((st) => h('article', { class: ['card', ctx.problemsAt(st.pointer) ? 'has-problems' : null], 'data-pointer': st.pointer }, h('h3', {}, h('button', { type: 'button', class: 'link', onclick: () => ctx.navigate(st.pointer) }, st.id), ' ', badge(TYPE_LABEL[st.type] ?? st.type, `type-${st.type}`), st.forEach ? [' ', badge('for each', 'for-each', 'iteration over a list (spec 5.6.4)')] : null, + st.when ? [' ', badge('conditional', 'when', 'runs only when its condition is true (spec 3.12)')] : null, st.extensions.map((x) => badge(x, 'ext', 'extension field (spec 3.3)'))), facts([ + ['When', st.when ? h('code', {}, st.when) : undefined], ['For each', st.forEach ? forEachText(st.forEach) : undefined], + ['Workflow', st.workflow ? workflowText(st.workflow) : undefined], + ['Workflow inputs', st.workflow?.inputs], ['Agent', st.agent], ['Task', st.task], ['Command', st.command ? h('code', {}, st.command) : undefined], diff --git a/src/ui/viewer.css b/src/ui/viewer.css index e56e382..b868142 100644 --- a/src/ui/viewer.css +++ b/src/ui/viewer.css @@ -62,6 +62,7 @@ pre { margin: 0; white-space: pre-wrap; word-break: break-word; background: var( .badge.kind { color: var(--awp-accent); border-color: var(--awp-accent); background: transparent; } .badge.ext { font-family: var(--awp-mono); font-weight: 500; } .badge.for-each { color: var(--awp-accent); border-color: var(--awp-accent); background: transparent; } +.badge.when { color: var(--awp-warn); border-color: var(--awp-warn); background: transparent; } .badge + .badge { margin-left: 0.3rem; } .section { margin-top: 1.5rem; } @@ -89,6 +90,7 @@ h3 button.link { font-weight: 700; } .node-box { fill: var(--awp-bg); stroke: var(--awp-line); stroke-width: 1.5; } .node.type-command .node-box { stroke-dasharray: 5 3; } .node.type-approval .node-box { stroke: var(--awp-warn); } +.node.type-workflow .node-box { stroke-width: 3; } .node.has-problems .node-box { stroke: var(--awp-bad); } .node:hover .node-box, .node:focus-visible .node-box { stroke: var(--awp-accent); stroke-width: 2.5; } .node:focus-visible { outline: none; } @@ -98,6 +100,7 @@ h3 button.link { font-weight: 700; } .node-alert { fill: var(--awp-bad); } /* Iterating step (spec 5.6.4): stacked cards and a bound such as "each ≤20". */ .node-stack { fill: var(--awp-panel); stroke: var(--awp-line); stroke-width: 1.5; } +.node-when { font-size: 11px; font-weight: 700; fill: var(--awp-warn); font-family: var(--awp-mono); } .node-each { font-size: 11px; font-weight: 600; fill: var(--awp-accent); font-family: var(--awp-mono); } .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 0.75rem; } diff --git a/test/browser/run.mjs b/test/browser/run.mjs index 7f85c21..6fca8f1 100644 --- a/test/browser/run.mjs +++ b/test/browser/run.mjs @@ -133,6 +133,18 @@ const viewerText = (p, selector) => p.evaluate((sel) => { check(errors.length === 0, 'viewer renders v1alpha3 without errors'); await close(); } +{ + // v1alpha4 (next draft): conditional workflow step with the called workflow on the node. + const { p, errors, close } = await page('viewer.html?url=examples/v1alpha4/cve-risk-then-fix.yaml'); + await p.waitForFunction(() => document.querySelector('awp-viewer')?.shadowRoot?.querySelector('.title')); + check((await viewerText(p, '.node.type-workflow .node-sub')).join() === 'workflow cve-fixer', 'workflow step shows the called workflow'); + const label = await p.evaluate(() => document.querySelector('awp-viewer').shadowRoot.querySelector('.node.conditional').getAttribute('aria-label')); + check(label.includes('only when steps.risk.outputs.affected == true'), 'conditional step has an accessible description'); + check((await viewerText(p, '.badge.when')).length === 1, 'step card has a conditional badge'); + check((await viewerText(p, '.head .badge')).some((t) => t.startsWith('valid')), 'v1alpha4 example is valid'); + check(errors.length === 0, 'viewer renders v1alpha4 without errors'); + await close(); +} { const { p, errors, close } = await page('embed.html'); await p.waitForFunction(() => document.querySelector('awp-viewer')?.shadowRoot?.querySelector('.title')); @@ -142,7 +154,7 @@ const viewerText = (p, selector) => p.evaluate((sel) => { // 3. Accessibility of every page in both colour schemes (axe needs an inline script: bypass CSP). for (const colorScheme of ['light', 'dark']) { - for (const path of ['', 'viewer.html?url=examples/vulnerability-fixer.workflow.yaml', 'viewer.html?url=examples/v1alpha2/image-review.workflow.yaml', 'viewer.html?url=examples/vulnerability-fixer.run.yaml', 'embed.html']) { + for (const path of ['', 'viewer.html?url=examples/vulnerability-fixer.workflow.yaml', 'viewer.html?url=examples/v1alpha2/image-review.workflow.yaml', 'viewer.html?url=examples/vulnerability-fixer.run.yaml', 'viewer.html?url=examples/v1alpha4/cve-risk-then-fix.yaml', 'embed.html']) { const context = await browser.newContext({ colorScheme, bypassCSP: true }); const p = await context.newPage(); await p.goto(base + path); diff --git a/test/model.test.js b/test/model.test.js index db3baec..31dbd47 100644 --- a/test/model.test.js +++ b/test/model.test.js @@ -11,7 +11,7 @@ const examplesDir = examplesOf('v1alpha1'); const example = (name, dir = examplesDir) => readFileSync(dir + name, 'utf8'); test('every manifest example of the specification builds a model', () => { - for (const version of ['v1alpha1', 'v1alpha2', 'v1alpha3']) { + for (const version of ['v1alpha1', 'v1alpha2', 'v1alpha3', 'v1alpha4']) { const dir = examplesOf(version); const files = readdirSync(dir).filter((f) => /\.(workflow|agent|policy|run)\.yaml$/.test(f)); assert.ok(files.length >= 5, version); @@ -62,6 +62,34 @@ test('v1alpha3: input steps and extensions objects of steps', () => { assert.deepEqual(m.extensions.map((e) => e.pointer), ['/spec/workflow/0/extensions/x-step']); }); +test('cve-risk-then-fix (v1alpha4): conditional workflow step with its child workflow', () => { + const m = buildModel(parse(example('cve-risk-then-fix.yaml', examplesOf('v1alpha4')))); + assert.equal(m.governancePointer, '/spec'); + assert.equal(m.version, '0.1.0'); + const byId = Object.fromEntries(m.steps.map((s) => [s.id, s])); + assert.equal(byId.fix.type, 'workflow'); + assert.equal(byId.fix.when, 'steps.risk.outputs.affected == true'); + assert.deepEqual(byId.fix.workflow, { + ref: 'cve-fixer', + version: '^0.5.0', + inputs: { repository: '${{ inputs.repository }}', cve: '${{ inputs.cve }}' }, + wait: true, + }); + assert.equal(byId.report.when, undefined); + assert.equal(byId.report.workflow, undefined); + assert.deepEqual(m.graph.nodes.map((n) => n.level), [0, 1, 1]); + assert.deepEqual(m.actions.find((a) => a.action === 'workflow.start').exposedTo, ['step fix']); +}); + +test('workflow step: wait defaults to true, malformed payloads are tolerated', () => { + const step = (workflow) => buildModel({ apiVersion: 'awp.agenticworkflowprotocol.org/v1alpha4', kind: 'Workflow', metadata: { name: 'x' }, spec: { workflow: [{ id: 'a', type: 'workflow', when: 'true', workflow }] } }).steps[0]; + assert.deepEqual(step({ ref: 'child' }).workflow, { ref: 'child', version: undefined, inputs: undefined, wait: true }); + assert.equal(step({ ref: 'child', wait: false }).workflow.wait, false); + assert.equal(step('child').workflow, undefined); + assert.equal(step({ ref: 1, inputs: [] }).workflow.ref, undefined); + assert.equal(step({}).when, 'true'); +}); + test('forEach without concurrency defaults to one item at a time', () => { const m = buildModel({ kind: 'Workflow', metadata: { name: 'x' }, spec: { workflow: [{ id: 'a', agent: 'w', forEach: { items: '${{ inputs.files }}', maxItems: 3 } }] } }); assert.deepEqual(m.steps[0].forEach, { items: 'inputs.files', maxItems: 3, concurrency: 1 }); diff --git a/types/model.d.ts b/types/model.d.ts index 52c62d8..c84c70d 100644 --- a/types/model.d.ts +++ b/types/model.d.ts @@ -49,6 +49,10 @@ export interface Model { input?: Record; /** Iteration (v1alpha2 spec 5.6.4, v1alpha3 spec 5.6.5): `items` without `${{ }}`, for example `steps.images.outputs.refs`. */ forEach?: { items: string; maxItems?: number; concurrency: number }; + /** Condition of the step (v1alpha4 spec 3.12), for example `steps.risk.outputs.affected == true`. */ + when?: string; + /** Child workflow of a `type: workflow` step (v1alpha4 spec 5.6.6); `wait` defaults to true. */ + workflow?: { ref?: string; version?: string; inputs?: Record; wait: boolean }; [key: string]: unknown; }[]; graph: { nodes: { id: string; level: number; x: number; y: number }[]; edges: { from: string; to: string }[]; width: number; height: number }; From 950fce1cfa6c34fd429518ab1bf70217847d7436 Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 27 Nov 2026 07:48:31 +0100 Subject: [PATCH 2/3] feat: v1alpha4 is the current draft (decision D24) The specification makes v1alpha4 the current draft (D24, spec PR #32). The website starts with a v1alpha4 manifest and serves the v1alpha4 examples at examples/; the v1alpha3 examples move to examples/v1alpha3/ and are listed as an older set. examples/v1alpha4/ keeps working unlisted for links from the time v1alpha4 was the next draft. Viewer and editor show older manifests unchanged. The validator dependency stays at 0.3.0 until validator 0.4.0 (v1alpha4 as the default) is released; tested against a locally packed 0.4.0. Signed-off-by: Erik --- CHANGELOG.md | 13 ++++++++++--- README.md | 4 ++-- scripts/build.mjs | 12 ++++++------ site/app.js | 2 +- test/browser/run.mjs | 27 ++++++++++++++++++++------- 5 files changed, 39 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 304fad4..0db7aef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ All notable changes are documented in this file. The format is based on ### Added -- AWP `v1alpha4`, the next draft (decision D23 of the specification). Step conditions (`when`, +- AWP `v1alpha4` (decision D23 of the specification). Step conditions (`when`, spec 3.12): the view model carries `when`; the graph marks a conditional step with `if` and names the condition in the accessible name; the step card gets a "conditional" badge and a "When" fact. Workflow steps (`type: workflow`, spec 5.6.6): the view model carries `workflow` @@ -16,10 +16,17 @@ All notable changes are documented in this file. The format is based on the step card shows the child workflow and its inputs; the step exposes the action `workflow.start`. - Governance fields of `v1alpha4` manifests are read from `spec`, as in `v1alpha3`. -- The website lists the `v1alpha4` examples under `examples/v1alpha4/`; `v1alpha3` stays the - current draft at `examples/`. - Requires `@agenticworkflowprotocol/validator` 0.4.0 (`v1alpha4`). +### Changed + +- `v1alpha4` is the current draft (decision D24 of the specification). The website starts with a + `v1alpha4` manifest, and `examples/` now serves the `v1alpha4` examples; the `v1alpha3` + examples moved to `examples/v1alpha3/` and are listed as an older set. + `examples/v1alpha4/` still works but is no longer listed. +- Viewer and editor show `v1alpha1` to `v1alpha3` manifests as before; the browser test checks a + `v1alpha3` example explicitly. + ## [0.3.0] - 2026-11-25 ### Changed diff --git a/README.md b/README.md index b2b8a8a..e57b041 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,8 @@ Embeddable like Swagger UI; runs entirely in the browser. - **Embed:** two Web Components, `` and ``, for applications, developer portals and documentation ([embedding guide](https://editor.agenticworkflowprotocol.org/embed.html)). -Status: alpha, like the specification (AWP `v1alpha3`, the current draft, the next draft `v1alpha4` -with step conditions and workflow steps, plus `v1alpha2` and `v1alpha1`). +Status: alpha, like the specification (AWP `v1alpha4`, the current draft with step conditions and +workflow steps, plus `v1alpha3`, `v1alpha2` and `v1alpha1`). ## What the viewer shows diff --git a/scripts/build.mjs b/scripts/build.mjs index ba46c13..dd66f32 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -33,15 +33,15 @@ async function bundle(entry, out) { }); } -// Examples on the site: the current draft (v1alpha3, decision D22 of the specification) at +// Examples on the site: the current draft (v1alpha4, decision D24 of the specification) at // examples/, older versions under examples//. The current draft is also -// copied to examples/v1alpha3/ without being listed, so links from the time it was a proposed -// draft keep working. The next draft (v1alpha4, decision D23) is listed under examples/v1alpha4/. +// copied to examples/v1alpha4/ without being listed, so links from the time it was the next +// draft keep working. const EXAMPLE_SETS = [ - { version: 'v1alpha3', dir: '' }, - { version: 'v1alpha4', dir: 'v1alpha4/' }, + { version: 'v1alpha4', dir: '' }, + { version: 'v1alpha3', dir: 'v1alpha3/' }, { version: 'v1alpha2', dir: 'v1alpha2/' }, - { version: 'v1alpha3', dir: 'v1alpha3/', listed: false }, + { version: 'v1alpha4', dir: 'v1alpha4/', listed: false }, ]; /** Copy the manifest examples of one spec version; returns their paths relative to examples/. */ diff --git a/site/app.js b/site/app.js index 5246562..45956cf 100644 --- a/site/app.js +++ b/site/app.js @@ -3,7 +3,7 @@ import { buildModel, parseYaml as parse } from './lib/awp-editor.mjs'; import { decodeShare, encodeShare } from './share.js'; -const STARTER = `apiVersion: awp.agenticworkflowprotocol.org/v1alpha3 +const STARTER = `apiVersion: awp.agenticworkflowprotocol.org/v1alpha4 kind: Workflow metadata: name: hello-workflow diff --git a/test/browser/run.mjs b/test/browser/run.mjs index 6fca8f1..3888ed6 100644 --- a/test/browser/run.mjs +++ b/test/browser/run.mjs @@ -80,8 +80,14 @@ const viewerText = (p, selector) => p.evaluate((sel) => { check((await viewerText(p, '.node')).length === 3, 'example vulnerability-fixer has three steps'); check((await viewerText(p, '#awp-actions tbody tr')).length > 3, 'tools and permissions table is filled'); - // The examples at the top level are the current draft v1alpha3: version from spec, valid. - check((await p.locator('awp-editor').evaluate((el) => el.value)).includes('/v1alpha3'), 'the top-level examples are v1alpha3'); + // The examples at the top level are the current draft v1alpha4: version from spec, valid. + check((await p.locator('awp-editor').evaluate((el) => el.value)).includes('/v1alpha4'), 'the top-level examples are v1alpha4'); + check((await viewerText(p, '.title .version')).join().trim() !== '', 'v1alpha4 example shows its version from spec'); + check((await viewerText(p, '.head .badge')).some((t) => t.startsWith('valid')), 'v1alpha4 example is valid'); + + // Older versions stay supported: a v1alpha3 example from the subfolder, version from spec, valid. + await p.selectOption('#example', 'v1alpha3/vulnerability-fixer.workflow.yaml'); + await p.waitForFunction(() => document.querySelector('awp-editor').shadowRoot.querySelector('awp-viewer').shadowRoot.querySelector('.api')?.textContent.endsWith('/v1alpha3')); check((await viewerText(p, '.title .version')).join().trim() !== '', 'v1alpha3 example shows its version from spec'); check((await viewerText(p, '.head .badge')).some((t) => t.startsWith('valid')), 'v1alpha3 example is valid'); @@ -124,8 +130,7 @@ const viewerText = (p, selector) => p.evaluate((sel) => { await close(); } { - // v1alpha3 WorkflowRun: namespace and referenced workflow in the facts. The examples/v1alpha3/ - // path is kept for links from the time v1alpha3 was a proposed draft. + // v1alpha3 WorkflowRun: namespace and referenced workflow in the facts. const { p, errors, close } = await page('viewer.html?url=examples/v1alpha3/vulnerability-fixer.run.yaml'); await p.waitForFunction(() => document.querySelector('awp-viewer')?.shadowRoot?.querySelector('.title')); const text = await p.evaluate(() => document.querySelector('awp-viewer').shadowRoot.textContent); @@ -134,8 +139,9 @@ const viewerText = (p, selector) => p.evaluate((sel) => { await close(); } { - // v1alpha4 (next draft): conditional workflow step with the called workflow on the node. - const { p, errors, close } = await page('viewer.html?url=examples/v1alpha4/cve-risk-then-fix.yaml'); + // v1alpha4 (current draft): conditional workflow step with the called workflow on the node. The + // examples/v1alpha4/ path is kept for links from the time v1alpha4 was the next draft. + const { p, errors, close } = await page('viewer.html?url=examples/cve-risk-then-fix.yaml'); await p.waitForFunction(() => document.querySelector('awp-viewer')?.shadowRoot?.querySelector('.title')); check((await viewerText(p, '.node.type-workflow .node-sub')).join() === 'workflow cve-fixer', 'workflow step shows the called workflow'); const label = await p.evaluate(() => document.querySelector('awp-viewer').shadowRoot.querySelector('.node.conditional').getAttribute('aria-label')); @@ -145,6 +151,13 @@ const viewerText = (p, selector) => p.evaluate((sel) => { check(errors.length === 0, 'viewer renders v1alpha4 without errors'); await close(); } +{ + const { p, errors, close } = await page('viewer.html?url=examples/v1alpha4/cve-risk-then-fix.yaml'); + await p.waitForFunction(() => document.querySelector('awp-viewer')?.shadowRoot?.querySelector('.title')); + check((await viewerText(p, '.head .badge')).some((t) => t.startsWith('valid')), 'examples/v1alpha4/ still serves the v1alpha4 examples'); + check(errors.length === 0, 'viewer renders examples/v1alpha4/ without errors'); + await close(); +} { const { p, errors, close } = await page('embed.html'); await p.waitForFunction(() => document.querySelector('awp-viewer')?.shadowRoot?.querySelector('.title')); @@ -154,7 +167,7 @@ const viewerText = (p, selector) => p.evaluate((sel) => { // 3. Accessibility of every page in both colour schemes (axe needs an inline script: bypass CSP). for (const colorScheme of ['light', 'dark']) { - for (const path of ['', 'viewer.html?url=examples/vulnerability-fixer.workflow.yaml', 'viewer.html?url=examples/v1alpha2/image-review.workflow.yaml', 'viewer.html?url=examples/vulnerability-fixer.run.yaml', 'viewer.html?url=examples/v1alpha4/cve-risk-then-fix.yaml', 'embed.html']) { + for (const path of ['', 'viewer.html?url=examples/vulnerability-fixer.workflow.yaml', 'viewer.html?url=examples/v1alpha2/image-review.workflow.yaml', 'viewer.html?url=examples/v1alpha3/vulnerability-fixer.run.yaml', 'viewer.html?url=examples/cve-risk-then-fix.yaml', 'embed.html']) { const context = await browser.newContext({ colorScheme, bypassCSP: true }); const p = await context.newPage(); await p.goto(base + path); From 2b7ae52c978fa9b0682c012da70507ccb2ec530f Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 27 Nov 2026 07:59:33 +0100 Subject: [PATCH 3/3] build: use validator 0.4.0 (v1alpha4 as the current draft) --- package-lock.json | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index b9f5883..8cc4ef2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "@agenticworkflowprotocol/editor", - "version": "0.3.0", + "version": "0.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@agenticworkflowprotocol/editor", - "version": "0.3.0", + "version": "0.4.0", "license": "Apache-2.0", "dependencies": { - "@agenticworkflowprotocol/validator": "0.3.0", + "@agenticworkflowprotocol/validator": "0.4.0", "yaml": "2.9.1" }, "devDependencies": { @@ -30,9 +30,9 @@ } }, "node_modules/@agenticworkflowprotocol/validator": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@agenticworkflowprotocol/validator/-/validator-0.3.0.tgz", - "integrity": "sha512-DZKVJp7Xj4Br7pf8eQwmT6283d9fjw3kZtZhZFVM+D94gPF/kVDqB4eVsXB6qPuvDrL0p1j5SLLydG3ATaB3UQ==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@agenticworkflowprotocol/validator/-/validator-0.4.0.tgz", + "integrity": "sha512-Md6B21G+1vSJJO2ec2xcJFp+AXUfNV013CKZV10owkJDSP9A8CwKvgfchD4UL/4yadP69N2ehhYDudX3mneDPg==", "license": "Apache-2.0", "dependencies": { "ajv": "8.20.0", diff --git a/package.json b/package.json index a8f9897..68e399e 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "prepack": "node scripts/build.mjs" }, "dependencies": { - "@agenticworkflowprotocol/validator": "0.3.0", + "@agenticworkflowprotocol/validator": "0.4.0", "yaml": "2.9.1" }, "devDependencies": {