@deepagents/orchestrator 6.1.0 → 7.0.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.
Files changed (62) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/lib/arxiv/arxiv.js +153 -0
  4. package/dist/lib/arxiv/arxiv.js.map +7 -0
  5. package/dist/lib/citation.js +120 -0
  6. package/dist/lib/citation.js.map +7 -0
  7. package/dist/lib/deepplan/demo.js +518 -0
  8. package/dist/lib/deepplan/demo.js.map +7 -0
  9. package/dist/lib/deepplan/executors/generic-executor.js +196 -0
  10. package/dist/lib/deepplan/executors/generic-executor.js.map +7 -0
  11. package/dist/lib/deepplan/executors/hackernews-executor.js +210 -0
  12. package/dist/lib/deepplan/executors/hackernews-executor.js.map +7 -0
  13. package/dist/lib/deepplan/executors/product-manager-executor.js +226 -0
  14. package/dist/lib/deepplan/executors/product-manager-executor.js.map +7 -0
  15. package/dist/lib/deepplan/executors/repo-search-executor.js +76 -0
  16. package/dist/lib/deepplan/executors/repo-search-executor.js.map +7 -0
  17. package/dist/lib/deepplan/executors/research-executor.js +196 -0
  18. package/dist/lib/deepplan/executors/research-executor.js.map +7 -0
  19. package/dist/lib/deepplan/next/plan.js +1 -0
  20. package/dist/lib/deepplan/next/plan.js.map +7 -0
  21. package/dist/lib/deepplan/plan-and-solve.js +826 -0
  22. package/dist/lib/deepplan/plan-and-solve.js.map +7 -0
  23. package/dist/lib/deepplan/planner-agent.js +416 -0
  24. package/dist/lib/deepplan/planner-agent.js.map +7 -0
  25. package/dist/lib/deepplan/replanner-agent.js +418 -0
  26. package/dist/lib/deepplan/replanner-agent.js.map +7 -0
  27. package/dist/lib/deepplan/synthesizer.js +75 -0
  28. package/dist/lib/deepplan/synthesizer.js.map +7 -0
  29. package/dist/lib/deepresearch.v0.js +297 -0
  30. package/dist/lib/deepresearch.v0.js.map +7 -0
  31. package/dist/lib/deepresearch.v1.js +260 -0
  32. package/dist/lib/deepresearch.v1.js.map +7 -0
  33. package/dist/lib/deepwiki/complete-wiki.js +319 -0
  34. package/dist/lib/deepwiki/complete-wiki.js.map +7 -0
  35. package/dist/lib/deepwiki/deepwiki.js +370 -0
  36. package/dist/lib/deepwiki/deepwiki.js.map +7 -0
  37. package/dist/lib/deepwiki/gitignore-agent.js +40 -0
  38. package/dist/lib/deepwiki/gitignore-agent.js.map +7 -0
  39. package/dist/lib/deepwiki/outline-agent.d.ts.map +1 -1
  40. package/dist/lib/deepwiki/outline-agent.js +186 -0
  41. package/dist/lib/deepwiki/outline-agent.js.map +7 -0
  42. package/dist/lib/deepwiki/wiki-writer.js +242 -0
  43. package/dist/lib/deepwiki/wiki-writer.js.map +7 -0
  44. package/dist/lib/deepwiki/writer.js +407 -0
  45. package/dist/lib/deepwiki/writer.js.map +7 -0
  46. package/dist/lib/evolving.js +204 -0
  47. package/dist/lib/evolving.js.map +7 -0
  48. package/dist/lib/graph.js +12 -0
  49. package/dist/lib/graph.js.map +7 -0
  50. package/dist/lib/openai-deepresearch/clarrify-agent.js +67 -0
  51. package/dist/lib/openai-deepresearch/clarrify-agent.js.map +7 -0
  52. package/dist/lib/openai-deepresearch/lead-research.js +168 -0
  53. package/dist/lib/openai-deepresearch/lead-research.js.map +7 -0
  54. package/dist/lib/openai-deepresearch/openai-deepresearch.js +179 -0
  55. package/dist/lib/openai-deepresearch/openai-deepresearch.js.map +7 -0
  56. package/dist/lib/openai-deepresearch/reasearcher.js +62 -0
  57. package/dist/lib/openai-deepresearch/reasearcher.js.map +7 -0
  58. package/dist/lib/openai-deepresearch/research-brief.js +59 -0
  59. package/dist/lib/openai-deepresearch/research-brief.js.map +7 -0
  60. package/dist/lib/repo-context.js +11 -0
  61. package/dist/lib/repo-context.js.map +7 -0
  62. package/package.json +8 -8
@@ -0,0 +1,370 @@
1
+ // packages/orchestrator/src/lib/deepwiki/deepwiki.ts
2
+ import { writeFile as writeFile2 } from "node:fs/promises";
3
+ import { repoTree } from "@deepagents/toolbox";
4
+
5
+ // packages/orchestrator/src/lib/deepwiki/complete-wiki.ts
6
+ import { groq as groq2 } from "@ai-sdk/groq";
7
+ import { defaultSettingsMiddleware, wrapLanguageModel } from "ai";
8
+ import { snakeCase } from "lodash-es";
9
+ import { writeFile } from "node:fs/promises";
10
+ import {
11
+ agent as agent2,
12
+ execute as execute2,
13
+ instructions as instructions2,
14
+ lmstudio,
15
+ user as user2
16
+ } from "@deepagents/agent";
17
+ import { read_file_tool as read_file_tool2, search_content_tool } from "@deepagents/toolbox";
18
+
19
+ // packages/orchestrator/src/lib/deepwiki/outline-agent.ts
20
+ import { groq } from "@ai-sdk/groq";
21
+ import { generateId, toUIMessageStream, tool } from "ai";
22
+ import z from "zod";
23
+ import {
24
+ agent,
25
+ execute,
26
+ generate,
27
+ instructions,
28
+ user
29
+ } from "@deepagents/agent";
30
+ import { read_file_tool, scratchpad_tool } from "@deepagents/toolbox";
31
+ var BaseOutlineItem = z.object({
32
+ title: z.string().trim().min(1, "Title is required")
33
+ });
34
+ var OutlineItemSchema = z.lazy(
35
+ () => BaseOutlineItem.extend({
36
+ sections: z.array(OutlineItemSchema).optional()
37
+ })
38
+ );
39
+ var OutlineSchema = z.array(OutlineItemSchema);
40
+ var outlineAgent = agent({
41
+ name: "Outline Agent",
42
+ model: groq("moonshotai/kimi-k2-instruct-0905"),
43
+ // model: lmstudio('qwen/qwen3-8b'),
44
+ // model: lmstudio('openai/gpt-oss-20b'),
45
+ // temperature: 0.1,
46
+ prompt: (context) => instructions({
47
+ purpose: [
48
+ "You are wiki architect, meticulously analyzing a repository's structure and content to automatically generate a comprehensive, intelligent, and perfectly structured outline, laying the bedrock for exceptional documentation.",
49
+ "\n",
50
+ "<RepositoryTree>",
51
+ context?.tree || "",
52
+ "</RepositoryTree>"
53
+ ],
54
+ routine: []
55
+ // routine: [
56
+ // 'Your primary tool for memory is your `scratchpad`. After every action, you MUST summarize your findings and add them to the scratchpad using the `update_scratchpad` tool.',
57
+ // 'Systematically investigate key files and directories use `search_files`. For each finding add it as a new note to your scratchpad.',
58
+ // 'When you read a file like `README.md` or `package.json`, do not keep the whole content in your head. Instead, summarize the important parts (like headings, dependencies, or scripts) and add that summary to your scratchpad.',
59
+ // 'Continue this process of exploring, summarizing, and adding to your scratchpad until you are confident you have a full picture of the repository.',
60
+ // 'Once you believe you have gathered enough information, your second-to-last step is to review your entire scratchpad to synthesize a plan for the final outline.',
61
+ // 'Finally, based *only* on the information you have gathered in your scratchpad, generate the complete, detailed outline and store it using the `store_outline` tool. You must only call `store_outline` ONCE at the very end.',
62
+ // ],
63
+ }),
64
+ tools: {
65
+ read_file: read_file_tool,
66
+ // read_dir: read_dir_tool,
67
+ // search_files: search_files_tool,
68
+ // file_exists: file_exists_tool,
69
+ update_scratchpad: scratchpad_tool,
70
+ store_outline: tool({
71
+ description: `Use this tool to store the generated outline.
72
+ The outline should be a detailed hierarchical structure representing the sections and subsections of the repository documentation. In thory you can nest sections as deep as you want, but try to keep it to 4 levels deep maximum.
73
+
74
+ ## Example outline
75
+ [
76
+ {
77
+ "title": "xxxx",
78
+ "sections": [
79
+ {
80
+ "title": "yyyy",
81
+ sections: [
82
+ {
83
+ "title": "vvvv",
84
+ "sections": [...],
85
+ }
86
+ ]
87
+ },
88
+ {
89
+ "title": "gggg",
90
+ "sections": [...],
91
+ }
92
+ ]
93
+ },
94
+ ]
95
+ `,
96
+ inputSchema: z.object({
97
+ outline: OutlineSchema
98
+ })
99
+ // execute: ({ outline }, options) => {
100
+ // const context = toState<OutlineAgentContext>(options);
101
+ // // Store the outline in a file or database
102
+ // console.log('Generated Outline:\n', outline);
103
+ // context.outline = outline;
104
+ // return 'Outline stored successfully.';
105
+ // },
106
+ })
107
+ }
108
+ });
109
+ var outlineCondensedAgent = agent({
110
+ name: "Outline Condensed Agent",
111
+ model: groq("moonshotai/kimi-k2-instruct-0905"),
112
+ prompt: instructions({
113
+ purpose: [
114
+ "To intelligently condense and optimize an existing outline by merging redundant sections, removing overly granular subdivisions, and creating a more streamlined, maintainable documentation structure.",
115
+ "Your goal is to reduce complexity while preserving all essential information and maintaining logical hierarchy."
116
+ ],
117
+ routine: [
118
+ "Examine the current outline structure stored in the context. Use your scratchpad to track your analysis.",
119
+ "Identify sections that are too granular (e.g., sections with only 1-2 subsections that could be merged with their parent).",
120
+ "Look for redundant or overlapping sections that cover similar topics and can be consolidated.",
121
+ "Note sections with excessive nesting depth (more than 3-4 levels) that could be flattened.",
122
+ 'Identify sections with very similar titles that could be merged (e.g., "API Overview" and "API Introduction").',
123
+ "For each potential consolidation, add a note to your scratchpad explaining the rationale.",
124
+ "Create a condensed version of the outline that:",
125
+ " - Merges related subsections into broader topics",
126
+ " - Reduces nesting depth where appropriate",
127
+ " - Eliminates redundancy while keeping all unique content areas",
128
+ " - Maintains a maximum depth of 3 levels unless absolutely necessary",
129
+ " - Ensures each section has substantial content to document",
130
+ "Return the condensed outline as structured output."
131
+ ]
132
+ }),
133
+ output: OutlineSchema
134
+ });
135
+ function slugify(text) {
136
+ return text.toLowerCase().replace(/[^a-z0-9\s-]/g, "").trim().replace(/\s+/g, "-").replace(/-+/g, "-");
137
+ }
138
+ function buildToc(items, baseDepth = 1, prefix = []) {
139
+ const lines = [];
140
+ for (const it of items) {
141
+ const path = [...prefix, it.title];
142
+ const indent = " ".repeat(Math.max(0, path.length - 1));
143
+ const anchor = slugify(it.title);
144
+ lines.push(`${indent}- [${it.title}](#${anchor})`);
145
+ if (it.sections?.length) {
146
+ lines.push(...buildToc(it.sections, baseDepth + 1, path));
147
+ }
148
+ }
149
+ return lines;
150
+ }
151
+
152
+ // packages/orchestrator/src/lib/deepwiki/complete-wiki.ts
153
+ var sectionWriterAgent = agent2({
154
+ name: "Section Writer",
155
+ model: wrapLanguageModel({
156
+ // model: groq('moonshotai/kimi-k2-instruct-0905'),
157
+ model: lmstudio("openai/gpt-oss-20b"),
158
+ middleware: defaultSettingsMiddleware({
159
+ settings: { temperature: 0.5 }
160
+ })
161
+ }),
162
+ tools: {
163
+ read_file: read_file_tool2,
164
+ search_content: search_content_tool
165
+ },
166
+ prompt: ""
167
+ });
168
+ var tocPageAgent = agent2({
169
+ name: "TOC Page Writer",
170
+ model: wrapLanguageModel({
171
+ model: groq2("moonshotai/kimi-k2-instruct-0905"),
172
+ middleware: defaultSettingsMiddleware({
173
+ settings: { temperature: 0.1 }
174
+ })
175
+ }),
176
+ prompt: instructions2({
177
+ purpose: [
178
+ "You create table-of-contents style pages for wiki parent sections.",
179
+ "Your pages introduce the parent topic and provide an organized overview of child sections."
180
+ ],
181
+ routine: [
182
+ "Write a clear, engaging introduction to the parent section topic.",
183
+ "Provide context about what readers will learn in the child sections.",
184
+ "Create a structured overview that explains how child sections relate to each other.",
185
+ "Your content should help readers understand the big picture before diving into specifics.",
186
+ "Do NOT duplicate detailed content - that belongs in the child pages."
187
+ ]
188
+ })
189
+ });
190
+ function buildFilePath(pathSegments) {
191
+ return `${snakeCase(pathSegments.join("_"))}.md`;
192
+ }
193
+ async function writeSection(item, pathSegments, state2) {
194
+ console.log(`Writing section: ${pathSegments.join(" > ")}`);
195
+ const result2 = await execute2(
196
+ sectionWriterAgent,
197
+ [
198
+ user2(
199
+ `You are writing the section: ${item.title}
200
+
201
+ Full path: ${pathSegments.join(" > ")}
202
+
203
+ The complete wiki outline is:
204
+ <WikiOutline>
205
+ ${state2.toc.join("\n")}
206
+ </WikiOutline>
207
+
208
+ The repository structure is:
209
+ <RepositoryTree>
210
+ ${state2.tree}
211
+ </RepositoryTree>
212
+
213
+ Your task:
214
+ 1. Use the provided tools to inspect relevant files in the repository
215
+ 2. Write clear, comprehensive, and accurate markdown content for this section
216
+ 3. Include code examples where appropriate
217
+ 4. Ensure the content is self-contained and valuable
218
+ 5. Focus specifically on the topic: ${item.title}
219
+
220
+ Write the section content now.
221
+ `
222
+ )
223
+ ],
224
+ state2
225
+ );
226
+ return result2.text;
227
+ }
228
+ async function writeTocPage(item, pathSegments, childFiles, state2) {
229
+ console.log(`Writing TOC page: ${pathSegments.join(" > ")}`);
230
+ const childSummaries = childFiles.map((child, index) => `${index + 1}. **${child.title}**`).join("\n");
231
+ const childLinks = childFiles.map((child) => `- [${child.title}](${child.path})`).join("\n");
232
+ const result2 = await execute2(
233
+ tocPageAgent,
234
+ [
235
+ user2(
236
+ `You are creating a table-of-contents page for the section: ${item.title}
237
+
238
+ Full path: ${pathSegments.join(" > ")}
239
+
240
+ This parent section has the following child sections:
241
+ ${childSummaries}
242
+
243
+ The complete wiki outline is:
244
+ <WikiOutline>
245
+ ${state2.toc.join("\n")}
246
+ </WikiOutline>
247
+
248
+ The repository structure is:
249
+ <RepositoryTree>
250
+ ${state2.tree}
251
+ </RepositoryTree>
252
+
253
+ Your task:
254
+ 1. Write a clear introduction to the "${item.title}" topic
255
+ 2. Explain what readers will learn from the child sections below
256
+ 3. Provide context about how these child sections relate to each other
257
+ 4. Keep it concise - this is a navigation page, not the full content
258
+
259
+ After your introduction, you MUST include this exact navigation section:
260
+
261
+ ## Sections
262
+
263
+ ${childLinks}
264
+
265
+ Write the TOC page content now (introduction followed by the navigation section above).
266
+ `
267
+ )
268
+ ],
269
+ state2
270
+ );
271
+ return result2.text;
272
+ }
273
+ async function processOutlineItem(item, pathSegments, state2, files) {
274
+ const currentPath = [...pathSegments, item.title];
275
+ const filePath = buildFilePath(currentPath);
276
+ if (!item.sections || item.sections.length === 0) {
277
+ const content = await writeSection(item, currentPath, state2);
278
+ await writeFile(filePath, content, "utf-8");
279
+ files[item.title] = filePath;
280
+ console.log(`\u2713 Created: ${filePath}`);
281
+ } else {
282
+ const childFiles = [];
283
+ for (const child of item.sections) {
284
+ await processOutlineItem(child, currentPath, state2, files);
285
+ const childPath = buildFilePath([...currentPath, child.title]);
286
+ childFiles.push({ title: child.title, path: childPath });
287
+ }
288
+ const content = await writeTocPage(item, currentPath, childFiles, state2);
289
+ await writeFile(filePath, content, "utf-8");
290
+ files[item.title] = filePath;
291
+ console.log(`\u2713 Created TOC: ${filePath}`);
292
+ }
293
+ }
294
+ async function completeWiki(state2) {
295
+ const toc = buildToc(state2.outline);
296
+ const files = {};
297
+ const agentContext = {
298
+ repo_path: state2.repo_path,
299
+ scratchpad: "## Scratchpad\n\n",
300
+ tree: state2.tree,
301
+ toc
302
+ };
303
+ console.log("Starting multi-page wiki generation...");
304
+ for (const item of state2.outline) {
305
+ await processOutlineItem(item, [], agentContext, files);
306
+ }
307
+ const indexLinks = state2.outline.map((item) => {
308
+ const filePath = buildFilePath([item.title]);
309
+ return `- [${item.title}](${filePath})`;
310
+ }).join("\n");
311
+ const index = `# Wiki Index
312
+
313
+ Welcome to the documentation. This wiki is organized into the following sections:
314
+
315
+ ${indexLinks}
316
+ `;
317
+ console.log(`\u2713 Complete! Generated ${Object.keys(files).length} pages`);
318
+ return { files, index };
319
+ }
320
+
321
+ // packages/orchestrator/src/lib/deepwiki/deepwiki.ts
322
+ var state = {
323
+ repo_path: "/Users/ezzabuzaid/Desktop/mo/cold-ambulance",
324
+ // outline: [JSON.parse(await readFile('./outline.json', 'utf-8'))],
325
+ outline: [
326
+ {
327
+ title: "Project Overview",
328
+ sections: [
329
+ {
330
+ title: "Healthcare Platform Architecture",
331
+ sections: [
332
+ {
333
+ title: "Multi-Tenant Structure"
334
+ },
335
+ {
336
+ title: "Modular Monorepo Setup"
337
+ }
338
+ ]
339
+ },
340
+ {
341
+ title: "Technology Stack"
342
+ },
343
+ {
344
+ title: "Multi-Tenant Design",
345
+ sections: [
346
+ {
347
+ title: "Customer and Vendor Separation"
348
+ },
349
+ {
350
+ title: "Shared Resources"
351
+ }
352
+ ]
353
+ },
354
+ {
355
+ title: "API-First Approach"
356
+ }
357
+ ]
358
+ }
359
+ ],
360
+ scratchpad: "## Scratchpad\n\n",
361
+ tree: await repoTree("/Users/ezzabuzaid/Desktop/mo/cold-ambulance")
362
+ };
363
+ var result = await completeWiki({
364
+ repo_path: state.repo_path,
365
+ outline: state.outline,
366
+ tree: state.tree
367
+ });
368
+ await writeFile2("docs/index.md", result.index, "utf-8");
369
+ console.log("Generated files:", result.files);
370
+ //# sourceMappingURL=deepwiki.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/lib/deepwiki/deepwiki.ts", "../../../src/lib/deepwiki/complete-wiki.ts", "../../../src/lib/deepwiki/outline-agent.ts"],
4
+ "sourcesContent": ["import { writeFile } from 'node:fs/promises';\n\nimport { repoTree } from '@deepagents/toolbox';\n\nimport { completeWiki } from './complete-wiki.ts';\nimport { type OutlineAgentContext } from './outline-agent.ts';\n\nconst state: OutlineAgentContext = {\n repo_path: '/Users/ezzabuzaid/Desktop/mo/cold-ambulance',\n // outline: [JSON.parse(await readFile('./outline.json', 'utf-8'))],\n outline: [\n {\n title: 'Project Overview',\n sections: [\n {\n title: 'Healthcare Platform Architecture',\n sections: [\n {\n title: 'Multi-Tenant Structure',\n },\n {\n title: 'Modular Monorepo Setup',\n },\n ],\n },\n {\n title: 'Technology Stack',\n },\n {\n title: 'Multi-Tenant Design',\n sections: [\n {\n title: 'Customer and Vendor Separation',\n },\n {\n title: 'Shared Resources',\n },\n ],\n },\n {\n title: 'API-First Approach',\n },\n ],\n },\n ],\n scratchpad: '## Scratchpad\\n\\n',\n tree: await repoTree('/Users/ezzabuzaid/Desktop/mo/cold-ambulance'),\n};\n\n// const outline = await generateOutline(state);\n\n// await writeFile(\n// './outline_large.json',\n// JSON.stringify(state.outline, null, 2),\n// 'utf-8',\n// );\n// await writeFile('./outline.json', JSON.stringify(outline, null, 2), 'utf-8');\n\n// const finalDoc = await generateWiki({\n// repo_path: state.repo_path,\n// outline: state.outline,\n// tree: state.tree,\n// });\n// const finalDoc = await singlePageWiki({\n// repo_path: state.repo_path,\n// outline: state.outline,\n// tree: state.tree,\n// });\n// await writeFile('./wiki.md', finalDoc, 'utf-8');\n\nconst result = await completeWiki({\n repo_path: state.repo_path,\n outline: state.outline,\n tree: state.tree,\n});\n\n// Write index\nawait writeFile('docs/index.md', result.index, 'utf-8');\n\n// All section files are already written to docs/\nconsole.log('Generated files:', result.files);\n", "import { groq } from '@ai-sdk/groq';\nimport { defaultSettingsMiddleware, wrapLanguageModel } from 'ai';\nimport { snakeCase } from 'lodash-es';\nimport { writeFile } from 'node:fs/promises';\n\nimport {\n agent,\n execute,\n instructions,\n lmstudio,\n user,\n} from '@deepagents/agent';\nimport { read_file_tool, search_content_tool } from '@deepagents/toolbox';\n\nimport { type Outline, buildToc } from './outline-agent.ts';\n\ntype SectionAgentContext = {\n repo_path: string;\n scratchpad: string;\n tree: string;\n toc: string[];\n};\n\n// Agent for writing leaf sections\nconst sectionWriterAgent = agent<SectionAgentContext>({\n name: 'Section Writer',\n model: wrapLanguageModel({\n // model: groq('moonshotai/kimi-k2-instruct-0905'),\n model: lmstudio('openai/gpt-oss-20b'),\n middleware: defaultSettingsMiddleware({\n settings: { temperature: 0.5 },\n }),\n }),\n tools: {\n read_file: read_file_tool,\n search_content: search_content_tool,\n },\n prompt: '',\n});\n\n// Agent for writing parent TOC pages\nconst tocPageAgent = agent<SectionAgentContext>({\n name: 'TOC Page Writer',\n model: wrapLanguageModel({\n model: groq('moonshotai/kimi-k2-instruct-0905'),\n middleware: defaultSettingsMiddleware({\n settings: { temperature: 0.1 },\n }),\n }),\n prompt: instructions({\n purpose: [\n 'You create table-of-contents style pages for wiki parent sections.',\n 'Your pages introduce the parent topic and provide an organized overview of child sections.',\n ],\n routine: [\n 'Write a clear, engaging introduction to the parent section topic.',\n 'Provide context about what readers will learn in the child sections.',\n 'Create a structured overview that explains how child sections relate to each other.',\n 'Your content should help readers understand the big picture before diving into specifics.',\n 'Do NOT duplicate detailed content - that belongs in the child pages.',\n ],\n }),\n});\n\ntype WikiResult = {\n files: Record<string, string>; // section title -> file path\n index: string; // main index content\n};\n\n/**\n * Build file path for a section based on its hierarchical path\n * Example: ['Project Overview', 'Architecture'] -> 'docs/project_overview_architecture.md'\n */\nfunction buildFilePath(pathSegments: string[]): string {\n return `${snakeCase(pathSegments.join('_'))}.md`;\n}\n\n/**\n * Write content for a leaf section using the section writer agent\n */\nasync function writeSection(\n item: Outline[number],\n pathSegments: string[],\n state: SectionAgentContext,\n): Promise<string> {\n console.log(`Writing section: ${pathSegments.join(' > ')}`);\n\n const result = await execute(\n sectionWriterAgent,\n [\n user(\n `You are writing the section: ${item.title}\n\nFull path: ${pathSegments.join(' > ')}\n\nThe complete wiki outline is:\n<WikiOutline>\n${state.toc.join('\\n')}\n</WikiOutline>\n\nThe repository structure is:\n<RepositoryTree>\n${state.tree}\n</RepositoryTree>\n\nYour task:\n1. Use the provided tools to inspect relevant files in the repository\n2. Write clear, comprehensive, and accurate markdown content for this section\n3. Include code examples where appropriate\n4. Ensure the content is self-contained and valuable\n5. Focus specifically on the topic: ${item.title}\n\nWrite the section content now.\n`,\n ),\n ],\n state,\n );\n\n return result.text;\n}\n\n/**\n * Write a TOC-style page for a parent section\n */\nasync function writeTocPage(\n item: Outline[number],\n pathSegments: string[],\n childFiles: Array<{ title: string; path: string }>,\n state: SectionAgentContext,\n): Promise<string> {\n console.log(`Writing TOC page: ${pathSegments.join(' > ')}`);\n\n const childSummaries = childFiles\n .map((child, index) => `${index + 1}. **${child.title}**`)\n .join('\\n');\n\n const childLinks = childFiles\n .map((child) => `- [${child.title}](${child.path})`)\n .join('\\n');\n\n const result = await execute(\n tocPageAgent,\n [\n user(\n `You are creating a table-of-contents page for the section: ${item.title}\n\nFull path: ${pathSegments.join(' > ')}\n\nThis parent section has the following child sections:\n${childSummaries}\n\nThe complete wiki outline is:\n<WikiOutline>\n${state.toc.join('\\n')}\n</WikiOutline>\n\nThe repository structure is:\n<RepositoryTree>\n${state.tree}\n</RepositoryTree>\n\nYour task:\n1. Write a clear introduction to the \"${item.title}\" topic\n2. Explain what readers will learn from the child sections below\n3. Provide context about how these child sections relate to each other\n4. Keep it concise - this is a navigation page, not the full content\n\nAfter your introduction, you MUST include this exact navigation section:\n\n## Sections\n\n${childLinks}\n\nWrite the TOC page content now (introduction followed by the navigation section above).\n`,\n ),\n ],\n state,\n );\n\n return result.text;\n}\n\n/**\n * Recursively process outline items and generate markdown files\n */\nasync function processOutlineItem(\n item: Outline[number],\n pathSegments: string[],\n state: SectionAgentContext,\n files: Record<string, string>,\n): Promise<void> {\n const currentPath = [...pathSegments, item.title];\n const filePath = buildFilePath(currentPath);\n\n if (!item.sections || item.sections.length === 0) {\n // Leaf node - write comprehensive content\n const content = await writeSection(item, currentPath, state);\n await writeFile(filePath, content, 'utf-8');\n files[item.title] = filePath;\n console.log(`\u2713 Created: ${filePath}`);\n } else {\n // Parent node - process children first, then create TOC page\n const childFiles: Array<{ title: string; path: string }> = [];\n\n for (const child of item.sections) {\n await processOutlineItem(child, currentPath, state, files);\n const childPath = buildFilePath([...currentPath, child.title]);\n childFiles.push({ title: child.title, path: childPath });\n }\n\n // Create TOC page for parent\n const content = await writeTocPage(item, currentPath, childFiles, state);\n await writeFile(filePath, content, 'utf-8');\n files[item.title] = filePath;\n console.log(`\u2713 Created TOC: ${filePath}`);\n }\n}\n\n/**\n * Generate a complete multi-page wiki from an outline\n *\n * This function creates separate markdown files for each section:\n * - Leaf sections get comprehensive content written by agents\n * - Parent sections get TOC-style pages with introductions and links to children\n * - All files use flat naming with full hierarchical path\n */\nexport async function completeWiki(state: {\n repo_path: string;\n outline: Outline;\n tree: string;\n}): Promise<WikiResult> {\n const toc = buildToc(state.outline);\n const files: Record<string, string> = {};\n\n const agentContext: SectionAgentContext = {\n repo_path: state.repo_path,\n scratchpad: '## Scratchpad\\n\\n',\n tree: state.tree,\n toc,\n };\n\n console.log('Starting multi-page wiki generation...');\n\n // Process each top-level item\n for (const item of state.outline) {\n await processOutlineItem(item, [], agentContext, files);\n }\n\n // Create main index page\n const indexLinks = state.outline\n .map((item) => {\n const filePath = buildFilePath([item.title]);\n return `- [${item.title}](${filePath})`;\n })\n .join('\\n');\n\n const index = `# Wiki Index\n\nWelcome to the documentation. This wiki is organized into the following sections:\n\n${indexLinks}\n`;\n\n console.log(`\u2713 Complete! Generated ${Object.keys(files).length} pages`);\n\n return { files, index };\n}\n", "import { groq } from '@ai-sdk/groq';\nimport { type UIMessage, generateId, toUIMessageStream, tool } from 'ai';\nimport z from 'zod';\n\nimport {\n agent,\n execute,\n generate,\n instructions,\n user,\n} from '@deepagents/agent';\nimport { read_file_tool, scratchpad_tool } from '@deepagents/toolbox';\n\nconst BaseOutlineItem = z.object({\n title: z.string().trim().min(1, 'Title is required'),\n});\ntype OutlineItem = z.output<typeof BaseOutlineItem> & {\n sections?: z.output<typeof OutlineItemSchema>[];\n};\nconst OutlineItemSchema: z.ZodType<OutlineItem> = z.lazy(() =>\n BaseOutlineItem.extend({\n sections: z.array(OutlineItemSchema).optional(),\n }),\n);\nconst OutlineSchema = z.array(OutlineItemSchema);\nexport type Outline = z.output<typeof OutlineSchema>;\nexport type OutlineAgentContext = {\n repo_path: string;\n outline: z.output<typeof OutlineSchema>;\n scratchpad: string;\n tree: string;\n};\n\nexport const outlineAgent = agent<unknown, OutlineAgentContext>({\n name: 'Outline Agent',\n model: groq('moonshotai/kimi-k2-instruct-0905'),\n // model: lmstudio('qwen/qwen3-8b'),\n // model: lmstudio('openai/gpt-oss-20b'),\n\n // temperature: 0.1,\n prompt: (context) =>\n instructions({\n purpose: [\n \"You are wiki architect, meticulously analyzing a repository's structure and content to automatically generate a comprehensive, intelligent, and perfectly structured outline, laying the bedrock for exceptional documentation.\",\n '\\n',\n '<RepositoryTree>',\n context?.tree || '',\n '</RepositoryTree>',\n ],\n routine: [],\n // routine: [\n // 'Your primary tool for memory is your `scratchpad`. After every action, you MUST summarize your findings and add them to the scratchpad using the `update_scratchpad` tool.',\n // 'Systematically investigate key files and directories use `search_files`. For each finding add it as a new note to your scratchpad.',\n // 'When you read a file like `README.md` or `package.json`, do not keep the whole content in your head. Instead, summarize the important parts (like headings, dependencies, or scripts) and add that summary to your scratchpad.',\n // 'Continue this process of exploring, summarizing, and adding to your scratchpad until you are confident you have a full picture of the repository.',\n // 'Once you believe you have gathered enough information, your second-to-last step is to review your entire scratchpad to synthesize a plan for the final outline.',\n // 'Finally, based *only* on the information you have gathered in your scratchpad, generate the complete, detailed outline and store it using the `store_outline` tool. You must only call `store_outline` ONCE at the very end.',\n // ],\n }),\n tools: {\n read_file: read_file_tool,\n // read_dir: read_dir_tool,\n // search_files: search_files_tool,\n // file_exists: file_exists_tool,\n update_scratchpad: scratchpad_tool,\n store_outline: tool({\n description: `Use this tool to store the generated outline.\n\t\tThe outline should be a detailed hierarchical structure representing the sections and subsections of the repository documentation. In thory you can nest sections as deep as you want, but try to keep it to 4 levels deep maximum.\n\n\t\t## Example outline\n\t\t[\n\t\t\t{\n\t\t\t\t\"title\": \"xxxx\",\n\t\t\t\t\"sections\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"title\": \"yyyy\",\n\t\t\t\t\t\tsections: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"title\": \"vvvv\",\n\t\t\t\t\t\t\t\t\"sections\": [...],\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t\"title\": \"gggg\",\n\t\t\t\t\t\t\"sections\": [...],\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t]\n\t\t\t`,\n inputSchema: z.object({\n outline: OutlineSchema,\n }),\n // execute: ({ outline }, options) => {\n // const context = toState<OutlineAgentContext>(options);\n // // Store the outline in a file or database\n // console.log('Generated Outline:\\n', outline);\n // context.outline = outline;\n // return 'Outline stored successfully.';\n // },\n }),\n },\n});\n\nexport const outlineCondensedAgent = agent<unknown, OutlineAgentContext>({\n name: 'Outline Condensed Agent',\n model: groq('moonshotai/kimi-k2-instruct-0905'),\n prompt: instructions({\n purpose: [\n 'To intelligently condense and optimize an existing outline by merging redundant sections, removing overly granular subdivisions, and creating a more streamlined, maintainable documentation structure.',\n 'Your goal is to reduce complexity while preserving all essential information and maintaining logical hierarchy.',\n ],\n routine: [\n 'Examine the current outline structure stored in the context. Use your scratchpad to track your analysis.',\n 'Identify sections that are too granular (e.g., sections with only 1-2 subsections that could be merged with their parent).',\n 'Look for redundant or overlapping sections that cover similar topics and can be consolidated.',\n 'Note sections with excessive nesting depth (more than 3-4 levels) that could be flattened.',\n 'Identify sections with very similar titles that could be merged (e.g., \"API Overview\" and \"API Introduction\").',\n 'For each potential consolidation, add a note to your scratchpad explaining the rationale.',\n 'Create a condensed version of the outline that:',\n ' - Merges related subsections into broader topics',\n ' - Reduces nesting depth where appropriate',\n ' - Eliminates redundancy while keeping all unique content areas',\n ' - Maintains a maximum depth of 3 levels unless absolutely necessary',\n ' - Ensures each section has substantial content to document',\n 'Return the condensed outline as structured output.',\n ],\n }),\n output: OutlineSchema,\n});\n\nexport async function generateOutline(state: OutlineAgentContext) {\n const messages: UIMessage[] = [\n user(\n 'Walk through the repository and generate a detailed outline. Make sure to avoid looking into framework generated files and folders. when outline is complete, call the store_outline tool.',\n ),\n ];\n const max_iterations = 3;\n let current_iteration = 0;\n while (current_iteration < max_iterations) {\n console.log(`\\n=== Outline Iteration ${current_iteration + 1} ===\\n`);\n const result = await execute(outlineAgent, messages, state);\n await Array.fromAsync(\n toUIMessageStream({\n stream: result.stream,\n tools: outlineAgent.toToolset(),\n generateMessageId: generateId,\n originalMessages: messages,\n onEnd: async ({ responseMessage }: { responseMessage: UIMessage }) => {\n messages.push(responseMessage);\n },\n }),\n );\n await result.consumeStream();\n const calls = await result.toolCalls;\n const outlineCall = calls.find(\n (t: { toolName: string }) => t.toolName === 'store_outline',\n );\n if (outlineCall) {\n console.log('\\n=== Outline Generation Complete ===\\n');\n state.outline = outlineCall.input.outline;\n break;\n }\n current_iteration++;\n }\n if (!state.outline.length) {\n throw new Error('Outline generation failed.');\n }\n return generate(\n outlineCondensedAgent,\n `Condense and optimize the following outline:\\n\\n${buildToc(state.outline)}`,\n state,\n ).then(({ output }) => output);\n}\n\nfunction slugify(text: string) {\n return text\n .toLowerCase()\n .replace(/[^a-z0-9\\s-]/g, '')\n .trim()\n .replace(/\\s+/g, '-')\n .replace(/-+/g, '-');\n}\n\nexport function buildToc(\n items: OutlineItem[],\n baseDepth = 1,\n prefix: string[] = [],\n) {\n const lines: string[] = [];\n for (const it of items) {\n const path = [...prefix, it.title];\n const indent = ' '.repeat(Math.max(0, path.length - 1));\n const anchor = slugify(it.title);\n lines.push(`${indent}- [${it.title}](#${anchor})`);\n if (it.sections?.length) {\n lines.push(...buildToc(it.sections, baseDepth + 1, path));\n }\n }\n return lines;\n}\n"],
5
+ "mappings": ";AAAA,SAAS,aAAAA,kBAAiB;AAE1B,SAAS,gBAAgB;;;ACFzB,SAAS,QAAAC,aAAY;AACrB,SAAS,2BAA2B,yBAAyB;AAC7D,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAE1B;AAAA,EACE,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,gBAAAC;AAAA,EACA;AAAA,EACA,QAAAC;AAAA,OACK;AACP,SAAS,kBAAAC,iBAAgB,2BAA2B;;;ACZpD,SAAS,YAAY;AACrB,SAAyB,YAAY,mBAAmB,YAAY;AACpE,OAAO,OAAO;AAEd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB,uBAAuB;AAEhD,IAAM,kBAAkB,EAAE,OAAO;AAAA,EAC/B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,GAAG,mBAAmB;AACrD,CAAC;AAID,IAAM,oBAA4C,EAAE;AAAA,EAAK,MACvD,gBAAgB,OAAO;AAAA,IACrB,UAAU,EAAE,MAAM,iBAAiB,EAAE,SAAS;AAAA,EAChD,CAAC;AACH;AACA,IAAM,gBAAgB,EAAE,MAAM,iBAAiB;AASxC,IAAM,eAAe,MAAoC;AAAA,EAC9D,MAAM;AAAA,EACN,OAAO,KAAK,kCAAkC;AAAA;AAAA;AAAA;AAAA,EAK9C,QAAQ,CAAC,YACP,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QAAM,QAAQ;AAAA;AAAA;AAAA;AAAA,EAId,UAAU;AAAA;AAGV,UAAQ,IAAI,8BAAyB,OAAO,KAAK,KAAK,EAAE,MAAM,QAAQ;AAEtE,SAAO,EAAE,OAAO,MAAM;AACxB;;;ADrQA,IAAM,QAA6B;AAAA,EACjC,WAAW;AAAA;AAAA,EAEX,SAAS;AAAA,IACP;AAAA,MACE,OAAO;AAAA,MACP,UAAU;AAAA,QACR;AAAA,UACE,OAAO;AAAA,UACP,UAAU;AAAA,YACR;AAAA,cACE,OAAO;AAAA,YACT;AAAA,YACA;AAAA,cACE,OAAO;AAAA,YACT;AAAA,UACF;AAAA,QACF;AAAA,QACA;AAAA,UACE,OAAO;AAAA,QACT;AAAA,QACA;AAAA,UACE,OAAO;AAAA,UACP,UAAU;AAAA,YACR;AAAA,cACE,OAAO;AAAA,YACT;AAAA,YACA;AAAA,cACE,OAAO;AAAA,YACT;AAAA,UACF;AAAA,QACF;AAAA,QACA;AAAA,UACE,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,YAAY;AAAA,EACZ,MAAM,MAAM,SAAS,6CAA6C;AACpE;AAuBA,IAAM,SAAS,MAAM,aAAa;AAAA,EAChC,WAAW,MAAM;AAAA,EACjB,SAAS,MAAM;AAAA,EACf,MAAM,MAAM;AACd,CAAC;AAGD,MAAMI,WAAU,iBAAiB,OAAO,OAAO,OAAO;AAGtD,QAAQ,IAAI,oBAAoB,OAAO,KAAK;",
6
+ "names": ["writeFile", "groq", "agent", "execute", "instructions", "user", "read_file_tool", "agent", "read_file_tool", "groq", "instructions", "state", "result", "execute", "user", "writeFile"]
7
+ }
@@ -0,0 +1,40 @@
1
+ // packages/orchestrator/src/lib/deepwiki/gitignore-agent.ts
2
+ import { groq } from "@ai-sdk/groq";
3
+ import { tool } from "ai";
4
+ import z from "zod";
5
+ import { agent, instructions, toState } from "@deepagents/agent";
6
+ import { read_dir_tool, read_file_tool } from "@deepagents/toolbox";
7
+ var ignoreAgent = agent({
8
+ name: "Ignore Agent",
9
+ model: groq("openai/gpt-oss-20b"),
10
+ prompt: instructions({
11
+ purpose: "To generate a comprehensive .gitignore file tailored to the specific technologies and frameworks used in a given code repository, ensuring that unnecessary or sensitive files are excluded from version control.",
12
+ routine: [
13
+ "Analyze the repository structure and identify key files and directories that should be ignored based on common development practices.",
14
+ "Identify the primary programming languages, frameworks, and tools used in the repository by looking for specific configuration files (e.g., package.json for Node.js, requirements.txt for Python, pom.xml for Java).",
15
+ "Based on the identified technologies, include standard ignore patterns from established templates (e.g., GitHub's collection of .gitignore templates) to cover common build artifacts, dependencies, and environment-specific files.",
16
+ "Consider any custom or unique files in the repository that may need to be ignored, such as local configuration files, logs, or temporary files generated during development.",
17
+ "Compile a comprehensive .gitignore file that includes all relevant patterns, ensuring it is well-organized and easy to understand.",
18
+ "Present the final .gitignore content, ready to be added to the repository to optimize version control practices."
19
+ ]
20
+ }),
21
+ tools: {
22
+ read_dir: read_dir_tool,
23
+ read_file: read_file_tool,
24
+ store_gitignore: tool({
25
+ description: "Use this tool to store the generated .gitignore content.",
26
+ inputSchema: z.object({
27
+ content: z.string().min(1).describe("The content of the .gitignore file.")
28
+ }),
29
+ execute: async ({ content }, options) => {
30
+ const context = toState(options);
31
+ console.log("Generated .gitignore content:\n", content);
32
+ return "Successfully wrote .gitignore file.";
33
+ }
34
+ })
35
+ }
36
+ });
37
+ export {
38
+ ignoreAgent
39
+ };
40
+ //# sourceMappingURL=gitignore-agent.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/lib/deepwiki/gitignore-agent.ts"],
4
+ "sourcesContent": ["import { groq } from '@ai-sdk/groq';\nimport { tool } from 'ai';\nimport z from 'zod';\n\nimport { agent, instructions, toState } from '@deepagents/agent';\nimport { read_dir_tool, read_file_tool } from '@deepagents/toolbox';\n\nexport const ignoreAgent = agent<{ repo_path: string }>({\n name: 'Ignore Agent',\n model: groq('openai/gpt-oss-20b'),\n prompt: instructions({\n purpose:\n 'To generate a comprehensive .gitignore file tailored to the specific technologies and frameworks used in a given code repository, ensuring that unnecessary or sensitive files are excluded from version control.',\n routine: [\n 'Analyze the repository structure and identify key files and directories that should be ignored based on common development practices.',\n 'Identify the primary programming languages, frameworks, and tools used in the repository by looking for specific configuration files (e.g., package.json for Node.js, requirements.txt for Python, pom.xml for Java).',\n \"Based on the identified technologies, include standard ignore patterns from established templates (e.g., GitHub's collection of .gitignore templates) to cover common build artifacts, dependencies, and environment-specific files.\",\n 'Consider any custom or unique files in the repository that may need to be ignored, such as local configuration files, logs, or temporary files generated during development.',\n 'Compile a comprehensive .gitignore file that includes all relevant patterns, ensuring it is well-organized and easy to understand.',\n 'Present the final .gitignore content, ready to be added to the repository to optimize version control practices.',\n ],\n }),\n tools: {\n read_dir: read_dir_tool,\n read_file: read_file_tool,\n store_gitignore: tool({\n description: 'Use this tool to store the generated .gitignore content.',\n inputSchema: z.object({\n content: z\n .string()\n .min(1)\n .describe('The content of the .gitignore file.'),\n }),\n execute: async ({ content }, options) => {\n const context = toState<{ repo_path: string }>(options);\n console.log('Generated .gitignore content:\\n', content);\n // await fs.promises.writeFile(join(context.repo_path, '.gitignore'), content);\n return 'Successfully wrote .gitignore file.';\n },\n }),\n },\n});\n"],
5
+ "mappings": ";AAAA,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,OAAO,OAAO;AAEd,SAAS,OAAO,cAAc,eAAe;AAC7C,SAAS,eAAe,sBAAsB;AAEvC,IAAM,cAAc,MAA6B;AAAA,EACtD,MAAM;AAAA,EACN,OAAO,KAAK,oBAAoB;AAAA,EAChC,QAAQ,aAAa;AAAA,IACnB,SACE;AAAA,IACF,SAAS;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AAAA,EACD,OAAO;AAAA,IACL,UAAU;AAAA,IACV,WAAW;AAAA,IACX,iBAAiB,KAAK;AA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