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
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ 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). 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`.
- 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/<file>` now serves the `v1alpha4` examples; the `v1alpha3`
examples moved to `examples/v1alpha3/<file>` and are listed as an older set.
`examples/v1alpha4/<file>` 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
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Embeddable like Swagger UI; runs entirely in the browser.
- **Embed:** two Web Components, `<awp-viewer>` and `<awp-editor>`, 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 `v1alpha4`, the current draft with step conditions and
workflow steps, plus `v1alpha3`, `v1alpha2` and `v1alpha1`).

## What the viewer shows

Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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": {
Expand Down
9 changes: 5 additions & 4 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +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/<file>, older versions under examples/<version>/<file>. The current draft is also
// copied to examples/v1alpha3/ without being listed, so links from the time it was a proposed
// 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: '' },
{ 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/. */
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 { 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
Expand Down
17 changes: 16 additions & 1 deletion src/model/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 : {})],
};
Expand All @@ -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}`));
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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) {
Expand Down
20 changes: 16 additions & 4 deletions src/ui/render-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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';
}

Expand All @@ -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 [];
Expand All @@ -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));
});
Expand All @@ -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],
Expand Down
3 changes: 3 additions & 0 deletions src/ui/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -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; }
Expand All @@ -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; }
Expand Down
35 changes: 30 additions & 5 deletions test/browser/run.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -124,15 +130,34 @@ 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);
check(text.includes('security') && text.includes('vulnerability-fixer@0.1.0'), 'v1alpha3 run shows namespace and workflow');
check(errors.length === 0, 'viewer renders v1alpha3 without errors');
await close();
}
{
// 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'));
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('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'));
Expand All @@ -142,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', '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);
Expand Down
Loading