@modular-prompt/process 0.1.28 → 0.2.1
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 +49 -58
- 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 +186 -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 +31 -0
- package/dist/workflows/agentic-workflow/process/builtin-tools.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/process/builtin-tools.js +158 -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 +103 -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 +32 -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-workflow.js","sourceRoot":"","sources":["../../src/workflows/stream-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"stream-workflow.js","sourceRoot":"","sources":["../../src/workflows/stream-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAuB,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAoB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEpE,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;AAEpE;;GAEG;AACH,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC;AAWD;;GAEG;AACH,SAAS,YAAY,CACnB,MAAy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K,CAAC,KAAK;YACxB,YAAY;SACb;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PromptModule } from '@modular-prompt/core';
|
|
2
|
-
import { type
|
|
2
|
+
import { type WorkflowResult } from './types.js';
|
|
3
|
+
import { type DriverInput } from './driver-input.js';
|
|
3
4
|
/**
|
|
4
5
|
* Context for summarization workflow
|
|
5
6
|
*/
|
|
@@ -35,5 +36,5 @@ export interface SummarizeWorkflowOptions {
|
|
|
35
36
|
/**
|
|
36
37
|
* Summarization workflow - performs analysis and summarization with stream processing
|
|
37
38
|
*/
|
|
38
|
-
export declare function summarizeProcess(driver:
|
|
39
|
+
export declare function summarizeProcess(driver: DriverInput, module: PromptModule<SummarizeWorkflowContext>, context: SummarizeWorkflowContext, options: SummarizeWorkflowOptions): Promise<WorkflowResult<SummarizeWorkflowContext>>;
|
|
39
40
|
//# sourceMappingURL=summarize-workflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarize-workflow.d.ts","sourceRoot":"","sources":["../../src/workflows/summarize-workflow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"summarize-workflow.d.ts","sourceRoot":"","sources":["../../src/workflows/summarize-workflow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIzD,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,KAAK,WAAW,EAAiB,MAAM,mBAAmB,CAAC;AAWpE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,GAAG,EAAE,CAAC;KACrB,CAAC,CAAC;IACH,eAAe,CAAC,EAAE;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,UAAU,GAAG,eAAe,GAAG,UAAU,CAAC;CACnD;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,YAAY,CAAC,wBAAwB,CAAC,EAC9C,OAAO,EAAE,wBAAwB,EACjC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC,CAmLnD"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { compile, merge } from '@modular-prompt/core';
|
|
2
|
+
import { Logger } from '@modular-prompt/utils';
|
|
2
3
|
import { streamProcessing } from '../modules/stream-processing.js';
|
|
3
4
|
import { analyzeForSummary, contentSummarize } from '../modules/summarize.js';
|
|
4
5
|
import { WorkflowExecutionError } from './types.js';
|
|
6
|
+
import { resolveDriver } from './driver-input.js';
|
|
7
|
+
const logger = new Logger({ prefix: 'process', context: 'summarize' });
|
|
5
8
|
/**
|
|
6
9
|
* Simple token estimation (roughly 4 characters per token)
|
|
7
10
|
*/
|
|
@@ -12,6 +15,7 @@ function estimateTokens(text) {
|
|
|
12
15
|
* Summarization workflow - performs analysis and summarization with stream processing
|
|
13
16
|
*/
|
|
14
17
|
export async function summarizeProcess(driver, module, context, options) {
|
|
18
|
+
logger.info('[start] summarize workflow');
|
|
15
19
|
const { targetTokens, enableAnalysis = true } = options;
|
|
16
20
|
let currentContext = { ...context };
|
|
17
21
|
let analysisReport = currentContext.analysisReport || '';
|
|
@@ -32,8 +36,10 @@ export async function summarizeProcess(driver, module, context, options) {
|
|
|
32
36
|
range: { start: i, end: Math.min(i + 3, currentContext.chunks.length) }
|
|
33
37
|
};
|
|
34
38
|
const prompt = compile(analysisModule, batchContext);
|
|
39
|
+
logger.verbose('[prompt]', JSON.stringify(prompt));
|
|
35
40
|
try {
|
|
36
|
-
const queryResult = await driver.query(prompt);
|
|
41
|
+
const queryResult = await resolveDriver(driver, 'default').query(prompt);
|
|
42
|
+
logger.verbose('[output]', queryResult.content);
|
|
37
43
|
// Check finish reason for dynamic failures
|
|
38
44
|
if (queryResult.finishReason && queryResult.finishReason !== 'stop') {
|
|
39
45
|
throw new WorkflowExecutionError(`Query failed with reason: ${queryResult.finishReason}`, {
|
|
@@ -92,8 +98,10 @@ export async function summarizeProcess(driver, module, context, options) {
|
|
|
92
98
|
preparationNote: currentContext.preparationNote
|
|
93
99
|
};
|
|
94
100
|
const prompt = compile(summarizeModule, batchContext);
|
|
101
|
+
logger.verbose('[prompt]', JSON.stringify(prompt));
|
|
95
102
|
try {
|
|
96
|
-
const queryResult = await driver.query(prompt);
|
|
103
|
+
const queryResult = await resolveDriver(driver, 'default').query(prompt);
|
|
104
|
+
logger.verbose('[output]', queryResult.content);
|
|
97
105
|
// Check finish reason for dynamic failures
|
|
98
106
|
if (queryResult.finishReason && queryResult.finishReason !== 'stop') {
|
|
99
107
|
throw new WorkflowExecutionError(`Query failed with reason: ${queryResult.finishReason}`, {
|
|
@@ -139,6 +147,7 @@ export async function summarizeProcess(driver, module, context, options) {
|
|
|
139
147
|
analysisReport,
|
|
140
148
|
range: undefined // Processing complete
|
|
141
149
|
};
|
|
150
|
+
logger.info('[end]');
|
|
142
151
|
return {
|
|
143
152
|
output: summaryState,
|
|
144
153
|
context: finalContext,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarize-workflow.js","sourceRoot":"","sources":["../../src/workflows/summarize-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"summarize-workflow.js","sourceRoot":"","sources":["../../src/workflows/summarize-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAuB,MAAM,YAAY,CAAC;AACzE,OAAO,EAAoB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEpE,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;AAEvE;;GAEG;AACH,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC;AAoCD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAmB,EACnB,MAA8C,EAC9C,OAAiC,EACjC,OAAiC;IAGjC,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;IAE1C,MAAM,EACJ,YAAY,EACZ,cAAc,G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EAAE,eAAe;gBACtB,aAAa,EAAE,YAAY;aAC5B,CAAC,CAAC;QACL,CAAC;QAED,yCAAyC;QACzC,IAAI,cAAc,CAAC,YAAY,CAAC,GAAG,YAAY,GAAG,CAAC,EAAE,CAAC,CAAE,+BAA+B;YACrF,8DAA8D;QAChE,CAAC;IACH,CAAC;IAED,gBAAgB;IAChB,MAAM,YAAY,GAA6B;QAC7C,GAAG,cAAc;QACjB,KAAK,EAAE,UAAU;QACjB,KAAK,EAAE;YACL,OAAO,EAAE,YAAY;YACrB,KAAK,EAAE,cAAc,CAAC,YAAY,CAAC;SACpC;QACD,cAAc;QACd,KAAK,EAAE,SAAS,CAAC,sBAAsB;KACxC,CAAC;IAEF,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAErB,OAAO;QACL,MAAM,EAAE,YAAY;QACpB,OAAO,EAAE,YAAY;QACrB,QAAQ,EAAE;YACR,eAAe,EAAE,cAAc;YAC/B,WAAW,EAAE,cAAc,CAAC,YAAY,CAAC;YACzC,YAAY;SACb;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modular-prompt/process",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Process module for modular prompt framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
"README.md"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@modular-prompt/
|
|
28
|
-
"@modular-prompt/
|
|
27
|
+
"@modular-prompt/driver": "0.10.1",
|
|
28
|
+
"@modular-prompt/utils": "0.3.1",
|
|
29
|
+
"@modular-prompt/core": "0.2.1"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@eslint/js": "^9.34.0",
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { PromptModule } from '@modular-prompt/core';
|
|
2
|
-
import type { AIDriver, WorkflowResult } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Agent workflow plan step definition
|
|
5
|
-
*/
|
|
6
|
-
interface AgentWorkflowStep {
|
|
7
|
-
id: string;
|
|
8
|
-
description: string;
|
|
9
|
-
action?: string;
|
|
10
|
-
params?: any;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Execution log entry
|
|
14
|
-
*/
|
|
15
|
-
interface AgentWorkflowExecutionLog {
|
|
16
|
-
stepId: string;
|
|
17
|
-
result: string;
|
|
18
|
-
metadata?: Record<string, any>;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Agent workflow plan structure
|
|
22
|
-
*/
|
|
23
|
-
interface AgentWorkflowPlan {
|
|
24
|
-
steps: AgentWorkflowStep[];
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Action handler signature
|
|
28
|
-
*/
|
|
29
|
-
export type AgentWorkflowActionHandler = (params: any, context: AgentWorkflowContext) => Promise<any>;
|
|
30
|
-
/**
|
|
31
|
-
* Agent workflow context stored between phases
|
|
32
|
-
*/
|
|
33
|
-
export interface AgentWorkflowContext {
|
|
34
|
-
objective: string;
|
|
35
|
-
inputs?: any;
|
|
36
|
-
plan?: AgentWorkflowPlan;
|
|
37
|
-
executionLog?: AgentWorkflowExecutionLog[];
|
|
38
|
-
currentStep?: AgentWorkflowStep;
|
|
39
|
-
actionResult?: any;
|
|
40
|
-
phase?: 'planning' | 'execution' | 'integration' | 'complete';
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Options for agent workflow execution
|
|
44
|
-
*/
|
|
45
|
-
export interface AgentWorkflowOptions {
|
|
46
|
-
maxSteps?: number;
|
|
47
|
-
actions?: Record<string, AgentWorkflowActionHandler>;
|
|
48
|
-
enablePlanning?: boolean;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Agent workflow - simple planning/execution/integration pipeline
|
|
52
|
-
*/
|
|
53
|
-
export declare function agentProcess(driver: AIDriver, module: PromptModule<AgentWorkflowContext>, context: AgentWorkflowContext, options?: AgentWorkflowOptions): Promise<WorkflowResult<AgentWorkflowContext>>;
|
|
54
|
-
export {};
|
|
55
|
-
//# sourceMappingURL=agent-workflow.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-workflow.d.ts","sourceRoot":"","sources":["../../src/workflows/agent-workflow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE3D;;GAEG;AACH,UAAU,iBAAiB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,GAAG,CAAC;CACd;AAED;;GAEG;AACH,UAAU,yBAAyB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,UAAU,iBAAiB;IACzB,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEtG;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,YAAY,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC3C,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,KAAK,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,UAAU,CAAC;CAC/D;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;IACrD,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AA4XD;;GAEG;AACH,wBAAsB,YAAY,CAChC,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,CA6C/C"}
|
|
@@ -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,E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AM,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAChG,cAAc,CAAC,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"}
|