@modality-counter/core 1.5.0 → 1.5.2

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.
@@ -14,15 +14,40 @@ export type PartyMode = z.infer<typeof partyModeSchema>;
14
14
  * HACK: some MCP clients (e.g. certain Gemini tool runtimes, Copilot CLI) flatten
15
15
  * a nested `params` object into dotted top-level keys on the wire — sending
16
16
  * `{ "params.reference": "x" }` instead of `{ params: { reference: "x" } }`.
17
- * Fold any `params.*` keys back into a nested `params` object so downstream
18
- * code (and Zod's object-strip) sees the intended shape instead of dropping it.
17
+ * This preprocessor folds any `params.*` keys back into a nested `params` object
18
+ * before Zod's z.object() sees the input — otherwise the dotted keys would be
19
+ * treated as unknown top-level keys and silently dropped under Zod's default
20
+ * strip mode.
19
21
  *
20
- * This function is required by Copilot CLI and similar MCP clients. Removing it
21
- * will break reference loading and method execution for those clients.
22
- * NEVER remove this function or the z.preprocess(liftDottedParams, …) wrapper
23
- * on heroMethodSchema.
22
+ * Preprocess trigger (both paths are needed):
23
+ * 1. MCP framework: the server passes raw JSON-RPC args straight through
24
+ * to execute(). The inputSchema is NOT auto-parsed.
25
+ * 2. executeMethod(): always calls heroMethodSchema.parse(props) before
26
+ * destructuring, so the preprocess fires on every call path.
27
+ *
28
+ * Removing this function or the z.preprocess(liftDottedParams, …) wrapper
29
+ * on heroMethodSchema will break reference loading and method execution for
30
+ * any client that sends flattened wire format.
24
31
  */
25
32
  export declare function liftDottedParams(input: unknown): unknown;
33
+ /**
34
+ * DO NOT REMOVE — LLM AGENT INSTRUCTION.
35
+ *
36
+ * Normalizes kebab-case method param keys to camelCase so CLI-style flags
37
+ * (e.g. `--step-to`) bind to a method's camelCase Zod schema key (`stepTo`).
38
+ * Method inputSchemas declare camelCase keys and Zod strips unknown keys under
39
+ * its default mode, so without this an incoming `step-to` key reaches the
40
+ * method's schema, is dropped, and the parameter is silently lost.
41
+ *
42
+ * Scope & safety:
43
+ * - Hyphens only — snake_case keys (e.g. `chunk_index`) are left untouched so
44
+ * methods that intentionally use underscores keep binding.
45
+ * - A leading `--`/`-` from a literal flag token is stripped first.
46
+ * - Collision-safe: if the camelCase key already exists on the object, the
47
+ * kebab variant is dropped rather than overwriting it.
48
+ * - Top-level params keys only; values are never recursed into.
49
+ */
50
+ export declare function camelCaseParamKeys(input: unknown): unknown;
26
51
  export declare const heroMethodSchema: z.ZodPreprocess<z.ZodObject<{
27
52
  method: z.ZodString;
28
53
  params: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodAny>>>;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.5.0",
2
+ "version": "1.5.2",
3
3
  "name": "@modality-counter/core",
4
4
  "repository": {
5
5
  "type": "git",