@vincemakes/kiso-core 0.47.3 → 0.48.0

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.
@@ -7,5 +7,8 @@
7
7
  * hand-rolling a draft-07 subset — is how schemas silently stop meaning
8
8
  * what they say. Validators are compiled once per schema and cached.
9
9
  */
10
- /** Returns a human-readable failure reason, or null when the input is valid. */
10
+ /** Returns a human-readable failure reason, or null when the input is valid.
11
+ * K15a: a refused undeclared argument is named — the model's own field,
12
+ * JSON-quoted and cut at 96 characters — so the call is fixable; no other
13
+ * validator detail reaches the model (an enum's values stay unlisted). */
11
14
  export declare function validateArgs(schema: Readonly<Record<string, unknown>>, input: unknown): string | null;
@@ -10,7 +10,10 @@
10
10
  import { Ajv } from "ajv";
11
11
  const ajv = new Ajv({ strict: false });
12
12
  const cache = new WeakMap();
13
- /** Returns a human-readable failure reason, or null when the input is valid. */
13
+ /** Returns a human-readable failure reason, or null when the input is valid.
14
+ * K15a: a refused undeclared argument is named — the model's own field,
15
+ * JSON-quoted and cut at 96 characters — so the call is fixable; no other
16
+ * validator detail reaches the model (an enum's values stay unlisted). */
14
17
  export function validateArgs(schema, input) {
15
18
  let validate = cache.get(schema);
16
19
  if (!validate) {
@@ -22,7 +25,9 @@ export function validateArgs(schema, input) {
22
25
  const first = validate.errors?.[0];
23
26
  if (first) {
24
27
  const where = first.instancePath || "/";
25
- return `${where} ${first.message ?? "is invalid"}`;
28
+ const extra = first.keyword === "additionalProperties" ? String(first.params.additionalProperty) : undefined;
29
+ const named = extra === undefined ? "" : `: ${JSON.stringify(extra.length > 96 ? `${extra.slice(0, 96)}…` : extra)}`;
30
+ return `${where} ${first.message ?? "is invalid"}${named}`;
26
31
  }
27
32
  return "arguments failed schema validation";
28
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincemakes/kiso-core",
3
- "version": "0.47.3",
3
+ "version": "0.48.0",
4
4
  "description": "kiso core \u2014 protocol, event log, loop, hooks, modes, permissions, compaction, delivery truth. The 2,000-line kernel at the bottom of the kiso framework.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  "openai"
34
34
  ],
35
35
  "devDependencies": {
36
- "@vincemakes/kiso-evals": "0.47.3",
36
+ "@vincemakes/kiso-evals": "0.48.0",
37
37
  "@types/node": "^26.1.2",
38
38
  "typescript": "^5.7.2",
39
39
  "vitest": "^3.0.0"