@agntk/core 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +228 -275
- package/dist/agent.js.map +1 -1
- package/dist/config/schema.d.ts +38 -38
- 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/index.d.ts +4 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -9
- package/dist/index.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 +5 -5
- package/dist/tools/browser/tool.d.ts +2 -2
- package/dist/tools/browser/types.d.ts +2 -2
- 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 +2 -2
- 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/types/agent.d.ts +69 -199
- 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/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,WAAW,GAAG,CAAC,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,CAAU,CAAC;AAElF,+EAA+E;AAC/E,+BAA+B;AAC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AAM,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"}
|
|
@@ -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"}
|
|
@@ -1,60 +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 { createLogger } from '@agntk/logger';
|
|
8
|
-
const log = createLogger('@agntk/core:workflow:parallel');
|
|
9
|
-
/**
|
|
10
|
-
* Create a parallel workflow that fans out to multiple steps concurrently.
|
|
11
|
-
* All steps receive the same input prompt. Results are merged by the synthesize function.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const parallel = createParallel({
|
|
16
|
-
* name: 'multi-analysis',
|
|
17
|
-
* steps: [securityAgent, performanceAgent, codeQualityAgent],
|
|
18
|
-
* synthesize: (outputs) => ({
|
|
19
|
-
* text: outputs.map(o => o.text).join('\n\n---\n\n'),
|
|
20
|
-
* }),
|
|
21
|
-
* });
|
|
22
|
-
* const result = await parallel.execute({ prompt: 'Analyze this codebase' });
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export function createParallel(config) {
|
|
26
|
-
const { name = 'parallel', steps, synthesize } = config;
|
|
27
|
-
if (steps.length === 0) {
|
|
28
|
-
throw new Error('Parallel workflow must have at least one step');
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
name,
|
|
32
|
-
stepCount: steps.length,
|
|
33
|
-
async execute(input) {
|
|
34
|
-
log.info('Parallel started', { name, stepCount: steps.length, promptLength: input.prompt.length });
|
|
35
|
-
const results = await Promise.allSettled(steps.map((step, i) => {
|
|
36
|
-
log.debug('Parallel step launched', { name, step: i + 1 });
|
|
37
|
-
return step.execute(input);
|
|
38
|
-
}));
|
|
39
|
-
const outputs = [];
|
|
40
|
-
for (let i = 0; i < results.length; i++) {
|
|
41
|
-
const result = results[i];
|
|
42
|
-
if (result.status === 'fulfilled') {
|
|
43
|
-
outputs.push(result.value);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
log.error('Parallel step failed', { name, step: i + 1, error: String(result.reason) });
|
|
47
|
-
outputs.push({
|
|
48
|
-
text: `[Step ${i + 1} failed: ${result.reason instanceof Error ? result.reason.message : String(result.reason)}]`,
|
|
49
|
-
metadata: { error: true },
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
log.debug('Synthesizing parallel outputs', { name, outputCount: outputs.length });
|
|
54
|
-
const synthesized = await synthesize(outputs);
|
|
55
|
-
log.info('Parallel completed', { name, textLength: synthesized.text.length });
|
|
56
|
-
return synthesized;
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=parallel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parallel.js","sourceRoot":"","sources":["../../../src/workflow/builders/parallel.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,MAAM,GAAG,GAAG,YAAY,CAAC,+BAA+B,CAAC,CAAC;AAE1D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,cAAc,CAAC,MAAsB;IACnD,MAAM,EAAE,IAAI,GAAG,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAExD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IAED,OAAO;QACL,IAAI;QACJ,SAAS,EAAE,KAAK,CAAC,MAAM;QAEvB,KAAK,CAAC,OAAO,CAAC,KAAoB;YAChC,GAAG,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;YAEnG,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CACtC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;gBACpB,GAAG,CAAC,KAAK,CAAC,wBAAwB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC7B,CAAC,CAAC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2
|
-
* @agntk/core - Pipeline Workflow Builder
|
|
3
|
-
*
|
|
4
|
-
* Chain agents/workflows sequentially. Each step's output
|
|
5
|
-
* becomes the next step's input prompt.
|
|
6
|
-
*/
|
|
7
|
-
import type { Workflow, PipelineConfig } from './types.js';
|
|
8
|
-
/**
|
|
9
|
-
* Create a pipeline that chains steps sequentially.
|
|
10
|
-
* Each step's text output becomes the next step's prompt.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* const pipeline = createPipeline({
|
|
15
|
-
* name: 'research-then-write',
|
|
16
|
-
* steps: [researchAgent, writerAgent],
|
|
17
|
-
* });
|
|
18
|
-
* const result = await pipeline.execute({ prompt: 'Write about quantum computing' });
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare function createPipeline(config: PipelineConfig): Workflow;
|
|
22
|
-
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../src/workflow/builders/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAiC,cAAc,EAAE,MAAM,SAAS,CAAC;AAIvF;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,QAAQ,CAkC/D"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @agntk/core - Pipeline Workflow Builder
|
|
3
|
-
*
|
|
4
|
-
* Chain agents/workflows sequentially. Each step's output
|
|
5
|
-
* becomes the next step's input prompt.
|
|
6
|
-
*/
|
|
7
|
-
import { createLogger } from '@agntk/logger';
|
|
8
|
-
const log = createLogger('@agntk/core:workflow:pipeline');
|
|
9
|
-
/**
|
|
10
|
-
* Create a pipeline that chains steps sequentially.
|
|
11
|
-
* Each step's text output becomes the next step's prompt.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const pipeline = createPipeline({
|
|
16
|
-
* name: 'research-then-write',
|
|
17
|
-
* steps: [researchAgent, writerAgent],
|
|
18
|
-
* });
|
|
19
|
-
* const result = await pipeline.execute({ prompt: 'Write about quantum computing' });
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export function createPipeline(config) {
|
|
23
|
-
const { name = 'pipeline', steps, transform } = config;
|
|
24
|
-
if (steps.length === 0) {
|
|
25
|
-
throw new Error('Pipeline must have at least one step');
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
name,
|
|
29
|
-
stepCount: steps.length,
|
|
30
|
-
async execute(input) {
|
|
31
|
-
log.info('Pipeline started', { name, stepCount: steps.length, promptLength: input.prompt.length });
|
|
32
|
-
let currentOutput = { text: input.prompt };
|
|
33
|
-
for (let i = 0; i < steps.length; i++) {
|
|
34
|
-
const step = steps[i];
|
|
35
|
-
const prompt = i === 0
|
|
36
|
-
? input.prompt
|
|
37
|
-
: transform
|
|
38
|
-
? transform(currentOutput, i)
|
|
39
|
-
: currentOutput.text;
|
|
40
|
-
log.debug('Pipeline step', { name, step: i + 1, total: steps.length, promptLength: prompt.length });
|
|
41
|
-
currentOutput = await step.execute({ prompt });
|
|
42
|
-
}
|
|
43
|
-
log.info('Pipeline completed', { name, textLength: currentOutput.text.length });
|
|
44
|
-
return currentOutput;
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=pipeline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../../src/workflow/builders/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,MAAM,GAAG,GAAG,YAAY,CAAC,+BAA+B,CAAC,CAAC;AAE1D;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,cAAc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E,IAAI,EAAE,UAAU,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YAEhF,OAAO,aAAa,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Types for workflow builders (Pipeline, Parallel).
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* A Workflow step that can execute with a prompt and return text.
|
|
6
|
-
* Compatible with the Agent interface so agents and workflows are interchangeable.
|
|
7
|
-
*/
|
|
8
|
-
export interface WorkflowStep {
|
|
9
|
-
/** Execute the step with a prompt. */
|
|
10
|
-
execute: (input: WorkflowInput) => Promise<WorkflowOutput>;
|
|
11
|
-
}
|
|
12
|
-
/** Input to a workflow step. */
|
|
13
|
-
export interface WorkflowInput {
|
|
14
|
-
prompt: string;
|
|
15
|
-
}
|
|
16
|
-
/** Output from a workflow step. */
|
|
17
|
-
export interface WorkflowOutput {
|
|
18
|
-
text: string;
|
|
19
|
-
metadata?: Record<string, unknown>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* A Workflow that composes multiple steps.
|
|
23
|
-
* Implements WorkflowStep so it can nest inside other workflows.
|
|
24
|
-
*/
|
|
25
|
-
export interface Workflow extends WorkflowStep {
|
|
26
|
-
/** Name of this workflow. */
|
|
27
|
-
name: string;
|
|
28
|
-
/** Number of steps in this workflow. */
|
|
29
|
-
stepCount: number;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Synthesize function for parallel workflows.
|
|
33
|
-
* Receives all outputs and produces a merged result.
|
|
34
|
-
*/
|
|
35
|
-
export type SynthesizeFn = (outputs: WorkflowOutput[]) => WorkflowOutput | Promise<WorkflowOutput>;
|
|
36
|
-
/** Configuration for createPipeline. */
|
|
37
|
-
export interface PipelineConfig {
|
|
38
|
-
/** Pipeline name. */
|
|
39
|
-
name?: string;
|
|
40
|
-
/** Steps to execute sequentially. */
|
|
41
|
-
steps: WorkflowStep[];
|
|
42
|
-
/** Optional transform between steps (receives previous output, returns next prompt). */
|
|
43
|
-
transform?: (output: WorkflowOutput, stepIndex: number) => string;
|
|
44
|
-
}
|
|
45
|
-
/** Configuration for createParallel. */
|
|
46
|
-
export interface ParallelConfig {
|
|
47
|
-
/** Parallel workflow name. */
|
|
48
|
-
name?: string;
|
|
49
|
-
/** Steps to execute concurrently. */
|
|
50
|
-
steps: WorkflowStep[];
|
|
51
|
-
/** Function to synthesize/merge parallel outputs. */
|
|
52
|
-
synthesize: SynthesizeFn;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/workflow/builders/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,sCAAsC;IACtC,OAAO,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CAC5D;AAED,gCAAgC;AAChC,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,QAAS,SAAQ,YAAY;IAC5C,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAEnG,wCAAwC;AACxC,MAAM,WAAW,cAAc;IAC7B,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,wFAAwF;IACxF,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CACnE;AAED,wCAAwC;AACxC,MAAM,WAAW,cAAc;IAC7B,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,qDAAqD;IACrD,UAAU,EAAE,YAAY,CAAC;CAC1B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/workflow/builders/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|