@agentskit/doc-bridge 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,361 @@
1
+ // src/config/defaults.ts
2
+ var DEFAULT_AGENT_EXCLUDE = ["**/node_modules/**", "**/.git/**"];
3
+ var applyConfigDefaults = (config) => {
4
+ const agentRoot = config.corpus.agent.root;
5
+ const agentIndex = config.corpus.agent.index ?? `${agentRoot}/INDEX.md`;
6
+ return {
7
+ ...config,
8
+ corpus: {
9
+ ...config.corpus,
10
+ agent: {
11
+ ...config.corpus.agent,
12
+ index: agentIndex,
13
+ include: config.corpus.agent.include ?? ["**/*.md"],
14
+ exclude: config.corpus.agent.exclude ?? [...DEFAULT_AGENT_EXCLUDE]
15
+ }
16
+ },
17
+ index: {
18
+ outFile: ".doc-bridge/index.json",
19
+ contentHash: "sha256-normalized-v1",
20
+ llmsTxt: {
21
+ enabled: true,
22
+ outFile: "llms.txt",
23
+ ...config.index?.llmsTxt
24
+ },
25
+ capabilities: {
26
+ enabled: true,
27
+ outFile: ".doc-bridge/capabilities.json",
28
+ ...config.index?.capabilities
29
+ },
30
+ ...config.index
31
+ },
32
+ gates: {
33
+ preset: "minimal",
34
+ ...config.gates
35
+ },
36
+ surfaces: {
37
+ cli: {
38
+ bin: "ak-docs",
39
+ defaultFormat: "json",
40
+ ...config.surfaces?.cli
41
+ },
42
+ mcp: {
43
+ enabled: true,
44
+ tools: ["handoff.resolve", "doc.search", "doc.get", "gate.status"],
45
+ transport: "stdio",
46
+ ...config.surfaces?.mcp
47
+ },
48
+ ...config.surfaces
49
+ },
50
+ intelligence: config.intelligence ? {
51
+ enabled: false,
52
+ ...config.intelligence,
53
+ chat: config.intelligence.chat ? { handoffFirst: true, ...config.intelligence.chat } : void 0
54
+ } : { enabled: false }
55
+ };
56
+ };
57
+
58
+ // src/config/schema.ts
59
+ import { z } from "zod";
60
+ var CONFIG_SCHEMA_VERSION = 1;
61
+ var HumanCorpusPluginIdSchema = z.enum([
62
+ "plain-markdown",
63
+ "fumadocs",
64
+ "docusaurus",
65
+ "mkdocs",
66
+ "vitepress",
67
+ "custom"
68
+ ]);
69
+ var AgentCorpusConfigSchema = z.object({
70
+ root: z.string().min(1).max(512),
71
+ index: z.string().min(1).max(512).optional(),
72
+ include: z.array(z.string().min(1).max(256)).max(64).optional(),
73
+ exclude: z.array(z.string().min(1).max(256)).max(64).optional(),
74
+ okf: z.object({
75
+ requireType: z.boolean().optional(),
76
+ allowedTypes: z.array(z.string().min(1).max(128)).max(64).optional()
77
+ }).strict().optional()
78
+ }).strict();
79
+ var HumanCorpusConfigSchema = z.object({
80
+ plugin: HumanCorpusPluginIdSchema,
81
+ options: z.record(z.string(), z.unknown()).optional()
82
+ }).strict();
83
+ var IndexConfigSchema = z.object({
84
+ outFile: z.string().min(1).max(512).optional(),
85
+ llmsTxt: z.object({
86
+ enabled: z.boolean().optional(),
87
+ outFile: z.string().min(1).max(512).optional(),
88
+ preamble: z.string().max(4e3).optional()
89
+ }).strict().optional(),
90
+ capabilities: z.object({
91
+ enabled: z.boolean().optional(),
92
+ outFile: z.string().min(1).max(512).optional()
93
+ }).strict().optional(),
94
+ contentHash: z.literal("sha256-normalized-v1").optional()
95
+ }).strict();
96
+ var OwnershipEntrySchema = z.object({
97
+ path: z.string().min(1).max(512),
98
+ group: z.string().min(1).max(128).optional(),
99
+ layer: z.string().min(1).max(32).optional(),
100
+ purpose: z.string().max(1024).optional(),
101
+ checks: z.array(z.string().min(1).max(256)).max(32).optional(),
102
+ agentDoc: z.string().min(1).max(512).optional(),
103
+ humanDoc: z.string().min(1).max(512).optional()
104
+ }).strict();
105
+ var RoutingConfigSchema = z.object({
106
+ plugin: z.enum(["pnpm-monorepo", "npm-workspaces", "yarn-workspaces", "custom"]).optional(),
107
+ options: z.object({
108
+ packages: z.array(z.string().min(1).max(256)).max(128).optional(),
109
+ ownership: z.record(z.string().min(1).max(256), OwnershipEntrySchema).optional(),
110
+ intents: z.array(
111
+ z.object({
112
+ id: z.string().min(1).max(128),
113
+ title: z.string().min(1).max(256),
114
+ paths: z.array(z.string().min(1).max(512)).max(32)
115
+ }).strict()
116
+ ).max(128).optional(),
117
+ changes: z.array(
118
+ z.object({
119
+ id: z.string().min(1).max(128),
120
+ title: z.string().min(1).max(256),
121
+ startHere: z.string().min(1).max(512),
122
+ relatedPackages: z.array(z.string().min(1).max(256)).max(32).optional()
123
+ }).strict()
124
+ ).max(128).optional()
125
+ }).strict().optional()
126
+ }).strict();
127
+ var GatesConfigSchema = z.object({
128
+ preset: z.enum(["minimal", "standard", "strict"]).optional(),
129
+ include: z.array(
130
+ z.enum([
131
+ "index-freshness",
132
+ "human-guide-links",
133
+ "link-rot",
134
+ "okf-type",
135
+ "docs-style",
136
+ "routing-currency",
137
+ "bootstrap-size"
138
+ ])
139
+ ).max(16).optional(),
140
+ exclude: z.array(
141
+ z.enum([
142
+ "index-freshness",
143
+ "human-guide-links",
144
+ "link-rot",
145
+ "okf-type",
146
+ "docs-style",
147
+ "routing-currency",
148
+ "bootstrap-size"
149
+ ])
150
+ ).max(16).optional(),
151
+ options: z.record(z.string(), z.unknown()).optional()
152
+ }).strict();
153
+ var SurfacesConfigSchema = z.object({
154
+ cli: z.object({
155
+ bin: z.string().min(1).max(64).optional(),
156
+ defaultFormat: z.enum(["json", "text"]).optional()
157
+ }).strict().optional(),
158
+ mcp: z.object({
159
+ enabled: z.boolean().optional(),
160
+ tools: z.array(
161
+ z.enum([
162
+ "handoff.resolve",
163
+ "doc.search",
164
+ "doc.get",
165
+ "gate.status",
166
+ "playbook.pattern.get",
167
+ "retriever.query",
168
+ "memory.classify",
169
+ "memory.promoteDraft",
170
+ "registry.topology"
171
+ ])
172
+ ).max(16).optional(),
173
+ transport: z.enum(["stdio", "http"]).optional(),
174
+ http: z.object({
175
+ port: z.number().int().min(1).max(65535).optional(),
176
+ path: z.string().min(1).max(256).optional()
177
+ }).strict().optional()
178
+ }).strict().optional()
179
+ }).strict();
180
+ var IntelligenceConfigSchema = z.object({
181
+ enabled: z.boolean().optional(),
182
+ adapter: z.object({
183
+ provider: z.enum(["openai", "anthropic", "ollama", "openrouter", "custom"]),
184
+ model: z.string().min(1).max(128).optional(),
185
+ apiKeyEnv: z.string().min(0).max(128).optional(),
186
+ baseUrl: z.string().url().optional(),
187
+ options: z.record(z.string(), z.unknown()).optional()
188
+ }).strict().optional(),
189
+ chat: z.object({
190
+ enabled: z.boolean().optional(),
191
+ sources: z.array(z.enum(["agent", "human", "federation"])).max(8).optional(),
192
+ handoffFirst: z.boolean().optional()
193
+ }).strict().optional(),
194
+ retriever: z.object({
195
+ enabled: z.boolean().optional(),
196
+ mode: z.enum(["local", "remote", "bm25", "agentskit-rag"]).optional(),
197
+ embedModel: z.string().min(1).max(128).optional(),
198
+ chunkSize: z.number().int().min(128).max(16384).optional(),
199
+ options: z.record(z.string(), z.unknown()).optional()
200
+ }).strict().optional(),
201
+ memory: z.object({
202
+ enabled: z.boolean().optional(),
203
+ adapters: z.array(z.enum(["playbook-memory", "cursor-rules", "session-export", "bootstrap-delta"])).max(8).optional(),
204
+ ingestDir: z.string().min(1).max(512).optional(),
205
+ classify: z.boolean().optional(),
206
+ promote: z.object({
207
+ enabled: z.boolean().optional(),
208
+ targets: z.array(z.enum(["agent", "human", "agents-md"])).max(8).optional(),
209
+ requireApproval: z.boolean().optional()
210
+ }).strict().optional()
211
+ }).strict().optional(),
212
+ runtime: z.enum(["agentskit", "custom"]).optional(),
213
+ runtimeModule: z.string().min(1).max(512).optional()
214
+ }).strict();
215
+ var FederationConfigSchema = z.object({
216
+ enabled: z.boolean().optional(),
217
+ sources: z.array(
218
+ z.object({
219
+ id: z.string().min(1).max(64),
220
+ llmsTxt: z.string().min(1).max(512).optional(),
221
+ rawBaseUrl: z.string().url().optional(),
222
+ includeInRetriever: z.boolean().optional(),
223
+ includeInChat: z.boolean().optional()
224
+ }).strict()
225
+ ).max(16).optional()
226
+ }).strict();
227
+ var DocBridgeConfigV1Schema = z.object({
228
+ schemaVersion: z.literal(CONFIG_SCHEMA_VERSION),
229
+ project: z.object({
230
+ name: z.string().min(1).max(128).optional(),
231
+ root: z.string().min(1).max(512).optional()
232
+ }).strict().optional(),
233
+ corpus: z.object({
234
+ agent: AgentCorpusConfigSchema,
235
+ human: z.union([HumanCorpusConfigSchema, z.array(HumanCorpusConfigSchema).max(8)]).optional()
236
+ }).strict(),
237
+ index: IndexConfigSchema.optional(),
238
+ routing: RoutingConfigSchema.optional(),
239
+ gates: GatesConfigSchema.optional(),
240
+ surfaces: SurfacesConfigSchema.optional(),
241
+ intelligence: IntelligenceConfigSchema.optional(),
242
+ federation: FederationConfigSchema.optional()
243
+ }).strict();
244
+
245
+ // src/config/define-config.ts
246
+ var defineConfig = (config) => applyConfigDefaults(DocBridgeConfigV1Schema.parse(config));
247
+
248
+ // src/config/load-config.ts
249
+ import { existsSync, readFileSync } from "fs";
250
+ import { basename, dirname, join, resolve } from "path";
251
+ import vm from "vm";
252
+ var CONFIG_CANDIDATES = [
253
+ "doc-bridge.config.ts",
254
+ "doc-bridge.config.mts",
255
+ "doc-bridge.config.js",
256
+ "doc-bridge.config.mjs",
257
+ "doc-bridge.config.json",
258
+ "doc-bridge.config.yaml",
259
+ "doc-bridge.config.yml",
260
+ "package.json"
261
+ ];
262
+ var ConfigNotFoundError = class extends Error {
263
+ constructor(cwd) {
264
+ super(
265
+ `No doc-bridge config found in ${cwd}. Run: ak-docs init \u2014 or pass --config <path>.`
266
+ );
267
+ this.cwd = cwd;
268
+ this.name = "ConfigNotFoundError";
269
+ }
270
+ cwd;
271
+ };
272
+ var findConfigPath = (cwd, explicitPath) => {
273
+ if (explicitPath) {
274
+ const abs = resolve(cwd, explicitPath);
275
+ return existsSync(abs) ? abs : null;
276
+ }
277
+ for (const name of CONFIG_CANDIDATES) {
278
+ const candidate = join(cwd, name);
279
+ if (!existsSync(candidate)) continue;
280
+ if (name !== "package.json") return candidate;
281
+ const pkg = parseJsonConfig(readFileSync(candidate, "utf8"), candidate);
282
+ if (pkg.docBridge) return candidate;
283
+ }
284
+ return null;
285
+ };
286
+ var parseJsonConfig = (raw, path) => {
287
+ try {
288
+ return JSON.parse(raw);
289
+ } catch (error) {
290
+ const message = error instanceof Error ? error.message : String(error);
291
+ throw new Error(`Failed to parse JSON config at ${path}: ${message}`);
292
+ }
293
+ };
294
+ var parseCodeConfig = (raw, path) => {
295
+ const code = raw.replace(/import\s+type\s+[\s\S]*?;?\n/g, "").replace(/import\s+\{\s*defineConfig\s*\}\s+from\s+['"]@agentskit\/doc-bridge(?:\/config)?['"];?\n?/g, "").replace(/\s+satisfies\s+[A-Za-z0-9_.$<>{}\[\],\s]+(?=\s*(?:;|\)|$))/g, "").replace(/export\s+default/, "module.exports.default =");
296
+ if (/\bimport\b/.test(code)) {
297
+ throw new Error(`Unsupported import in ${path}. Static config only supports defineConfig imports.`);
298
+ }
299
+ const sandbox = {
300
+ module: { exports: {} },
301
+ exports: {},
302
+ defineConfig: (config) => config
303
+ };
304
+ try {
305
+ vm.runInNewContext(code, sandbox, { timeout: 250, filename: path });
306
+ } catch (error) {
307
+ const message = error instanceof Error ? error.message : String(error);
308
+ throw new Error(`Failed to load config at ${path}: ${message}`);
309
+ }
310
+ return sandbox.module.exports.default;
311
+ };
312
+ var parseConfig = (input) => {
313
+ const result = DocBridgeConfigV1Schema.safeParse(input);
314
+ if (result.success) return result.data;
315
+ throw new Error(
316
+ `Invalid doc-bridge config:
317
+ ${result.error.issues.map(
318
+ (issue) => ` - ${issue.path.join(".") || "(root)"}: ${issue.message}`
319
+ ).join("\n")}`
320
+ );
321
+ };
322
+ var loadConfig = (opts = {}) => {
323
+ const cwd = resolve(opts.cwd ?? process.cwd());
324
+ const path = findConfigPath(cwd, opts.explicitPath);
325
+ if (!path) throw new ConfigNotFoundError(cwd);
326
+ const raw = readFileSync(path, "utf8");
327
+ const ext = path.split(".").pop()?.toLowerCase();
328
+ if (ext === "yaml" || ext === "yml") {
329
+ throw new Error(`YAML config is not supported yet (${path}). Use doc-bridge.config.json for now.`);
330
+ }
331
+ const parsed = basename(path) === "package.json" ? parseJsonConfig(raw, path).docBridge : ext === "ts" || ext === "mts" || ext === "js" || ext === "mjs" ? parseCodeConfig(raw, path) : parseJsonConfig(raw, path);
332
+ const config = applyConfigDefaults(parseConfig(parsed));
333
+ return { config, path };
334
+ };
335
+ var resolveProjectRoot = (start = process.cwd()) => {
336
+ let cur = resolve(start);
337
+ for (let i = 0; i < 12; i += 1) {
338
+ if (findConfigPath(cur)) return cur;
339
+ const parent = dirname(cur);
340
+ if (parent === cur) break;
341
+ cur = parent;
342
+ }
343
+ return resolve(start);
344
+ };
345
+ var projectRootFromConfigPath = (configFilePath, projectRootField) => {
346
+ const configDir = dirname(resolve(configFilePath));
347
+ if (projectRootField) return resolve(configDir, projectRootField);
348
+ return configDir;
349
+ };
350
+ export {
351
+ AgentCorpusConfigSchema,
352
+ ConfigNotFoundError,
353
+ DocBridgeConfigV1Schema,
354
+ HumanCorpusConfigSchema,
355
+ applyConfigDefaults,
356
+ defineConfig,
357
+ loadConfig,
358
+ projectRootFromConfigPath,
359
+ resolveProjectRoot
360
+ };
361
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/config/defaults.ts","../../src/config/schema.ts","../../src/config/define-config.ts","../../src/config/load-config.ts"],"sourcesContent":["import type { DocBridgeConfigV1 } from './schema.js'\n\nconst DEFAULT_AGENT_EXCLUDE = ['**/node_modules/**', '**/.git/**'] as const\n\nexport const applyConfigDefaults = (config: DocBridgeConfigV1): DocBridgeConfigV1 => {\n const agentRoot = config.corpus.agent.root\n const agentIndex = config.corpus.agent.index ?? `${agentRoot}/INDEX.md`\n\n return {\n ...config,\n corpus: {\n ...config.corpus,\n agent: {\n ...config.corpus.agent,\n index: agentIndex,\n include: config.corpus.agent.include ?? ['**/*.md'],\n exclude: config.corpus.agent.exclude ?? [...DEFAULT_AGENT_EXCLUDE],\n },\n },\n index: {\n outFile: '.doc-bridge/index.json',\n contentHash: 'sha256-normalized-v1',\n llmsTxt: {\n enabled: true,\n outFile: 'llms.txt',\n ...config.index?.llmsTxt,\n },\n capabilities: {\n enabled: true,\n outFile: '.doc-bridge/capabilities.json',\n ...config.index?.capabilities,\n },\n ...config.index,\n },\n gates: {\n preset: 'minimal',\n ...config.gates,\n },\n surfaces: {\n cli: {\n bin: 'ak-docs',\n defaultFormat: 'json',\n ...config.surfaces?.cli,\n },\n mcp: {\n enabled: true,\n tools: ['handoff.resolve', 'doc.search', 'doc.get', 'gate.status'],\n transport: 'stdio',\n ...config.surfaces?.mcp,\n },\n ...config.surfaces,\n },\n intelligence: config.intelligence\n ? {\n enabled: false,\n ...config.intelligence,\n chat: config.intelligence.chat\n ? { handoffFirst: true, ...config.intelligence.chat }\n : undefined,\n }\n : { enabled: false },\n }\n}\n","import { z } from 'zod'\n\nexport const CONFIG_SCHEMA_VERSION = 1 as const\n\nexport const HumanCorpusPluginIdSchema = z.enum([\n 'plain-markdown',\n 'fumadocs',\n 'docusaurus',\n 'mkdocs',\n 'vitepress',\n 'custom',\n])\n\nexport const AgentCorpusConfigSchema = z\n .object({\n root: z.string().min(1).max(512),\n index: z.string().min(1).max(512).optional(),\n include: z.array(z.string().min(1).max(256)).max(64).optional(),\n exclude: z.array(z.string().min(1).max(256)).max(64).optional(),\n okf: z\n .object({\n requireType: z.boolean().optional(),\n allowedTypes: z.array(z.string().min(1).max(128)).max(64).optional(),\n })\n .strict()\n .optional(),\n })\n .strict()\n\nexport const HumanCorpusConfigSchema = z\n .object({\n plugin: HumanCorpusPluginIdSchema,\n options: z.record(z.string(), z.unknown()).optional(),\n })\n .strict()\n\nexport const IndexConfigSchema = z\n .object({\n outFile: z.string().min(1).max(512).optional(),\n llmsTxt: z\n .object({\n enabled: z.boolean().optional(),\n outFile: z.string().min(1).max(512).optional(),\n preamble: z.string().max(4_000).optional(),\n })\n .strict()\n .optional(),\n capabilities: z\n .object({\n enabled: z.boolean().optional(),\n outFile: z.string().min(1).max(512).optional(),\n })\n .strict()\n .optional(),\n contentHash: z.literal('sha256-normalized-v1').optional(),\n })\n .strict()\n\nexport const OwnershipEntrySchema = z\n .object({\n path: z.string().min(1).max(512),\n group: z.string().min(1).max(128).optional(),\n layer: z.string().min(1).max(32).optional(),\n purpose: z.string().max(1024).optional(),\n checks: z.array(z.string().min(1).max(256)).max(32).optional(),\n agentDoc: z.string().min(1).max(512).optional(),\n humanDoc: z.string().min(1).max(512).optional(),\n })\n .strict()\n\nexport const RoutingConfigSchema = z\n .object({\n plugin: z.enum(['pnpm-monorepo', 'npm-workspaces', 'yarn-workspaces', 'custom']).optional(),\n options: z\n .object({\n packages: z.array(z.string().min(1).max(256)).max(128).optional(),\n ownership: z.record(z.string().min(1).max(256), OwnershipEntrySchema).optional(),\n intents: z\n .array(\n z\n .object({\n id: z.string().min(1).max(128),\n title: z.string().min(1).max(256),\n paths: z.array(z.string().min(1).max(512)).max(32),\n })\n .strict(),\n )\n .max(128)\n .optional(),\n changes: z\n .array(\n z\n .object({\n id: z.string().min(1).max(128),\n title: z.string().min(1).max(256),\n startHere: z.string().min(1).max(512),\n relatedPackages: z.array(z.string().min(1).max(256)).max(32).optional(),\n })\n .strict(),\n )\n .max(128)\n .optional(),\n })\n .strict()\n .optional(),\n })\n .strict()\n\nexport const GatesConfigSchema = z\n .object({\n preset: z.enum(['minimal', 'standard', 'strict']).optional(),\n include: z\n .array(\n z.enum([\n 'index-freshness',\n 'human-guide-links',\n 'link-rot',\n 'okf-type',\n 'docs-style',\n 'routing-currency',\n 'bootstrap-size',\n ]),\n )\n .max(16)\n .optional(),\n exclude: z\n .array(\n z.enum([\n 'index-freshness',\n 'human-guide-links',\n 'link-rot',\n 'okf-type',\n 'docs-style',\n 'routing-currency',\n 'bootstrap-size',\n ]),\n )\n .max(16)\n .optional(),\n options: z.record(z.string(), z.unknown()).optional(),\n })\n .strict()\n\nexport const SurfacesConfigSchema = z\n .object({\n cli: z\n .object({\n bin: z.string().min(1).max(64).optional(),\n defaultFormat: z.enum(['json', 'text']).optional(),\n })\n .strict()\n .optional(),\n mcp: z\n .object({\n enabled: z.boolean().optional(),\n tools: z\n .array(\n z.enum([\n 'handoff.resolve',\n 'doc.search',\n 'doc.get',\n 'gate.status',\n 'playbook.pattern.get',\n 'retriever.query',\n 'memory.classify',\n 'memory.promoteDraft',\n 'registry.topology',\n ]),\n )\n .max(16)\n .optional(),\n transport: z.enum(['stdio', 'http']).optional(),\n http: z\n .object({\n port: z.number().int().min(1).max(65_535).optional(),\n path: z.string().min(1).max(256).optional(),\n })\n .strict()\n .optional(),\n })\n .strict()\n .optional(),\n })\n .strict()\n\nexport const IntelligenceConfigSchema = z\n .object({\n enabled: z.boolean().optional(),\n adapter: z\n .object({\n provider: z.enum(['openai', 'anthropic', 'ollama', 'openrouter', 'custom']),\n model: z.string().min(1).max(128).optional(),\n apiKeyEnv: z.string().min(0).max(128).optional(),\n baseUrl: z.string().url().optional(),\n options: z.record(z.string(), z.unknown()).optional(),\n })\n .strict()\n .optional(),\n chat: z\n .object({\n enabled: z.boolean().optional(),\n sources: z.array(z.enum(['agent', 'human', 'federation'])).max(8).optional(),\n handoffFirst: z.boolean().optional(),\n })\n .strict()\n .optional(),\n retriever: z\n .object({\n enabled: z.boolean().optional(),\n mode: z.enum(['local', 'remote', 'bm25', 'agentskit-rag']).optional(),\n embedModel: z.string().min(1).max(128).optional(),\n chunkSize: z.number().int().min(128).max(16_384).optional(),\n options: z.record(z.string(), z.unknown()).optional(),\n })\n .strict()\n .optional(),\n memory: z\n .object({\n enabled: z.boolean().optional(),\n adapters: z\n .array(z.enum(['playbook-memory', 'cursor-rules', 'session-export', 'bootstrap-delta']))\n .max(8)\n .optional(),\n ingestDir: z.string().min(1).max(512).optional(),\n classify: z.boolean().optional(),\n promote: z\n .object({\n enabled: z.boolean().optional(),\n targets: z.array(z.enum(['agent', 'human', 'agents-md'])).max(8).optional(),\n requireApproval: z.boolean().optional(),\n })\n .strict()\n .optional(),\n })\n .strict()\n .optional(),\n runtime: z.enum(['agentskit', 'custom']).optional(),\n runtimeModule: z.string().min(1).max(512).optional(),\n })\n .strict()\n\nexport const FederationConfigSchema = z\n .object({\n enabled: z.boolean().optional(),\n sources: z\n .array(\n z\n .object({\n id: z.string().min(1).max(64),\n llmsTxt: z.string().min(1).max(512).optional(),\n rawBaseUrl: z.string().url().optional(),\n includeInRetriever: z.boolean().optional(),\n includeInChat: z.boolean().optional(),\n })\n .strict(),\n )\n .max(16)\n .optional(),\n })\n .strict()\n\nexport const DocBridgeConfigV1Schema = z\n .object({\n schemaVersion: z.literal(CONFIG_SCHEMA_VERSION),\n project: z\n .object({\n name: z.string().min(1).max(128).optional(),\n root: z.string().min(1).max(512).optional(),\n })\n .strict()\n .optional(),\n corpus: z\n .object({\n agent: AgentCorpusConfigSchema,\n human: z.union([HumanCorpusConfigSchema, z.array(HumanCorpusConfigSchema).max(8)]).optional(),\n })\n .strict(),\n index: IndexConfigSchema.optional(),\n routing: RoutingConfigSchema.optional(),\n gates: GatesConfigSchema.optional(),\n surfaces: SurfacesConfigSchema.optional(),\n intelligence: IntelligenceConfigSchema.optional(),\n federation: FederationConfigSchema.optional(),\n })\n .strict()\n\nexport type DocBridgeConfigV1 = z.infer<typeof DocBridgeConfigV1Schema>\nexport type AgentCorpusConfig = z.infer<typeof AgentCorpusConfigSchema>\nexport type HumanCorpusConfig = z.infer<typeof HumanCorpusConfigSchema>\n","import { applyConfigDefaults } from './defaults.js'\nimport { DocBridgeConfigV1Schema, type DocBridgeConfigV1 } from './schema.js'\n\n/** Type-safe config helper for `doc-bridge.config.ts`. */\nexport const defineConfig = (config: DocBridgeConfigV1): DocBridgeConfigV1 =>\n applyConfigDefaults(DocBridgeConfigV1Schema.parse(config))","import { existsSync, readFileSync } from 'node:fs'\nimport { basename, dirname, join, resolve } from 'node:path'\nimport vm from 'node:vm'\n\nimport { applyConfigDefaults } from './defaults.js'\nimport { DocBridgeConfigV1Schema, type DocBridgeConfigV1 } from './schema.js'\n\nconst CONFIG_CANDIDATES = [\n 'doc-bridge.config.ts',\n 'doc-bridge.config.mts',\n 'doc-bridge.config.js',\n 'doc-bridge.config.mjs',\n 'doc-bridge.config.json',\n 'doc-bridge.config.yaml',\n 'doc-bridge.config.yml',\n 'package.json',\n] as const\n\nexport type LoadConfigOptions = {\n readonly cwd?: string\n readonly explicitPath?: string\n}\n\nexport type LoadConfigResult = {\n readonly config: DocBridgeConfigV1\n readonly path: string\n}\n\nexport class ConfigNotFoundError extends Error {\n constructor(readonly cwd: string) {\n super(\n `No doc-bridge config found in ${cwd}. Run: ak-docs init — or pass --config <path>.`,\n )\n this.name = 'ConfigNotFoundError'\n }\n}\n\nconst findConfigPath = (cwd: string, explicitPath?: string): string | null => {\n if (explicitPath) {\n const abs = resolve(cwd, explicitPath)\n return existsSync(abs) ? abs : null\n }\n for (const name of CONFIG_CANDIDATES) {\n const candidate = join(cwd, name)\n if (!existsSync(candidate)) continue\n if (name !== 'package.json') return candidate\n const pkg = parseJsonConfig(readFileSync(candidate, 'utf8'), candidate) as { docBridge?: unknown }\n if (pkg.docBridge) return candidate\n }\n return null\n}\n\nconst parseJsonConfig = (raw: string, path: string): unknown => {\n try {\n return JSON.parse(raw) as unknown\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n throw new Error(`Failed to parse JSON config at ${path}: ${message}`)\n }\n}\n\nconst parseCodeConfig = (raw: string, path: string): unknown => {\n const code = raw\n .replace(/import\\s+type\\s+[\\s\\S]*?;?\\n/g, '')\n .replace(/import\\s+\\{\\s*defineConfig\\s*\\}\\s+from\\s+['\"]@agentskit\\/doc-bridge(?:\\/config)?['\"];?\\n?/g, '')\n .replace(/\\s+satisfies\\s+[A-Za-z0-9_.$<>{}\\[\\],\\s]+(?=\\s*(?:;|\\)|$))/g, '')\n .replace(/export\\s+default/, 'module.exports.default =')\n\n if (/\\bimport\\b/.test(code)) {\n throw new Error(`Unsupported import in ${path}. Static config only supports defineConfig imports.`)\n }\n\n const sandbox = {\n module: { exports: {} as { default?: unknown } },\n exports: {},\n defineConfig: (config: unknown) => config,\n }\n try {\n vm.runInNewContext(code, sandbox, { timeout: 250, filename: path })\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n throw new Error(`Failed to load config at ${path}: ${message}`)\n }\n return sandbox.module.exports.default\n}\n\nconst parseConfig = (input: unknown): DocBridgeConfigV1 => {\n const result = DocBridgeConfigV1Schema.safeParse(input)\n if (result.success) return result.data\n throw new Error(\n `Invalid doc-bridge config:\\n${result.error.issues.map((issue) =>\n ` - ${issue.path.join('.') || '(root)'}: ${issue.message}`,\n ).join('\\n')}`,\n )\n}\n\n/** v0.1 — static JS/TS config, JSON config files, and package.json#docBridge. */\nexport const loadConfig = (opts: LoadConfigOptions = {}): LoadConfigResult => {\n const cwd = resolve(opts.cwd ?? process.cwd())\n const path = findConfigPath(cwd, opts.explicitPath)\n if (!path) throw new ConfigNotFoundError(cwd)\n\n const raw = readFileSync(path, 'utf8')\n const ext = path.split('.').pop()?.toLowerCase()\n if (ext === 'yaml' || ext === 'yml') {\n throw new Error(`YAML config is not supported yet (${path}). Use doc-bridge.config.json for now.`)\n }\n\n const parsed =\n basename(path) === 'package.json'\n ? (parseJsonConfig(raw, path) as { docBridge?: unknown }).docBridge\n : ext === 'ts' || ext === 'mts' || ext === 'js' || ext === 'mjs'\n ? parseCodeConfig(raw, path)\n : parseJsonConfig(raw, path)\n const config = applyConfigDefaults(parseConfig(parsed))\n return { config, path }\n}\n\nexport const resolveProjectRoot = (start = process.cwd()): string => {\n let cur = resolve(start)\n for (let i = 0; i < 12; i += 1) {\n if (findConfigPath(cur)) return cur\n const parent = dirname(cur)\n if (parent === cur) break\n cur = parent\n }\n return resolve(start)\n}\n\n/** Project root for a loaded config file path (directory of the config). */\nexport const projectRootFromConfigPath = (\n configFilePath: string,\n projectRootField?: string,\n): string => {\n const configDir = dirname(resolve(configFilePath))\n if (projectRootField) return resolve(configDir, project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