Repository navigation
Commit 55ea182
feat(blocks): shared prompt and config blocks, with a sync command (#111)
* feat(blocks): share prompt text and config between resources
A system prompt can include a Markdown block with a line that says only
"@include <name>", and any mapping can include a YAML block with a
"$include" key, where the file's own keys win. Blocks are looked up in
resources/<org>/templates/ first, then in templates/ at the repository
root, so an org can replace or extend a shared block. The loader expands
them, so validate, push, PR checks and drift hashes all see the finished
resource. Liquid inside a block is passed through untouched.
Pull never writes a file that uses blocks. It used to rewrite a file
whenever the dashboard matched it, was ahead of it, or under --force and
--resolve=theirs, and each of those would replace a marker with a copy of
the block. It now leaves the file as written and saves the dashboard
version beside it when the two differ.
validate warns about YAML merge keys and Liquid include/render/layout tags,
which the engine and Vapi drop silently.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
* feat(blocks): sync a block edit to every resource that uses it
A block edit changes what many resources send to Vapi without changing
their files, so nothing in git said which resources still ran old text.
Push now records the block content each resource went up with in
resources/<org>/.vapi-blocks.json. "npm run sync-blocks" lists, across
every org, the resources whose blocks changed since they were last pushed,
and with --apply deploys them through apply, so the drift check still
refuses a resource that was edited in the dashboard.
Promotion plans those resources as "sync" entries for the destination org,
the promotion workflow runs on templates/**, and a shared block edit
selects every PR check.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
* docs(blocks): guide, worked example and the corrections it needs
Adds docs/guides/blocks.md and examples/blocks/, two clinics that share a
red-flags prompt block and a voice config block, one with its own version
of the block. The examples test now copies an example's templates/ folder,
so the example is validated and the guide's snippets are checked against
its files.
Also corrects two statements the feature depends on: YAML merge keys are
not processed by the engine, and an undefined Liquid variable is left in
the prompt as written, not replaced with an empty string.
Logs the pull behaviour this replaces as improvements entry 39, and a
drift-check gap found while testing, in orgs with no credentials, as
entry 40.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
* refactor(blocks): keep the blocks record in state/<org>/
Push writes the record, so it belongs with the rest of the engine's files.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
* fix(blocks): keep the blocks record where the org's commit step stages it
An org whose state is still in the layout from before state/ gets its
record at resources/<org>/.vapi-blocks.json. A commit step written for that
layout stages resources/, so the record is committed, and a promotion run
with nothing to promote no longer plans a sync for every resource that uses
a block. An org whose state is in state/<org>/ keeps state/<org>/blocks.json.
npm run migrate moves the record with the state file and the pin.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
* test: the blocks record is not a local edit to pull
In the older layout a push that uses blocks rewrites
resources/<org>/.vapi-blocks.json, and until that is committed git shows it
as modified. The record is on the list migrate moves, so pull leaves it out
of what it counts as a person's edits. This pins it with a pull in a fresh
clone.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
* fix(blocks): sync-blocks takes its directory from src/base-dir.ts
sync-blocks worked out the repository's directory for itself, the one
module that still did. It would have worked in the repository while every
other module worked in a test's temporary directory.
tests/base-dir.test.ts names the line.
The blocks tests import the engine sandbox first, as every engine test
file does.
The test that runs sync-blocks --apply gives that one call 240 seconds.
It starts four commands in a row and took 72 seconds on a slow machine
beside the rest of the suite. cliRun takes the limit as a parameter and
keeps 60 seconds for every other call.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
* feat(validate): catch undefined squad variables and Liquid transfer numbers (#99)
* feat(validate): warn on undefined squad variables
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix(validate): reject Liquid transfer destination numbers
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* docs: explain squad variable and transfer number validation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* docs: link NHS example across stacked PR branches
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* docs(examples): two NHS practice squads sharing one assistant set (#100)
* feat(validate): warn on undefined squad variables
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* docs(examples): add shared NHS practice squads
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix(examples): inline practice-specific transfer destinations
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix(validate): reject Liquid transfer destination numbers
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* docs: explain squad variable and transfer number validation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* docs: add shared practice quick reference
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* docs: link NHS example across stacked PR branches
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: integrate blocks with adoption folder hashes and strict preflight
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
---------
Co-authored-by: Dhruva Reddy <dhruva@vapi.ai>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: Dhruva Reddy <264116857+dhruva-vapi@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent 11f572f commit 55ea182
65 files changed
Lines changed: 4424 additions & 43 deletions
File tree
- .github/workflows
- docs
- guides
- learnings
- examples
- blocks
- resources
- north-clinic
- assistants
- squads
- south-clinic
- assistants
- squads
- templates/blocks
- templates
- blocks
- config
- src
- state
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
| |||
149 | 154 | | |
150 | 155 | | |
151 | 156 | | |
| 157 | + | |
| 158 | + | |
152 | 159 | | |
153 | 160 | | |
154 | 161 | | |
| |||
202 | 209 | | |
203 | 210 | | |
204 | 211 | | |
205 | | - | |
| 212 | + | |
| 213 | + | |
206 | 214 | | |
207 | 215 | | |
208 | 216 | | |
| |||
220 | 228 | | |
221 | 229 | | |
222 | 230 | | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
223 | 234 | | |
224 | 235 | | |
225 | 236 | | |
| |||
289 | 300 | | |
290 | 301 | | |
291 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
292 | 321 | | |
293 | 322 | | |
294 | 323 | | |
| |||
405 | 434 | | |
406 | 435 | | |
407 | 436 | | |
| 437 | + | |
408 | 438 | | |
409 | 439 | | |
410 | 440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
| 224 | + | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
| 227 | + | |
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| 235 | + | |
235 | 236 | | |
236 | 237 | | |
237 | 238 | | |
| |||
243 | 244 | | |
244 | 245 | | |
245 | 246 | | |
| 247 | + | |
246 | 248 | | |
247 | 249 | | |
248 | 250 | | |
| |||
0 commit comments