@turbomem/okf 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/dist/index.cjs ADDED
@@ -0,0 +1,269 @@
1
+ 'use strict';
2
+
3
+ var path = require('path');
4
+ var fs2 = require('fs/promises');
5
+ var matter = require('gray-matter');
6
+ var fg = require('fast-glob');
7
+ var unified = require('unified');
8
+ var remarkParse = require('remark-parse');
9
+ var unistUtilVisit = require('unist-util-visit');
10
+ var zod = require('zod');
11
+
12
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
+
14
+ var path__default = /*#__PURE__*/_interopDefault(path);
15
+ var fs2__default = /*#__PURE__*/_interopDefault(fs2);
16
+ var matter__default = /*#__PURE__*/_interopDefault(matter);
17
+ var fg__default = /*#__PURE__*/_interopDefault(fg);
18
+ var remarkParse__default = /*#__PURE__*/_interopDefault(remarkParse);
19
+
20
+ // src/parser.ts
21
+ function normalizeRelativePath(relativePath) {
22
+ return relativePath.split(path__default.default.sep).join("/");
23
+ }
24
+ function resolveLinkHref(href, documentPath, bundleRoot) {
25
+ const withoutFragment = href.split("#")[0] ?? href;
26
+ if (withoutFragment.startsWith("/")) {
27
+ return path__default.default.join(bundleRoot, withoutFragment.slice(1));
28
+ }
29
+ return path__default.default.resolve(path__default.default.dirname(documentPath), withoutFragment);
30
+ }
31
+ function extractLinks(body, documentPath, bundleRoot, followLinks) {
32
+ const links = [];
33
+ const tree = unified.unified().use(remarkParse__default.default).parse(body);
34
+ unistUtilVisit.visit(tree, "link", (node) => {
35
+ const linkNode = node;
36
+ const href = linkNode.url;
37
+ const text = linkNode.children?.[0]?.type === "text" ? linkNode.children[0].value ?? "" : "";
38
+ if (href.startsWith("http://") || href.startsWith("https://")) {
39
+ links.push({ text, href });
40
+ return;
41
+ }
42
+ const link = { text, href };
43
+ if (followLinks) {
44
+ const resolvedAbsolute = resolveLinkHref(href, documentPath, bundleRoot);
45
+ link.resolvedPath = normalizeRelativePath(path__default.default.relative(bundleRoot, resolvedAbsolute));
46
+ }
47
+ links.push(link);
48
+ });
49
+ return links;
50
+ }
51
+ function normalizeFrontmatter(data) {
52
+ const normalized = { ...data };
53
+ if (normalized.timestamp instanceof Date) {
54
+ normalized.timestamp = normalized.timestamp.toISOString();
55
+ }
56
+ return normalized;
57
+ }
58
+ async function parseDocument(filePath, bundleRoot, options = {}) {
59
+ const { followLinks = true } = options;
60
+ const raw = await fs2__default.default.readFile(filePath, "utf-8");
61
+ const { data, content } = matter__default.default(raw);
62
+ const relativePath = normalizeRelativePath(path__default.default.relative(bundleRoot, filePath));
63
+ const links = extractLinks(content, filePath, bundleRoot, followLinks);
64
+ return {
65
+ path: filePath,
66
+ relativePath,
67
+ frontmatter: normalizeFrontmatter(data),
68
+ body: content,
69
+ links
70
+ };
71
+ }
72
+ async function parseBundle(rootDir, options = {}) {
73
+ const absoluteRoot = path__default.default.resolve(rootDir);
74
+ const ignorePatterns = options.ignore ?? [];
75
+ const filePaths = await fg__default.default("**/*.md", {
76
+ cwd: absoluteRoot,
77
+ absolute: true,
78
+ ignore: ignorePatterns
79
+ });
80
+ const documents = await Promise.all(
81
+ filePaths.map((fp) => parseDocument(fp, absoluteRoot, options))
82
+ );
83
+ const index = /* @__PURE__ */ new Map();
84
+ for (const doc of documents) {
85
+ index.set(doc.relativePath, doc);
86
+ }
87
+ return { root: absoluteRoot, documents, index };
88
+ }
89
+ var frontmatterSchema = zod.z.object({
90
+ type: zod.z.string().min(1, "type field must be a non-empty string"),
91
+ title: zod.z.string().optional(),
92
+ description: zod.z.string().optional(),
93
+ resource: zod.z.string().url("resource must be a valid URL").optional(),
94
+ tags: zod.z.array(zod.z.string()).optional(),
95
+ timestamp: zod.z.string().datetime({ offset: true }).optional()
96
+ }).passthrough();
97
+ function validateDocument(doc) {
98
+ const errors = [];
99
+ const warnings = [];
100
+ const result = frontmatterSchema.safeParse(doc.frontmatter);
101
+ if (!result.success) {
102
+ for (const issue of result.error.issues) {
103
+ errors.push({
104
+ path: doc.relativePath,
105
+ message: issue.message,
106
+ rule: "frontmatter-schema"
107
+ });
108
+ }
109
+ }
110
+ if (!doc.body.trim()) {
111
+ warnings.push({
112
+ path: doc.relativePath,
113
+ message: "Document body is empty",
114
+ rule: "empty-body"
115
+ });
116
+ }
117
+ if (doc.frontmatter.timestamp) {
118
+ const d = Date.parse(doc.frontmatter.timestamp);
119
+ if (isNaN(d)) {
120
+ errors.push({
121
+ path: doc.relativePath,
122
+ message: `timestamp "${doc.frontmatter.timestamp}" is not a valid ISO 8601 date`,
123
+ rule: "timestamp-format"
124
+ });
125
+ }
126
+ }
127
+ return { errors, warnings };
128
+ }
129
+ function validateBundle(bundle) {
130
+ const allErrors = [];
131
+ const allWarnings = [];
132
+ for (const doc of bundle.documents) {
133
+ const { errors, warnings } = validateDocument(doc);
134
+ allErrors.push(...errors);
135
+ allWarnings.push(...warnings);
136
+ }
137
+ for (const doc of bundle.documents) {
138
+ for (const link of doc.links) {
139
+ if (link.resolvedPath && !bundle.index.has(link.resolvedPath)) {
140
+ allWarnings.push({
141
+ path: doc.relativePath,
142
+ message: `Cross-link "${link.href}" does not resolve to a known concept in this bundle`,
143
+ rule: "unresolved-cross-link"
144
+ });
145
+ }
146
+ }
147
+ }
148
+ return {
149
+ valid: allErrors.length === 0,
150
+ errors: allErrors,
151
+ warnings: allWarnings
152
+ };
153
+ }
154
+ function serializeDocument(frontmatter, body) {
155
+ return matter__default.default.stringify(body, frontmatter);
156
+ }
157
+ async function writeDocument(outputPath, frontmatter, body, options = {}) {
158
+ const { overwrite = false } = options;
159
+ let exists = false;
160
+ try {
161
+ await fs2__default.default.access(outputPath);
162
+ exists = true;
163
+ } catch {
164
+ exists = false;
165
+ }
166
+ if (exists && !overwrite) {
167
+ throw new Error(`File already exists: ${outputPath}. Pass overwrite: true to replace it.`);
168
+ }
169
+ await fs2__default.default.mkdir(path__default.default.dirname(outputPath), { recursive: true });
170
+ const content = serializeDocument(frontmatter, body);
171
+ await fs2__default.default.writeFile(outputPath, content, "utf-8");
172
+ }
173
+ async function writeIndex(dirPath, title, description, options = {}) {
174
+ const indexPath = path__default.default.join(dirPath, "index.md");
175
+ await writeDocument(
176
+ indexPath,
177
+ { type: "index", title, description },
178
+ `# ${title}
179
+
180
+ ${description}
181
+ `,
182
+ options
183
+ );
184
+ }
185
+
186
+ // src/graph.ts
187
+ function buildGraph(bundle) {
188
+ const nodes = /* @__PURE__ */ new Map();
189
+ const edges = [];
190
+ for (const doc of bundle.documents) {
191
+ nodes.set(doc.relativePath, {
192
+ document: doc,
193
+ outgoing: [],
194
+ incoming: []
195
+ });
196
+ }
197
+ for (const doc of bundle.documents) {
198
+ const fromNode = nodes.get(doc.relativePath);
199
+ for (const link of doc.links) {
200
+ if (!link.resolvedPath) continue;
201
+ const toNode = nodes.get(link.resolvedPath);
202
+ if (!toNode) continue;
203
+ const edge = {
204
+ from: doc,
205
+ to: toNode.document,
206
+ linkText: link.text
207
+ };
208
+ edges.push(edge);
209
+ fromNode.outgoing.push(edge);
210
+ toNode.incoming.push(edge);
211
+ }
212
+ }
213
+ return { nodes, edges };
214
+ }
215
+ function reachableFrom(graph, startRelativePath) {
216
+ const visited = /* @__PURE__ */ new Set();
217
+ const queue = [startRelativePath];
218
+ while (queue.length > 0) {
219
+ const current = queue.shift();
220
+ if (visited.has(current)) continue;
221
+ visited.add(current);
222
+ const node = graph.nodes.get(current);
223
+ if (!node) continue;
224
+ for (const edge of node.outgoing) {
225
+ queue.push(edge.to.relativePath);
226
+ }
227
+ }
228
+ return [...visited];
229
+ }
230
+
231
+ // src/turbomem.ts
232
+ function documentToFacts(doc) {
233
+ const facts = [];
234
+ const fm = doc.frontmatter;
235
+ const parts = [`[${fm.type}]`];
236
+ if (fm.title) parts.push(fm.title);
237
+ if (fm.description) parts.push("\u2014", fm.description);
238
+ if (fm.resource) parts.push(`(resource: ${fm.resource})`);
239
+ if (fm.tags?.length) parts.push(`tags: ${fm.tags.join(", ")}`);
240
+ facts.push(parts.join(" "));
241
+ const body = doc.body.trim();
242
+ if (body) {
243
+ facts.push(`${fm.title ?? doc.relativePath} details: ${body}`);
244
+ }
245
+ return facts;
246
+ }
247
+ function bundleToFacts(bundle) {
248
+ return bundle.documents.flatMap(documentToFacts);
249
+ }
250
+ async function addFromBundle(memory, bundle, scope = {}) {
251
+ const facts = bundleToFacts(bundle);
252
+ if (facts.length === 0) return [];
253
+ return memory.addFacts(facts, scope);
254
+ }
255
+
256
+ exports.addFromBundle = addFromBundle;
257
+ exports.buildGraph = buildGraph;
258
+ exports.bundleToFacts = bundleToFacts;
259
+ exports.documentToFacts = documentToFacts;
260
+ exports.parseBundle = parseBundle;
261
+ exports.parseDocument = parseDocument;
262
+ exports.reachableFrom = reachableFrom;
263
+ exports.serializeDocument = serializeDocument;
264
+ exports.validateBundle = validateBundle;
265
+ exports.validateDocument = validateDocument;
266
+ exports.writeDocument = writeDocument;
267
+ exports.writeIndex = writeIndex;
268
+ //# sourceMappingURL=index.cjs.map
269
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/parser.ts","../src/validator.ts","../src/writer.ts","../src/graph.ts","../src/turbomem.ts"],"names":["path","unified","remarkParse","visit","fs","matter","fg","z"],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,SAAS,sBAAsB,YAAA,EAA8B;AAC3D,EAAA,OAAO,aAAa,KAAA,CAAMA,qBAAA,CAAK,GAAG,CAAA,CAAE,KAAK,GAAG,CAAA;AAC9C;AAEA,SAAS,eAAA,CAAgB,IAAA,EAAc,YAAA,EAAsB,UAAA,EAA4B;AACvF,EAAA,MAAM,kBAAkB,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,IAAK,IAAA;AAC9C,EAAA,IAAI,eAAA,CAAgB,UAAA,CAAW,GAAG,CAAA,EAAG;AACnC,IAAA,OAAOA,sBAAK,IAAA,CAAK,UAAA,EAAY,eAAA,CAAgB,KAAA,CAAM,CA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import matter from \"gray-matter\";\nimport fg from \"fast-glob\";\nimport { unified } from \"unified\";\nimport remarkParse from \"remark-parse\";\nimport { visit } from \"unist-util-visit\";\nimport type { OKFBundle, OKFDocument, OKFLink, OKFFrontmatter, ParseOptions } from \"./types.js\";\n\nfunction normalizeRelativePath(relativePath: string): string {\n return relativePath.split(path.sep).join(\"/\");\n}\n\nfunction resolveLinkHref(href: string, documentPath: string, bundleRoot: string): string {\n const withoutFragment = href.split(\"#\")[0] ?? href;\n if (withoutFragment.startsWith(\"/\")) {\n return path.join(bundleRoot, withoutFragment.slice(1));\n }\n return path.resolve(path.dirname(documentPath), withoutFragment);\n}\n\nfunction extractLinks(\n body: string,\n documentPath: string,\n bundleRoot: string,\n followLinks: boolean,\n): OKFLink[] {\n const links: OKFLink[] = [];\n const tree = unified().use(remarkParse).parse(body);\n\n visit(tree, \"link\", (node) => {\n const linkNode = node as { url: string; children?: Array<{ type?: string; value?: string }> };\n const href = linkNode.url;\n const text = linkNode.children?.[0]?.type === \"text\" ? (linkNode.children[0].value ?? \"\") : \"\";\n\n if (href.startsWith(\"http://\") || href.startsWith(\"https://\")) {\n links.push({ text, href });\n return;\n }\n\n const link: OKFLink = { text, href };\n if (followLinks) {\n const resolvedAbsolute = resolveLinkHref(href, documentPath, bundleRoot);\n link.resolvedPath = normalizeRelativePath(path.relative(bundleRoot, resolvedAbsolute));\n }\n links.push(link);\n });\n\n return links;\n}\n\nfunction normalizeFrontmatter(data: Record<string, unknown>): OKFFrontmatter {\n const normalized = { ...data };\n if (normalized.timestamp instanceof Date) {\n normalized.timestamp = normalized.timestamp.toISOString();\n }\n return normalized as OKFFrontmatter;\n}\n\nexport async function parseDocument(filePath: string, bundleRoot: string, options: ParseOptions = {}): Promise<OKFDocument> {\n const { followLinks = true } = options;\n const raw = await fs.readFile(filePath, \"utf-8\");\n const { data, content } = matter(raw);\n\n const relativePath = normalizeRelativePath(path.relative(bundleRoot, filePath));\n const links = extractLinks(content, filePath, bundleRoot, followLinks);\n\n return {\n path: filePath,\n relativePath,\n frontmatter: normalizeFrontmatter(data as Record<string, unknown>),\n body: content,\n links,\n };\n}\n\nexport async function parseBundle(rootDir: string, options: ParseOptions = {}): Promise<OKFBundle> {\n const absoluteRoot = path.resolve(rootDir);\n const ignorePatterns = options.ignore ?? [];\n\n const filePaths = await fg(\"**/*.md\", {\n cwd: absoluteRoot,\n absolute: true,\n ignore: ignorePatterns,\n });\n\n const documents = await Promise.all(\n filePaths.map((fp) => parseDocument(fp, absoluteRoot, options)),\n );\n\n const index = new Map<string, OKFDocument>();\n for (const doc of documents) {\n index.set(doc.relativePath, doc);\n }\n\n return { root: absoluteRoot, documents, index };\n}\n","import { z } from \"zod\";\nimport type {\n OKFBundle,\n OKFDocument,\n OKFValidationResult,\n OKFValidationError,\n OKFValidationWarning,\n} from \"./types.js\";\n\nconst frontmatterSchema = z\n .object({\n type: z.string().min(1, \"type field must be a non-empty string\"),\n title: z.string().optional(),\n description: z.string().optional(),\n resource: z.string().url(\"resource must be a valid URL\").optional(),\n tags: z.array(z.string()).optional(),\n timestamp: z.string().datetime({ offset: true }).optional(),\n })\n .passthrough();\n\nexport function validateDocument(doc: OKFDocument): {\n errors: OKFValidationError[];\n warnings: OKFValidationWarning[];\n} {\n const errors: OKFValidationError[] = [];\n const warnings: OKFValidationWarning[] = [];\n\n const result = frontmatterSchema.safeParse(doc.frontmatter);\n if (!result.success) {\n for (const issue of result.error.issues) {\n errors.push({\n path: doc.relativePath,\n message: issue.message,\n rule: \"frontmatter-schema\",\n });\n }\n }\n\n if (!doc.body.trim()) {\n warnings.push({\n path: doc.relativePath,\n message: \"Document body is empty\",\n rule: \"empty-body\",\n });\n }\n\n if (doc.frontmatter.timestamp) {\n const d = Date.parse(doc.frontmatter.timestamp);\n if (isNaN(d)) {\n errors.push({\n path: doc.relativePath,\n message: `timestamp \"${doc.frontmatter.timestamp}\" is not a valid ISO 8601 date`,\n rule: \"timestamp-format\",\n });\n }\n }\n\n return { errors, warnings };\n}\n\nexport function validateBundle(bundle: OKFBundle): OKFValidationResult {\n const allErrors: OKFValidationError[] = [];\n const allWarnings: OKFValidationWarning[] = [];\n\n for (const doc of bundle.documents) {\n const { errors, warnings } = validateDocument(doc);\n allErrors.push(...errors);\n allWarnings.push(...warnings);\n }\n\n for (const doc of bundle.documents) {\n for (const link of doc.links) {\n if (link.resolvedPath && !bundle.index.has(link.resolvedPath)) {\n allWarnings.push({\n path: doc.relativePath,\n message: `Cross-link \"${link.href}\" does not resolve to a known concept in this bundle`,\n rule: \"unresolved-cross-link\",\n });\n }\n }\n }\n\n return {\n valid: allErrors.length === 0,\n errors: allErrors,\n warnings: allWarnings,\n };\n}\n","import path from \"node:path\";\nimport fs from \"node:fs/promises\";\nimport matter from \"gray-matter\";\nimport type { OKFFrontmatter, WriteOptions } from \"./types.js\";\n\nexport function serializeDocument(frontmatter: OKFFrontmatter, body: string): string {\n return matter.stringify(body, frontmatter as Record<string, unknown>);\n}\n\nexport async function writeDocument(\n outputPath: string,\n frontmatter: OKFFrontmatter,\n body: string,\n options: WriteOptions = {},\n): Promise<void> {\n const { overwrite = false } = options;\n\n let exists = false;\n try {\n await fs.access(outputPath);\n exists = true;\n } catch {\n exists = false;\n }\n\n if (exists && !overwrite) {\n throw new Error(`File already exists: ${outputPath}. Pass overwrite: true to replace it.`);\n }\n\n await fs.mkdir(path.dirname(outputPath), { recursive: true });\n const content = serializeDocument(frontmatter, body);\n await fs.writeFile(outputPath, content, \"utf-8\");\n}\n\nexport async function writeIndex(\n dirPath: string,\n title: string,\n description: string,\n options: WriteOptions = {},\n): Promise<void> {\n const indexPath = path.join(dirPath, \"index.md\");\n await writeDocument(\n indexPath,\n { type: \"index\", title, description },\n `# ${title}\\n\\n${description}\\n`,\n options,\n );\n}\n","import type { OKFBundle, OKFGraph, OKFNode, OKFEdge } from \"./types.js\";\n\nexport function buildGraph(bundle: OKFBundle): OKFGraph {\n const nodes = new Map<string, OKFNode>();\n const edges: OKFEdge[] = [];\n\n for (const doc of bundle.documents) {\n nodes.set(doc.relativePath, {\n document: doc,\n outgoing: [],\n incoming: [],\n });\n }\n\n for (const doc of bundle.documents) {\n const fromNode = nodes.get(doc.relativePath)!;\n\n for (const link of doc.links) {\n if (!link.resolvedPath) continue;\n const toNode = nodes.get(link.resolvedPath);\n if (!toNode) continue;\n\n const edge: OKFEdge = {\n from: doc,\n to: toNode.document,\n linkText: link.text,\n };\n\n edges.push(edge);\n fromNode.outgoing.push(edge);\n toNode.incoming.push(edge);\n }\n }\n\n return { nodes, edges };\n}\n\nexport function reachableFrom(graph: OKFGraph, startRelativePath: string): string[] {\n const visited = new Set<string>();\n const queue = [startRelativePath];\n\n while (queue.length > 0) {\n const current = queue.shift()!;\n if (visited.has(current)) continue;\n visited.add(current);\n\n const node = graph.nodes.get(current);\n if (!node) continue;\n\n for (const edge of node.outgoing) {\n queue.push(edge.to.relativePath);\n }\n }\n\n return [...visited];\n}\n","import type { OKFBundle, OKFDocument } from \"./types.js\";\n\nexport interface OKFMemoryScope {\n userId?: string;\n agentId?: string;\n sessionId?: string;\n}\n\nexport interface OKFMemory {\n addFacts: (facts: string[], scope: OKFMemoryScope) => Promise<unknown[]>;\n}\n\nexport function documentToFacts(doc: OKFDocument): string[] {\n const facts: string[] = [];\n const fm = doc.frontmatter;\n\n const parts: string[] = [`[${fm.type}]`];\n if (fm.title) parts.push(fm.title);\n if (fm.description) parts.push(\"—\", fm.description);\n if (fm.resource) parts.push(`(resource: ${fm.resource})`);\n if (fm.tags?.length) parts.push(`tags: ${fm.tags.join(\", \")}`);\n\n facts.push(parts.join(\" \"));\n\n const body = doc.body.trim();\n if (body) {\n facts.push(`${fm.title ?? doc.relativePath} details: ${body}`);\n }\n\n return facts;\n}\n\nexport function bundleToFacts(bundle: OKFBundle): string[] {\n return bundle.documents.flatMap(documentToFacts);\n}\n\nexport async function addFromBundle(\n memory: OKFMemory,\n bundle: OKFBundle,\n scope: OKFMemoryScope = {},\n): Promise<unknown[]> {\n const facts = bundleToFacts(bundle);\n if (facts.length === 0) return [];\n return memory.addFacts(facts, scope);\n}\n"]}
@@ -0,0 +1,92 @@
1
+ interface OKFFrontmatter {
2
+ type: string;
3
+ title?: string;
4
+ description?: string;
5
+ resource?: string;
6
+ tags?: string[];
7
+ timestamp?: string;
8
+ [key: string]: unknown;
9
+ }
10
+ interface OKFDocument {
11
+ path: string;
12
+ relativePath: string;
13
+ frontmatter: OKFFrontmatter;
14
+ body: string;
15
+ links: OKFLink[];
16
+ }
17
+ interface OKFLink {
18
+ text: string;
19
+ href: string;
20
+ resolvedPath?: string;
21
+ }
22
+ interface OKFBundle {
23
+ root: string;
24
+ documents: OKFDocument[];
25
+ index: Map<string, OKFDocument>;
26
+ }
27
+ interface OKFNode {
28
+ document: OKFDocument;
29
+ outgoing: OKFEdge[];
30
+ incoming: OKFEdge[];
31
+ }
32
+ interface OKFEdge {
33
+ from: OKFDocument;
34
+ to: OKFDocument;
35
+ linkText: string;
36
+ }
37
+ interface OKFGraph {
38
+ nodes: Map<string, OKFNode>;
39
+ edges: OKFEdge[];
40
+ }
41
+ interface OKFValidationResult {
42
+ valid: boolean;
43
+ errors: OKFValidationError[];
44
+ warnings: OKFValidationWarning[];
45
+ }
46
+ interface OKFValidationError {
47
+ path: string;
48
+ message: string;
49
+ rule: string;
50
+ }
51
+ interface OKFValidationWarning {
52
+ path: string;
53
+ message: string;
54
+ rule: string;
55
+ }
56
+ interface ParseOptions {
57
+ ignore?: string[];
58
+ followLinks?: boolean;
59
+ }
60
+ interface WriteOptions {
61
+ overwrite?: boolean;
62
+ }
63
+
64
+ declare function parseDocument(filePath: string, bundleRoot: string, options?: ParseOptions): Promise<OKFDocument>;
65
+ declare function parseBundle(rootDir: string, options?: ParseOptions): Promise<OKFBundle>;
66
+
67
+ declare function validateDocument(doc: OKFDocument): {
68
+ errors: OKFValidationError[];
69
+ warnings: OKFValidationWarning[];
70
+ };
71
+ declare function validateBundle(bundle: OKFBundle): OKFValidationResult;
72
+
73
+ declare function serializeDocument(frontmatter: OKFFrontmatter, body: string): string;
74
+ declare function writeDocument(outputPath: string, frontmatter: OKFFrontmatter, body: string, options?: WriteOptions): Promise<void>;
75
+ declare function writeIndex(dirPath: string, title: string, description: string, options?: WriteOptions): Promise<void>;
76
+
77
+ declare function buildGraph(bundle: OKFBundle): OKFGraph;
78
+ declare function reachableFrom(graph: OKFGraph, startRelativePath: string): string[];
79
+
80
+ interface OKFMemoryScope {
81
+ userId?: string;
82
+ agentId?: string;
83
+ sessionId?: string;
84
+ }
85
+ interface OKFMemory {
86
+ addFacts: (facts: string[], scope: OKFMemoryScope) => Promise<unknown[]>;
87
+ }
88
+ declare function documentToFacts(doc: OKFDocument): string[];
89
+ declare function bundleToFacts(bundle: OKFBundle): string[];
90
+ declare function addFromBundle(memory: OKFMemory, bundle: OKFBundle, scope?: OKFMemoryScope): Promise<unknown[]>;
91
+
92
+ export { type OKFBundle, type OKFDocument, type OKFEdge, type OKFFrontmatter, type OKFGraph, type OKFLink, type OKFMemory, type OKFMemoryScope, type OKFNode, type OKFValidationError, type OKFValidationResult, type OKFValidationWarning, type ParseOptions, type WriteOptions, addFromBundle, buildGraph, bundleToFacts, documentToFacts, parseBundle, parseDocument, reachableFrom, serializeDocument, validateBundle, validateDocument, writeDocument, writeIndex };
@@ -0,0 +1,92 @@
1
+ interface OKFFrontmatter {
2
+ type: string;
3
+ title?: string;
4
+ description?: string;
5
+ resource?: string;
6
+ tags?: string[];
7
+ timestamp?: string;
8
+ [key: string]: unknown;
9
+ }
10
+ interface OKFDocument {
11
+ path: string;
12
+ relativePath: string;
13
+ frontmatter: OKFFrontmatter;
14
+ body: string;
15
+ links: OKFLink[];
16
+ }
17
+ interface OKFLink {
18
+ text: string;
19
+ href: string;
20
+ resolvedPath?: string;
21
+ }
22
+ interface OKFBundle {
23
+ root: string;
24
+ documents: OKFDocument[];
25
+ index: Map<string, OKFDocument>;
26
+ }
27
+ interface OKFNode {
28
+ document: OKFDocument;
29
+ outgoing: OKFEdge[];
30
+ incoming: OKFEdge[];
31
+ }
32
+ interface OKFEdge {
33
+ from: OKFDocument;
34
+ to: OKFDocument;
35
+ linkText: string;
36
+ }
37
+ interface OKFGraph {
38
+ nodes: Map<string, OKFNode>;
39
+ edges: OKFEdge[];
40
+ }
41
+ interface OKFValidationResult {
42
+ valid: boolean;
43
+ errors: OKFValidationError[];
44
+ warnings: OKFValidationWarning[];
45
+ }
46
+ interface OKFValidationError {
47
+ path: string;
48
+ message: string;
49
+ rule: string;
50
+ }
51
+ interface OKFValidationWarning {
52
+ path: string;
53
+ message: string;
54
+ rule: string;
55
+ }
56
+ interface ParseOptions {
57
+ ignore?: string[];
58
+ followLinks?: boolean;
59
+ }
60
+ interface WriteOptions {
61
+ overwrite?: boolean;
62
+ }
63
+
64
+ declare function parseDocument(filePath: string, bundleRoot: string, options?: ParseOptions): Promise<OKFDocument>;
65
+ declare function parseBundle(rootDir: string, options?: ParseOptions): Promise<OKFBundle>;
66
+
67
+ declare function validateDocument(doc: OKFDocument): {
68
+ errors: OKFValidationError[];
69
+ warnings: OKFValidationWarning[];
70
+ };
71
+ declare function validateBundle(bundle: OKFBundle): OKFValidationResult;
72
+
73
+ declare function serializeDocument(frontmatter: OKFFrontmatter, body: string): string;
74
+ declare function writeDocument(outputPath: string, frontmatter: OKFFrontmatter, body: string, options?: WriteOptions): Promise<void>;
75
+ declare function writeIndex(dirPath: string, title: string, description: string, options?: WriteOptions): Promise<void>;
76
+
77
+ declare function buildGraph(bundle: OKFBundle): OKFGraph;
78
+ declare function reachableFrom(graph: OKFGraph, startRelativePath: string): string[];
79
+
80
+ interface OKFMemoryScope {
81
+ userId?: string;
82
+ agentId?: string;
83
+ sessionId?: string;
84
+ }
85
+ interface OKFMemory {
86
+ addFacts: (facts: string[], scope: OKFMemoryScope) => Promise<unknown[]>;
87
+ }
88
+ declare function documentToFacts(doc: OKFDocument): string[];
89
+ declare function bundleToFacts(bundle: OKFBundle): string[];
90
+ declare function addFromBundle(memory: OKFMemory, bundle: OKFBundle, scope?: OKFMemoryScope): Promise<unknown[]>;
91
+
92
+ export { type OKFBundle, type OKFDocument, type OKFEdge, type OKFFrontmatter, type OKFGraph, type OKFLink, type OKFMemory, type OKFMemoryScope, type OKFNode, type OKFValidationError, type OKFValidationResult, type OKFValidationWarning, type ParseOptions, type WriteOptions, addFromBundle, buildGraph, bundleToFacts, documentToFacts, parseBundle, parseDocument, reachableFrom, serializeDocument, validateBundle, validateDocument, writeDocument, writeIndex };