@alexnetrebskii/hive-agent 0.24.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.
Files changed (61) hide show
  1. package/dist/agent.d.ts +2 -2
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +48 -360
  4. package/dist/agent.js.map +1 -1
  5. package/dist/executor.d.ts +1 -1
  6. package/dist/executor.d.ts.map +1 -1
  7. package/dist/index.d.ts +2 -2
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +6 -2
  10. package/dist/index.js.map +1 -1
  11. package/dist/prompt/index.d.ts +10 -0
  12. package/dist/prompt/index.d.ts.map +1 -0
  13. package/dist/prompt/index.js +11 -0
  14. package/dist/prompt/index.js.map +1 -0
  15. package/dist/prompt/main-agent-builder.d.ts +92 -0
  16. package/dist/prompt/main-agent-builder.d.ts.map +1 -0
  17. package/dist/prompt/main-agent-builder.js +244 -0
  18. package/dist/prompt/main-agent-builder.js.map +1 -0
  19. package/dist/prompt/sub-agent-builder.d.ts +137 -0
  20. package/dist/prompt/sub-agent-builder.d.ts.map +1 -0
  21. package/dist/prompt/sub-agent-builder.js +342 -0
  22. package/dist/prompt/sub-agent-builder.js.map +1 -0
  23. package/dist/prompt/templates.d.ts +87 -0
  24. package/dist/prompt/templates.d.ts.map +1 -0
  25. package/dist/prompt/templates.js +338 -0
  26. package/dist/prompt/templates.js.map +1 -0
  27. package/dist/prompt/types.d.ts +159 -0
  28. package/dist/prompt/types.d.ts.map +1 -0
  29. package/dist/prompt/types.js +5 -0
  30. package/dist/prompt/types.js.map +1 -0
  31. package/dist/prompt.d.ts +1 -0
  32. package/dist/prompt.d.ts.map +1 -1
  33. package/dist/prompt.js +2 -0
  34. package/dist/prompt.js.map +1 -1
  35. package/dist/providers/dataset/recorder.d.ts.map +1 -1
  36. package/dist/providers/dataset/recorder.js +8 -2
  37. package/dist/providers/dataset/recorder.js.map +1 -1
  38. package/dist/tools/ask-user.d.ts +11 -0
  39. package/dist/tools/ask-user.d.ts.map +1 -0
  40. package/dist/tools/ask-user.js +88 -0
  41. package/dist/tools/ask-user.js.map +1 -0
  42. package/dist/tools/index.d.ts +10 -0
  43. package/dist/tools/index.d.ts.map +1 -0
  44. package/dist/tools/index.js +14 -0
  45. package/dist/tools/index.js.map +1 -0
  46. package/dist/tools/output.d.ts +15 -0
  47. package/dist/tools/output.d.ts.map +1 -0
  48. package/dist/tools/output.js +40 -0
  49. package/dist/tools/output.js.map +1 -0
  50. package/dist/tools/task.d.ts +25 -0
  51. package/dist/tools/task.d.ts.map +1 -0
  52. package/dist/tools/task.js +292 -0
  53. package/dist/tools/task.js.map +1 -0
  54. package/dist/{todo.d.ts → tools/todo.d.ts} +1 -1
  55. package/dist/tools/todo.d.ts.map +1 -0
  56. package/dist/tools/todo.js +476 -0
  57. package/dist/tools/todo.js.map +1 -0
  58. package/package.json +1 -1
  59. package/dist/todo.d.ts.map +0 -1
  60. package/dist/todo.js +0 -325
  61. package/dist/todo.js.map +0 -1
@@ -0,0 +1,342 @@
1
+ /**
2
+ * Sub-Agent Prompt Builder
3
+ *
4
+ * Fluent API for building sub-agent system prompts.
5
+ */
6
+ import { subAgentRoleSection, taskSection, workflowSection, guidelinesSection, outputSection, outputSchemaSection, availableToolsSection, instructionsSection, checklistSection, subAgentExamplesSection, constraintsSection, inputParametersSection } from './templates.js';
7
+ export class SubAgentBuilder {
8
+ config = {
9
+ workflow: [],
10
+ guidelines: [],
11
+ instructions: [],
12
+ constraints: [],
13
+ examples: [],
14
+ contextPaths: [],
15
+ useContext: false,
16
+ customSections: [],
17
+ availableTools: []
18
+ };
19
+ /**
20
+ * Set the sub-agent's role (e.g., "a Nutrition Counter assistant")
21
+ */
22
+ role(role) {
23
+ this.config.role = role;
24
+ return this;
25
+ }
26
+ /**
27
+ * Set the task description
28
+ */
29
+ task(task) {
30
+ this.config.task = task;
31
+ return this;
32
+ }
33
+ /**
34
+ * Add step-by-step instructions
35
+ */
36
+ instructions(instructions) {
37
+ this.config.instructions = instructions;
38
+ return this;
39
+ }
40
+ /**
41
+ * Add a single instruction
42
+ */
43
+ addInstruction(instruction) {
44
+ this.config.instructions.push(instruction);
45
+ return this;
46
+ }
47
+ /**
48
+ * Enable todo tracking - AI will plan and track its own work
49
+ * @param options.exampleSteps - Example todos to guide the AI (optional)
50
+ */
51
+ useTodoTracking(options) {
52
+ this.config.checklist = {
53
+ items: (options?.exampleSteps || []).map(step => ({ task: step })),
54
+ trackProgress: true
55
+ };
56
+ return this;
57
+ }
58
+ /**
59
+ * Add guidance items (without todo tracking)
60
+ * @deprecated Use useTodoTracking() for progress tracking, or addGuidelines() for static guidance
61
+ */
62
+ checklist(items, options) {
63
+ this.config.checklist = {
64
+ items: items.map(item => typeof item === 'string' ? { task: item } : item),
65
+ sequential: options?.sequential,
66
+ trackProgress: options?.trackProgress
67
+ };
68
+ return this;
69
+ }
70
+ /**
71
+ * Add an input/output example
72
+ */
73
+ addExample(input, output, explanation) {
74
+ this.config.examples.push({ input, output, explanation });
75
+ return this;
76
+ }
77
+ /**
78
+ * Add multiple examples at once
79
+ */
80
+ examples(examples) {
81
+ this.config.examples.push(...examples);
82
+ return this;
83
+ }
84
+ /**
85
+ * Add a constraint (thing to avoid)
86
+ */
87
+ addConstraint(constraint) {
88
+ this.config.constraints.push(constraint);
89
+ return this;
90
+ }
91
+ /**
92
+ * Add multiple constraints at once
93
+ */
94
+ constraints(constraints) {
95
+ this.config.constraints.push(...constraints);
96
+ return this;
97
+ }
98
+ /**
99
+ * Add a workflow step
100
+ */
101
+ addStep(step) {
102
+ this.config.workflow.push(step);
103
+ return this;
104
+ }
105
+ /**
106
+ * Add a step that may ask a question
107
+ */
108
+ addQuestionStep(description, askQuestion) {
109
+ this.config.workflow.push({
110
+ description,
111
+ askQuestion
112
+ });
113
+ return this;
114
+ }
115
+ /**
116
+ * Add a step with tool calls
117
+ */
118
+ addToolStep(description, toolCalls) {
119
+ this.config.workflow.push({
120
+ description,
121
+ toolCalls
122
+ });
123
+ return this;
124
+ }
125
+ /**
126
+ * Add a guideline
127
+ */
128
+ addGuideline(guideline) {
129
+ this.config.guidelines.push(guideline);
130
+ return this;
131
+ }
132
+ /**
133
+ * Add multiple guidelines at once
134
+ */
135
+ addGuidelines(guidelines) {
136
+ this.config.guidelines.push(...guidelines);
137
+ return this;
138
+ }
139
+ /**
140
+ * Enable context discovery - agent will check context before starting work
141
+ */
142
+ useContext() {
143
+ this.config.useContext = true;
144
+ return this;
145
+ }
146
+ /**
147
+ * Add a context path the agent should check
148
+ */
149
+ addContextPath(path, description) {
150
+ this.config.contextPaths.push({ path, description });
151
+ this.config.useContext = true;
152
+ return this;
153
+ }
154
+ /**
155
+ * Add multiple context paths at once
156
+ */
157
+ addContextPaths(paths) {
158
+ this.config.contextPaths.push(...paths);
159
+ this.config.useContext = true;
160
+ return this;
161
+ }
162
+ /**
163
+ * Set the output format
164
+ */
165
+ output(format) {
166
+ this.config.output = format;
167
+ return this;
168
+ }
169
+ /**
170
+ * Shorthand for common output format
171
+ * @deprecated Use outputSchema() instead for type-safe output definition
172
+ */
173
+ outputWithSummary(summaryTemplate, dataFields, errorCase) {
174
+ this.config.output = {
175
+ summaryTemplate,
176
+ dataFields,
177
+ errorCase
178
+ };
179
+ return this;
180
+ }
181
+ /**
182
+ * Set output schema - generates output instructions from the schema
183
+ * This is the preferred way to define output format (type-safe)
184
+ */
185
+ outputSchema(schema) {
186
+ // Convert JSONSchema to OutputSchema format
187
+ this.config.outputSchema = schema;
188
+ return this;
189
+ }
190
+ /**
191
+ * Set available tools from actual Tool objects
192
+ * Extracts name and description automatically for documentation
193
+ */
194
+ tools(toolObjects) {
195
+ for (const tool of toolObjects) {
196
+ // Extract first line of description for brevity
197
+ const desc = tool.description.split('\n')[0].trim();
198
+ this.config.availableTools.push({
199
+ name: tool.name,
200
+ description: desc
201
+ });
202
+ }
203
+ return this;
204
+ }
205
+ /**
206
+ * Add a workflow step that uses specific tools
207
+ * Type-safe alternative to addToolStep with string arrays
208
+ */
209
+ addToolsStep(description, toolRefs) {
210
+ const toolCalls = toolRefs.map(ref => {
211
+ const purpose = ref.purpose ? ` - ${ref.purpose}` : '';
212
+ return `${ref.tool.name}${purpose}`;
213
+ });
214
+ this.config.workflow.push({
215
+ description,
216
+ toolCalls
217
+ });
218
+ return this;
219
+ }
220
+ /**
221
+ * Add a custom section
222
+ */
223
+ addSection(title, content) {
224
+ this.config.customSections.push({ title, content });
225
+ return this;
226
+ }
227
+ /**
228
+ * Get the current configuration
229
+ */
230
+ getConfig() {
231
+ return { ...this.config };
232
+ }
233
+ /**
234
+ * Build the final system prompt string
235
+ */
236
+ build() {
237
+ const sections = [];
238
+ // Role section (required, with default)
239
+ const role = this.config.role || 'a specialized assistant';
240
+ sections.push(subAgentRoleSection(role));
241
+ // Task section
242
+ if (this.config.task) {
243
+ sections.push('');
244
+ sections.push(taskSection(this.config.task));
245
+ }
246
+ // Instructions section
247
+ if (this.config.instructions && this.config.instructions.length > 0) {
248
+ sections.push('');
249
+ sections.push(instructionsSection(this.config.instructions));
250
+ }
251
+ // Checklist section
252
+ if (this.config.checklist && this.config.checklist.items.length > 0) {
253
+ sections.push('');
254
+ sections.push(checklistSection(this.config.checklist));
255
+ }
256
+ // Available tools section (before context discovery)
257
+ if (this.config.availableTools && this.config.availableTools.length > 0) {
258
+ sections.push('');
259
+ sections.push(availableToolsSection(this.config.availableTools));
260
+ }
261
+ // Context discovery section (before workflow)
262
+ if (this.config.useContext) {
263
+ sections.push('');
264
+ sections.push('## Context Discovery (Do This First!)');
265
+ sections.push('');
266
+ sections.push('⚠️ ALWAYS check context BEFORE asking questions or starting work:');
267
+ sections.push('');
268
+ sections.push('1. Use **context_ls** to see what data exists');
269
+ sections.push('2. Use **context_read** to read relevant paths');
270
+ sections.push('3. Use information from context instead of asking the user');
271
+ if (this.config.contextPaths && this.config.contextPaths.length > 0) {
272
+ sections.push('');
273
+ sections.push('Check these paths:');
274
+ for (const path of this.config.contextPaths) {
275
+ sections.push(`- ${path.path} - ${path.description}`);
276
+ }
277
+ }
278
+ }
279
+ // Check if we have question steps with conditions - add input parameters section
280
+ const hasQuestionSteps = this.config.workflow?.some(step => step.askQuestion?.condition);
281
+ if (hasQuestionSteps) {
282
+ sections.push('');
283
+ sections.push(inputParametersSection());
284
+ }
285
+ // Workflow steps
286
+ if (this.config.workflow && this.config.workflow.length > 0) {
287
+ sections.push('');
288
+ sections.push(workflowSection(this.config.workflow));
289
+ }
290
+ // Guidelines
291
+ if (this.config.guidelines && this.config.guidelines.length > 0) {
292
+ sections.push('');
293
+ sections.push(guidelinesSection(this.config.guidelines));
294
+ }
295
+ // Constraints section
296
+ if (this.config.constraints && this.config.constraints.length > 0) {
297
+ sections.push('');
298
+ sections.push(constraintsSection(this.config.constraints));
299
+ }
300
+ // Examples section
301
+ if (this.config.examples && this.config.examples.length > 0) {
302
+ sections.push('');
303
+ sections.push(subAgentExamplesSection(this.config.examples));
304
+ }
305
+ // Custom sections
306
+ for (const section of this.config.customSections || []) {
307
+ sections.push('');
308
+ sections.push(`## ${section.title}`);
309
+ sections.push('');
310
+ sections.push(section.content);
311
+ }
312
+ // Output format (always at the end)
313
+ // Prefer outputSchema over deprecated output format
314
+ if (this.config.outputSchema) {
315
+ sections.push('');
316
+ sections.push(outputSchemaSection(this.config.outputSchema));
317
+ }
318
+ else if (this.config.output) {
319
+ sections.push('');
320
+ sections.push(outputSection(this.config.output));
321
+ }
322
+ return sections.join('\n');
323
+ }
324
+ /**
325
+ * Reset the builder to initial state
326
+ */
327
+ reset() {
328
+ this.config = {
329
+ workflow: [],
330
+ guidelines: [],
331
+ instructions: [],
332
+ constraints: [],
333
+ examples: [],
334
+ contextPaths: [],
335
+ useContext: false,
336
+ customSections: [],
337
+ availableTools: []
338
+ };
339
+ return this;
340
+ }
341
+ }
342
+ //# sourceMappingURL=sub-agent-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sub-agent-builder.js","sourceRoot":"","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G;YACZ,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,EAAE;YACd,YAAY,EAAE,EAAE;YAChB,WAAW,EAAE,EAAE;YACf,QAAQ,EAAE,EAAE;YACZ,YAAY,EAAE,EAAE;YAChB,UAAU,EAAE,KAAK;YACjB,cAAc,EAAE,EAAE;YAClB,cAAc,EAAE,EAAE;SACnB,CAAA;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Prompt Templates
3
+ *
4
+ * Template functions for generating prompt sections.
5
+ */
6
+ import type { SubAgentDef, ToolDef, ContextPathDef, TaskExample, WorkflowStep, OutputFormat, OutputSchema, ChecklistConfig, SubAgentExample } from './types.js';
7
+ /**
8
+ * Generate role section
9
+ */
10
+ export declare function roleSection(role: string, description?: string): string;
11
+ /**
12
+ * Generate sub-agents table
13
+ */
14
+ export declare function subAgentsTable(agents: SubAgentDef[]): string;
15
+ /**
16
+ * Generate sub-agent parameters documentation
17
+ */
18
+ export declare function subAgentParametersSection(agents: SubAgentDef[]): string;
19
+ /**
20
+ * Generate question handling section
21
+ */
22
+ export declare function questionHandlingSection(description?: string, exampleFlow?: string[]): string;
23
+ /**
24
+ * Generate direct tools section
25
+ */
26
+ export declare function directToolsSection(tools: ToolDef[]): string;
27
+ /**
28
+ * Generate context storage section
29
+ */
30
+ export declare function contextStorageSection(paths: ContextPathDef[]): string;
31
+ /**
32
+ * Generate rules section
33
+ */
34
+ export declare function rulesSection(rules: string[]): string;
35
+ /**
36
+ * Generate task examples section
37
+ */
38
+ export declare function taskExamplesSection(examples: TaskExample[]): string;
39
+ /**
40
+ * Generate sub-agent role section
41
+ */
42
+ export declare function subAgentRoleSection(role: string): string;
43
+ /**
44
+ * Generate input parameters section - explains how to check provided parameters
45
+ */
46
+ export declare function inputParametersSection(): string;
47
+ /**
48
+ * Generate task section
49
+ */
50
+ export declare function taskSection(task: string): string;
51
+ /**
52
+ * Generate workflow steps section
53
+ */
54
+ export declare function workflowSection(steps: WorkflowStep[]): string;
55
+ /**
56
+ * Generate guidelines section
57
+ */
58
+ export declare function guidelinesSection(guidelines: string[]): string;
59
+ /**
60
+ * Generate output section
61
+ */
62
+ export declare function outputSection(output: OutputFormat): string;
63
+ /**
64
+ * Generate output section from JSON schema
65
+ */
66
+ export declare function outputSchemaSection(schema: OutputSchema): string;
67
+ /**
68
+ * Generate available tools section for sub-agents
69
+ */
70
+ export declare function availableToolsSection(tools: ToolDef[]): string;
71
+ /**
72
+ * Generate instructions section
73
+ */
74
+ export declare function instructionsSection(instructions: string[]): string;
75
+ /**
76
+ * Generate checklist section
77
+ */
78
+ export declare function checklistSection(config: ChecklistConfig): string;
79
+ /**
80
+ * Generate examples section for sub-agents
81
+ */
82
+ export declare function subAgentExamplesSection(examples: SubAgentExample[]): string;
83
+ /**
84
+ * Generate constraints section
85
+ */
86
+ export declare function constraintsSection(constraints: string[]): string;
87
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/prompt/templates.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,OAAO,EACP,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,eAAe,EAChB,MAAM,YAAY,CAAA;AAMnB;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAMtE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAe5D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAwBvE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,CAAC,EAAE,MAAM,EACpB,WAAW,CAAC,EAAE,MAAM,EAAE,GACrB,MAAM,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