@alexnetrebskii/hive-agent 0.23.0 → 0.25.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/dist/agent.d.ts +2 -2
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +56 -359
- package/dist/agent.js.map +1 -1
- package/dist/executor.d.ts +1 -1
- package/dist/executor.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/prompt/index.d.ts +10 -0
- package/dist/prompt/index.d.ts.map +1 -0
- package/dist/prompt/index.js +11 -0
- package/dist/prompt/index.js.map +1 -0
- package/dist/prompt/main-agent-builder.d.ts +92 -0
- package/dist/prompt/main-agent-builder.d.ts.map +1 -0
- package/dist/prompt/main-agent-builder.js +244 -0
- package/dist/prompt/main-agent-builder.js.map +1 -0
- package/dist/prompt/sub-agent-builder.d.ts +137 -0
- package/dist/prompt/sub-agent-builder.d.ts.map +1 -0
- package/dist/prompt/sub-agent-builder.js +342 -0
- package/dist/prompt/sub-agent-builder.js.map +1 -0
- package/dist/prompt/templates.d.ts +87 -0
- package/dist/prompt/templates.d.ts.map +1 -0
- package/dist/prompt/templates.js +338 -0
- package/dist/prompt/templates.js.map +1 -0
- package/dist/prompt/types.d.ts +159 -0
- package/dist/prompt/types.d.ts.map +1 -0
- package/dist/prompt/types.js +5 -0
- package/dist/prompt/types.js.map +1 -0
- package/dist/prompt.d.ts +1 -0
- package/dist/prompt.d.ts.map +1 -1
- package/dist/prompt.js +2 -0
- package/dist/prompt.js.map +1 -1
- package/dist/providers/dataset/base.d.ts +74 -0
- package/dist/providers/dataset/base.d.ts.map +1 -0
- package/dist/providers/dataset/base.js +7 -0
- package/dist/providers/dataset/base.js.map +1 -0
- package/dist/providers/dataset/index.d.ts +8 -0
- package/dist/providers/dataset/index.d.ts.map +1 -0
- package/dist/providers/dataset/index.js +8 -0
- package/dist/providers/dataset/index.js.map +1 -0
- package/dist/providers/dataset/recorder.d.ts +46 -0
- package/dist/providers/dataset/recorder.d.ts.map +1 -0
- package/dist/providers/dataset/recorder.js +105 -0
- package/dist/providers/dataset/recorder.js.map +1 -0
- package/dist/providers/dataset/replayer.d.ts +46 -0
- package/dist/providers/dataset/replayer.d.ts.map +1 -0
- package/dist/providers/dataset/replayer.js +163 -0
- package/dist/providers/dataset/replayer.js.map +1 -0
- package/dist/providers/dataset/tester.d.ts +89 -0
- package/dist/providers/dataset/tester.d.ts.map +1 -0
- package/dist/providers/dataset/tester.js +143 -0
- package/dist/providers/dataset/tester.js.map +1 -0
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +2 -0
- package/dist/providers/index.js.map +1 -1
- package/dist/tools/ask-user.d.ts +11 -0
- package/dist/tools/ask-user.d.ts.map +1 -0
- package/dist/tools/ask-user.js +88 -0
- package/dist/tools/ask-user.js.map +1 -0
- package/dist/tools/index.d.ts +10 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +14 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/output.d.ts +15 -0
- package/dist/tools/output.d.ts.map +1 -0
- package/dist/tools/output.js +40 -0
- package/dist/tools/output.js.map +1 -0
- package/dist/tools/task.d.ts +25 -0
- package/dist/tools/task.d.ts.map +1 -0
- package/dist/tools/task.js +292 -0
- package/dist/tools/task.js.map +1 -0
- package/dist/{todo.d.ts → tools/todo.d.ts} +1 -1
- package/dist/tools/todo.d.ts.map +1 -0
- package/dist/tools/todo.js +476 -0
- package/dist/tools/todo.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/todo.d.ts.map +0 -1
- package/dist/todo.js +0 -325
- package/dist/todo.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,mBAAmB;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAsDjC,YAAY;AACZ,OAAO,EACL,cAAc,EAEf,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,cAAc,EAEf,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,aAAa,EAGd,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EACL,gBAAgB,EACjB,MAAM,kCAAkC,CAAA;AAEzC,YAAY;AACZ,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,mBAAmB;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAsDjC,YAAY;AACZ,OAAO,EACL,cAAc,EAEf,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,cAAc,EAEf,MAAM,2BAA2B,CAAA;AAElC,OAAO,EACL,aAAa,EAGd,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EACL,gBAAgB,EACjB,MAAM,kCAAkC,CAAA;AAEzC,YAAY;AACZ,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB;AACrB,kBAAkB;AAClB,gBAAgB,EAChB,eAAe;AACf,kDAAkD;AAClD,WAAW,EACX,cAAc,EACd,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,aAAa,EAUd,MAAM,aAAa,CAAA;AAEpB,iBAAiB;AACjB,OAAO,EACL,WAAW,EACX,cAAc,EACf,MAAM,iBAAiB,CAAA;AAExB,UAAU;AACV,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,aAAa,EACb,qBAAqB,EAYtB,MAAM,YAAY,CAAA;AAEnB,UAAU;AACV,OAAO,EACL,OAAO,EACP,kBAAkB,EASnB,MAAM,cAAc,CAAA;AAErB,4CAA4C;AAC5C,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,EAUV,MAAM,8BAA8B,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt Builder Module
|
|
3
|
+
*
|
|
4
|
+
* Fluent API builders for creating main agent and sub-agent system prompts.
|
|
5
|
+
*/
|
|
6
|
+
export type { SubAgentDef, ToolDef, ContextPathDef, TaskExample, WorkflowStep, OutputFormat, MainAgentPromptConfig, SubAgentPromptConfig } from './types.js';
|
|
7
|
+
export { MainAgentBuilder } from './main-agent-builder.js';
|
|
8
|
+
export { SubAgentBuilder } from './sub-agent-builder.js';
|
|
9
|
+
export { roleSection, subAgentsTable, questionHandlingSection, directToolsSection, contextStorageSection, rulesSection, taskExamplesSection, subAgentRoleSection, taskSection, workflowSection, guidelinesSection, outputSection } from './templates.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompt/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,YAAY,EACV,WAAW,EACX,OAAO,EACP,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,YAAY,CAAA;AAGnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAGxD,OAAO,EACL,WAAW,EACX,cAAc,EACd,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,aAAa,EACd,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt Builder Module
|
|
3
|
+
*
|
|
4
|
+
* Fluent API builders for creating main agent and sub-agent system prompts.
|
|
5
|
+
*/
|
|
6
|
+
// Builders
|
|
7
|
+
export { MainAgentBuilder } from './main-agent-builder.js';
|
|
8
|
+
export { SubAgentBuilder } from './sub-agent-builder.js';
|
|
9
|
+
// Templates (for advanced customization)
|
|
10
|
+
export { roleSection, subAgentsTable, questionHandlingSection, directToolsSection, contextStorageSection, rulesSection, taskExamplesSection, subAgentRoleSection, taskSection, workflowSection, guidelinesSection, outputSection } from './templates.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompt/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH,WAAW;AACX,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,yCAAyC;AACzC,OAAO,EACL,WAAW,EACX,cAAc,EACd,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,aAAa,EACd,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main Agent Prompt Builder
|
|
3
|
+
*
|
|
4
|
+
* Fluent API for building main agent system prompts.
|
|
5
|
+
*/
|
|
6
|
+
import type { SubAgentDef, ToolDef, ContextPathDef, TaskExample, MainAgentPromptConfig } from './types.js';
|
|
7
|
+
import type { Tool, SubAgentConfig } from '../types.js';
|
|
8
|
+
export declare class MainAgentBuilder {
|
|
9
|
+
private config;
|
|
10
|
+
/**
|
|
11
|
+
* Set the agent's role identity
|
|
12
|
+
*/
|
|
13
|
+
role(role: string): this;
|
|
14
|
+
/**
|
|
15
|
+
* Set the agent's description
|
|
16
|
+
*/
|
|
17
|
+
description(description: string): this;
|
|
18
|
+
/**
|
|
19
|
+
* Add a sub-agent definition manually
|
|
20
|
+
*/
|
|
21
|
+
addSubAgent(name: string, purpose: string, whenToUse: string): this;
|
|
22
|
+
/**
|
|
23
|
+
* Add multiple sub-agents at once (manual definitions)
|
|
24
|
+
*/
|
|
25
|
+
addSubAgents(agents: SubAgentDef[]): this;
|
|
26
|
+
/**
|
|
27
|
+
* Set sub-agents from actual SubAgentConfig objects
|
|
28
|
+
* Extracts name, description, and input parameters automatically
|
|
29
|
+
*/
|
|
30
|
+
agents(configs: SubAgentConfig[]): this;
|
|
31
|
+
/**
|
|
32
|
+
* Configure question handling behavior
|
|
33
|
+
*/
|
|
34
|
+
questionHandling(options: {
|
|
35
|
+
description?: string;
|
|
36
|
+
exampleFlow?: string[];
|
|
37
|
+
}): this;
|
|
38
|
+
/**
|
|
39
|
+
* Add a direct tool manually
|
|
40
|
+
*/
|
|
41
|
+
addTool(name: string, description: string): this;
|
|
42
|
+
/**
|
|
43
|
+
* Add multiple tools at once (manual definitions)
|
|
44
|
+
*/
|
|
45
|
+
addTools(tools: ToolDef[]): this;
|
|
46
|
+
/**
|
|
47
|
+
* Set tools from actual Tool objects
|
|
48
|
+
* Extracts name and description automatically
|
|
49
|
+
*/
|
|
50
|
+
tools(toolObjects: Tool[]): this;
|
|
51
|
+
/**
|
|
52
|
+
* Add a context path definition
|
|
53
|
+
*/
|
|
54
|
+
addContextPath(path: string, description: string): this;
|
|
55
|
+
/**
|
|
56
|
+
* Add multiple context paths at once
|
|
57
|
+
*/
|
|
58
|
+
addContextPaths(paths: ContextPathDef[]): this;
|
|
59
|
+
/**
|
|
60
|
+
* Add a behavioral rule
|
|
61
|
+
*/
|
|
62
|
+
addRule(rule: string): this;
|
|
63
|
+
/**
|
|
64
|
+
* Add multiple rules at once
|
|
65
|
+
*/
|
|
66
|
+
addRules(rules: string[]): this;
|
|
67
|
+
/**
|
|
68
|
+
* Add a task example showing the flow
|
|
69
|
+
*/
|
|
70
|
+
addExample(example: TaskExample): this;
|
|
71
|
+
/**
|
|
72
|
+
* Add multiple examples at once
|
|
73
|
+
*/
|
|
74
|
+
addExamples(examples: TaskExample[]): this;
|
|
75
|
+
/**
|
|
76
|
+
* Add a custom section with title and content
|
|
77
|
+
*/
|
|
78
|
+
addSection(title: string, content: string): this;
|
|
79
|
+
/**
|
|
80
|
+
* Get the current configuration
|
|
81
|
+
*/
|
|
82
|
+
getConfig(): MainAgentPromptConfig;
|
|
83
|
+
/**
|
|
84
|
+
* Build the final system prompt string
|
|
85
|
+
*/
|
|
86
|
+
build(): string;
|
|
87
|
+
/**
|
|
88
|
+
* Reset the builder to initial state
|
|
89
|
+
*/
|
|
90
|
+
reset(): this;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=main-agent-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main-agent-builder.d.ts","sourceRoot":"","sources":["../../src/prompt/main-agent-builder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,OAAO,EACP,cAAc,EACd,WAAW,EACX,qBAAqB,EACtB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAYvD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAOb;IAED;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG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ACH,KAAK,IAAI,MAAM;IA+Ef;;OAEG;IACH,KAAK,IAAI,IAAI;CAWd"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main Agent Prompt Builder
|
|
3
|
+
*
|
|
4
|
+
* Fluent API for building main agent system prompts.
|
|
5
|
+
*/
|
|
6
|
+
import { roleSection, subAgentsTable, subAgentParametersSection, questionHandlingSection, directToolsSection, contextStorageSection, rulesSection, taskExamplesSection } from './templates.js';
|
|
7
|
+
export class MainAgentBuilder {
|
|
8
|
+
config = {
|
|
9
|
+
subAgents: [],
|
|
10
|
+
directTools: [],
|
|
11
|
+
contextPaths: [],
|
|
12
|
+
rules: [],
|
|
13
|
+
examples: [],
|
|
14
|
+
customSections: []
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Set the agent's role identity
|
|
18
|
+
*/
|
|
19
|
+
role(role) {
|
|
20
|
+
this.config.role = role;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Set the agent's description
|
|
25
|
+
*/
|
|
26
|
+
description(description) {
|
|
27
|
+
this.config.description = description;
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Add a sub-agent definition manually
|
|
32
|
+
*/
|
|
33
|
+
addSubAgent(name, purpose, whenToUse) {
|
|
34
|
+
this.config.subAgents.push({ name, purpose, whenToUse });
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Add multiple sub-agents at once (manual definitions)
|
|
39
|
+
*/
|
|
40
|
+
addSubAgents(agents) {
|
|
41
|
+
this.config.subAgents.push(...agents);
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Set sub-agents from actual SubAgentConfig objects
|
|
46
|
+
* Extracts name, description, and input parameters automatically
|
|
47
|
+
*/
|
|
48
|
+
agents(configs) {
|
|
49
|
+
for (const config of configs) {
|
|
50
|
+
// Extract input parameters from inputSchema
|
|
51
|
+
const inputParams = [];
|
|
52
|
+
if (config.inputSchema?.properties) {
|
|
53
|
+
const required = config.inputSchema.required || [];
|
|
54
|
+
for (const [name, prop] of Object.entries(config.inputSchema.properties)) {
|
|
55
|
+
inputParams.push({
|
|
56
|
+
name,
|
|
57
|
+
description: prop.description || '',
|
|
58
|
+
required: required.includes(name)
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
this.config.subAgents.push({
|
|
63
|
+
name: config.name,
|
|
64
|
+
purpose: config.description,
|
|
65
|
+
whenToUse: config.description,
|
|
66
|
+
inputParams: inputParams.length > 0 ? inputParams : undefined
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Configure question handling behavior
|
|
73
|
+
*/
|
|
74
|
+
questionHandling(options) {
|
|
75
|
+
this.config.questionHandling = options;
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Add a direct tool manually
|
|
80
|
+
*/
|
|
81
|
+
addTool(name, description) {
|
|
82
|
+
this.config.directTools.push({ name, description });
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Add multiple tools at once (manual definitions)
|
|
87
|
+
*/
|
|
88
|
+
addTools(tools) {
|
|
89
|
+
this.config.directTools.push(...tools);
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Set tools from actual Tool objects
|
|
94
|
+
* Extracts name and description automatically
|
|
95
|
+
*/
|
|
96
|
+
tools(toolObjects) {
|
|
97
|
+
for (const tool of toolObjects) {
|
|
98
|
+
// Extract first line of description for brevity
|
|
99
|
+
const desc = tool.description.split('\n')[0].trim();
|
|
100
|
+
this.config.directTools.push({
|
|
101
|
+
name: tool.name,
|
|
102
|
+
description: desc
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Add a context path definition
|
|
109
|
+
*/
|
|
110
|
+
addContextPath(path, description) {
|
|
111
|
+
this.config.contextPaths.push({ path, description });
|
|
112
|
+
return this;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Add multiple context paths at once
|
|
116
|
+
*/
|
|
117
|
+
addContextPaths(paths) {
|
|
118
|
+
this.config.contextPaths.push(...paths);
|
|
119
|
+
return this;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Add a behavioral rule
|
|
123
|
+
*/
|
|
124
|
+
addRule(rule) {
|
|
125
|
+
this.config.rules.push(rule);
|
|
126
|
+
return this;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Add multiple rules at once
|
|
130
|
+
*/
|
|
131
|
+
addRules(rules) {
|
|
132
|
+
this.config.rules.push(...rules);
|
|
133
|
+
return this;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Add a task example showing the flow
|
|
137
|
+
*/
|
|
138
|
+
addExample(example) {
|
|
139
|
+
this.config.examples.push(example);
|
|
140
|
+
return this;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Add multiple examples at once
|
|
144
|
+
*/
|
|
145
|
+
addExamples(examples) {
|
|
146
|
+
this.config.examples.push(...examples);
|
|
147
|
+
return this;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Add a custom section with title and content
|
|
151
|
+
*/
|
|
152
|
+
addSection(title, content) {
|
|
153
|
+
this.config.customSections.push({ title, content });
|
|
154
|
+
return this;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get the current configuration
|
|
158
|
+
*/
|
|
159
|
+
getConfig() {
|
|
160
|
+
return { ...this.config };
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Build the final system prompt string
|
|
164
|
+
*/
|
|
165
|
+
build() {
|
|
166
|
+
const sections = [];
|
|
167
|
+
// Role section (required, with default)
|
|
168
|
+
const role = this.config.role || 'an AI assistant';
|
|
169
|
+
sections.push(roleSection(role, this.config.description));
|
|
170
|
+
// Your Role header if we have sub-agents (orchestrator pattern)
|
|
171
|
+
if (this.config.subAgents && this.config.subAgents.length > 0) {
|
|
172
|
+
sections.push('');
|
|
173
|
+
sections.push('## Your Role');
|
|
174
|
+
sections.push('');
|
|
175
|
+
sections.push('1. **Delegate** - Call __task__ tool to spawn sub-agents');
|
|
176
|
+
sections.push('2. **Relay questions** - When sub-agent needs input, call __ask_user__ tool');
|
|
177
|
+
sections.push('3. **Present results** - After sub-agent completes, you MUST output a text message to the user');
|
|
178
|
+
sections.push('');
|
|
179
|
+
sections.push('⚠️ CRITICAL:');
|
|
180
|
+
sections.push('- Make actual tool calls, never write tool names as text');
|
|
181
|
+
sections.push('- After receiving tool results, ALWAYS respond with a text message to the user');
|
|
182
|
+
sections.push('- Never return an empty response');
|
|
183
|
+
}
|
|
184
|
+
// Sub-agents table
|
|
185
|
+
if (this.config.subAgents && this.config.subAgents.length > 0) {
|
|
186
|
+
sections.push('');
|
|
187
|
+
sections.push(subAgentsTable(this.config.subAgents));
|
|
188
|
+
// Add sub-agent parameters documentation
|
|
189
|
+
const paramsSection = subAgentParametersSection(this.config.subAgents);
|
|
190
|
+
if (paramsSection) {
|
|
191
|
+
sections.push('');
|
|
192
|
+
sections.push(paramsSection);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// Question handling
|
|
196
|
+
if (this.config.questionHandling || (this.config.subAgents && this.config.subAgents.length > 0)) {
|
|
197
|
+
sections.push('');
|
|
198
|
+
sections.push(questionHandlingSection(this.config.questionHandling?.description, this.config.questionHandling?.exampleFlow));
|
|
199
|
+
}
|
|
200
|
+
// Direct tools
|
|
201
|
+
if (this.config.directTools && this.config.directTools.length > 0) {
|
|
202
|
+
sections.push('');
|
|
203
|
+
sections.push(directToolsSection(this.config.directTools));
|
|
204
|
+
}
|
|
205
|
+
// Context storage
|
|
206
|
+
if (this.config.contextPaths && this.config.contextPaths.length > 0) {
|
|
207
|
+
sections.push('');
|
|
208
|
+
sections.push(contextStorageSection(this.config.contextPaths));
|
|
209
|
+
}
|
|
210
|
+
// Task examples
|
|
211
|
+
if (this.config.examples && this.config.examples.length > 0) {
|
|
212
|
+
sections.push('');
|
|
213
|
+
sections.push(taskExamplesSection(this.config.examples));
|
|
214
|
+
}
|
|
215
|
+
// Custom sections
|
|
216
|
+
for (const section of this.config.customSections || []) {
|
|
217
|
+
sections.push('');
|
|
218
|
+
sections.push(`## ${section.title}`);
|
|
219
|
+
sections.push('');
|
|
220
|
+
sections.push(section.content);
|
|
221
|
+
}
|
|
222
|
+
// Rules (always at the end)
|
|
223
|
+
if (this.config.rules && this.config.rules.length > 0) {
|
|
224
|
+
sections.push('');
|
|
225
|
+
sections.push(rulesSection(this.config.rules));
|
|
226
|
+
}
|
|
227
|
+
return sections.join('\n');
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Reset the builder to initial state
|
|
231
|
+
*/
|
|
232
|
+
reset() {
|
|
233
|
+
this.config = {
|
|
234
|
+
subAgents: [],
|
|
235
|
+
directTools: [],
|
|
236
|
+
contextPaths: [],
|
|
237
|
+
rules: [],
|
|
238
|
+
examples: [],
|
|
239
|
+
customSections: []
|
|
240
|
+
};
|
|
241
|
+
return this;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=main-agent-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main-agent-builder.js","sourceRoot":"","sources":["../../src/prompt/main-agent-builder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EACL,WAAW,EACX,cAAc,EACd,yBAAyB,EACzB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,EACpB,MAAM,gBAAgB,CAAA;AAEvB,MAAM,OAAO,gBAAgB;IACnB,MAAM,GAA0B;QACtC,SAAS,EAAE,EAAE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
|
|
1
|
+
/**
|
|
2
|
+
* Sub-Agent Prompt Builder
|
|
3
|
+
*
|
|
4
|
+
* Fluent API for building sub-agent system prompts.
|
|
5
|
+
*/
|
|
6
|
+
import type { WorkflowStep, OutputFormat, SubAgentPromptConfig, ContextPathDef, ToolStepRef, ChecklistItem, SubAgentExample } from './types.js';
|
|
7
|
+
import type { Tool, JSONSchema } from '../types.js';
|
|
8
|
+
export declare class SubAgentBuilder {
|
|
9
|
+
private config;
|
|
10
|
+
/**
|
|
11
|
+
* Set the sub-agent's role (e.g., "a Nutrition Counter assistant")
|
|
12
|
+
*/
|
|
13
|
+
role(role: string): this;
|
|
14
|
+
/**
|
|
15
|
+
* Set the task description
|
|
16
|
+
*/
|
|
17
|
+
task(task: string): this;
|
|
18
|
+
/**
|
|
19
|
+
* Add step-by-step instructions
|
|
20
|
+
*/
|
|
21
|
+
instructions(instructions: string[]): this;
|
|
22
|
+
/**
|
|
23
|
+
* Add a single instruction
|
|
24
|
+
*/
|
|
25
|
+
addInstruction(instruction: string): this;
|
|
26
|
+
/**
|
|
27
|
+
* Enable todo tracking - AI will plan and track its own work
|
|
28
|
+
* @param options.exampleSteps - Example todos to guide the AI (optional)
|
|
29
|
+
*/
|
|
30
|
+
useTodoTracking(options?: {
|
|
31
|
+
exampleSteps?: string[];
|
|
32
|
+
}): this;
|
|
33
|
+
/**
|
|
34
|
+
* Add guidance items (without todo tracking)
|
|
35
|
+
* @deprecated Use useTodoTracking() for progress tracking, or addGuidelines() for static guidance
|
|
36
|
+
*/
|
|
37
|
+
checklist(items: (string | ChecklistItem)[], options?: {
|
|
38
|
+
sequential?: boolean;
|
|
39
|
+
trackProgress?: boolean;
|
|
40
|
+
}): this;
|
|
41
|
+
/**
|
|
42
|
+
* Add an input/output example
|
|
43
|
+
*/
|
|
44
|
+
addExample(input: string, output: string, explanation?: string): this;
|
|
45
|
+
/**
|
|
46
|
+
* Add multiple examples at once
|
|
47
|
+
*/
|
|
48
|
+
examples(examples: SubAgentExample[]): this;
|
|
49
|
+
/**
|
|
50
|
+
* Add a constraint (thing to avoid)
|
|
51
|
+
*/
|
|
52
|
+
addConstraint(constraint: string): this;
|
|
53
|
+
/**
|
|
54
|
+
* Add multiple constraints at once
|
|
55
|
+
*/
|
|
56
|
+
constraints(constraints: string[]): this;
|
|
57
|
+
/**
|
|
58
|
+
* Add a workflow step
|
|
59
|
+
*/
|
|
60
|
+
addStep(step: WorkflowStep): this;
|
|
61
|
+
/**
|
|
62
|
+
* Add a step that may ask a question
|
|
63
|
+
*/
|
|
64
|
+
addQuestionStep(description: string, askQuestion: {
|
|
65
|
+
condition?: string;
|
|
66
|
+
question: string;
|
|
67
|
+
options?: string[];
|
|
68
|
+
}): this;
|
|
69
|
+
/**
|
|
70
|
+
* Add a step with tool calls
|
|
71
|
+
*/
|
|
72
|
+
addToolStep(description: string, toolCalls: string[]): this;
|
|
73
|
+
/**
|
|
74
|
+
* Add a guideline
|
|
75
|
+
*/
|
|
76
|
+
addGuideline(guideline: string): this;
|
|
77
|
+
/**
|
|
78
|
+
* Add multiple guidelines at once
|
|
79
|
+
*/
|
|
80
|
+
addGuidelines(guidelines: string[]): this;
|
|
81
|
+
/**
|
|
82
|
+
* Enable context discovery - agent will check context before starting work
|
|
83
|
+
*/
|
|
84
|
+
useContext(): this;
|
|
85
|
+
/**
|
|
86
|
+
* Add a context path the agent should check
|
|
87
|
+
*/
|
|
88
|
+
addContextPath(path: string, description: string): this;
|
|
89
|
+
/**
|
|
90
|
+
* Add multiple context paths at once
|
|
91
|
+
*/
|
|
92
|
+
addContextPaths(paths: ContextPathDef[]): this;
|
|
93
|
+
/**
|
|
94
|
+
* Set the output format
|
|
95
|
+
*/
|
|
96
|
+
output(format: OutputFormat): this;
|
|
97
|
+
/**
|
|
98
|
+
* Shorthand for common output format
|
|
99
|
+
* @deprecated Use outputSchema() instead for type-safe output definition
|
|
100
|
+
*/
|
|
101
|
+
outputWithSummary(summaryTemplate: string, dataFields: Record<string, string>, errorCase?: {
|
|
102
|
+
condition: string;
|
|
103
|
+
data: Record<string, unknown>;
|
|
104
|
+
}): this;
|
|
105
|
+
/**
|
|
106
|
+
* Set output schema - generates output instructions from the schema
|
|
107
|
+
* This is the preferred way to define output format (type-safe)
|
|
108
|
+
*/
|
|
109
|
+
outputSchema(schema: JSONSchema): this;
|
|
110
|
+
/**
|
|
111
|
+
* Set available tools from actual Tool objects
|
|
112
|
+
* Extracts name and description automatically for documentation
|
|
113
|
+
*/
|
|
114
|
+
tools(toolObjects: Tool[]): this;
|
|
115
|
+
/**
|
|
116
|
+
* Add a workflow step that uses specific tools
|
|
117
|
+
* Type-safe alternative to addToolStep with string arrays
|
|
118
|
+
*/
|
|
119
|
+
addToolsStep(description: string, toolRefs: ToolStepRef[]): this;
|
|
120
|
+
/**
|
|
121
|
+
* Add a custom section
|
|
122
|
+
*/
|
|
123
|
+
addSection(title: string, content: string): this;
|
|
124
|
+
/**
|
|
125
|
+
* Get the current configuration
|
|
126
|
+
*/
|
|
127
|
+
getConfig(): SubAgentPromptConfig;
|
|
128
|
+
/**
|
|
129
|
+
* Build the final system prompt string
|
|
130
|
+
*/
|
|
131
|
+
build(): string;
|
|
132
|
+
/**
|
|
133
|
+
* Reset the builder to initial state
|
|
134
|
+
*/
|
|
135
|
+
reset(): this;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=sub-agent-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sub-agent-builder.d.ts","sourceRoot":"","sources":["../../src/prompt/sub-agent-builder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EAEZ,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,aAAa,EACb,eAAe,EAChB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAgBnD,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAA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