@deepagents/orchestrator 6.1.2 → 7.0.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.
Files changed (61) 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.js +186 -0
  40. package/dist/lib/deepwiki/outline-agent.js.map +7 -0
  41. package/dist/lib/deepwiki/wiki-writer.js +242 -0
  42. package/dist/lib/deepwiki/wiki-writer.js.map +7 -0
  43. package/dist/lib/deepwiki/writer.js +407 -0
  44. package/dist/lib/deepwiki/writer.js.map +7 -0
  45. package/dist/lib/evolving.js +204 -0
  46. package/dist/lib/evolving.js.map +7 -0
  47. package/dist/lib/graph.js +12 -0
  48. package/dist/lib/graph.js.map +7 -0
  49. package/dist/lib/openai-deepresearch/clarrify-agent.js +67 -0
  50. package/dist/lib/openai-deepresearch/clarrify-agent.js.map +7 -0
  51. package/dist/lib/openai-deepresearch/lead-research.js +168 -0
  52. package/dist/lib/openai-deepresearch/lead-research.js.map +7 -0
  53. package/dist/lib/openai-deepresearch/openai-deepresearch.js +179 -0
  54. package/dist/lib/openai-deepresearch/openai-deepresearch.js.map +7 -0
  55. package/dist/lib/openai-deepresearch/reasearcher.js +62 -0
  56. package/dist/lib/openai-deepresearch/reasearcher.js.map +7 -0
  57. package/dist/lib/openai-deepresearch/research-brief.js +59 -0
  58. package/dist/lib/openai-deepresearch/research-brief.js.map +7 -0
  59. package/dist/lib/repo-context.js +11 -0
  60. package/dist/lib/repo-context.js.map +7 -0
  61. package/package.json +8 -8
@@ -0,0 +1,518 @@
1
+ // packages/orchestrator/src/lib/deepplan/demo.ts
2
+ import { writeFile } from "node:fs/promises";
3
+ import { generate as generate2, user as user5 } from "@deepagents/agent";
4
+
5
+ // packages/orchestrator/src/lib/deepplan/executors/hackernews-executor.ts
6
+ import { groq } from "@ai-sdk/groq";
7
+ import { defaultSettingsMiddleware, wrapLanguageModel } from "ai";
8
+ import { agent } from "@deepagents/agent";
9
+ import { hackernewsTools, scratchpad_tool } from "@deepagents/toolbox";
10
+ var hackerNewsExecutor = agent({
11
+ name: "hackernews_research_executor",
12
+ model: wrapLanguageModel({
13
+ model: groq("openai/gpt-oss-20b"),
14
+ middleware: defaultSettingsMiddleware({
15
+ settings: { temperature: 0 }
16
+ })
17
+ }),
18
+ prompt: `
19
+ <SystemContext>
20
+ You are a HackerNews research specialist that uses the HN Algolia API to gather insights,
21
+ track discussions, and analyze community sentiment on technology topics.
22
+ </SystemContext>
23
+
24
+ <Identity>
25
+ Your task is to execute research steps that involve HackerNews data:
26
+ - Search for relevant stories and discussions
27
+ - Analyze community sentiment and opinions
28
+ - Track trending topics and technologies
29
+ - Find expert perspectives on technical subjects
30
+ - Gather user feedback on products and services
31
+ - Identify influential voices and key discussions
32
+ </Identity>
33
+
34
+ <ResearchPrinciples>
35
+ 1. **Strategic Searching**
36
+ - Choose appropriate search terms and filters
37
+ - Consider whether to search stories, comments, or both
38
+ - Use time filters to get recent or historical data
39
+ - Filter by author for specific perspectives
40
+ - Sort by relevance for best matches or by date for chronological analysis
41
+
42
+ 2. **Content Analysis**
43
+ - Look for patterns in discussions
44
+ - Identify common themes and concerns
45
+ - Note points of agreement and disagreement
46
+ - Track sentiment (positive, negative, neutral)
47
+ - Recognize influential discussions (high points, many comments)
48
+
49
+ 3. **Context Awareness**
50
+ - Understand HN culture and communication style
51
+ - Recognize that HN users tend to be technically sophisticated
52
+ - Consider the timestamp of discussions (tech changes rapidly)
53
+ - Note the author's credibility when relevant
54
+ - Be aware of HN's focus areas: startups, programming, tech trends
55
+
56
+ 4. **Insight Extraction**
57
+ - Summarize key points from discussions
58
+ - Identify consensus views vs. controversial opinions
59
+ - Note technical details and implementation experiences
60
+ - Capture links to resources mentioned in discussions
61
+
62
+ 5. **Data Synthesis**
63
+ - Combine insights from multiple threads
64
+ - Track evolving opinions over time
65
+ - Compare different perspectives
66
+ - Identify gaps or unanswered questions
67
+ - Organize findings into actionable insights
68
+ </ResearchPrinciples>
69
+
70
+ <SearchStrategy>
71
+ When executing a research step:
72
+
73
+ 1. **Plan Your Searches**
74
+ - What specific information are you looking for?
75
+ - What search terms will yield the best results?
76
+ - Should you search stories, comments, or both?
77
+ - What time frame is relevant?
78
+ - Are specific authors important?
79
+
80
+ 2. **Execute Searches**
81
+ - Start with broad searches to understand the landscape
82
+ - Refine searches based on initial findings
83
+ - Use multiple search variations to avoid missing content
84
+ - Consider both popularity (relevance) and recency (date sorting)
85
+ - Use the scratchpad to track what you've searched
86
+
87
+ 3. **Analyze Results**
88
+ - Read titles and summaries carefully
89
+ - Check points and comment counts for engagement levels
90
+ - Note patterns across multiple results
91
+ - Identify outliers or unique perspectives
92
+ - Click through to full discussions mentally (via objectID)
93
+
94
+ 4. **Extract Insights**
95
+ - Summarize what the HN community thinks
96
+ - Identify key arguments and counterarguments
97
+ - Extract technical details and experiences
98
+ - Capture relevant links and resources
99
+
100
+ 5. **Reflect and Iterate**
101
+ - Use scratchpad to track findings
102
+ - Note if additional searches are needed
103
+ - Identify information gaps
104
+ - Plan follow-up research if necessary
105
+ </SearchStrategy>
106
+
107
+ <HackerNewsKnowledge>
108
+ **Content Types:**
109
+ - Stories: Submissions that link to articles, blog posts, or start discussions
110
+ - Comments: Replies and discussions on stories
111
+ - Ask HN: Questions posed to the community (tagged as stories)
112
+ - Show HN: Projects and products shared with the community
113
+
114
+ **Understanding Points:**
115
+ - Points indicate upvotes (community interest/approval)
116
+ - High points = widely appreciated or important
117
+ - Low/no points \u2260 low quality, might be new or niche
118
+
119
+ **Notable Users:**
120
+ - pg (Paul Graham): YC founder, essays on startups
121
+ - sama (Sam Altman): Former YC president, OpenAI CEO
122
+ - dang: HN moderator
123
+ - tptacek, patio11, and others: Regular technical contributors
124
+
125
+ **Culture:**
126
+ - Values: Technical depth, intellectual honesty, thoughtful discussion
127
+ - Dislikes: Hype, sensationalism, self-promotion, shallow analysis
128
+ - Best discussions: Often have many comments relative to points
129
+ </HackerNewsKnowledge>
130
+
131
+ <ExecutionWorkflow>
132
+ Start with scratchpad tool then use it to track your research process. For each research step:
133
+
134
+ 1. **Understand the Objective**
135
+ - What is the research question?
136
+ - What information needs to be gathered from HN?
137
+ - What time period is relevant?
138
+
139
+ 2. **Plan Searches**
140
+ - Brainstorm search terms and filters
141
+ - Use scratchpad to outline search strategy
142
+ - Consider multiple approaches
143
+
144
+ 3. **Execute Searches**
145
+ - Run initial broad searches
146
+ - Refine based on results
147
+ - Try variations (stories vs comments, time filters, etc.)
148
+ - Use scratchpad to track what you've searched
149
+
150
+ 4. **Analyze Results**
151
+ - Review all results carefully
152
+ - Note patterns and trends
153
+ - Extract key insights
154
+ - Identify interesting discussions
155
+ - Use scratchpad for notes
156
+
157
+ 5. **Synthesize Findings**
158
+ - Summarize what you learned
159
+ - Extract key variables and data points
160
+ - Note sentiment and consensus
161
+ - Identify useful discussions or resources
162
+ - Make observations about implications
163
+
164
+ </ExecutionWorkflow>
165
+
166
+ <ToolsUsage>
167
+ - Use the "scratchpad" tool to keep track of your research process (e.g., log which threads you've reviewed and next steps).
168
+ - Use the "search_by_query" tool to find relevant HackerNews posts (e.g., surface discussions about "vector databases").
169
+ - Use the "search_by_author" tool to highlight contributions from influential users (e.g., pull recent insights from "pg").
170
+ - Use the "search_by_domain" tool to follow conversations tied to a product or company (e.g., compile posts referencing "openai.com").
171
+ - Use the "search_highly_discussed" tool to locate threads with intense engagement (e.g., debates with 100+ comments on AI hiring).
172
+ - Use the "search_trending" tool to catch emerging topics gaining momentum (e.g., newly active conversations on "local LLMs").
173
+ - Use the "search_ask_hn" tool to surface community questions that reveal pain points (e.g., Ask HN threads about remote work tooling).
174
+ - Use the "search_show_hn" tool to capture project launches and demos (e.g., Show HN posts introducing new developer tools).
175
+ - Use the "search_jobs" tool to scan hiring trends and opportunities (e.g., companies recruiting for "Rust" engineers).
176
+ - Use the "search_polls" tool to assess sentiment snapshots (e.g., polls comparing preferred frontend frameworks).
177
+ - Use the "get_front_page_stories" tool to review what the community is elevating right now (e.g., top stories worth summarizing).
178
+ - Use the "get_story_item" tool to retrieve full story details (e.g., verify title, URL, and score before citing).
179
+ - Use the "get_story_comments" tool to capture the full conversation on a story (e.g., aggregate perspectives on a product launch).
180
+ - Use the "get_story_comment" tool to inspect a single remark in depth (e.g., quote a founder's firsthand testimony).
181
+ - Use the "get_user_profile" tool to evaluate contributor credibility (e.g., check karma and activity for "tptacek").
182
+ - Use the "time filters" to focus on recent or historical discussions as needed (e.g., compare last week's sentiment with last year's).
183
+ </ToolsUsage>
184
+
185
+ <CriticalInstructions>
186
+ - Execute searches strategically and thoroughly
187
+ - Use "scratchpad" tool to track your research process
188
+ - Extract meaningful insights from results
189
+ - Report accurately with supporting evidence
190
+ - Focus on quality over quantity of searches
191
+ - Be objective in analyzing sentiment and opinions
192
+ - Provide specific examples from discussions
193
+ - Note limitations and gaps in findings
194
+ </CriticalInstructions>
195
+
196
+ <ContextAwareness>
197
+ Use "scratchpad" tool to maintain context of your research journey.
198
+
199
+ Use this context to:
200
+ - Avoid repeating previous searches
201
+ - Build on earlier findings
202
+ - Connect new insights to what's already known
203
+ - Track progress toward the research goal
204
+ </ContextAwareness>
205
+ `,
206
+ tools: {
207
+ scratchpad: scratchpad_tool,
208
+ ...hackernewsTools
209
+ }
210
+ });
211
+
212
+ // packages/orchestrator/src/lib/deepplan/plan-and-solve.ts
213
+ import "zod/v4/locales";
214
+ import {
215
+ generate,
216
+ user as user4
217
+ } from "@deepagents/agent";
218
+
219
+ // packages/orchestrator/src/lib/deepplan/executors/generic-executor.ts
220
+ import { groq as groq2 } from "@ai-sdk/groq";
221
+ import { defaultSettingsMiddleware as defaultSettingsMiddleware2, wrapLanguageModel as wrapLanguageModel2 } from "ai";
222
+ import { agent as agent2 } from "@deepagents/agent";
223
+ import { scratchpad_tool as scratchpad_tool2, search_content_tool } from "@deepagents/toolbox";
224
+ var executorAgent = agent2({
225
+ name: "executor_agent",
226
+ model: wrapLanguageModel2({
227
+ model: groq2("openai/gpt-oss-20b"),
228
+ middleware: defaultSettingsMiddleware2({
229
+ settings: { temperature: 0 }
230
+ })
231
+ }),
232
+ prompt: `
233
+ <SystemContext>
234
+ You are a precise execution agent that follows plans and gathers information systematically.
235
+ You pay close attention to details and track what you find.
236
+ </SystemContext>
237
+
238
+ <Identity>
239
+ Your task is to execute a single step from a plan and report back with structured results.
240
+ You are part of an adaptive planning system where your findings will influence future steps.
241
+ </Identity>
242
+
243
+ <ExecutionPrinciples>
244
+ 1. **Focus on the Objective**
245
+ - Understand exactly what this step is asking for
246
+ - Review the expected outcome
247
+ - Stay focused on gathering that specific information
248
+
249
+ 2. **Extract Variables and Numerals**
250
+ - As you find information, extract key data points
251
+ - **CRITICAL: Extract numerical values separately from units**
252
+ - Store them as structured variables (e.g., {product_name: "iPhone 15", release_date: "Sep 2024", release_month: 9, release_year: 2024})
253
+ - Track counts, amounts, dates, and measurements explicitly
254
+ - These variables help track progress across steps
255
+
256
+ 3. **Calculate Intermediate Results**
257
+ - Pay attention to correct numerical calculation and commonsense
258
+ - Perform any required calculations step-by-step
259
+ - Verify numerical accuracy (e.g., date ranges, counts, sums)
260
+ - Check results against common sense (e.g., dates in valid range, reasonable quantities)
261
+ - Show your calculation work when computing values
262
+
263
+ 4. **Verify Results**
264
+ - Carefully review what you find for accuracy
265
+ - Ensure numerical values are consistent
266
+ - Check for logical coherence
267
+ - Note anything unexpected or inconsistent
268
+
269
+ 5. **Make Observations**
270
+ - What patterns did you notice?
271
+ - What numerical trends are apparent?
272
+ - What might affect subsequent steps?
273
+
274
+ 6. **Note Issues**
275
+ - Were there any calculation difficulties?
276
+ - Was the information hard to find?
277
+ - Were there any errors or ambiguities?
278
+ </ExecutionPrinciples>
279
+
280
+
281
+ <ContextAwareness>
282
+ You will be given:
283
+ - The current step to execute
284
+ - The original user request (for context)
285
+ - Variables gathered from previous steps
286
+ - Data collected so far
287
+
288
+ Use this context to:
289
+ - Avoid re-gathering information you already have
290
+ - Build on previous findings
291
+ - Connect new information to what's already known
292
+ </ContextAwareness>
293
+
294
+ <ReportingGuidelines>
295
+ Your report should include:
296
+
297
+ 1. **Status**
298
+ - success: Step completed as expected
299
+ - partial: Got some but not all information
300
+ - failed: Could not complete the step
301
+
302
+ 2. **Data Gathered**
303
+ - Summarize what you found
304
+ - Be specific and factual
305
+ - Include enough detail to be useful
306
+
307
+ 3. **Extracted Variables and Numerals**
308
+ - Key data points you discovered
309
+ - Format as key-value pairs with numerical values separated
310
+ - Examples: {count: 5, average_price: 299, latest_date: "2024-01-15", date_month: 1, date_year: 2024}
311
+ - Include any intermediate calculations performed
312
+
313
+ 4. **Observations**
314
+ - Notable patterns or insights
315
+ - Anything that might affect the plan
316
+ - Connections to the overall goal
317
+
318
+ 5. **Issues**
319
+ - Any problems encountered
320
+ - Missing or unclear information
321
+ - Limitations of what you found
322
+ </ReportingGuidelines>
323
+
324
+ <Examples>
325
+ Step: "Find Apple's official announcements from the past 3 months"
326
+ Context: {company: "Apple", timeframe: "3 months"}
327
+
328
+ Good Execution:
329
+ - Use browser_search to find Apple newsroom/press releases
330
+ - Filter results to last 3 months
331
+ - List the announcements found
332
+ - Extract count, dates, types
333
+ - Note any gaps or issues
334
+
335
+ Report (with numerical extraction):
336
+ - Status: success
337
+ - Data: "Found 15 press releases from Apple newsroom (Oct-Dec 2024)"
338
+ - Variables: {
339
+ press_release_count: 15,
340
+ date_range: "Oct-Dec 2024",
341
+ start_month: 10,
342
+ end_month: 12,
343
+ year: 2024,
344
+ months_covered: 3
345
+ }
346
+ - Observations: ["Mix of product, service, and corporate announcements", "Exactly covers the requested 3-month timeframe"]
347
+ - Issues: []
348
+ </Examples>
349
+
350
+ <CriticalInstructions>
351
+ - Execute the step precisely as described
352
+ - **Extract numerical variables and their values separately**
353
+ - **Pay attention to correct numerical calculation and commonsense**
354
+ - Calculate and verify intermediate results step-by-step
355
+ - Report accurately with verified numbers - your results influence future steps
356
+ - Use the context from previous steps to work smarter
357
+ - If you can't find something, say so clearly
358
+ - Double-check all numerical values for accuracy
359
+ </CriticalInstructions>
360
+
361
+ <OutputFormat>
362
+ Provide a structured step result with:
363
+ - status (success/partial/failed)
364
+ - data_gathered (summary of findings)
365
+ - extracted_variables (key-value pairs)
366
+ - observations (notable insights)
367
+ - issues (any problems)
368
+ </OutputFormat>
369
+ `,
370
+ tools: {
371
+ scratchpad: scratchpad_tool2,
372
+ search: search_content_tool
373
+ // browser_search: groq.tools.browserSearch({}),
374
+ }
375
+ });
376
+
377
+ // packages/orchestrator/src/lib/deepplan/planner-agent.ts
378
+ import { defaultSettingsMiddleware as defaultSettingsMiddleware3, wrapLanguageModel as wrapLanguageModel3 } from "ai";
379
+ import z from "zod";
380
+ import { lmstudio } from "@deepagents/agent";
381
+ import {
382
+ ContextEngine,
383
+ InMemoryContextStore,
384
+ fragment,
385
+ persona,
386
+ structuredOutput,
387
+ user
388
+ } from "@deepagents/context";
389
+ var PlanStepSchema = z.object({
390
+ description: z.string().describe("What information to find or action to take"),
391
+ expected_outcome: z.string().describe("What should be accomplished by this step")
392
+ });
393
+ var PlannerOutputSchema = z.object({
394
+ understanding: z.string().describe("Clear understanding of what the user is asking for and why"),
395
+ variables: z.record(z.string(), z.any()).describe(
396
+ 'Key variables with numerical values extracted from the request. Examples: {company: "Apple", timeframe_value: 3, timeframe_unit: "months", min_salary: 150000}'
397
+ ),
398
+ constraints: z.array(z.string()).default([]).describe("Any constraints or limitations mentioned"),
399
+ success_criteria: z.string().describe("How to know if the task was completed successfully"),
400
+ steps: z.array(PlanStepSchema).min(1).max(4).describe("Ordered list of steps to execute")
401
+ });
402
+ var plannerModel = wrapLanguageModel3({
403
+ model: lmstudio("google/gemma-3-12b"),
404
+ // model: groq('moonshotai/kimi-k2-instruct-0905'),
405
+ middleware: defaultSettingsMiddleware3({
406
+ settings: { temperature: 0.3 }
407
+ // Slightly creative for better planning
408
+ })
409
+ });
410
+
411
+ // packages/orchestrator/src/lib/deepplan/replanner-agent.ts
412
+ import { defaultSettingsMiddleware as defaultSettingsMiddleware4, wrapLanguageModel as wrapLanguageModel4 } from "ai";
413
+ import z2 from "zod";
414
+ import { lmstudio as lmstudio2 } from "@deepagents/agent";
415
+ import {
416
+ ContextEngine as ContextEngine2,
417
+ InMemoryContextStore as InMemoryContextStore2,
418
+ fragment as fragment2,
419
+ persona as persona2,
420
+ structuredOutput as structuredOutput2,
421
+ user as user2
422
+ } from "@deepagents/context";
423
+ var PlanStepSchema2 = z2.object({
424
+ description: z2.string().describe("What information to find or action to take"),
425
+ expected_outcome: z2.string().describe("What should be accomplished by this step")
426
+ });
427
+ var ReplanDecisionSchema = z2.object({
428
+ reasoning: z2.string().describe("Why this replanning decision was made"),
429
+ should_continue: z2.boolean().describe("Should we continue executing?"),
430
+ remaining_steps: z2.array(PlanStepSchema2).max(4).describe("Updated list of remaining steps"),
431
+ new_insights: z2.string().describe("New insights learned that affected the plan")
432
+ });
433
+ var replannerModel = wrapLanguageModel4({
434
+ // model: groq('moonshotai/kimi-k2-instruct-0905'),
435
+ model: lmstudio2("google/gemma-3-12b"),
436
+ middleware: defaultSettingsMiddleware4({
437
+ settings: { temperature: 0.1 }
438
+ })
439
+ });
440
+
441
+ // packages/orchestrator/src/lib/deepplan/synthesizer.ts
442
+ import { agent as agent3, execute, lmstudio as lmstudio3, user as user3 } from "@deepagents/agent";
443
+ var synthesizer = agent3({
444
+ name: "synthesizer_agent",
445
+ model: lmstudio3("google/gemma-3-12b"),
446
+ prompt: `
447
+ <SystemContext>
448
+ You are a synthesizer agent that compiles the results of executed plan steps into a final answer.
449
+ You ensure accuracy and coherence in the final output.
450
+ </SystemContext>
451
+
452
+ <Identity>
453
+ Your task is to take the individual step results and synthesize them into a coherent final response that addresses the original user request.
454
+ </Identity>
455
+
456
+ <ConstraintDetection>
457
+ **CRITICAL: Check the original request for output constraints FIRST**
458
+ </ConstraintDetection>
459
+
460
+ <SynthesisPrinciples>
461
+ 1. **Verify Numerical Accuracy**
462
+ - Check all numerical values for consistency
463
+ - Ensure calculations are correct across steps
464
+ - Verify dates, counts, and measurements make sense
465
+
466
+ 2. **Apply Commonsense Validation**
467
+ - Do the results make logical sense?
468
+ - Are there any contradictions or inconsistencies?
469
+ - Do temporal relationships align (e.g., dates in proper order)?
470
+
471
+ 3. **Aggregate Intermediate Results**
472
+ - Combine findings from multiple steps coherently
473
+ - Preserve important numerical details
474
+ - Show clear connections between steps
475
+
476
+ 4. **Show the Answer Clearly**
477
+ - Present the final answer in a structured format
478
+ - Highlight key numerical findings
479
+ - Make the conclusion explicit and unambiguous
480
+ </SynthesisPrinciples>
481
+
482
+ <Instructions>
483
+ 1. **Read the original user request carefully** and identify any output constraints
484
+ 2. Review all step results carefully
485
+ 3. **Verify numerical consistency and commonsense**
486
+ 4. If constraints exist: compile results according to constraints (minimal output)
487
+ 5. If no constraints: synthesize insights into a comprehensive answer
488
+ 6. **Show the answer clearly** with verified numbers and logical coherence
489
+
490
+ CRITICAL:
491
+ - Always prioritize explicit constraints over comprehensive analysis
492
+ - When in doubt about constraints, prefer minimal output
493
+ - Verify numerical accuracy before finalizing
494
+ - Check for commonsense and logical coherence
495
+ - The final answer should be well-structured and easy to understand
496
+ </Instructions>
497
+ `
498
+ });
499
+
500
+ // packages/orchestrator/src/lib/deepplan/demo.ts
501
+ var input = `
502
+ As a technology analyst, display a list products that have received investment funding within the past month. Format the output as a structured table with the following columns: Tool Name, Tool Website, Funding announcement link, Description, Funding Amount, Investor(s), and Date of Investment.
503
+
504
+ if no tool has received funding in the past month, simply respond with "No new developer tool funding announcements in the past month with explanation on how you got there."
505
+ `;
506
+ var state = {
507
+ repo_path: "/Users/ezzabuzaid/Desktop/mo/cold-ambulance",
508
+ environment: {
509
+ executor_type: "hackernews_search",
510
+ available_tools: hackerNewsExecutor.toolsNames
511
+ }
512
+ };
513
+ if (import.meta.main) {
514
+ const final = await generate2(hackerNewsExecutor, [user5(input)], state);
515
+ await writeFile("state.json", JSON.stringify(state, null, 2));
516
+ await writeFile("final.md", final.text);
517
+ }
518
+ //# sourceMappingURL=demo.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/lib/deepplan/demo.ts", "../../../src/lib/deepplan/executors/hackernews-executor.ts", "../../../src/lib/deepplan/plan-and-solve.ts", "../../../src/lib/deepplan/executors/generic-executor.ts", "../../../src/lib/deepplan/planner-agent.ts", "../../../src/lib/deepplan/replanner-agent.ts", "../../../src/lib/deepplan/synthesizer.ts"],
4
+ "sourcesContent": ["import { writeFile } from 'node:fs/promises';\n\nimport { generate, user } from '@deepagents/agent';\n\nimport { hackerNewsExecutor } from './executors/hackernews-executor.ts';\nimport { planAndSolve } from './plan-and-solve.ts';\n\nconst input = `\nAs a technology analyst, display a list products that have received investment funding within the past month. Format the output as a structured table with the following columns: Tool Name, Tool Website, Funding announcement link, Description, Funding Amount, Investor(s), and Date of Investment.\n\nif no tool has received funding in the past month, simply respond with \"No new developer tool funding announcements in the past month with explanation on how you got there.\"\n`;\n\nconst state = {\n repo_path: '/Users/ezzabuzaid/Desktop/mo/cold-ambulance',\n environment: {\n executor_type: 'hackernews_search',\n available_tools: hackerNewsExecutor.toolsNames,\n },\n};\n\n// const final = await planAndSolve({\n// input,\n// executor: hackerNewsExecutor,\n// state: state,\n// hooks: {\n// onInitialPlan: async (context) => {\n// await writeFile('ps_initial_plan.json', JSON.stringify(context, null, 2));\n// },\n// afterReplan: async (context) => {\n// await writeFile(\n// `ps_replanned_context-${Date.now()}.json`,\n// JSON.stringify(context, null, 2),\n// );\n// },\n// },\n// });\n\nif (import.meta.main) {\n const final = await generate(hackerNewsExecutor, [user(input)], state);\n await writeFile('state.json', JSON.stringify(state, null, 2));\n await writeFile('final.md', final.text);\n}\n", "import { groq } from '@ai-sdk/groq';\nimport { defaultSettingsMiddleware, wrapLanguageModel } from 'ai';\n\nimport { agent } from '@deepagents/agent';\nimport { hackernewsTools, scratchpad_tool } from '@deepagents/toolbox';\n\nexport const hackerNewsExecutor = agent({\n name: 'hackernews_research_executor',\n model: wrapLanguageModel({\n model: groq('openai/gpt-oss-20b'),\n middleware: defaultSettingsMiddleware({\n settings: { temperature: 0 },\n }),\n }),\n prompt: `\n <SystemContext>\n You are a HackerNews research specialist that uses the HN Algolia API to gather insights,\n track discussions, and analyze community sentiment on technology topics.\n </SystemContext>\n\n <Identity>\n Your task is to execute research steps that involve HackerNews data:\n - Search for relevant stories and discussions\n - Analyze community sentiment and opinions\n - Track trending topics and technologies\n - Find expert perspectives on technical subjects\n - Gather user feedback on products and services\n - Identify influential voices and key discussions\n </Identity>\n\n <ResearchPrinciples>\n 1. **Strategic Searching**\n - Choose appropriate search terms and filters\n - Consider whether to search stories, comments, or both\n - Use time filters to get recent or historical data\n - Filter by author for specific perspectives\n - Sort by relevance for best matches or by date for chronological analysis\n\n 2. **Content Analysis**\n - Look for patterns in discussions\n - Identify common themes and concerns\n - Note points of agreement and disagreement\n - Track sentiment (positive, negative, neutral)\n - Recognize influential discussions (high points, many comments)\n\n 3. **Context Awareness**\n - Understand HN culture and communication style\n - Recognize that HN users tend to be technically sophisticated\n - Consider the timestamp of discussions (tech changes rapidly)\n - Note the author's credibility when relevant\n - Be aware of HN's focus areas: startups, programming, tech trends\n\n 4. **Insight Extraction**\n - Summarize key points from discussions\n - Identify consensus views vs. controversial opinions\n - Note technical details and implementation experiences\n - Capture links to resources mentioned in discussions\n\n 5. **Data Synthesis**\n - Combine insights from multiple threads\n - Track evolving opinions over time\n - Compare different perspectives\n - Identify gaps or unanswered questions\n - Organize findings into actionable insights\n </ResearchPrinciples>\n\n <SearchStrategy>\n When executing a research step:\n\n 1. **Plan Your Searches**\n - What specific information are you looking for?\n - What search terms will yield the best results?\n - Should you search stories, comments, or both?\n - What time frame is relevant?\n - Are specific authors important?\n\n 2. **Execute Searches**\n - Start with broad searches to understand the landscape\n - Refine searches based on initial findings\n - Use multiple search variations to avoid missing content\n - Consider both popularity (relevance) and recency (date sorting)\n - Use the scratchpad to track what you've searched\n\n 3. **Analyze Results**\n - Read titles and summaries carefully\n - Check points and comment counts for engagement levels\n - Note patterns across multiple results\n - Identify outliers or unique perspectives\n - Click through to full discussions mentally (via objectID)\n\n 4. **Extract Insights**\n - Summarize what the HN community thinks\n - Identify key arguments and counterarguments\n - Extract technical details and experiences\n - Capture relevant links and resources\n\n 5. **Reflect and Iterate**\n - Use scratchpad to track findings\n - Note if additional searches are needed\n - Identify information gaps\n - Plan follow-up research if necessary\n </SearchStrategy>\n\n <HackerNewsKnowledge>\n **Content Types:**\n - Stories: Submissions that link to articles, blog posts, or start discussions\n - Comments: Replies and discussions on stories\n - Ask HN: Questions posed to the community (tagged as stories)\n - Show HN: Projects and products shared with the community\n\n **Understanding Points:**\n - Points indicate upvotes (community interest/approval)\n - High points = widely appreciated or important\n - Low/no points \u2260 low quality, might be new or niche\n\n **Notable Users:**\n - pg (Paul Graham): YC founder, essays on startups\n - sama (Sam Altman): Former YC president, OpenAI CEO\n - dang: HN moderator\n - tptacek, patio11, and others: Regular technical contributors\n\n **Culture:**\n - Values: Technical depth, intellectual honesty, thoughtful discussion\n - Dislikes: Hype, sensationalism, self-promotion, shallow analysis\n - Best discussions: Often have many comments relative to points\n </HackerNewsKnowledge>\n\n <ExecutionWorkflow>\n Start with scratchpad tool then use it to track your research process. For each research step:\n\n 1. **Understand the Objective**\n - What is the research question?\n - What information needs to be gathered from HN?\n - What time period is relevant?\n\n 2. **Plan Searches**\n - Brainstorm search terms and filters\n - Use scratchpad to outline search strategy\n - Consider multiple approaches\n\n 3. **Execute Searches**\n - Run initial broad searches\n - Refine based on results\n - Try variations (stories vs comments, time filters, etc.)\n - Use scratchpad to track what you've searched\n\n 4. **Analyze Results**\n - Review all results carefully\n - Note patterns and trends\n - Extract key insights\n - Identify interesting discussions\n - Use scratchpad for notes\n\n 5. **Synthesize Findings**\n - Summarize what you learned\n - Extract key variables and data points\n - Note sentiment and consensus\n - Identify useful discussions or resources\n - Make observations about implications\n\n </ExecutionWorkflow>\n\n <ToolsUsage>\n - Use the \"scratchpad\" tool to keep track of your research process (e.g., log which threads you've reviewed and next steps).\n - Use the \"search_by_query\" tool to find relevant HackerNews posts (e.g., surface discussions about \"vector databases\").\n - Use the \"search_by_author\" tool to highlight contributions from influential users (e.g., pull recent insights from \"pg\").\n - Use the \"search_by_domain\" tool to follow conversations tied to a product or company (e.g., compile posts referencing \"openai.com\").\n - Use the \"search_highly_discussed\" tool to locate threads with intense engagement (e.g., debates with 100+ comments on AI hiring).\n - Use the \"search_trending\" tool to catch emerging topics gaining momentum (e.g., newly active conversations on \"local LLMs\").\n - Use the \"search_ask_hn\" tool to surface community questions that reveal pain points (e.g., Ask HN threads about remote work tooling).\n - Use the \"search_show_hn\" tool to capture project launches and demos (e.g., Show HN posts introducing new developer tools).\n - Use the \"search_jobs\" tool to scan hiring trends and opportunities (e.g., companies recruiting for \"Rust\" engineers).\n - Use the \"search_polls\" tool to assess sentiment snapshots (e.g., polls comparing preferred frontend frameworks).\n - Use the \"get_front_page_stories\" tool to review what the community is elevating right now (e.g., top stories worth summarizing).\n - Use the \"get_story_item\" tool to retrieve full story details (e.g., verify title, URL, and score before citing).\n - Use the \"get_story_comments\" tool to capture the full conversation on a story (e.g., aggregate perspectives on a product launch).\n - Use the \"get_story_comment\" tool to inspect a single remark in depth (e.g., quote a founder's firsthand testimony).\n - Use the \"get_user_profile\" tool to evaluate contributor credibility (e.g., check karma and activity for \"tptacek\").\n - Use the \"time filters\" to focus on recent or historical discussions as needed (e.g., compare last week's sentiment with last year's).\n </ToolsUsage>\n\n <CriticalInstructions>\n - Execute searches strategically and thoroughly\n - Use \"scratchpad\" tool to track your research process\n - Extract meaningful insights from results\n - Report accurately with supporting evidence\n - Focus on quality over quantity of searches\n - Be objective in analyzing sentiment and opinions\n - Provide specific examples from discussions\n - Note limitations and gaps in findings\n </CriticalInstructions>\n\n <ContextAwareness>\n Use \"scratchpad\" tool to maintain context of your research journey.\n\n Use this context to:\n - Avoid repeating previous searches\n - Build on earlier findings\n - Connect new insights to what's already known\n - Track progress toward the research goal\n </ContextAwareness>\n `,\n tools: {\n scratchpad: scratchpad_tool,\n ...hackernewsTools,\n },\n});\n", "import { pl } from 'zod/v4/locales';\n\nimport {\n type Agent,\n type ContextVariables,\n execute,\n generate,\n user,\n} from '@deepagents/agent';\n\nimport {\n type ExecutionContext,\n formatStepForExecutor,\n} from './executors/generic-executor.ts';\nimport { type PlanStep, plan } from './planner-agent.ts';\nimport { replan } from './replanner-agent.ts';\nimport { synthesize } from './synthesizer.ts';\n\n/**\n * Lifecycle hooks for Plan-and-Solve execution.\n *\n * These hooks allow you to intercept and react to key points in the execution lifecycle,\n * enabling progress tracking, persistence, notifications, and custom logic injection.\n *\n * **Important:** You can manually terminate the execution loop by setting `context.is_complete = true`\n * in either hook. This allows you to stop execution early based on custom conditions (e.g., user cancellation,\n * resource limits, or completion detection).\n */\nexport interface PlanHooks {\n /**\n * Hook executed immediately after the initial plan is created.\n *\n * **When to use:**\n * - Review and validate the initial plan\n * - Persist the initial plan to storage\n * - Log the planned steps for auditing\n * - Modify the plan before execution starts\n * - Display the plan to users for confirmation\n * - Estimate total execution time or cost\n * - **Terminate execution before it starts** by setting `context.is_complete = true`\n *\n * **Timing:** After the planner agent creates the initial plan, before any step execution\n *\n * @param context - Initial execution context with the complete plan\n * @returns Modified context (or undefined to keep current context)\n *\n * @example\n * ```typescript\n * onInitialPlan: async (context) => {\n * // Log the initial plan\n * console.log(`Plan created with ${context.current_plan.length} steps`);\n *\n * // Save for later review\n * await writeFile('initial_plan.json', JSON.stringify(context, null, 2));\n *\n * // Validate plan isn't too complex\n * if (context.current_plan.length > 20) {\n * console.error('Plan too complex, aborting');\n * context.is_complete = true;\n * }\n *\n * return context;\n * }\n * ```\n */\n onInitialPlan?: (\n context: ExecutionContext,\n ) => Promise<ExecutionContext | void> | ExecutionContext | void;\n\n /**\n * Hook executed before replanning occurs (after a step completes).\n *\n * **When to use:**\n * - Save execution progress/checkpoints\n * - Log intermediate results for auditing\n * - Modify context before the replanner evaluates it\n * - Track execution metrics\n * - Stream progress updates to a client/UI\n * - **Terminate execution early** by setting `context.is_complete = true`\n *\n * **Timing:** After a step executes, before the replanner agent runs\n *\n * @param context - Current execution state including completed step results\n * @returns Modified context (or undefined to keep current context)\n */\n beforeReplan?: (\n context: ExecutionContext,\n ) => Promise<ExecutionContext | void> | ExecutionContext | void;\n\n /**\n * Hook executed after replanning occurs and the plan is updated.\n *\n * **When to use:**\n * - Persist the updated plan to storage\n * - Log plan changes and reasoning\n * - Notify users of plan adjustments\n * - Update progress indicators\n * - Implement custom plan filtering/validation\n * - Stream plan updates to a dashboard\n * - Send alerts if major changes occur\n * - **Terminate execution early** by setting `context.is_complete = true`\n *\n * **Timing:** After the replanner agent has updated the plan, before next step execution\n *\n * @param context - Current execution state with updated plan\n * @returns Modified context (or undefined to keep current context)\n */\n afterReplan?: (\n context: ExecutionContext,\n ) => Promise<ExecutionContext | void> | ExecutionContext | void;\n}\n\nasync function runExecutor(\n agent: Agent<any, any>,\n context: ExecutionContext,\n step: PlanStep,\n state: ContextVariables,\n) {\n const { text } = await generate(\n agent,\n [user(formatStepForExecutor(step, context))],\n state,\n );\n return {\n ...context,\n variables: { ...context.variables },\n step_results: [...context.step_results, text],\n };\n}\n\n/**\n * Executes a Plan-and-Solve Plus (PS+) workflow with adaptive replanning.\n *\n * This function creates a complete autonomous task execution pipeline:\n * 1. Plans the task into specific steps\n * 2. Executes each step sequentially\n * 3. Replans after each execution to adapt based on results\n * 4. Synthesizes results into a final output\n *\n * @param options - Configuration for the plan-and-solve execution\n * @param options.input - The user's request or task description\n * @param options.executor - The agent that will execute individual plan steps\n * @param options.state - Execution context variables (e.g., repo_path, API keys)\n * @param options.hooks - Optional lifecycle hooks for extensibility (see {@link PlanHooks})\n *\n * @example\n * ```typescript\n * const result = await planAndSolve({\n * input: \"Find all AI startups that raised Series A\",\n * executor: researchExecutor,\n * state: {\n * repo_path: process.cwd()\n * },\n * environment: {\n * executor_type: 'research',\n * available_tools: ['browser_search', 'scratchpad'],\n * domain: 'market research',\n * capabilities: ['web search', 'source verification', 'numerical data extraction']\n * },\n * },\n * hooks: {\n * beforeReplan: async (context) => {\n * // Save progress before replanning\n * await saveCheckpoint(context);\n * return context;\n * },\n * afterReplan: async (context) => {\n * // Log plan updates\n * console.log(`Updated plan: ${context.current_plan.length} steps remaining`);\n * return context;\n * }\n * }\n * });\n * ```\n */\nexport async function planAndSolve(options: {\n input: string;\n executor: Agent<any, any>;\n state: ContextVariables;\n hooks?: PlanHooks;\n}) {\n let context = await plan(options.input);\n const plans = [context.current_plan];\n\n if (options.hooks?.onInitialPlan) {\n const initialPlanResult = await options.hooks.onInitialPlan(context);\n if (initialPlanResult) {\n context = initialPlanResult;\n }\n }\n\n if (context.is_complete) {\n return synthesize(context.step_results, context.original_request);\n }\n\n while (context.current_plan.length > 0) {\n const currentStep = context.current_plan[0];\n context = await runExecutor(\n options.executor,\n context,\n currentStep,\n options.state,\n );\n if (options.hooks?.beforeReplan) {\n const beforeReplanResult = await options.hooks.beforeReplan(context);\n if (beforeReplanResult) {\n context = beforeReplanResult;\n }\n }\n if (context.is_complete) {\n // User requested early termination\n break;\n }\n\n // -- Start Replanning --\n context = await replan(context);\n plans.push(context.current_plan);\n // -- End Replanning --\n\n if (options.hooks?.afterReplan) {\n const afterReplanResult = await options.hooks.afterReplan(context);\n if (afterReplanResult) {\n context = afterReplanResult;\n }\n }\n\n if (context.is_complete) {\n break;\n }\n }\n\n options.state.plans = plans;\n return synthesize(context.step_results, context.original_request);\n}\n", "import { groq } from '@ai-sdk/groq';\nimport { defaultSettingsMiddleware, wrapLanguageModel } from 'ai';\n\nimport { agent } from '@deepagents/agent';\nimport { scratchpad_tool, search_content_tool } from '@deepagents/toolbox';\n\nimport type { PlanStep, PlannerOutput } from '../planner-agent.ts';\n\n/**\n * Executor Agent\n *\n * Executes individual plan steps while:\n * 1. Tracking what information is gathered\n * 2. Extracting numerical variables from results\n * 3. Calculating intermediate results with attention to accuracy\n * 4. Paying attention to correct numerical calculation and commonsense\n * 5. Making observations about findings\n * 6. Noting any issues or unexpected results\n */\nexport const executorAgent = agent({\n name: 'executor_agent',\n model: wrapLanguageModel({\n model: groq('openai/gpt-oss-20b'),\n middleware: defaultSettingsMiddleware({\n settings: { temperature: 0 },\n }),\n }),\n prompt: `\n <SystemContext>\n You are a precise execution agent that follows plans and gathers information systematically.\n You pay close attention to details and track what you find.\n </SystemContext>\n\n <Identity>\n Your task is to execute a single step from a plan and report back with structured results.\n You are part of an adaptive planning system where your findings will influence future steps.\n </Identity>\n\n <ExecutionPrinciples>\n 1. **Focus on the Objective**\n - Understand exactly what this step is asking for\n - Review the expected outcome\n - Stay focused on gathering that specific information\n\n 2. **Extract Variables and Numerals**\n - As you find information, extract key data points\n - **CRITICAL: Extract numerical values separately from units**\n - Store them as structured variables (e.g., {product_name: \"iPhone 15\", release_date: \"Sep 2024\", release_month: 9, release_year: 2024})\n - Track counts, amounts, dates, and measurements explicitly\n - These variables help track progress across steps\n\n 3. **Calculate Intermediate Results**\n - Pay attention to correct numerical calculation and commonsense\n - Perform any required calculations step-by-step\n - Verify numerical accuracy (e.g., date ranges, counts, sums)\n - Check results against common sense (e.g., dates in valid range, reasonable quantities)\n - Show your calculation work when computing values\n\n 4. **Verify Results**\n - Carefully review what you find for accuracy\n - Ensure numerical values are consistent\n - Check for logical coherence\n - Note anything unexpected or inconsistent\n\n 5. **Make Observations**\n - What patterns did you notice?\n - What numerical trends are apparent?\n - What might affect subsequent steps?\n\n 6. **Note Issues**\n - Were there any calculation difficulties?\n - Was the information hard to find?\n - Were there any errors or ambiguities?\n </ExecutionPrinciples>\n\n\n <ContextAwareness>\n You will be given:\n - The current step to execute\n - The original user request (for context)\n - Variables gathered from previous steps\n - Data collected so far\n\n Use this context to:\n - Avoid re-gathering information you already have\n - Build on previous findings\n - Connect new information to what's already known\n </ContextAwareness>\n\n <ReportingGuidelines>\n Your report should include:\n\n 1. **Status**\n - success: Step completed as expected\n - partial: Got some but not all information\n - failed: Could not complete the step\n\n 2. **Data Gathered**\n - Summarize what you found\n - Be specific and factual\n - Include enough detail to be useful\n\n 3. **Extracted Variables and Numerals**\n - Key data points you discovered\n - Format as key-value pairs with numerical values separated\n - Examples: {count: 5, average_price: 299, latest_date: \"2024-01-15\", date_month: 1, date_year: 2024}\n - Include any intermediate calculations performed\n\n 4. **Observations**\n - Notable patterns or insights\n - Anything that might affect the plan\n - Connections to the overall goal\n\n 5. **Issues**\n - Any problems encountered\n - Missing or unclear information\n - Limitations of what you found\n </ReportingGuidelines>\n\n <Examples>\n Step: \"Find Apple's official announcements from the past 3 months\"\n Context: {company: \"Apple\", timeframe: \"3 months\"}\n\n Good Execution:\n - Use browser_search to find Apple newsroom/press releases\n - Filter results to last 3 months\n - List the announcements found\n - Extract count, dates, types\n - Note any gaps or issues\n\n Report (with numerical extraction):\n - Status: success\n - Data: \"Found 15 press releases from Apple newsroom (Oct-Dec 2024)\"\n - Variables: {\n press_release_count: 15,\n date_range: \"Oct-Dec 2024\",\n start_month: 10,\n end_month: 12,\n year: 2024,\n months_covered: 3\n }\n - Observations: [\"Mix of product, service, and corporate announcements\", \"Exactly covers the requested 3-month timeframe\"]\n - Issues: []\n </Examples>\n\n <CriticalInstructions>\n - Execute the step precisely as described\n - **Extract numerical variables and their values separately**\n - **Pay attention to correct numerical calculation and commonsense**\n - Calculate and verify intermediate results step-by-step\n - Report accurately with verified numbers - your results influence future steps\n - Use the context from previous steps to work smarter\n - If you can't find something, say so clearly\n - Double-check all numerical values for accuracy\n </CriticalInstructions>\n\n <OutputFormat>\n Provide a structured step result with:\n - status (success/partial/failed)\n - data_gathered (summary of findings)\n - extracted_variables (key-value pairs)\n - observations (notable insights)\n - issues (any problems)\n </OutputFormat>\n `,\n tools: {\n scratchpad: scratchpad_tool,\n search: search_content_tool,\n // browser_search: groq.tools.browserSearch({}),\n },\n});\n\n/**\n * Format step for executor with full context\n */\nexport function formatStepForExecutor(\n step: PlanStep,\n context: ExecutionContext,\n): string {\n return `\n<UserRequest>${context.original_request}</UserRequest>\n\n<Understanding>${context.understanding}</Understanding>\n\n<CurrentVariables>\n${JSON.stringify(context.variables, null, 2)}\n</CurrentVariables>\n\n<PreviousSteps>\n${context.step_results.length ? context.step_results.map((result, i) => `Step ${i + 1}: ${result}`).join('\\n') : 'No previous steps'}\n</PreviousSteps>\n\n<CurrentStep>\nStep Description: ${step.description}\nExpected Outcome: ${step.expected_outcome}\n</CurrentStep>\n\nExecute this step and provide a detailed report of what you find.\n `.trim();\n}\n\nexport function createExecutionContext(\n request: string,\n plannerOutput: PlannerOutput,\n): ExecutionContext {\n return {\n original_request: request,\n understanding: plannerOutput.understanding,\n initial_plan: plannerOutput.steps,\n current_plan: [...plannerOutput.steps],\n variables: { ...plannerOutput.variables },\n step_results: [],\n is_complete: false,\n };\n}\n\nexport interface ExecutionContext {\n // Request information\n original_request: string;\n understanding: string;\n\n // Planning state\n initial_plan: PlanStep[];\n current_plan: PlanStep[];\n\n // Data collected\n variables: Record<string, string | number | boolean>;\n\n // Execution history\n step_results: string[];\n\n // Status\n is_complete: boolean;\n success_criteria_met?: boolean;\n}\n", "import { defaultSettingsMiddleware, wrapLanguageModel } from 'ai';\nimport z from 'zod';\n\nimport { lmstudio } from '@deepagents/agent';\nimport {\n ContextEngine,\n InMemoryContextStore,\n createBashTool,\n fragment,\n persona,\n structuredOutput,\n user,\n} from '@deepagents/context';\n\nimport { createExecutionContext } from './executors/generic-executor.ts';\n\nconst PlanStepSchema = z.object({\n description: z\n .string()\n .describe('What information to find or action to take'),\n expected_outcome: z\n .string()\n .describe('What should be accomplished by this step'),\n});\n\nexport const PlannerOutputSchema = z.object({\n understanding: z\n .string()\n .describe('Clear understanding of what the user is asking for and why'),\n variables: z\n .record(z.string(), z.any())\n .describe(\n 'Key variables with numerical values extracted from the request. Examples: {company: \"Apple\", timeframe_value: 3, timeframe_unit: \"months\", min_salary: 150000}',\n ),\n constraints: z\n .array(z.string())\n .default([])\n .describe('Any constraints or limitations mentioned'),\n success_criteria: z\n .string()\n .describe('How to know if the task was completed successfully'),\n steps: z\n .array(PlanStepSchema)\n .min(1)\n .max(4)\n .describe('Ordered list of steps to execute'),\n});\n\nexport type PlanStep = z.infer<typeof PlanStepSchema>;\nexport type PlannerOutput = z.infer<typeof PlannerOutputSchema>;\n\n/**\n * Environment context that describes the execution capabilities.\n * This helps the planner create steps that are actually executable.\n */\nexport interface PlanEnvironment {\n /**\n * Type of executor that will execute the steps\n * @example 'research', 'hackernews', 'generic', 'product_manager'\n */\n executor_type: string;\n\n /**\n * Available tools the executor has access to\n * @example ['browser_search', 'scratchpad'], ['hackernews_search', 'scratchpad']\n */\n available_tools: string[];\n\n /**\n * Domain or task category\n * @example 'market research', 'hackernews sentiment analysis', 'code repository search'\n */\n domain: string;\n\n /**\n * High-level capabilities description\n * @example ['web search', 'source verification', 'numerical data extraction']\n */\n capabilities?: string[];\n}\n\n/**\n * Planner agent that creates structured execution plans:\n * 1. Understanding Phase: Deeply understand the user's request\n * 2. Variable Extraction: Extract relevant variables and their corresponding numerical values\n * 3. Plan Devising: Break down into specific, actionable steps\n * 4. Success Criteria: Define how to know when the task is complete\n *\n * Enhanced with adaptive replanning for dynamic task execution.\n */\nconst plannerModel = wrapLanguageModel({\n model: lmstudio('google/gemma-3-12b'),\n // model: groq('moonshotai/kimi-k2-instruct-0905'),\n middleware: defaultSettingsMiddleware({\n settings: { temperature: 0.3 }, // Slightly creative for better planning\n }),\n});\n\nfunction createPlannerPrompt(context?: {\n environment?: PlanEnvironment;\n}): string {\n return `\n <SystemContext>\n You are an expert planning agent that creates adaptive, well-structured plans.\n Plans are executed step-by-step and adjusted as needed based on findings.\n </SystemContext>\n\n <ExecutionEnvironment>\n ${formatEnvironmentContext(context?.environment)}\n\n CRITICAL: Create steps that match the available tools and domain.\n - Only plan steps that can be executed with the available tools\n - Tailor your approach to the executor's domain and capabilities\n - Don't ask for actions the executor cannot perform\n - Frame steps in terms the executor understands\n </ExecutionEnvironment>\n\n <Identity>\n Your task is to deeply understand user requests and create detailed execution plans.\n You excel at:\n - Understanding what users truly need\n - Extracting key variables and constraints\n - Breaking complex tasks into clear, actionable steps\n - Defining success criteria\n - Creating executable plans that match available capabilities\n </Identity>\n\n <PlanningMethodology>\n Follow this two-phase approach:\n First understand the problem, extract relevant variables and their numerical values,\n and devise a plan. Then the plan will be carried out step by step.\n\n ## PHASE 1: Understanding & Analysis\n\n 1. **Understand the Request**\n - What is the user asking for?\n - Why do they need this information?\n - What is the core intent behind the request?\n\n 2. **Extract Variables and Numerals**\n - Identify all key variables (e.g., company names, time periods, categories)\n - **CRITICALLY: Extract numerical values and their units** (e.g., \"3 months\", \"$150k\", \"5 products\")\n - Map variables to their corresponding numerical values (e.g., {timeframe: 3, unit: \"months\"})\n - Note any implicit variables and numerical relationships\n - Identify calculations that may be required\n\n 3. **Identify Constraints**\n - Time constraints (e.g., \"last 3 months\", \"2024\")\n - Category constraints (e.g., \"AI startups\", \"developer tools\")\n - Scope constraints (e.g., \"in Europe\", \"Y Combinator companies\")\n - Quality constraints (e.g., \"above $150k\", \"4-day work week\")\n\n 4. **Define Success**\n - How will we know the task is complete?\n - What must be included in the final result?\n - What level of detail is needed?\n\n ## PHASE 2: Plan Creation\n\n 5. **Devise Subtasks**\n - Break the request into smaller, specific steps\n - Each step should gather ONE specific type of information\n - Make each step independently executable\n\n 6. **Specify Expected Outcomes**\n - For each step, define what should be accomplished\n - This helps the executor know what to deliver\n - This helps the replanner know if the step succeeded\n\n </PlanningMethodology>\n\n <StepDesignPrinciples>\n Each step should:\n \u2713 Be SPECIFIC and ACTIONABLE\n \u2713 Focus on gathering ONE type of information\n \u2713 Start with action verbs: \"Find...\", \"Identify...\", \"Determine...\", \"Extract...\"\n \u2713 Have a clear expected outcome\n \u2713 Be verifiable (can check if it succeeded)\n\n Avoid:\n \u2717 Vague steps like \"Research the topic\"\n \u2717 Implementation details like \"Query the database\"\n \u2717 Multiple objectives in one step\n \u2717 Summary/aggregation steps (that happens automatically)\n \u2717 Delivery steps (system handles that)\n </StepDesignPrinciples>\n\n <Examples>\n Example 1: Web Research Task\n\n User Request: \"Did Apple release any new products in the past 3 months?\"\n Environment: Executor Type: research, Tools: [browser_search, scratchpad], Domain: market research\n\n Understanding: User wants to know about recent Apple product launches\n\n Variables (with numerical values extracted):\n - company: \"Apple\"\n - timeframe_value: 3\n - timeframe_unit: \"months\"\n - info_type: \"product releases\"\n\n Constraints:\n - Only products (not services, updates, etc.)\n - Only last 3 months\n - Apple only (not subsidiaries)\n\n Success Criteria: List of Apple products released in last 3 months with names and dates\n\n Steps (tailored to browser_search capability):\n 1. Search Apple's newsroom for product announcements from the past 3 months\n Expected: List of official press releases and announcements\n\n 2. Identify product-specific announcements (filter out software updates, services)\n Expected: Subset of announcements that are actual product launches\n\n 3. Extract product names and release dates from announcements\n Expected: Product name, date, and brief description for each\n\n ---\n\n Example 2: HackerNews Research Task\n\n User Request: \"What does the tech community think about Rust vs Go?\"\n Environment: Executor Type: hackernews, Tools: [hackernews_search, scratchpad], Domain: hackernews sentiment analysis\n\n Understanding: User wants to understand tech community opinions comparing Rust and Go\n\n Variables:\n - languages: [\"Rust\", \"Go\"]\n - info_type: \"sentiment comparison\"\n\n Constraints:\n - HackerNews community only\n - Recent discussions preferred\n\n Success Criteria: Summary of HN community sentiment on Rust vs Go with key points from both sides\n\n Steps (tailored to hackernews_search capability):\n 1. Search HackerNews for recent discussions about Rust programming language\n Expected: Stories and comments about Rust with engagement metrics\n\n 2. Search HackerNews for recent discussions about Go programming language\n Expected: Stories and comments about Go with engagement metrics\n\n 3. Search HackerNews for direct comparisons between Rust and Go\n Expected: Discussions explicitly comparing the two languages\n </Examples>\n\n <CriticalInstructions>\n - Take time to truly UNDERSTAND the request before planning\n - **Extract ALL relevant variables with their numerical values**\n - Separate numerical values from their units (e.g., 3 and \"months\", not \"3 months\")\n - Identify any calculations or comparisons that will be needed\n - Create focused steps that each have ONE clear purpose\n - Define what success looks like\n - Steps should be about WHAT to find, not HOW to find it\n - Remember: the plan will be adjusted as execution proceeds\n </CriticalInstructions>\n\n <OutputFormat>\n Provide a structured plan with:\n 1. Understanding of the request\n 2. Extracted variables (as key-value pairs)\n 3. Identified constraints\n 4. Success criteria\n 5. Ordered list of steps with expected outcomes.\n </OutputFormat>\n `;\n}\n\n/**\n * Format environment context for the planner prompt\n */\nfunction formatEnvironmentContext(environment?: PlanEnvironment): string {\n if (!environment) {\n return `No specific environment provided. Infer environment from user request.`;\n }\n\n const capabilitiesText = environment.capabilities\n ? `\\n Capabilities: ${environment.capabilities.join(', ')}`\n : '';\n\n return `\n Executor Type: ${environment.executor_type}\n Domain: ${environment.domain}\n Available Tools: ${environment.available_tools.join(', ')}${capabilitiesText}\n `.trim();\n}\n\n/**\n * Create an execution plan for the given user request\n *\n * @param userRequest - The user's task or question\n * @param environment - Optional execution environment describing available tools and domain\n */\nexport async function plan(\n userRequest: string,\n state: { environment?: PlanEnvironment } = {},\n) {\n const context = new ContextEngine({\n store: new InMemoryContextStore(),\n chatId: `planner-${crypto.randomUUID()}`,\n userId: 'system',\n });\n\n context.set(\n persona({\n name: 'planner_agent',\n role: 'You are an expert planning agent that creates adaptive, well-structured plans.',\n objective:\n 'Deeply understand user requests and return executable plans with structured variables, constraints, success criteria, and steps.',\n }),\n fragment('planner_instructions', createPlannerPrompt(state)),\n user(userRequest),\n );\n\n const plannerOutput = structuredOutput({\n model: plannerModel,\n context,\n schema: PlannerOutputSchema,\n });\n\n const output = await plannerOutput.generate();\n return createExecutionContext(\n userRequest,\n output as {\n understanding: string;\n variables: Record<string, unknown>;\n constraints: string[];\n success_criteria: string;\n steps: { description: string; expected_outcome: string }[];\n },\n );\n}\n", "import { defaultSettingsMiddleware, wrapLanguageModel } from 'ai';\nimport z from 'zod';\n\nimport { lmstudio } from '@deepagents/agent';\nimport {\n ContextEngine,\n InMemoryContextStore,\n createBashTool,\n fragment,\n persona,\n structuredOutput,\n user,\n} from '@deepagents/context';\n\nimport { type ExecutionContext } from './executors/generic-executor.ts';\nimport type { PlanStep } from './planner-agent.ts';\n\nconst PlanStepSchema = z.object({\n description: z\n .string()\n .describe('What information to find or action to take'),\n expected_outcome: z\n .string()\n .describe('What should be accomplished by this step'),\n});\nexport const ReplanDecisionSchema = z.object({\n reasoning: z.string().describe('Why this replanning decision was made'),\n should_continue: z.boolean().describe('Should we continue executing?'),\n remaining_steps: z\n .array(PlanStepSchema)\n .max(4)\n .describe('Updated list of remaining steps'),\n new_insights: z\n .string()\n .describe('New insights learned that affected the plan'),\n});\n\nexport type ReplanDecision = z.infer<typeof ReplanDecisionSchema>;\n\n/**\n * Replanner Agent\n *\n * After each step execution, the replanner:\n * 1. Reviews what was accomplished vs what was expected\n * 2. Analyzes how this affects the remaining plan\n * 3. Decides if the plan needs adjustment\n * 4. Updates remaining steps based on new information\n *\n * This creates an adaptive planning system that learns as it executes.\n */\nconst replannerModel = wrapLanguageModel({\n // model: groq('moonshotai/kimi-k2-instruct-0905'),\n model: lmstudio('google/gemma-3-12b'),\n middleware: defaultSettingsMiddleware({\n settings: { temperature: 0.1 },\n }),\n});\n\nfunction createReplannerPrompt(): string {\n return `\n <SystemContext>\n You are an adaptive replanning agent.\n After each step execution, you review progress and adjust the plan as needed.\n </SystemContext>\n\n <Identity>\n Your role is to ensure the execution stays on track and adapts to new information.\n You analyze results, learn from findings, and modify the plan to achieve the goal efficiently.\n </Identity>\n\n <ReplanningPrinciples>\n 1. **Review Results**\n - What was the step supposed to accomplish?\n - What was actually accomplished?\n - Was it successful, partial, or failed?\n\n 2. **Analyze Impact**\n - How do these results affect the overall goal?\n - What did we learn that we didn't know before?\n - Does this change what we need to do next?\n\n 3. **Assess Remaining Plan**\n - Are the remaining steps still appropriate?\n - Do we need additional steps?\n - Can we skip any steps?\n - Should we change the order?\n\n 4. **Make Decisions**\n - Should we continue with the plan?\n - What adjustments are needed?\n - How significant are the changes?\n\n 5. **Update Steps**\n - Modify remaining steps based on learnings\n - Add new steps if needed\n - Remove unnecessary steps\n - Reorder for efficiency\n </ReplanningPrinciples>\n\n <WhenToMakeChanges>\n ## Add Steps When:\n - Found more information than expected (need to filter/process)\n - Discovered new relevant categories (need to explore)\n - Hit limitations (need alternative approaches)\n - Found partial data (need additional sources)\n\n ## Remove Steps When:\n - Already got the information another way\n - The step is no longer relevant based on findings\n - The goal can be achieved without it\n - It's redundant with completed steps\n\n ## Modify Steps When:\n - Need to be more specific based on findings\n - Scope needs adjustment (broader or narrower)\n - Better approach became apparent\n - Need to work around issues discovered\n\n ## Keep Steps When:\n - They're still relevant and needed\n - Results so far support the original plan\n - No better alternative is apparent\n </WhenToMakeChanges>\n\n <ChangeMagnitude>\n Classify plan changes as:\n - **none**: No changes needed, continue as planned\n - **minor**: Small tweaks (wording, ordering, slight additions)\n - **major**: Significant restructuring (many new steps, removed steps, different approach)\n </ChangeMagnitude>\n\n <DecisionMaking>\n Decide if execution should continue:\n\n \u2713 **Continue** when:\n - More steps are needed to complete the goal\n - Making progress toward the objective\n - Can adapt the plan to handle issues\n\n \u2717 **Stop** when:\n - Goal has been fully achieved\n - Discovered the answer isn't available\n - Fundamental blocker that can't be worked around\n - Success criteria have been met\n </DecisionMaking>\n\n <Examples>\n Scenario 1: Found more data than expected\n\n Step Result: Found 50 press releases instead of expected 10-15\n\n Replanning Decision:\n - Reasoning: Large volume needs filtering before analysis\n - Changes: major\n - Add step: \"Filter press releases to product-related only\"\n - Modify next step: Focus on filtered subset\n - Continue: true\n\n ---\n\n Scenario 2: Got exactly what was needed\n\n Step Result: Successfully identified 3 products with all details\n\n Replanning Decision:\n - Reasoning: Already have complete information\n - Changes: none or minor (maybe skip redundant verification step)\n - Continue: Check if success criteria met, might stop\n\n ---\n\n Scenario 3: Information not available\n\n Step Result: Official source doesn't have the data\n\n Replanning Decision:\n - Reasoning: Need alternative data source\n - Changes: major\n - Add step: \"Search tech news sites for announcements\"\n - Continue: true (with new approach)\n </Examples>\n\n <ContextAwareness>\n You have access to:\n - Original user request\n - Initial understanding and success criteria\n - All previous step results\n - Current variables and gathered data\n - The remaining steps in the plan\n\n Use this to make informed replanning decisions.\n </ContextAwareness>\n\n <CriticalInstructions>\n - Be thoughtful but decisive\n - Adapt the plan based on ACTUAL results, not assumptions\n - Keep the end goal in mind (user's original request)\n - Don't keep executing steps if the goal is already achieved\n - Don't abandon the plan too easily - adapt when possible\n - Make changes that improve efficiency and effectiveness\n - Explain your reasoning clearly\n </CriticalInstructions>\n\n <OutputFormat>\n Provide a replanning decision with:\n - reasoning: Why you're making this decision\n - should_continue: true/false\n - remaining_steps: Updated list of steps to execute\n - new_insights: What you learned that affected the plan\n </OutputFormat>\n `;\n}\n\nfunction formatReplannerPrompt(\n context: ExecutionContext,\n remainingSteps: PlanStep[],\n): string {\n const executionHistory = context.step_results\n .map((r, i) => `Step ${i}: ${r}`)\n .join('\\n');\n\n return `\n<OriginalRequest>${context.original_request}</OriginalRequest>\n\n<Understanding>${context.understanding}</Understanding>\n\n<SuccessCriteria>\nCheck if we have achieved the goal of the original request.\n</SuccessCriteria>\n\n<ExecutionHistory>\n${executionHistory}\n</ExecutionHistory>\n\n<MostRecentStep>\n${context.step_results.at(-1) ?? 'No steps executed yet'}\n</MostRecentStep>\n\n<CurrentVariables>\n${JSON.stringify(context.variables, null, 2)}\n</CurrentVariables>\n\n<RemainingSteps>\n${remainingSteps.length > 0 ? remainingSteps.map((s, i) => `${i}. ${s.description} (Expected: ${s.expected_outcome})`).join('\\n') : 'No remaining steps'}\n</RemainingSteps>\n\n<YourTask>\nReview the most recent step result and determine:\n1. Should we continue execution?\n2. Does the plan need adjustment based on what we found?\n3. What should the remaining steps be?\n\nConsider:\n- Did we find what we were looking for?\n- Is the goal achievable with the current approach?\n- Do results suggest a better path forward?\n- Have we already met the success criteria?\n</YourTask>\n `.trim();\n}\n\nexport async function replan(context: ExecutionContext) {\n const remainingSteps = context.current_plan.slice(1);\n const plannerContext = new ContextEngine({\n store: new InMemoryContextStore(),\n chatId: `replanner-${crypto.randomUUID()}`,\n userId: 'system',\n });\n\n plannerContext.set(\n persona({\n name: 'replanner_agent',\n role: 'You are an adaptive replanning agent.',\n objective:\n 'Review execution progress and adjust remaining steps so the plan reaches the original goal efficiently.',\n }),\n fragment('replanner_instructions', createReplannerPrompt()),\n user(formatReplannerPrompt(context, remainingSteps)),\n );\n\n const replannerOutput = structuredOutput({\n model: replannerModel,\n context: plannerContext,\n schema: ReplanDecisionSchema,\n });\n\n const output = await replannerOutput.generate();\n const decision = output as {\n remaining_steps: typeof context.current_plan;\n should_continue: boolean;\n };\n return {\n ...context,\n current_plan: decision.remaining_steps,\n is_complete: !decision.should_continue,\n };\n}\n", "import { agent, execute, lmstudio, user } from '@deepagents/agent';\n\n/**\n * Synthesizer agent that compiles step results into a final answer\n * Applies numerical accuracy and commonsense validation\n */\nconst synthesizer = agent({\n name: 'synthesizer_agent',\n model: lmstudio('google/gemma-3-12b'),\n prompt: `\n\t\t<SystemContext>\n\t\t\tYou are a synthesizer agent that compiles the results of executed plan steps into a final answer.\n\t\t\tYou ensure accuracy and coherence in the final output.\n\t\t</SystemContext>\n\n\t\t<Identity>\n\t\t\tYour task is to take the individual step results and synthesize them into a coherent final response that addresses the original user request.\n\t\t</Identity>\n\n\t\t<ConstraintDetection>\n\t\t\t**CRITICAL: Check the original request for output constraints FIRST**\n\t\t</ConstraintDetection>\n\n\t\t<SynthesisPrinciples>\n\t\t\t1. **Verify Numerical Accuracy**\n\t\t\t\t - Check all numerical values for consistency\n\t\t\t\t - Ensure calculations are correct across steps\n\t\t\t\t - Verify dates, counts, and measurements make sense\n\n\t\t\t2. **Apply Commonsense Validation**\n\t\t\t\t - Do the results make logical sense?\n\t\t\t\t - Are there any contradictions or inconsistencies?\n\t\t\t\t - Do temporal relationships align (e.g., dates in proper order)?\n\n\t\t\t3. **Aggregate Intermediate Results**\n\t\t\t\t - Combine findings from multiple steps coherently\n\t\t\t\t - Preserve important numerical details\n\t\t\t\t - Show clear connections between steps\n\n\t\t\t4. **Show the Answer Clearly**\n\t\t\t\t - Present the final answer in a structured format\n\t\t\t\t - Highlight key numerical findings\n\t\t\t\t - Make the conclusion explicit and unambiguous\n\t\t</SynthesisPrinciples>\n\n\t\t<Instructions>\n\t\t\t1. **Read the original user request carefully** and identify any output constraints\n\t\t\t2. Review all step results carefully\n\t\t\t3. **Verify numerical consistency and commonsense**\n\t\t\t4. If constraints exist: compile results according to constraints (minimal output)\n\t\t\t5. If no constraints: synthesize insights into a comprehensive answer\n\t\t\t6. **Show the answer clearly** with verified numbers and logical coherence\n\n\t\t\tCRITICAL:\n\t\t\t- Always prioritize explicit constraints over comprehensive analysis\n\t\t\t- When in doubt about constraints, prefer minimal output\n\t\t\t- Verify numerical accuracy before finalizing\n\t\t\t- Check for commonsense and logical coherence\n\t\t\t- The final answer should be well-structured and easy to understand\n\t\t</Instructions>\n\t`,\n});\n\nexport async function synthesize(\n stepResults: string[],\n originalRequest: string,\n) {\n const stepResultsText = stepResults\n .map((step, index) => `Step ${index + 1} Result:\\n${step}`)\n .join('\\n\\n');\n\n const prompt = `\nOriginal User Request:\n${originalRequest}\n\n---\n\n${stepResultsText}\n `.trim();\n\n return (await execute(synthesizer, [user(prompt)], {})).text;\n}\n"],
5
+ "mappings": ";AAAA,SAAS,iBAAiB;AAE1B,SAAS,YAAAA,WAAU,QAAAC,aAAY;;;ACF/B,SAAS,YAAY;AACrB,SAAS,2BAA2B,yBAAyB;AAE7D,SAAS,aAAa;AACtB,SAAS,iBAAiB,uBAAuB;AAE1C,IAAM,qBAAqB,MAAM;AAAA,EACtC,MAAM;AAAA,EACN,OAAO,kBAAkB;AAAA,IACvB,OAAO,KAAK,oBAAoB;AAAA,IAChC,YAAY,0BAA0B;AAAA,MACpC,UAAU,EAAE,aAAa,EAAE;AAAA,IAC7B,CAAC;AAAA,EACH,CAAC;AAAA,EACD,Q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,MAAM;AACpB,QAAM,QAAQ,MAAME,UAAS,oBAAoB,CAACC,MAAK,KAAK,CAAC,GAAG,KAAK;AACrE,QAAM,UAAU,cAAc,KAAK,UAAU,OAAO,MAAM,CAAC,CAAC;AAC5D,QAAM,UAAU,YAAY,MAAM,IAAI;AACxC;",
6
+ "names": ["generate", "user", "user", "groq", "defaultSettingsMiddleware", "wrapLanguageModel", "agent", "scratchpad_tool", "defaultSettingsMiddleware", "wrapLanguageModel", "wrapLanguageModel", "defaultSettingsMiddleware", "defaultSettingsMiddleware", "wrapLanguageModel", "z", "lmstudio", "ContextEngine", "InMemoryContextStore", "fragment", "persona", "structuredOutput", "user", "PlanStepSchema", "z", "wrapLanguageModel", "lmstudio", "defaultSettingsMiddleware", "agent", "lmstudio", "user", "generate", "user"]
7
+ }