@agntk/core 0.3.0 → 0.3.2
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/dist/agent-v2.d.ts +48 -0
- package/dist/agent-v2.d.ts.map +1 -0
- package/dist/agent-v2.js +365 -0
- package/dist/agent-v2.js.map +1 -0
- package/dist/config/defaults.js +3 -3
- package/dist/config/defaults.js.map +1 -1
- package/dist/memory/engine.d.ts +130 -0
- package/dist/memory/engine.d.ts.map +1 -0
- package/dist/memory/engine.js +227 -0
- package/dist/memory/engine.js.map +1 -0
- package/dist/memory/vectra-store.d.ts +31 -0
- package/dist/memory/vectra-store.d.ts.map +1 -0
- package/dist/memory/vectra-store.js +122 -0
- package/dist/memory/vectra-store.js.map +1 -0
- package/dist/models.d.ts +4 -0
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +53 -7
- package/dist/models.js.map +1 -1
- package/dist/pool/index.d.ts +7 -0
- package/dist/pool/index.d.ts.map +1 -0
- package/dist/pool/index.js +6 -0
- package/dist/pool/index.js.map +1 -0
- package/dist/pool/specialist-pool.d.ts +59 -0
- package/dist/pool/specialist-pool.d.ts.map +1 -0
- package/dist/pool/specialist-pool.js +224 -0
- package/dist/pool/specialist-pool.js.map +1 -0
- package/dist/pool/tools.d.ts +63 -0
- package/dist/pool/tools.d.ts.map +1 -0
- package/dist/pool/tools.js +83 -0
- package/dist/pool/tools.js.map +1 -0
- package/dist/pool/types.d.ts +79 -0
- package/dist/pool/types.d.ts.map +1 -0
- package/dist/pool/types.js +5 -0
- package/dist/pool/types.js.map +1 -0
- package/dist/presets/index.d.ts +5 -0
- package/dist/presets/index.d.ts.map +1 -0
- package/dist/presets/index.js +5 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/presets/role-registry.d.ts +41 -0
- package/dist/presets/role-registry.d.ts.map +1 -0
- package/dist/presets/role-registry.js +213 -0
- package/dist/presets/role-registry.js.map +1 -0
- package/dist/presets/roles.d.ts +105 -0
- package/dist/presets/roles.d.ts.map +1 -0
- package/dist/presets/roles.js +207 -0
- package/dist/presets/roles.js.map +1 -0
- package/dist/prompts/templates.d.ts +11 -0
- package/dist/prompts/templates.d.ts.map +1 -0
- package/dist/prompts/templates.js +115 -0
- package/dist/prompts/templates.js.map +1 -0
- package/dist/provider-resolver.d.ts +4 -0
- package/dist/provider-resolver.d.ts.map +1 -1
- package/dist/provider-resolver.js +51 -15
- package/dist/provider-resolver.js.map +1 -1
- package/dist/streaming/data-parts.d.ts +163 -0
- package/dist/streaming/data-parts.d.ts.map +1 -0
- package/dist/streaming/data-parts.js +14 -0
- package/dist/streaming/data-parts.js.map +1 -0
- package/dist/streaming/index.d.ts +8 -0
- package/dist/streaming/index.d.ts.map +1 -0
- package/dist/streaming/index.js +10 -0
- package/dist/streaming/index.js.map +1 -0
- package/dist/streaming/transient.d.ts +136 -0
- package/dist/streaming/transient.d.ts.map +1 -0
- package/dist/streaming/transient.js +201 -0
- package/dist/streaming/transient.js.map +1 -0
- package/dist/system-detect.d.ts +34 -12
- package/dist/system-detect.d.ts.map +1 -1
- package/dist/system-detect.js +154 -29
- package/dist/system-detect.js.map +1 -1
- package/dist/tools/factory.d.ts +109 -0
- package/dist/tools/factory.d.ts.map +1 -0
- package/dist/tools/factory.js +166 -0
- package/dist/tools/factory.js.map +1 -0
- package/dist/tools/provider.d.ts +97 -0
- package/dist/tools/provider.d.ts.map +1 -0
- package/dist/tools/provider.js +178 -0
- package/dist/tools/provider.js.map +1 -0
- package/dist/types/agent-v2.d.ts +83 -0
- package/dist/types/agent-v2.d.ts.map +1 -0
- package/dist/types/agent-v2.js +8 -0
- package/dist/types/agent-v2.js.map +1 -0
- package/dist/utils/logger.d.ts +35 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +149 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/workflow/builders/adapt.d.ts +20 -0
- package/dist/workflow/builders/adapt.d.ts.map +1 -0
- package/dist/workflow/builders/adapt.js +33 -0
- package/dist/workflow/builders/adapt.js.map +1 -0
- package/dist/workflow/builders/index.d.ts +8 -0
- package/dist/workflow/builders/index.d.ts.map +1 -0
- package/dist/workflow/builders/index.js +7 -0
- package/dist/workflow/builders/index.js.map +1 -0
- package/dist/workflow/builders/parallel.d.ts +25 -0
- package/dist/workflow/builders/parallel.d.ts.map +1 -0
- package/dist/workflow/builders/parallel.js +60 -0
- package/dist/workflow/builders/parallel.js.map +1 -0
- package/dist/workflow/builders/pipeline.d.ts +22 -0
- package/dist/workflow/builders/pipeline.d.ts.map +1 -0
- package/dist/workflow/builders/pipeline.js +48 -0
- package/dist/workflow/builders/pipeline.js.map +1 -0
- package/dist/workflow/builders/types.d.ts +54 -0
- package/dist/workflow/builders/types.d.ts.map +1 -0
- package/dist/workflow/builders/types.js +5 -0
- package/dist/workflow/builders/types.js.map +1 -0
- package/dist/workflow/durable-agent.d.ts +128 -0
- package/dist/workflow/durable-agent.d.ts.map +1 -0
- package/dist/workflow/durable-agent.js +323 -0
- package/dist/workflow/durable-agent.js.map +1 -0
- package/dist/workflow/schedulers.d.ts +231 -0
- package/dist/workflow/schedulers.d.ts.map +1 -0
- package/dist/workflow/schedulers.js +250 -0
- package/dist/workflow/schedulers.js.map +1 -0
- package/dist/workflow/team/create-team.d.ts +34 -0
- package/dist/workflow/team/create-team.d.ts.map +1 -0
- package/dist/workflow/team/create-team.js +242 -0
- package/dist/workflow/team/create-team.js.map +1 -0
- package/dist/workflow/team/index.d.ts +9 -0
- package/dist/workflow/team/index.d.ts.map +1 -0
- package/dist/workflow/team/index.js +8 -0
- package/dist/workflow/team/index.js.map +1 -0
- package/dist/workflow/team/machines.d.ts +152 -0
- package/dist/workflow/team/machines.d.ts.map +1 -0
- package/dist/workflow/team/machines.js +197 -0
- package/dist/workflow/team/machines.js.map +1 -0
- package/dist/workflow/team/task-board.d.ts +47 -0
- package/dist/workflow/team/task-board.d.ts.map +1 -0
- package/dist/workflow/team/task-board.js +111 -0
- package/dist/workflow/team/task-board.js.map +1 -0
- package/dist/workflow/team/tools.d.ts +66 -0
- package/dist/workflow/team/tools.d.ts.map +1 -0
- package/dist/workflow/team/tools.js +100 -0
- package/dist/workflow/team/tools.js.map +1 -0
- package/dist/workflow/team/types.d.ts +109 -0
- package/dist/workflow/team/types.d.ts.map +1 -0
- package/dist/workflow/team/types.js +5 -0
- package/dist/workflow/team/types.js.map +1 -0
- package/dist/workflow/templates.d.ts +71 -0
- package/dist/workflow/templates.d.ts.map +1 -0
- package/dist/workflow/templates.js +132 -0
- package/dist/workflow/templates.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Role Registry - manages built-in and custom roles.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { createLogger } from '@agntk/logger';
|
|
6
|
+
import { getConfig } from '../config/index.js';
|
|
7
|
+
import { applyTemplate } from '../prompts/template.js';
|
|
8
|
+
const log = createLogger('@agntk/core:roles');
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Registry State
|
|
11
|
+
// ============================================================================
|
|
12
|
+
const roleRegistry = new Map();
|
|
13
|
+
let configRolesLoaded = false;
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Base System Prompt
|
|
16
|
+
// ============================================================================
|
|
17
|
+
const BASE_SYSTEM_PROMPT = `You are an AI assistant with access to tools for completing tasks.
|
|
18
|
+
|
|
19
|
+
**Guidelines:**
|
|
20
|
+
- Be direct and concise in your responses
|
|
21
|
+
- Use tools when they would help accomplish the task
|
|
22
|
+
- Explain your reasoning when making decisions
|
|
23
|
+
- Ask for clarification if the request is ambiguous
|
|
24
|
+
- Complete tasks step by step, validating progress`;
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Built-in Role Prompts
|
|
27
|
+
// ============================================================================
|
|
28
|
+
const ROLE_PROMPTS = {
|
|
29
|
+
generic: '',
|
|
30
|
+
researcher: `
|
|
31
|
+
# Role: Research Specialist
|
|
32
|
+
|
|
33
|
+
You excel at gathering, verifying, and synthesizing information from multiple sources.
|
|
34
|
+
|
|
35
|
+
**Core competencies:**
|
|
36
|
+
- Web search and documentation retrieval
|
|
37
|
+
- Cross-referencing claims across sources
|
|
38
|
+
- Distinguishing fact from speculation
|
|
39
|
+
- Summarizing complex topics clearly
|
|
40
|
+
|
|
41
|
+
**Quality standards:**
|
|
42
|
+
- Cite sources for factual claims
|
|
43
|
+
- Explicitly state confidence levels
|
|
44
|
+
- Acknowledge when information is incomplete`,
|
|
45
|
+
coder: `
|
|
46
|
+
# Role: Software Engineer
|
|
47
|
+
|
|
48
|
+
You write production-quality code that integrates cleanly with existing systems.
|
|
49
|
+
|
|
50
|
+
**Core competencies:**
|
|
51
|
+
- Reading and understanding existing codebases
|
|
52
|
+
- Writing clean, maintainable code
|
|
53
|
+
- Testing and validation
|
|
54
|
+
- Debugging and error diagnosis
|
|
55
|
+
|
|
56
|
+
**Quality standards:**
|
|
57
|
+
- Follow patterns established in the codebase
|
|
58
|
+
- Write tests for new functionality
|
|
59
|
+
- Consistent formatting with the codebase
|
|
60
|
+
- Meaningful variable and function names`,
|
|
61
|
+
analyst: `
|
|
62
|
+
# Role: Data Analyst
|
|
63
|
+
|
|
64
|
+
You analyze information to extract insights and support decision-making.
|
|
65
|
+
|
|
66
|
+
**Core competencies:**
|
|
67
|
+
- Pattern recognition across datasets
|
|
68
|
+
- Statistical reasoning
|
|
69
|
+
- Hypothesis formation and testing
|
|
70
|
+
- Clear communication of findings
|
|
71
|
+
|
|
72
|
+
**Quality standards:**
|
|
73
|
+
- Distinguish correlation from causation
|
|
74
|
+
- Quantify uncertainty in conclusions
|
|
75
|
+
- Consider alternative explanations`,
|
|
76
|
+
};
|
|
77
|
+
// ============================================================================
|
|
78
|
+
// Built-in Roles
|
|
79
|
+
// ============================================================================
|
|
80
|
+
const BUILT_IN_ROLES = {
|
|
81
|
+
generic: {
|
|
82
|
+
systemPrompt: BASE_SYSTEM_PROMPT,
|
|
83
|
+
defaultTools: ['shell', 'glob', 'grep'],
|
|
84
|
+
recommendedModel: 'standard',
|
|
85
|
+
},
|
|
86
|
+
researcher: {
|
|
87
|
+
systemPrompt: `${BASE_SYSTEM_PROMPT}\n${ROLE_PROMPTS.researcher}`,
|
|
88
|
+
defaultTools: ['glob', 'grep', 'deep_reasoning'],
|
|
89
|
+
recommendedModel: 'standard',
|
|
90
|
+
},
|
|
91
|
+
coder: {
|
|
92
|
+
systemPrompt: `${BASE_SYSTEM_PROMPT}\n${ROLE_PROMPTS.coder}`,
|
|
93
|
+
defaultTools: ['shell', 'glob', 'grep'],
|
|
94
|
+
recommendedModel: 'powerful',
|
|
95
|
+
},
|
|
96
|
+
analyst: {
|
|
97
|
+
systemPrompt: `${BASE_SYSTEM_PROMPT}\n${ROLE_PROMPTS.analyst}`,
|
|
98
|
+
defaultTools: ['glob', 'grep', 'deep_reasoning'],
|
|
99
|
+
recommendedModel: 'standard',
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
// ============================================================================
|
|
103
|
+
// Registry Functions
|
|
104
|
+
// ============================================================================
|
|
105
|
+
/**
|
|
106
|
+
* Register a role in the registry.
|
|
107
|
+
*/
|
|
108
|
+
export function registerRole(name, definition) {
|
|
109
|
+
log.debug('Registering role', { name, hasPrompt: !!definition.systemPrompt });
|
|
110
|
+
roleRegistry.set(name, definition);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get a role from the registry.
|
|
114
|
+
* Falls back to built-in roles, then generic.
|
|
115
|
+
* Templates are applied to the system prompt.
|
|
116
|
+
*/
|
|
117
|
+
export function getRole(name) {
|
|
118
|
+
loadConfigRoles();
|
|
119
|
+
let role;
|
|
120
|
+
// Check registry first
|
|
121
|
+
if (roleRegistry.has(name)) {
|
|
122
|
+
role = roleRegistry.get(name);
|
|
123
|
+
}
|
|
124
|
+
else if (name in BUILT_IN_ROLES) {
|
|
125
|
+
role = BUILT_IN_ROLES[name];
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
log.warn('Unknown role, using generic', { role: name });
|
|
129
|
+
role = BUILT_IN_ROLES.generic;
|
|
130
|
+
}
|
|
131
|
+
// Apply template substitution
|
|
132
|
+
return {
|
|
133
|
+
...role,
|
|
134
|
+
systemPrompt: applyTemplate(role.systemPrompt),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Get all registered role names.
|
|
139
|
+
*/
|
|
140
|
+
export function getAllRoleNames() {
|
|
141
|
+
loadConfigRoles();
|
|
142
|
+
const builtIn = Object.keys(BUILT_IN_ROLES);
|
|
143
|
+
const custom = Array.from(roleRegistry.keys());
|
|
144
|
+
return [...new Set([...builtIn, ...custom])];
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Check if a role exists.
|
|
148
|
+
*/
|
|
149
|
+
export function hasRole(name) {
|
|
150
|
+
loadConfigRoles();
|
|
151
|
+
return roleRegistry.has(name) || name in BUILT_IN_ROLES;
|
|
152
|
+
}
|
|
153
|
+
// ============================================================================
|
|
154
|
+
// Config Loading
|
|
155
|
+
// ============================================================================
|
|
156
|
+
/**
|
|
157
|
+
* Load roles from config file (called lazily on first access).
|
|
158
|
+
*/
|
|
159
|
+
function loadConfigRoles() {
|
|
160
|
+
if (configRolesLoaded)
|
|
161
|
+
return;
|
|
162
|
+
configRolesLoaded = true;
|
|
163
|
+
const config = getConfig();
|
|
164
|
+
const roles = config.roles;
|
|
165
|
+
if (!roles)
|
|
166
|
+
return;
|
|
167
|
+
for (const [name, roleConfig] of Object.entries(roles)) {
|
|
168
|
+
if (!roleConfig)
|
|
169
|
+
continue;
|
|
170
|
+
// Build the full prompt
|
|
171
|
+
let systemPrompt = roleConfig.systemPrompt ?? '';
|
|
172
|
+
// If it's an override of a built-in role, inherit the base
|
|
173
|
+
if (name in BUILT_IN_ROLES && !roleConfig.systemPrompt) {
|
|
174
|
+
systemPrompt = BUILT_IN_ROLES[name].systemPrompt;
|
|
175
|
+
}
|
|
176
|
+
else if (systemPrompt && !systemPrompt.includes('Guidelines:')) {
|
|
177
|
+
// Prepend base prompt if custom prompt doesn't include it
|
|
178
|
+
systemPrompt = `${BASE_SYSTEM_PROMPT}\n\n${systemPrompt}`;
|
|
179
|
+
}
|
|
180
|
+
const definition = {
|
|
181
|
+
systemPrompt,
|
|
182
|
+
defaultTools: roleConfig.defaultTools,
|
|
183
|
+
recommendedModel: roleConfig.recommendedModel,
|
|
184
|
+
};
|
|
185
|
+
log.info('Loading role from config', { name });
|
|
186
|
+
registerRole(name, definition);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Reset the registry (for testing).
|
|
191
|
+
*/
|
|
192
|
+
export function resetRoleRegistry() {
|
|
193
|
+
roleRegistry.clear();
|
|
194
|
+
configRolesLoaded = false;
|
|
195
|
+
}
|
|
196
|
+
// ============================================================================
|
|
197
|
+
// Helpers for backward compatibility
|
|
198
|
+
// ============================================================================
|
|
199
|
+
export const SPAWNED_AGENT_CONTEXT = `
|
|
200
|
+
# Context: Spawned Sub-Agent
|
|
201
|
+
|
|
202
|
+
You are running as a sub-agent spawned by a parent agent to handle a delegated task.
|
|
203
|
+
|
|
204
|
+
**Constraints:**
|
|
205
|
+
- The delegate tool is disabled to prevent infinite recursion
|
|
206
|
+
- Focus on completing the delegated task autonomously
|
|
207
|
+
`;
|
|
208
|
+
export function buildSpawnedAgentPrompt(role) {
|
|
209
|
+
const def = getRole(role);
|
|
210
|
+
return `${def.systemPrompt}\n${SPAWNED_AGENT_CONTEXT}`;
|
|
211
|
+
}
|
|
212
|
+
export { BASE_SYSTEM_PROMPT };
|
|
213
|
+
//# sourceMappingURL=role-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role-registry.js","sourceRoot":"","sources":["../../src/presets/role-registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,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AC,YAAY;YACrC,gBAAgB,EAAE,UAAU,CAAC,gBAAsD;SACpF,CAAC;QAEF,GAAG,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,YAAY,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACjC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,YAAY,CAAC,KAAK,EAAE,CAAC;IACrB,iBAAiB,GAAG,KAAK,CAAC;AAC5B,CAAC;AAED,+EAA+E;AAC/E,qCAAqC;AACrC,+EAA+E;AAE/E,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;CAQpC,CAAC;AAEF,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAClD,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,OAAO,GAAG,GAAG,CAAC,YAAY,KAAK,qBAAqB,EAAE,CAAC;AACzD,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
export declare const SPAWNED_AGENT_CONTEXT = "\n# Context: Spawned Sub-Agent\n\nYou are running as a sub-agent spawned by a parent agent to handle a delegated task.\n\n**Constraints:**\n- The delegate tool is disabled to prevent infinite recursion\n- You still have access to fs, shell, web, memory, and task tools\n- Focus on completing the delegated task, then call task_complete\n\nWork autonomously until the task is complete.";
|
|
9
|
+
export declare const rolePrompts: {
|
|
10
|
+
generic: string;
|
|
11
|
+
researcher: string;
|
|
12
|
+
coder: string;
|
|
13
|
+
analyst: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const systemPrompts: {
|
|
16
|
+
generic: string;
|
|
17
|
+
researcher: string;
|
|
18
|
+
coder: string;
|
|
19
|
+
analyst: string;
|
|
20
|
+
};
|
|
21
|
+
export type AgentRole = keyof typeof systemPrompts;
|
|
22
|
+
export declare const AGENT_ROLES: readonly ["generic", "researcher", "coder", "analyst"];
|
|
23
|
+
export declare const roleCallOptionsSchemas: {
|
|
24
|
+
generic: z.ZodObject<{
|
|
25
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
26
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
27
|
+
workspaceRoot: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
workspaceRoot?: string | undefined;
|
|
30
|
+
sessionId?: string | undefined;
|
|
31
|
+
userId?: string | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
workspaceRoot?: string | undefined;
|
|
34
|
+
sessionId?: string | undefined;
|
|
35
|
+
userId?: string | undefined;
|
|
36
|
+
}>;
|
|
37
|
+
researcher: z.ZodObject<{
|
|
38
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
39
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
40
|
+
workspaceRoot: z.ZodOptional<z.ZodString>;
|
|
41
|
+
searchDepth: z.ZodOptional<z.ZodEnum<["shallow", "deep"]>>;
|
|
42
|
+
sourceTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
workspaceRoot?: string | undefined;
|
|
45
|
+
sessionId?: string | undefined;
|
|
46
|
+
userId?: string | undefined;
|
|
47
|
+
searchDepth?: "shallow" | "deep" | undefined;
|
|
48
|
+
sourceTypes?: string[] | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
workspaceRoot?: string | undefined;
|
|
51
|
+
sessionId?: string | undefined;
|
|
52
|
+
userId?: string | undefined;
|
|
53
|
+
searchDepth?: "shallow" | "deep" | undefined;
|
|
54
|
+
sourceTypes?: string[] | undefined;
|
|
55
|
+
}>;
|
|
56
|
+
coder: z.ZodObject<{
|
|
57
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
58
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
59
|
+
workspaceRoot: z.ZodOptional<z.ZodString>;
|
|
60
|
+
language: z.ZodOptional<z.ZodString>;
|
|
61
|
+
testingStrategy: z.ZodOptional<z.ZodEnum<["unit", "integration", "both", "none"]>>;
|
|
62
|
+
}, "strip", z.ZodTypeAny, {
|
|
63
|
+
workspaceRoot?: string | undefined;
|
|
64
|
+
sessionId?: string | undefined;
|
|
65
|
+
userId?: string | undefined;
|
|
66
|
+
language?: string | undefined;
|
|
67
|
+
testingStrategy?: "none" | "unit" | "integration" | "both" | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
workspaceRoot?: string | undefined;
|
|
70
|
+
sessionId?: string | undefined;
|
|
71
|
+
userId?: string | undefined;
|
|
72
|
+
language?: string | undefined;
|
|
73
|
+
testingStrategy?: "none" | "unit" | "integration" | "both" | undefined;
|
|
74
|
+
}>;
|
|
75
|
+
analyst: z.ZodObject<{
|
|
76
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
77
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
78
|
+
workspaceRoot: z.ZodOptional<z.ZodString>;
|
|
79
|
+
analysisType: z.ZodOptional<z.ZodEnum<["exploratory", "confirmatory"]>>;
|
|
80
|
+
outputFormat: z.ZodOptional<z.ZodEnum<["summary", "detailed", "visual"]>>;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
workspaceRoot?: string | undefined;
|
|
83
|
+
sessionId?: string | undefined;
|
|
84
|
+
userId?: string | undefined;
|
|
85
|
+
analysisType?: "exploratory" | "confirmatory" | undefined;
|
|
86
|
+
outputFormat?: "summary" | "detailed" | "visual" | undefined;
|
|
87
|
+
}, {
|
|
88
|
+
workspaceRoot?: string | undefined;
|
|
89
|
+
sessionId?: string | undefined;
|
|
90
|
+
userId?: string | undefined;
|
|
91
|
+
analysisType?: "exploratory" | "confirmatory" | undefined;
|
|
92
|
+
outputFormat?: "summary" | "detailed" | "visual" | undefined;
|
|
93
|
+
}>;
|
|
94
|
+
};
|
|
95
|
+
export interface RoleConfig {
|
|
96
|
+
systemPrompt: string;
|
|
97
|
+
callOptionsSchema: z.ZodType;
|
|
98
|
+
defaultTools?: string[];
|
|
99
|
+
recommendedModel?: string;
|
|
100
|
+
}
|
|
101
|
+
export declare const roleConfigs: Record<AgentRole, RoleConfig>;
|
|
102
|
+
export declare function buildSpawnedAgentPrompt(role: AgentRole): string;
|
|
103
|
+
export declare function getRoleSystemPrompt(role: AgentRole): string;
|
|
104
|
+
export declare function getRoleCallOptionsSchema(role: AgentRole): z.ZodType;
|
|
105
|
+
//# sourceMappingURL=roles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../src/presets/roles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,qBAAqB,qYAUY,CAAC;AAE/C,eAAO,MAAM,WAAW;;;;;CA+EvB,CAAC;AAsCF,eAAO,MAAM,aAAa;;;;;CAKzB,CAAC;AAMF,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,aAAa,CAAC;AACnD,eAAO,MAAM,WAAW,wDAAyD,CAAC;AAMlF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BlC,CAAC;AAMF,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,UAAU,CAyBrD,CAAC;AAMF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAE/D;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAE3D;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,SAAS,GAAG,CAAC,CAAC,OAAO,CAEnE"}
|
|
@@ -0,0 +1,207 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,YAA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AAU;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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agntk/core - System Prompt Templates
|
|
3
|
+
* Core system prompts for agent behavior
|
|
4
|
+
*
|
|
5
|
+
* @deprecated Use `presets/role-registry.ts` instead. That module is the canonical
|
|
6
|
+
* source of truth for role prompts, used by `createAgent()` via `getRole()`.
|
|
7
|
+
* This file is kept for backward compatibility of public exports only.
|
|
8
|
+
*/
|
|
9
|
+
export declare const systemPrompt = "You are an autonomous agent. Your purpose is to accomplish the user's goal using whatever approach makes sense.\n\n# Philosophy\n\nYou have a mind and you have tools. Tools extend your thinking - use them fluidly as part of reasoning, not as separate mechanical steps.\n\nThere is no single correct workflow. Match your approach to the problem:\n- Reason through it, gather information, reason more, then act\n- Act immediately if the path is obvious\n- Start one approach, realize it's wrong, switch to another\n- Call multiple tools in parallel when they don't depend on each other\n\nWhen something doesn't work, adapt. When you need information, go get it. When uncertain, reason carefully. When clear, act directly.\n\nWhen errors occur, read them carefully. The error message usually points to the fix.\n\n# Action\n\nDo things, don't announce them. Instead of \"I'll search for X\", just search.\n\nBe autonomous. Complete tasks without asking permission at every step. Only ask the user when you genuinely need information only they can provide.\n\n# Thinking Out Loud\n\nBefore each action, briefly state:\n- **Goal**: What am I trying to accomplish?\n- **Approach**: Why is this the right tool/action?\n- **Risk**: What could go wrong?\n\nKeep it concise (1-2 sentences each). This helps the user understand your decisions.\n\n# Efficiency\n\nComplete tasks in the fewest steps possible:\n- Think first: What's the most direct path to the goal?\n- Use the right tool: Each tool's description explains when to use it\n- Chain when independent: Call multiple tools in parallel when they don't depend on each other\n- No random exploration: Every action should have a purpose\n\n# Tools\n\nYou have access to consolidated tools with multiple actions. Use the action parameter to specify what to do:\n\n**fs** - All file operations (read, write, edit, list, glob, grep, move, delete, info, mkdir)\n**shell** - Execute shell commands (with allowlisting for repeated commands)\n**web** - Search the internet (search) or fetch page content (fetch)\n**memory** - Knowledge graph operations (add, search, episodes, fact, entity, related)\n\n**delegate** - Parallel work: tool chains (steps), sub-agents (agent), or background processes (background)\n**task** - Manage background tasks (status, output, cancel, list, cleanup)\n\nAdditional tools: plan, ask_user, task_complete\n\nEach tool's description provides detailed guidance on when and how to use it. Read the descriptions to understand capabilities and constraints.\n\n# Delegation\n\nFor complex work, use the delegate tool:\n- **steps**: Execute multiple tool calls in sequence with dependency handling\n- **agent**: Spawn a specialized sub-agent (coder/researcher/analyst)\n- **background**: Start a long-running shell command\n\nAfter delegating, use the task tool to monitor progress and retrieve output.\n\n# Completion\n\nCall task_complete when you have fully accomplished what the user asked for.\n\nOnly call task_complete when truly done - not planned, not partially done, but actually complete.\n";
|
|
10
|
+
export declare const rolePrompts: Record<string, string>;
|
|
11
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/prompts/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,YAAY,+/FAqExB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAsC9C,CAAC"}
|