caedora-mcp 0.2.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 +71 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +100 -0
- package/dist/cli.js.map +1 -0
- package/dist/lib/conventions.d.ts +3 -0
- package/dist/lib/conventions.d.ts.map +1 -0
- package/dist/lib/conventions.js +12 -0
- package/dist/lib/conventions.js.map +1 -0
- package/dist/lib/frontmatter.d.ts +23 -0
- package/dist/lib/frontmatter.d.ts.map +1 -0
- package/dist/lib/frontmatter.js +139 -0
- package/dist/lib/frontmatter.js.map +1 -0
- package/dist/lib/okf.d.ts +55 -0
- package/dist/lib/okf.d.ts.map +1 -0
- package/dist/lib/okf.js +276 -0
- package/dist/lib/okf.js.map +1 -0
- package/dist/providers/github.d.ts +26 -0
- package/dist/providers/github.d.ts.map +1 -0
- package/dist/providers/github.js +144 -0
- package/dist/providers/github.js.map +1 -0
- package/dist/providers/local-node.d.ts +25 -0
- package/dist/providers/local-node.d.ts.map +1 -0
- package/dist/providers/local-node.js +112 -0
- package/dist/providers/local-node.js.map +1 -0
- package/dist/providers/types.d.ts +25 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +21 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +43 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/operations.d.ts +60 -0
- package/dist/tools/operations.d.ts.map +1 -0
- package/dist/tools/operations.js +48 -0
- package/dist/tools/operations.js.map +1 -0
- package/dist/tools/read.d.ts +49 -0
- package/dist/tools/read.d.ts.map +1 -0
- package/dist/tools/read.js +74 -0
- package/dist/tools/read.js.map +1 -0
- package/dist/tools/search.d.ts +77 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +107 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/write.d.ts +89 -0
- package/dist/tools/write.d.ts.map +1 -0
- package/dist/tools/write.js +114 -0
- package/dist/tools/write.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trimmed VaultProvider interface for the MCP server. Mirrors
|
|
3
|
+
* `lib/types.ts` in the web app but only declares the subset the MCP
|
|
4
|
+
* actually needs (no diff/log helpers).
|
|
5
|
+
*/
|
|
6
|
+
export interface FileEntry {
|
|
7
|
+
path: string;
|
|
8
|
+
name: string;
|
|
9
|
+
type: 'file' | 'dir';
|
|
10
|
+
size?: number;
|
|
11
|
+
lastModified?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface VaultProvider {
|
|
14
|
+
readonly type: 'local' | 'github';
|
|
15
|
+
readonly writesAreCommits: boolean;
|
|
16
|
+
readFile(path: string): Promise<string>;
|
|
17
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
18
|
+
listFiles(dir?: string): Promise<FileEntry[]>;
|
|
19
|
+
renamePath(from: string, to: string): Promise<void>;
|
|
20
|
+
deletePath(path: string): Promise<void>;
|
|
21
|
+
commit(message: string, paths: string[]): Promise<string>;
|
|
22
|
+
}
|
|
23
|
+
/** Walks a provider and returns every file/dir underneath root. */
|
|
24
|
+
export declare function listFilesRecursive(provider: VaultProvider): Promise<FileEntry[]>;
|
|
25
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/providers/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,GAAG,KAAK,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAA;IACjC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAA;IAElC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACvC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACvD,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAAA;IAC7C,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACvC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CAC1D;AAED,mEAAmE;AACnE,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAYtF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trimmed VaultProvider interface for the MCP server. Mirrors
|
|
3
|
+
* `lib/types.ts` in the web app but only declares the subset the MCP
|
|
4
|
+
* actually needs (no diff/log helpers).
|
|
5
|
+
*/
|
|
6
|
+
/** Walks a provider and returns every file/dir underneath root. */
|
|
7
|
+
export async function listFilesRecursive(provider) {
|
|
8
|
+
const out = [];
|
|
9
|
+
const queue = [''];
|
|
10
|
+
while (queue.length) {
|
|
11
|
+
const dir = queue.shift();
|
|
12
|
+
const entries = await provider.listFiles(dir);
|
|
13
|
+
for (const e of entries) {
|
|
14
|
+
out.push(e);
|
|
15
|
+
if (e.type === 'dir')
|
|
16
|
+
queue.push(e.path);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return out;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/providers/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAsBH,mEAAmE;AACnE,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,QAAuB;IAC9D,MAAM,GAAG,GAAgB,EAAE,CAAA;IAC3B,MAAM,KAAK,GAAa,CAAC,EAAE,CAAC,CAAA;IAC5B,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,EAAG,CAAA;QAC1B,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;QAC7C,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACxB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACX,IAAI,CAAC,CAAC,IAAI,KAAK,KAAK;gBAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QAC1C,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { VaultProvider } from './providers/types.js';
|
|
4
|
+
export interface BuildServerOptions {
|
|
5
|
+
provider: VaultProvider;
|
|
6
|
+
readOnly?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function buildServer({ provider, readOnly }: BuildServerOptions): McpServer;
|
|
9
|
+
export type { VaultProvider } from './providers/types.js';
|
|
10
|
+
export { LocalNodeProvider } from './providers/local-node.js';
|
|
11
|
+
export { GitHubNodeProvider } from './providers/github.js';
|
|
12
|
+
export { z };
|
|
13
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AA0CzD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,aAAa,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,QAAgB,EAAE,EAAE,kBAAkB,GAAG,SAAS,CAiHzF;AAQD,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,CAAC,EAAE,CAAA"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { grepConcepts, grepConceptsSchema, listConcepts, listConceptsSchema, readConcept, readConceptSchema, } from './tools/read.js';
|
|
4
|
+
import { conceptGraph, conceptGraphSchema, conceptsByTag, conceptsByTagSchema, listTags, listTagsSchema, listTypes, listTypesSchema, searchConcepts, searchConceptsSchema, } from './tools/search.js';
|
|
5
|
+
import { createConcept, createConceptSchema, deleteConcept, deleteConceptSchema, renameConcept, renameConceptSchema, updateConcept, updateConceptSchema, } from './tools/write.js';
|
|
6
|
+
import { ingestSource, ingestSourceSchema, lintBundle, rebuildBundleIndexes, rebuildIndexesSchema, recordQuery, recordQuerySchema, validateBundleSchema, } from './tools/operations.js';
|
|
7
|
+
export function buildServer({ provider, readOnly = false }) {
|
|
8
|
+
const server = new McpServer({
|
|
9
|
+
name: 'caedora-mcp',
|
|
10
|
+
version: '0.2.0',
|
|
11
|
+
});
|
|
12
|
+
server.tool('list_concepts', 'List OKF concepts with structured metadata, optionally filtered by directory or type.', listConceptsSchema, async (args) => textResult(await listConcepts(provider, args)));
|
|
13
|
+
server.tool('read_concept', 'Read one OKF concept and return its concept ID, metadata, body, and conformance state.', readConceptSchema, async (args) => textResult(await readConcept(provider, args)));
|
|
14
|
+
server.tool('search_concepts', 'Ranked search across concept metadata and Markdown bodies, with type and tag filters.', searchConceptsSchema, async (args) => textResult(await searchConcepts(provider, args)));
|
|
15
|
+
server.tool('grep_concepts', 'Run a regular expression across all concept documents.', grepConceptsSchema, async (args) => textResult(await grepConcepts(provider, args)));
|
|
16
|
+
server.tool('list_tags', 'List bundle tags and concept counts.', listTagsSchema, async () => textResult(await listTags(provider)));
|
|
17
|
+
server.tool('list_types', 'List concept types and usage counts.', listTypesSchema, async () => textResult(await listTypes(provider)));
|
|
18
|
+
server.tool('concepts_by_tag', 'List concepts carrying a normalized tag.', conceptsByTagSchema, async (args) => textResult(await conceptsByTag(provider, args)));
|
|
19
|
+
server.tool('concept_graph', 'Return outgoing links, external references, and backlinks for one concept or the full bundle.', conceptGraphSchema, async (args) => textResult(await conceptGraph(provider, args)));
|
|
20
|
+
server.tool('lint_bundle', 'Validate OKF v0.1 conformance and report invalid metadata, reserved files, and broken links.', validateBundleSchema, async (args) => textResult(await lintBundle(provider, {
|
|
21
|
+
...args,
|
|
22
|
+
recordLint: readOnly ? false : args.recordLint,
|
|
23
|
+
})));
|
|
24
|
+
if (!readOnly) {
|
|
25
|
+
server.tool('create_concept', 'Create a conformant OKF concept and update bundle indexes and log.', createConceptSchema, async (args) => textResult(await createConcept(provider, args)));
|
|
26
|
+
server.tool('update_concept', 'Update a concept body or metadata while preserving producer-defined YAML fields.', updateConceptSchema, async (args) => textResult(await updateConcept(provider, args)));
|
|
27
|
+
server.tool('rename_concept', 'Move a concept to a new path-based concept ID, then rebuild indexes and log the move.', renameConceptSchema, async (args) => textResult(await renameConcept(provider, args)));
|
|
28
|
+
server.tool('delete_concept', 'Delete a concept or concept directory while protecting reserved OKF documents.', deleteConceptSchema, async (args) => textResult(await deleteConcept(provider, args)));
|
|
29
|
+
server.tool('ingest_source', 'Create a source concept with provenance metadata and record an ingest operation.', ingestSourceSchema, async (args) => textResult(await ingestSource(provider, args)));
|
|
30
|
+
server.tool('rebuild_indexes', 'Regenerate hierarchical index.md files for progressive disclosure.', rebuildIndexesSchema, async () => textResult(await rebuildBundleIndexes(provider)));
|
|
31
|
+
server.tool('record_query', 'Append a durable query or synthesis operation to the bundle log.', recordQuerySchema, async (args) => textResult(await recordQuery(provider, args)));
|
|
32
|
+
}
|
|
33
|
+
return server;
|
|
34
|
+
}
|
|
35
|
+
function textResult(payload) {
|
|
36
|
+
return {
|
|
37
|
+
content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export { LocalNodeProvider } from './providers/local-node.js';
|
|
41
|
+
export { GitHubNodeProvider } from './providers/github.js';
|
|
42
|
+
export { z };
|
|
43
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,iBAAiB,GAClB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,QAAQ,EACR,cAAc,EACd,SAAS,EACT,eAAe,EACf,cAAc,EACd,oBAAoB,GACrB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,aAA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E,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,CAAC,EAAE,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { VaultProvider } from '../providers/types.js';
|
|
3
|
+
export declare const validateBundleSchema: {
|
|
4
|
+
recordLint: z.ZodOptional<z.ZodBoolean>;
|
|
5
|
+
};
|
|
6
|
+
export declare function lintBundle(provider: VaultProvider, { recordLint }: {
|
|
7
|
+
recordLint?: boolean;
|
|
8
|
+
}): Promise<{
|
|
9
|
+
version: string;
|
|
10
|
+
conformant: boolean;
|
|
11
|
+
concepts: number;
|
|
12
|
+
links: number;
|
|
13
|
+
brokenLinks: number;
|
|
14
|
+
issues: {
|
|
15
|
+
path: string;
|
|
16
|
+
severity: "error" | "warning";
|
|
17
|
+
code: string;
|
|
18
|
+
message: string;
|
|
19
|
+
}[];
|
|
20
|
+
}>;
|
|
21
|
+
export declare const rebuildIndexesSchema: {};
|
|
22
|
+
export declare function rebuildBundleIndexes(provider: VaultProvider): Promise<{
|
|
23
|
+
updated: string[];
|
|
24
|
+
}>;
|
|
25
|
+
export declare const ingestSourceSchema: {
|
|
26
|
+
path: z.ZodString;
|
|
27
|
+
title: z.ZodString;
|
|
28
|
+
sourceType: z.ZodOptional<z.ZodString>;
|
|
29
|
+
description: z.ZodString;
|
|
30
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
31
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
32
|
+
body: z.ZodString;
|
|
33
|
+
};
|
|
34
|
+
export declare function ingestSource(provider: VaultProvider, args: {
|
|
35
|
+
path: string;
|
|
36
|
+
title: string;
|
|
37
|
+
sourceType?: string;
|
|
38
|
+
description: string;
|
|
39
|
+
resource?: string;
|
|
40
|
+
tags?: string[];
|
|
41
|
+
body: string;
|
|
42
|
+
}): Promise<{
|
|
43
|
+
id: string;
|
|
44
|
+
path: string;
|
|
45
|
+
created: boolean;
|
|
46
|
+
metadata: import("../lib/frontmatter.js").Frontmatter;
|
|
47
|
+
}>;
|
|
48
|
+
export declare const recordQuerySchema: {
|
|
49
|
+
summary: z.ZodString;
|
|
50
|
+
conceptPaths: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
51
|
+
};
|
|
52
|
+
export declare function recordQuery(provider: VaultProvider, { summary, conceptPaths }: {
|
|
53
|
+
summary: string;
|
|
54
|
+
conceptPaths?: string[];
|
|
55
|
+
}): Promise<{
|
|
56
|
+
path: string;
|
|
57
|
+
action: string;
|
|
58
|
+
recorded: boolean;
|
|
59
|
+
}>;
|
|
60
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../src/tools/operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAG1D,eAAO,MAAM,oBAAoB;;CAEhC,CAAA;AAED,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,aAAa,EACvB,EAAE,UAAkB,EAAE,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE;;;;;;;;;;;;GAWjD;AAED,eAAO,MAAM,oBAAoB,IAAK,CAAA;AAEtC,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,aAAa;;GAEjE;AAED,eAAO,MAAM,kBAAkB;;;;;;;;CAQ9B,CAAA;AAED,wBAAsB,YAAY,CAChC,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE;IACJ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;CACb;;;;;GAaF;AAED,eAAO,MAAM,iBAAiB;;;CAG7B,CAAA;AAED,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,aAAa,EACvB,EAAE,OAAO,EAAE,YAAiB,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE;;;;GAI7E"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { appendLog, rebuildIndexes, validateBundle } from '../lib/okf.js';
|
|
3
|
+
import { createConcept } from './write.js';
|
|
4
|
+
export const validateBundleSchema = {
|
|
5
|
+
recordLint: z.boolean().optional().describe('Append the lint result to log.md. Defaults to false.'),
|
|
6
|
+
};
|
|
7
|
+
export async function lintBundle(provider, { recordLint = false }) {
|
|
8
|
+
const report = await validateBundle(provider);
|
|
9
|
+
if (recordLint) {
|
|
10
|
+
await appendLog(provider, 'Lint', `${report.conformant ? 'Passed' : 'Found issues'}: ${report.concepts} concepts, ${report.issues.length} issues, ${report.brokenLinks} broken links.`);
|
|
11
|
+
}
|
|
12
|
+
return report;
|
|
13
|
+
}
|
|
14
|
+
export const rebuildIndexesSchema = {};
|
|
15
|
+
export async function rebuildBundleIndexes(provider) {
|
|
16
|
+
return rebuildIndexes(provider);
|
|
17
|
+
}
|
|
18
|
+
export const ingestSourceSchema = {
|
|
19
|
+
path: z.string().describe('Source concept path, normally under sources/, ending in .md.'),
|
|
20
|
+
title: z.string().describe('Source title.'),
|
|
21
|
+
sourceType: z.string().optional().describe('Concept type. Defaults to Source.'),
|
|
22
|
+
description: z.string().describe('One-sentence source summary.'),
|
|
23
|
+
resource: z.string().optional().describe('Canonical URI for the source.'),
|
|
24
|
+
tags: z.array(z.string()).optional(),
|
|
25
|
+
body: z.string().describe('Source notes, claims, quotations, and citations in Markdown.'),
|
|
26
|
+
};
|
|
27
|
+
export async function ingestSource(provider, args) {
|
|
28
|
+
const result = await createConcept(provider, {
|
|
29
|
+
path: args.path,
|
|
30
|
+
type: args.sourceType ?? 'Source',
|
|
31
|
+
title: args.title,
|
|
32
|
+
description: args.description,
|
|
33
|
+
resource: args.resource,
|
|
34
|
+
tags: ['source', ...(args.tags ?? [])],
|
|
35
|
+
body: args.body,
|
|
36
|
+
});
|
|
37
|
+
await appendLog(provider, 'Ingest', `Ingested [${args.title}](/${args.path}).`);
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
export const recordQuerySchema = {
|
|
41
|
+
summary: z.string().describe('Concise description of the query or durable synthesis produced.'),
|
|
42
|
+
conceptPaths: z.array(z.string()).optional().describe('Concept paths used or created.'),
|
|
43
|
+
};
|
|
44
|
+
export async function recordQuery(provider, { summary, conceptPaths = [] }) {
|
|
45
|
+
const links = conceptPaths.map((path) => `[${path.replace(/\.md$/i, '')}](/${path})`).join(', ');
|
|
46
|
+
return appendLog(provider, 'Query', links ? `${summary} Concepts: ${links}.` : summary);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../src/tools/operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1C,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC;CACpG,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,QAAuB,EACvB,EAAE,UAAU,GAAG,KAAK,EAA4B;IAEhD,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,CAAA;IAC7C,I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aultProvider } from '../providers/types.js';
|
|
3
|
+
export declare const listConceptsSchema: {
|
|
4
|
+
folder: z.ZodOptional<z.ZodString>;
|
|
5
|
+
type: z.ZodOptional<z.ZodString>;
|
|
6
|
+
};
|
|
7
|
+
export declare function listConcepts(provider: VaultProvider, { folder, type }: {
|
|
8
|
+
folder?: string;
|
|
9
|
+
type?: string;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
id: string;
|
|
12
|
+
path: string;
|
|
13
|
+
type: string;
|
|
14
|
+
title: string;
|
|
15
|
+
description: string;
|
|
16
|
+
tags: string[];
|
|
17
|
+
timestamp: string;
|
|
18
|
+
conformant: boolean;
|
|
19
|
+
size: number | undefined;
|
|
20
|
+
lastModified: number | undefined;
|
|
21
|
+
}[]>;
|
|
22
|
+
export declare const readConceptSchema: {
|
|
23
|
+
path: z.ZodString;
|
|
24
|
+
};
|
|
25
|
+
export declare function readConcept(provider: VaultProvider, { path }: {
|
|
26
|
+
path: string;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
id: string;
|
|
29
|
+
path: string;
|
|
30
|
+
metadata: import("../lib/frontmatter.js").Frontmatter;
|
|
31
|
+
body: string;
|
|
32
|
+
conformant: boolean;
|
|
33
|
+
parseError: string | null;
|
|
34
|
+
}>;
|
|
35
|
+
export declare const grepConceptsSchema: {
|
|
36
|
+
regex: z.ZodString;
|
|
37
|
+
flags: z.ZodOptional<z.ZodString>;
|
|
38
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
};
|
|
40
|
+
export declare function grepConcepts(provider: VaultProvider, { regex, flags, limit }: {
|
|
41
|
+
regex: string;
|
|
42
|
+
flags?: string;
|
|
43
|
+
limit?: number;
|
|
44
|
+
}): Promise<{
|
|
45
|
+
path: string;
|
|
46
|
+
line: number;
|
|
47
|
+
text: string;
|
|
48
|
+
}[]>;
|
|
49
|
+
//# sourceMappingURL=read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE9E,eAAO,MAAM,kBAAkB;;;CAG9B,CAAA;AAED,wBAAsB,YAAY,CAChC,QAAQ,EAAE,aAAa,EACvB,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;KAwBrD;AAED,eAAO,MAAM,iBAAiB;;CAE7B,CAAA;AAED,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,aAAa,EACvB,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE;;;;;;;GAa3B;AAED,eAAO,MAAM,kBAAkB;;;;CAI9B,CAAA;AAED,wBAAsB,YAAY,CAChC,QAAQ,EAAE,aAAa,EACvB,EAAE,KAAK,EAAE,KAAW,EAAE,KAAW,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE;UAI5D,MAAM;UAAQ,MAAM;UAAQ,MAAM;KAU7D"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { parseFrontmatter } from '../lib/frontmatter.js';
|
|
3
|
+
import { conceptId, isConceptPath } from '../lib/okf.js';
|
|
4
|
+
import { listFilesRecursive } from '../providers/types.js';
|
|
5
|
+
export const listConceptsSchema = {
|
|
6
|
+
folder: z.string().optional().describe('Directory path relative to the bundle root.'),
|
|
7
|
+
type: z.string().optional().describe('Optional exact concept type filter.'),
|
|
8
|
+
};
|
|
9
|
+
export async function listConcepts(provider, { folder, type }) {
|
|
10
|
+
const entries = await listFilesRecursive(provider);
|
|
11
|
+
const concepts = [];
|
|
12
|
+
for (const entry of entries) {
|
|
13
|
+
if (entry.type !== 'file' || !isConceptPath(entry.path))
|
|
14
|
+
continue;
|
|
15
|
+
if (folder && entry.path !== folder && !entry.path.startsWith(`${folder}/`))
|
|
16
|
+
continue;
|
|
17
|
+
const raw = await provider.readFile(entry.path);
|
|
18
|
+
const parsed = parseFrontmatter(raw);
|
|
19
|
+
if (type && parsed.frontmatter.type !== type)
|
|
20
|
+
continue;
|
|
21
|
+
concepts.push({
|
|
22
|
+
id: conceptId(entry.path),
|
|
23
|
+
path: entry.path,
|
|
24
|
+
type: parsed.frontmatter.type || 'Unknown',
|
|
25
|
+
title: parsed.frontmatter.title,
|
|
26
|
+
description: parsed.frontmatter.description,
|
|
27
|
+
tags: parsed.frontmatter.tags,
|
|
28
|
+
timestamp: parsed.frontmatter.timestamp,
|
|
29
|
+
conformant: parsed.hasFrontmatter && !parsed.error && !!parsed.frontmatter.type.trim(),
|
|
30
|
+
size: entry.size,
|
|
31
|
+
lastModified: entry.lastModified,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return concepts;
|
|
35
|
+
}
|
|
36
|
+
export const readConceptSchema = {
|
|
37
|
+
path: z.string().describe('Concept path relative to the bundle root.'),
|
|
38
|
+
};
|
|
39
|
+
export async function readConcept(provider, { path }) {
|
|
40
|
+
if (!isConceptPath(path))
|
|
41
|
+
throw new Error(`${path} is not an OKF concept path.`);
|
|
42
|
+
const raw = await provider.readFile(path);
|
|
43
|
+
const parsed = parseFrontmatter(raw);
|
|
44
|
+
return {
|
|
45
|
+
id: conceptId(path),
|
|
46
|
+
path,
|
|
47
|
+
metadata: parsed.frontmatter,
|
|
48
|
+
body: parsed.body,
|
|
49
|
+
conformant: parsed.hasFrontmatter && !parsed.error && !!parsed.frontmatter.type.trim(),
|
|
50
|
+
parseError: parsed.error,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export const grepConceptsSchema = {
|
|
54
|
+
regex: z.string().describe('JavaScript regular expression to search for.'),
|
|
55
|
+
flags: z.string().optional().describe('Regex flags. Defaults to "i".'),
|
|
56
|
+
limit: z.number().int().positive().max(500).optional().describe('Maximum matches.'),
|
|
57
|
+
};
|
|
58
|
+
export async function grepConcepts(provider, { regex, flags = 'i', limit = 100 }) {
|
|
59
|
+
const re = new RegExp(regex, flags.includes('g') ? flags : `${flags}g`);
|
|
60
|
+
const entries = await listFilesRecursive(provider);
|
|
61
|
+
const hits = [];
|
|
62
|
+
for (const entry of entries.filter((item) => item.type === 'file' && isConceptPath(item.path))) {
|
|
63
|
+
const lines = (await provider.readFile(entry.path)).split(/\r?\n/);
|
|
64
|
+
for (let index = 0; index < lines.length && hits.length < limit; index++) {
|
|
65
|
+
if (re.test(lines[index]))
|
|
66
|
+
hits.push({ path: entry.path, line: index + 1, text: lines[index].trim() });
|
|
67
|
+
re.lastIndex = 0;
|
|
68
|
+
}
|
|
69
|
+
if (hits.length >= limit)
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
return hits;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAsB,MAAM,uBAAuB,CAAA;AAE9E,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;IACrF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;CAC5E,C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IACjC,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { VaultProvider } from '../providers/types.js';
|
|
3
|
+
export declare const searchConceptsSchema: {
|
|
4
|
+
query: z.ZodString;
|
|
5
|
+
tag: z.ZodOptional<z.ZodString>;
|
|
6
|
+
type: z.ZodOptional<z.ZodString>;
|
|
7
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
};
|
|
9
|
+
export declare function searchConcepts(provider: VaultProvider, { query, tag, type, limit, }: {
|
|
10
|
+
query: string;
|
|
11
|
+
tag?: string;
|
|
12
|
+
type?: string;
|
|
13
|
+
limit?: number;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
id: string;
|
|
16
|
+
path: string;
|
|
17
|
+
type: string;
|
|
18
|
+
title: string;
|
|
19
|
+
description: string;
|
|
20
|
+
tags: string[];
|
|
21
|
+
timestamp: string;
|
|
22
|
+
score: number;
|
|
23
|
+
snippet: string;
|
|
24
|
+
}[]>;
|
|
25
|
+
export declare const listTagsSchema: {};
|
|
26
|
+
export declare function listTags(provider: VaultProvider): Promise<{
|
|
27
|
+
tag: string;
|
|
28
|
+
count: number;
|
|
29
|
+
}[]>;
|
|
30
|
+
export declare const listTypesSchema: {};
|
|
31
|
+
export declare function listTypes(provider: VaultProvider): Promise<{
|
|
32
|
+
type: string;
|
|
33
|
+
count: number;
|
|
34
|
+
}[]>;
|
|
35
|
+
export declare const conceptsByTagSchema: {
|
|
36
|
+
tag: z.ZodString;
|
|
37
|
+
};
|
|
38
|
+
export declare function conceptsByTag(provider: VaultProvider, { tag }: {
|
|
39
|
+
tag: string;
|
|
40
|
+
}): Promise<{
|
|
41
|
+
id: string;
|
|
42
|
+
path: string;
|
|
43
|
+
type: string;
|
|
44
|
+
title: string;
|
|
45
|
+
description: string;
|
|
46
|
+
}[]>;
|
|
47
|
+
export declare const conceptGraphSchema: {
|
|
48
|
+
path: z.ZodOptional<z.ZodString>;
|
|
49
|
+
};
|
|
50
|
+
export declare function conceptGraph(provider: VaultProvider, { path }: {
|
|
51
|
+
path?: string;
|
|
52
|
+
}): Promise<{
|
|
53
|
+
id: string;
|
|
54
|
+
path: string;
|
|
55
|
+
title: string;
|
|
56
|
+
type: string;
|
|
57
|
+
outgoing: {
|
|
58
|
+
label: string;
|
|
59
|
+
href: string;
|
|
60
|
+
targetPath: string | null;
|
|
61
|
+
targetId: string | null;
|
|
62
|
+
external: boolean;
|
|
63
|
+
}[];
|
|
64
|
+
external: {
|
|
65
|
+
label: string;
|
|
66
|
+
href: string;
|
|
67
|
+
targetPath: string | null;
|
|
68
|
+
targetId: string | null;
|
|
69
|
+
external: boolean;
|
|
70
|
+
}[];
|
|
71
|
+
backlinks: {
|
|
72
|
+
id: string;
|
|
73
|
+
path: string;
|
|
74
|
+
title: string;
|
|
75
|
+
}[];
|
|
76
|
+
}[]>;
|
|
77
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1D,eAAO,MAAM,oBAAoB;;;;;CAKhC,CAAA;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,aAAa,EACvB,EACE,KAAK,EACL,GAAG,EACH,IAAI,EACJ,KAAU,GACX,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;KAmClE;AAED,eAAO,MAAM,cAAc,IAAK,CAAA;AAEhC,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,aAAa;;;KAMrD;AAED,eAAO,MAAM,eAAe,IAAK,CAAA;AAEjC,wBAAsB,SAAS,CAAC,QAAQ,EAAE,aAAa;;;KAMtD;AAED,eAAO,MAAM,mBAAmB;;CAE/B,CAAA;AAED,wBAAsB,aAAa,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE;;;;;;KAKpF;AAED,eAAO,MAAM,kBAAkB;;CAE9B,CAAA;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;KActF"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { normalizeTag, parseFrontmatter } from '../lib/frontmatter.js';
|
|
3
|
+
import { buildConceptCatalog } from '../lib/okf.js';
|
|
4
|
+
export const searchConceptsSchema = {
|
|
5
|
+
query: z.string().describe('Free-text query across structured metadata and Markdown bodies.'),
|
|
6
|
+
tag: z.string().optional().describe('Optional normalized tag filter.'),
|
|
7
|
+
type: z.string().optional().describe('Optional exact concept type filter.'),
|
|
8
|
+
limit: z.number().int().positive().max(100).optional().describe('Maximum results.'),
|
|
9
|
+
};
|
|
10
|
+
export async function searchConcepts(provider, { query, tag, type, limit = 20, }) {
|
|
11
|
+
const q = query.trim().toLowerCase();
|
|
12
|
+
const tagFilter = tag ? normalizeTag(tag) : null;
|
|
13
|
+
const catalog = await buildConceptCatalog(provider);
|
|
14
|
+
const hits = [];
|
|
15
|
+
for (const concept of catalog) {
|
|
16
|
+
if (tagFilter && !concept.tags.includes(tagFilter))
|
|
17
|
+
continue;
|
|
18
|
+
if (type && concept.type !== type)
|
|
19
|
+
continue;
|
|
20
|
+
const raw = await provider.readFile(concept.path);
|
|
21
|
+
const body = parseFrontmatter(raw).body;
|
|
22
|
+
const metadataText = [
|
|
23
|
+
concept.title,
|
|
24
|
+
concept.description,
|
|
25
|
+
concept.type,
|
|
26
|
+
concept.resource,
|
|
27
|
+
concept.tags.join(' '),
|
|
28
|
+
].join(' ').toLowerCase();
|
|
29
|
+
const metadataMatches = q ? countMatches(metadataText, q) : 0;
|
|
30
|
+
const bodyMatches = q ? countMatches(body.toLowerCase(), q) : 0;
|
|
31
|
+
const score = metadataMatches * 5 + bodyMatches;
|
|
32
|
+
if (q && score === 0)
|
|
33
|
+
continue;
|
|
34
|
+
hits.push({
|
|
35
|
+
id: concept.id,
|
|
36
|
+
path: concept.path,
|
|
37
|
+
type: concept.type,
|
|
38
|
+
title: concept.title,
|
|
39
|
+
description: concept.description,
|
|
40
|
+
tags: concept.tags,
|
|
41
|
+
timestamp: concept.timestamp,
|
|
42
|
+
score,
|
|
43
|
+
snippet: snippetAround(body, q),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return hits.sort((a, b) => b.score - a.score).slice(0, limit);
|
|
47
|
+
}
|
|
48
|
+
export const listTagsSchema = {};
|
|
49
|
+
export async function listTags(provider) {
|
|
50
|
+
const counts = new Map();
|
|
51
|
+
for (const concept of await buildConceptCatalog(provider)) {
|
|
52
|
+
for (const tag of concept.tags)
|
|
53
|
+
counts.set(tag, (counts.get(tag) ?? 0) + 1);
|
|
54
|
+
}
|
|
55
|
+
return [...counts].map(([tag, count]) => ({ tag, count })).sort((a, b) => b.count - a.count);
|
|
56
|
+
}
|
|
57
|
+
export const listTypesSchema = {};
|
|
58
|
+
export async function listTypes(provider) {
|
|
59
|
+
const counts = new Map();
|
|
60
|
+
for (const concept of await buildConceptCatalog(provider)) {
|
|
61
|
+
counts.set(concept.type, (counts.get(concept.type) ?? 0) + 1);
|
|
62
|
+
}
|
|
63
|
+
return [...counts].map(([type, count]) => ({ type, count })).sort((a, b) => b.count - a.count);
|
|
64
|
+
}
|
|
65
|
+
export const conceptsByTagSchema = {
|
|
66
|
+
tag: z.string().describe('Tag to filter by.'),
|
|
67
|
+
};
|
|
68
|
+
export async function conceptsByTag(provider, { tag }) {
|
|
69
|
+
const target = normalizeTag(tag);
|
|
70
|
+
return (await buildConceptCatalog(provider))
|
|
71
|
+
.filter((concept) => concept.tags.includes(target))
|
|
72
|
+
.map(({ id, path, type, title, description }) => ({ id, path, type, title, description }));
|
|
73
|
+
}
|
|
74
|
+
export const conceptGraphSchema = {
|
|
75
|
+
path: z.string().optional().describe('Optional concept path to focus on.'),
|
|
76
|
+
};
|
|
77
|
+
export async function conceptGraph(provider, { path }) {
|
|
78
|
+
const concepts = await buildConceptCatalog(provider);
|
|
79
|
+
const nodes = path ? concepts.filter((concept) => concept.path === path) : concepts;
|
|
80
|
+
return nodes.map((concept) => ({
|
|
81
|
+
id: concept.id,
|
|
82
|
+
path: concept.path,
|
|
83
|
+
title: concept.title,
|
|
84
|
+
type: concept.type,
|
|
85
|
+
outgoing: concept.links.filter((link) => !link.external),
|
|
86
|
+
external: concept.links.filter((link) => link.external),
|
|
87
|
+
backlinks: concepts
|
|
88
|
+
.filter((candidate) => candidate.links.some((link) => link.targetPath === concept.path))
|
|
89
|
+
.map(({ id, path: sourcePath, title }) => ({ id, path: sourcePath, title })),
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
function countMatches(text, query) {
|
|
93
|
+
if (!query)
|
|
94
|
+
return 0;
|
|
95
|
+
return text.split(query).length - 1;
|
|
96
|
+
}
|
|
97
|
+
function snippetAround(body, query, radius = 80) {
|
|
98
|
+
if (!query)
|
|
99
|
+
return body.slice(0, 160).trim();
|
|
100
|
+
const index = body.toLowerCase().indexOf(query);
|
|
101
|
+
if (index < 0)
|
|
102
|
+
return body.slice(0, 160).trim();
|
|
103
|
+
const start = Math.max(0, index - radius);
|
|
104
|
+
const end = Math.min(body.length, index + query.length + radius);
|
|
105
|
+
return `${start > 0 ? '... ' : ''}${body.slice(start, end).replace(/\s+/g, ' ').trim()}${end < body.length ? ' ...' : ''}`;
|
|
106
|
+
}
|
|
107
|
+
//# s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