tuplet 2.7.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/LICENSE +21 -0
- package/README.md +136 -0
- package/dist/agent.d.ts +46 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +393 -0
- package/dist/agent.js.map +1 -0
- package/dist/built-in-agents/explore.d.ts +9 -0
- package/dist/built-in-agents/explore.d.ts.map +1 -0
- package/dist/built-in-agents/explore.js +40 -0
- package/dist/built-in-agents/explore.js.map +1 -0
- package/dist/built-in-agents/index.d.ts +15 -0
- package/dist/built-in-agents/index.d.ts.map +1 -0
- package/dist/built-in-agents/index.js +19 -0
- package/dist/built-in-agents/index.js.map +1 -0
- package/dist/built-in-agents/plan.d.ts +10 -0
- package/dist/built-in-agents/plan.d.ts.map +1 -0
- package/dist/built-in-agents/plan.js +62 -0
- package/dist/built-in-agents/plan.js.map +1 -0
- package/dist/built-in-agents/worker.d.ts +9 -0
- package/dist/built-in-agents/worker.d.ts.map +1 -0
- package/dist/built-in-agents/worker.js +53 -0
- package/dist/built-in-agents/worker.js.map +1 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +18 -0
- package/dist/constants.js.map +1 -0
- package/dist/context-manager.d.ts +65 -0
- package/dist/context-manager.d.ts.map +1 -0
- package/dist/context-manager.js +272 -0
- package/dist/context-manager.js.map +1 -0
- package/dist/context-manager.test.d.ts +2 -0
- package/dist/context-manager.test.d.ts.map +1 -0
- package/dist/context-manager.test.js +394 -0
- package/dist/context-manager.test.js.map +1 -0
- package/dist/executor.d.ts +29 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +399 -0
- package/dist/executor.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/prompt/index.d.ts +9 -0
- package/dist/prompt/index.d.ts.map +1 -0
- package/dist/prompt/index.js +10 -0
- package/dist/prompt/index.js.map +1 -0
- package/dist/prompt/main-agent-builder.d.ts +81 -0
- package/dist/prompt/main-agent-builder.d.ts.map +1 -0
- package/dist/prompt/main-agent-builder.js +287 -0
- package/dist/prompt/main-agent-builder.js.map +1 -0
- package/dist/prompt/sub-agent-builder.d.ts +133 -0
- package/dist/prompt/sub-agent-builder.d.ts.map +1 -0
- package/dist/prompt/sub-agent-builder.js +337 -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 +343 -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 +32 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +86 -0
- package/dist/prompt.js.map +1 -0
- 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/env/memory.d.ts +14 -0
- package/dist/providers/env/memory.d.ts.map +1 -0
- package/dist/providers/env/memory.js +19 -0
- package/dist/providers/env/memory.js.map +1 -0
- package/dist/providers/index.d.ts +12 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +10 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/llm/base.d.ts +7 -0
- package/dist/providers/llm/base.d.ts.map +1 -0
- package/dist/providers/llm/base.js +7 -0
- package/dist/providers/llm/base.js.map +1 -0
- package/dist/providers/llm/claude.d.ts +32 -0
- package/dist/providers/llm/claude.d.ts.map +1 -0
- package/dist/providers/llm/claude.js +171 -0
- package/dist/providers/llm/claude.js.map +1 -0
- package/dist/providers/llm/openai.d.ts +26 -0
- package/dist/providers/llm/openai.d.ts.map +1 -0
- package/dist/providers/llm/openai.js +174 -0
- package/dist/providers/llm/openai.js.map +1 -0
- package/dist/providers/llm/openrouter.d.ts +43 -0
- package/dist/providers/llm/openrouter.d.ts.map +1 -0
- package/dist/providers/llm/openrouter.js +288 -0
- package/dist/providers/llm/openrouter.js.map +1 -0
- package/dist/providers/logger/base.d.ts +7 -0
- package/dist/providers/logger/base.d.ts.map +1 -0
- package/dist/providers/logger/base.js +7 -0
- package/dist/providers/logger/base.js.map +1 -0
- package/dist/providers/logger/console.d.ts +29 -0
- package/dist/providers/logger/console.d.ts.map +1 -0
- package/dist/providers/logger/console.js +70 -0
- package/dist/providers/logger/console.js.map +1 -0
- package/dist/providers/repository/base.d.ts +7 -0
- package/dist/providers/repository/base.d.ts.map +1 -0
- package/dist/providers/repository/base.js +7 -0
- package/dist/providers/repository/base.js.map +1 -0
- package/dist/providers/repository/memory.d.ts +21 -0
- package/dist/providers/repository/memory.d.ts.map +1 -0
- package/dist/providers/repository/memory.js +50 -0
- package/dist/providers/repository/memory.js.map +1 -0
- package/dist/providers/workspace/file.d.ts +26 -0
- package/dist/providers/workspace/file.d.ts.map +1 -0
- package/dist/providers/workspace/file.js +151 -0
- package/dist/providers/workspace/file.js.map +1 -0
- package/dist/providers/workspace/index.d.ts +7 -0
- package/dist/providers/workspace/index.d.ts.map +1 -0
- package/dist/providers/workspace/index.js +6 -0
- package/dist/providers/workspace/index.js.map +1 -0
- package/dist/providers/workspace/memory.d.ts +26 -0
- package/dist/providers/workspace/memory.d.ts.map +1 -0
- package/dist/providers/workspace/memory.js +136 -0
- package/dist/providers/workspace/memory.js.map +1 -0
- package/dist/providers/workspace/types.d.ts +27 -0
- package/dist/providers/workspace/types.d.ts.map +1 -0
- package/dist/providers/workspace/types.js +8 -0
- package/dist/providers/workspace/types.js.map +1 -0
- package/dist/providers/workspace/workspace-provider.test.d.ts +2 -0
- package/dist/providers/workspace/workspace-provider.test.d.ts.map +1 -0
- package/dist/providers/workspace/workspace-provider.test.js +250 -0
- package/dist/providers/workspace/workspace-provider.test.js.map +1 -0
- package/dist/shell/commands/browse.d.ts +6 -0
- package/dist/shell/commands/browse.d.ts.map +1 -0
- package/dist/shell/commands/browse.js +158 -0
- package/dist/shell/commands/browse.js.map +1 -0
- package/dist/shell/commands/cat.d.ts +6 -0
- package/dist/shell/commands/cat.d.ts.map +1 -0
- package/dist/shell/commands/cat.js +104 -0
- package/dist/shell/commands/cat.js.map +1 -0
- package/dist/shell/commands/curl.d.ts +6 -0
- package/dist/shell/commands/curl.d.ts.map +1 -0
- package/dist/shell/commands/curl.js +190 -0
- package/dist/shell/commands/curl.js.map +1 -0
- package/dist/shell/commands/date.d.ts +6 -0
- package/dist/shell/commands/date.d.ts.map +1 -0
- package/dist/shell/commands/date.js +151 -0
- package/dist/shell/commands/date.js.map +1 -0
- package/dist/shell/commands/echo.d.ts +6 -0
- package/dist/shell/commands/echo.d.ts.map +1 -0
- package/dist/shell/commands/echo.js +48 -0
- package/dist/shell/commands/echo.js.map +1 -0
- package/dist/shell/commands/env.d.ts +8 -0
- package/dist/shell/commands/env.d.ts.map +1 -0
- package/dist/shell/commands/env.js +41 -0
- package/dist/shell/commands/env.js.map +1 -0
- package/dist/shell/commands/file.d.ts +6 -0
- package/dist/shell/commands/file.d.ts.map +1 -0
- package/dist/shell/commands/file.js +213 -0
- package/dist/shell/commands/file.js.map +1 -0
- package/dist/shell/commands/find.d.ts +6 -0
- package/dist/shell/commands/find.d.ts.map +1 -0
- package/dist/shell/commands/find.js +100 -0
- package/dist/shell/commands/find.js.map +1 -0
- package/dist/shell/commands/grep.d.ts +6 -0
- package/dist/shell/commands/grep.d.ts.map +1 -0
- package/dist/shell/commands/grep.js +229 -0
- package/dist/shell/commands/grep.js.map +1 -0
- package/dist/shell/commands/head.d.ts +6 -0
- package/dist/shell/commands/head.d.ts.map +1 -0
- package/dist/shell/commands/head.js +88 -0
- package/dist/shell/commands/head.js.map +1 -0
- package/dist/shell/commands/index.d.ts +25 -0
- package/dist/shell/commands/index.d.ts.map +1 -0
- package/dist/shell/commands/index.js +43 -0
- package/dist/shell/commands/index.js.map +1 -0
- package/dist/shell/commands/jq.d.ts +8 -0
- package/dist/shell/commands/jq.d.ts.map +1 -0
- package/dist/shell/commands/jq.js +233 -0
- package/dist/shell/commands/jq.js.map +1 -0
- package/dist/shell/commands/ls.d.ts +6 -0
- package/dist/shell/commands/ls.d.ts.map +1 -0
- package/dist/shell/commands/ls.js +88 -0
- package/dist/shell/commands/ls.js.map +1 -0
- package/dist/shell/commands/mkdir.d.ts +6 -0
- package/dist/shell/commands/mkdir.d.ts.map +1 -0
- package/dist/shell/commands/mkdir.js +43 -0
- package/dist/shell/commands/mkdir.js.map +1 -0
- package/dist/shell/commands/rm.d.ts +6 -0
- package/dist/shell/commands/rm.d.ts.map +1 -0
- package/dist/shell/commands/rm.js +64 -0
- package/dist/shell/commands/rm.js.map +1 -0
- package/dist/shell/commands/sed.d.ts +6 -0
- package/dist/shell/commands/sed.d.ts.map +1 -0
- package/dist/shell/commands/sed.js +414 -0
- package/dist/shell/commands/sed.js.map +1 -0
- package/dist/shell/commands/sort.d.ts +6 -0
- package/dist/shell/commands/sort.d.ts.map +1 -0
- package/dist/shell/commands/sort.js +109 -0
- package/dist/shell/commands/sort.js.map +1 -0
- package/dist/shell/commands/tail.d.ts +6 -0
- package/dist/shell/commands/tail.d.ts.map +1 -0
- package/dist/shell/commands/tail.js +68 -0
- package/dist/shell/commands/tail.js.map +1 -0
- package/dist/shell/commands/wc.d.ts +6 -0
- package/dist/shell/commands/wc.d.ts.map +1 -0
- package/dist/shell/commands/wc.js +86 -0
- package/dist/shell/commands/wc.js.map +1 -0
- package/dist/shell/index.d.ts +10 -0
- package/dist/shell/index.d.ts.map +1 -0
- package/dist/shell/index.js +10 -0
- package/dist/shell/index.js.map +1 -0
- package/dist/shell/limits.d.ts +5 -0
- package/dist/shell/limits.d.ts.map +1 -0
- package/dist/shell/limits.js +5 -0
- package/dist/shell/limits.js.map +1 -0
- package/dist/shell/parser.d.ts +8 -0
- package/dist/shell/parser.d.ts.map +1 -0
- package/dist/shell/parser.js +307 -0
- package/dist/shell/parser.js.map +1 -0
- package/dist/shell/path-validation.d.ts +35 -0
- package/dist/shell/path-validation.d.ts.map +1 -0
- package/dist/shell/path-validation.js +81 -0
- package/dist/shell/path-validation.js.map +1 -0
- package/dist/shell/shell.d.ts +66 -0
- package/dist/shell/shell.d.ts.map +1 -0
- package/dist/shell/shell.js +301 -0
- package/dist/shell/shell.js.map +1 -0
- package/dist/shell/shell.test.d.ts +2 -0
- package/dist/shell/shell.test.d.ts.map +1 -0
- package/dist/shell/shell.test.js +1088 -0
- package/dist/shell/shell.test.js.map +1 -0
- package/dist/shell/types.d.ts +82 -0
- package/dist/shell/types.d.ts.map +1 -0
- package/dist/shell/types.js +5 -0
- package/dist/shell/types.js.map +1 -0
- package/dist/summarizer.d.ts +28 -0
- package/dist/summarizer.d.ts.map +1 -0
- package/dist/summarizer.js +136 -0
- package/dist/summarizer.js.map +1 -0
- package/dist/summarizer.test.d.ts +2 -0
- package/dist/summarizer.test.d.ts.map +1 -0
- package/dist/summarizer.test.js +192 -0
- package/dist/summarizer.test.js.map +1 -0
- 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 +35 -0
- package/dist/tools/ask-user.js.map +1 -0
- package/dist/tools/index.d.ts +11 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +18 -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/shell.d.ts +13 -0
- package/dist/tools/shell.d.ts.map +1 -0
- package/dist/tools/shell.js +166 -0
- package/dist/tools/shell.js.map +1 -0
- package/dist/tools/sub-agent.d.ts +25 -0
- package/dist/tools/sub-agent.d.ts.map +1 -0
- package/dist/tools/sub-agent.js +312 -0
- package/dist/tools/sub-agent.js.map +1 -0
- package/dist/tools/tasks.d.ts +170 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +947 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/trace/builder.d.ts +54 -0
- package/dist/trace/builder.d.ts.map +1 -0
- package/dist/trace/builder.js +229 -0
- package/dist/trace/builder.js.map +1 -0
- package/dist/trace/console.d.ts +45 -0
- package/dist/trace/console.d.ts.map +1 -0
- package/dist/trace/console.js +143 -0
- package/dist/trace/console.js.map +1 -0
- package/dist/trace/index.d.ts +11 -0
- package/dist/trace/index.d.ts.map +1 -0
- package/dist/trace/index.js +11 -0
- package/dist/trace/index.js.map +1 -0
- package/dist/trace/openrouter-pricing.d.ts +9 -0
- package/dist/trace/openrouter-pricing.d.ts.map +1 -0
- package/dist/trace/openrouter-pricing.js +321 -0
- package/dist/trace/openrouter-pricing.js.map +1 -0
- package/dist/trace/pricing.d.ts +13 -0
- package/dist/trace/pricing.d.ts.map +1 -0
- package/dist/trace/pricing.js +41 -0
- package/dist/trace/pricing.js.map +1 -0
- package/dist/trace/types.d.ts +142 -0
- package/dist/trace/types.d.ts.map +1 -0
- package/dist/trace/types.js +16 -0
- package/dist/trace/types.js.map +1 -0
- package/dist/trace.d.ts +5 -0
- package/dist/trace.d.ts.map +1 -0
- package/dist/trace.js +5 -0
- package/dist/trace.js.map +1 -0
- package/dist/types.d.ts +382 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/workspace.d.ts +287 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +560 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,337 @@
|
|
|
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
|
+
workspacePaths: [],
|
|
15
|
+
useWorkspace: 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 guideline
|
|
117
|
+
*/
|
|
118
|
+
addGuideline(guideline) {
|
|
119
|
+
this.config.guidelines.push(guideline);
|
|
120
|
+
return this;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Add multiple guidelines at once
|
|
124
|
+
*/
|
|
125
|
+
addGuidelines(guidelines) {
|
|
126
|
+
this.config.guidelines.push(...guidelines);
|
|
127
|
+
return this;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Enable workspace discovery - agent will check workspace before starting work
|
|
131
|
+
*/
|
|
132
|
+
useWorkspace() {
|
|
133
|
+
this.config.useWorkspace = true;
|
|
134
|
+
return this;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Add a workspace path the agent should check
|
|
138
|
+
*/
|
|
139
|
+
addWorkspacePath(path, description) {
|
|
140
|
+
this.config.workspacePaths.push({ path, description });
|
|
141
|
+
this.config.useWorkspace = true;
|
|
142
|
+
return this;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Add multiple workspace paths at once
|
|
146
|
+
*/
|
|
147
|
+
addWorkspacePaths(paths) {
|
|
148
|
+
this.config.workspacePaths.push(...paths);
|
|
149
|
+
this.config.useWorkspace = true;
|
|
150
|
+
return this;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Set the output format
|
|
154
|
+
*/
|
|
155
|
+
output(format) {
|
|
156
|
+
this.config.output = format;
|
|
157
|
+
return this;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Shorthand for common output format
|
|
161
|
+
* @deprecated Use outputSchema() instead for type-safe output definition
|
|
162
|
+
*/
|
|
163
|
+
outputWithSummary(summaryTemplate, dataFields, errorCase) {
|
|
164
|
+
this.config.output = {
|
|
165
|
+
summaryTemplate,
|
|
166
|
+
dataFields,
|
|
167
|
+
errorCase
|
|
168
|
+
};
|
|
169
|
+
return this;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Set output schema - generates output instructions from the schema
|
|
173
|
+
* This is the preferred way to define output format (type-safe)
|
|
174
|
+
*/
|
|
175
|
+
outputSchema(schema) {
|
|
176
|
+
// Convert JSONSchema to OutputSchema format
|
|
177
|
+
this.config.outputSchema = schema;
|
|
178
|
+
return this;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Set available tools from actual Tool objects
|
|
182
|
+
* Extracts name and description automatically for documentation
|
|
183
|
+
*/
|
|
184
|
+
tools(toolObjects) {
|
|
185
|
+
for (const tool of toolObjects) {
|
|
186
|
+
// Extract first line of description for brevity
|
|
187
|
+
const desc = tool.description.split('\n')[0].trim();
|
|
188
|
+
this.config.availableTools.push({
|
|
189
|
+
name: tool.name,
|
|
190
|
+
description: desc
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
return this;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Add a workflow step that uses specific tools
|
|
197
|
+
* Type-safe alternative to addToolStep with string arrays
|
|
198
|
+
*/
|
|
199
|
+
addToolsStep(description, toolRefs) {
|
|
200
|
+
const toolCalls = toolRefs.map(ref => {
|
|
201
|
+
const purpose = ref.purpose ? ` - ${ref.purpose}` : '';
|
|
202
|
+
return `${ref.tool.name}${purpose}`;
|
|
203
|
+
});
|
|
204
|
+
this.config.workflow.push({
|
|
205
|
+
description,
|
|
206
|
+
toolCalls
|
|
207
|
+
});
|
|
208
|
+
return this;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Add a custom section
|
|
212
|
+
*/
|
|
213
|
+
addSection(title, content) {
|
|
214
|
+
this.config.customSections.push({ title, content });
|
|
215
|
+
return this;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Get the current configuration
|
|
219
|
+
*/
|
|
220
|
+
getConfig() {
|
|
221
|
+
return { ...this.config };
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Build the final system prompt string
|
|
225
|
+
*/
|
|
226
|
+
build() {
|
|
227
|
+
const sections = [];
|
|
228
|
+
// Role section (required, with default)
|
|
229
|
+
const role = this.config.role || 'a specialized assistant';
|
|
230
|
+
sections.push(subAgentRoleSection(role));
|
|
231
|
+
// Task section
|
|
232
|
+
if (this.config.task) {
|
|
233
|
+
sections.push('');
|
|
234
|
+
sections.push(taskSection(this.config.task));
|
|
235
|
+
}
|
|
236
|
+
// Instructions section
|
|
237
|
+
if (this.config.instructions && this.config.instructions.length > 0) {
|
|
238
|
+
sections.push('');
|
|
239
|
+
sections.push(instructionsSection(this.config.instructions));
|
|
240
|
+
}
|
|
241
|
+
// Checklist section
|
|
242
|
+
if (this.config.checklist && this.config.checklist.items.length > 0) {
|
|
243
|
+
sections.push('');
|
|
244
|
+
sections.push(checklistSection(this.config.checklist));
|
|
245
|
+
}
|
|
246
|
+
// Available tools section (before workspace discovery)
|
|
247
|
+
if (this.config.availableTools && this.config.availableTools.length > 0) {
|
|
248
|
+
sections.push('');
|
|
249
|
+
sections.push(availableToolsSection(this.config.availableTools));
|
|
250
|
+
}
|
|
251
|
+
// Workspace discovery section (before workflow)
|
|
252
|
+
if (this.config.useWorkspace) {
|
|
253
|
+
sections.push('');
|
|
254
|
+
sections.push('## Workspace Discovery (Do This First!)');
|
|
255
|
+
sections.push('');
|
|
256
|
+
sections.push('⚠️ ALWAYS check workspace BEFORE asking questions or starting work:');
|
|
257
|
+
sections.push('');
|
|
258
|
+
sections.push('1. Use `ls` to see what data exists');
|
|
259
|
+
sections.push('2. Use `cat path/file.json` to read relevant paths');
|
|
260
|
+
sections.push('3. Use `grep "keyword" **/*.json` to search workspace');
|
|
261
|
+
sections.push('4. Use information from workspace instead of asking the user');
|
|
262
|
+
if (this.config.workspacePaths && this.config.workspacePaths.length > 0) {
|
|
263
|
+
sections.push('');
|
|
264
|
+
sections.push('Check these paths:');
|
|
265
|
+
for (const path of this.config.workspacePaths) {
|
|
266
|
+
sections.push(`- ${path.path} - ${path.description}`);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
// Check if we have question steps with conditions - add input parameters section
|
|
271
|
+
const hasQuestionSteps = this.config.workflow?.some(step => step.askQuestion?.condition);
|
|
272
|
+
if (hasQuestionSteps) {
|
|
273
|
+
sections.push('');
|
|
274
|
+
sections.push(inputParametersSection());
|
|
275
|
+
}
|
|
276
|
+
// Workflow steps
|
|
277
|
+
if (this.config.workflow && this.config.workflow.length > 0) {
|
|
278
|
+
sections.push('');
|
|
279
|
+
sections.push(workflowSection(this.config.workflow));
|
|
280
|
+
}
|
|
281
|
+
// Guidelines
|
|
282
|
+
if (this.config.guidelines && this.config.guidelines.length > 0) {
|
|
283
|
+
sections.push('');
|
|
284
|
+
sections.push(guidelinesSection(this.config.guidelines));
|
|
285
|
+
}
|
|
286
|
+
// Constraints section: combine default constraints with user constraints
|
|
287
|
+
const defaultConstraints = [
|
|
288
|
+
'Never use placeholders (e.g. <API_KEY>, YOUR_TOKEN, etc.) in commands or URLs. If a value is unknown, ask the user via __ask_user__',
|
|
289
|
+
'Prefer free public APIs and resources that require no authentication. If auth is needed and credentials are not in workspace, ask the user',
|
|
290
|
+
'If a tool call fails, analyze the error and try a different approach instead of giving up',
|
|
291
|
+
];
|
|
292
|
+
const allConstraints = [...defaultConstraints, ...(this.config.constraints || [])];
|
|
293
|
+
sections.push('');
|
|
294
|
+
sections.push(constraintsSection(allConstraints));
|
|
295
|
+
// Examples section
|
|
296
|
+
if (this.config.examples && this.config.examples.length > 0) {
|
|
297
|
+
sections.push('');
|
|
298
|
+
sections.push(subAgentExamplesSection(this.config.examples));
|
|
299
|
+
}
|
|
300
|
+
// Custom sections
|
|
301
|
+
for (const section of this.config.customSections || []) {
|
|
302
|
+
sections.push('');
|
|
303
|
+
sections.push(`## ${section.title}`);
|
|
304
|
+
sections.push('');
|
|
305
|
+
sections.push(section.content);
|
|
306
|
+
}
|
|
307
|
+
// Output format (always at the end)
|
|
308
|
+
// Prefer outputSchema over deprecated output format
|
|
309
|
+
if (this.config.outputSchema) {
|
|
310
|
+
sections.push('');
|
|
311
|
+
sections.push(outputSchemaSection(this.config.outputSchema));
|
|
312
|
+
}
|
|
313
|
+
else if (this.config.output) {
|
|
314
|
+
sections.push('');
|
|
315
|
+
sections.push(outputSection(this.config.output));
|
|
316
|
+
}
|
|
317
|
+
return sections.join('\n');
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Reset the builder to initial state
|
|
321
|
+
*/
|
|
322
|
+
reset() {
|
|
323
|
+
this.config = {
|
|
324
|
+
workflow: [],
|
|
325
|
+
guidelines: [],
|
|
326
|
+
instructions: [],
|
|
327
|
+
constraints: [],
|
|
328
|
+
examples: [],
|
|
329
|
+
workspacePaths: [],
|
|
330
|
+
useWorkspace: false,
|
|
331
|
+
customSections: [],
|
|
332
|
+
availableTools: []
|
|
333
|
+
};
|
|
334
|
+
return this;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
//# sourceMappingURL=sub-agent-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sub-agent-builder.js","sourceRoot":"","sources":["../../src/prompt/sub-agent-builder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,OAAO,EACL,mBAAmB,EAC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AAY,EAAE,KAAK;YACnB,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, WorkspacePathDef, 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 workspace storage section
|
|
29
|
+
*/
|
|
30
|
+
export declare function workspaceStorageSection(paths: WorkspacePathDef[]): 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;;;;GA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