@modality-counter/core 1.4.6 → 1.5.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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -9,11 +9,25 @@ export declare const partyModeSchema: z.ZodObject<{
9
9
  }, z.core.$strip>;
10
10
  export type PartyMode = z.infer<typeof partyModeSchema>;
11
11
  /**
12
- * HACK: some MCP clients (e.g. certain Gemini tool runtimes) flatten a nested
13
- * `params` object into dotted top-level keys on the wire — sending
12
+ * DO NOT REMOVE — LLM AGENT INSTRUCTION.
13
+ *
14
+ * HACK: some MCP clients (e.g. certain Gemini tool runtimes, Copilot CLI) flatten
15
+ * a nested `params` object into dotted top-level keys on the wire — sending
14
16
  * `{ "params.reference": "x" }` instead of `{ params: { reference: "x" } }`.
15
- * Fold any `params.*` keys back into a nested `params` object so downstream
16
- * 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.
21
+ *
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.
17
31
  */
18
32
  export declare function liftDottedParams(input: unknown): unknown;
19
33
  export declare const heroMethodSchema: z.ZodPreprocess<z.ZodObject<{
@@ -35,5 +49,6 @@ export declare const counterAssembleSchema: z.ZodObject<{
35
49
  method: "method";
36
50
  workflow: "workflow";
37
51
  }>>>;
52
+ keyword: z.ZodDefault<z.ZodNullable<z.ZodString>>;
38
53
  }, z.core.$strip>;
39
54
  export type CounterAssembleType = z.infer<typeof counterAssembleSchema>;
@@ -54,6 +54,11 @@ export interface CounterContent {
54
54
  }
55
55
  export declare function getCounterContent(items: CounterItem[], callSign: string, params?: any, executeScript?: boolean, options?: ReferenceOptions): Promise<CounterContent | false>;
56
56
  export declare function getAllCounterItems(types?: ResourceType[], baseDir?: string): Promise<CounterItem[]>;
57
+ /**
58
+ * Fuzzy-search Counter items by keyword over their id, name and description.
59
+ * Returns matches ordered by relevance score (highest first).
60
+ */
61
+ export declare function searchCounterItems(items: CounterItem[], keyword: string): CounterItem[];
57
62
  /**
58
63
  * Find all template files - convenience wrapper around recursiveScanForFiles
59
64
  */
@@ -0,0 +1,36 @@
1
+ export interface FuzzyFinderOptions {
2
+ caseSensitive?: boolean;
3
+ sortByScore?: boolean;
4
+ tokenize?: boolean;
5
+ locale?: string;
6
+ }
7
+ export interface ScoreResult {
8
+ score: number;
9
+ matches: number[];
10
+ }
11
+ export interface SearchResultItem<T extends {
12
+ content: string;
13
+ }> {
14
+ item: T;
15
+ score: number;
16
+ matches: number[];
17
+ tokens: string[];
18
+ }
19
+ declare class FuzzyFinder<T extends {
20
+ content: string;
21
+ }> {
22
+ items: T[];
23
+ caseSensitive: boolean;
24
+ sortByScore: boolean;
25
+ tokenize: boolean;
26
+ locale: string;
27
+ constructor(items: T[], options?: FuzzyFinderOptions);
28
+ getTokens(query: string): string[];
29
+ scoreToken(item: string, token: string): ScoreResult | null;
30
+ score(item: string, query: string): ScoreResult | null;
31
+ isWordBoundary(str: string, idx: number): boolean;
32
+ getExactMatches(str: string, query: string): number[];
33
+ search(query: string): SearchResultItem<T>[];
34
+ highlight(item: string, matches: number[], openTag?: string, closeTag?: string): string;
35
+ }
36
+ export default FuzzyFinder;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.4.6",
2
+ "version": "1.5.1",
3
3
  "name": "@modality-counter/core",
4
4
  "repository": {
5
5
  "type": "git",