@agntk/core 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -90
- package/dist/advanced/index.d.ts +9 -2
- package/dist/advanced/index.d.ts.map +1 -1
- package/dist/advanced/index.js +13 -2
- package/dist/advanced/index.js.map +1 -1
- package/dist/agent.d.ts +27 -31
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +251 -280
- package/dist/agent.js.map +1 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +16 -4
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/loader.d.ts +14 -6
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +38 -16
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +52 -52
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +1 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/evals/runner.js +16 -9
- package/dist/evals/runner.js.map +1 -1
- package/dist/evals/types.d.ts +1 -1
- package/dist/evals/types.d.ts.map +1 -1
- package/dist/guardrails/runner.d.ts.map +1 -1
- package/dist/guardrails/runner.js +4 -0
- package/dist/guardrails/runner.js.map +1 -1
- package/dist/index.d.ts +9 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -10
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +24 -1
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +50 -4
- package/dist/models.js.map +1 -1
- package/dist/observability/langfuse.d.ts +2 -2
- package/dist/observability/langfuse.d.ts.map +1 -1
- package/dist/observability/langfuse.js +39 -17
- package/dist/observability/langfuse.js.map +1 -1
- package/dist/presets/sub-agent-configs.d.ts +11 -3
- package/dist/presets/sub-agent-configs.d.ts.map +1 -1
- package/dist/presets/sub-agent-configs.js +5 -10
- package/dist/presets/sub-agent-configs.js.map +1 -1
- package/dist/presets/tools.d.ts +3 -3
- package/dist/provider-resolver.d.ts +38 -0
- package/dist/provider-resolver.d.ts.map +1 -0
- package/dist/provider-resolver.js +142 -0
- package/dist/provider-resolver.js.map +1 -0
- package/dist/reflection.d.ts +5 -2
- package/dist/reflection.d.ts.map +1 -1
- package/dist/reflection.js +8 -3
- package/dist/reflection.js.map +1 -1
- package/dist/skills/loader.d.ts +18 -0
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js +58 -2
- package/dist/skills/loader.js.map +1 -1
- package/dist/system-detect.d.ts +59 -0
- package/dist/system-detect.d.ts.map +1 -0
- package/dist/system-detect.js +193 -0
- package/dist/system-detect.js.map +1 -0
- package/dist/tools/file/tools.d.ts.map +1 -1
- package/dist/tools/file/tools.js +30 -1
- package/dist/tools/file/tools.js.map +1 -1
- package/dist/tools/index.d.ts +0 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +0 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/plan/tools.d.ts +1 -1
- package/dist/tools/plan/types.d.ts +2 -2
- package/dist/tools/progress/index.d.ts +1 -1
- package/dist/tools/shell/background.d.ts.map +1 -1
- package/dist/tools/shell/background.js +45 -3
- package/dist/tools/shell/background.js.map +1 -1
- package/dist/tools/shell/tools.d.ts.map +1 -1
- package/dist/tools/shell/tools.js +9 -2
- package/dist/tools/shell/tools.js.map +1 -1
- package/dist/tools/spawn-agent/index.d.ts +7 -9
- package/dist/tools/spawn-agent/index.d.ts.map +1 -1
- package/dist/tools/spawn-agent/index.js +2 -4
- package/dist/tools/spawn-agent/index.js.map +1 -1
- package/dist/tools/utils/shell.d.ts +14 -0
- package/dist/tools/utils/shell.d.ts.map +1 -1
- package/dist/tools/utils/shell.js +171 -12
- package/dist/tools/utils/shell.js.map +1 -1
- package/dist/types/agent.d.ts +75 -195
- package/dist/types/agent.d.ts.map +1 -1
- package/dist/types/agent.js +4 -2
- package/dist/types/agent.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/usage-limits.d.ts +1 -1
- package/dist/usage-limits.js +1 -1
- package/dist/workflow/index.d.ts +1 -5
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +1 -9
- package/dist/workflow/index.js.map +1 -1
- package/dist/wrappers/best-of-n.d.ts +1 -1
- package/dist/wrappers/best-of-n.d.ts.map +1 -1
- package/dist/wrappers/best-of-n.js +11 -6
- package/dist/wrappers/best-of-n.js.map +1 -1
- package/package.json +4 -14
- package/dist/pool/index.d.ts +0 -7
- package/dist/pool/index.d.ts.map +0 -1
- package/dist/pool/index.js +0 -6
- package/dist/pool/index.js.map +0 -1
- package/dist/pool/specialist-pool.d.ts +0 -59
- package/dist/pool/specialist-pool.d.ts.map +0 -1
- package/dist/pool/specialist-pool.js +0 -224
- package/dist/pool/specialist-pool.js.map +0 -1
- package/dist/pool/tools.d.ts +0 -63
- package/dist/pool/tools.d.ts.map +0 -1
- package/dist/pool/tools.js +0 -83
- package/dist/pool/tools.js.map +0 -1
- package/dist/pool/types.d.ts +0 -79
- package/dist/pool/types.d.ts.map +0 -1
- package/dist/pool/types.js +0 -5
- package/dist/pool/types.js.map +0 -1
- package/dist/presets/index.d.ts +0 -5
- package/dist/presets/index.d.ts.map +0 -1
- package/dist/presets/index.js +0 -5
- package/dist/presets/index.js.map +0 -1
- package/dist/presets/role-registry.d.ts +0 -41
- package/dist/presets/role-registry.d.ts.map +0 -1
- package/dist/presets/role-registry.js +0 -213
- package/dist/presets/role-registry.js.map +0 -1
- package/dist/presets/roles.d.ts +0 -105
- package/dist/presets/roles.d.ts.map +0 -1
- package/dist/presets/roles.js +0 -207
- package/dist/presets/roles.js.map +0 -1
- package/dist/tools/factory.d.ts +0 -109
- package/dist/tools/factory.d.ts.map +0 -1
- package/dist/tools/factory.js +0 -166
- package/dist/tools/factory.js.map +0 -1
- package/dist/workflow/builders/adapt.d.ts +0 -20
- package/dist/workflow/builders/adapt.d.ts.map +0 -1
- package/dist/workflow/builders/adapt.js +0 -33
- package/dist/workflow/builders/adapt.js.map +0 -1
- package/dist/workflow/builders/index.d.ts +0 -8
- package/dist/workflow/builders/index.d.ts.map +0 -1
- package/dist/workflow/builders/index.js +0 -7
- package/dist/workflow/builders/index.js.map +0 -1
- package/dist/workflow/builders/parallel.d.ts +0 -25
- package/dist/workflow/builders/parallel.d.ts.map +0 -1
- package/dist/workflow/builders/parallel.js +0 -60
- package/dist/workflow/builders/parallel.js.map +0 -1
- package/dist/workflow/builders/pipeline.d.ts +0 -22
- package/dist/workflow/builders/pipeline.d.ts.map +0 -1
- package/dist/workflow/builders/pipeline.js +0 -48
- package/dist/workflow/builders/pipeline.js.map +0 -1
- package/dist/workflow/builders/types.d.ts +0 -54
- package/dist/workflow/builders/types.d.ts.map +0 -1
- package/dist/workflow/builders/types.js +0 -5
- package/dist/workflow/builders/types.js.map +0 -1
- package/dist/workflow/schedulers.d.ts +0 -231
- package/dist/workflow/schedulers.d.ts.map +0 -1
- package/dist/workflow/schedulers.js +0 -250
- package/dist/workflow/schedulers.js.map +0 -1
- package/dist/workflow/team/create-team.d.ts +0 -34
- package/dist/workflow/team/create-team.d.ts.map +0 -1
- package/dist/workflow/team/create-team.js +0 -242
- package/dist/workflow/team/create-team.js.map +0 -1
- package/dist/workflow/team/index.d.ts +0 -9
- package/dist/workflow/team/index.d.ts.map +0 -1
- package/dist/workflow/team/index.js +0 -8
- package/dist/workflow/team/index.js.map +0 -1
- package/dist/workflow/team/machines.d.ts +0 -152
- package/dist/workflow/team/machines.d.ts.map +0 -1
- package/dist/workflow/team/machines.js +0 -197
- package/dist/workflow/team/machines.js.map +0 -1
- package/dist/workflow/team/task-board.d.ts +0 -47
- package/dist/workflow/team/task-board.d.ts.map +0 -1
- package/dist/workflow/team/task-board.js +0 -111
- package/dist/workflow/team/task-board.js.map +0 -1
- package/dist/workflow/team/tools.d.ts +0 -66
- package/dist/workflow/team/tools.d.ts.map +0 -1
- package/dist/workflow/team/tools.js +0 -100
- package/dist/workflow/team/tools.js.map +0 -1
- package/dist/workflow/team/types.d.ts +0 -109
- package/dist/workflow/team/types.d.ts.map +0 -1
- package/dist/workflow/team/types.js +0 -5
- package/dist/workflow/team/types.js.map +0 -1
- package/dist/workflow/templates.d.ts +0 -71
- package/dist/workflow/templates.d.ts.map +0 -1
- package/dist/workflow/templates.js +0 -132
- package/dist/workflow/templates.js.map +0 -1
package/dist/presets/roles.js
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @agntk/core - Role Configurations
|
|
3
|
-
*
|
|
4
|
-
* Agent role presets with system prompts and call options.
|
|
5
|
-
* Adapted from packages/core/src/agents/roles.ts
|
|
6
|
-
*/
|
|
7
|
-
import { z } from 'zod';
|
|
8
|
-
// ============================================================================
|
|
9
|
-
// Role Prompts
|
|
10
|
-
// ============================================================================
|
|
11
|
-
export const SPAWNED_AGENT_CONTEXT = `
|
|
12
|
-
# Context: Spawned Sub-Agent
|
|
13
|
-
|
|
14
|
-
You are running as a sub-agent spawned by a parent agent to handle a delegated task.
|
|
15
|
-
|
|
16
|
-
**Constraints:**
|
|
17
|
-
- The delegate tool is disabled to prevent infinite recursion
|
|
18
|
-
- You still have access to fs, shell, web, memory, and task tools
|
|
19
|
-
- Focus on completing the delegated task, then call task_complete
|
|
20
|
-
|
|
21
|
-
Work autonomously until the task is complete.`;
|
|
22
|
-
export const rolePrompts = {
|
|
23
|
-
generic: '',
|
|
24
|
-
researcher: `
|
|
25
|
-
# Role: Research Specialist
|
|
26
|
-
|
|
27
|
-
You excel at gathering, verifying, and synthesizing information from multiple sources.
|
|
28
|
-
|
|
29
|
-
**Core competencies:**
|
|
30
|
-
- Web search and documentation retrieval
|
|
31
|
-
- Cross-referencing claims across sources
|
|
32
|
-
- Distinguishing fact from speculation
|
|
33
|
-
- Summarizing complex topics clearly
|
|
34
|
-
- Identifying knowledge gaps and uncertainties
|
|
35
|
-
|
|
36
|
-
**Approach:**
|
|
37
|
-
1. Start with broad searches to understand the landscape
|
|
38
|
-
2. Drill into authoritative sources for specifics
|
|
39
|
-
3. Verify claims by finding corroborating evidence
|
|
40
|
-
4. Note conflicting information and assess credibility
|
|
41
|
-
5. Synthesize findings into clear, structured summaries
|
|
42
|
-
|
|
43
|
-
**Quality standards:**
|
|
44
|
-
- Cite sources for factual claims
|
|
45
|
-
- Explicitly state confidence levels
|
|
46
|
-
- Acknowledge when information is incomplete or uncertain
|
|
47
|
-
- Prefer primary sources over secondary summaries`,
|
|
48
|
-
coder: `
|
|
49
|
-
# Role: Software Engineer
|
|
50
|
-
|
|
51
|
-
You write production-quality code that integrates cleanly with existing systems.
|
|
52
|
-
|
|
53
|
-
**Core competencies:**
|
|
54
|
-
- Reading and understanding existing codebases
|
|
55
|
-
- Writing clean, maintainable code
|
|
56
|
-
- Testing and validation
|
|
57
|
-
- Debugging and error diagnosis
|
|
58
|
-
- Git operations and version control
|
|
59
|
-
|
|
60
|
-
**Approach:**
|
|
61
|
-
1. Read existing code before writing new code
|
|
62
|
-
2. Follow patterns established in the codebase
|
|
63
|
-
3. Write tests for new functionality
|
|
64
|
-
4. Validate changes compile and pass tests
|
|
65
|
-
5. Make atomic, focused commits
|
|
66
|
-
|
|
67
|
-
**Quality standards:**
|
|
68
|
-
- No commented-out code or TODOs without context
|
|
69
|
-
- Consistent formatting with the codebase
|
|
70
|
-
- Meaningful variable and function names
|
|
71
|
-
- Error handling for edge cases
|
|
72
|
-
- Type safety where applicable`,
|
|
73
|
-
analyst: `
|
|
74
|
-
# Role: Data Analyst
|
|
75
|
-
|
|
76
|
-
You analyze information to extract insights and support decision-making.
|
|
77
|
-
|
|
78
|
-
**Core competencies:**
|
|
79
|
-
- Pattern recognition across datasets
|
|
80
|
-
- Statistical reasoning
|
|
81
|
-
- Data visualization concepts
|
|
82
|
-
- Hypothesis formation and testing
|
|
83
|
-
- Clear communication of findings
|
|
84
|
-
|
|
85
|
-
**Approach:**
|
|
86
|
-
1. Understand what question needs answering
|
|
87
|
-
2. Gather relevant data from available sources
|
|
88
|
-
3. Clean and validate data quality
|
|
89
|
-
4. Apply appropriate analysis methods
|
|
90
|
-
5. Present findings with supporting evidence
|
|
91
|
-
|
|
92
|
-
**Quality standards:**
|
|
93
|
-
- Distinguish correlation from causation
|
|
94
|
-
- Quantify uncertainty in conclusions
|
|
95
|
-
- Consider alternative explanations
|
|
96
|
-
- Present data honestly without cherry-picking
|
|
97
|
-
- Make recommendations actionable`,
|
|
98
|
-
};
|
|
99
|
-
// ============================================================================
|
|
100
|
-
// Base System Prompt (standalone version)
|
|
101
|
-
// ============================================================================
|
|
102
|
-
const baseSystemPrompt = `You are an autonomous AI agent operating in a software development workspace. You have access to tools for reading, writing, and searching files, running shell commands, browsing the web, and delegating to sub-agents. You are in a multi-step execution loop — you will keep working until the task is complete.
|
|
103
|
-
|
|
104
|
-
# Identity and Approach
|
|
105
|
-
|
|
106
|
-
You are a hands-on agent. When given a task, you use your tools to accomplish it directly rather than explaining what the user could do. You think through problems step by step, writing out your reasoning before each tool call so your decision-making is transparent. When a task requires multiple steps, you persist through all of them — you do not stop partway or ask for permission to continue unless the request is genuinely ambiguous.
|
|
107
|
-
|
|
108
|
-
CRITICAL RULES:
|
|
109
|
-
- Never say "I can't", "I don't have access", or "I don't know" without trying a tool first.
|
|
110
|
-
- If you don't know how to answer something, your default action is to use a tool — not to give up.
|
|
111
|
-
- Always prefer action over asking for clarification.
|
|
112
|
-
|
|
113
|
-
# Working with Code
|
|
114
|
-
|
|
115
|
-
Before modifying any file, you read it first to understand its current state and context. You make targeted, minimal edits rather than rewriting entire files. After making changes, you verify they work by running builds, tests, or other validation as appropriate. When exploring an unfamiliar codebase, you start broad (glob for file patterns, grep for content) and narrow down progressively.
|
|
116
|
-
|
|
117
|
-
# Tool Awareness
|
|
118
|
-
|
|
119
|
-
Your tool calls and their results are displayed directly to the user. Because of this, you do not echo or restate tool output in your text responses. Instead, you provide brief interpretation — what the results mean, what you noticed, or what you plan to do next. This keeps the conversation focused and avoids redundancy.
|
|
120
|
-
|
|
121
|
-
# Problem Solving
|
|
122
|
-
|
|
123
|
-
When something goes wrong — a failed command, an unexpected error, a tool call that returns nothing useful — you read the error output, reason about what happened, and try a different approach. You never give up after one failure. If one path doesn't work, you try alternative approaches before concluding something isn't possible. When the user asks you to do something and you're not sure how, try the most obvious approach first — action beats deliberation.
|
|
124
|
-
|
|
125
|
-
# Communication
|
|
126
|
-
|
|
127
|
-
You are direct and concise. You lead with actions and results rather than preamble. After completing work, you briefly summarize what you did and why. If you're uncertain about something, you say so clearly rather than guessing. Never ask the user to clarify something you could figure out by using your tools.`;
|
|
128
|
-
// ============================================================================
|
|
129
|
-
// Combined System Prompts
|
|
130
|
-
// ============================================================================
|
|
131
|
-
export const systemPrompts = {
|
|
132
|
-
generic: baseSystemPrompt,
|
|
133
|
-
researcher: `${baseSystemPrompt}\n${rolePrompts.researcher}`,
|
|
134
|
-
coder: `${baseSystemPrompt}\n${rolePrompts.coder}`,
|
|
135
|
-
analyst: `${baseSystemPrompt}\n${rolePrompts.analyst}`,
|
|
136
|
-
};
|
|
137
|
-
export const AGENT_ROLES = ['generic', 'researcher', 'coder', 'analyst'];
|
|
138
|
-
// ============================================================================
|
|
139
|
-
// Call Options Schema per Role
|
|
140
|
-
// ============================================================================
|
|
141
|
-
export const roleCallOptionsSchemas = {
|
|
142
|
-
generic: z.object({
|
|
143
|
-
userId: z.string().optional(),
|
|
144
|
-
sessionId: z.string().optional(),
|
|
145
|
-
workspaceRoot: z.string().optional(),
|
|
146
|
-
}),
|
|
147
|
-
researcher: z.object({
|
|
148
|
-
userId: z.string().optional(),
|
|
149
|
-
sessionId: z.string().optional(),
|
|
150
|
-
workspaceRoot: z.string().optional(),
|
|
151
|
-
searchDepth: z.enum(['shallow', 'deep']).optional(),
|
|
152
|
-
sourceTypes: z.array(z.string()).optional(),
|
|
153
|
-
}),
|
|
154
|
-
coder: z.object({
|
|
155
|
-
userId: z.string().optional(),
|
|
156
|
-
sessionId: z.string().optional(),
|
|
157
|
-
workspaceRoot: z.string().optional(),
|
|
158
|
-
language: z.string().optional(),
|
|
159
|
-
testingStrategy: z.enum(['unit', 'integration', 'both', 'none']).optional(),
|
|
160
|
-
}),
|
|
161
|
-
analyst: z.object({
|
|
162
|
-
userId: z.string().optional(),
|
|
163
|
-
sessionId: z.string().optional(),
|
|
164
|
-
workspaceRoot: z.string().optional(),
|
|
165
|
-
analysisType: z.enum(['exploratory', 'confirmatory']).optional(),
|
|
166
|
-
outputFormat: z.enum(['summary', 'detailed', 'visual']).optional(),
|
|
167
|
-
}),
|
|
168
|
-
};
|
|
169
|
-
export const roleConfigs = {
|
|
170
|
-
generic: {
|
|
171
|
-
systemPrompt: systemPrompts.generic,
|
|
172
|
-
callOptionsSchema: roleCallOptionsSchemas.generic,
|
|
173
|
-
defaultTools: ['fs', 'shell', 'web'],
|
|
174
|
-
recommendedModel: 'standard',
|
|
175
|
-
},
|
|
176
|
-
researcher: {
|
|
177
|
-
systemPrompt: systemPrompts.researcher,
|
|
178
|
-
callOptionsSchema: roleCallOptionsSchemas.researcher,
|
|
179
|
-
defaultTools: ['web', 'fs', 'reasoning'],
|
|
180
|
-
recommendedModel: 'standard',
|
|
181
|
-
},
|
|
182
|
-
coder: {
|
|
183
|
-
systemPrompt: systemPrompts.coder,
|
|
184
|
-
callOptionsSchema: roleCallOptionsSchemas.coder,
|
|
185
|
-
defaultTools: ['fs', 'shell', 'grep', 'glob'],
|
|
186
|
-
recommendedModel: 'powerful',
|
|
187
|
-
},
|
|
188
|
-
analyst: {
|
|
189
|
-
systemPrompt: systemPrompts.analyst,
|
|
190
|
-
callOptionsSchema: roleCallOptionsSchemas.analyst,
|
|
191
|
-
defaultTools: ['fs', 'reasoning', 'shell'],
|
|
192
|
-
recommendedModel: 'standard',
|
|
193
|
-
},
|
|
194
|
-
};
|
|
195
|
-
// ============================================================================
|
|
196
|
-
// Helpers
|
|
197
|
-
// ============================================================================
|
|
198
|
-
export function buildSpawnedAgentPrompt(role) {
|
|
199
|
-
return `${systemPrompts[role]}\n${SPAWNED_AGENT_CONTEXT}`;
|
|
200
|
-
}
|
|
201
|
-
export function getRoleSystemPrompt(role) {
|
|
202
|
-
return systemPrompts[role];
|
|
203
|
-
}
|
|
204
|
-
export function getRoleCallOptionsSchema(role) {
|
|
205
|
-
return roleCallOptionsSchemas[role];
|
|
206
|
-
}
|
|
207
|
-
//# sourceMappingURL=roles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"roles.js","sourceRoot":"","sources":["../../src/presets/roles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;8CAUS,CAAC;AAE/C,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,OAAO,EAAE,EAAE;IAEX,UAAU,EAAE;;;;;;;;;;;;;;;;;;;;;;;kDAuBoC;IAEhD,KAAK,EAAE;;;;;;;;;;;;;;;;;;;;;;;;+BAwBsB;IAE7B,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;kCAwBuB;CACjC,CAAC;AAEF,+EAA+E;AAC/E,0CAA0C;AAC1C,+EAA+E;AAE/E,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;uTAyB8R,CAAA;AAGvT,+EAA+E;AAC/E,0BAA0B;AAC1B,+EAA+E;AAE/E,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,gBAAgB;IACzB,UAAU,EAAE,GAAG,gBAAgB,KAAK,WAAW,CAAC,UAAU,EAAE;IAC5D,KAAK,EAAE,GAAG,gBAAgB,KAAK,WAAW,CAAC,KAAK,EAAE;IAClD,OAAO,EAAE,GAAG,gBAAgB,KAAK,WAAW,CAAC,OAAO,EAAE;CACvD,CAAC;AAOF,MAAM,CAAC,MAAM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OAAO,CAAC;QAC1C,gBAAgB,EAAE,UAAU;KAC7B;CACF,CAAC;AAEF,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E,MAAM,UAAU,uBAAuB,CAAC,IAAe;IACrD,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,qBAAqB,EAAE,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAe;IACjD,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,IAAe;IACtD,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC"}
|
package/dist/tools/factory.d.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @agntk/core - Tool Factory
|
|
3
|
-
*
|
|
4
|
-
* Factory pattern for creating tool sets with dependency injection.
|
|
5
|
-
* Adapted from packages/core/src/tools/factory.ts
|
|
6
|
-
*/
|
|
7
|
-
import type { Tool } from 'ai';
|
|
8
|
-
/**
|
|
9
|
-
* Dependencies that can be injected into tool creators.
|
|
10
|
-
*/
|
|
11
|
-
export interface ToolDependencies {
|
|
12
|
-
/** Workspace root directory for file operations */
|
|
13
|
-
workspaceRoot?: string;
|
|
14
|
-
/** Directories the agent is allowed to access */
|
|
15
|
-
allowedDirectories?: string[];
|
|
16
|
-
/** Optional UI stream writer for transient data */
|
|
17
|
-
streamWriter?: unknown;
|
|
18
|
-
/** Optional memory store instance */
|
|
19
|
-
memoryStore?: unknown;
|
|
20
|
-
/** Custom context data */
|
|
21
|
-
context?: Record<string, unknown>;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* A set of tools keyed by name.
|
|
25
|
-
*/
|
|
26
|
-
export type ToolSet = Record<string, Tool>;
|
|
27
|
-
/**
|
|
28
|
-
* Function that creates a set of tools given dependencies.
|
|
29
|
-
*/
|
|
30
|
-
export type ToolCreator = (deps: ToolDependencies) => ToolSet;
|
|
31
|
-
/**
|
|
32
|
-
* Factory for registering and creating tools with dependency injection.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```typescript
|
|
36
|
-
* const factory = new ToolFactory();
|
|
37
|
-
*
|
|
38
|
-
* factory.register('search', (deps) => ({
|
|
39
|
-
* glob: createGlobTool({ defaultCwd: deps.workspaceRoot }),
|
|
40
|
-
* grep: createGrepTool({ defaultCwd: deps.workspaceRoot }),
|
|
41
|
-
* }));
|
|
42
|
-
*
|
|
43
|
-
* const tools = factory.createAll({ workspaceRoot: '/my/project' });
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export declare class ToolFactory {
|
|
47
|
-
private factories;
|
|
48
|
-
private creationErrors;
|
|
49
|
-
/**
|
|
50
|
-
* Register a tool creator function.
|
|
51
|
-
*/
|
|
52
|
-
register(name: string, creator: ToolCreator): void;
|
|
53
|
-
/**
|
|
54
|
-
* Unregister a tool creator.
|
|
55
|
-
*/
|
|
56
|
-
unregister(name: string): boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Check if a tool creator is registered.
|
|
59
|
-
*/
|
|
60
|
-
has(name: string): boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Get all registered tool creator names.
|
|
63
|
-
*/
|
|
64
|
-
getRegisteredNames(): string[];
|
|
65
|
-
/**
|
|
66
|
-
* Create tools from a single registered creator.
|
|
67
|
-
*/
|
|
68
|
-
create(name: string, deps: ToolDependencies): ToolSet | null;
|
|
69
|
-
/**
|
|
70
|
-
* Create all registered tools.
|
|
71
|
-
*/
|
|
72
|
-
createAll(deps: ToolDependencies): ToolSet;
|
|
73
|
-
/**
|
|
74
|
-
* Create selected tools by name.
|
|
75
|
-
*/
|
|
76
|
-
createSelected(names: string[], deps: ToolDependencies): ToolSet;
|
|
77
|
-
/**
|
|
78
|
-
* Get errors from the last creation operation.
|
|
79
|
-
*/
|
|
80
|
-
getLastErrors(): Array<{
|
|
81
|
-
name: string;
|
|
82
|
-
error: string;
|
|
83
|
-
}>;
|
|
84
|
-
/**
|
|
85
|
-
* Clear all registered factories.
|
|
86
|
-
*/
|
|
87
|
-
clear(): void;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Default tool factory instance for convenience.
|
|
91
|
-
*/
|
|
92
|
-
export declare const defaultToolFactory: ToolFactory;
|
|
93
|
-
/**
|
|
94
|
-
* Merge multiple tool sets into one.
|
|
95
|
-
*/
|
|
96
|
-
export declare function mergeToolSets(...toolSets: ToolSet[]): ToolSet;
|
|
97
|
-
/**
|
|
98
|
-
* Filter a tool set to only include specified tools.
|
|
99
|
-
*/
|
|
100
|
-
export declare function filterTools(tools: ToolSet, include: string[]): ToolSet;
|
|
101
|
-
/**
|
|
102
|
-
* Exclude specified tools from a tool set.
|
|
103
|
-
*/
|
|
104
|
-
export declare function excludeTools(tools: ToolSet, exclude: string[]): ToolSet;
|
|
105
|
-
/**
|
|
106
|
-
* Get tool names from a tool set.
|
|
107
|
-
*/
|
|
108
|
-
export declare function getToolNames(tools: ToolSet): string[];
|
|
109
|
-
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/tools/factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAM/B;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qCAAqC;IACrC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,MAAM,OAAO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O,EAAE,MAAM,EAAE,GAAG,OAAO,CAKvE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAErD"}
|
package/dist/tools/factory.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @agntk/core - Tool Factory
|
|
3
|
-
*
|
|
4
|
-
* Factory pattern for creating tool sets with dependency injection.
|
|
5
|
-
* Adapted from packages/core/src/tools/factory.ts
|
|
6
|
-
*/
|
|
7
|
-
// ============================================================================
|
|
8
|
-
// Tool Factory Class
|
|
9
|
-
// ============================================================================
|
|
10
|
-
/**
|
|
11
|
-
* Factory for registering and creating tools with dependency injection.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const factory = new ToolFactory();
|
|
16
|
-
*
|
|
17
|
-
* factory.register('search', (deps) => ({
|
|
18
|
-
* glob: createGlobTool({ defaultCwd: deps.workspaceRoot }),
|
|
19
|
-
* grep: createGrepTool({ defaultCwd: deps.workspaceRoot }),
|
|
20
|
-
* }));
|
|
21
|
-
*
|
|
22
|
-
* const tools = factory.createAll({ workspaceRoot: '/my/project' });
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export class ToolFactory {
|
|
26
|
-
factories = new Map();
|
|
27
|
-
creationErrors = [];
|
|
28
|
-
/**
|
|
29
|
-
* Register a tool creator function.
|
|
30
|
-
*/
|
|
31
|
-
register(name, creator) {
|
|
32
|
-
this.factories.set(name, creator);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Unregister a tool creator.
|
|
36
|
-
*/
|
|
37
|
-
unregister(name) {
|
|
38
|
-
return this.factories.delete(name);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Check if a tool creator is registered.
|
|
42
|
-
*/
|
|
43
|
-
has(name) {
|
|
44
|
-
return this.factories.has(name);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Get all registered tool creator names.
|
|
48
|
-
*/
|
|
49
|
-
getRegisteredNames() {
|
|
50
|
-
return Array.from(this.factories.keys());
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Create tools from a single registered creator.
|
|
54
|
-
*/
|
|
55
|
-
create(name, deps) {
|
|
56
|
-
const creator = this.factories.get(name);
|
|
57
|
-
if (!creator) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
try {
|
|
61
|
-
return creator(deps);
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
this.creationErrors.push({
|
|
65
|
-
name,
|
|
66
|
-
error: String(error),
|
|
67
|
-
});
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Create all registered tools.
|
|
73
|
-
*/
|
|
74
|
-
createAll(deps) {
|
|
75
|
-
const allTools = {};
|
|
76
|
-
this.creationErrors = [];
|
|
77
|
-
for (const [name, creator] of this.factories.entries()) {
|
|
78
|
-
try {
|
|
79
|
-
const tools = creator(deps);
|
|
80
|
-
Object.assign(allTools, tools);
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
this.creationErrors.push({
|
|
84
|
-
name,
|
|
85
|
-
error: String(error),
|
|
86
|
-
});
|
|
87
|
-
// Continue creating other tools even if one fails
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return allTools;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Create selected tools by name.
|
|
94
|
-
*/
|
|
95
|
-
createSelected(names, deps) {
|
|
96
|
-
const allTools = {};
|
|
97
|
-
this.creationErrors = [];
|
|
98
|
-
for (const name of names) {
|
|
99
|
-
const creator = this.factories.get(name);
|
|
100
|
-
if (!creator) {
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
try {
|
|
104
|
-
const tools = creator(deps);
|
|
105
|
-
Object.assign(allTools, tools);
|
|
106
|
-
}
|
|
107
|
-
catch (error) {
|
|
108
|
-
this.creationErrors.push({
|
|
109
|
-
name,
|
|
110
|
-
error: String(error),
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return allTools;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Get errors from the last creation operation.
|
|
118
|
-
*/
|
|
119
|
-
getLastErrors() {
|
|
120
|
-
return [...this.creationErrors];
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Clear all registered factories.
|
|
124
|
-
*/
|
|
125
|
-
clear() {
|
|
126
|
-
this.factories.clear();
|
|
127
|
-
this.creationErrors = [];
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
// ============================================================================
|
|
131
|
-
// Default Factory Instance
|
|
132
|
-
// ============================================================================
|
|
133
|
-
/**
|
|
134
|
-
* Default tool factory instance for convenience.
|
|
135
|
-
*/
|
|
136
|
-
export const defaultToolFactory = new ToolFactory();
|
|
137
|
-
// ============================================================================
|
|
138
|
-
// Helper Functions
|
|
139
|
-
// ============================================================================
|
|
140
|
-
/**
|
|
141
|
-
* Merge multiple tool sets into one.
|
|
142
|
-
*/
|
|
143
|
-
export function mergeToolSets(...toolSets) {
|
|
144
|
-
return Object.assign({}, ...toolSets);
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Filter a tool set to only include specified tools.
|
|
148
|
-
*/
|
|
149
|
-
export function filterTools(tools, include) {
|
|
150
|
-
const includeSet = new Set(include);
|
|
151
|
-
return Object.fromEntries(Object.entries(tools).filter(([name]) => includeSet.has(name)));
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Exclude specified tools from a tool set.
|
|
155
|
-
*/
|
|
156
|
-
export function excludeTools(tools, exclude) {
|
|
157
|
-
const excludeSet = new Set(exclude);
|
|
158
|
-
return Object.fromEntries(Object.entries(tools).filter(([name]) => !excludeSet.has(name)));
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Get tool names from a tool set.
|
|
162
|
-
*/
|
|
163
|
-
export function getToolNames(tools) {
|
|
164
|
-
return Object.keys(tools);
|
|
165
|
-
}
|
|
166
|
-
//# sourceMappingURL=factory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src/tools/factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkCH,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,WAAW;IACd,SAAS,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC3C,cAAc,GAA2C,EAAE,CAAC;IAEpE;;OAEG;IACH,QAAQ,CAAC,IAAY,EAAE,OAAoB;QACzC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,IAAY;QACrB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAY,EAAE,IAAsB;QACzC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,CAAC;YACH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC;gBACvB,I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CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAChE,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @agntk/core - Agent → WorkflowStep Adapter
|
|
3
|
-
*
|
|
4
|
-
* Converts an Agent to a WorkflowStep so agents and workflows are interchangeable.
|
|
5
|
-
*/
|
|
6
|
-
import type { Agent } from '../../agent.js';
|
|
7
|
-
import type { WorkflowStep } from './types.js';
|
|
8
|
-
/**
|
|
9
|
-
* Adapt an Agent to a WorkflowStep.
|
|
10
|
-
* The agent's generate() method is called with the workflow input prompt.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* const pipeline = createPipeline({
|
|
15
|
-
* steps: [asStep(researchAgent), asStep(writerAgent)],
|
|
16
|
-
* });
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare function asStep(agent: Agent): WorkflowStep;
|
|
20
|
-
//# sourceMappingURL=adapt.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapt.d.ts","sourceRoot":"","sources":["../../../src/workflow/builders/adapt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAiC,MAAM,SAAS,CAAC;AAE3E;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,YAAY,CAejD"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @agntk/core - Agent → WorkflowStep Adapter
|
|
3
|
-
*
|
|
4
|
-
* Converts an Agent to a WorkflowStep so agents and workflows are interchangeable.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Adapt an Agent to a WorkflowStep.
|
|
8
|
-
* The agent's generate() method is called with the workflow input prompt.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const pipeline = createPipeline({
|
|
13
|
-
* steps: [asStep(researchAgent), asStep(writerAgent)],
|
|
14
|
-
* });
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export function asStep(agent) {
|
|
18
|
-
return {
|
|
19
|
-
async execute(input) {
|
|
20
|
-
const result = await agent.generate({ prompt: input.prompt });
|
|
21
|
-
return {
|
|
22
|
-
text: result.text ?? '',
|
|
23
|
-
metadata: {
|
|
24
|
-
agentId: agent.agentId,
|
|
25
|
-
role: agent.role,
|
|
26
|
-
steps: result.steps?.length ?? 0,
|
|
27
|
-
usage: result.totalUsage,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=adapt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapt.js","sourceRoot":"","sources":["../../../src/workflow/builders/adapt.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,MAAM,CAAC,KAAY;IACjC,OAAO;QACL,KAAK,CAAC,OAAO,CAAC,KAAoB;YAChC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;YAC9D,OAAO;gBACL,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;gBACvB,QAAQ,EAAE;oBACR,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;oBAChC,KAAK,EAAE,MAAM,CAAC,UAAU;iBACzB;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Workflow builders public API.
|
|
3
|
-
*/
|
|
4
|
-
export type { Workflow, WorkflowStep, WorkflowInput, WorkflowOutput, SynthesizeFn, PipelineConfig, ParallelConfig, } from './types.js';
|
|
5
|
-
export { createPipeline } from './pipeline.js';
|
|
6
|
-
export { createParallel } from './parallel.js';
|
|
7
|
-
export { asStep } from './adapt.js';
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/workflow/builders/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,cAAc,EACd,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/workflow/builders/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @agntk/core - Parallel Workflow Builder
|
|
3
|
-
*
|
|
4
|
-
* Fan out to multiple agents/workflows concurrently,
|
|
5
|
-
* then synthesize the results.
|
|
6
|
-
*/
|
|
7
|
-
import type { Workflow, ParallelConfig } from './types.js';
|
|
8
|
-
/**
|
|
9
|
-
* Create a parallel workflow that fans out to multiple steps concurrently.
|
|
10
|
-
* All steps receive the same input prompt. Results are merged by the synthesize function.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* const parallel = createParallel({
|
|
15
|
-
* name: 'multi-analysis',
|
|
16
|
-
* steps: [securityAgent, performanceAgent, codeQualityAgent],
|
|
17
|
-
* synthesize: (outputs) => ({
|
|
18
|
-
* text: outputs.map(o => o.text).join('\n\n---\n\n'),
|
|
19
|
-
* }),
|
|
20
|
-
* });
|
|
21
|
-
* const result = await parallel.execute({ prompt: 'Analyze this codebase' });
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export declare function createParallel(config: ParallelConfig): Workflow;
|
|
25
|
-
//# sourceMappingURL=parallel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parallel.d.ts","sourceRoot":"","sources":["../../../src/workflow/builders/parallel.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAiC,cAAc,EAAE,MAAM,SAAS,CAAC;AAIvF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,QAAQ,CA2C/D"}
|