@modootoday/pmcp 0.9.2 → 0.11.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.
- package/README.md +308 -2
- package/dist/attachment-tU5FZrgZ.d.ts +17 -0
- package/dist/cli.js +8378 -1674
- package/dist/config-CJ43_oBS.d.ts +49 -0
- package/dist/embed-BBhv3y5x.d.ts +53 -0
- package/dist/encoder-DGRy9skC.d.ts +36 -0
- package/dist/hook-spec-PRSnYGLV.d.ts +10 -0
- package/dist/http.d.ts +7 -38
- package/dist/http.js +2115 -14
- package/dist/index.d.ts +44 -46
- package/dist/index.js +4550 -74
- package/dist/mailbox/index.d.ts +44 -0
- package/dist/mailbox/index.js +1896 -0
- package/dist/project/hook-adapter.d.ts +11 -0
- package/dist/project/hook-adapter.js +191 -0
- package/dist/{server-C9eO6LMI.d.ts → server-CwWcRjqz.d.ts} +122 -2
- package/dist/service-qpCsOXkQ.d.ts +116 -0
- package/dist/stdio.d.ts +10 -4
- package/dist/stdio.js +3052 -6
- package/package.json +5 -1
- package/dist/catalog-BU5VLLyd.d.ts +0 -121
- package/dist/chunk-A5NOHVHN.js +0 -1805
- package/dist/chunk-CMZ7OTQD.js +0 -134
- package/dist/chunk-D3OZVMHN.js +0 -1142
- package/dist/chunk-EIHMCKY5.js +0 -41
- package/dist/chunk-KYW3VP3L.js +0 -160
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { E as EncoderOptions } from './encoder-DGRy9skC.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `pmcp.toml`, the project's one record of where its catalog lives.
|
|
5
|
+
*
|
|
6
|
+
* Paths in it are relative to the file, so the same file works from any
|
|
7
|
+
* directory a host starts pmcp in. Catalog and embedding settings are checked
|
|
8
|
+
* here; projector sections are kept as given.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
declare const CONFIG_FILE = "pmcp.toml";
|
|
12
|
+
/** What `[catalog]` may say. Each mirrors the repeatable CLI flag of the same meaning. */
|
|
13
|
+
interface CatalogSection {
|
|
14
|
+
readonly roots?: readonly string[];
|
|
15
|
+
readonly scopes?: readonly string[];
|
|
16
|
+
readonly workspaces?: readonly string[];
|
|
17
|
+
readonly packages?: readonly string[];
|
|
18
|
+
readonly marketplaces?: readonly string[];
|
|
19
|
+
}
|
|
20
|
+
interface ProjectConfig {
|
|
21
|
+
/** Absolute path of the file read. */
|
|
22
|
+
readonly path: string;
|
|
23
|
+
/** Its directory; every relative path in the file resolves against it. */
|
|
24
|
+
readonly dir: string;
|
|
25
|
+
/** `[catalog]` with paths already absolute. */
|
|
26
|
+
readonly catalog: CatalogSection;
|
|
27
|
+
readonly embedding?: EmbeddingSection;
|
|
28
|
+
/** The whole document, for sections this module does not interpret. */
|
|
29
|
+
readonly raw: Readonly<Record<string, unknown>>;
|
|
30
|
+
}
|
|
31
|
+
interface EmbeddingSection extends EncoderOptions {
|
|
32
|
+
readonly enabled?: boolean;
|
|
33
|
+
readonly modelId?: string;
|
|
34
|
+
readonly modelPath?: string;
|
|
35
|
+
readonly cacheDir?: string;
|
|
36
|
+
}
|
|
37
|
+
declare class ConfigError extends Error {
|
|
38
|
+
constructor(path: string, message: string);
|
|
39
|
+
}
|
|
40
|
+
/** The nearest pmcp.toml at or above start, or null when there is none. */
|
|
41
|
+
declare function findConfig(start: string): string | null;
|
|
42
|
+
/**
|
|
43
|
+
* Reads and checks one file. An unknown key under `[catalog]` is an error
|
|
44
|
+
* rather than ignored, for the same reason an unknown flag is: a misspelt
|
|
45
|
+
* `workspace = [...]` must not look like it worked.
|
|
46
|
+
*/
|
|
47
|
+
declare function readConfig(path: string): ProjectConfig;
|
|
48
|
+
|
|
49
|
+
export { CONFIG_FILE as C, type EmbeddingSection as E, type ProjectConfig as P, type CatalogSection as a, ConfigError as b, findConfig as f, readConfig as r };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { E as Embedder } from './server-CwWcRjqz.js';
|
|
2
|
+
import { E as EncoderOptions } from './encoder-DGRy9skC.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The optional encoder and the store for the vectors it produces.
|
|
6
|
+
*
|
|
7
|
+
* Neither the model nor its runtime is a dependency: a caller who wants
|
|
8
|
+
* semantic ranking installs the peer and runs `pmcp index`, and everything
|
|
9
|
+
* here degrades to null rather than throwing when that has not happened.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
interface LoadEmbedderOptions extends EncoderOptions {
|
|
13
|
+
/** Where model files live; a host bakes them into its image here. */
|
|
14
|
+
readonly cacheDir?: string;
|
|
15
|
+
readonly modelPath?: string;
|
|
16
|
+
/** Refuse to download, so a missing model is an error rather than a fetch. */
|
|
17
|
+
readonly localOnly?: boolean;
|
|
18
|
+
/** Injected for tests. The optional peer is imported otherwise. */
|
|
19
|
+
readonly module?: unknown;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Loads the encoder, or returns null when the peer is not installed.
|
|
23
|
+
*
|
|
24
|
+
* Absence is not failure anywhere in this package: the caller reports it and
|
|
25
|
+
* ranking stays lexical.
|
|
26
|
+
*/
|
|
27
|
+
declare function loadEmbedder(modelId?: string, options?: LoadEmbedderOptions): Promise<Embedder | null>;
|
|
28
|
+
/**
|
|
29
|
+
* One vector per entry, reusing those whose description has not changed.
|
|
30
|
+
* Encoded as passages, the side the intent is compared against.
|
|
31
|
+
*/
|
|
32
|
+
declare function encodeEntries(embedder: Embedder, entries: readonly {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly description: string;
|
|
35
|
+
}[], previous?: ReadonlyMap<string, {
|
|
36
|
+
hash: string;
|
|
37
|
+
vector: Float32Array;
|
|
38
|
+
}>): Promise<Map<string, {
|
|
39
|
+
hash: string;
|
|
40
|
+
vector: Float32Array;
|
|
41
|
+
}>>;
|
|
42
|
+
interface EntryVectorStore {
|
|
43
|
+
read(modelId: string): Map<string, Float32Array>;
|
|
44
|
+
/** Names whose stored hash disagrees with the description they now have. */
|
|
45
|
+
stale(modelId: string, entries: ReadonlyMap<string, string>): string[];
|
|
46
|
+
write(modelId: string, name: string, description: string, vector: Float32Array): void;
|
|
47
|
+
close(): void;
|
|
48
|
+
}
|
|
49
|
+
declare function openEntryVectors(path: string, options?: {
|
|
50
|
+
readOnly?: boolean;
|
|
51
|
+
}): Promise<EntryVectorStore | null>;
|
|
52
|
+
|
|
53
|
+
export { type EntryVectorStore as E, type LoadEmbedderOptions as L, encodeEntries as e, loadEmbedder as l, openEntryVectors as o };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare const DEFAULT_MODEL_ID = "Xenova/multilingual-e5-small";
|
|
2
|
+
type EncoderDtype = "q4" | "q8" | "fp32";
|
|
3
|
+
interface EncoderSpec {
|
|
4
|
+
readonly queryPrefix: string;
|
|
5
|
+
readonly passagePrefix: string;
|
|
6
|
+
readonly pooling: "mean" | "cls";
|
|
7
|
+
readonly projected?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface EncoderOptions {
|
|
10
|
+
readonly dtype?: EncoderDtype;
|
|
11
|
+
readonly dimensions?: number;
|
|
12
|
+
readonly revision?: string;
|
|
13
|
+
readonly encoder?: Partial<EncoderSpec>;
|
|
14
|
+
}
|
|
15
|
+
interface EmbeddingModel {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly modelId: string;
|
|
18
|
+
readonly dtype: EncoderDtype;
|
|
19
|
+
readonly dtypes: readonly EncoderDtype[];
|
|
20
|
+
readonly dimensions: readonly number[];
|
|
21
|
+
readonly revision: string;
|
|
22
|
+
readonly encoder: EncoderSpec;
|
|
23
|
+
}
|
|
24
|
+
declare function embeddingModels(): readonly EmbeddingModel[];
|
|
25
|
+
declare function encoderSpec(modelId: string): EncoderSpec;
|
|
26
|
+
interface ResolvedEncoder {
|
|
27
|
+
readonly modelId: string;
|
|
28
|
+
readonly dtype: EncoderDtype;
|
|
29
|
+
readonly dimensions?: number;
|
|
30
|
+
readonly revision: string;
|
|
31
|
+
readonly encoder: EncoderSpec;
|
|
32
|
+
readonly indexKey: string;
|
|
33
|
+
}
|
|
34
|
+
declare function resolveEncoder(model?: string, options?: EncoderOptions): ResolvedEncoder;
|
|
35
|
+
|
|
36
|
+
export { DEFAULT_MODEL_ID as D, type EncoderOptions as E, type ResolvedEncoder as R, type EmbeddingModel as a, type EncoderDtype as b, type EncoderSpec as c, encoderSpec as d, embeddingModels as e, resolveEncoder as r };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const HOOK_TOOLS: readonly ["codex", "gemini", "antigravity"];
|
|
2
|
+
type HookTool = (typeof HOOK_TOOLS)[number];
|
|
3
|
+
interface ShellHookSpec {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly command: readonly string[];
|
|
6
|
+
readonly targets: readonly HookTool[];
|
|
7
|
+
readonly timeoutMs: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type { HookTool as H, ShellHookSpec as S };
|
package/dist/http.d.ts
CHANGED
|
@@ -1,42 +1,10 @@
|
|
|
1
|
-
import { S as SkillEntry } from './
|
|
2
|
-
import {
|
|
1
|
+
import { S as SkillServerOptions, E as Embedder, a as SkillEntry } from './server-CwWcRjqz.js';
|
|
2
|
+
import { L as LoadEmbedderOptions } from './embed-BBhv3y5x.js';
|
|
3
|
+
export { l as loadEmbedder } from './embed-BBhv3y5x.js';
|
|
4
|
+
import { M as MailboxService } from './service-qpCsOXkQ.js';
|
|
5
|
+
export { D as DEFAULT_MODEL_ID } from './encoder-DGRy9skC.js';
|
|
3
6
|
import 'zod';
|
|
4
7
|
|
|
5
|
-
/**
|
|
6
|
-
* The optional encoder and the store for the vectors it produces.
|
|
7
|
-
*
|
|
8
|
-
* Neither the model nor its runtime is a dependency: a caller who wants
|
|
9
|
-
* semantic ranking installs the peer and runs `pmcp index`, and everything
|
|
10
|
-
* here degrades to null rather than throwing when that has not happened.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* What `pmcp index` writes and what the server reads back. Multilingual, so a
|
|
15
|
-
* Korean intent finds an English description (measured 20261005: 8/8 Korean
|
|
16
|
-
* and 8/8 English intents in the top three over a 99-skill catalog).
|
|
17
|
-
*/
|
|
18
|
-
declare const DEFAULT_MODEL_ID = "Xenova/multilingual-e5-small";
|
|
19
|
-
interface LoadEmbedderOptions {
|
|
20
|
-
/** Where model files live; a host bakes them into its image here. */
|
|
21
|
-
readonly cacheDir?: string;
|
|
22
|
-
/** Refuse to download, so a missing model is an error rather than a fetch. */
|
|
23
|
-
readonly localOnly?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Weight precision. q8 is a quarter of fp32's size (118 MB against 470 MB for
|
|
26
|
-
* the default model) and ranked the same in the 20261005 measurement.
|
|
27
|
-
*/
|
|
28
|
-
readonly dtype?: "q8" | "fp32";
|
|
29
|
-
/** Injected for tests. The optional peer is imported otherwise. */
|
|
30
|
-
readonly module?: unknown;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Loads the encoder, or returns null when the peer is not installed.
|
|
34
|
-
*
|
|
35
|
-
* Absence is not failure anywhere in this package: the caller reports it and
|
|
36
|
-
* ranking stays lexical.
|
|
37
|
-
*/
|
|
38
|
-
declare function loadEmbedder(modelId?: string, options?: LoadEmbedderOptions): Promise<Embedder | null>;
|
|
39
|
-
|
|
40
8
|
/**
|
|
41
9
|
* Checks a hosted skills server makes before a request reaches MCP: which browser origins
|
|
42
10
|
* and Host names may call it, how large a request may be, and how often one caller may call.
|
|
@@ -74,6 +42,7 @@ interface SkillCaller {
|
|
|
74
42
|
readonly claims?: Readonly<Record<string, unknown>>;
|
|
75
43
|
}
|
|
76
44
|
interface SkillHttpOptions extends SkillServerOptions {
|
|
45
|
+
readonly mailboxFor?: (caller: SkillCaller) => MailboxService | undefined | Promise<MailboxService | undefined>;
|
|
77
46
|
/** Gets the Request the host's fetch received; read headers only, the body is still unread. */
|
|
78
47
|
readonly authorize: (request: Request) => SkillCaller | undefined | Promise<SkillCaller | undefined>;
|
|
79
48
|
/** Tiers a caller may list and load. Package skills without a tier count as open. */
|
|
@@ -111,4 +80,4 @@ interface SkillHttpHandler {
|
|
|
111
80
|
}
|
|
112
81
|
declare function createSkillHttpHandler(options: SkillHttpOptions): SkillHttpHandler;
|
|
113
82
|
|
|
114
|
-
export { DEFAULT_MAX_REQUEST_BYTES,
|
|
83
|
+
export { DEFAULT_MAX_REQUEST_BYTES, DEFAULT_TIERS, Embedder, type RateLimitOptions, type SkillCaller, type SkillHttpHandler, type SkillHttpOptions, type SkillHttpSemanticOptions, createSkillHttpHandler, visibleTo };
|