@modular-prompt/process 0.2.2 → 0.3.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/dist/workflows/agentic-workflow/agentic-workflow.d.ts +2 -2
- package/dist/workflows/agentic-workflow/agentic-workflow.d.ts.map +1 -1
- package/dist/workflows/agentic-workflow/agentic-workflow.js +32 -35
- package/dist/workflows/agentic-workflow/agentic-workflow.js.map +1 -1
- package/dist/workflows/agentic-workflow/index.d.ts +1 -1
- package/dist/workflows/agentic-workflow/index.d.ts.map +1 -1
- package/dist/workflows/agentic-workflow/index.js.map +1 -1
- package/dist/workflows/agentic-workflow/process/builtin-tools.d.ts +9 -0
- package/dist/workflows/agentic-workflow/process/builtin-tools.d.ts.map +1 -1
- package/dist/workflows/agentic-workflow/process/builtin-tools.js +29 -4
- package/dist/workflows/agentic-workflow/process/builtin-tools.js.map +1 -1
- package/dist/workflows/agentic-workflow/process/query-with-tools.d.ts +9 -10
- package/dist/workflows/agentic-workflow/process/query-with-tools.d.ts.map +1 -1
- package/dist/workflows/agentic-workflow/process/query-with-tools.js +45 -62
- package/dist/workflows/agentic-workflow/process/query-with-tools.js.map +1 -1
- package/dist/workflows/agentic-workflow/task-types/execution-tasks.d.ts +5 -1
- package/dist/workflows/agentic-workflow/task-types/execution-tasks.d.ts.map +1 -1
- package/dist/workflows/agentic-workflow/task-types/execution-tasks.js +30 -19
- package/dist/workflows/agentic-workflow/task-types/execution-tasks.js.map +1 -1
- package/dist/workflows/agentic-workflow/task-types/index.d.ts +12 -3
- package/dist/workflows/agentic-workflow/task-types/index.d.ts.map +1 -1
- package/dist/workflows/agentic-workflow/task-types/index.js +40 -21
- package/dist/workflows/agentic-workflow/task-types/index.js.map +1 -1
- package/dist/workflows/agentic-workflow/task-types/output.d.ts +3 -3
- package/dist/workflows/agentic-workflow/task-types/output.d.ts.map +1 -1
- package/dist/workflows/agentic-workflow/task-types/output.js +9 -8
- package/dist/workflows/agentic-workflow/task-types/output.js.map +1 -1
- package/dist/workflows/agentic-workflow/task-types/planning.d.ts +1 -2
- package/dist/workflows/agentic-workflow/task-types/planning.d.ts.map +1 -1
- package/dist/workflows/agentic-workflow/task-types/planning.js +46 -21
- package/dist/workflows/agentic-workflow/task-types/planning.js.map +1 -1
- package/dist/workflows/agentic-workflow/types.d.ts +27 -12
- package/dist/workflows/agentic-workflow/types.d.ts.map +1 -1
- package/dist/workflows/index.d.ts +1 -1
- package/dist/workflows/index.d.ts.map +1 -1
- package/dist/workflows/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -10,34 +10,37 @@
|
|
|
10
10
|
* 2. types.ts の TaskType union に追加
|
|
11
11
|
* → レジストリ登録・ツール定義は自動的に反映される
|
|
12
12
|
*/
|
|
13
|
-
import {
|
|
13
|
+
import { buildPreviousResultsNote } from './index.js';
|
|
14
14
|
// ---------------------------------------------------------------------------
|
|
15
15
|
// Task definitions
|
|
16
16
|
// ---------------------------------------------------------------------------
|
|
17
17
|
export const EXECUTION_TASK_DEFS = {
|
|
18
18
|
think: {
|
|
19
|
-
objective: '- Perform reasoning, analysis, or processing
|
|
19
|
+
objective: '- Perform reasoning, analysis, or processing according to your Focus.',
|
|
20
20
|
instructions: [
|
|
21
21
|
'- You will perform reasoning, analysis, or processing as instructed.',
|
|
22
|
-
'- You may call
|
|
22
|
+
'- You may call tools if needed to gather information or perform actions.',
|
|
23
23
|
'- If additional tasks are needed to complete the objective, use `__insert_tasks` to register them.',
|
|
24
24
|
],
|
|
25
25
|
driverRole: 'thinking',
|
|
26
26
|
defaults: { withInputs: false, withMessages: false, withMaterials: false },
|
|
27
27
|
toolDescription: 'general reasoning/analysis',
|
|
28
|
+
maxTokensTier: 'high',
|
|
28
29
|
},
|
|
29
30
|
toolCall: {
|
|
30
|
-
objective: '- Call
|
|
31
|
+
objective: '- Call the tools needed according to your Focus.',
|
|
31
32
|
instructions: [
|
|
32
|
-
'-
|
|
33
|
-
'-
|
|
33
|
+
'- Call the appropriate tools to accomplish your Focus.',
|
|
34
|
+
'- Tool results are automatically passed to subsequent Tasks.',
|
|
34
35
|
],
|
|
35
36
|
driverRole: 'instruct',
|
|
36
37
|
defaults: { withInputs: false, withMessages: false, withMaterials: false },
|
|
37
|
-
toolDescription: 'call
|
|
38
|
+
toolDescription: 'call tools',
|
|
39
|
+
maxTokensTier: 'low',
|
|
40
|
+
builtinToolNames: ['__time'],
|
|
38
41
|
},
|
|
39
42
|
verify: {
|
|
40
|
-
objective: '- Verify or validate results from previous Tasks
|
|
43
|
+
objective: '- Verify or validate results from previous Tasks according to your Focus.',
|
|
41
44
|
instructions: [
|
|
42
45
|
'- You will verify or validate results from previous Tasks as instructed.',
|
|
43
46
|
'- Report any issues, inconsistencies, or confirmations clearly.',
|
|
@@ -46,11 +49,12 @@ export const EXECUTION_TASK_DEFS = {
|
|
|
46
49
|
driverRole: 'thinking',
|
|
47
50
|
defaults: { withInputs: false, withMessages: false, withMaterials: false },
|
|
48
51
|
toolDescription: 'validate previous results',
|
|
52
|
+
maxTokensTier: 'low',
|
|
49
53
|
},
|
|
50
54
|
extractContext: {
|
|
51
|
-
objective: '- Extract relevant information from the provided data according to
|
|
55
|
+
objective: '- Extract relevant information from the provided data according to your Focus.',
|
|
52
56
|
instructions: [
|
|
53
|
-
'- Extract information from the provided inputs, messages, and materials
|
|
57
|
+
'- Extract information from the provided inputs, messages, and materials according to your Focus.',
|
|
54
58
|
'- Be exhaustive — do not omit any relevant information.',
|
|
55
59
|
'- Combine direct quoting and summarization: quote key phrases or data verbatim, and summarize surrounding context.',
|
|
56
60
|
'- This is an extraction task: gather and organize what is present in the data. Do not interpret, infer, or add your own reasoning.',
|
|
@@ -59,11 +63,12 @@ export const EXECUTION_TASK_DEFS = {
|
|
|
59
63
|
driverRole: 'thinking',
|
|
60
64
|
defaults: { withInputs: true, withMessages: true, withMaterials: true },
|
|
61
65
|
toolDescription: 'extract from inputs/materials',
|
|
66
|
+
maxTokensTier: 'high',
|
|
62
67
|
},
|
|
63
68
|
recall: {
|
|
64
|
-
objective: '- Retrieve information relevant to
|
|
69
|
+
objective: '- Retrieve information relevant to your Focus using search tools or training knowledge.',
|
|
65
70
|
instructions: [
|
|
66
|
-
'- You will retrieve information relevant to
|
|
71
|
+
'- You will retrieve information relevant to your Focus.',
|
|
67
72
|
'- If search tools are available, formulate appropriate search queries and use them.',
|
|
68
73
|
'- If the information is already known from your training data and no search is needed, return it directly.',
|
|
69
74
|
'- Do not fabricate information. If uncertain, state what you know and what is unverified.',
|
|
@@ -71,9 +76,10 @@ export const EXECUTION_TASK_DEFS = {
|
|
|
71
76
|
driverRole: 'instruct',
|
|
72
77
|
defaults: { withInputs: false, withMessages: false, withMaterials: false },
|
|
73
78
|
toolDescription: 'retrieve information via search tools or training knowledge',
|
|
79
|
+
maxTokensTier: 'middle',
|
|
74
80
|
},
|
|
75
81
|
determine: {
|
|
76
|
-
objective: '- Make a decision or judgment based on the available information
|
|
82
|
+
objective: '- Make a decision or judgment based on the available information according to your Focus.',
|
|
77
83
|
instructions: [
|
|
78
84
|
'- You will make a decision or judgment based on the available information.',
|
|
79
85
|
'- You MUST reach a definitive conclusion. Do not defer, leave open, or suggest further investigation.',
|
|
@@ -82,6 +88,7 @@ export const EXECUTION_TASK_DEFS = {
|
|
|
82
88
|
driverRole: 'thinking',
|
|
83
89
|
defaults: { withInputs: true, withMessages: true, withMaterials: true },
|
|
84
90
|
toolDescription: 'make a decision or judgment',
|
|
91
|
+
maxTokensTier: 'middle',
|
|
85
92
|
},
|
|
86
93
|
};
|
|
87
94
|
// ---------------------------------------------------------------------------
|
|
@@ -91,7 +98,7 @@ function buildModule(def) {
|
|
|
91
98
|
const module = {
|
|
92
99
|
objective: [
|
|
93
100
|
'',
|
|
94
|
-
def.objective ?? '-
|
|
101
|
+
def.objective ?? '- Execute the current Task according to your Focus.',
|
|
95
102
|
],
|
|
96
103
|
instructions: [
|
|
97
104
|
...def.instructions,
|
|
@@ -106,12 +113,14 @@ function buildModule(def) {
|
|
|
106
113
|
],
|
|
107
114
|
},
|
|
108
115
|
],
|
|
109
|
-
|
|
116
|
+
preparationNote: [
|
|
110
117
|
(ctx) => {
|
|
111
118
|
if (!ctx.executionLog?.length)
|
|
112
119
|
return null;
|
|
113
|
-
return
|
|
120
|
+
return buildPreviousResultsNote(ctx.executionLog);
|
|
114
121
|
},
|
|
122
|
+
],
|
|
123
|
+
materials: [
|
|
115
124
|
(ctx) => {
|
|
116
125
|
const task = ctx.taskList?.[ctx.currentTaskIndex ?? 0];
|
|
117
126
|
const withMaterials = task?.withMaterials ?? def.defaults.withMaterials;
|
|
@@ -124,9 +133,9 @@ function buildModule(def) {
|
|
|
124
133
|
(ctx) => {
|
|
125
134
|
const task = ctx.taskList?.[ctx.currentTaskIndex ?? 0];
|
|
126
135
|
const withInputs = task?.withInputs ?? def.defaults.withInputs;
|
|
127
|
-
if (!withInputs || !ctx.inputs)
|
|
136
|
+
if (!withInputs || !ctx.userModule?.inputs?.length)
|
|
128
137
|
return null;
|
|
129
|
-
return
|
|
138
|
+
return ctx.userModule.inputs;
|
|
130
139
|
},
|
|
131
140
|
],
|
|
132
141
|
messages: [
|
|
@@ -141,10 +150,12 @@ function buildModule(def) {
|
|
|
141
150
|
};
|
|
142
151
|
return module;
|
|
143
152
|
}
|
|
153
|
+
const DEFAULT_BUILTIN_TOOLS = ['__insert_tasks', '__update_state', '__time'];
|
|
144
154
|
function buildConfig(def) {
|
|
145
155
|
return {
|
|
146
156
|
module: buildModule(def),
|
|
147
|
-
builtinToolNames:
|
|
157
|
+
builtinToolNames: def.builtinToolNames ?? DEFAULT_BUILTIN_TOOLS,
|
|
158
|
+
maxTokensTier: def.maxTokensTier,
|
|
148
159
|
};
|
|
149
160
|
}
|
|
150
161
|
// ---------------------------------------------------------------------------
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-tasks.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/task-types/execution-tasks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"execution-tasks.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/task-types/execution-tasks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAuBtD,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,mBAAmB,GAAqC;IACnE,KAAK,EAAE;QACL,SAAS,EAAE,uEAAuE;QAClF,YAAY,EAAE;YACZ,sEAAsE;YACtE,0EAA0E;YAC1E,oGAAoG;SACrG;QACD,UAAU,EAAE,UAAU;QACtB,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE;QAC1E,eAAe,EAAE,4BAA4B;QAC7C,aAAa,EAAE,MAAM;KACtB;IACD,QAAQ,EAAE;QACR,SAAS,EAAE,kDAAkD;QAC7D,YAAY,EAAE;YACZ,wDAAwD;YACxD,8DAA8D;SAC/D;QACD,UAAU,EAAE,UAAU;QACtB,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE;QAC1E,eAAe,EAAE,YAAY;QAC7B,aAAa,EAAE,KAAK;QACpB,gBAAgB,EAAE,CAAC,QAAQ,CAAC;KAC7B;IACD,MAAM,EAAE;QACN,SAAS,EAAE,2EAA2E;QACtF,YAAY,EAAE;YACZ,0EAA0E;YAC1E,iEAAiE;YACjE,mHAAmH;SACpH;QACD,UAAU,EAAE,UAAU;QACtB,QAAQ,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE;QAC1E,eAAe,EAAE,2BAA2B;QAC5C,aAAa,EAAE,KAAK;KACrB;IACD,cAAc,EAAE;QACd,SAAS,E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E;gBAC9B,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,gBAAgB,IAAI,CAAC,CAAC,CAAC;gBACvD,MAAM,YAAY,GAAG,IAAI,EAAE,YAAY,IAAI,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC;gBACrE,IAAI,CAAC,YAAY,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM;oBAAE,OAAO,IAAI,CAAC;gBACpE,OAAO,GAAG,CAAC,UAAU,CAAC,QAA4B,CAAC;YACrD,CAAC;SACF;KACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,qBAAqB,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;AAE7E,SAAS,WAAW,CAAC,GAAqB;IACxC,OAAO;QACL,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC;QACxB,gBAAgB,EAAE,GAAG,CAAC,gBAAgB,IAAI,qBAAqB;QAC/D,aAAa,EAAE,GAAG,CAAC,aAAa;KACjC,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,0DAA0D;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAmC,MAAM,CAAC,WAAW,CACpF,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CACnF,CAAC"}
|
|
@@ -1,25 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Task type registry and shared utilities
|
|
3
3
|
*/
|
|
4
|
-
import type { PromptModule,
|
|
4
|
+
import type { PromptModule, TextElement, SectionContent } from '@modular-prompt/core';
|
|
5
5
|
import type { AgenticWorkflowContext, TaskType, AgenticTaskExecutionLog } from '../types.js';
|
|
6
6
|
/**
|
|
7
7
|
* Task type configuration
|
|
8
8
|
*/
|
|
9
|
+
/**
|
|
10
|
+
* maxTokens tier for task types.
|
|
11
|
+
* Actual values: low=1024, middle=4096, high=8192 (capped by model maxOutputTokens).
|
|
12
|
+
*/
|
|
13
|
+
export type MaxTokensTier = 'low' | 'middle' | 'high';
|
|
14
|
+
export declare const MAX_TOKENS_VALUES: Record<MaxTokensTier, number>;
|
|
9
15
|
export interface TaskTypeConfig {
|
|
10
16
|
/** Static prompt module for this task type */
|
|
11
17
|
module: PromptModule<AgenticWorkflowContext>;
|
|
12
18
|
/** List of builtin tool names available for this task type */
|
|
13
19
|
builtinToolNames: string[];
|
|
20
|
+
/** maxTokens tier (default: 'middle') */
|
|
21
|
+
maxTokensTier: MaxTokensTier;
|
|
14
22
|
}
|
|
15
23
|
/**
|
|
16
24
|
* Get task type configuration
|
|
17
25
|
*/
|
|
18
26
|
export declare function getTaskTypeConfig(taskType: TaskType): TaskTypeConfig;
|
|
19
27
|
/**
|
|
20
|
-
* Convert execution log to
|
|
28
|
+
* Convert execution log to a TextElement for preparationNote.
|
|
29
|
+
* Each task result is formatted as a labeled block.
|
|
21
30
|
*/
|
|
22
|
-
export declare function
|
|
31
|
+
export declare function buildPreviousResultsNote(executionLog: AgenticTaskExecutionLog[]): TextElement;
|
|
23
32
|
/**
|
|
24
33
|
* Build task list display for methodology section
|
|
25
34
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/task-types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/task-types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAK7F;;GAEG;AACH;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAItD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAI3D,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,MAAM,EAAE,YAAY,CAAC,sBAAsB,CAAC,CAAC;IAC7C,8DAA8D;IAC9D,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,yCAAyC;IACzC,aAAa,EAAE,aAAa,CAAC;CAC9B;AAYD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,CAEpE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,uBAAuB,EAAE,GACtC,WAAW,CAcb;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,sBAAsB,GAAG,MAAM,CAwBxE;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,sBAAsB,CA+B3D,CAAC;AAEF;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,MAAM,CAUvF"}
|
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
import { config as planningConfig } from './planning.js';
|
|
5
5
|
import { config as outputConfig } from './output.js';
|
|
6
6
|
import { executionTaskConfigs } from './execution-tasks.js';
|
|
7
|
+
// TODO: high tier should be capped by ModelSpec.maxOutputTokens at query time.
|
|
8
|
+
// Currently the driver's defaultOptions-level cap (validateAndClampMaxTokens) does not apply to per-query maxTokens.
|
|
9
|
+
export const MAX_TOKENS_VALUES = {
|
|
10
|
+
low: 2048,
|
|
11
|
+
middle: 4096,
|
|
12
|
+
high: 8192,
|
|
13
|
+
};
|
|
7
14
|
/**
|
|
8
15
|
* Task type registry.
|
|
9
16
|
* planning/output are special; execution tasks are auto-generated from EXECUTION_TASK_DEFS.
|
|
@@ -20,15 +27,23 @@ export function getTaskTypeConfig(taskType) {
|
|
|
20
27
|
return TASK_TYPE_REGISTRY[taskType];
|
|
21
28
|
}
|
|
22
29
|
/**
|
|
23
|
-
* Convert execution log to
|
|
30
|
+
* Convert execution log to a TextElement for preparationNote.
|
|
31
|
+
* Each task result is formatted as a labeled block.
|
|
24
32
|
*/
|
|
25
|
-
export function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
export function buildPreviousResultsNote(executionLog) {
|
|
34
|
+
const content = executionLog
|
|
35
|
+
.map((log, index) => {
|
|
36
|
+
let text = `[Task ${index + 1}: ${log.taskType}] ${log.instruction}\n${log.result}`;
|
|
37
|
+
if (log.toolCallLog?.length) {
|
|
38
|
+
const toolResults = log.toolCallLog
|
|
39
|
+
.map(tc => ` [tool: ${tc.name}] ${typeof tc.result === 'string' ? tc.result : JSON.stringify(tc.result)}`)
|
|
40
|
+
.join('\n');
|
|
41
|
+
text += `\n${toolResults}`;
|
|
42
|
+
}
|
|
43
|
+
return text;
|
|
44
|
+
})
|
|
45
|
+
.join('\n\n');
|
|
46
|
+
return { type: 'text', content };
|
|
32
47
|
}
|
|
33
48
|
/**
|
|
34
49
|
* Build task list display for methodology section
|
|
@@ -60,25 +75,16 @@ export function buildTaskListDisplay(ctx) {
|
|
|
60
75
|
* Provides workflow terms, methodology, and state information.
|
|
61
76
|
*/
|
|
62
77
|
export const taskCommon = {
|
|
63
|
-
instructions: [
|
|
64
|
-
'- Do not perform work outside the scope of the current Task.',
|
|
65
|
-
'- It is a valid and sufficient response to report: instructions are contradictory, there is insufficient information, you lack the required knowledge, or the work is unnecessary.',
|
|
66
|
-
],
|
|
67
78
|
terms: [
|
|
68
|
-
'- **
|
|
79
|
+
'- **Workflow**: The entire process that achieves the Objective by executing a sequence of Tasks.',
|
|
80
|
+
'- **Task**: A unit of work in the Workflow. Each Task is executed by a separate AI instance.',
|
|
69
81
|
'- **Task Type**: Defines the role of a Task (e.g. think, toolCall, verify). The prompt is pre-configured for each type.',
|
|
70
82
|
'- **Focus**: The specific directive for the current Task — what to concentrate on and accomplish.',
|
|
71
83
|
'- **State**: Persistent information shared across Tasks. Updated via `__update_state` and visible to all subsequent Tasks in the "Current State" section.',
|
|
72
|
-
|
|
73
|
-
state: [
|
|
74
|
-
(ctx) => {
|
|
75
|
-
if (!ctx.state)
|
|
76
|
-
return null;
|
|
77
|
-
return ctx.state;
|
|
78
|
-
},
|
|
84
|
+
'- **Response Preparation Note**: Results from all previously completed Tasks. Use this as your primary reference for what has already been done.',
|
|
79
85
|
],
|
|
80
86
|
methodology: [
|
|
81
|
-
|
|
87
|
+
`- We accomplish the Workflow's Objective by executing Tasks sequentially.`,
|
|
82
88
|
{
|
|
83
89
|
type: 'subsection',
|
|
84
90
|
title: 'Workflow Status / Current Task List',
|
|
@@ -87,6 +93,19 @@ export const taskCommon = {
|
|
|
87
93
|
],
|
|
88
94
|
},
|
|
89
95
|
],
|
|
96
|
+
instructions: [
|
|
97
|
+
'- Do not perform work outside the scope of the current Task\'s Focus.',
|
|
98
|
+
'- If "Response Preparation Note" is present, refer to it as the basis for your work.',
|
|
99
|
+
'- If the instructions are contradictory, there is insufficient information, or you lack the required knowledge — report the issue instead of producing a speculative result.',
|
|
100
|
+
'- If the work is unnecessary given the current context, skip it and explain why. This is a valid and sufficient response.',
|
|
101
|
+
],
|
|
102
|
+
state: [
|
|
103
|
+
(ctx) => {
|
|
104
|
+
if (!ctx.state)
|
|
105
|
+
return null;
|
|
106
|
+
return ctx.state;
|
|
107
|
+
},
|
|
108
|
+
],
|
|
90
109
|
};
|
|
91
110
|
/**
|
|
92
111
|
* Extract static text content from SectionContent.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/task-types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/task-types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAW5D,+EAA+E;AAC/E,qHAAqH;AACrH,MAAM,CAAC,MAAM,iBAAiB,GAAkC;IAC9D,GAAG,EAAE,IAAI;IACT,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,IAAI;CACX,CAAC;AAWF;;;GAGG;AACH,MAAM,kBAAkB,GAAqC;IAC3D,QAAQ,EAAE,cAAc;IACxB,GAAG,oBAAsD;IACzD,MAAM,EAAE,YAAY;CACe,CAAC;AAEtC;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAkB;IAClD,OAAO,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AACtC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACtC,YAAuC;IAEvC,MAAM,OAAO,GAAG,YAAY;SACzB,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAClB,IAAI,IAAI,GAAG,SAAS,KAAK,GAAG,CAAC,KAAK,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,WAAW,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC;QACpF,IAAI,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,C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AAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Uses the full userModule (passed via workflowBase) as the prompt.
|
|
5
5
|
* This module only adds:
|
|
6
|
-
* - An instruction to refer to the pre-computed task results in
|
|
7
|
-
* - The execution log as
|
|
6
|
+
* - An instruction to refer to the pre-computed task results in preparationNote
|
|
7
|
+
* - The execution log as preparationNote
|
|
8
8
|
*
|
|
9
9
|
* The model sees the original user prompt with task results injected,
|
|
10
10
|
* so it naturally produces the expected response.
|
|
11
11
|
*
|
|
12
|
-
* Builtin tools: none
|
|
12
|
+
* Builtin tools: none
|
|
13
13
|
*/
|
|
14
14
|
import type { TaskTypeConfig } from './index.js';
|
|
15
15
|
export declare const config: TaskTypeConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/task-types/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAiBjD,eAAO,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/task-types/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAiBjD,eAAO,MAAM,MAAM,EAAE,cAIpB,CAAC"}
|
|
@@ -3,30 +3,31 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Uses the full userModule (passed via workflowBase) as the prompt.
|
|
5
5
|
* This module only adds:
|
|
6
|
-
* - An instruction to refer to the pre-computed task results in
|
|
7
|
-
* - The execution log as
|
|
6
|
+
* - An instruction to refer to the pre-computed task results in preparationNote
|
|
7
|
+
* - The execution log as preparationNote
|
|
8
8
|
*
|
|
9
9
|
* The model sees the original user prompt with task results injected,
|
|
10
10
|
* so it naturally produces the expected response.
|
|
11
11
|
*
|
|
12
|
-
* Builtin tools: none
|
|
12
|
+
* Builtin tools: none
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
14
|
+
import { buildPreviousResultsNote } from './index.js';
|
|
15
15
|
const outputModule = {
|
|
16
16
|
instructions: [
|
|
17
|
-
'-
|
|
18
|
-
'-
|
|
17
|
+
'- Compose the final response using the pre-computed results in "Response Preparation Note".',
|
|
18
|
+
'- Focus on presenting the results clearly. You may adapt, rephrase, or convert values as needed for the audience, but do not perform substantive new analysis.',
|
|
19
19
|
],
|
|
20
|
-
|
|
20
|
+
preparationNote: [
|
|
21
21
|
(ctx) => {
|
|
22
22
|
if (!ctx.executionLog?.length)
|
|
23
23
|
return null;
|
|
24
|
-
return
|
|
24
|
+
return buildPreviousResultsNote(ctx.executionLog);
|
|
25
25
|
},
|
|
26
26
|
],
|
|
27
27
|
};
|
|
28
28
|
export const config = {
|
|
29
29
|
module: outputModule,
|
|
30
30
|
builtinToolNames: [],
|
|
31
|
+
maxTokensTier: 'middle',
|
|
31
32
|
};
|
|
32
33
|
//# sourceMappingURL=output.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/task-types/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/task-types/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,YAAY,GAAyC;IACzD,YAAY,EAAE;QACZ,6FAA6F;QAC7F,gKAAgK;KACjK;IAED,eAAe,EAAE;QACf,CAAC,GAA2B,EAAE,EAAE;YAC9B,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,MAAM;gBAAE,OAAO,IAAI,CAAC;YAC3C,OAAO,wBAAwB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACpD,CAAC;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAmB;IACpC,MAAM,EAAE,YAAY;IACpB,gBAAgB,EAAE,EAAE;IACpB,aAAa,EAAE,QAAQ;CACxB,CAAC"}
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
* using distribute() + formatCompletionPrompt().
|
|
7
7
|
*
|
|
8
8
|
* Data side:
|
|
9
|
-
* - userModule compiled as "Prompt to analyze" material
|
|
10
|
-
* - ctx.inputs
|
|
9
|
+
* - userModule compiled as "Prompt to analyze" material (includes inputs)
|
|
11
10
|
*
|
|
12
11
|
* Output side:
|
|
13
12
|
* - cue: user message instructing to call __insert_tasks tool
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/task-types/planning.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/task-types/planning.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAmFjD,eAAO,MAAM,MAAM,EAAE,cAIpB,CAAC"}
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
* using distribute() + formatCompletionPrompt().
|
|
7
7
|
*
|
|
8
8
|
* Data side:
|
|
9
|
-
* - userModule compiled as "Prompt to analyze" material
|
|
10
|
-
* - ctx.inputs
|
|
9
|
+
* - userModule compiled as "Prompt to analyze" material (includes inputs)
|
|
11
10
|
*
|
|
12
11
|
* Output side:
|
|
13
12
|
* - cue: user message instructing to call __insert_tasks tool
|
|
@@ -18,22 +17,54 @@ import { distribute } from '@modular-prompt/core';
|
|
|
18
17
|
import { formatCompletionPrompt } from '@modular-prompt/driver';
|
|
19
18
|
const planningModule = {
|
|
20
19
|
objective: [
|
|
21
|
-
'-
|
|
20
|
+
'- You are the planner. Analysis and task design are your responsibility.',
|
|
21
|
+
'- Analyze the given prompt to understand what needs to be accomplished.',
|
|
22
|
+
'- Design a Workflow by composing the minimum sequence of Tasks needed.',
|
|
23
|
+
],
|
|
24
|
+
terms: [
|
|
25
|
+
'- **Workflow**: The entire process that achieves the Objective by executing a sequence of Tasks.',
|
|
26
|
+
'- **Task**: A unit of work in the Workflow. Each Task is executed by a separate AI instance.',
|
|
27
|
+
'- **Task Type**: Defines the role of a Task. The prompt is pre-configured for each type.',
|
|
28
|
+
'- **Tool**: A function that a Task can call to perform actions or retrieve information. See "Available Tools" in Guidelines.',
|
|
29
|
+
'- **State**: Persistent information shared across Tasks. Updated via `__update_state` and visible to all subsequent Tasks.',
|
|
30
|
+
],
|
|
31
|
+
methodology: [
|
|
32
|
+
'- Tasks are executed sequentially by separate AI instances.',
|
|
33
|
+
'- Each Task receives results from all previously completed Tasks.',
|
|
34
|
+
'- Tool call results from one Task are passed to the next Task.',
|
|
22
35
|
],
|
|
23
36
|
instructions: [
|
|
24
|
-
'-
|
|
25
|
-
'-
|
|
26
|
-
'-
|
|
27
|
-
'-
|
|
28
|
-
'-
|
|
37
|
+
'- Read "Prompt to analyze" and determine what the final output should be.',
|
|
38
|
+
'- Check "Available Tools" to understand what tools can be used in the Workflow.',
|
|
39
|
+
'- Determine the minimum set of Tasks needed — a simple prompt may need only one.',
|
|
40
|
+
'- If tools are needed, schedule toolCall Tasks for them.',
|
|
41
|
+
'- Call `__insert_tasks` to register Tasks. If the work is simple enough (e.g. a single tool call), you may call the tool directly instead of scheduling a Task.',
|
|
42
|
+
],
|
|
43
|
+
guidelines: [
|
|
44
|
+
'- Only register Tasks for work that requires a separate AI instance to execute.',
|
|
45
|
+
'- Write each Task instruction as a descriptive action statement — what the Task does and what outcome is expected. A longer paragraph is fine, but step-by-step procedural instructions are unnecessary.',
|
|
46
|
+
{
|
|
47
|
+
type: 'subsection',
|
|
48
|
+
title: 'Task Type Guide',
|
|
49
|
+
items: [
|
|
50
|
+
'- **think**: General reasoning, analysis, or processing.',
|
|
51
|
+
'- **toolCall**: Call tools and report results.',
|
|
52
|
+
'- **extractContext**: Extract information from inputs, messages, or materials.',
|
|
53
|
+
'- **recall**: Retrieve information via search tools or training knowledge.',
|
|
54
|
+
'- **verify**: Validate results from previous Tasks.',
|
|
55
|
+
'- **determine**: Make a definitive decision or judgment.',
|
|
56
|
+
'- **output**: Format and present the final response from previous Task results. No new work is performed. Must be the last Task.',
|
|
57
|
+
],
|
|
58
|
+
},
|
|
29
59
|
{
|
|
30
60
|
type: 'subsection',
|
|
31
|
-
title: '
|
|
61
|
+
title: 'Available Tools',
|
|
32
62
|
items: [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
63
|
+
(ctx) => {
|
|
64
|
+
if (!ctx.availableTools?.length)
|
|
65
|
+
return 'No tools available.';
|
|
66
|
+
return ctx.availableTools.map(t => `- **${t.name}**: ${t.description || '(no description)'}`).join('\n');
|
|
67
|
+
},
|
|
37
68
|
],
|
|
38
69
|
},
|
|
39
70
|
],
|
|
@@ -55,13 +86,6 @@ const planningModule = {
|
|
|
55
86
|
};
|
|
56
87
|
},
|
|
57
88
|
],
|
|
58
|
-
inputs: [
|
|
59
|
-
(ctx) => {
|
|
60
|
-
if (!ctx.inputs)
|
|
61
|
-
return null;
|
|
62
|
-
return JSON.stringify(ctx.inputs, null, 2);
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
89
|
cue: [
|
|
66
90
|
{
|
|
67
91
|
type: 'message',
|
|
@@ -72,6 +96,7 @@ const planningModule = {
|
|
|
72
96
|
};
|
|
73
97
|
export const config = {
|
|
74
98
|
module: planningModule,
|
|
75
|
-
builtinToolNames: ['__insert_tasks'],
|
|
99
|
+
builtinToolNames: ['__insert_tasks', '__update_state', '__time'],
|
|
100
|
+
maxTokensTier: 'high',
|
|
76
101
|
};
|
|
77
102
|
//# sourceMappingURL=planning.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planning.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/task-types/planning.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"planning.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/task-types/planning.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAIhE,MAAM,cAAc,GAAyC;IAC3D,SAAS,EAAE;QACT,0EAA0E;QAC1E,yEAAyE;QACzE,wEAAwE;KACzE;IACD,KAAK,EAAE;QACL,kGAAkG;QAClG,8FAA8F;QAC9F,0FAA0F;QAC1F,8HAA8H;QAC9H,4HAA4H;KAC7H;IACD,WAAW,EAAE;QACX,6DAA6D;QAC7D,mEAAmE;QACnE,gEAAgE;KACjE;IACD,YAAY,EAAE;QACZ,2EAA2E;QAC3E,iFAAiF;QACjF,kFAAkF;QAClF,0DAA0D;QAC1D,iKAAiK;KAClK;IACD,UAAU,EAAE;QACV,iFAAiF;QACjF,0MAA0M;QAC1M;YACE,IAAI,EAAE,YAAqB;YAC3B,KAAK,EAAE,iBAAiB;YACxB,KAAK,EAAE;gBACL,0DAA0D;gBAC1D,gDAAgD;gBAChD,gFAAgF;gBAChF,4EAA4E;gBAC5E,qDAAqD;gBACrD,0DAA0D;gBAC1D,kIAAkI;aACnI;SACF;QACD;YACE,IAAI,EAAE,YAAqB;YAC3B,KAAK,EAAE,iBAAiB;YACxB,KAAK,EAAE;gBACL,CAAC,GAA2B,EAAE,EAAE;oBAC9B,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,MAAM;wBAAE,OAAO,qBAAqB,CAAC;oBAC9D,OAAO,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAChC,OAAO,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,WAAW,IAAI,kBAAkB,EAAE,CAC1D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACf,CAAC;aACF;SACF;KACF;IAED,SAAS,EAAE;QACT,CAAC,GAA2B,EAAE,EAAE;YAC9B,IAAI,CAAC,GAAG,CAAC,UAAU;gBAAE,OAAO,IAAI,CAAC;YACjC,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC5C,MAAM,IAAI,GAAG,sBAAsB,CAAC,QAAQ,EAAE;gBAC5C,mBAAmB,EAAE,EAAE;aACxB,CAAC,CAAC;YACH,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;gBAAE,OAAO,IAAI,CAAC;YAC9B,OAAO;gBACL,IAAI,EAAE,UAAmB;gBACzB,EAAE,EAAE,aAAa;gBACjB,KAAK,EAAE,mBAAmB;gBAC1B,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;KACF;IAED,GAAG,EAAE;QACH;YACE,IAAI,EAAE,SAAkB;YACxB,IAAI,EAAE,MAAe;YACrB,OAAO,EAAE,oEAAoE;SAC9E;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAmB;IACpC,MAAM,EAAE,cAAc;IACtB,gBAAgB,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,QAAQ,CAAC;IAChE,aAAa,EAAE,MAAM;CACtB,CAAC"}
|
|
@@ -48,11 +48,11 @@ export interface AgenticTask {
|
|
|
48
48
|
taskType: TaskType;
|
|
49
49
|
/** Driver role override (defaults per task type) */
|
|
50
50
|
driverRole?: ModelRole;
|
|
51
|
-
/** Include
|
|
51
|
+
/** Include user inputs in data */
|
|
52
52
|
withInputs?: boolean;
|
|
53
|
-
/** Include
|
|
53
|
+
/** Include user messages in data */
|
|
54
54
|
withMessages?: boolean;
|
|
55
|
-
/** Include
|
|
55
|
+
/** Include user materials in data */
|
|
56
56
|
withMaterials?: boolean;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
@@ -62,24 +62,23 @@ export interface AgenticTaskExecutionLog {
|
|
|
62
62
|
taskType: TaskType;
|
|
63
63
|
instruction: string;
|
|
64
64
|
result: string;
|
|
65
|
+
/** Builtin tool call results from this task */
|
|
66
|
+
toolCallLog?: ToolCallLog[];
|
|
65
67
|
pendingToolCalls?: ToolCall[];
|
|
66
68
|
metadata?: {
|
|
67
69
|
usage?: QueryResult['usage'];
|
|
68
70
|
};
|
|
69
71
|
}
|
|
70
72
|
/**
|
|
71
|
-
*
|
|
73
|
+
* Internal context for agentic workflow.
|
|
72
74
|
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
+
* This is NOT the user-facing API. Users pass their own context type `T`
|
|
76
|
+
* (for module DynamicContent resolution) and optionally an `AgenticResumeState`
|
|
77
|
+
* (via options) to resume a previously suspended workflow.
|
|
75
78
|
*/
|
|
76
79
|
export interface AgenticWorkflowContext {
|
|
77
|
-
/** Primary objective (passed as instruction to all tasks) */
|
|
78
|
-
objective: string;
|
|
79
80
|
/** Resolved user module (set by agenticProcess via resolve()) */
|
|
80
81
|
userModule?: ResolvedModule;
|
|
81
|
-
/** Structured input data */
|
|
82
|
-
inputs?: Record<string, unknown>;
|
|
83
82
|
/** Current task list */
|
|
84
83
|
taskList?: AgenticTask[];
|
|
85
84
|
/** Execution log of completed tasks */
|
|
@@ -88,6 +87,22 @@ export interface AgenticWorkflowContext {
|
|
|
88
87
|
currentTaskIndex?: number;
|
|
89
88
|
/** Persisted state string from previous task execution */
|
|
90
89
|
state?: string;
|
|
90
|
+
/** External tool definitions available to tasks (for planning visibility) */
|
|
91
|
+
availableTools?: ToolDefinition[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* State for resuming a previously suspended agentic workflow.
|
|
95
|
+
*
|
|
96
|
+
* Returned by agenticProcess in the result and can be passed back
|
|
97
|
+
* via options.resumeState to continue execution.
|
|
98
|
+
*/
|
|
99
|
+
export interface AgenticResumeState {
|
|
100
|
+
/** Task list from the previous run */
|
|
101
|
+
taskList?: AgenticTask[];
|
|
102
|
+
/** Execution log from the previous run */
|
|
103
|
+
executionLog?: AgenticTaskExecutionLog[];
|
|
104
|
+
/** Persisted state from the previous run */
|
|
105
|
+
state?: string;
|
|
91
106
|
}
|
|
92
107
|
/**
|
|
93
108
|
* Options for agentic workflow
|
|
@@ -97,11 +112,11 @@ export interface AgenticWorkflowOptions {
|
|
|
97
112
|
maxTasks?: number;
|
|
98
113
|
/** External tools available to tasks */
|
|
99
114
|
tools?: ToolSpec[];
|
|
100
|
-
/** Maximum tool call iterations per task (default: 10) */
|
|
101
|
-
maxToolCalls?: number;
|
|
102
115
|
/** Skip planning and use provided taskList (default: true) */
|
|
103
116
|
enablePlanning?: boolean;
|
|
104
117
|
/** Include intermediate task results wrapped in <think> tags before the final output (default: false) */
|
|
105
118
|
includeThinking?: boolean;
|
|
119
|
+
/** Resume state from a previously suspended workflow */
|
|
120
|
+
resumeState?: AgenticResumeState;
|
|
106
121
|
}
|
|
107
122
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/workflows/agentic-workflow/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAMpD;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,cAAc,CAAC;IAC3B,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,C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