@cavelon/cli 0.2.10 → 0.2.12

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.
@@ -6,6 +6,8 @@ import { MANIFEST_SECTION, PERSONA_SECTION, sectionFields } from "./package-form
6
6
  import { kitErrorEntry } from "./kit-codes.js";
7
7
  import { checkWorkflowQueries } from "./workflow-queries.js";
8
8
  import { checkWritePaths } from "./database-write-paths.js";
9
+ import { ATTACHED_DOCUMENTS_CODES, checkAttachedDocuments, inAttachedDocuments } from "./attached-documents.js";
10
+ import { checkManagedFields, MANAGED_KINDS_LEFT_OUT_CODE, MANAGED_KINDS_UNSUPPORTED_CODE, MANAGED_SETTING_UNKNOWN_CODE, UNMANAGED_SET_CODE, } from "./managed-fields.js";
9
11
  import { cavelonCommand, fill, folderCommand } from "./printed.js";
10
12
  import { branches, checkModels, checkReferences, checkUnknownFields, closest, DUPLICATE_CODE, FIELD_UNKNOWN_CODE, MODEL_UNKNOWN_CODE, REFERENCE_MISSING_CODE, REFERENCE_UNKNOWN_CODE, KNOWLEDGE_TOOL_KEYS, } from "./package-references.js";
11
13
  export const SCHEMA_CODE = "package_schema_invalid";
@@ -32,6 +34,7 @@ const SOLUTION_MISMATCH_CODE = "solution_slug_mismatch";
32
34
  const TENANT_WIDE_CODE = "tenant_wide_section";
33
35
  const ASSERTION_UNCHECKED_CODE = "test_assertion_unchecked";
34
36
  const TESTING_DOCS = "/docs/concepts/regression-testing";
37
+ const MANAGED_DOCS = "https://github.com/goodguys-gmbh/cavelon-dev-kit/blob/main/docs/concepts.md#fields-the-folder-does-not-manage";
35
38
  const DATABASE_DOCS = "/docs/administration/database-connectors";
36
39
  export const KIT_CODES = [
37
40
  {
@@ -185,6 +188,36 @@ export const KIT_CODES = [
185
188
  hint: "Change the query's parameters instead (database_query.parameters), or put the field back as pulled.",
186
189
  docs: DATABASE_DOCS,
187
190
  },
191
+ {
192
+ code: UNMANAGED_SET_CODE,
193
+ area: "package",
194
+ message: "A package file sets a field that cavelon.yaml lists under unmanaged: apply leaves it out, so the instance keeps its own value.",
195
+ hint: "Remove the field from the package file, or take its pointer out of unmanaged in cavelon.yaml when the folder should manage it again. " +
196
+ "`cavelon pull` does not write an unmanaged field.",
197
+ docs: MANAGED_DOCS,
198
+ },
199
+ {
200
+ code: MANAGED_SETTING_UNKNOWN_CODE,
201
+ area: "package",
202
+ message: "cavelon.yaml's unmanaged or managed_kinds names a field or a kind this instance's package schema does not have.",
203
+ hint: "Check the pointer and the kinds for a typo; `cavelon schema persona` lists the persona's fields. A field inside a list cannot be named.",
204
+ docs: MANAGED_DOCS,
205
+ },
206
+ {
207
+ code: MANAGED_KINDS_LEFT_OUT_CODE,
208
+ area: "package",
209
+ message: "A list entry is of a kind that cavelon.yaml's managed_kinds does not list: apply leaves it out, and the instance keeps its own entries of that kind.",
210
+ hint: "Add the kind to managed_kinds in cavelon.yaml when the folder should manage it, or remove the entry from the package file.",
211
+ docs: MANAGED_DOCS,
212
+ },
213
+ {
214
+ code: MANAGED_KINDS_UNSUPPORTED_CODE,
215
+ area: "package",
216
+ message: "This instance cannot import only some kinds of a list, so apply leaves the list out to keep the entries of the kinds the folder does not manage.",
217
+ hint: "The instance keeps the whole list as it is. To send the list anyway, replacing every kind, remove its entry from managed_kinds in cavelon.yaml; " +
218
+ "an instance that publishes <list>_kinds in its package schema imports only the managed kinds.",
219
+ docs: MANAGED_DOCS,
220
+ },
188
221
  {
189
222
  code: "package_file_duplicate",
190
223
  area: "package",
@@ -192,6 +225,7 @@ export const KIT_CODES = [
192
225
  hint: "Keep one of them: package/<section>.yaml, or the section's own folder from cavelon.yaml's layout.",
193
226
  docs: PACKAGE_DOCS,
194
227
  },
228
+ ...ATTACHED_DOCUMENTS_CODES,
195
229
  ];
196
230
  function findingEntry(catalog, code) {
197
231
  return catalog?.rule_codes?.find((e) => e.code === code) ?? KIT_CODES.find((e) => e.code === code) ?? catalog?.api_error_codes?.find((e) => e.code === code);
@@ -216,10 +250,27 @@ export function packageVersionOf(pkg) {
216
250
  const version = manifest.package_version;
217
251
  return typeof version === "string" ? version : undefined;
218
252
  }
253
+ function withPlainDiscriminators(value) {
254
+ if (Array.isArray(value))
255
+ return value.map(withPlainDiscriminators);
256
+ if (!value || typeof value !== "object")
257
+ return value;
258
+ const out = {};
259
+ for (const [key, inner] of Object.entries(value)) {
260
+ const name = key === "discriminator" ? inner?.propertyName : undefined;
261
+ out[key] = typeof name === "string" ? { propertyName: name } : withPlainDiscriminators(inner);
262
+ }
263
+ return out;
264
+ }
219
265
  function compile(schema) {
220
266
  const { $id: _id, $schema: _schema, ...body } = schema;
221
- const ajv = new Ajv2020({ strict: false, allErrors: true, verbose: true, validateSchema: false, validateFormats: false });
222
- return ajv.compile(body);
267
+ const options = { strict: false, allErrors: true, verbose: true, validateSchema: false, validateFormats: false };
268
+ try {
269
+ return new Ajv2020({ ...options, discriminator: true }).compile(withPlainDiscriminators(body));
270
+ }
271
+ catch {
272
+ return new Ajv2020(options).compile(body);
273
+ }
223
274
  }
224
275
  function closestBranchErrors(errors) {
225
276
  const dropped = new Set();
@@ -253,12 +304,17 @@ function closestBranchErrors(errors) {
253
304
  const field = e.instancePath.startsWith(`${here}/`) && !e.instancePath.slice(here.length + 1).includes("/");
254
305
  return sum + ((e.keyword === "const" || e.keyword === "enum") && field ? 100 : 1);
255
306
  }, 0);
256
- const ranked = [...byBranch.values()].map((list) => ({ list, distance: distance(list) })).sort((a, b) => a.distance - b.distance);
307
+ const claimed = new Set([...byBranch.values()].flat());
308
+ const unclaimed = errors.slice(0, index).filter((e) => !dropped.has(e) && !isChoice(e) && !claimed.has(e) && (e.instancePath === here || e.instancePath.startsWith(`${here}/`)));
309
+ if (unclaimed.length)
310
+ byBranch.set(-1, unclaimed);
311
+ const ranked = [...byBranch.entries()].map(([branch, list]) => ({ branch, list, distance: distance(list) })).sort((a, b) => a.distance - b.distance);
257
312
  if (ranked.length < 2 || ranked[0].distance === ranked[1].distance)
258
313
  return;
259
314
  for (const other of ranked.slice(1))
260
- for (const error of other.list)
261
- dropped.add(error);
315
+ if (other.branch !== -1)
316
+ for (const error of other.list)
317
+ dropped.add(error);
262
318
  for (const error of ranked[0].list)
263
319
  countedAt.set(error, pathOf(choice));
264
320
  });
@@ -326,6 +382,8 @@ export function checkPackage(disk, options) {
326
382
  continue;
327
383
  if (misnamed.some((m) => within(error.instancePath, m.pointer)))
328
384
  continue;
385
+ if (inAttachedDocuments(options.schema, error.instancePath))
386
+ continue;
329
387
  if (error.keyword === "required" && error.instancePath === "" && unreadable.has(String(error.params.missingProperty)))
330
388
  continue;
331
389
  const { pointer, message } = describe(error);
@@ -340,6 +398,7 @@ export function checkPackage(disk, options) {
340
398
  findings.push(...checkEndpointLimits(disk, options.schema));
341
399
  findings.push(...checkBranchConcurrency(disk, options.limits));
342
400
  findings.push(...checkKnowledgeSearch(disk));
401
+ findings.push(...checkAttachedDocuments(disk, options.schema));
343
402
  findings.push(...checkUnknownFields(disk, options.schema, findings));
344
403
  findings.push(...checkReferences(disk, options.inventory));
345
404
  findings.push(...checkModels(disk, options.inventory));
@@ -350,6 +409,7 @@ export function checkPackage(disk, options) {
350
409
  findings.push(...checkQueryTools(disk, options.schema, options.queryBaseline, options.queryConnections));
351
410
  findings.push(...checkWorkflowQueries(disk, options.schema, options.inventory, options.queryBaseline));
352
411
  findings.push(...checkWritePaths(disk, options.schema, options.catalog, options.queryBaseline));
412
+ findings.push(...checkManagedFields(disk, options.managed, options.schema));
353
413
  noteTenantWide(findings, options.schema, options.solution);
354
414
  for (const finding of findings) {
355
415
  const entry = findingEntry(options.catalog, finding.code);
@@ -114,11 +114,12 @@ export function exportForm(schema, node, value, depth = 0, position) {
114
114
  if (!props)
115
115
  return value;
116
116
  const required = requiredOf(object);
117
+ const openMap = object.additionalProperties === true;
117
118
  const out = {};
118
119
  for (const [key, sub] of Object.entries(props)) {
119
120
  if (key in value)
120
121
  out[key] = exportForm(schema, sub, value[key], depth + 1);
121
- else {
122
+ else if (!openMap) {
122
123
  const fallback = implicitDefault(schema, key, sub, required, position);
123
124
  if (fallback !== undefined)
124
125
  out[key] = structuredClone(fallback);
@@ -152,6 +153,10 @@ function isEmpty(value) {
152
153
  return value === null || value === undefined || (isObject(value) && Object.keys(value).length === 0);
153
154
  }
154
155
  const isUnset = (value) => isEmpty(value) || (Array.isArray(value) && value.length === 0);
156
+ function emptyListIsAValue(schema, node) {
157
+ const field = resolve(schema, node);
158
+ return Boolean(field) && field.default === null && nullable(schema, field) && arrayBranch(schema, field) !== undefined;
159
+ }
155
160
  export function settledForm(schema, node, value, depth = 0) {
156
161
  const resolved = resolve(schema, node);
157
162
  if (!resolved || depth > 40)
@@ -175,6 +180,10 @@ export function settledForm(schema, node, value, depth = 0) {
175
180
  continue;
176
181
  }
177
182
  const settled = settledForm(schema, props[key], inner, depth + 1);
183
+ if (Array.isArray(inner) && emptyListIsAValue(schema, props[key])) {
184
+ out[key] = settled;
185
+ continue;
186
+ }
178
187
  if (!required.has(key)) {
179
188
  const fallback = implicitDefault(schema, key, props[key], required, undefined);
180
189
  if (isUnset(settled) && (fallback === undefined || isUnset(fallback)))
package/dist/project.js CHANGED
@@ -6,6 +6,7 @@ import { CavelonError, ExitCode, usageError } from "./errors.js";
6
6
  import { layoutFrom } from "./package-files.js";
7
7
  import { cavelonCommand } from "./printed.js";
8
8
  import { solutionPath, solutionPaths } from "./file-boundary.js";
9
+ import { validManagedPointer } from "./managed-fields.js";
9
10
  export const PROJECT_FILE = "cavelon.yaml";
10
11
  function stringField(value, ...keys) {
11
12
  if (typeof value === "string" && value.trim())
@@ -60,9 +61,42 @@ export function parseProject(file, text) {
60
61
  harness: stringField(map.harness, "slug", "id"),
61
62
  packageVersion: stringField(map.package_version),
62
63
  layout: layoutFrom(map),
64
+ managed: managedFrom(file, map),
63
65
  raw: map,
64
66
  };
65
67
  }
68
+ function managedFrom(file, map) {
69
+ const invalid = (message) => new CavelonError(ExitCode.validation, {
70
+ code: "project_file_invalid",
71
+ message: `${file}: ${message}`,
72
+ hint: "Name a field inside a section as a JSON pointer, such as /persona/engagement_rules; `managed_kinds` maps such a pointer to a list of kinds.",
73
+ });
74
+ const pointer = (value, where) => {
75
+ if (typeof value !== "string" || !validManagedPointer(value.trim()))
76
+ throw invalid(`${where} must be a JSON pointer to a field inside a section, got ${JSON.stringify(value)}.`);
77
+ return value.trim();
78
+ };
79
+ const unmanaged = [];
80
+ if (map.unmanaged !== undefined && map.unmanaged !== null) {
81
+ if (!Array.isArray(map.unmanaged))
82
+ throw invalid("unmanaged must be a list of JSON pointers.");
83
+ for (const entry of map.unmanaged)
84
+ unmanaged.push(pointer(entry, "each unmanaged entry"));
85
+ }
86
+ const kinds = {};
87
+ const declared = map.managed_kinds;
88
+ if (declared !== undefined && declared !== null) {
89
+ if (typeof declared !== "object" || Array.isArray(declared))
90
+ throw invalid("managed_kinds must map a JSON pointer to the list of kinds the folder manages.");
91
+ for (const [key, value] of Object.entries(declared)) {
92
+ const at = pointer(key, "each managed_kinds key");
93
+ if (!Array.isArray(value) || !value.every((k) => typeof k === "string" && k.trim()))
94
+ throw invalid(`managed_kinds["${at}"] must be a list of kinds, such as [starters].`);
95
+ kinds[at] = [...new Set(value.map((k) => k.trim()))];
96
+ }
97
+ }
98
+ return { unmanaged: [...new Set(unmanaged)], kinds };
99
+ }
66
100
  function refuseCredentials(file, map) {
67
101
  for (const forbidden of ["token", "api_key", "secret"]) {
68
102
  if (forbidden in map) {
@@ -584,6 +584,7 @@ async function removeSkills(record, skills, stillUsed) {
584
584
  if (isGenerated(await readTextFile(full).catch(() => undefined))) {
585
585
  await fs.rm(full, { force: true });
586
586
  removed++;
587
+ await removeEmptyDirs(path.dirname(full), folder);
587
588
  }
588
589
  }
589
590
  await fs.rmdir(folder).catch(() => undefined);
@@ -11,6 +11,17 @@ format as a JSON Schema; `cavelon` splits it along that schema's top-level
11
11
  sections, so the files follow whatever the instance version defines. Do not
12
12
  assume a section or field exists: check the schema or the docs first.
13
13
 
14
+ ## New solutions: make the Canvas useful
15
+
16
+ For a new ordinary chat or trigger solution, include its connected **Chat
17
+ Start** (`chat_start`) or **Trigger Start** (`trigger_start`) and useful saved
18
+ demo input as part of authoring, even though start nodes are optional. An
19
+ agent marked `is_entrypoint: true` alone does not provide that Canvas debug
20
+ entry. See [Canvas entrypoints](references/canvas-entrypoints.md) for the
21
+ package shape, trigger demo defaults and Masterloop iteration exceptions.
22
+ Preserve an existing solution's entry design unless the requested work needs
23
+ it changed; do not add live triggers just to provide a demo.
24
+
14
25
  ## Before you plan: the instance's limits
15
26
 
16
27
  Read `cavelon limits` (or the `limits` MCP tool) before you design or change a
@@ -219,11 +230,51 @@ and fill the field in to set it. A file of comments only sets nothing.
219
230
  (`persona_message_empty`). Write the text, or turn it off.
220
231
  - Leave the persona out (all fields commented) only for a solution nobody
221
232
  talks to directly: a pipeline, a loop, a solution another solution calls.
233
+ - **Engagement rules** (`engagement_rules`) are the page starter questions
234
+ (`kind: starters`) and the campaigns: `calendar`, `banner` and
235
+ `decoration`. Give every rule a stable `id` of lowercase letters, digits and
236
+ hyphens, and never reuse one for something else: the instance counts results
237
+ by `rule_id`. `cavelon schema persona.engagement_rules` shows each kind's
238
+ fields. A minimal campaign:
239
+
240
+ ```yaml
241
+ engagement_rules:
242
+ - id: winter-snow
243
+ kind: decoration
244
+ name: Winter snow
245
+ enabled: true
246
+ window: { timezone: Europe/Vienna, starts_at: "2026-12-01T00:00", ends_at: "2027-01-07T00:00" }
247
+ content: { effect: snow }
248
+ ```
249
+
250
+ Left out, an import keeps the solution's rules; `[]` deletes them all.
251
+ Campaigns are usually edited in the Admin. When people do that, add
252
+ `managed_kinds: {/persona/engagement_rules: [starters]}` to `cavelon.yaml`, so
253
+ `pull` and `apply` touch only the starters. Try a page and a date with
254
+ `cavelon engagement preview --page <url> --at <time>`. On an active solution,
255
+ rules, greeting and teasers reach visitors at once, without a publication,
256
+ so the preview asks for a person. A site with a Content Security Policy must
257
+ allow the widget's `chat-widget-engagement.js` and the image hosts a campaign
258
+ uses: `cavelon docs get channels/widget`.
222
259
  - Without `harness_id`, the persona operations of `cavelon api`
223
260
  (`get_bot_persona`, `upsert_bot_persona`) reach the tenant's default route;
224
261
  in a solution folder, `cavelon api` sends the folder's solution, and says
225
262
  so. Prefer the package file and `apply` over those operations.
226
263
 
264
+ ## A chat turn's wait for attached files
265
+
266
+ A solution sets how long a chat turn waits for a file it carries that is still
267
+ being read in `harnesses.yaml`: `settings.attached_documents` with
268
+ `wait_until_readable` (only `false` turns the wait off) and `wait_seconds`
269
+ (0 to 120, as the package schema publishes). The instance reads it leniently
270
+ and never refuses it, so `cavelon validate` warns instead
271
+ (`attached_documents_value_ignored`, `attached_documents_wait_clamped`). It is
272
+ not the tenant's `attached_documents` context-source limit, which bounds how
273
+ much of the files reaches the model. On an active solution the change goes to
274
+ the draft; try it with `cavelon chat "<message>" --file <path> --draft` (a
275
+ personal access token holding `playground.use` reaches the draft; an API key
276
+ gets the published version).
277
+
227
278
  ## Rules that keep a package portable
228
279
 
229
280
  - **Slugs are identities.** An entry is matched by its slug on import; renaming
@@ -0,0 +1,83 @@
1
+ # Canvas entrypoints and demo inputs
2
+
3
+ When creating an ordinary chat or trigger solution, leave it ready to inspect
4
+ and debug in the Canvas. Start nodes are optional in the platform, so schema
5
+ validation alone cannot establish this. Read the instance's schema for
6
+ `registry_entities.orchestration_nodes`, `registry_entities.graph_edges`,
7
+ `NodeConfig_chat_start` and `NodeConfig_trigger_start` before writing them;
8
+ `cavelon docs get reference/nodes-and-edges` explains the graph rules.
9
+
10
+ ## Chat
11
+
12
+ Add one `chat_start` and a `pipeline` edge to the first agent or workflow node
13
+ in the same harness. Give `config.demo_message` a realistic question from
14
+ the solution's tests, rather than a placeholder. For example, alongside an
15
+ agent `faq-agent` in harness `support-faq`, `package/registry_entities.yaml`:
16
+
17
+ ```yaml
18
+ orchestration_nodes:
19
+ - slug: chat
20
+ name: Chat
21
+ node_type: chat_start
22
+ harness_slug: support-faq
23
+ config:
24
+ demo_message: When can I reach your support team?
25
+ canvas_x: 0
26
+ canvas_y: 200
27
+ graph_edges:
28
+ - harness_slug: support-faq
29
+ from_node_ref: {kind: orchestration, slug: chat}
30
+ to_node_ref: {kind: agent, slug: faq-agent}
31
+ edge_type: pipeline
32
+ config: {}
33
+ ```
34
+
35
+ Keep conversation history on the Chat Start-to-agent edge at its default.
36
+ There is at most one active Chat Start per harness. Starts have no incoming
37
+ edges and cannot connect directly to a Join.
38
+
39
+ ## Triggers
40
+
41
+ For each intended trigger entry, add a `trigger_start` whose
42
+ `config.trigger_slug` names the actual trigger in the same harness, then
43
+ connect it to the intended first agent or workflow node with a `pipeline`
44
+ edge. There is at most one Trigger Start per trigger. A chat-and-trigger
45
+ solution can have both kinds of start; a trigger-only solution needs no
46
+ artificial chat route.
47
+
48
+ Suggest and save `config.demo_payload` with realistic, non-sensitive example
49
+ values derived from the trigger's actual `config.payload_schema` and
50
+ `config.sample_payload`. Include required fields, honor types, enums and
51
+ formats, and choose values that exercise a useful path. For a trigger whose
52
+ contract requires `order_id` (string) and `total` (number), an appropriate
53
+ node fragment is:
54
+
55
+ ```yaml
56
+ node_type: trigger_start
57
+ config:
58
+ trigger_slug: order-received
59
+ demo_payload: {order_id: DEMO-1001, total: 49.9}
60
+ ```
61
+
62
+ Keep the trigger's `config.sample_payload` coherent with that demo. On a
63
+ webhook, the **trigger's** `config.payload_schema` validates incoming
64
+ payloads. A start node's `sample_payload` or `payload_schema` does not replace
65
+ that runtime contract. Supply `demo_request_context` or
66
+ `demo_document_names` only when the scenario needs them and the schema offers
67
+ them. Demo input neither sets secrets nor grants execution identity; keep a
68
+ new trigger inactive until the intended activation is approved.
69
+
70
+ ## Exceptions and completion
71
+
72
+ Masterloop **iteration** harnesses have constrained entrypoints. A native
73
+ iteration requires its agent to be the only root, marked `is_entrypoint`;
74
+ pure iterations must also retain their required unambiguous root. Follow
75
+ those rules rather than inserting a Chat Start or Trigger Start. Put the
76
+ external trigger entry on the parent where appropriate. Do not rewrite legacy or deliberately
77
+ headless harnesses solely to satisfy this recommendation.
78
+
79
+ Before handing over a new ordinary solution, check that its start references
80
+ the right harness/trigger, its outgoing edge resolves, and its saved demo
81
+ input is useful and schema-compatible. Validate and preview the whole
82
+ package, then use the cavelon-testing skill for suites and Canvas debugging.
83
+ Running a Canvas demo executes real tools; saved examples alone run nothing.
@@ -36,6 +36,12 @@ Do not work around it; use the other column.
36
36
  skill). `cavelon validate`, then `cavelon apply --env test`: the preview shows
37
37
  the loop's budget, Sandboxes that an active solution writes to, and triggers
38
38
  whose execution identity is missing.
39
+ Give an externally triggered parent a connected Trigger Start with
40
+ `config.trigger_slug` and realistic `config.demo_payload` derived from
41
+ the trigger's schema/sample. See the authoring skill's Canvas entrypoints
42
+ reference. Do not add starts to constrained native/pure iteration
43
+ harnesses: preserve their required entrypoint rules. Saved
44
+ demo input neither binds an execution identity nor starts a loop.
39
45
  2. **Bind the test Sandbox** in `env/test.yaml` (`runtime_bindings`), never the
40
46
  live one: a loop test needs a Sandbox of its own, because only one writer at a
41
47
  time may use it.
@@ -195,6 +195,11 @@ in a pinned recovery snapshot and clears the draft; report its warnings.
195
195
  remove it unless the person wants it.
196
196
  2. **Edit** the files in `package/` (one file per schema section) and `tests/`
197
197
  (one file per test suite). See the cavelon-authoring skill.
198
+ For a new ordinary chat/trigger solution, also author the connected Chat
199
+ Start or Trigger Start with realistic saved demo input; an entrypoint
200
+ agent alone leaves the Canvas debug entry incomplete. Follow the
201
+ authoring skill's Canvas entrypoints reference, including its Masterloop
202
+ iteration exceptions. This does not activate a trigger or run its demo.
198
203
  3. **Validate** offline: `cavelon validate`. Fix every error; `cavelon explain
199
204
  <code>` says what a code means and how to fix it. Besides the schema it
200
205
  finds duplicate slugs, handoffs and test assertions naming an agent the
@@ -329,7 +334,9 @@ preview too.
329
334
  `cavelon chat "<message>" --harness <solution>` (the `chat` tool over MCP)
330
335
  prints its answer, the session to continue with `--session`, and the
331
336
  conversation to trace. A draft answers only a person's token, as a
332
- Playground run.
337
+ Playground run; `--draft` tries an active solution's unpublished draft. On
338
+ `chat_turn_timeout` the turn goes on and its answer is stored: read the
339
+ conversation the error names instead of sending the message again.
333
340
  - `cavelon deactivate --harness <solution>` takes an active solution out of
334
341
  live traffic: it previews, and only the confirm command it prints
335
342
  deactivates. Its status becomes `inactive`, not `draft`: it keeps its
@@ -10,6 +10,23 @@ A solution is ready when its test suites pass on the instance, not when the
10
10
  package validates. Test against a draft solution or a test tenant
11
11
  (`--env test`), never by trying things on an active solution.
12
12
 
13
+ ## Canvas debug readiness
14
+
15
+ For a newly authored ordinary chat/trigger solution, check its connected
16
+ Chat Start or Trigger Start as well as its suites. The Chat Start should
17
+ have a useful `config.demo_message`; a Trigger Start should bind the right
18
+ `config.trigger_slug` and save `config.demo_payload` matching that trigger's
19
+ payload contract. Check a realistic happy path and a relevant edge case in
20
+ the suites. The cavelon-authoring skill's Canvas entrypoints reference covers
21
+ the package shapes and exceptions for Masterloop iteration harnesses.
22
+
23
+ After apply, inspect the saved input and route in the draft's Canvas when
24
+ the UI is available (`cavelon docs get concepts/playground-and-debugging`).
25
+ **Run demo executes real tools**, including external writes. Check the test
26
+ tenant, bindings and effects before running it; no secret belongs in demo
27
+ input. If you cannot inspect the UI, report that check as outstanding rather
28
+ than claiming a Canvas run from package validation alone.
29
+
13
30
  ## Test suites
14
31
 
15
32
  Suites live in `tests/`, one YAML file per suite, and `apply` imports them with
@@ -85,6 +102,27 @@ it as a judge criterion instead of checking it, so read `cavelon docs get
85
102
  concepts/regression-testing` for the types the instance knows before relying on
86
103
  `answered_by` or `handoff_to`.
87
104
 
105
+ ## Trigger output checks
106
+
107
+ Inspect a completed trigger's output before choosing its assertions. A text
108
+ agent returns text directly; it has no implicit `answer` JSON field. Omit
109
+ `json_path` for text and check the output itself, for example:
110
+
111
+ ```yaml
112
+ type: trigger
113
+ trigger:
114
+ trigger_slug: stock-updated
115
+ input: {item_id: DEMO-SKU-0, quantity: 0, active: false}
116
+ expect_status: completed
117
+ output:
118
+ - contains: "quantity=0; active=false"
119
+ ```
120
+
121
+ Use `json_path` only for structured JSON output and a path that the actual
122
+ output contains. Prefer `contains` or a bounded `matches` pattern when exact
123
+ punctuation is not part of the requirement. A completed run can still have
124
+ failed assertions; fix and rerun those before calling the suite passed.
125
+
88
126
  ## Testing an approval
89
127
 
90
128
  A test run never waits for a person and never approves anything. A run that
@@ -133,6 +171,13 @@ no verdict; `cavelon explain <status>` says what it means and what to do next:
133
171
  The case's own reason (which knowledge base, which value) is in the output of
134
172
  `test run --wait`, `wait` and `cavelon trace <run>`.
135
173
 
174
+ Without `--suite`, `test run` runs every suite of the solution except those
175
+ that never vote in readiness: a campaign's question check (tagged `engagement`
176
+ and `rule:<id>`, made by the Admin's Engagement editor, and never part of the
177
+ package). They are listed under `skipped` and never change the exit code; a
178
+ failed question there is a content gap for the campaign's author.
179
+ `--suite <name>` runs one when asked.
180
+
136
181
  ## Database query tools
137
182
 
138
183
  Test edited package SQL before apply with `cavelon db test-run <slug> --draft
@@ -352,7 +397,14 @@ To try a question outside the suite, `cavelon chat "<message>" --harness
352
397
  the answer, the session to continue with `--session`, and the conversation to
353
398
  trace. It reaches an active solution that is not the tenant's default route,
354
399
  which the tenant's chat and widget never answer with; a draft answers only a
355
- person's token, as a Playground run. `cavelon api chat` with `harness_id` in
400
+ person's token, as a Playground run. `--file <path>` attaches a file (the
401
+ solution's wait for a file still being read is `settings.attached_documents`
402
+ in `harnesses.yaml`). With a personal access token holding `playground.use`
403
+ the chat is a Playground run, so an active solution answers with its pending
404
+ draft; `--draft` asks for it explicitly, and an API key gets the published
405
+ version. A `chat_turn_timeout` means the turn goes on and its answer is stored:
406
+ never send the message again (it would run twice); read the conversation the
407
+ error names. A `cancelled` status is a turn stored without an answer. `cavelon api chat` with `harness_id` in
356
408
  the body does the same, but needs the id and a confirm. `cavelon deactivate
357
409
  --harness <solution>` takes an active solution out of live traffic again; it
358
410
  previews first and is the person's decision: show the preview; over MCP the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cavelon/cli",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "description": "The cavelon binary: CLI and local MCP server for building Cavelon solutions with a coding agent.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/goodguys-gmbh/cavelon-dev-kit",
@@ -46,10 +46,10 @@
46
46
  "@types/node": "^20.19.0",
47
47
  "esbuild": "0.28.2",
48
48
  "eslint": "^10.12.0",
49
- "typebox": "1.3.36",
49
+ "typebox": "1.4.2",
50
50
  "typescript": "~6.0.3",
51
51
  "typescript-eslint": "^8.71.0",
52
52
  "vitest": "^4.0.0",
53
- "zod": "4.6.5"
53
+ "zod": "4.6.7"
54
54
  }
55
55
  }