Embed the viewer and the editor
Both are standard Web Components. They work in any framework (React, Vue, Angular, plain HTML), render into their own Shadow DOM, need no external resources and run under a Content-Security-Policy without unsafe-inline or unsafe-eval. Manifests are validated in the browser with the AWP validator 0.1.0.
Install
npm install --save-exact \
https://github.com/agenticworkflowprotocol/awp-editor/releases/download/v0.1.0/agenticworkflowprotocol-editor-0.1.0.tgz
Each release also contains awp-viewer.mjs and awp-editor.mjs as single files to host yourself.
Viewer (read-only, like Swagger UI)
<script type="module" src="/assets/awp-viewer.mjs"></script>
<awp-viewer src="/workflows/vulnerability-fixer.yaml" profiles="core,governance,mcp"></awp-viewer>
Or from a bundler: import '@agenticworkflowprotocol/editor/viewer'; and set the content from code:
const viewer = document.querySelector('awp-viewer');
viewer.text = yamlText; // YAML or JSON, several documents allowed
viewer.manifest = parsedObject; // or an already parsed manifest
viewer.addEventListener('awp-navigate', (e) => console.log(e.detail.pointer, e.detail.line));
Editor
<script type="module" src="/assets/awp-editor.mjs"></script>
<awp-editor src="/workflows/vulnerability-fixer.yaml" profiles="core,mcp"></awp-editor>
<script type="module">
const editor = document.querySelector('awp-editor');
editor.addEventListener('change', (e) => save(e.detail.value, e.detail.documents));
</script>
Attributes
| Attribute | Element | Meaning |
|---|---|---|
src | both | URL of a manifest to load (fetched without credentials). |
profiles | both | Conformance profiles the host supports, comma-separated. Fields of other profiles are reported as errors. Default: all. |
theme | both | light or dark; default follows the system. |
no-validate | viewer | Show the manifest without validation. |
layout | editor | split (default), stacked, editor or viewer. |
readonly | editor | Code cannot be edited. |
Colours can be changed with CSS custom properties on the element, for example awp-viewer { --awp-accent: #8a3ab9; }, and the editor height with --awp-editor-height. Parts: ::part(header), ::part(section), ::part(viewer), ::part(code).