@modular-prompt/process 0.1.27 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -2
- package/dist/workflows/agentic-workflow/agentic-workflow.d.ts +12 -8
- package/dist/workflows/agentic-workflow/agentic-workflow.d.ts.map +1 -1
- package/dist/workflows/agentic-workflow/agentic-workflow.js +182 -205
- package/dist/workflows/agentic-workflow/agentic-workflow.js.map +1 -1
- package/dist/workflows/agentic-workflow/index.d.ts +5 -2
- package/dist/workflows/agentic-workflow/index.d.ts.map +1 -1
- package/dist/workflows/agentic-workflow/index.js +5 -2
- package/dist/workflows/agentic-workflow/index.js.map +1 -1
- package/dist/workflows/agentic-workflow/process/builtin-tools.d.ts +24 -0
- package/dist/workflows/agentic-workflow/process/builtin-tools.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/process/builtin-tools.js +134 -0
- package/dist/workflows/agentic-workflow/process/builtin-tools.js.map +1 -0
- package/dist/workflows/agentic-workflow/process/format-helpers.d.ts +11 -0
- package/dist/workflows/agentic-workflow/process/format-helpers.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/process/format-helpers.js +18 -0
- package/dist/workflows/agentic-workflow/process/format-helpers.js.map +1 -0
- package/dist/workflows/agentic-workflow/process/index.d.ts +7 -0
- package/dist/workflows/agentic-workflow/process/index.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/process/index.js +7 -0
- package/dist/workflows/agentic-workflow/process/index.js.map +1 -0
- package/dist/workflows/agentic-workflow/process/query-with-tools.d.ts +37 -0
- package/dist/workflows/agentic-workflow/process/query-with-tools.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/process/query-with-tools.js +118 -0
- package/dist/workflows/agentic-workflow/process/query-with-tools.js.map +1 -0
- package/dist/workflows/agentic-workflow/task-types/execution-tasks.d.ts +35 -0
- package/dist/workflows/agentic-workflow/task-types/execution-tasks.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/task-types/execution-tasks.js +155 -0
- package/dist/workflows/agentic-workflow/task-types/execution-tasks.js.map +1 -0
- package/dist/workflows/agentic-workflow/task-types/index.d.ts +37 -0
- package/dist/workflows/agentic-workflow/task-types/index.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/task-types/index.js +95 -0
- package/dist/workflows/agentic-workflow/task-types/index.js.map +1 -0
- package/dist/workflows/agentic-workflow/task-types/output.d.ts +16 -0
- package/dist/workflows/agentic-workflow/task-types/output.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/task-types/output.js +31 -0
- package/dist/workflows/agentic-workflow/task-types/output.js.map +1 -0
- package/dist/workflows/agentic-workflow/task-types/planning.d.ts +19 -0
- package/dist/workflows/agentic-workflow/task-types/planning.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/task-types/planning.js +77 -0
- package/dist/workflows/agentic-workflow/task-types/planning.js.map +1 -0
- package/dist/workflows/agentic-workflow/types.d.ts +83 -37
- package/dist/workflows/agentic-workflow/types.d.ts.map +1 -1
- package/dist/workflows/agentic-workflow/types.js +27 -1
- package/dist/workflows/agentic-workflow/types.js.map +1 -1
- package/dist/workflows/concat-process-workflow.d.ts +3 -2
- package/dist/workflows/concat-process-workflow.d.ts.map +1 -1
- package/dist/workflows/concat-process-workflow.js +41 -5
- package/dist/workflows/concat-process-workflow.js.map +1 -1
- package/dist/workflows/default-workflow.d.ts +3 -2
- package/dist/workflows/default-workflow.d.ts.map +1 -1
- package/dist/workflows/default-workflow.js +14 -1
- package/dist/workflows/default-workflow.js.map +1 -1
- package/dist/workflows/dialogue-workflow.d.ts +3 -2
- package/dist/workflows/dialogue-workflow.d.ts.map +1 -1
- package/dist/workflows/dialogue-workflow.js +15 -3
- package/dist/workflows/dialogue-workflow.js.map +1 -1
- package/dist/workflows/driver-input.d.ts +16 -0
- package/dist/workflows/driver-input.d.ts.map +1 -0
- package/dist/workflows/driver-input.js +18 -0
- package/dist/workflows/driver-input.js.map +1 -0
- package/dist/workflows/index.d.ts +6 -3
- package/dist/workflows/index.d.ts.map +1 -1
- package/dist/workflows/index.js +5 -2
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/self-prompting-workflow/self-prompting-workflow.d.ts +3 -2
- package/dist/workflows/self-prompting-workflow/self-prompting-workflow.d.ts.map +1 -1
- package/dist/workflows/self-prompting-workflow/self-prompting-workflow.js +4 -3
- package/dist/workflows/self-prompting-workflow/self-prompting-workflow.js.map +1 -1
- package/dist/workflows/stream-workflow.d.ts +3 -2
- package/dist/workflows/stream-workflow.d.ts.map +1 -1
- package/dist/workflows/stream-workflow.js +11 -3
- package/dist/workflows/stream-workflow.js.map +1 -1
- package/dist/workflows/summarize-workflow.d.ts +3 -2
- package/dist/workflows/summarize-workflow.d.ts.map +1 -1
- package/dist/workflows/summarize-workflow.js +11 -2
- package/dist/workflows/summarize-workflow.js.map +1 -1
- package/package.json +4 -3
- package/dist/workflows/agent-workflow.d.ts +0 -55
- package/dist/workflows/agent-workflow.d.ts.map +0 -1
- package/dist/workflows/agent-workflow.js +0 -337
- package/dist/workflows/agent-workflow.js.map +0 -1
- package/dist/workflows/agentic-workflow/modules/agentic.d.ts +0 -12
- package/dist/workflows/agentic-workflow/modules/agentic.d.ts.map +0 -1
- package/dist/workflows/agentic-workflow/modules/agentic.js +0 -22
- package/dist/workflows/agentic-workflow/modules/agentic.js.map +0 -1
- package/dist/workflows/agentic-workflow/modules/execution-freeform.d.ts +0 -15
- package/dist/workflows/agentic-workflow/modules/execution-freeform.d.ts.map +0 -1
- package/dist/workflows/agentic-workflow/modules/execution-freeform.js +0 -140
- package/dist/workflows/agentic-workflow/modules/execution-freeform.js.map +0 -1
- package/dist/workflows/agentic-workflow/modules/execution.d.ts +0 -11
- package/dist/workflows/agentic-workflow/modules/execution.d.ts.map +0 -1
- package/dist/workflows/agentic-workflow/modules/execution.js +0 -180
- package/dist/workflows/agentic-workflow/modules/execution.js.map +0 -1
- package/dist/workflows/agentic-workflow/modules/index.d.ts +0 -6
- package/dist/workflows/agentic-workflow/modules/index.d.ts.map +0 -1
- package/dist/workflows/agentic-workflow/modules/index.js +0 -7
- package/dist/workflows/agentic-workflow/modules/index.js.map +0 -1
- package/dist/workflows/agentic-workflow/modules/integration.d.ts +0 -11
- package/dist/workflows/agentic-workflow/modules/integration.d.ts.map +0 -1
- package/dist/workflows/agentic-workflow/modules/integration.js +0 -85
- package/dist/workflows/agentic-workflow/modules/integration.js.map +0 -1
- package/dist/workflows/agentic-workflow/modules/planning.d.ts +0 -11
- package/dist/workflows/agentic-workflow/modules/planning.d.ts.map +0 -1
- package/dist/workflows/agentic-workflow/modules/planning.js +0 -103
- package/dist/workflows/agentic-workflow/modules/planning.js.map +0 -1
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
import { compile, merge } from '@modular-prompt/core';
|
|
2
|
-
import { WorkflowExecutionError } from './types.js';
|
|
3
|
-
const baseAgentModule = {
|
|
4
|
-
methodology: [
|
|
5
|
-
'- Simple agent workflow executes work through Planning → Execution → Integration.',
|
|
6
|
-
'- Keep reasoning explicit and document what each phase accomplishes.'
|
|
7
|
-
],
|
|
8
|
-
state: [
|
|
9
|
-
(ctx) => ctx.phase ? `Current phase: ${ctx.phase}` : null
|
|
10
|
-
]
|
|
11
|
-
};
|
|
12
|
-
const planningModule = {
|
|
13
|
-
methodology: [
|
|
14
|
-
'- **Planning Phase**',
|
|
15
|
-
' - Break the objective into concrete executable steps.',
|
|
16
|
-
' - Use JSON output so the application can parse the plan.'
|
|
17
|
-
],
|
|
18
|
-
instructions: [
|
|
19
|
-
{
|
|
20
|
-
type: 'subsection',
|
|
21
|
-
title: 'Planning Requirements',
|
|
22
|
-
items: [
|
|
23
|
-
'- Produce 3-5 ordered steps that accomplish the objective.',
|
|
24
|
-
'- Each step needs: id (e.g., "step-1"), description, optional action + params.',
|
|
25
|
-
'- Consider available inputs when proposing the steps.',
|
|
26
|
-
'- Output valid JSON only. No commentary or markdown fences.'
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
],
|
|
30
|
-
inputs: [
|
|
31
|
-
(ctx) => ctx.inputs ? JSON.stringify(ctx.inputs, null, 2) : null
|
|
32
|
-
],
|
|
33
|
-
state: [
|
|
34
|
-
'Phase: planning'
|
|
35
|
-
],
|
|
36
|
-
cue: [
|
|
37
|
-
'Return a JSON object that contains the plan. Respond only with JSON text.',
|
|
38
|
-
'Start the response with { and end with }.'
|
|
39
|
-
],
|
|
40
|
-
schema: [
|
|
41
|
-
{
|
|
42
|
-
type: 'json',
|
|
43
|
-
content: {
|
|
44
|
-
type: 'object',
|
|
45
|
-
properties: {
|
|
46
|
-
steps: {
|
|
47
|
-
type: 'array',
|
|
48
|
-
items: {
|
|
49
|
-
type: 'object',
|
|
50
|
-
properties: {
|
|
51
|
-
id: { type: 'string' },
|
|
52
|
-
description: { type: 'string' },
|
|
53
|
-
action: { type: 'string' },
|
|
54
|
-
params: { type: 'object' }
|
|
55
|
-
},
|
|
56
|
-
required: ['id', 'description']
|
|
57
|
-
},
|
|
58
|
-
minItems: 1
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
required: ['steps']
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
};
|
|
66
|
-
const executionModule = {
|
|
67
|
-
methodology: [
|
|
68
|
-
'- **Execution Phase**',
|
|
69
|
-
'- Complete only the current step from the plan and describe the result clearly.'
|
|
70
|
-
],
|
|
71
|
-
instructions: [
|
|
72
|
-
{
|
|
73
|
-
type: 'subsection',
|
|
74
|
-
title: 'Current Step',
|
|
75
|
-
items: [
|
|
76
|
-
(ctx) => ctx.currentStep
|
|
77
|
-
? `- Execute: ${ctx.currentStep.description}`
|
|
78
|
-
: '- There is no current step.'
|
|
79
|
-
]
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
type: 'subsection',
|
|
83
|
-
title: 'Execution Plan Overview',
|
|
84
|
-
items: [
|
|
85
|
-
(ctx) => {
|
|
86
|
-
if (!ctx.plan) {
|
|
87
|
-
return '- Plan not available.';
|
|
88
|
-
}
|
|
89
|
-
const completed = ctx.executionLog?.length || 0;
|
|
90
|
-
return ctx.plan.steps.map((step, index) => {
|
|
91
|
-
const prefix = index < completed
|
|
92
|
-
? '[done]'
|
|
93
|
-
: (ctx.currentStep?.id === step.id ? '[current]' : '[todo]');
|
|
94
|
-
const actionInfo = step.action ? ` (action: ${step.action})` : '';
|
|
95
|
-
return `- ${prefix} ${step.id}: ${step.description}${actionInfo}`;
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
]
|
|
99
|
-
}
|
|
100
|
-
],
|
|
101
|
-
state: [
|
|
102
|
-
(ctx) => {
|
|
103
|
-
const completed = ctx.executionLog?.length || 0;
|
|
104
|
-
const total = ctx.plan?.steps.length || 0;
|
|
105
|
-
return `Progress: ${completed}/${total} steps completed`;
|
|
106
|
-
}
|
|
107
|
-
],
|
|
108
|
-
inputs: [
|
|
109
|
-
(ctx) => ctx.inputs ? JSON.stringify(ctx.inputs, null, 2) : null
|
|
110
|
-
],
|
|
111
|
-
materials: [
|
|
112
|
-
(ctx) => {
|
|
113
|
-
if (ctx.actionResult === undefined) {
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
return {
|
|
117
|
-
type: 'material',
|
|
118
|
-
id: 'action-result',
|
|
119
|
-
title: 'Latest action output',
|
|
120
|
-
content: typeof ctx.actionResult === 'string'
|
|
121
|
-
? ctx.actionResult
|
|
122
|
-
: JSON.stringify(ctx.actionResult, null, 2)
|
|
123
|
-
};
|
|
124
|
-
},
|
|
125
|
-
(ctx) => {
|
|
126
|
-
if (!ctx.executionLog || ctx.executionLog.length === 0) {
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
return ctx.executionLog.map((log) => ({
|
|
130
|
-
type: 'material',
|
|
131
|
-
id: `execution-log-${log.stepId}`,
|
|
132
|
-
title: `Previous result: ${log.stepId}`,
|
|
133
|
-
content: log.result
|
|
134
|
-
}));
|
|
135
|
-
}
|
|
136
|
-
],
|
|
137
|
-
cue: [
|
|
138
|
-
'Describe the work performed for this step and the resulting findings.',
|
|
139
|
-
'Only focus on the current step.'
|
|
140
|
-
]
|
|
141
|
-
};
|
|
142
|
-
const integrationModule = {
|
|
143
|
-
methodology: [
|
|
144
|
-
'- **Integration Phase**',
|
|
145
|
-
'- Combine the outcomes from all steps and deliver the final answer.'
|
|
146
|
-
],
|
|
147
|
-
instructions: [
|
|
148
|
-
{
|
|
149
|
-
type: 'subsection',
|
|
150
|
-
title: 'Integration Goals',
|
|
151
|
-
items: [
|
|
152
|
-
'- Summarize the outcome of each executed step.',
|
|
153
|
-
'- Confirm that the overall objective has been satisfied.',
|
|
154
|
-
'- Present a cohesive final response.'
|
|
155
|
-
]
|
|
156
|
-
}
|
|
157
|
-
],
|
|
158
|
-
inputs: [
|
|
159
|
-
(ctx) => ctx.inputs ? JSON.stringify(ctx.inputs, null, 2) : null
|
|
160
|
-
],
|
|
161
|
-
materials: [
|
|
162
|
-
(ctx) => {
|
|
163
|
-
if (!ctx.executionLog || ctx.executionLog.length === 0) {
|
|
164
|
-
return null;
|
|
165
|
-
}
|
|
166
|
-
return ctx.executionLog.map((log) => ({
|
|
167
|
-
type: 'material',
|
|
168
|
-
id: `integrated-result-${log.stepId}`,
|
|
169
|
-
title: `Result from ${log.stepId}`,
|
|
170
|
-
content: log.result
|
|
171
|
-
}));
|
|
172
|
-
}
|
|
173
|
-
],
|
|
174
|
-
state: [
|
|
175
|
-
(ctx) => {
|
|
176
|
-
const total = ctx.plan?.steps.length || 0;
|
|
177
|
-
return `All ${total} steps complete. Generate the final answer.`;
|
|
178
|
-
}
|
|
179
|
-
],
|
|
180
|
-
cue: [
|
|
181
|
-
'Integrate every step result and provide the final deliverable.'
|
|
182
|
-
]
|
|
183
|
-
};
|
|
184
|
-
async function executePlanningPhase(driver, module, context, maxSteps) {
|
|
185
|
-
const planningPrompt = compile(merge(baseAgentModule, planningModule, module), context);
|
|
186
|
-
try {
|
|
187
|
-
const planResult = await driver.query(planningPrompt);
|
|
188
|
-
if (planResult.finishReason && planResult.finishReason !== 'stop') {
|
|
189
|
-
throw new WorkflowExecutionError(`Planning failed with reason: ${planResult.finishReason}`, context, {
|
|
190
|
-
phase: 'planning',
|
|
191
|
-
finishReason: planResult.finishReason
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
if (!planResult.structuredOutput) {
|
|
195
|
-
throw new WorkflowExecutionError('Planning did not return structured output', context, {
|
|
196
|
-
phase: 'planning',
|
|
197
|
-
partialResult: planResult.content
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
const plan = planResult.structuredOutput;
|
|
201
|
-
if (!plan.steps || !Array.isArray(plan.steps)) {
|
|
202
|
-
throw new WorkflowExecutionError('Plan must contain steps array', context, {
|
|
203
|
-
phase: 'planning'
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
if (plan.steps.length > maxSteps) {
|
|
207
|
-
plan.steps = plan.steps.slice(0, maxSteps);
|
|
208
|
-
}
|
|
209
|
-
return plan;
|
|
210
|
-
}
|
|
211
|
-
catch (error) {
|
|
212
|
-
if (error instanceof WorkflowExecutionError) {
|
|
213
|
-
throw error;
|
|
214
|
-
}
|
|
215
|
-
throw new WorkflowExecutionError(error, context, {
|
|
216
|
-
phase: 'planning'
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
async function executeStep(driver, module, context, step, actions) {
|
|
221
|
-
let actionResult;
|
|
222
|
-
if (step.action) {
|
|
223
|
-
const handler = actions[step.action];
|
|
224
|
-
if (!handler) {
|
|
225
|
-
throw new WorkflowExecutionError(`Action "${step.action}" is not available`, context, { phase: 'execution' });
|
|
226
|
-
}
|
|
227
|
-
try {
|
|
228
|
-
actionResult = await handler(step.params ?? {}, context);
|
|
229
|
-
}
|
|
230
|
-
catch (error) {
|
|
231
|
-
throw new WorkflowExecutionError(error, context, {
|
|
232
|
-
phase: 'execution',
|
|
233
|
-
partialResult: `Action ${step.action} failed`
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
const executionPrompt = compile(merge(baseAgentModule, executionModule, module), {
|
|
238
|
-
...context,
|
|
239
|
-
currentStep: step,
|
|
240
|
-
actionResult
|
|
241
|
-
});
|
|
242
|
-
try {
|
|
243
|
-
const result = await driver.query(executionPrompt);
|
|
244
|
-
if (result.finishReason && result.finishReason !== 'stop') {
|
|
245
|
-
throw new WorkflowExecutionError(`Execution failed with reason: ${result.finishReason}`, context, {
|
|
246
|
-
phase: 'execution',
|
|
247
|
-
partialResult: result.content,
|
|
248
|
-
finishReason: result.finishReason
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
return {
|
|
252
|
-
stepId: step.id,
|
|
253
|
-
result: result.content,
|
|
254
|
-
metadata: {
|
|
255
|
-
usage: result.usage,
|
|
256
|
-
action: step.action,
|
|
257
|
-
actionResult
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
catch (error) {
|
|
262
|
-
if (error instanceof WorkflowExecutionError) {
|
|
263
|
-
throw error;
|
|
264
|
-
}
|
|
265
|
-
throw new WorkflowExecutionError(error, context, {
|
|
266
|
-
phase: 'execution'
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
async function executeExecutionPhase(driver, module, context, plan, actions) {
|
|
271
|
-
const executionLog = context.executionLog ? [...context.executionLog] : [];
|
|
272
|
-
const startIndex = executionLog.length;
|
|
273
|
-
for (let i = startIndex; i < plan.steps.length; i++) {
|
|
274
|
-
const currentStep = plan.steps[i];
|
|
275
|
-
const logEntry = await executeStep(driver, module, context, currentStep, actions);
|
|
276
|
-
executionLog.push(logEntry);
|
|
277
|
-
context.executionLog = executionLog;
|
|
278
|
-
}
|
|
279
|
-
return executionLog;
|
|
280
|
-
}
|
|
281
|
-
async function executeIntegrationPhase(driver, module, context) {
|
|
282
|
-
const integrationPrompt = compile(merge(baseAgentModule, integrationModule, module), context);
|
|
283
|
-
try {
|
|
284
|
-
const result = await driver.query(integrationPrompt);
|
|
285
|
-
if (result.finishReason && result.finishReason !== 'stop') {
|
|
286
|
-
throw new WorkflowExecutionError(`Integration failed with reason: ${result.finishReason}`, context, {
|
|
287
|
-
phase: 'integration',
|
|
288
|
-
partialResult: result.content,
|
|
289
|
-
finishReason: result.finishReason
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
return result.content;
|
|
293
|
-
}
|
|
294
|
-
catch (error) {
|
|
295
|
-
if (error instanceof WorkflowExecutionError) {
|
|
296
|
-
throw error;
|
|
297
|
-
}
|
|
298
|
-
throw new WorkflowExecutionError(error, context, {
|
|
299
|
-
phase: 'integration'
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Agent workflow - simple planning/execution/integration pipeline
|
|
305
|
-
*/
|
|
306
|
-
export async function agentProcess(driver, module, context, options = {}) {
|
|
307
|
-
const { maxSteps = 5, actions = {}, enablePlanning = true } = options;
|
|
308
|
-
let currentContext = { ...context };
|
|
309
|
-
let plan = currentContext.plan;
|
|
310
|
-
if (enablePlanning || !plan) {
|
|
311
|
-
currentContext.phase = 'planning';
|
|
312
|
-
plan = await executePlanningPhase(driver, module, currentContext, maxSteps);
|
|
313
|
-
currentContext.plan = plan;
|
|
314
|
-
}
|
|
315
|
-
if (!plan) {
|
|
316
|
-
throw new WorkflowExecutionError('Agent workflow requires a plan to execute', currentContext, { phase: 'planning' });
|
|
317
|
-
}
|
|
318
|
-
currentContext.phase = 'execution';
|
|
319
|
-
const executionLog = await executeExecutionPhase(driver, module, currentContext, plan, actions);
|
|
320
|
-
currentContext.executionLog = executionLog;
|
|
321
|
-
currentContext.phase = 'integration';
|
|
322
|
-
const finalOutput = await executeIntegrationPhase(driver, module, currentContext);
|
|
323
|
-
const finalContext = {
|
|
324
|
-
...currentContext,
|
|
325
|
-
phase: 'complete'
|
|
326
|
-
};
|
|
327
|
-
return {
|
|
328
|
-
output: finalOutput,
|
|
329
|
-
context: finalContext,
|
|
330
|
-
metadata: {
|
|
331
|
-
planSteps: plan.steps.length,
|
|
332
|
-
executedSteps: executionLog.length,
|
|
333
|
-
actionsUsed: executionLog.filter(log => log.metadata?.actionResult !== undefined).length
|
|
334
|
-
}
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
//# sourceMappingURL=agent-workflow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-workflow.js","sourceRoot":"","sources":["../../src/workflows/agent-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAwDpD,MAAM,eAAe,GAAuC;IAC1D,WAAW,EAAE;QACX,mFAAmF;QACnF,sEAAsE;KACvE;IACD,KAAK,EAAE;QACL,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,kBAAkB,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI;KAC1D;CACF,CAAC;AAEF,MAAM,cAAc,GAAuC;IACzD,WAAW,EAAE;QACX,sBAAsB;QACtB,yDAAyD;QACzD,4DAA4D;KAC7D;IACD,YAAY,EAAE;QACZ;YACE,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE,uBAAuB;YAC9B,KAAK,EAAE;gBACL,4DAA4D;gBAC5D,gFAAgF;gBAChF,uDAAuD;gBACvD,6DAA6D;aAC9D;SACF;KACF;IACD,MAAM,EAAE;QACN,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;KACjE;IACD,KAAK,EAAE;QACL,iBAAiB;KAClB;IACD,GAAG,EAAE;QACH,2EAA2E;QAC3E,2CAA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AC,YAAY,GAAG,YAAY,CAAC;IAE3C,cAAc,CAAC,KAAK,GAAG,aAAa,CAAC;IACrC,MAAM,WAAW,GAAG,MAAM,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;IAElF,MAAM,YAAY,GAAyB;QACzC,GAAG,cAAc;QACjB,KAAK,EAAE,UAAU;KAClB,CAAC;IAEF,OAAO;QACL,MAAM,EAAE,WAAW;QACnB,OAAO,EAAE,YAAY;QACrB,QAAQ,EAAE;YACR,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;YAC5B,aAAa,EAAE,YAAY,CAAC,MAAM;YAClC,WAAW,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,YAAY,KAAK,SAAS,CAAC,CAAC,MAAM;SACzF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { PromptModule } from '@modular-prompt/core';
|
|
2
|
-
import type { AgenticWorkflowContext } from '../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Agentic module - Common definitions for agent workflow
|
|
5
|
-
* Defines the basic behavior and terminology for agentic processing
|
|
6
|
-
* This module is shared across all phases (planning, execution, integration)
|
|
7
|
-
*
|
|
8
|
-
* This module should be merged with user's module:
|
|
9
|
-
* agentProcess(driver, merge(agenticModule, userModule), context)
|
|
10
|
-
*/
|
|
11
|
-
export declare const agentic: PromptModule<AgenticWorkflowContext>;
|
|
12
|
-
//# sourceMappingURL=agentic.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agentic.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/modules/agentic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,EAAE,YAAY,CAAC,sBAAsB,CAaxD,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agentic module - Common definitions for agent workflow
|
|
3
|
-
* Defines the basic behavior and terminology for agentic processing
|
|
4
|
-
* This module is shared across all phases (planning, execution, integration)
|
|
5
|
-
*
|
|
6
|
-
* This module should be merged with user's module:
|
|
7
|
-
* agentProcess(driver, merge(agenticModule, userModule), context)
|
|
8
|
-
*/
|
|
9
|
-
export const agentic = {
|
|
10
|
-
terms: [
|
|
11
|
-
'- Execution Plan: Objective and Instructions broken down into executable steps',
|
|
12
|
-
'- Action: External tool/API to use during execution (e.g., data retrieval, calculations)'
|
|
13
|
-
],
|
|
14
|
-
methodology: [
|
|
15
|
-
'- Agentic workflow executes complex tasks through multi-step processing.',
|
|
16
|
-
'- This workflow has three phases: Planning → Execution → Integration.',
|
|
17
|
-
' - Planning: analyzes the objective to create an execution plan.',
|
|
18
|
-
' - Execution: processes each step sequentially, recording results.',
|
|
19
|
-
' - Integration: combines all results into the final output.'
|
|
20
|
-
]
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=agentic.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agentic.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/modules/agentic.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAAyC;IAC3D,KAAK,EAAE;QACL,gFAAgF;QAChF,0FAA0F;KAC3F;IAED,WAAW,EAAE;QACX,0EAA0E;QAC1E,uEAAuE;QACvE,mEAAmE;QACnE,qEAAqE;QACrE,8DAA8D;KAC/D;CACF,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { PromptModule } from '@modular-prompt/core';
|
|
2
|
-
import type { AgenticWorkflowContext } from '../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Execution phase module (freeform version) for agent workflow
|
|
5
|
-
*
|
|
6
|
-
* This version differs from the standard execution module:
|
|
7
|
-
* - Uses planned dos/donts as instructions (not fixed process steps)
|
|
8
|
-
* - Outputs freeform text (not structured JSON)
|
|
9
|
-
* - Accumulates all previous step decisions
|
|
10
|
-
*
|
|
11
|
-
* Should be merged with agentic and user's module:
|
|
12
|
-
* merge(agentic, executionFreeform, userModule)
|
|
13
|
-
*/
|
|
14
|
-
export declare const executionFreeform: PromptModule<AgenticWorkflowContext>;
|
|
15
|
-
//# sourceMappingURL=execution-freeform.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"execution-freeform.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/modules/execution-freeform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,sBAAsB,CAmJlE,CAAC"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Execution phase module (freeform version) for agent workflow
|
|
3
|
-
*
|
|
4
|
-
* This version differs from the standard execution module:
|
|
5
|
-
* - Uses planned dos/donts as instructions (not fixed process steps)
|
|
6
|
-
* - Outputs freeform text (not structured JSON)
|
|
7
|
-
* - Accumulates all previous step decisions
|
|
8
|
-
*
|
|
9
|
-
* Should be merged with agentic and user's module:
|
|
10
|
-
* merge(agentic, executionFreeform, userModule)
|
|
11
|
-
*/
|
|
12
|
-
export const executionFreeform = {
|
|
13
|
-
methodology: [
|
|
14
|
-
(ctx) => {
|
|
15
|
-
const currentStepIndex = (ctx.executionLog?.length || 0) + 1;
|
|
16
|
-
const totalSteps = ctx.plan?.steps.length || 0;
|
|
17
|
-
return [
|
|
18
|
-
`- **Current Phase: Execution (Step ${currentStepIndex}/${totalSteps})**`,
|
|
19
|
-
' - Execute only the current step of the execution plan.',
|
|
20
|
-
' - Follow the dos/don\'ts specified in the plan.',
|
|
21
|
-
' - Output the reasoning process and results as natural text.',
|
|
22
|
-
''
|
|
23
|
-
];
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
// Replace user's instructions with plan-based dos/donts
|
|
27
|
-
// Note: User's original instructions are omitted in agentic-workflow.ts
|
|
28
|
-
instructions: [
|
|
29
|
-
(ctx) => {
|
|
30
|
-
const items = [];
|
|
31
|
-
// Add current step description first
|
|
32
|
-
if (ctx.currentStep?.description) {
|
|
33
|
-
items.push(ctx.currentStep.description);
|
|
34
|
-
items.push('');
|
|
35
|
-
}
|
|
36
|
-
// Add general execution guidelines
|
|
37
|
-
items.push('');
|
|
38
|
-
items.push('**Requirements:**');
|
|
39
|
-
if (ctx.executionLog && ctx.executionLog.length > 0) {
|
|
40
|
-
items.push('- Read and understand the previous step\'s decisions (shown in Data section below)');
|
|
41
|
-
items.push('- Use that understanding to complete THIS step\'s task');
|
|
42
|
-
items.push('- Produce only NEW content for this step');
|
|
43
|
-
items.push('- Do NOT copy or reproduce the previous outputs');
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
items.push('- Focus on the current step instructions only');
|
|
47
|
-
}
|
|
48
|
-
items.push('- Concise output is acceptable');
|
|
49
|
-
// Add guidelines
|
|
50
|
-
if (ctx.currentStep?.guidelines && ctx.currentStep.guidelines.length > 0) {
|
|
51
|
-
items.push('');
|
|
52
|
-
items.push('**Guidelines:**');
|
|
53
|
-
ctx.currentStep.guidelines.forEach((item) => items.push(`- ${item}`));
|
|
54
|
-
}
|
|
55
|
-
// Add constraints
|
|
56
|
-
if (ctx.currentStep?.constraints && ctx.currentStep.constraints.length > 0) {
|
|
57
|
-
items.push('');
|
|
58
|
-
items.push('**Constraints:**');
|
|
59
|
-
ctx.currentStep.constraints.forEach((item) => items.push(`- ${item}`));
|
|
60
|
-
}
|
|
61
|
-
return items;
|
|
62
|
-
}
|
|
63
|
-
],
|
|
64
|
-
state: [
|
|
65
|
-
(ctx) => {
|
|
66
|
-
const completed = ctx.executionLog?.length || 0;
|
|
67
|
-
const total = ctx.plan?.steps.length || 0;
|
|
68
|
-
return `Progress: ${completed}/${total} steps completed`;
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
inputs: [
|
|
72
|
-
(ctx) => ctx.inputs ? JSON.stringify(ctx.inputs, null, 2) : null
|
|
73
|
-
],
|
|
74
|
-
materials: [
|
|
75
|
-
(ctx) => {
|
|
76
|
-
if (ctx.actionResult === undefined) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
type: 'material',
|
|
81
|
-
id: 'action-result',
|
|
82
|
-
title: 'Action execution result for current step',
|
|
83
|
-
content: typeof ctx.actionResult === 'string'
|
|
84
|
-
? ctx.actionResult
|
|
85
|
-
: JSON.stringify(ctx.actionResult, null, 2)
|
|
86
|
-
};
|
|
87
|
-
},
|
|
88
|
-
(ctx) => {
|
|
89
|
-
if (!ctx.executionLog || ctx.executionLog.length === 0) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
return ctx.executionLog.map((log, index) => {
|
|
93
|
-
const parts = [];
|
|
94
|
-
// Add the step's instructions first
|
|
95
|
-
const stepIndex = index;
|
|
96
|
-
if (ctx.plan?.steps[stepIndex]) {
|
|
97
|
-
const step = ctx.plan.steps[stepIndex];
|
|
98
|
-
const instructionsParts = [];
|
|
99
|
-
if (step.description) {
|
|
100
|
-
instructionsParts.push(step.description);
|
|
101
|
-
}
|
|
102
|
-
if (step.guidelines && step.guidelines.length > 0) {
|
|
103
|
-
instructionsParts.push('');
|
|
104
|
-
instructionsParts.push('**Guidelines:**');
|
|
105
|
-
step.guidelines.forEach((item) => instructionsParts.push(`- ${item}`));
|
|
106
|
-
}
|
|
107
|
-
if (step.constraints && step.constraints.length > 0) {
|
|
108
|
-
instructionsParts.push('');
|
|
109
|
-
instructionsParts.push('**Constraints:**');
|
|
110
|
-
step.constraints.forEach((item) => instructionsParts.push(`- ${item}`));
|
|
111
|
-
}
|
|
112
|
-
if (instructionsParts.length > 0) {
|
|
113
|
-
parts.push(`[Instructions]\n${instructionsParts.join('\n')}`);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
if (log.reasoning) {
|
|
117
|
-
parts.push(`[Reasoning]\n${log.reasoning}`);
|
|
118
|
-
}
|
|
119
|
-
parts.push(`[Result]\n${log.result}`);
|
|
120
|
-
if (log.actionResult !== undefined) {
|
|
121
|
-
const actionResultStr = typeof log.actionResult === 'string'
|
|
122
|
-
? log.actionResult
|
|
123
|
-
: JSON.stringify(log.actionResult, null, 2);
|
|
124
|
-
parts.push(`[Action Result]\n${actionResultStr}`);
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
type: 'material',
|
|
128
|
-
id: `execution-decision-${log.stepId}`,
|
|
129
|
-
title: `Previous step decision: ${log.stepId}`,
|
|
130
|
-
content: parts.join('\n\n')
|
|
131
|
-
};
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
],
|
|
135
|
-
cue: [
|
|
136
|
-
'IMPORTANT: Follow the Instructions above carefully.',
|
|
137
|
-
'Output only what is required for THIS step based on the Requirements.'
|
|
138
|
-
]
|
|
139
|
-
};
|
|
140
|
-
//# sourceMappingURL=execution-freeform.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"execution-freeform.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/modules/execution-freeform.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAyC;IACrE,WAAW,EAAE;QACX,CAAC,GAA2B,EAAE,EAAE;YAC9B,MAAM,gBAAgB,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YAC7D,MAAM,UAAU,GAAG,GAAG,CAAC,IAAI,EAAE,KAA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2B,GAAG,CAAC,MAAM,EAAE;oBAC9C,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;iBAC5B,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF;IAED,GAAG,EAAE;QACH,qDAAqD;QACrD,uEAAuE;KACxE;CACF,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { PromptModule } from '@modular-prompt/core';
|
|
2
|
-
import type { AgenticWorkflowContext } from '../types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Execution phase module for agent workflow
|
|
5
|
-
* Phase-specific definitions for executing a single step
|
|
6
|
-
*
|
|
7
|
-
* Should be merged with agentic and user's module:
|
|
8
|
-
* merge(agentic, execution, userModule)
|
|
9
|
-
*/
|
|
10
|
-
export declare const execution: PromptModule<AgenticWorkflowContext>;
|
|
11
|
-
//# sourceMappingURL=execution.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/modules/execution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AAEvE;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,EAAE,YAAY,CAAC,sBAAsB,CAsM1D,CAAC"}
|