You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(compile): runtime prompt injection via prompt.js bundle
Default behaviour now renders the agent prompt at pipeline runtime via a
new `prompt.js` ado-script bundle, instead of embedding the body in the
compiled YAML. Body-only edits to the agent .md no longer require
recompiling the pipeline.
Set `inlined-imports: true` in front matter to opt out and keep the
legacy heredoc-embedded behaviour.
The runtime contract is a new `PromptSpec` IR (mirrors `GateSpec`):
schemars-derived JSON Schema, `json-schema-to-typescript` codegen into
`types-prompt.gen.ts`, base64-encoded into a single
`ADO_AW_PROMPT_SPEC` env var on the prompt.js step.
`prompt.js` reads the source from the workspace, strips front matter,
appends extension supplements, and substitutes `${{ parameters.NAME }}`
and `$(VAR)` patterns at runtime via env vars. Secret variables stay
secure-by-default (not auto-exposed).
Existing compiled YAMLs will fail `ado-aw check` after upgrade until
recompiled. Use `inlined-imports: true` as the one-line escape hatch.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|`${{ parameters.NAME }}`| env `ADO_AW_PARAM_<NAME upper, hyphen→underscore>`| Only declared parameters substitute; others left verbatim with a warning. |
170
+
|`$(VAR)` / `$(VAR.SUB)`| env `<name upper, dot→underscore>` (ADO native) | Unset variables left verbatim with a warning. Secrets are not auto-exposed and stay verbatim. |
171
+
|`$[ ... ]`| not substituted | Left verbatim with one warning per render. |
172
+
|`\$(...)`| escape | Backslash stripped; `$(...)` left literal. |
173
+
146
174
## Workspace Defaults
147
175
148
176
The `workspace:` field controls which directory the agent runs in. When it is
Copy file name to clipboardExpand all lines: docs/template-markers.md
+22-2Lines changed: 22 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -305,9 +305,29 @@ resources:
305
305
- release/*
306
306
```
307
307
308
-
## {{ agent_content }}
308
+
## {{ prepare_agent_prompt }}
309
309
310
-
Should be replaced with the markdown body (agent instructions) extracted from the source markdown file, excluding the YAML front matter. This content provides the agent with its task description and guidelines.
310
+
Replaced with the YAML step(s) that prepare `/tmp/awf-tools/agent-prompt.md` for the agent.
311
+
312
+
The expansion depends on the `inlined-imports` front-matter field:
313
+
314
+
- **`inlined-imports: false`** (default) — emits a three-step bundle:
315
+
1. `NodeTool@0` to install Node 20.x.
316
+
2. A `curl` download of `scripts.zip` from the matching `githubnext/ado-aw` release, extracting `prompt.js` to `/tmp/ado-aw-scripts/prompt.js`.
317
+
3. A bash step that runs `node /tmp/ado-aw-scripts/prompt.js` with `ADO_AW_PROMPT_SPEC` (a base64-encoded `PromptSpec` JSON) and one `ADO_AW_PARAM_<NAME>: ${{ parameters.<NAME> }}` env entry per declared parameter. The renderer reads the source `.md` from the workspace, strips its front matter, applies variable substitution, appends extension supplements, and writes the result to `/tmp/awf-tools/agent-prompt.md`.
318
+
319
+
Substitution patterns recognised at runtime by `prompt.js`:
- **`inlined-imports: true`** — emits a single legacy heredoc step that writes the markdown body verbatim into `/tmp/awf-tools/agent-prompt.md`. Extension prompt supplements are emitted as separate `cat >>` heredoc steps via `wrap_prompt_append`. No variable substitution beyond what ADO macros already do natively.
329
+
330
+
This marker replaces the older `{{ agent_content }}` placeholder, which is no longer emitted by the compiler.
0 commit comments