@synthaer/resonance 0.1.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 +19 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +40 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +24 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +44 -0
- package/dist/config.js.map +1 -0
- package/dist/contracts.d.ts +4 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +2 -0
- package/dist/contracts.js.map +1 -0
- package/dist/db/local.d.ts +21 -0
- package/dist/db/local.d.ts.map +1 -0
- package/dist/db/local.js +158 -0
- package/dist/db/local.js.map +1 -0
- package/dist/db-types.d.ts +14 -0
- package/dist/db-types.d.ts.map +1 -0
- package/dist/db-types.js +2 -0
- package/dist/db-types.js.map +1 -0
- package/dist/dikw-pipeline.d.ts +31 -0
- package/dist/dikw-pipeline.d.ts.map +1 -0
- package/dist/dikw-pipeline.js +130 -0
- package/dist/dikw-pipeline.js.map +1 -0
- package/dist/embedding-provider.d.ts +25 -0
- package/dist/embedding-provider.d.ts.map +1 -0
- package/dist/embedding-provider.js +62 -0
- package/dist/embedding-provider.js.map +1 -0
- package/dist/embeddings/local.d.ts +31 -0
- package/dist/embeddings/local.d.ts.map +1 -0
- package/dist/embeddings/local.js +72 -0
- package/dist/embeddings/local.js.map +1 -0
- package/dist/encryption.d.ts +22 -0
- package/dist/encryption.d.ts.map +1 -0
- package/dist/encryption.js +39 -0
- package/dist/encryption.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server.d.ts +362 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +722 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/pki.d.ts +160 -0
- package/dist/pki.d.ts.map +1 -0
- package/dist/pki.js +502 -0
- package/dist/pki.js.map +1 -0
- package/dist/ratification.d.ts +125 -0
- package/dist/ratification.d.ts.map +1 -0
- package/dist/ratification.js +315 -0
- package/dist/ratification.js.map +1 -0
- package/dist/schema.d.ts +4 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +119 -0
- package/dist/schema.js.map +1 -0
- package/dist/search.d.ts +33 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +132 -0
- package/dist/search.js.map +1 -0
- package/dist/server.d.ts +11 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +297 -0
- package/dist/server.js.map +1 -0
- package/dist/store.d.ts +77 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +572 -0
- package/dist/store.js.map +1 -0
- package/dist/tools/cloud-gate.d.ts +72 -0
- package/dist/tools/cloud-gate.d.ts.map +1 -0
- package/dist/tools/cloud-gate.js +79 -0
- package/dist/tools/cloud-gate.js.map +1 -0
- package/dist/tools/experiences.d.ts +20 -0
- package/dist/tools/experiences.d.ts.map +1 -0
- package/dist/tools/experiences.js +135 -0
- package/dist/tools/experiences.js.map +1 -0
- package/dist/tools/knowledge.d.ts +37 -0
- package/dist/tools/knowledge.d.ts.map +1 -0
- package/dist/tools/knowledge.js +213 -0
- package/dist/tools/knowledge.js.map +1 -0
- package/dist/tools/sessions.d.ts +11 -0
- package/dist/tools/sessions.d.ts.map +1 -0
- package/dist/tools/sessions.js +66 -0
- package/dist/tools/sessions.js.map +1 -0
- package/dist/tools/trust.d.ts +18 -0
- package/dist/tools/trust.d.ts.map +1 -0
- package/dist/tools/trust.js +42 -0
- package/dist/tools/trust.js.map +1 -0
- package/dist/types.d.ts +75 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { mkdir } from 'node:fs/promises';
|
|
4
|
+
const DEFAULT_MODEL = 'Xenova/all-MiniLM-L6-v2';
|
|
5
|
+
const MODEL_DIMENSIONS = 384;
|
|
6
|
+
const DEFAULT_CACHE_DIR = join(homedir(), '.partitura', 'models');
|
|
7
|
+
export class LocalEmbeddingProvider {
|
|
8
|
+
_model;
|
|
9
|
+
_cacheDir;
|
|
10
|
+
_pipeline = null;
|
|
11
|
+
_initPromise = null;
|
|
12
|
+
_ready = false;
|
|
13
|
+
dimensions = MODEL_DIMENSIONS;
|
|
14
|
+
constructor(options) {
|
|
15
|
+
this._model = options?.model ?? DEFAULT_MODEL;
|
|
16
|
+
this._cacheDir = options?.cacheDir ?? DEFAULT_CACHE_DIR;
|
|
17
|
+
}
|
|
18
|
+
get ready() {
|
|
19
|
+
return this._ready;
|
|
20
|
+
}
|
|
21
|
+
async ensureInitialized() {
|
|
22
|
+
if (this._ready)
|
|
23
|
+
return;
|
|
24
|
+
if (!this._initPromise) {
|
|
25
|
+
this._initPromise = this._initialize();
|
|
26
|
+
}
|
|
27
|
+
await this._initPromise;
|
|
28
|
+
}
|
|
29
|
+
async _initialize() {
|
|
30
|
+
await mkdir(this._cacheDir, { recursive: true });
|
|
31
|
+
const { pipeline, env } = await import('@xenova/transformers');
|
|
32
|
+
env.cacheDir = this._cacheDir;
|
|
33
|
+
env.allowLocalModels = true;
|
|
34
|
+
this._pipeline = await pipeline('feature-extraction', this._model, {
|
|
35
|
+
quantized: true,
|
|
36
|
+
});
|
|
37
|
+
this._ready = true;
|
|
38
|
+
}
|
|
39
|
+
async embed(text) {
|
|
40
|
+
await this.ensureInitialized();
|
|
41
|
+
const output = await this._pipeline(text, {
|
|
42
|
+
pooling: 'mean',
|
|
43
|
+
normalize: true,
|
|
44
|
+
});
|
|
45
|
+
return Array.from(output.data);
|
|
46
|
+
}
|
|
47
|
+
async embedBatch(texts) {
|
|
48
|
+
if (texts.length === 0)
|
|
49
|
+
return [];
|
|
50
|
+
await this.ensureInitialized();
|
|
51
|
+
const results = [];
|
|
52
|
+
for (const text of texts) {
|
|
53
|
+
const output = await this._pipeline(text, {
|
|
54
|
+
pooling: 'mean',
|
|
55
|
+
normalize: true,
|
|
56
|
+
});
|
|
57
|
+
results.push(Array.from(output.data));
|
|
58
|
+
}
|
|
59
|
+
return results;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=embedding-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedding-provider.js","sourceRoot":"","sources":["../src/embedding-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AASzC,MAAM,aAAa,GAAG,yBAAyB,CAAC;AAChD,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC;AAOlE,MAAM,OAAO,sBAAsB;IACzB,MAAM,CAAS;IACf,SAAS,CAAS;IAClB,SAAS,GAAY,IAAI,CAAC;IAC1B,YAAY,GAAyB,IAAI,CAAC;IAC1C,MAAM,GAAG,KAAK,CAAC;IAEd,UAAU,GAAG,gBAAgB,CAAC;IAEvC,YAAY,OAAuC;QACjD,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,KAAK,IAAI,aAAa,CAAC;QAC9C,IAAI,CAAC,SAAS,GAAG,OAAO,EAAE,QAAQ,IAAI,iBAAiB,CAAC;IAC1D,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAEO,KAAK,CAAC,iBAAiB;QAC7B,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,IAAI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AAE,IAAI;aAChB,CAAC,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAoB,CAAC,CAAC,CAAC;QACxD,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface EmbeddingProvider {
|
|
2
|
+
embed(text: string): Promise<number[]>;
|
|
3
|
+
embedBatch(texts: string[]): Promise<number[][]>;
|
|
4
|
+
readonly dimensions: number;
|
|
5
|
+
readonly ready: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Local embedding provider using @xenova/transformers.
|
|
9
|
+
*
|
|
10
|
+
* The model (~23MB) is downloaded on first use and cached in the
|
|
11
|
+
* models directory. All subsequent calls are fully offline.
|
|
12
|
+
*/
|
|
13
|
+
export declare class LocalEmbeddingProvider implements EmbeddingProvider {
|
|
14
|
+
private _model;
|
|
15
|
+
private _cacheDir;
|
|
16
|
+
private _pipeline;
|
|
17
|
+
private _initPromise;
|
|
18
|
+
private _ready;
|
|
19
|
+
readonly dimensions = 384;
|
|
20
|
+
constructor(cacheDir: string, model?: string);
|
|
21
|
+
get ready(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Lazily initialize the embedding pipeline.
|
|
24
|
+
* Shows a progress message on first download.
|
|
25
|
+
*/
|
|
26
|
+
ensureInitialized(): Promise<void>;
|
|
27
|
+
private _initialize;
|
|
28
|
+
embed(text: string): Promise<number[]>;
|
|
29
|
+
embedBatch(texts: string[]): Promise<number[][]>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=local.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../src/embeddings/local.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACvC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACjD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAKD;;;;;GAKG;AACH,qBAAa,sBAAuB,YAAW,iBAAiB;IAC9D,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,YAAY,CAA8B;IAClD,OAAO,CAAC,MAAM,CAAS;IAEvB,QAAQ,CAAC,UAAU,OAAoB;gBAE3B,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;IAK5C,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED;;;OAGG;IACG,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;YAQ1B,WAAW;IAoBnB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAWtC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;CAevD"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { mkdir } from 'node:fs/promises';
|
|
2
|
+
const DEFAULT_MODEL = 'Xenova/all-MiniLM-L6-v2';
|
|
3
|
+
const MODEL_DIMENSIONS = 384;
|
|
4
|
+
/**
|
|
5
|
+
* Local embedding provider using @xenova/transformers.
|
|
6
|
+
*
|
|
7
|
+
* The model (~23MB) is downloaded on first use and cached in the
|
|
8
|
+
* models directory. All subsequent calls are fully offline.
|
|
9
|
+
*/
|
|
10
|
+
export class LocalEmbeddingProvider {
|
|
11
|
+
_model;
|
|
12
|
+
_cacheDir;
|
|
13
|
+
_pipeline = null;
|
|
14
|
+
_initPromise = null;
|
|
15
|
+
_ready = false;
|
|
16
|
+
dimensions = MODEL_DIMENSIONS;
|
|
17
|
+
constructor(cacheDir, model) {
|
|
18
|
+
this._model = model ?? DEFAULT_MODEL;
|
|
19
|
+
this._cacheDir = cacheDir;
|
|
20
|
+
}
|
|
21
|
+
get ready() {
|
|
22
|
+
return this._ready;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Lazily initialize the embedding pipeline.
|
|
26
|
+
* Shows a progress message on first download.
|
|
27
|
+
*/
|
|
28
|
+
async ensureInitialized() {
|
|
29
|
+
if (this._ready)
|
|
30
|
+
return;
|
|
31
|
+
if (!this._initPromise) {
|
|
32
|
+
this._initPromise = this._initialize();
|
|
33
|
+
}
|
|
34
|
+
await this._initPromise;
|
|
35
|
+
}
|
|
36
|
+
async _initialize() {
|
|
37
|
+
await mkdir(this._cacheDir, { recursive: true });
|
|
38
|
+
process.stderr.write(`[resonance] Loading embedding model (${this._model})...\n` +
|
|
39
|
+
`[resonance] First run downloads ~23MB. Cached at: ${this._cacheDir}\n`);
|
|
40
|
+
const { pipeline, env } = await import('@xenova/transformers');
|
|
41
|
+
env.cacheDir = this._cacheDir;
|
|
42
|
+
env.allowLocalModels = true;
|
|
43
|
+
this._pipeline = await pipeline('feature-extraction', this._model, {
|
|
44
|
+
quantized: true,
|
|
45
|
+
});
|
|
46
|
+
this._ready = true;
|
|
47
|
+
process.stderr.write('[resonance] Embedding model ready.\n');
|
|
48
|
+
}
|
|
49
|
+
async embed(text) {
|
|
50
|
+
await this.ensureInitialized();
|
|
51
|
+
const output = await this._pipeline(text, {
|
|
52
|
+
pooling: 'mean',
|
|
53
|
+
normalize: true,
|
|
54
|
+
});
|
|
55
|
+
return Array.from(output.data);
|
|
56
|
+
}
|
|
57
|
+
async embedBatch(texts) {
|
|
58
|
+
if (texts.length === 0)
|
|
59
|
+
return [];
|
|
60
|
+
await this.ensureInitialized();
|
|
61
|
+
const results = [];
|
|
62
|
+
for (const text of texts) {
|
|
63
|
+
const output = await this._pipeline(text, {
|
|
64
|
+
pooling: 'mean',
|
|
65
|
+
normalize: true,
|
|
66
|
+
});
|
|
67
|
+
results.push(Array.from(output.data));
|
|
68
|
+
}
|
|
69
|
+
return results;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=local.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/embeddings/local.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AASzC,MAAM,aAAa,GAAG,yBAAyB,CAAC;AAChD,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,OAAO,sBAAsB;IACzB,MAAM,CAAS;IACf,SAAS,CAAS;IAClB,SAAS,GAAY,IAAI,CAAC;IAC1B,YAAY,GAAyB,IAAI,CAAC;IAC1C,MAAM,GAAG,KAAK,CAAC;IAEd,UAAU,GAAG,gBAAgB,CAAC;IAEvC,YAAY,QAAgB,EAAE,KAAc;QAC1C,IAAI,CAAC,MAAM,GAAG,KAAK,IAAI,aAAa,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,iBAAiB;QACrB,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACzC,CAAC;QACD,MAAM,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;IAEO,KAAK,CAAC,WAAW;QACvB,MAAM,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEjD,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,wCAAwC,IAAI,CAAC,MAAM,QAAQ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AAC,CAAC;QACxD,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* encryption.ts — AES-256-GCM encryption for knowledge content.
|
|
3
|
+
*
|
|
4
|
+
* The encryption key derives from the user's cloud auth token.
|
|
5
|
+
* Without a valid token, knowledge cannot be stored or read.
|
|
6
|
+
* Experiences are NOT encrypted (private scratch data).
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Derive an AES-256 key from the user's auth token.
|
|
10
|
+
* No token = no key = no knowledge access.
|
|
11
|
+
*/
|
|
12
|
+
export declare function deriveLocalKey(authToken: string): Buffer;
|
|
13
|
+
/**
|
|
14
|
+
* Encrypt plaintext content using AES-256-GCM.
|
|
15
|
+
* Returns base64(iv + authTag + ciphertext).
|
|
16
|
+
*/
|
|
17
|
+
export declare function encryptContent(plaintext: string, key: Buffer): string;
|
|
18
|
+
/**
|
|
19
|
+
* Decrypt base64(iv + authTag + ciphertext) back to plaintext.
|
|
20
|
+
*/
|
|
21
|
+
export declare function decryptContent(encrypted: string, key: Buffer): string;
|
|
22
|
+
//# sourceMappingURL=encryption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../src/encryption.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAMrE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAQrE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* encryption.ts — AES-256-GCM encryption for knowledge content.
|
|
3
|
+
*
|
|
4
|
+
* The encryption key derives from the user's cloud auth token.
|
|
5
|
+
* Without a valid token, knowledge cannot be stored or read.
|
|
6
|
+
* Experiences are NOT encrypted (private scratch data).
|
|
7
|
+
*/
|
|
8
|
+
import { createCipheriv, createDecipheriv, randomBytes, createHash } from 'node:crypto';
|
|
9
|
+
/**
|
|
10
|
+
* Derive an AES-256 key from the user's auth token.
|
|
11
|
+
* No token = no key = no knowledge access.
|
|
12
|
+
*/
|
|
13
|
+
export function deriveLocalKey(authToken) {
|
|
14
|
+
return createHash('sha256').update(authToken).digest();
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Encrypt plaintext content using AES-256-GCM.
|
|
18
|
+
* Returns base64(iv + authTag + ciphertext).
|
|
19
|
+
*/
|
|
20
|
+
export function encryptContent(plaintext, key) {
|
|
21
|
+
const iv = randomBytes(12);
|
|
22
|
+
const cipher = createCipheriv('aes-256-gcm', key, iv);
|
|
23
|
+
const encrypted = Buffer.concat([cipher.update(plaintext, 'utf8'), cipher.final()]);
|
|
24
|
+
const tag = cipher.getAuthTag();
|
|
25
|
+
return Buffer.concat([iv, tag, encrypted]).toString('base64');
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Decrypt base64(iv + authTag + ciphertext) back to plaintext.
|
|
29
|
+
*/
|
|
30
|
+
export function decryptContent(encrypted, key) {
|
|
31
|
+
const buf = Buffer.from(encrypted, 'base64');
|
|
32
|
+
const iv = buf.subarray(0, 12);
|
|
33
|
+
const tag = buf.subarray(12, 28);
|
|
34
|
+
const ciphertext = buf.subarray(28);
|
|
35
|
+
const decipher = createDecipheriv('aes-256-gcm', key, iv);
|
|
36
|
+
decipher.setAuthTag(tag);
|
|
37
|
+
return decipher.update(ciphertext) + decipher.final('utf8');
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=encryption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryption.js","sourceRoot":"","sources":["../src/encry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AAE,GAAG,EAAE,EAAE,CAAC,CAAC;IAC1D,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACzB,OAAO,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC9D,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synthaer/resonance — Local-first AI memory for agents.
|
|
3
|
+
*
|
|
4
|
+
* Programmatic API entry point. For CLI usage, see cli.ts.
|
|
5
|
+
*/
|
|
6
|
+
export { resolveMode, resolveDataDir, ensureDataDir } from './config.js';
|
|
7
|
+
export type { ResonanceMode } from './config.js';
|
|
8
|
+
export { initLocalDb, createVectorIndexes, getDb, closeDb } from './db/local.js';
|
|
9
|
+
export { LocalEmbeddingProvider } from './embeddings/local.js';
|
|
10
|
+
export type { EmbeddingProvider } from './embeddings/local.js';
|
|
11
|
+
export { startServer } from './server.js';
|
|
12
|
+
export type { ResonanceServerOptions } from './server.js';
|
|
13
|
+
export { handleStoreKnowledge, handleRecallKnowledge, handleSemanticSearch, handleEndorseKnowledge, handleChallengeKnowledge, } from './tools/knowledge.js';
|
|
14
|
+
export type { StoreKnowledgeInput, RecallKnowledgeInput, SearchKnowledgeInput, EndorseInput, ChallengeInput, } from './tools/knowledge.js';
|
|
15
|
+
export { handleStoreExperience, handleRecallExperiences, } from './tools/experiences.js';
|
|
16
|
+
export type { StoreExperienceInput, RecallExperiencesInput, } from './tools/experiences.js';
|
|
17
|
+
export { handleSessionResume, handleMemoryCheckpoint, } from './tools/sessions.js';
|
|
18
|
+
export type { SessionResumeInput, MemoryCheckpointInput, } from './tools/sessions.js';
|
|
19
|
+
export { handleGetTrust, handleUpdateTrust, } from './tools/trust.js';
|
|
20
|
+
export type { GetTrustInput, UpdateTrustInput, } from './tools/trust.js';
|
|
21
|
+
export { isCloudOnlyTool, cloudRequiredError, } from './tools/cloud-gate.js';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACzE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAEjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,cAAc,GACf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,cAAc,EACd,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,aAAa,EACb,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,eAAe,EACf,kBAAkB,GACnB,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synthaer/resonance — Local-first AI memory for agents.
|
|
3
|
+
*
|
|
4
|
+
* Programmatic API entry point. For CLI usage, see cli.ts.
|
|
5
|
+
*/
|
|
6
|
+
export { resolveMode, resolveDataDir, ensureDataDir } from './config.js';
|
|
7
|
+
export { initLocalDb, createVectorIndexes, getDb, closeDb } from './db/local.js';
|
|
8
|
+
export { LocalEmbeddingProvider } from './embeddings/local.js';
|
|
9
|
+
export { startServer } from './server.js';
|
|
10
|
+
export { handleStoreKnowledge, handleRecallKnowledge, handleSemanticSearch, handleEndorseKnowledge, handleChallengeKnowledge, } from './tools/knowledge.js';
|
|
11
|
+
export { handleStoreExperience, handleRecallExperiences, } from './tools/experiences.js';
|
|
12
|
+
export { handleSessionResume, handleMemoryCheckpoint, } from './tools/sessions.js';
|
|
13
|
+
export { handleGetTrust, handleUpdateTrust, } from './tools/trust.js';
|
|
14
|
+
export { isCloudOnlyTool, cloudRequiredError, } from './tools/cloud-gate.js';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAEjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAS9B,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EACL,cAAc,EACd,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAM1B,OAAO,EACL,eAAe,EACf,kBAAkB,GACnB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import type { LocalResonance } from './index.js';
|
|
3
|
+
import { type DikwStage } from './types.js';
|
|
4
|
+
import type { LocalIdentity, PKIConfig, ContentSignature } from './pki.js';
|
|
5
|
+
export interface LocalMcpLimits {
|
|
6
|
+
edition: string;
|
|
7
|
+
maxProjects: number;
|
|
8
|
+
maxConcurrentFleet: number;
|
|
9
|
+
recallWindowSize: number;
|
|
10
|
+
allowedDikwStages: DikwStage[];
|
|
11
|
+
allowMassImport: boolean;
|
|
12
|
+
allowFleetKnowledge: boolean;
|
|
13
|
+
allowFullPromotion: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface LocalMcpRuntime {
|
|
16
|
+
listTools: () => Readonly<typeof MCP_TOOLS>;
|
|
17
|
+
callTool: (name: string, args?: Record<string, unknown>) => Promise<unknown>;
|
|
18
|
+
}
|
|
19
|
+
export interface CreateLocalMcpRouterOptions {
|
|
20
|
+
limits?: Partial<LocalMcpLimits>;
|
|
21
|
+
serverName?: string;
|
|
22
|
+
pkiConfig?: PKIConfig;
|
|
23
|
+
}
|
|
24
|
+
export declare function getPkiIdentity(): LocalIdentity | null;
|
|
25
|
+
export declare function isPkiReady(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Initialize PKI. Called once on server start. If a signed certificate is
|
|
28
|
+
* not yet available, the identity is created but writes that require signing
|
|
29
|
+
* will be blocked until the certificate is obtained.
|
|
30
|
+
*/
|
|
31
|
+
export declare function initializeServerPKI(config: PKIConfig): Promise<LocalIdentity>;
|
|
32
|
+
/**
|
|
33
|
+
* Request certificate signing from cloud PKI and update the local identity.
|
|
34
|
+
*/
|
|
35
|
+
export declare function requestServerCertSigning(authToken: string): Promise<LocalIdentity>;
|
|
36
|
+
/**
|
|
37
|
+
* Sign content using the local identity for ratification.
|
|
38
|
+
*/
|
|
39
|
+
export declare function signContentWithLocalIdentity(content: string): ContentSignature | null;
|
|
40
|
+
export type LocalMcpToolName = (typeof MCP_TOOLS)[number]['name'];
|
|
41
|
+
declare const MCP_TOOLS: readonly [{
|
|
42
|
+
readonly name: "store_knowledge";
|
|
43
|
+
readonly description: "Store a knowledge item in local Resonance memory.";
|
|
44
|
+
readonly inputSchema: {
|
|
45
|
+
readonly type: "object";
|
|
46
|
+
readonly properties: {
|
|
47
|
+
readonly content: {
|
|
48
|
+
readonly type: "string";
|
|
49
|
+
};
|
|
50
|
+
readonly kind: {
|
|
51
|
+
readonly type: readonly ["number", "string"];
|
|
52
|
+
};
|
|
53
|
+
readonly tags: {
|
|
54
|
+
readonly type: "array";
|
|
55
|
+
readonly items: {
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
readonly projectId: {
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
};
|
|
62
|
+
readonly dikwStage: {
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
readonly enum: DikwStage[];
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
readonly required: readonly ["content"];
|
|
68
|
+
};
|
|
69
|
+
}, {
|
|
70
|
+
readonly name: "recall_knowledge";
|
|
71
|
+
readonly description: "Keyword search across stored knowledge.";
|
|
72
|
+
readonly inputSchema: {
|
|
73
|
+
readonly type: "object";
|
|
74
|
+
readonly properties: {
|
|
75
|
+
readonly query: {
|
|
76
|
+
readonly type: "string";
|
|
77
|
+
};
|
|
78
|
+
readonly limit: {
|
|
79
|
+
readonly type: "number";
|
|
80
|
+
};
|
|
81
|
+
readonly minStrength: {
|
|
82
|
+
readonly type: "number";
|
|
83
|
+
};
|
|
84
|
+
readonly projectId: {
|
|
85
|
+
readonly type: "string";
|
|
86
|
+
};
|
|
87
|
+
readonly tags: {
|
|
88
|
+
readonly type: "array";
|
|
89
|
+
readonly items: {
|
|
90
|
+
readonly type: "string";
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
readonly required: readonly ["query"];
|
|
95
|
+
};
|
|
96
|
+
}, {
|
|
97
|
+
readonly name: "get_knowledge";
|
|
98
|
+
readonly description: "Fetch a single knowledge item by id.";
|
|
99
|
+
readonly inputSchema: {
|
|
100
|
+
readonly type: "object";
|
|
101
|
+
readonly properties: {
|
|
102
|
+
readonly id: {
|
|
103
|
+
readonly type: "string";
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
readonly required: readonly ["id"];
|
|
107
|
+
};
|
|
108
|
+
}, {
|
|
109
|
+
readonly name: "promote_knowledge";
|
|
110
|
+
readonly description: "Promote a knowledge item to a higher DIKW stage.";
|
|
111
|
+
readonly inputSchema: {
|
|
112
|
+
readonly type: "object";
|
|
113
|
+
readonly properties: {
|
|
114
|
+
readonly id: {
|
|
115
|
+
readonly type: "string";
|
|
116
|
+
};
|
|
117
|
+
readonly toStage: {
|
|
118
|
+
readonly type: "string";
|
|
119
|
+
readonly enum: DikwStage[];
|
|
120
|
+
};
|
|
121
|
+
readonly reason: {
|
|
122
|
+
readonly type: "string";
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
readonly required: readonly ["id", "toStage", "reason"];
|
|
126
|
+
};
|
|
127
|
+
}, {
|
|
128
|
+
readonly name: "store_experience";
|
|
129
|
+
readonly description: "Store an agent experience record.";
|
|
130
|
+
readonly inputSchema: {
|
|
131
|
+
readonly type: "object";
|
|
132
|
+
readonly properties: {
|
|
133
|
+
readonly content: {
|
|
134
|
+
readonly type: "string";
|
|
135
|
+
};
|
|
136
|
+
readonly kind: {
|
|
137
|
+
readonly type: readonly ["number", "string"];
|
|
138
|
+
};
|
|
139
|
+
readonly agentId: {
|
|
140
|
+
readonly type: "string";
|
|
141
|
+
};
|
|
142
|
+
readonly sessionId: {
|
|
143
|
+
readonly type: "string";
|
|
144
|
+
};
|
|
145
|
+
readonly projectId: {
|
|
146
|
+
readonly type: "string";
|
|
147
|
+
};
|
|
148
|
+
readonly relatedKnowledgeIds: {
|
|
149
|
+
readonly type: "array";
|
|
150
|
+
readonly items: {
|
|
151
|
+
readonly type: "string";
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
readonly required: readonly ["content"];
|
|
156
|
+
};
|
|
157
|
+
}, {
|
|
158
|
+
readonly name: "recall_experiences";
|
|
159
|
+
readonly description: "Keyword search across stored experiences.";
|
|
160
|
+
readonly inputSchema: {
|
|
161
|
+
readonly type: "object";
|
|
162
|
+
readonly properties: {
|
|
163
|
+
readonly query: {
|
|
164
|
+
readonly type: "string";
|
|
165
|
+
};
|
|
166
|
+
readonly limit: {
|
|
167
|
+
readonly type: "number";
|
|
168
|
+
};
|
|
169
|
+
readonly projectId: {
|
|
170
|
+
readonly type: "string";
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
readonly required: readonly ["query"];
|
|
174
|
+
};
|
|
175
|
+
}, {
|
|
176
|
+
readonly name: "semantic_search";
|
|
177
|
+
readonly description: "Hybrid semantic search across knowledge + experiences.";
|
|
178
|
+
readonly inputSchema: {
|
|
179
|
+
readonly type: "object";
|
|
180
|
+
readonly properties: {
|
|
181
|
+
readonly query: {
|
|
182
|
+
readonly type: "string";
|
|
183
|
+
};
|
|
184
|
+
readonly limit: {
|
|
185
|
+
readonly type: "number";
|
|
186
|
+
};
|
|
187
|
+
readonly minStrength: {
|
|
188
|
+
readonly type: "number";
|
|
189
|
+
};
|
|
190
|
+
readonly projectId: {
|
|
191
|
+
readonly type: "string";
|
|
192
|
+
};
|
|
193
|
+
readonly tags: {
|
|
194
|
+
readonly type: "array";
|
|
195
|
+
readonly items: {
|
|
196
|
+
readonly type: "string";
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
readonly required: readonly ["query"];
|
|
201
|
+
};
|
|
202
|
+
}, {
|
|
203
|
+
readonly name: "session_resume";
|
|
204
|
+
readonly description: "Resume or create session memory for agent/project.";
|
|
205
|
+
readonly inputSchema: {
|
|
206
|
+
readonly type: "object";
|
|
207
|
+
readonly properties: {
|
|
208
|
+
readonly agentId: {
|
|
209
|
+
readonly type: "string";
|
|
210
|
+
};
|
|
211
|
+
readonly projectId: {
|
|
212
|
+
readonly type: "string";
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
readonly required: readonly ["agentId", "projectId"];
|
|
216
|
+
};
|
|
217
|
+
}, {
|
|
218
|
+
readonly name: "memory_append";
|
|
219
|
+
readonly description: "Append a memory item to an active session.";
|
|
220
|
+
readonly inputSchema: {
|
|
221
|
+
readonly type: "object";
|
|
222
|
+
readonly properties: {
|
|
223
|
+
readonly sessionId: {
|
|
224
|
+
readonly type: "string";
|
|
225
|
+
};
|
|
226
|
+
readonly role: {
|
|
227
|
+
readonly type: "string";
|
|
228
|
+
readonly enum: readonly ["system", "user", "assistant"];
|
|
229
|
+
};
|
|
230
|
+
readonly content: {
|
|
231
|
+
readonly type: "string";
|
|
232
|
+
};
|
|
233
|
+
readonly timestamp: {
|
|
234
|
+
readonly type: "string";
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
readonly required: readonly ["sessionId", "role", "content"];
|
|
238
|
+
};
|
|
239
|
+
}, {
|
|
240
|
+
readonly name: "memory_checkpoint";
|
|
241
|
+
readonly description: "Persist a checkpoint for a session memory thread.";
|
|
242
|
+
readonly inputSchema: {
|
|
243
|
+
readonly type: "object";
|
|
244
|
+
readonly properties: {
|
|
245
|
+
readonly sessionId: {
|
|
246
|
+
readonly type: "string";
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
readonly required: readonly ["sessionId"];
|
|
250
|
+
};
|
|
251
|
+
}, {
|
|
252
|
+
readonly name: "update_experience";
|
|
253
|
+
readonly description: "Update an existing experience record.";
|
|
254
|
+
readonly inputSchema: {
|
|
255
|
+
readonly type: "object";
|
|
256
|
+
readonly properties: {
|
|
257
|
+
readonly id: {
|
|
258
|
+
readonly type: "string";
|
|
259
|
+
};
|
|
260
|
+
readonly content: {
|
|
261
|
+
readonly type: "string";
|
|
262
|
+
};
|
|
263
|
+
readonly kind: {
|
|
264
|
+
readonly type: readonly ["number", "string"];
|
|
265
|
+
};
|
|
266
|
+
readonly agentId: {
|
|
267
|
+
readonly type: "string";
|
|
268
|
+
};
|
|
269
|
+
readonly sessionId: {
|
|
270
|
+
readonly type: "string";
|
|
271
|
+
};
|
|
272
|
+
readonly projectId: {
|
|
273
|
+
readonly type: "string";
|
|
274
|
+
};
|
|
275
|
+
readonly relatedKnowledgeIds: {
|
|
276
|
+
readonly type: "array";
|
|
277
|
+
readonly items: {
|
|
278
|
+
readonly type: "string";
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
readonly required: readonly ["id"];
|
|
283
|
+
};
|
|
284
|
+
}, {
|
|
285
|
+
readonly name: "delete_experience";
|
|
286
|
+
readonly description: "Delete an experience record by id.";
|
|
287
|
+
readonly inputSchema: {
|
|
288
|
+
readonly type: "object";
|
|
289
|
+
readonly properties: {
|
|
290
|
+
readonly id: {
|
|
291
|
+
readonly type: "string";
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
readonly required: readonly ["id"];
|
|
295
|
+
};
|
|
296
|
+
}, {
|
|
297
|
+
readonly name: "get_experience";
|
|
298
|
+
readonly description: "Fetch a single experience record by id.";
|
|
299
|
+
readonly inputSchema: {
|
|
300
|
+
readonly type: "object";
|
|
301
|
+
readonly properties: {
|
|
302
|
+
readonly id: {
|
|
303
|
+
readonly type: "string";
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
readonly required: readonly ["id"];
|
|
307
|
+
};
|
|
308
|
+
}, {
|
|
309
|
+
readonly name: "update_knowledge";
|
|
310
|
+
readonly description: "Update an existing knowledge item.";
|
|
311
|
+
readonly inputSchema: {
|
|
312
|
+
readonly type: "object";
|
|
313
|
+
readonly properties: {
|
|
314
|
+
readonly id: {
|
|
315
|
+
readonly type: "string";
|
|
316
|
+
};
|
|
317
|
+
readonly content: {
|
|
318
|
+
readonly type: "string";
|
|
319
|
+
};
|
|
320
|
+
readonly kind: {
|
|
321
|
+
readonly type: readonly ["number", "string"];
|
|
322
|
+
};
|
|
323
|
+
readonly tags: {
|
|
324
|
+
readonly type: "array";
|
|
325
|
+
readonly items: {
|
|
326
|
+
readonly type: "string";
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
readonly projectId: {
|
|
330
|
+
readonly type: "string";
|
|
331
|
+
};
|
|
332
|
+
readonly dikwStage: {
|
|
333
|
+
readonly type: "string";
|
|
334
|
+
readonly enum: DikwStage[];
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
readonly required: readonly ["id"];
|
|
338
|
+
};
|
|
339
|
+
}, {
|
|
340
|
+
readonly name: "delete_knowledge";
|
|
341
|
+
readonly description: "Delete a knowledge item by id.";
|
|
342
|
+
readonly inputSchema: {
|
|
343
|
+
readonly type: "object";
|
|
344
|
+
readonly properties: {
|
|
345
|
+
readonly id: {
|
|
346
|
+
readonly type: "string";
|
|
347
|
+
};
|
|
348
|
+
};
|
|
349
|
+
readonly required: readonly ["id"];
|
|
350
|
+
};
|
|
351
|
+
}, {
|
|
352
|
+
readonly name: "health";
|
|
353
|
+
readonly description: "Return local MCP health and knowledge counts.";
|
|
354
|
+
readonly inputSchema: {
|
|
355
|
+
readonly type: "object";
|
|
356
|
+
readonly properties: {};
|
|
357
|
+
};
|
|
358
|
+
}];
|
|
359
|
+
export declare function createLocalMcpRuntime(localResonance: LocalResonance, limits?: Partial<LocalMcpLimits>): LocalMcpRuntime;
|
|
360
|
+
export declare function createResonanceMcpRouter(localResonance: LocalResonance, options?: CreateLocalMcpRouterOptions): Router;
|
|
361
|
+
export {};
|
|
362
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