@modootoday/pmcp 0.7.1 → 0.8.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.
- package/README.md +52 -10
- package/SECURITY.md +5 -0
- package/dist/{catalog-5v7jrGwP.d.ts → catalog-CS0j6-0U.d.ts} +11 -11
- package/dist/{chunk-GNJSZCRH.js → chunk-DTQAN33I.js} +37 -2
- package/dist/chunk-HB4VJ5VW.js +1664 -0
- package/dist/{chunk-IJPOJ6PG.js → chunk-K7BX33LH.js} +6 -3
- package/dist/{chunk-KP3TQ3QY.js → chunk-MO3LLVVY.js} +2 -2
- package/dist/{chunk-VBLAH6J2.js → chunk-STBBSQ3R.js} +2 -2
- package/dist/cli.js +50 -11
- package/dist/http.d.ts +32 -3
- package/dist/http.js +144 -22
- package/dist/index.d.ts +119 -44
- package/dist/index.js +51 -6
- package/dist/server-CLyCpwZb.d.ts +352 -0
- package/dist/stdio.d.ts +7 -3
- package/dist/stdio.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-C46YCY2I.js +0 -1194
- package/dist/server-B9GDPRoE.d.ts +0 -217
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import { S as SkillEntry, C as CatalogOptions, A as AssetKind } from './catalog-5v7jrGwP.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The intent key and the cache contract.
|
|
5
|
-
*
|
|
6
|
-
* Separate from the sqlite implementation so that ranking, which needs the key
|
|
7
|
-
* and the interface, does not pull a bun-only module into a consumer running
|
|
8
|
-
* under node. Only `cache.ts` requires bun.
|
|
9
|
-
*/
|
|
10
|
-
interface IntentCacheStats {
|
|
11
|
-
readonly hits: number;
|
|
12
|
-
readonly misses: number;
|
|
13
|
-
/** Rows found for the key but written by a different model. */
|
|
14
|
-
readonly mismatched: number;
|
|
15
|
-
readonly rows: number;
|
|
16
|
-
/** Which sqlite builtin answered, or absent when there is no cache. */
|
|
17
|
-
readonly provider?: string;
|
|
18
|
-
}
|
|
19
|
-
interface IntentCache {
|
|
20
|
-
/** The cached vector for an intent, or null when nothing usable is stored. */
|
|
21
|
-
get(intent: string): Float32Array | null;
|
|
22
|
-
put(intent: string, vector: Float32Array): void;
|
|
23
|
-
stats(): IntentCacheStats;
|
|
24
|
-
close(): void;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Same question, differently typed. Case, punctuation and spacing only — the
|
|
28
|
-
* key has to survive a caller writing "How do I wire X?" and "how do i wire x".
|
|
29
|
-
*/
|
|
30
|
-
declare function normaliseIntent(intent: string): string;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Ranking an intent against skill descriptions.
|
|
34
|
-
*
|
|
35
|
-
* Semantic when an embedder is supplied, lexical otherwise, and the answer says
|
|
36
|
-
* which. A caller that cannot tell the two apart cannot tell a degraded server
|
|
37
|
-
* from a working one.
|
|
38
|
-
*/
|
|
39
|
-
|
|
40
|
-
type Ranking = "semantic" | "lexical";
|
|
41
|
-
interface Match {
|
|
42
|
-
readonly name: string;
|
|
43
|
-
readonly package: string;
|
|
44
|
-
readonly description: string;
|
|
45
|
-
readonly score: number;
|
|
46
|
-
}
|
|
47
|
-
interface FindResult {
|
|
48
|
-
readonly ranking: Ranking;
|
|
49
|
-
readonly matches: readonly Match[];
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* The encoder, supplied by the caller. There is no default and no bundled
|
|
53
|
-
* model: which model runs decides what the scores mean, so it is the consuming
|
|
54
|
-
* repository's declaration rather than this package's.
|
|
55
|
-
*/
|
|
56
|
-
interface Embedder {
|
|
57
|
-
readonly modelId: string;
|
|
58
|
-
readonly dims: number;
|
|
59
|
-
/** Encodes an intent, the query side. */
|
|
60
|
-
embed(text: string): Promise<Float32Array>;
|
|
61
|
-
/** Encodes a description, for models that write the two sides differently. */
|
|
62
|
-
embedPassage?(text: string): Promise<Float32Array>;
|
|
63
|
-
}
|
|
64
|
-
interface FindOptions {
|
|
65
|
-
readonly entries: readonly SkillEntry[];
|
|
66
|
-
readonly intent: string;
|
|
67
|
-
readonly limit?: number;
|
|
68
|
-
readonly embedder?: Embedder;
|
|
69
|
-
readonly cache?: IntentCache;
|
|
70
|
-
/** Precomputed description vectors, keyed by skill name. */
|
|
71
|
-
readonly vectors?: ReadonlyMap<string, Float32Array>;
|
|
72
|
-
}
|
|
73
|
-
declare const DEFAULT_FIND_LIMIT = 5;
|
|
74
|
-
/**
|
|
75
|
-
* Token overlap and bigram Dice, averaged. Deterministic and dependency-free:
|
|
76
|
-
* this is the answer when there is no model, so it must never be the thing
|
|
77
|
-
* that fails.
|
|
78
|
-
*/
|
|
79
|
-
declare function lexicalScore(intent: string, description: string): number;
|
|
80
|
-
/** Cosine over two equal-width vectors. Zero when either has no magnitude. */
|
|
81
|
-
declare function cosine(a: Float32Array, b: Float32Array): number;
|
|
82
|
-
/**
|
|
83
|
-
* Ranked matches, and which ranking produced them.
|
|
84
|
-
*
|
|
85
|
-
* Returns rather than loads: a search verb that also acts cannot be used to
|
|
86
|
-
* look, and the whole reason this server exists is that looking should be
|
|
87
|
-
* cheap.
|
|
88
|
-
*/
|
|
89
|
-
declare function find(options: FindOptions): Promise<FindResult>;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* The five tools, and nothing else.
|
|
93
|
-
*
|
|
94
|
-
* The point of the server is that a session's startup cost does not grow with
|
|
95
|
-
* the number of skills installed: the host lists five tools whatever the
|
|
96
|
-
* catalog holds, and a body is read only when one is asked for.
|
|
97
|
-
*/
|
|
98
|
-
|
|
99
|
-
/** Largest file skill_read returns. A skill needing more should split it. */
|
|
100
|
-
declare const READ_BUDGET_BYTES: number;
|
|
101
|
-
/** How many files skill_describe lists before saying the rest were cut. */
|
|
102
|
-
declare const DESCRIBE_FILE_LIMIT = 200;
|
|
103
|
-
declare const CATALOG_PAGE_SIZE = 8;
|
|
104
|
-
declare const CATALOG_PAGE_MAX = 20;
|
|
105
|
-
/** A kind filter value: one kind, or every kind. */
|
|
106
|
-
type KindFilter = AssetKind | "any";
|
|
107
|
-
/**
|
|
108
|
-
* Equality filters over catalog fields. Unset keys match everything except
|
|
109
|
-
* kind, which defaults to skill so a search for a skill never returns a hook.
|
|
110
|
-
*/
|
|
111
|
-
interface SkillFilters {
|
|
112
|
-
readonly kind?: KindFilter;
|
|
113
|
-
readonly tier?: string;
|
|
114
|
-
readonly package?: string;
|
|
115
|
-
readonly level?: string;
|
|
116
|
-
readonly domain?: string;
|
|
117
|
-
readonly medium?: string;
|
|
118
|
-
}
|
|
119
|
-
type ReadResult = {
|
|
120
|
-
readonly ok: true;
|
|
121
|
-
readonly name: string;
|
|
122
|
-
readonly path: string;
|
|
123
|
-
readonly bytes: number;
|
|
124
|
-
readonly sha256: string;
|
|
125
|
-
readonly text: string;
|
|
126
|
-
} | {
|
|
127
|
-
readonly ok: false;
|
|
128
|
-
readonly error: string;
|
|
129
|
-
readonly detail: string;
|
|
130
|
-
};
|
|
131
|
-
interface SkillServerOptions extends CatalogOptions {
|
|
132
|
-
readonly embedder?: Embedder;
|
|
133
|
-
readonly cache?: IntentCache;
|
|
134
|
-
readonly vectors?: ReadonlyMap<string, Float32Array>;
|
|
135
|
-
/** Injected for tests. Reads the catalog off disk otherwise. */
|
|
136
|
-
readonly loadCatalog?: (options: CatalogOptions) => SkillEntry[];
|
|
137
|
-
}
|
|
138
|
-
interface CatalogResponse {
|
|
139
|
-
readonly count: number;
|
|
140
|
-
readonly page: number;
|
|
141
|
-
readonly totalPages: number;
|
|
142
|
-
readonly hasNext: boolean;
|
|
143
|
-
readonly packages: readonly {
|
|
144
|
-
readonly package: string;
|
|
145
|
-
readonly skills: readonly CatalogItem[];
|
|
146
|
-
}[];
|
|
147
|
-
}
|
|
148
|
-
/** One catalog line. `kind` appears only for an asset that is not a skill. */
|
|
149
|
-
interface CatalogItem {
|
|
150
|
-
readonly name: string;
|
|
151
|
-
readonly description: string;
|
|
152
|
-
readonly tier?: string;
|
|
153
|
-
readonly kind?: AssetKind;
|
|
154
|
-
}
|
|
155
|
-
interface CallResponse {
|
|
156
|
-
readonly name: string;
|
|
157
|
-
readonly body: string;
|
|
158
|
-
/** Files the skill carries besides its body, for skill_read. */
|
|
159
|
-
readonly files: readonly {
|
|
160
|
-
path: string;
|
|
161
|
-
bytes: number;
|
|
162
|
-
sha256: string;
|
|
163
|
-
}[];
|
|
164
|
-
readonly filesTruncated: boolean;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* The catalog, the search and the read, as plain functions.
|
|
168
|
-
*
|
|
169
|
-
* Separate from the MCP wiring so they can be exercised without a transport,
|
|
170
|
-
* and so a consumer that wants them from a hook or a script is not made to
|
|
171
|
-
* speak a protocol to get them.
|
|
172
|
-
*/
|
|
173
|
-
declare function createSkillTools(options: SkillServerOptions): {
|
|
174
|
-
/**
|
|
175
|
-
* Grouped, and without bodies. The cheap overview and the search's miss
|
|
176
|
-
* path. Paged by package so a large catalog never arrives in one answer.
|
|
177
|
-
*/
|
|
178
|
-
catalog(request?: {
|
|
179
|
-
page?: number;
|
|
180
|
-
pageSize?: number;
|
|
181
|
-
tier?: string;
|
|
182
|
-
kind?: KindFilter;
|
|
183
|
-
}): CatalogResponse;
|
|
184
|
-
/** Ranked names. Returns; never loads a body. */
|
|
185
|
-
find(intent: string, limit?: number, filters?: SkillFilters): Promise<FindResult>;
|
|
186
|
-
/** Every property of one skill and the files it carries, without bodies. */
|
|
187
|
-
describe(name: string): {
|
|
188
|
-
name: string;
|
|
189
|
-
kind: "agent" | "skill" | "hook" | "mcp";
|
|
190
|
-
package: string;
|
|
191
|
-
description: string;
|
|
192
|
-
tier: string | undefined;
|
|
193
|
-
metadata: Readonly<Record<string, string | readonly string[]>>;
|
|
194
|
-
frontmatter: string;
|
|
195
|
-
files: {
|
|
196
|
-
path: string;
|
|
197
|
-
bytes: number;
|
|
198
|
-
sha256: string;
|
|
199
|
-
}[];
|
|
200
|
-
filesTruncated: boolean;
|
|
201
|
-
} | null;
|
|
202
|
-
/**
|
|
203
|
-
* One file inside a skill's directory. Paths that leave the directory,
|
|
204
|
-
* directly or through a link, are refused; nothing is ever executed.
|
|
205
|
-
*/
|
|
206
|
-
read(name: string, path?: string): ReadResult;
|
|
207
|
-
/** One body, at the moment it is needed. */
|
|
208
|
-
call(name: string): CallResponse | null;
|
|
209
|
-
/** Drops the memoised catalog, so the next call re-reads the tree. */
|
|
210
|
-
refresh(): void;
|
|
211
|
-
entries: () => Omit<SkillEntry, "path">[];
|
|
212
|
-
/** The catalog with paths, for the Skills extension. The same array until refresh. */
|
|
213
|
-
skills: () => readonly SkillEntry[];
|
|
214
|
-
};
|
|
215
|
-
type SkillTools = ReturnType<typeof createSkillTools>;
|
|
216
|
-
|
|
217
|
-
export { CATALOG_PAGE_MAX as C, DEFAULT_FIND_LIMIT as D, type Embedder as E, type FindOptions as F, type IntentCache as I, type KindFilter as K, type Match as M, READ_BUDGET_BYTES as R, type SkillServerOptions as S, type SkillTools as a, CATALOG_PAGE_SIZE as b, type CallResponse as c, type CatalogItem as d, type CatalogResponse as e, DESCRIBE_FILE_LIMIT as f, type FindResult as g, type IntentCacheStats as h, type Ranking as i, type ReadResult as j, type SkillFilters as k, cosine as l, createSkillTools as m, find as n, lexicalScore as o, normaliseIntent as p };
|