@modular-prompt/process 0.1.11
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 +166 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/dialogue.d.ts +39 -0
- package/dist/modules/dialogue.d.ts.map +1 -0
- package/dist/modules/dialogue.js +106 -0
- package/dist/modules/dialogue.js.map +1 -0
- package/dist/modules/index.d.ts +9 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/index.js +5 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/material.d.ts +21 -0
- package/dist/modules/material.d.ts.map +1 -0
- package/dist/modules/material.js +41 -0
- package/dist/modules/material.js.map +1 -0
- package/dist/modules/stream-processing.d.ts +26 -0
- package/dist/modules/stream-processing.d.ts.map +1 -0
- package/dist/modules/stream-processing.js +128 -0
- package/dist/modules/stream-processing.js.map +1 -0
- package/dist/modules/summarize.d.ts +32 -0
- package/dist/modules/summarize.d.ts.map +1 -0
- package/dist/modules/summarize.js +97 -0
- package/dist/modules/summarize.js.map +1 -0
- package/dist/workflows/agent-workflow.d.ts +55 -0
- package/dist/workflows/agent-workflow.d.ts.map +1 -0
- package/dist/workflows/agent-workflow.js +337 -0
- package/dist/workflows/agent-workflow.js.map +1 -0
- package/dist/workflows/agentic-workflow/agentic-workflow.d.ts +13 -0
- package/dist/workflows/agentic-workflow/agentic-workflow.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/agentic-workflow.js +235 -0
- package/dist/workflows/agentic-workflow/agentic-workflow.js.map +1 -0
- package/dist/workflows/agentic-workflow/index.d.ts +4 -0
- package/dist/workflows/agentic-workflow/index.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/index.js +5 -0
- package/dist/workflows/agentic-workflow/index.js.map +1 -0
- package/dist/workflows/agentic-workflow/modules/agentic.d.ts +12 -0
- package/dist/workflows/agentic-workflow/modules/agentic.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/modules/agentic.js +22 -0
- package/dist/workflows/agentic-workflow/modules/agentic.js.map +1 -0
- package/dist/workflows/agentic-workflow/modules/execution-freeform.d.ts +15 -0
- package/dist/workflows/agentic-workflow/modules/execution-freeform.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/modules/execution-freeform.js +140 -0
- package/dist/workflows/agentic-workflow/modules/execution-freeform.js.map +1 -0
- package/dist/workflows/agentic-workflow/modules/execution.d.ts +11 -0
- package/dist/workflows/agentic-workflow/modules/execution.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/modules/execution.js +180 -0
- package/dist/workflows/agentic-workflow/modules/execution.js.map +1 -0
- package/dist/workflows/agentic-workflow/modules/index.d.ts +6 -0
- package/dist/workflows/agentic-workflow/modules/index.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/modules/index.js +7 -0
- package/dist/workflows/agentic-workflow/modules/index.js.map +1 -0
- package/dist/workflows/agentic-workflow/modules/integration.d.ts +11 -0
- package/dist/workflows/agentic-workflow/modules/integration.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/modules/integration.js +85 -0
- package/dist/workflows/agentic-workflow/modules/integration.js.map +1 -0
- package/dist/workflows/agentic-workflow/modules/planning.d.ts +11 -0
- package/dist/workflows/agentic-workflow/modules/planning.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/modules/planning.js +103 -0
- package/dist/workflows/agentic-workflow/modules/planning.js.map +1 -0
- package/dist/workflows/agentic-workflow/types.d.ts +60 -0
- package/dist/workflows/agentic-workflow/types.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/types.js +2 -0
- package/dist/workflows/agentic-workflow/types.js.map +1 -0
- package/dist/workflows/concat-process-workflow.d.ts +29 -0
- package/dist/workflows/concat-process-workflow.d.ts.map +1 -0
- package/dist/workflows/concat-process-workflow.js +121 -0
- package/dist/workflows/concat-process-workflow.js.map +1 -0
- package/dist/workflows/dialogue-workflow.d.ts +25 -0
- package/dist/workflows/dialogue-workflow.d.ts.map +1 -0
- package/dist/workflows/dialogue-workflow.js +139 -0
- package/dist/workflows/dialogue-workflow.js.map +1 -0
- package/dist/workflows/index.d.ts +14 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/index.js +13 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/self-prompting-workflow/index.d.ts +12 -0
- package/dist/workflows/self-prompting-workflow/index.d.ts.map +1 -0
- package/dist/workflows/self-prompting-workflow/index.js +11 -0
- package/dist/workflows/self-prompting-workflow/index.js.map +1 -0
- package/dist/workflows/self-prompting-workflow/modules/integration.d.ts +11 -0
- package/dist/workflows/self-prompting-workflow/modules/integration.d.ts.map +1 -0
- package/dist/workflows/self-prompting-workflow/modules/integration.js +82 -0
- package/dist/workflows/self-prompting-workflow/modules/integration.js.map +1 -0
- package/dist/workflows/self-prompting-workflow/modules/planning.d.ts +11 -0
- package/dist/workflows/self-prompting-workflow/modules/planning.d.ts.map +1 -0
- package/dist/workflows/self-prompting-workflow/modules/planning.js +108 -0
- package/dist/workflows/self-prompting-workflow/modules/planning.js.map +1 -0
- package/dist/workflows/self-prompting-workflow/self-prompting-workflow.d.ts +14 -0
- package/dist/workflows/self-prompting-workflow/self-prompting-workflow.d.ts.map +1 -0
- package/dist/workflows/self-prompting-workflow/self-prompting-workflow.js +250 -0
- package/dist/workflows/self-prompting-workflow/self-prompting-workflow.js.map +1 -0
- package/dist/workflows/self-prompting-workflow/types.d.ts +56 -0
- package/dist/workflows/self-prompting-workflow/types.d.ts.map +1 -0
- package/dist/workflows/self-prompting-workflow/types.js +2 -0
- package/dist/workflows/self-prompting-workflow/types.js.map +1 -0
- package/dist/workflows/stream-workflow.d.ts +17 -0
- package/dist/workflows/stream-workflow.d.ts.map +1 -0
- package/dist/workflows/stream-workflow.js +119 -0
- package/dist/workflows/stream-workflow.js.map +1 -0
- package/dist/workflows/summarize-workflow.d.ts +39 -0
- package/dist/workflows/summarize-workflow.d.ts.map +1 -0
- package/dist/workflows/summarize-workflow.js +152 -0
- package/dist/workflows/summarize-workflow.js.map +1 -0
- package/dist/workflows/types.d.ts +37 -0
- package/dist/workflows/types.d.ts.map +1 -0
- package/dist/workflows/types.js +25 -0
- package/dist/workflows/types.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution phase module for agent workflow
|
|
3
|
+
* Phase-specific definitions for executing a single step
|
|
4
|
+
*
|
|
5
|
+
* Should be merged with agentic and user's module:
|
|
6
|
+
* merge(agentic, execution, userModule)
|
|
7
|
+
*/
|
|
8
|
+
export const execution = {
|
|
9
|
+
methodology: [
|
|
10
|
+
'',
|
|
11
|
+
'**Current Phase: Execution**',
|
|
12
|
+
'',
|
|
13
|
+
'- Execute only the current step of the execution plan.',
|
|
14
|
+
'- Output the reasoning process and results as structured JSON text.'
|
|
15
|
+
],
|
|
16
|
+
instructions: [
|
|
17
|
+
{
|
|
18
|
+
type: 'subsection',
|
|
19
|
+
title: 'Execution Phase Process',
|
|
20
|
+
items: [
|
|
21
|
+
'- Focus solely on completing the current step',
|
|
22
|
+
'- Utilize action results if available',
|
|
23
|
+
'- Output result and nextState in a structured format'
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'subsection',
|
|
28
|
+
title: 'Available Tools',
|
|
29
|
+
items: [
|
|
30
|
+
'- No tools are available'
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
type: 'subsection',
|
|
35
|
+
title: 'Execution Plan',
|
|
36
|
+
items: [
|
|
37
|
+
(ctx) => {
|
|
38
|
+
if (!ctx.plan) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const currentStepId = ctx.currentStep?.id;
|
|
42
|
+
return ctx.plan.steps.map((step) => {
|
|
43
|
+
const parts = [];
|
|
44
|
+
// Description
|
|
45
|
+
parts.push(step.description);
|
|
46
|
+
// Tools
|
|
47
|
+
if (step.actions && step.actions.length > 0) {
|
|
48
|
+
const toolNames = step.actions.map(a => a.tool).join(', ');
|
|
49
|
+
parts.push(`(Tools: ${toolNames})`);
|
|
50
|
+
}
|
|
51
|
+
const baseText = parts.join(' ');
|
|
52
|
+
// For currently executing step, show guidelines/constraints
|
|
53
|
+
if (step.id === currentStepId) {
|
|
54
|
+
const details = [`- **${baseText}** ← **[Currently executing]**`];
|
|
55
|
+
if (step.guidelines && step.guidelines.length > 0) {
|
|
56
|
+
details.push(' **Guidelines:**');
|
|
57
|
+
step.guidelines.forEach(item => details.push(` - ${item}`));
|
|
58
|
+
}
|
|
59
|
+
if (step.constraints && step.constraints.length > 0) {
|
|
60
|
+
details.push(' **Constraints:**');
|
|
61
|
+
step.constraints.forEach(item => details.push(` - ${item}`));
|
|
62
|
+
}
|
|
63
|
+
return details;
|
|
64
|
+
}
|
|
65
|
+
return `- ${baseText}`;
|
|
66
|
+
}).flat();
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
state: [
|
|
72
|
+
(ctx) => {
|
|
73
|
+
const completed = ctx.executionLog?.length || 0;
|
|
74
|
+
const total = ctx.plan?.steps.length || 0;
|
|
75
|
+
return `Progress: ${completed}/${total} steps completed`;
|
|
76
|
+
},
|
|
77
|
+
(ctx) => {
|
|
78
|
+
if (ctx.state) {
|
|
79
|
+
return `Handover from previous step: ${ctx.state.content}`;
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
inputs: [
|
|
85
|
+
(ctx) => ctx.inputs ? JSON.stringify(ctx.inputs, null, 2) : null
|
|
86
|
+
],
|
|
87
|
+
materials: [
|
|
88
|
+
(ctx) => {
|
|
89
|
+
if (ctx.actionResult === undefined) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
type: 'material',
|
|
94
|
+
id: 'action-result',
|
|
95
|
+
title: 'Action execution result for current step',
|
|
96
|
+
content: typeof ctx.actionResult === 'string'
|
|
97
|
+
? ctx.actionResult
|
|
98
|
+
: JSON.stringify(ctx.actionResult, null, 2)
|
|
99
|
+
};
|
|
100
|
+
},
|
|
101
|
+
(ctx) => {
|
|
102
|
+
if (!ctx.executionLog || ctx.executionLog.length === 0 || !ctx.plan) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
return ctx.executionLog.map((log) => {
|
|
106
|
+
// Find the corresponding step to get dos/donts
|
|
107
|
+
const step = ctx.plan.steps.find((s) => s.id === log.stepId);
|
|
108
|
+
const contentParts = [];
|
|
109
|
+
// Instructions section
|
|
110
|
+
if (step) {
|
|
111
|
+
contentParts.push('## Instructions');
|
|
112
|
+
contentParts.push('');
|
|
113
|
+
contentParts.push(step.description);
|
|
114
|
+
contentParts.push('');
|
|
115
|
+
if (step.guidelines && step.guidelines.length > 0) {
|
|
116
|
+
contentParts.push('**Guidelines:**');
|
|
117
|
+
step.guidelines.forEach(item => contentParts.push(`- ${item}`));
|
|
118
|
+
contentParts.push('');
|
|
119
|
+
}
|
|
120
|
+
if (step.constraints && step.constraints.length > 0) {
|
|
121
|
+
contentParts.push('**Constraints:**');
|
|
122
|
+
step.constraints.forEach(item => contentParts.push(`- ${item}`));
|
|
123
|
+
contentParts.push('');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Result section
|
|
127
|
+
contentParts.push('## Result');
|
|
128
|
+
contentParts.push('');
|
|
129
|
+
if (log.reasoning) {
|
|
130
|
+
contentParts.push('**Reasoning:**');
|
|
131
|
+
contentParts.push(log.reasoning);
|
|
132
|
+
contentParts.push('');
|
|
133
|
+
}
|
|
134
|
+
contentParts.push(log.result);
|
|
135
|
+
if (log.actionResult !== undefined) {
|
|
136
|
+
const actionResultStr = typeof log.actionResult === 'string'
|
|
137
|
+
? log.actionResult
|
|
138
|
+
: JSON.stringify(log.actionResult, null, 2);
|
|
139
|
+
contentParts.push('');
|
|
140
|
+
contentParts.push('**Action Result:**');
|
|
141
|
+
contentParts.push(actionResultStr);
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
type: 'material',
|
|
145
|
+
id: `previous-step-${log.stepId}`,
|
|
146
|
+
title: `Previous step decision: ${log.stepId}`,
|
|
147
|
+
content: contentParts.join('\n')
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
cue: [
|
|
153
|
+
'Output a JSON object containing the execution result of the current step following the JSON Output Format below.',
|
|
154
|
+
'Generate actual data (an object with reasoning, result, and nextState properties), not the JSON Schema definition itself.'
|
|
155
|
+
],
|
|
156
|
+
schema: [
|
|
157
|
+
{
|
|
158
|
+
type: 'json',
|
|
159
|
+
content: {
|
|
160
|
+
type: 'object',
|
|
161
|
+
properties: {
|
|
162
|
+
reasoning: {
|
|
163
|
+
type: 'string',
|
|
164
|
+
description: 'Thought process and analysis: Explain your thinking, considerations, and decision-making process for this step.'
|
|
165
|
+
},
|
|
166
|
+
result: {
|
|
167
|
+
type: 'string',
|
|
168
|
+
description: 'Execution result: Describe what was actually done in this step and what concrete results were obtained.'
|
|
169
|
+
},
|
|
170
|
+
nextState: {
|
|
171
|
+
type: 'string',
|
|
172
|
+
description: 'Handover note for the next step (simple text, not object/array)'
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
required: ['reasoning', 'result', 'nextState']
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
};
|
|
180
|
+
//# sourceMappingURL=execution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/modules/execution.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAyC;IAC7D,WAAW,EAAE;QACX,EAAE;QACF,8BAA8B;QAC9B,EAAE;QACF,wDAAwD;QACxD,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AAG,CAAC,YAAY,KAAK,QAAQ;wBAC1D,CAAC,CAAC,GAAG,CAAC,YAAY;wBAClB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;oBAC9C,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBACtB,YAAY,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;oBACxC,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;gBACrC,CAAC;gBAED,OAAO;oBACL,IAAI,EAAE,UAAmB;oBACzB,EAAE,EAAE,iBAAiB,GAAG,CAAC,MAAM,EAAE;oBACjC,KAAK,EAAE,2BAA2B,GAAG,CAAC,MAAM,EAAE;oBAC9C,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;iBACjC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF;IAED,GAAG,EAAE;QACH,kHAAkH;QAClH,2HAA2H;KAC5H;IAED,MAAM,EAAE;QACN;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,SAAS,EAAE;wBACT,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,iHAAiH;qBAC/H;oBACD,MAAM,EAAE;wBACN,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,yGAAyG;qBACvH;oBACD,SAAS,EAAE;wBACT,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,iEAAiE;qBAC/E;iBACF;gBACD,QAAQ,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAC;aAC/C;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { agentic } from './agentic.js';
|
|
2
|
+
export { planning } from './planning.js';
|
|
3
|
+
export { execution } from './execution.js';
|
|
4
|
+
export { executionFreeform } from './execution-freeform.js';
|
|
5
|
+
export { integration } from './integration.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/modules/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Core modules
|
|
2
|
+
export { agentic } from './agentic.js';
|
|
3
|
+
export { planning } from './planning.js';
|
|
4
|
+
export { execution } from './execution.js';
|
|
5
|
+
export { executionFreeform } from './execution-freeform.js';
|
|
6
|
+
export { integration } from './integration.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/modules/index.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PromptModule } from '@modular-prompt/core';
|
|
2
|
+
import type { AgenticWorkflowContext } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Integration phase module for agent workflow
|
|
5
|
+
* Phase-specific definitions for integrating all step results
|
|
6
|
+
*
|
|
7
|
+
* Should be merged with agentic and user's module:
|
|
8
|
+
* merge(agentic, integration, userModule)
|
|
9
|
+
*/
|
|
10
|
+
export declare const integration: PromptModule<AgenticWorkflowContext>;
|
|
11
|
+
//# sourceMappingURL=integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/modules/integration.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,WAAW,EAAE,YAAY,CAAC,sBAAsB,CAyF5D,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration phase module for agent workflow
|
|
3
|
+
* Phase-specific definitions for integrating all step results
|
|
4
|
+
*
|
|
5
|
+
* Should be merged with agentic and user's module:
|
|
6
|
+
* merge(agentic, integration, userModule)
|
|
7
|
+
*/
|
|
8
|
+
export const integration = {
|
|
9
|
+
methodology: [
|
|
10
|
+
'- **Current Phase: Integration**',
|
|
11
|
+
' - Integrate results from all executed steps.',
|
|
12
|
+
' - Generate the final output that achieves the overall objective.'
|
|
13
|
+
],
|
|
14
|
+
instructions: [
|
|
15
|
+
{
|
|
16
|
+
type: 'subsection',
|
|
17
|
+
title: 'Integration Phase Process',
|
|
18
|
+
items: [
|
|
19
|
+
'- Integrate execution results from all steps in the "Execution Plan" to generate the final output',
|
|
20
|
+
'- Verify that the objective has been achieved',
|
|
21
|
+
'- Clearly describe important results from each step'
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
type: 'subsection',
|
|
26
|
+
title: 'Execution Plan (All Steps Completed)',
|
|
27
|
+
items: [
|
|
28
|
+
(ctx) => {
|
|
29
|
+
if (!ctx.plan) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return ctx.plan.steps.map((step) => {
|
|
33
|
+
const parts = [step.description];
|
|
34
|
+
// Tools
|
|
35
|
+
if (step.actions && step.actions.length > 0) {
|
|
36
|
+
const toolNames = step.actions.map(a => a.tool).join(', ');
|
|
37
|
+
parts.push(`(Tools: ${toolNames})`);
|
|
38
|
+
}
|
|
39
|
+
return `- ${parts.join(' ')}`;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
state: [
|
|
46
|
+
(ctx) => {
|
|
47
|
+
const total = ctx.plan?.steps.length || 0;
|
|
48
|
+
return `All ${total} steps completed. Generating final output.`;
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
inputs: [
|
|
52
|
+
(ctx) => ctx.inputs ? JSON.stringify(ctx.inputs, null, 2) : null
|
|
53
|
+
],
|
|
54
|
+
materials: [
|
|
55
|
+
(ctx) => {
|
|
56
|
+
if (!ctx.executionLog || ctx.executionLog.length === 0) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return ctx.executionLog.map((log) => {
|
|
60
|
+
const parts = [];
|
|
61
|
+
if (log.reasoning) {
|
|
62
|
+
parts.push(`[Reasoning]\n${log.reasoning}`);
|
|
63
|
+
}
|
|
64
|
+
parts.push(`[Result]\n${log.result}`);
|
|
65
|
+
if (log.actionResult !== undefined) {
|
|
66
|
+
const actionResultStr = typeof log.actionResult === 'string'
|
|
67
|
+
? log.actionResult
|
|
68
|
+
: JSON.stringify(log.actionResult, null, 2);
|
|
69
|
+
parts.push(`[Action Result]\n${actionResultStr}`);
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
type: 'material',
|
|
73
|
+
id: `execution-result-${log.stepId}`,
|
|
74
|
+
title: `Execution result: ${log.stepId}`,
|
|
75
|
+
content: parts.join('\n\n')
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
cue: [
|
|
81
|
+
'Integrate all execution results to generate the final output.',
|
|
82
|
+
'Summarize what was accomplished and provide the complete solution to the objective.'
|
|
83
|
+
]
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/modules/integration.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAyC;IAC/D,WAAW,EAAE;QACX,kCAAkC;QAClC,gDAAgD;QAChD,oEAAoE;KACrE;IAED,YAAY,EAAE;QACZ;YACE,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE,2BAA2B;YAClC,KAAK,EAAE;gBACL,mGAAmG;gBACnG,+CAA+C;gBAC/C,qDAAqD;aACtD;SACF;QACD;YACE,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE,sCAAsC;YAC7C,KAAK,EAAE;gBACL,CAAC,GAAG,EAAE,EAAE;oBACN,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;wBACd,OAAO,IAAI,CAAC;oBACd,CAAC;oBAED,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAiB,EAAE,EAAE;wBAC9C,MAAM,KAAK,GAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;wBAE3C,QAAQ;wBACR,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;4BAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;4BAC3D,KAAK,CAAC,IAAI,CAAC,WAAW,SAAS,GAAG,CAAC,CAAC;wBACtC,CAAC;wBAED,OAAO,KAAK,KAAK,CAAC,IAAI,C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AC,oBAAoB,eAAe,EAAE,CAAC,CAAC;gBACpD,CAAC;gBAED,OAAO;oBACL,IAAI,EAAE,UAAmB;oBACzB,EAAE,EAAE,oBAAoB,GAAG,CAAC,MAAM,EAAE;oBACpC,KAAK,EAAE,qBAAqB,GAAG,CAAC,MAAM,EAAE;oBACxC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;iBAC5B,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF;IAED,GAAG,EAAE;QACH,+DAA+D;QAC/D,qFAAqF;KACtF;CACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PromptModule } from '@modular-prompt/core';
|
|
2
|
+
import type { AgenticWorkflowContext } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Planning phase module for agent workflow
|
|
5
|
+
* Phase-specific definitions for generating execution plan
|
|
6
|
+
*
|
|
7
|
+
* Should be merged with agentic and user's module:
|
|
8
|
+
* merge(agentic, planning, userModule)
|
|
9
|
+
*/
|
|
10
|
+
export declare const planning: PromptModule<AgenticWorkflowContext>;
|
|
11
|
+
//# sourceMappingURL=planning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/modules/planning.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,EAAE,YAAY,CAAC,sBAAsB,CAmGzD,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Planning phase module for agent workflow
|
|
3
|
+
* Phase-specific definitions for generating execution plan
|
|
4
|
+
*
|
|
5
|
+
* Should be merged with agentic and user's module:
|
|
6
|
+
* merge(agentic, planning, userModule)
|
|
7
|
+
*/
|
|
8
|
+
export const planning = {
|
|
9
|
+
methodology: [
|
|
10
|
+
'- **Current Phase: Planning**',
|
|
11
|
+
' - Generate an execution plan by breaking down the Objective and Instructions into 3-5 executable steps.',
|
|
12
|
+
' - Output structured JSON text immediately, with no explanations or commentary.'
|
|
13
|
+
],
|
|
14
|
+
instructions: [
|
|
15
|
+
{
|
|
16
|
+
type: 'subsection',
|
|
17
|
+
title: 'Planning Requirements',
|
|
18
|
+
items: [
|
|
19
|
+
'- Break down the **Objective and Instructions shown above** into 3-5 concrete executable steps',
|
|
20
|
+
'- Each step must have: id, description, guidelines (2-4 items), constraints (1-3 items)',
|
|
21
|
+
' - **guidelines**: Specific actions or principles to follow in this step',
|
|
22
|
+
' - **constraints**: Specific limitations or prohibitions for this step',
|
|
23
|
+
'- The steps should accomplish the Instructions in a logical sequence',
|
|
24
|
+
'- Consider available tools when defining actions (currently none available)',
|
|
25
|
+
'- Ensure logical flow between steps',
|
|
26
|
+
'',
|
|
27
|
+
'**CRITICAL: Output Format**',
|
|
28
|
+
'- Respond ONLY with valid JSON text',
|
|
29
|
+
'- NO explanatory text before or after the JSON',
|
|
30
|
+
'- NO markdown code blocks (```json)',
|
|
31
|
+
'- Start directly with { and end with }'
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
inputs: [
|
|
36
|
+
(ctx) => ctx.inputs ? JSON.stringify(ctx.inputs, null, 2) : null
|
|
37
|
+
],
|
|
38
|
+
state: [
|
|
39
|
+
'Phase: planning'
|
|
40
|
+
],
|
|
41
|
+
cue: [
|
|
42
|
+
'Respond with a JSON-formatted string containing the execution plan.',
|
|
43
|
+
'Output format: {"steps": [...]}'
|
|
44
|
+
],
|
|
45
|
+
schema: [
|
|
46
|
+
{
|
|
47
|
+
type: 'json',
|
|
48
|
+
content: {
|
|
49
|
+
type: 'object',
|
|
50
|
+
properties: {
|
|
51
|
+
steps: {
|
|
52
|
+
type: 'array',
|
|
53
|
+
items: {
|
|
54
|
+
type: 'object',
|
|
55
|
+
properties: {
|
|
56
|
+
id: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
description: 'Unique step ID (e.g., step-1, step-2)'
|
|
59
|
+
},
|
|
60
|
+
description: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
description: 'Brief summary of what this step accomplishes'
|
|
63
|
+
},
|
|
64
|
+
guidelines: {
|
|
65
|
+
type: 'array',
|
|
66
|
+
items: { type: 'string' },
|
|
67
|
+
description: 'Specific actions or principles to follow in this step (2-4 items)'
|
|
68
|
+
},
|
|
69
|
+
constraints: {
|
|
70
|
+
type: 'array',
|
|
71
|
+
items: { type: 'string' },
|
|
72
|
+
description: 'Specific limitations or prohibitions for this step (1-3 items)'
|
|
73
|
+
},
|
|
74
|
+
actions: {
|
|
75
|
+
type: 'array',
|
|
76
|
+
items: {
|
|
77
|
+
type: 'object',
|
|
78
|
+
properties: {
|
|
79
|
+
tool: {
|
|
80
|
+
type: 'string',
|
|
81
|
+
description: 'Tool name from available actions'
|
|
82
|
+
},
|
|
83
|
+
params: {
|
|
84
|
+
type: 'object',
|
|
85
|
+
description: 'Tool parameters (optional)'
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
required: ['tool']
|
|
89
|
+
},
|
|
90
|
+
description: 'External tools to use (optional, only if available actions exist)'
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
required: ['id', 'description', 'guidelines', 'constraints']
|
|
94
|
+
},
|
|
95
|
+
description: 'List of execution plan steps'
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
required: ['steps']
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=planning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planning.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/modules/planning.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ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,QAAQ,EAAE;oCACzB,WAAW,EAAE,gEAAgE;iCAC9E;gCACD,OAAO,EAAE;oCACP,IAAI,EAAE,OAAO;oCACb,KAAK,EAAE;wCACL,IAAI,EAAE,QAAQ;wCACd,UAAU,EAAE;4CACV,IAAI,EAAE;gDACJ,IAAI,EAAE,QAAQ;gDACd,WAAW,EAAE,kCAAkC;6CAChD;4CACD,MAAM,EAAE;gDACN,IAAI,EAAE,QAAQ;gDACd,WAAW,EAAE,4BAA4B;6CAC1C;yCACF;wCACD,QAAQ,EAAE,CAAC,MAAM,CAAC;qCACnB;oCACD,WAAW,EAAE,mEAAmE;iCACjF;6BACF;4BACD,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,CAAC;yBAC7D;wBACD,WAAW,EAAE,8BAA8B;qBAC5C;iBACF;gBACD,QAAQ,EAAE,CAAC,OAAO,CAAC;aACpB;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action handler type for agentic workflow
|
|
3
|
+
*/
|
|
4
|
+
export type ActionHandler<TContext = any> = (params: any, context: TContext) => Promise<any>;
|
|
5
|
+
/**
|
|
6
|
+
* Agentic workflow step definition
|
|
7
|
+
*/
|
|
8
|
+
export interface AgenticStep {
|
|
9
|
+
id: string;
|
|
10
|
+
description: string;
|
|
11
|
+
guidelines?: string[];
|
|
12
|
+
constraints?: string[];
|
|
13
|
+
actions?: Array<{
|
|
14
|
+
tool: string;
|
|
15
|
+
params?: any;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Agentic workflow execution log entry
|
|
20
|
+
*/
|
|
21
|
+
export interface AgenticExecutionLog {
|
|
22
|
+
stepId: string;
|
|
23
|
+
reasoning: string;
|
|
24
|
+
result: string;
|
|
25
|
+
actionResult?: any;
|
|
26
|
+
metadata?: any;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Agentic workflow plan (structured output from planning phase)
|
|
30
|
+
*/
|
|
31
|
+
export interface AgenticPlan {
|
|
32
|
+
steps: AgenticStep[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Context for agentic workflow
|
|
36
|
+
*/
|
|
37
|
+
export interface AgenticWorkflowContext {
|
|
38
|
+
objective: string;
|
|
39
|
+
inputs?: any;
|
|
40
|
+
state?: {
|
|
41
|
+
content: string;
|
|
42
|
+
usage?: number;
|
|
43
|
+
};
|
|
44
|
+
plan?: AgenticPlan;
|
|
45
|
+
executionLog?: AgenticExecutionLog[];
|
|
46
|
+
currentStep?: AgenticStep;
|
|
47
|
+
actionResult?: any;
|
|
48
|
+
phase?: 'planning' | 'execution' | 'integration' | 'complete';
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Options for agentic workflow
|
|
52
|
+
*/
|
|
53
|
+
export interface AgenticWorkflowOptions {
|
|
54
|
+
maxSteps?: number;
|
|
55
|
+
actions?: Record<string, ActionHandler>;
|
|
56
|
+
enablePlanning?: boolean;
|
|
57
|
+
useFreeformExecution?: boolean;
|
|
58
|
+
logger?: any;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/workflows/agentic-workflow/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,QAAQ,GAAG,GAAG,IAAI,CAC1C,MAAM,EAAE,GAAG,EACX,OAAO,EAAE,QAAQ,KACd,OAAO,CAAC,GAAG,CAAC,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,GAAG,CAAC;KACd,CAAC,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,KAAK,CAAC,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,KAAK,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,UAAU,CAAC;CAC/D;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACxC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,MAAM,CAAC,EAAE,GAAG,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/workflows/agentic-workflow/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PromptModule } from '@modular-prompt/core';
|
|
2
|
+
import { type AIDriver, type WorkflowResult } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Context for concat processing workflow
|
|
5
|
+
*/
|
|
6
|
+
export interface ConcatProcessContext {
|
|
7
|
+
chunks: Array<{
|
|
8
|
+
content: string;
|
|
9
|
+
partOf?: string;
|
|
10
|
+
usage?: number;
|
|
11
|
+
metadata?: Record<string, any>;
|
|
12
|
+
}>;
|
|
13
|
+
results?: string[];
|
|
14
|
+
processedCount?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Options for concat processing workflow
|
|
18
|
+
*/
|
|
19
|
+
export interface ConcatProcessOptions {
|
|
20
|
+
batchSize?: number;
|
|
21
|
+
separator?: string;
|
|
22
|
+
parallel?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Concat processing workflow - processes chunks independently and concatenates results
|
|
26
|
+
* Unlike stream processing which maintains state, concat treats each chunk independently
|
|
27
|
+
*/
|
|
28
|
+
export declare function concatProcess(driver: AIDriver, module: PromptModule<ConcatProcessContext>, context: ConcatProcessContext, options?: ConcatProcessOptions): Promise<WorkflowResult<ConcatProcessContext>>;
|
|
29
|
+
//# sourceMappingURL=concat-process-workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concat-process-workflow.d.ts","sourceRoot":"","sources":["../../src/workflows/concat-process-workflow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAA0B,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAGxF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,KAAK,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAChC,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,QAAQ,EAChB,MAAM,EAAE,YAAY,CAAC,oBAAoB,CAAC,EAC1C,OAAO,EAAE,oBAAoB,EAC7B,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC,CA4I/C"}
|