@cavelon/cli 0.2.18 → 0.2.19

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.
@@ -602,9 +602,18 @@ export function previewText(p, context = {}) {
602
602
  lines.push(["not applied", notAppliedLines(skipped)]);
603
603
  const impact = p.impact ?? {};
604
604
  const active = (impact.active_harnesses ?? []).map((h) => {
605
- const via = [...(h.tools ?? []), ...(h.knowledge_bases ?? []), ...(h.sandboxes ?? [])];
606
- return `${h.name ?? h.harness_slug} (${h.harness_slug})${via.length ? ` through ${list(via, 5)}` : ""}`;
605
+ const via = [...(h.tools ?? []), ...(h.knowledge_bases ?? []), ...(h.skills ?? []), ...(h.guardrails ?? []), ...(h.sandboxes ?? [])];
606
+ const steps = h.nodes?.length ? `; workflow step${h.nodes.length === 1 ? "" : "s"} ${list(h.nodes, 5)}` : "";
607
+ return `${h.name ?? h.harness_slug} (${h.harness_slug})${via.length ? ` through ${list(via, 5)}` : ""}${steps}`;
607
608
  });
609
+ const changed = [
610
+ ["tools", impact.changed_tools],
611
+ ["knowledge bases", impact.changed_knowledge_bases],
612
+ ["skills", impact.changed_skills],
613
+ ["guardrails", impact.changed_guardrails],
614
+ ].filter((entry) => Array.isArray(entry[1]) && entry[1].length > 0);
615
+ if (changed.length)
616
+ lines.push(["changes shared", changed.map(([what, names]) => `${what} ${list(names, 5)}`).join("; ")]);
608
617
  if (active.length)
609
618
  lines.push(["reaches active", active.map((a) => `\n - ${a}`).join("")]);
610
619
  if (impact.sandbox_writers?.length)
@@ -1017,7 +1026,20 @@ function graphDraftTarget(preview, harness) {
1017
1026
  Number.isSafeInteger(p.draft_revision) && p.draft_revision >= 0 &&
1018
1027
  Array.isArray(preview.impact?.active_harnesses));
1019
1028
  }
1020
- function personReason(preview, harness, mode, env, shared = [], sharedReaches = [], live = []) {
1029
+ const UNFOLLOWED_UPDATES = ["skills", "guardrails", "tools", "knowledge_bases", "tool_bindings"];
1030
+ export function unfollowedRows(preview, pkg) {
1031
+ const impact = preview.impact;
1032
+ if (!impact || (Array.isArray(impact.changed_skills) && Array.isArray(impact.changed_guardrails)))
1033
+ return [];
1034
+ const updates = preview.summary?.updates ?? {};
1035
+ const rows = UNFOLLOWED_UPDATES.filter((section) => (updates[section] ?? 0) > 0);
1036
+ if ((preview.summary?.creates?.tool_bindings ?? 0) > 0 && !rows.includes("tool_bindings"))
1037
+ rows.push("tool_bindings");
1038
+ if (Array.isArray(pkg.web_sources) && pkg.web_sources.length)
1039
+ rows.push("web_sources");
1040
+ return rows;
1041
+ }
1042
+ function personReason(preview, harness, mode, env, shared = [], sharedReaches = [], live = [], unfollowed = []) {
1021
1043
  if (shared.length) {
1022
1044
  const reaching = sharedReaches.length ? `, reaching the active solution${sharedReaches.length === 1 ? "" : "s"} ${list(sharedReaches, 5)}` : "";
1023
1045
  return `changes what the whole tenant shares (${list(shared, 5)})${reaching}`;
@@ -1031,6 +1053,11 @@ function personReason(preview, harness, mode, env, shared = [], sharedReaches =
1031
1053
  return `changes ${list(live, 5)}, which visitors of the active solution ${harness.slug} see at once, without a publication`;
1032
1054
  if (preview.impact?.active_harnesses?.length)
1033
1055
  return "reaches an active solution";
1056
+ if (unfollowed.length) {
1057
+ const rows = unfollowed.map((s) => s.replace(/_/g, " "));
1058
+ const named = rows.length > 1 ? `${rows.slice(0, -1).join(", ")} and ${rows.at(-1)}` : rows[0];
1059
+ return `changes ${named} that other solutions may use, and this instance's preview does not say which active solutions that reaches`;
1060
+ }
1034
1061
  if (counts(preview.summary?.deletes) || mode === "replace")
1035
1062
  return "deletes";
1036
1063
  if (env === "prod")
@@ -1269,7 +1296,7 @@ export const apply = {
1269
1296
  if (!preview.preview_id) {
1270
1297
  ctx.warn("This instance's preview returns no preview id, so `apply --confirm` cannot import exactly it; update the instance.");
1271
1298
  }
1272
- const reason = personReason(preview, harness, mode, envFile?.name, sharedImported, reaches, livePointers);
1299
+ const reason = personReason(preview, harness, mode, envFile?.name, sharedImported, reaches, livePointers, unfollowedRows(preview, sent.package));
1273
1300
  if (preview.preview_id) {
1274
1301
  const stored = {
1275
1302
  preview_id: preview.preview_id,
@@ -277,7 +277,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
277
277
 
278
278
  ---
279
279
 
280
- typebox 1.4.3
280
+ typebox 1.4.7
281
281
  TypeBox
282
282
 
283
283
  The MIT License (MIT)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "format": 1,
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "entries": {
5
5
  "omp": [
6
6
  "omp-extension.mjs"
@@ -45,8 +45,8 @@
45
45
  },
46
46
  {
47
47
  "path": "omp-extension.mjs",
48
- "size": 1149112,
49
- "sha256": "4c2546c4516e940bbc3118601fc53dd6938fb70329af59ecb8b1044e44b5f0c2"
48
+ "size": 1149595,
49
+ "sha256": "192ad9c0bcc9db892d9af36a315f9ce52cbc3b9e045562c832d1dcacf0e81fce"
50
50
  },
51
51
  {
52
52
  "path": "opencode-server.mjs",
@@ -60,13 +60,13 @@
60
60
  },
61
61
  {
62
62
  "path": "pi-extension.mjs",
63
- "size": 1149020,
64
- "sha256": "dfdc37d005db9c839ab4f5b07e600953cca04c181f0951001540033dfb2592e8"
63
+ "size": 1149503,
64
+ "sha256": "eae7c35025daa4507e26e3eddc9d6b012cee80614f6de82031d9c618fd503096"
65
65
  },
66
66
  {
67
67
  "path": "THIRD-PARTY-NOTICES",
68
68
  "size": 18302,
69
- "sha256": "7ed44d7c1e35f82897bcb4e89d28a07b85a915533074590250afd7f2c3b828c3"
69
+ "sha256": "9406e824f04bc08788f8ede3a4b5e4e0d4ef2e971d3a8147dc0cece1b89ec1ef"
70
70
  },
71
71
  {
72
72
  "path": "TYPEBOX-LICENSE",
@@ -18014,8 +18014,8 @@ function BindArgument(context, state, name, extends_, type) {
18014
18014
  return memory_exports.Assign(context, { [name]: instantiatedArgument });
18015
18015
  }
18016
18016
  function BindArguments(context, state, parameterLeft, parameterRight, arguments_) {
18017
- const instantiatedExtends = InstantiateType(context, state, parameterLeft.extends);
18018
- const instantiatedEquals = InstantiateType(context, state, parameterLeft.equals);
18017
+ const instantiatedExtends = InstantiateType(context, State(state.callstack, []), parameterLeft.extends);
18018
+ const instantiatedEquals = InstantiateType(context, State(state.callstack, []), parameterLeft.equals);
18019
18019
  return guard_exports.ShiftLeft(arguments_, (left, right) => BindParameters(BindArgument(context, state, parameterLeft["name"], instantiatedExtends, left), state, parameterRight, right), () => BindParameters(BindArgument(context, state, parameterLeft["name"], instantiatedExtends, instantiatedEquals), state, parameterRight, []));
18020
18020
  }
18021
18021
  function BindParameters(context, state, parameters, arguments_) {
@@ -18047,16 +18047,21 @@ function Peek(state) {
18047
18047
  const result = guard_exports.IsGreaterThan(state.callstack.length, 0) ? state.callstack[state.callstack.length - 1] : "";
18048
18048
  return result;
18049
18049
  }
18050
- function IsTailCall(state, name) {
18050
+ function IsTailReturn(state, name) {
18051
18051
  const result = guard_exports.IsEqual(Peek(state), name);
18052
18052
  return result;
18053
18053
  }
18054
+ function IsTailCall(returnType, name) {
18055
+ const result = IsCall(returnType) && IsRef(returnType.target) && guard_exports.IsEqual(name, returnType["target"]["$ref"]);
18056
+ return result;
18057
+ }
18054
18058
  function CallDispatch(context, state, target, parameters, expression, arguments_) {
18055
18059
  InstantiationIncrement();
18056
18060
  try {
18057
18061
  const argumentsContext = ResolveArgumentsContext(context, state, parameters, arguments_);
18058
18062
  const returnType = InstantiateType(argumentsContext, State([...state["callstack"], target["$ref"]], state["visited"]), expression);
18059
- return InstantiateType(argumentsContext, State([], []), returnType);
18063
+ const tailArguments = IsCall(returnType) ? InstantiateTypes(argumentsContext, State([], []), returnType.arguments) : [];
18064
+ return IsTailCall(returnType, target["$ref"]) ? CallDispatch(context, State([], []), target, parameters, expression, tailArguments) : InstantiateType(argumentsContext, State([], []), returnType);
18060
18065
  } finally {
18061
18066
  InstantiationDecrement();
18062
18067
  }
@@ -18078,7 +18083,7 @@ function CallInstantiate(context, state, target, arguments_) {
18078
18083
  const resolved = ResolveTarget(context, target, arguments_);
18079
18084
  const name = resolved[0];
18080
18085
  const type = resolved[1];
18081
- const result = IsGeneric(type) ? IsTailCall(state, name) ? CallConstruct(Ref(name), instantiatedArguments) : CallImmediate(context, state, Ref(name), type.parameters, type.expression, instantiatedArguments) : CallConstruct(target, instantiatedArguments);
18086
+ const result = IsGeneric(type) ? IsTailReturn(state, name) ? CallConstruct(Ref(name), instantiatedArguments) : CallImmediate(context, state, Ref(name), type.parameters, type.expression, instantiatedArguments) : CallConstruct(target, instantiatedArguments);
18082
18087
  return result;
18083
18088
  }
18084
18089
 
@@ -18011,8 +18011,8 @@ function BindArgument(context, state, name, extends_, type) {
18011
18011
  return memory_exports.Assign(context, { [name]: instantiatedArgument });
18012
18012
  }
18013
18013
  function BindArguments(context, state, parameterLeft, parameterRight, arguments_) {
18014
- const instantiatedExtends = InstantiateType(context, state, parameterLeft.extends);
18015
- const instantiatedEquals = InstantiateType(context, state, parameterLeft.equals);
18014
+ const instantiatedExtends = InstantiateType(context, State(state.callstack, []), parameterLeft.extends);
18015
+ const instantiatedEquals = InstantiateType(context, State(state.callstack, []), parameterLeft.equals);
18016
18016
  return guard_exports.ShiftLeft(arguments_, (left, right) => BindParameters(BindArgument(context, state, parameterLeft["name"], instantiatedExtends, left), state, parameterRight, right), () => BindParameters(BindArgument(context, state, parameterLeft["name"], instantiatedExtends, instantiatedEquals), state, parameterRight, []));
18017
18017
  }
18018
18018
  function BindParameters(context, state, parameters, arguments_) {
@@ -18044,16 +18044,21 @@ function Peek(state) {
18044
18044
  const result = guard_exports.IsGreaterThan(state.callstack.length, 0) ? state.callstack[state.callstack.length - 1] : "";
18045
18045
  return result;
18046
18046
  }
18047
- function IsTailCall(state, name) {
18047
+ function IsTailReturn(state, name) {
18048
18048
  const result = guard_exports.IsEqual(Peek(state), name);
18049
18049
  return result;
18050
18050
  }
18051
+ function IsTailCall(returnType, name) {
18052
+ const result = IsCall(returnType) && IsRef(returnType.target) && guard_exports.IsEqual(name, returnType["target"]["$ref"]);
18053
+ return result;
18054
+ }
18051
18055
  function CallDispatch(context, state, target, parameters, expression, arguments_) {
18052
18056
  InstantiationIncrement();
18053
18057
  try {
18054
18058
  const argumentsContext = ResolveArgumentsContext(context, state, parameters, arguments_);
18055
18059
  const returnType = InstantiateType(argumentsContext, State([...state["callstack"], target["$ref"]], state["visited"]), expression);
18056
- return InstantiateType(argumentsContext, State([], []), returnType);
18060
+ const tailArguments = IsCall(returnType) ? InstantiateTypes(argumentsContext, State([], []), returnType.arguments) : [];
18061
+ return IsTailCall(returnType, target["$ref"]) ? CallDispatch(context, State([], []), target, parameters, expression, tailArguments) : InstantiateType(argumentsContext, State([], []), returnType);
18057
18062
  } finally {
18058
18063
  InstantiationDecrement();
18059
18064
  }
@@ -18075,7 +18080,7 @@ function CallInstantiate(context, state, target, arguments_) {
18075
18080
  const resolved = ResolveTarget(context, target, arguments_);
18076
18081
  const name = resolved[0];
18077
18082
  const type = resolved[1];
18078
- const result = IsGeneric(type) ? IsTailCall(state, name) ? CallConstruct(Ref(name), instantiatedArguments) : CallImmediate(context, state, Ref(name), type.parameters, type.expression, instantiatedArguments) : CallConstruct(target, instantiatedArguments);
18083
+ const result = IsGeneric(type) ? IsTailReturn(state, name) ? CallConstruct(Ref(name), instantiatedArguments) : CallImmediate(context, state, Ref(name), type.parameters, type.expression, instantiatedArguments) : CallConstruct(target, instantiatedArguments);
18079
18084
  return result;
18080
18085
  }
18081
18086
 
@@ -24,6 +24,9 @@ const KB_WITHOUT_SEARCH_CODE = "knowledge_base_without_search_tool";
24
24
  const SEARCH_DOCS = "/docs/reference/builtin-tools#binding-knowledge-bases-to-search_documents";
25
25
  const SEARCH_TOOL = "search_documents";
26
26
  const LIST_TOOL = "list_documents";
27
+ const KB_FILING_CODE = "kb_filing_access_invalid";
28
+ const KB_FILING_DOCS = "/docs/concepts/agent-graph#what-a-solutions-package-may-change";
29
+ const KB_READERS = "kb_readers";
27
30
  const PERSONA_MESSAGE_CODE = "persona_message_empty";
28
31
  const PERSONA_DOCS = "/docs/concepts/personas";
29
32
  const PERSONA_MESSAGES = [
@@ -102,6 +105,15 @@ export const KIT_CODES = [
102
105
  "what it lists) to the tool_assignments of the skill that names the knowledge base, or of the agent. `cavelon docs get reference/builtin-tools` shows the binding.",
103
106
  docs: SEARCH_DOCS,
104
107
  },
108
+ {
109
+ code: KB_FILING_CODE,
110
+ area: "package",
111
+ message: "A knowledge base that accepts email attachments needs at least one default_acl_groups entry, or filing_access " +
112
+ "'kb_readers' so every reader of it may read them; with 'kb_readers' it names no default_acl_groups.",
113
+ hint: "Name the group that reads the filed attachments in default_acl_groups, or set filing_access: kb_readers and leave " +
114
+ "default_acl_groups empty. The import preview blocks the knowledge base until then.",
115
+ docs: KB_FILING_DOCS,
116
+ },
105
117
  {
106
118
  code: ASSERTION_UNCHECKED_CODE,
107
119
  area: "package",
@@ -398,6 +410,7 @@ export function checkPackage(disk, options) {
398
410
  findings.push(...checkEndpointLimits(disk, options.schema));
399
411
  findings.push(...checkBranchConcurrency(disk, options.limits));
400
412
  findings.push(...checkKnowledgeSearch(disk));
413
+ findings.push(...checkFilingAccess(disk, options.schema));
401
414
  findings.push(...checkAttachedDocuments(disk, options.schema));
402
415
  findings.push(...checkUnknownFields(disk, options.schema, findings));
403
416
  findings.push(...checkReferences(disk, options.inventory));
@@ -595,6 +608,42 @@ function checkKnowledgeSearch(disk) {
595
608
  });
596
609
  return findings;
597
610
  }
611
+ function checkFilingAccess(disk, schema) {
612
+ const entry = schemaNode(schema, listItems(schema, schema.properties?.knowledge_bases));
613
+ const fields = asObject(entry?.properties) ?? {};
614
+ if (!["accepts_email_attachments", "filing_access", "default_acl_groups"].every((f) => f in fields))
615
+ return [];
616
+ const findings = [];
617
+ asList(disk.package.knowledge_bases).forEach((kb, i) => {
618
+ const stated = (field) => kb[field] !== undefined && kb[field] !== null;
619
+ const groups = Array.isArray(kb.default_acl_groups) ? kb.default_acl_groups.filter((g) => typeof g === "string") : [];
620
+ const readers = kb.filing_access === KB_READERS;
621
+ const name = typeof kb.name === "string" ? ` "${kb.name}"` : "";
622
+ let problem;
623
+ if (readers && groups.length) {
624
+ problem = {
625
+ pointer: `/knowledge_bases/${i}/default_acl_groups`,
626
+ certain: true,
627
+ message: `The knowledge base${name} lets every reader of it read its filings (filing_access: kb_readers), so it names no default_acl_groups: ` +
628
+ "remove the groups, or set filing_access to default_groups.",
629
+ };
630
+ }
631
+ else if (kb.accepts_email_attachments === true && !readers && !groups.length) {
632
+ const left = ["default_acl_groups", "filing_access"].filter((f) => !stated(f));
633
+ const certain = !left.length;
634
+ problem = {
635
+ pointer: `/knowledge_bases/${i}/accepts_email_attachments`,
636
+ certain,
637
+ message: `The knowledge base${name} accepts email attachments, but no one may read them: name a group in default_acl_groups, ` +
638
+ `or set filing_access: kb_readers so every reader of the knowledge base may.` +
639
+ (certain ? "" : ` The entry leaves ${left.join(" and ")} out: an existing knowledge base keeps ${left.length === 1 ? "its value" : "its values"}, a new one is blocked by the import.`),
640
+ };
641
+ }
642
+ if (problem)
643
+ findings.push({ code: KB_FILING_CODE, severity: problem.certain ? "error" : "warning", ...locate(disk, problem.pointer), message: problem.message });
644
+ });
645
+ return findings;
646
+ }
598
647
  function schemaNode(schema, node) {
599
648
  let at = asObject(node);
600
649
  for (let hops = 0; at && typeof at.$ref === "string" && hops < 10; hops++) {
@@ -342,6 +342,13 @@ personal access token holding `playground.use` reaches the draft; without
342
342
  nothing. Without such a tool the
343
343
  agent answers from memory; `cavelon validate` warns
344
344
  (`knowledge_base_without_search_tool`).
345
+ - **A knowledge base that accepts email attachments names who reads them.**
346
+ With `accepts_email_attachments: true`, give it at least one
347
+ `default_acl_groups` entry, or `filing_access: kb_readers` (every reader of
348
+ the knowledge base may read them); `kb_readers` names no groups. Pick the
349
+ group with the person: it decides who reads a mailbox's filings. The import
350
+ preview blocks it otherwise, and `cavelon validate` reports it first
351
+ (`kb_filing_access_invalid`).
345
352
  - **The model comes from the tenant.** Set an agent's `llm_model` and
346
353
  `llm_provider` to a row of `cavelon models list` (MODEL_ID, PROVIDER); the
347
354
  models differ per instance and tenant, and the preview blocks one the tenant
@@ -375,6 +375,9 @@ when:
375
375
 
376
376
  - the preview lists an active solution under "reaches active", or the target
377
377
  solution is active without explicit isolated-draft metadata;
378
+ - the preview says it changes skills, guardrails, tools, knowledge bases,
379
+ tool bindings or web sources "that other solutions may use": an older
380
+ instance's preview does not say which active solutions they reach;
378
381
  - the environment is `prod` (`--env prod`), or the preview deletes anything
379
382
  (`--mode replace`);
380
383
  - the preview changes tenant-wide sections (`tenant-wide: … change for every
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cavelon/cli",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
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,7 +46,7 @@
46
46
  "@types/node": "^20.19.0",
47
47
  "esbuild": "0.28.2",
48
48
  "eslint": "^10.12.0",
49
- "typebox": "1.4.3",
49
+ "typebox": "1.4.7",
50
50
  "typescript": "~6.0.3",
51
51
  "typescript-eslint": "^8.71.0",
52
52
  "vitest": "^4.0.0",