AWP Editor

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 @agenticworkflowprotocol/editor

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

AttributeElementMeaning
srcbothURL of a manifest to load (fetched without credentials).
profilesbothConformance profiles the host supports, comma-separated. Fields of other profiles are reported as errors. Default: all.
themebothlight or dark; default follows the system.
no-validateviewerShow the manifest without validation.
layouteditorsplit (default), stacked, editor or viewer.
readonlyeditorCode 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).

Live example