@cavelon/cli 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +697 -3
- package/dist/LICENSE +201 -0
- package/dist/agents.js +91 -0
- package/dist/branches.js +61 -0
- package/dist/capacity.js +162 -0
- package/dist/cli.js +4 -0
- package/dist/command.js +62 -0
- package/dist/commands/api.js +243 -0
- package/dist/commands/async.js +207 -0
- package/dist/commands/docs.js +158 -0
- package/dist/commands/index.js +112 -0
- package/dist/commands/init.js +452 -0
- package/dist/commands/inventory.js +56 -0
- package/dist/commands/limits-set.js +624 -0
- package/dist/commands/limits.js +156 -0
- package/dist/commands/loops.js +792 -0
- package/dist/commands/models.js +197 -0
- package/dist/commands/sandboxes.js +667 -0
- package/dist/commands/session.js +476 -0
- package/dist/commands/solution.js +760 -0
- package/dist/commands/tenants.js +266 -0
- package/dist/commands/values.js +383 -0
- package/dist/commands/work.js +744 -0
- package/dist/context.js +56 -0
- package/dist/contracts.js +189 -0
- package/dist/credentials.js +134 -0
- package/dist/errors.js +64 -0
- package/dist/features.js +37 -0
- package/dist/format.js +36 -0
- package/dist/fsutil.js +40 -0
- package/dist/git.js +41 -0
- package/dist/http.js +286 -0
- package/dist/invoke.js +161 -0
- package/dist/io.js +49 -0
- package/dist/limits.js +299 -0
- package/dist/local-state.js +60 -0
- package/dist/main.js +227 -0
- package/dist/markers.js +113 -0
- package/dist/mcp.js +130 -0
- package/dist/openapi.js +223 -0
- package/dist/operations.js +107 -0
- package/dist/package-check.js +342 -0
- package/dist/package-files.js +329 -0
- package/dist/pair-order.js +39 -0
- package/dist/paths.js +28 -0
- package/dist/principal.js +33 -0
- package/dist/project.js +138 -0
- package/dist/prompt.js +34 -0
- package/dist/results.js +66 -0
- package/dist/session.js +166 -0
- package/dist/shell.js +41 -0
- package/dist/skills/cavelon-authoring/SKILL.md +214 -0
- package/dist/skills/cavelon-long-running/SKILL.md +181 -0
- package/dist/skills/cavelon-loop/SKILL.md +158 -0
- package/dist/skills/cavelon-testing/SKILL.md +90 -0
- package/dist/sse.js +44 -0
- package/dist/tar.js +172 -0
- package/dist/user-config.js +36 -0
- package/dist/version.js +17 -0
- package/dist/zip.js +132 -0
- package/package.json +40 -4
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cavelon-authoring
|
|
3
|
+
description: Writing and changing a Cavelon solution package in a repository - the package/ files split by schema section, the package schema, environments in env/, declaring the variables and secrets a solution needs, and fixing validation codes with cavelon explain. Use when editing files under package/, tests/ or env/ of a folder with cavelon.yaml, when cavelon validate or apply reports an error code, when the user asks to add or change agents, tools, skills, knowledge bases or triggers of a Cavelon solution, or when a limit of the tenant needs changing (cavelon limits set) or they set up a self-hosted model endpoint or its concurrency limit (max_concurrent_requests).
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Authoring a Cavelon package
|
|
8
|
+
|
|
9
|
+
The package is the solution's configuration. The instance publishes its
|
|
10
|
+
format as a JSON Schema; `cavelon` splits it along that schema's top-level
|
|
11
|
+
sections, so the files follow whatever the instance version defines. Do not
|
|
12
|
+
assume a section or field exists: check the schema or the docs first.
|
|
13
|
+
|
|
14
|
+
## Before you plan: the instance's limits
|
|
15
|
+
|
|
16
|
+
Read `cavelon limits` (or the `limits` MCP tool) before you design or change a
|
|
17
|
+
solution. It lists, for this tenant, every limit the instance enforces that a
|
|
18
|
+
solution can run into: knowledge-base upload size and file types, structured
|
|
19
|
+
knowledge-base sizes, agent turns and tool calls, pipeline stages and
|
|
20
|
+
`harness_call` depth, webhook, API Request, MCP and model timeouts and sizes,
|
|
21
|
+
rate limits, the licence's cap on solutions, and branch concurrency; and the
|
|
22
|
+
tenant's quotas (agents, tools, knowledge bases, storage, monthly tokens, the
|
|
23
|
+
monthly Processing Step cap) with their use.
|
|
24
|
+
|
|
25
|
+
- Design within them: a webhook timeout above `webhook_max_timeout_seconds`
|
|
26
|
+
or a document above `kb_upload_max_file_size_mb` fails on the instance.
|
|
27
|
+
- Each limit says where its value comes from (`source`: tenant, platform or
|
|
28
|
+
licence), who can change it (`changeable_by`: a tenant admin or the
|
|
29
|
+
operator) and the `setting`. A tenant admin's limit can be changed with
|
|
30
|
+
`cavelon limits set <key> <value>` (see below), or in the Admin; an operator
|
|
31
|
+
changes environment settings or the licence. The run caps
|
|
32
|
+
also name their `origin`: a platform setting the operator changes in the
|
|
33
|
+
Admin, the environment, or the default. Ask the person rather than working
|
|
34
|
+
around a limit, and never edit a limit into the package.
|
|
35
|
+
- A fan-out or Map loop runs at most `orchestration_max_branch_concurrency`
|
|
36
|
+
branches at once: a `max_concurrency` above it is capped, and `cavelon
|
|
37
|
+
validate` warns (`branch_width_capped`). When `limits` says branches do not
|
|
38
|
+
run concurrently, every fan-out and Map loop runs one branch after another
|
|
39
|
+
(same result, slower); `validate` warns (`branches_run_in_sequence`) and
|
|
40
|
+
`limits` names the switch that is off and who turns it on. Plan the time a
|
|
41
|
+
long document takes with that, and tell the person.
|
|
42
|
+
- A limit the instance does not list does not bind there. `cavelon docs get
|
|
43
|
+
<page>` with a limit's `docs` path explains it.
|
|
44
|
+
|
|
45
|
+
## Changing a limit
|
|
46
|
+
|
|
47
|
+
When a solution needs more than a limit allows, or less (a lower rate limit
|
|
48
|
+
for a public widget), **propose the change; the person decides.**
|
|
49
|
+
|
|
50
|
+
- Run `cavelon limits set <key> <value>` without `--confirm` (MCP: `limits_set`
|
|
51
|
+
without `confirm`). It changes nothing and shows the old and the new value,
|
|
52
|
+
the operation it would send and the permissions it needs. Show that to the
|
|
53
|
+
person with your reason (what fails or waits now), and wait for their answer.
|
|
54
|
+
- Only after they agreed, run it again with `--confirm`. Never raise a limit on
|
|
55
|
+
your own, never pick a value higher than the need you named, and never change
|
|
56
|
+
one without telling them.
|
|
57
|
+
- The same goes for the tenant's monthly inference budget
|
|
58
|
+
(`monthly_inference_token_budget`) and the monthly Processing Step cap
|
|
59
|
+
(`monthly_processing_step_cap`, a Tenant Owner's; `none` removes it): both
|
|
60
|
+
decide what the tenant pays. When new work is refused at the cap,
|
|
61
|
+
`cavelon explain processing_step_cap` says when it resets and who raises it.
|
|
62
|
+
- An operator's or the licence's limit (`changeable_by: operator`: the run
|
|
63
|
+
caps, the slot waits, timeouts, `licence_max_harnesses`) goes to the
|
|
64
|
+
operator. Where it publishes a `change` (the run caps), `limits set` sends it
|
|
65
|
+
only with a personal access token in Platform mode of the role it names, and
|
|
66
|
+
otherwise refuses naming the role and the Admin page; `--tenant <tenant>`
|
|
67
|
+
then sets one tenant's own run cap. Without a `change` it cannot be changed
|
|
68
|
+
at runtime. Tell the person who changes it and where, and design within it
|
|
69
|
+
meanwhile; never ask for an operator's token.
|
|
70
|
+
- A rate limit only goes down to what the operator allows; above the ceiling
|
|
71
|
+
(`maximum_setting`), it is the operator's too. That holds for the per-visitor
|
|
72
|
+
limits (`rate_limit_chat_visitor_rpm`, `rate_limit_widget_visitor_rpm`) as
|
|
73
|
+
well. A refusal `limit_above_platform_ceiling` names the ceiling and the
|
|
74
|
+
operator's setting; `cavelon explain limit_above_platform_ceiling` lists them.
|
|
75
|
+
- Archive uploads are one switch, `kb_upload_archive_enabled` (`true` or
|
|
76
|
+
`false`). The archive caps apply only while it is on (`binds_when` in
|
|
77
|
+
`limits`), and can be set before. The formats are the platform's.
|
|
78
|
+
- A refusal for permissions (exit 7) means this credential may not change it:
|
|
79
|
+
ask a person who holds one of the permissions it names. The kit refuses
|
|
80
|
+
before sending when the instance publishes the credential's permissions. An
|
|
81
|
+
instance that does not publish how to change a limit is changed in the Admin.
|
|
82
|
+
|
|
83
|
+
## Self-hosted model endpoints
|
|
84
|
+
|
|
85
|
+
A model served from the customer's own endpoint (vLLM, TGI, an on-prem
|
|
86
|
+
gateway: a Model Registry row with a `base_url`) answers only so many requests
|
|
87
|
+
at once. Declare that number as the row's `max_concurrent_requests`, so chat,
|
|
88
|
+
triggers and ingestion wait in line for a free slot instead of overloading the
|
|
89
|
+
endpoint.
|
|
90
|
+
|
|
91
|
+
- Only on a row with a `base_url`; empty means no limit. `cavelon validate`
|
|
92
|
+
refuses the field on a row without one.
|
|
93
|
+
- The count is shared by every row that points to the same endpoint (the same
|
|
94
|
+
`base_url`), across tenants: give each such row the same number.
|
|
95
|
+
- Ask the person for the number the endpoint serves (for vLLM, its concurrent
|
|
96
|
+
sequences); do not guess high.
|
|
97
|
+
- Plan it with the instance's own tutorial before you propose a number:
|
|
98
|
+
`cavelon docs get tutorials/plan-model-capacity` goes from what the server
|
|
99
|
+
serves to the endpoint limit, the run caps and a load test, at this
|
|
100
|
+
instance's version.
|
|
101
|
+
- A call that finds no free slot within `model_endpoint_slot_wait_seconds`
|
|
102
|
+
(`cavelon limits`) fails with `model_endpoint_busy`; `cavelon explain
|
|
103
|
+
model_endpoint_busy` says what to raise.
|
|
104
|
+
- On rows that already exist, `cavelon models list` shows each row's endpoint
|
|
105
|
+
and `max_concurrent_requests` (never a key). `cavelon models set-limit
|
|
106
|
+
<model_id> <n|none>` shows the old and the new value and changes nothing;
|
|
107
|
+
with `--confirm` it changes the row. It refuses a row without a `base_url`.
|
|
108
|
+
Where this instance's package format does not carry the field, `validate`
|
|
109
|
+
warns that the import ignores it; set it this way instead.
|
|
110
|
+
|
|
111
|
+
**Propose a limit; the person decides.** Say which value you would set and
|
|
112
|
+
why (what the endpoint serves, which rows share it, what waits or fails now),
|
|
113
|
+
then wait for the person's answer. Run `models set-limit --confirm` only after
|
|
114
|
+
they agreed, and never raise or lower a limit without telling them. A limit
|
|
115
|
+
`cavelon limits` names as the operator's (the run caps, the slot waits, the
|
|
116
|
+
licence) is not yours or the tenant's to change: tell the person who changes
|
|
117
|
+
it and where, as the output says.
|
|
118
|
+
|
|
119
|
+
## The files
|
|
120
|
+
|
|
121
|
+
| Path | Holds |
|
|
122
|
+
|---|---|
|
|
123
|
+
| `cavelon.yaml` | instance, tenant, solution (`harness`), package format version, layout. Never a token. |
|
|
124
|
+
| `package/<section>.yaml` | one top-level section of the package each (`manifest`, `agents`, `tools`, …) |
|
|
125
|
+
| `tests/<suite>.yaml` | one test suite each, when the layout maps test suites there |
|
|
126
|
+
| `env/<name>.yaml` | where `apply --env <name>` goes: `tenant`, `harness`, `mode`, `runtime_bindings` |
|
|
127
|
+
| `seeds/` | your seed scripts and data manifests |
|
|
128
|
+
| `.cavelon/` | local state (inventory, previews); never committed, never edit |
|
|
129
|
+
|
|
130
|
+
A file of a section the instance does not know is kept as it is; the preview
|
|
131
|
+
lists it under "ignored". `package/manifest.yaml` names the package format
|
|
132
|
+
version; leave it as `pull` wrote it.
|
|
133
|
+
|
|
134
|
+
## Finding out what a section takes
|
|
135
|
+
|
|
136
|
+
1. Start from what exists: `cavelon pull`, then read the section files. Copy
|
|
137
|
+
the shape of a similar entry rather than inventing fields. A blueprint or
|
|
138
|
+
another instance's export comes in through `cavelon init --from <file>`
|
|
139
|
+
(JSON or YAML): it writes the same files as `pull`, refuses to change files
|
|
140
|
+
that hold something else unless `--force`, and names the sections this
|
|
141
|
+
instance ignores.
|
|
142
|
+
2. The schema: `cavelon validate` checks the files against the instance's
|
|
143
|
+
package schema, and each error names the file, line and field.
|
|
144
|
+
3. Concepts and fields: `cavelon docs search <topic>` (for example "agent
|
|
145
|
+
graph", "tools", "knowledge base", "triggers"), then `cavelon docs get
|
|
146
|
+
<page>`.
|
|
147
|
+
4. A code from `validate`, `apply` or a failed request: `cavelon explain
|
|
148
|
+
<code>`. It gives the meaning, the fix and a docs link.
|
|
149
|
+
|
|
150
|
+
## Rules that keep a package portable
|
|
151
|
+
|
|
152
|
+
- **Slugs are identities.** An entry is matched by its slug on import; renaming
|
|
153
|
+
a slug creates a new entry and, with `--mode replace`, deletes the old one.
|
|
154
|
+
- **Secrets and variables are references only:** write `{{secret:<name>}}` or
|
|
155
|
+
`{{var:<name>}}` where a value is needed, and declare the name (below). Never
|
|
156
|
+
write a secret value into any file, an argument or a message.
|
|
157
|
+
- **Environment specifics go into `env/`, not `package/`.** Runtime
|
|
158
|
+
requirements (Sandboxes, other solutions) are bound per environment in
|
|
159
|
+
`runtime_bindings`, keyed by the requirement's key, to the target tenant's
|
|
160
|
+
resource id. The preview lists unbound ones under "needs bindings".
|
|
161
|
+
- **OAuth grants and trigger execution identities** are never in the package.
|
|
162
|
+
The preview names them with the Admin path where a person sets them.
|
|
163
|
+
- **Knowledge-base documents** are not in the repository: the package declares
|
|
164
|
+
the knowledge bases; `cavelon kb upload` brings the documents.
|
|
165
|
+
- **A knowledge base reaches an agent only through a search tool.** Naming it
|
|
166
|
+
in a skill's `knowledge_base_assignments` only scopes the search; the skill
|
|
167
|
+
(or the agent) also needs the built-in search tool in its `tool_assignments`
|
|
168
|
+
(`cavelon docs get reference/builtin-tools` names it). Without one the agent
|
|
169
|
+
answers from memory; `cavelon validate` warns
|
|
170
|
+
(`knowledge_base_without_search_tool`).
|
|
171
|
+
|
|
172
|
+
## Variables and secrets the solution needs
|
|
173
|
+
|
|
174
|
+
A package carries names, never values. Declare every variable and secret the
|
|
175
|
+
solution needs in two sections of the package (check that the instance's
|
|
176
|
+
schema has them: `cavelon validate` reports an unknown section):
|
|
177
|
+
|
|
178
|
+
```yaml
|
|
179
|
+
# package/required_variables.yaml
|
|
180
|
+
- name: crm_base_url
|
|
181
|
+
description: Base URL of the CRM API, e.g. https://crm.example.com
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
```yaml
|
|
185
|
+
# package/required_secrets.yaml
|
|
186
|
+
- name: crm_api_token
|
|
187
|
+
description: API token of the CRM integration user
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
- A name is what the placeholder uses: letters, digits, `_`, `.` and `-`. The
|
|
191
|
+
description tells the person setting it what to enter.
|
|
192
|
+
- `pull` and `apply` keep both files; the instance sorts the entries by name.
|
|
193
|
+
- `cavelon apply` lists each declared or referenced name the target has no
|
|
194
|
+
value for, under "needs variables" and "needs secrets", with the command
|
|
195
|
+
that sets it (`--json`: `set_commands`).
|
|
196
|
+
- **Variables** are plain text that anyone who may view the tenant's settings
|
|
197
|
+
reads. You may set one with `cavelon variables set <name> <value>` (the
|
|
198
|
+
`variables_set` tool) when the value is not a credential and you know it;
|
|
199
|
+
ask the person otherwise. `cavelon variables list` shows them.
|
|
200
|
+
- **Secrets are set by a person, never by you.** Tell the person the exact
|
|
201
|
+
command `apply` printed, `cavelon secrets set <name>` (with `--env <name>`
|
|
202
|
+
when there is one), to run in their own terminal; it asks for the value
|
|
203
|
+
without echoing it. Never ask for the value, never put it into a file,
|
|
204
|
+
an argument or a message, and never put a credential into a variable.
|
|
205
|
+
`cavelon secrets list` (the `secrets_list` tool) shows which are set,
|
|
206
|
+
never a value. A tenant API key cannot set a secret at all.
|
|
207
|
+
|
|
208
|
+
## After each edit
|
|
209
|
+
|
|
210
|
+
1. `cavelon validate` until it reports no errors.
|
|
211
|
+
2. `cavelon apply --env test` to see what the instance makes of it; the
|
|
212
|
+
preview re-checks everything on the server, including rules that only the
|
|
213
|
+
instance can check (graph rules, references between sections).
|
|
214
|
+
3. Follow the cavelon-loop skill for confirming and testing.
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cavelon-long-running
|
|
3
|
+
description: Long-running work on Cavelon - Masterloop loops that a trigger starts, Sandboxes in their two modes (isolated container, customer VM), seeding a workspace, following and pausing a loop, taking results out, binding a trigger's execution identity, testing loops, and runs that wait for run capacity. Use when a solution has a Masterloop node, a trigger that runs on its own, or a Sandbox, when the user wants to run, watch, stop or test a loop, or when a run stays queued or fails with run_capacity_busy or model_endpoint_busy.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Long-running work: loops and Sandboxes
|
|
8
|
+
|
|
9
|
+
A **Masterloop** node runs one solution again and again in bounded iterations
|
|
10
|
+
until its check passes, its budget or deadline runs out, or a person stops it.
|
|
11
|
+
Each iteration returns `continue`, `wait`, `done` or `blocked`. A loop starts
|
|
12
|
+
only through its **trigger**, and stopping the trigger run stops the loop.
|
|
13
|
+
|
|
14
|
+
A **Sandbox** is a workspace a loop (or an ordinary agent) reads and writes. One
|
|
15
|
+
writer at a time: while a run holds a Sandbox, nothing else changes it.
|
|
16
|
+
|
|
17
|
+
Read the instance's own docs for the details: `cavelon docs search masterloop`,
|
|
18
|
+
`cavelon docs search sandbox`. `cavelon sandbox list` shows the tenant's
|
|
19
|
+
Sandboxes, their mode and what each mode offers.
|
|
20
|
+
|
|
21
|
+
## The two modes
|
|
22
|
+
|
|
23
|
+
| | `isolated_container` | `customer_vm` |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| Where | the reference runner's containers | a directory on the customer's own VM |
|
|
26
|
+
| Put files in | `cavelon sandbox seed <sandbox> <folder>` | copy them onto the VM, then `cavelon sandbox refresh <sandbox>` |
|
|
27
|
+
| Take results out | `cavelon artifacts export <sandbox>` (a tar) | `cavelon sandbox cat <sandbox> <path>` |
|
|
28
|
+
| Evidence a loop finished | the runner's trusted receipt (`sandbox receipt`) | the files themselves; completion is only agent-reported |
|
|
29
|
+
|
|
30
|
+
`cavelon` refuses what a Sandbox's mode does not offer and names the mode (exit 3).
|
|
31
|
+
Do not work around it; use the other column.
|
|
32
|
+
|
|
33
|
+
## Prepare
|
|
34
|
+
|
|
35
|
+
1. **Author** the loop in `package/` like any other solution (cavelon-authoring
|
|
36
|
+
skill). `cavelon validate`, then `cavelon apply --env test`: the preview shows
|
|
37
|
+
the loop's budget, Sandboxes that an active solution writes to, and triggers
|
|
38
|
+
whose execution identity is missing.
|
|
39
|
+
2. **Bind the test Sandbox** in `env/test.yaml` (`runtime_bindings`), never the
|
|
40
|
+
live one: a loop test needs a Sandbox of its own, because only one writer at a
|
|
41
|
+
time may use it.
|
|
42
|
+
3. **Check the Sandbox:** `cavelon sandbox validate <sandbox>` (exit 3 lists the
|
|
43
|
+
failing checks). A person enrols VMs, grants Sandbox Access and sets its
|
|
44
|
+
policy in the Admin; you cannot, so ask.
|
|
45
|
+
4. **A parent and its iteration solution** go in a fixed order: apply the
|
|
46
|
+
iteration, apply the parent, run the parent's loop suite, activate the
|
|
47
|
+
iteration, activate the parent (cavelon-loop skill, "A Masterloop parent and
|
|
48
|
+
its iteration solution"). `activate` never forces.
|
|
49
|
+
5. **Seed it.** Isolated container: `cavelon sandbox seed <sandbox> <folder>`
|
|
50
|
+
shows what it would send; add `--confirm` to send it. The archive **replaces
|
|
51
|
+
the workspace**, so confirm only for a test Sandbox or after the person
|
|
52
|
+
agreed. Customer VM: the files go onto the VM, then `cavelon sandbox refresh
|
|
53
|
+
<sandbox>`.
|
|
54
|
+
|
|
55
|
+
## Run and follow
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
cavelon loop start <trigger> --input @request.json # prints the run id and an operation id
|
|
59
|
+
cavelon loop watch <run> --timeout 5m # each iteration's verdict, then the loop's outcome
|
|
60
|
+
cavelon loop iterations <run> # state, budget, iterations (a page at a time)
|
|
61
|
+
cavelon wait <operation-id> --timeout 90s # exit 0 done, 1 failed, 5 needs a person, 6 still running
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
A loop started from `cavelon` runs **as the person whose token it is**, checked
|
|
65
|
+
again on every iteration. Keep each `watch` or `wait` under your shell's time
|
|
66
|
+
limit and run it again to resume (exit 6 means still running). Over MCP, use the
|
|
67
|
+
`loop_iterations` and `operation_status` tools; they never block.
|
|
68
|
+
|
|
69
|
+
- **Pause** at the next safe point: `cavelon loop pause <run>`. Resume with
|
|
70
|
+
`cavelon loop resume <run>`. A paused loop makes `wait` and `loop watch` exit
|
|
71
|
+
5 at once: tell the person why it paused and what the watch says to run, do
|
|
72
|
+
not wait forever. A pause that is a verdict on the task (`task_blocked`,
|
|
73
|
+
`invalid_continuation`, …) resumes only with `--reason <the pause reason>`,
|
|
74
|
+
exactly as the loop names it, once the person reviewed the cause; `--reason`
|
|
75
|
+
is never free text. A pause that cannot be resumed is cancelled
|
|
76
|
+
(`cavelon loop cancel <run> --confirm`) and started again after the fix; the
|
|
77
|
+
watch prints both commands.
|
|
78
|
+
- An iteration reads **accepted** (with its outcome: continue, wait, done,
|
|
79
|
+
blocked), **rejected**, or **failed** when its child failed. A run that ended
|
|
80
|
+
without a loop names the stage that recorded an error.
|
|
81
|
+
`cavelon trace <child_run_id>` reads one iteration's run.
|
|
82
|
+
- **Stop** a run and its loops: `cavelon loop cancel <run>` shows what stops;
|
|
83
|
+
`--confirm` stops it. Stop runs you started, not someone else's.
|
|
84
|
+
- A run that waits at an **Approval** node, or a loop paused by a guardrail,
|
|
85
|
+
needs a person: `wait` prints the reason and the Admin link. An approval is
|
|
86
|
+
decided by a person, or by an API key an owner granted the explicit scope
|
|
87
|
+
`approvals.decide`. `cavelon` has no command for it, and you never approve
|
|
88
|
+
or reject anything, not through `cavelon api` either: tell the person.
|
|
89
|
+
|
|
90
|
+
## Waiting for capacity
|
|
91
|
+
|
|
92
|
+
The instance runs only so many agent runs at once, per tenant and in total. A
|
|
93
|
+
trigger or channel run that meets a full cap is not refused: it stays `queued`
|
|
94
|
+
(`pending`) and the instance retries it every few seconds until a slot frees.
|
|
95
|
+
The run says so itself (`waiting_for_capacity`), so `wait`, `watch`,
|
|
96
|
+
`loop watch`, `trace` and `status` say **waiting for run capacity** from the
|
|
97
|
+
first poll and name the cap and where it is set. On an instance that does not
|
|
98
|
+
say, they infer it once the run has been queued for longer than a normal start
|
|
99
|
+
(30 s), and `--json` marks the wait `inferred`. It is not stuck: keep waiting
|
|
100
|
+
within your timeout, and run the same command again on exit 6. Do not cancel
|
|
101
|
+
and restart it; a new run queues behind the same cap.
|
|
102
|
+
|
|
103
|
+
What waits for what, and where each limit is set, is the instance's own page:
|
|
104
|
+
`cavelon docs get concepts/capacity-and-concurrency` (model endpoint slots, run
|
|
105
|
+
caps, branches inside a run, ingestion and rate limits).
|
|
106
|
+
|
|
107
|
+
Two reasons end work for capacity; each has its code in `cavelon explain`:
|
|
108
|
+
|
|
109
|
+
- `run_capacity_busy`: every run slot of the tenant or the instance was in use,
|
|
110
|
+
on a path that does not wait (a synchronous call, a test run). Retry later,
|
|
111
|
+
or ask the instance operator to raise `max_concurrent_agent_runs_per_tenant`
|
|
112
|
+
(for this tenant alone, or for all as a platform setting).
|
|
113
|
+
- `model_endpoint_busy`: a self-hosted model endpoint was at its
|
|
114
|
+
`max_concurrent_requests` and no slot freed within
|
|
115
|
+
`model_endpoint_slot_wait_seconds`. Retry later, or, if the endpoint can serve
|
|
116
|
+
more, propose raising the Model Registry row's `max_concurrent_requests`
|
|
117
|
+
(`cavelon models list` shows it). The person decides; only then run
|
|
118
|
+
`cavelon models set-limit <model_id> <n> --confirm`.
|
|
119
|
+
|
|
120
|
+
`cavelon limits` shows the caps, their source and origin, the slot waits, and
|
|
121
|
+
branch concurrency (how many items of a Map loop run at once, and whether they
|
|
122
|
+
run concurrently at all). Raising them is someone else's decision: tell the
|
|
123
|
+
person what the output names. An operator changes a run cap with
|
|
124
|
+
`cavelon limits set … --confirm` and a Platform-mode personal access token of
|
|
125
|
+
their own; never ask for one.
|
|
126
|
+
|
|
127
|
+
## Look inside
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
cavelon sandbox files <sandbox> [folder] # what is in the workspace
|
|
131
|
+
cavelon sandbox cat <sandbox> <path> # a file, 32 KiB at a time (--offset reads on)
|
|
132
|
+
cavelon sandbox activity <sandbox> # commands, transfers, validations
|
|
133
|
+
cavelon sandbox logs <sandbox> <activity-id> # one activity's output
|
|
134
|
+
cavelon sandbox receipt <sandbox> <activity> # isolated container only
|
|
135
|
+
cavelon trace <run> # the run's traces, as for any trigger run
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Sandbox reads go through a solution the Sandbox allows: `--harness`, or the
|
|
139
|
+
folder's solution, or the Sandbox's only allowed one. Exit 7 means Sandbox
|
|
140
|
+
Access does not list it; a person changes that in the Admin.
|
|
141
|
+
|
|
142
|
+
Take results out of an isolated container with `cavelon artifacts export
|
|
143
|
+
<sandbox> --path output --wait --out results.tar` (it never overwrites a file),
|
|
144
|
+
or start it without `--wait` and download later with `--job <id>`.
|
|
145
|
+
|
|
146
|
+
## Unattended runs: the execution identity
|
|
147
|
+
|
|
148
|
+
A scheduled or webhook run has no caller, so it acts as an **API key** bound to
|
|
149
|
+
its trigger. `apply` never binds one; it lists unbound triggers in the preview.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
cavelon trigger identity <trigger> # who it runs as, what the key must reach
|
|
153
|
+
cavelon trigger identity <trigger> <key-name> # shows the change
|
|
154
|
+
cavelon trigger identity <trigger> <key-name> --confirm
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Binding gives the trigger standing authority over its Sandboxes: show the person
|
|
158
|
+
first and confirm only after they agree. Name the key by its name or id, never
|
|
159
|
+
its value. A personal access token is never an execution identity. Creating keys
|
|
160
|
+
and adding a key to a Sandbox's Access stay in the Admin; the output says when
|
|
161
|
+
that is still missing.
|
|
162
|
+
|
|
163
|
+
## Test a loop
|
|
164
|
+
|
|
165
|
+
Loop tests are ordinary test suites whose cases start a trigger and check what
|
|
166
|
+
the loop left behind: the outcome, what it spent, and files in the Sandbox (on an
|
|
167
|
+
isolated container also the receipt). Run them like any suite (cavelon-testing
|
|
168
|
+
skill):
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
cavelon test run --suite <loop-suite> --wait --timeout 10m
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
On a customer VM the test's own file checks are the evidence.
|
|
175
|
+
|
|
176
|
+
## Exit codes
|
|
177
|
+
|
|
178
|
+
0 ok · 1 failed or cancelled · 2 usage · 3 refused: invalid, or not offered by
|
|
179
|
+
the Sandbox's mode · 4 conflict (the loop or binding changed; read it again) ·
|
|
180
|
+
5 needs a person · 6 still running (run the same command again) · 7 not
|
|
181
|
+
authorised · 8 server or network error.
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cavelon-loop
|
|
3
|
+
description: The development loop for a Cavelon solution kept in a repository - init or pull, edit, validate, apply (preview, then confirm), seed, wait, test, trace, fix. Use when the user wants to build, change, deploy or promote a Cavelon solution (harness, agents, tools, knowledge bases), when the folder has a cavelon.yaml, or when they mention the cavelon CLI.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# The Cavelon development loop
|
|
8
|
+
|
|
9
|
+
A Cavelon solution lives in two places: the **instance** runs it, and the
|
|
10
|
+
**repository** holds its blueprint (`cavelon.yaml`, `package/`, `tests/`,
|
|
11
|
+
`env/`). The `cavelon` CLI moves it between them. Every command takes `--json`;
|
|
12
|
+
use it when you parse the result.
|
|
13
|
+
|
|
14
|
+
## Before anything
|
|
15
|
+
|
|
16
|
+
- `cavelon status` says which instance, tenant and solution this folder is
|
|
17
|
+
bound to, the last pull and the open previews. `cavelon whoami` says who the
|
|
18
|
+
token acts as and when it expires.
|
|
19
|
+
- **Never handle a token.** If a command exits 7 (not authorised) or says no
|
|
20
|
+
token, ask the person to run `cavelon login --instance <url>` themselves (in a
|
|
21
|
+
terminal, or with a `!` prefix where your client offers one). Never ask them
|
|
22
|
+
to paste a token to you, and never put one in a file or an argument.
|
|
23
|
+
- **Secrets are set by a person.** When a preview or `cavelon secrets list`
|
|
24
|
+
names a secret that is not set, tell the person the exact command to run in
|
|
25
|
+
their terminal, `cavelon secrets set <name>` (as `apply` prints it, with its
|
|
26
|
+
`--env`). Never ask for the value, never pipe or pass one yourself; there is
|
|
27
|
+
no MCP tool for it. Plain-text variables you may set with `cavelon variables
|
|
28
|
+
set <name> <value>` when the value is not a credential.
|
|
29
|
+
- **Read the limits before you plan a solution:** `cavelon limits` (the
|
|
30
|
+
`limits` tool over MCP). It lists what this instance allows the tenant
|
|
31
|
+
(upload size and file types, agent turns, tool calls, timeouts, rate limits,
|
|
32
|
+
the licence's solution cap, how many branches of a fan-out run at once and
|
|
33
|
+
whether they run concurrently) and the tenant's quotas with their use, the
|
|
34
|
+
monthly Processing Step cap among them. Plan within them: split a document
|
|
35
|
+
that is too large, keep a webhook under its timeout. Each limit names who can
|
|
36
|
+
change it (a tenant admin, a Tenant Owner, or the operator) and the setting;
|
|
37
|
+
when the plan needs more, propose `cavelon limits set` (without `--confirm`)
|
|
38
|
+
or tell the person who to ask instead of working around it. `cavelon status`
|
|
39
|
+
says when a quota is close to full.
|
|
40
|
+
- No `cavelon.yaml` here or above: for a new solution run
|
|
41
|
+
`cavelon init --instance <url> --tenant <tenant> --harness <slug>`; for an
|
|
42
|
+
existing one add `cavelon pull --harness <slug>` after it. To start from a
|
|
43
|
+
package file (a blueprint, an export from another instance), run
|
|
44
|
+
`cavelon init --instance <url> --tenant <tenant> --from <file>` instead of
|
|
45
|
+
splitting it by hand or importing it in the Admin. Ask the person for the
|
|
46
|
+
instance and tenant if you do not know them; do not guess.
|
|
47
|
+
|
|
48
|
+
## The loop
|
|
49
|
+
|
|
50
|
+
1. **Pull** what is live: `cavelon pull`. It refuses when `package/` has
|
|
51
|
+
uncommitted changes; commit first. `git diff` then shows what someone changed
|
|
52
|
+
in the Admin.
|
|
53
|
+
2. **Edit** the files in `package/` (one file per schema section) and `tests/`
|
|
54
|
+
(one file per test suite). See the cavelon-authoring skill.
|
|
55
|
+
3. **Validate** offline: `cavelon validate`. Fix every error; `cavelon explain
|
|
56
|
+
<code>` says what a code means and how to fix it.
|
|
57
|
+
4. **Preview**: `cavelon apply --env test` (or `--harness <slug>`). Nothing is
|
|
58
|
+
imported yet. Read the preview: what is created, updated or deleted, which
|
|
59
|
+
active solutions it reaches, what the target still needs (variables and
|
|
60
|
+
secrets with the command that sets each, OAuth grants, runtime bindings,
|
|
61
|
+
trigger identities), loop budgets, and what the instance ignores.
|
|
62
|
+
5. **Confirm** exactly that preview: `cavelon apply --confirm <preview-id>`
|
|
63
|
+
(with the same `--env`). Exit 4 means the target changed since the preview:
|
|
64
|
+
preview again and confirm the new id. When the error lists `blockers`, the
|
|
65
|
+
import's own check found them as it applied: fix what each names (the hint
|
|
66
|
+
says how for a code the kit knows), then preview again.
|
|
67
|
+
6. **Seed** knowledge when needed: `cavelon kb upload <dir> --kb <kb>`. It
|
|
68
|
+
refuses before sending when a file is larger than the instance allows or of
|
|
69
|
+
a type it does not accept, and a `.zip` unless the tenant has archive
|
|
70
|
+
uploads on (`kb_upload_archive_enabled`) and it stays within their file
|
|
71
|
+
count, unpacked size and compression ratio (exit 3, naming the limit and who
|
|
72
|
+
changes it). A test
|
|
73
|
+
Sandbox gets its files with `cavelon sandbox seed <sandbox> <folder>`
|
|
74
|
+
(isolated container) or `cavelon sandbox refresh <sandbox>` after the files
|
|
75
|
+
were put on the VM (customer VM).
|
|
76
|
+
7. **Test**: `cavelon test run --suite <suite>`, then `cavelon wait <operation>`.
|
|
77
|
+
See the cavelon-testing skill. A solution with a Masterloop node is run with
|
|
78
|
+
`cavelon loop start <trigger>` and followed with `cavelon loop watch <run>`;
|
|
79
|
+
see the cavelon-long-running skill.
|
|
80
|
+
8. **Fix** what the results and traces show, and go back to step 2. Commit
|
|
81
|
+
when a step works.
|
|
82
|
+
|
|
83
|
+
## Show the person before confirming
|
|
84
|
+
|
|
85
|
+
Confirm on your own only for a draft solution in a test environment. Stop and
|
|
86
|
+
show the preview to the person, and confirm only after they agree, when:
|
|
87
|
+
|
|
88
|
+
- the preview lists an active solution under "reaches active", or the target
|
|
89
|
+
solution is active;
|
|
90
|
+
- the environment is `prod` (`--env prod`), or the preview deletes anything
|
|
91
|
+
(`--mode replace`);
|
|
92
|
+
- the preview lists target needs (secrets, grants, identities): only a person
|
|
93
|
+
can provide them, with `cavelon secrets set <name>` or in the Admin.
|
|
94
|
+
|
|
95
|
+
The same holds for the other commands that take `--confirm`: without it they
|
|
96
|
+
only show what would happen. Show it to the person before `cavelon trigger
|
|
97
|
+
identity <trigger> <key> --confirm` (it gives a trigger standing authority), and
|
|
98
|
+
before `cavelon sandbox seed … --confirm` or `cavelon loop cancel … --confirm` on
|
|
99
|
+
anything but a test Sandbox or a run you started yourself.
|
|
100
|
+
|
|
101
|
+
`activate` goes through the readiness gate only, and only with a token that
|
|
102
|
+
may activate. It never forces: activating without the evidence stays a person's
|
|
103
|
+
decision in the Admin, so do not ask for it as a shortcut.
|
|
104
|
+
|
|
105
|
+
## A Masterloop parent and its iteration solution
|
|
106
|
+
|
|
107
|
+
A parent whose Masterloop node runs another solution (its iteration solution)
|
|
108
|
+
and that iteration solution are two solutions, applied and activated one at a
|
|
109
|
+
time. The iteration has no test of its own: the parent's loop suite is its
|
|
110
|
+
evidence. Keep this order; it needs no override:
|
|
111
|
+
|
|
112
|
+
1. **Apply the iteration solution** (`cavelon apply`, then `--confirm`). It
|
|
113
|
+
stays a draft.
|
|
114
|
+
2. **Apply the parent**, with the iteration solution's id under
|
|
115
|
+
`runtime_bindings` in its `env/<name>.yaml`. A draft parent binds a draft
|
|
116
|
+
iteration; an active or paused parent refuses one
|
|
117
|
+
(`runtime_draft_iteration_needs_draft_parent`), so apply the pair into a
|
|
118
|
+
draft parent.
|
|
119
|
+
3. **Run the parent's loop suite** (`cavelon test run --suite <loop-suite>
|
|
120
|
+
--wait`), with a trigger case whose loop runs through the iteration solution.
|
|
121
|
+
4. **Activate the iteration solution**: `cavelon activate --harness <iteration>`.
|
|
122
|
+
5. **Activate the parent**: `cavelon activate --harness <parent>`.
|
|
123
|
+
|
|
124
|
+
When `apply` or `activate` meets a step out of order, its `hint` says which
|
|
125
|
+
step and repeats the order (`cavelon explain <code>` too). Do not work around it.
|
|
126
|
+
|
|
127
|
+
## Long-running work
|
|
128
|
+
|
|
129
|
+
`kb upload`, `test run`, `loop start`, `sandbox seed` and `artifacts export`
|
|
130
|
+
return operation ids at once. `cavelon wait <ids> --timeout 90s` returns the
|
|
131
|
+
state when the time is up (exit 6 means still running; the same `wait` again
|
|
132
|
+
resumes). Keep each wait under your shell's command time limit, and run longer
|
|
133
|
+
waits in the background if your client can. Over MCP, the `operation_status`
|
|
134
|
+
tool reads an operation without blocking. Exit 5 means a person must act (an
|
|
135
|
+
approval, a paused loop): tell them, with the link `wait` prints.
|
|
136
|
+
|
|
137
|
+
**Never approve anything.** An approval is decided by a person, or by an API
|
|
138
|
+
key an owner granted the explicit scope `approvals.decide`; never by you, and
|
|
139
|
+
not through `cavelon api` either, even when the token could reach the route.
|
|
140
|
+
|
|
141
|
+
Loops, Sandboxes and execution identities have their own skill:
|
|
142
|
+
cavelon-long-running.
|
|
143
|
+
|
|
144
|
+
## Exit codes
|
|
145
|
+
|
|
146
|
+
0 ok · 1 other error · 2 usage · 3 validation failed · 4 conflict or stale
|
|
147
|
+
preview · 5 needs a person · 6 timed out (still running) · 7 not authorised ·
|
|
148
|
+
8 server or network error.
|
|
149
|
+
|
|
150
|
+
## Where to read more
|
|
151
|
+
|
|
152
|
+
- `cavelon docs search <query>` and `cavelon docs get <page>`: the instance's
|
|
153
|
+
own docs, for its version.
|
|
154
|
+
- `.cavelon/inventory.md`: the tenant's solutions, knowledge bases, tools, test
|
|
155
|
+
suites and sandboxes from the last pull; `cavelon sandbox list` for their
|
|
156
|
+
current state and mode.
|
|
157
|
+
- `cavelon api list --search <word>` and `cavelon api <operation>`: any API
|
|
158
|
+
operation the workflow commands do not cover.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cavelon-testing
|
|
3
|
+
description: Testing and optimizing a Cavelon solution - writing test suites in tests/, running them with cavelon test run, waiting for results, reading traces with cavelon trace, and improving prompts, tools and retrieval from what the traces show. Use when the user wants to test, evaluate, debug or improve the answers of a Cavelon solution, when a test run fails, or before activating a solution.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Testing and optimizing a Cavelon solution
|
|
8
|
+
|
|
9
|
+
A solution is ready when its test suites pass on the instance, not when the
|
|
10
|
+
package validates. Test against a draft solution or a test tenant
|
|
11
|
+
(`--env test`), never by trying things on an active solution.
|
|
12
|
+
|
|
13
|
+
## Test suites
|
|
14
|
+
|
|
15
|
+
Suites live in `tests/`, one YAML file per suite, and `apply` imports them with
|
|
16
|
+
the package. Each suite has cases, and each case one or more steps (a user
|
|
17
|
+
message and what a good answer must contain or do). Copy the shape of an
|
|
18
|
+
existing suite from `cavelon pull`, or read `cavelon docs search regression
|
|
19
|
+
testing`.
|
|
20
|
+
|
|
21
|
+
Write cases for:
|
|
22
|
+
|
|
23
|
+
- the questions the solution exists for, with the facts a good answer needs;
|
|
24
|
+
- edge cases: out of scope, ambiguous, a follow-up in the same conversation;
|
|
25
|
+
- the tools it must call, and the ones it must not;
|
|
26
|
+
- what it must refuse or hand over;
|
|
27
|
+
- in a pipeline with an approval: the cases that must reach it, and the ones
|
|
28
|
+
that must not.
|
|
29
|
+
|
|
30
|
+
## Testing an approval
|
|
31
|
+
|
|
32
|
+
A test run never waits for a person and never approves anything. A run that
|
|
33
|
+
reaches an Approval node ends there: its trace records that the approval was
|
|
34
|
+
reached (`test_approval_reached`), with the approval's title and instructions,
|
|
35
|
+
and the judge grades the step against those. So write the criteria about what
|
|
36
|
+
the person would see: that the approval was reached, who approves, the facts
|
|
37
|
+
and the recommendation in the instructions. The branches after the decision
|
|
38
|
+
(approved, rejected, expired) are never reached by a test; a person checks them
|
|
39
|
+
on a draft solution by deciding a real approval, and you never decide one.
|
|
40
|
+
`examples/expense-approval` in the dev-kit repository has such a suite.
|
|
41
|
+
|
|
42
|
+
## Running
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
cavelon apply --env test # preview, then --confirm <preview-id>
|
|
46
|
+
cavelon test run --suite <suite> # returns operation ids at once
|
|
47
|
+
cavelon wait <operation-id> --timeout 90s
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`wait` exits 6 when the run is still going; run the same `wait` again (keep
|
|
51
|
+
each call under your shell's time limit). `test run --wait --timeout 5m` does
|
|
52
|
+
both in one call where your client allows long commands; when its wait ends
|
|
53
|
+
first, its last line is the command that resumes, with the same timeout. Exit 1 after a run
|
|
54
|
+
means a case failed, even though the run itself finished; the output names the
|
|
55
|
+
cases that did not pass and why, and `cavelon trace <run>` shows each one.
|
|
56
|
+
|
|
57
|
+
## Reading what happened
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
cavelon trace <test-run-id or operation-id> # cases, scores, judge's reasoning
|
|
61
|
+
cavelon trace <conversation-id> --kind conversation # one case's traces
|
|
62
|
+
cavelon trace <conversation-id> --kind conversation --trace <trace-id> # one trace's spans
|
|
63
|
+
cavelon trace <conversation-id> --kind conversation --trace <trace-id> --span <span-id>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Go down only as far as you need: the summary first, then the failing case's
|
|
67
|
+
trace, then the one span that went wrong (the model call, the tool call or the
|
|
68
|
+
retrieval). Output is bounded; run the command each level prints as printed: it
|
|
69
|
+
carries the id its route needs. A case's traces are under its
|
|
70
|
+
`conversation_id` (a trigger case's under its `run_id`, `--kind trigger`), not
|
|
71
|
+
under the test run's id; a wrong id answers with a hint naming the right one.
|
|
72
|
+
A low-scoring pass shows the judge's reasoning too.
|
|
73
|
+
|
|
74
|
+
## Optimizing
|
|
75
|
+
|
|
76
|
+
Change one thing at a time, then run the same suite again and compare:
|
|
77
|
+
|
|
78
|
+
- **Wrong or missing facts:** check retrieval first (which chunks came back in
|
|
79
|
+
the retrieval span). Fix the documents or the knowledge base's settings
|
|
80
|
+
before the prompt.
|
|
81
|
+
- **Wrong tool, or a tool called with bad arguments:** sharpen the tool's
|
|
82
|
+
description and parameters, then the agent's instructions about when to use it.
|
|
83
|
+
- **Right facts, poor answer:** adjust the agent's instructions; keep them short
|
|
84
|
+
and specific.
|
|
85
|
+
- **Too slow or too costly:** read the token counts and durations in the trace;
|
|
86
|
+
a smaller model or fewer tool rounds often suffice for a step.
|
|
87
|
+
|
|
88
|
+
Record why a change helped in the commit message. When every suite passes,
|
|
89
|
+
`cavelon activate --harness <slug>` goes through the readiness gate; if the
|
|
90
|
+
token may not activate, a person activates in the Admin.
|