@modular-prompt/process 0.1.27 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -2
- package/dist/workflows/agentic-workflow/agentic-workflow.d.ts +12 -8
- package/dist/workflows/agentic-workflow/agentic-workflow.d.ts.map +1 -1
- package/dist/workflows/agentic-workflow/agentic-workflow.js +182 -205
- package/dist/workflows/agentic-workflow/agentic-workflow.js.map +1 -1
- package/dist/workflows/agentic-workflow/index.d.ts +5 -2
- package/dist/workflows/agentic-workflow/index.d.ts.map +1 -1
- package/dist/workflows/agentic-workflow/index.js +5 -2
- package/dist/workflows/agentic-workflow/index.js.map +1 -1
- package/dist/workflows/agentic-workflow/process/builtin-tools.d.ts +24 -0
- package/dist/workflows/agentic-workflow/process/builtin-tools.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/process/builtin-tools.js +134 -0
- package/dist/workflows/agentic-workflow/process/builtin-tools.js.map +1 -0
- package/dist/workflows/agentic-workflow/process/format-helpers.d.ts +11 -0
- package/dist/workflows/agentic-workflow/process/format-helpers.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/process/format-helpers.js +18 -0
- package/dist/workflows/agentic-workflow/process/format-helpers.js.map +1 -0
- package/dist/workflows/agentic-workflow/process/index.d.ts +7 -0
- package/dist/workflows/agentic-workflow/process/index.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/process/index.js +7 -0
- package/dist/workflows/agentic-workflow/process/index.js.map +1 -0
- package/dist/workflows/agentic-workflow/process/query-with-tools.d.ts +37 -0
- package/dist/workflows/agentic-workflow/process/query-with-tools.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/process/query-with-tools.js +118 -0
- package/dist/workflows/agentic-workflow/process/query-with-tools.js.map +1 -0
- package/dist/workflows/agentic-workflow/task-types/execution-tasks.d.ts +35 -0
- package/dist/workflows/agentic-workflow/task-types/execution-tasks.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/task-types/execution-tasks.js +155 -0
- package/dist/workflows/agentic-workflow/task-types/execution-tasks.js.map +1 -0
- package/dist/workflows/agentic-workflow/task-types/index.d.ts +37 -0
- package/dist/workflows/agentic-workflow/task-types/index.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/task-types/index.js +95 -0
- package/dist/workflows/agentic-workflow/task-types/index.js.map +1 -0
- package/dist/workflows/agentic-workflow/task-types/output.d.ts +16 -0
- package/dist/workflows/agentic-workflow/task-types/output.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/task-types/output.js +31 -0
- package/dist/workflows/agentic-workflow/task-types/output.js.map +1 -0
- package/dist/workflows/agentic-workflow/task-types/planning.d.ts +19 -0
- package/dist/workflows/agentic-workflow/task-types/planning.d.ts.map +1 -0
- package/dist/workflows/agentic-workflow/task-types/planning.js +77 -0
- package/dist/workflows/agentic-workflow/task-types/planning.js.map +1 -0
- package/dist/workflows/agentic-workflow/types.d.ts +83 -37
- package/dist/workflows/agentic-workflow/types.d.ts.map +1 -1
- package/dist/workflows/agentic-workflow/types.js +27 -1
- package/dist/workflows/agentic-workflow/types.js.map +1 -1
- package/dist/workflows/concat-process-workflow.d.ts +3 -2
- package/dist/workflows/concat-process-workflow.d.ts.map +1 -1
- package/dist/workflows/concat-process-workflow.js +41 -5
- package/dist/workflows/concat-process-workflow.js.map +1 -1
- package/dist/workflows/default-workflow.d.ts +3 -2
- package/dist/workflows/default-workflow.d.ts.map +1 -1
- package/dist/workflows/default-workflow.js +14 -1
- package/dist/workflows/default-workflow.js.map +1 -1
- package/dist/workflows/dialogue-workflow.d.ts +3 -2
- package/dist/workflows/dialogue-workflow.d.ts.map +1 -1
- package/dist/workflows/dialogue-workflow.js +15 -3
- package/dist/workflows/dialogue-workflow.js.map +1 -1
- package/dist/workflows/driver-input.d.ts +16 -0
- package/dist/workflows/driver-input.d.ts.map +1 -0
- package/dist/workflows/driver-input.js +18 -0
- package/dist/workflows/driver-input.js.map +1 -0
- package/dist/workflows/index.d.ts +6 -3
- package/dist/workflows/index.d.ts.map +1 -1
- package/dist/workflows/index.js +5 -2
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/self-prompting-workflow/self-prompting-workflow.d.ts +3 -2
- package/dist/workflows/self-prompting-workflow/self-prompting-workflow.d.ts.map +1 -1
- package/dist/workflows/self-prompting-workflow/self-prompting-workflow.js +4 -3
- package/dist/workflows/self-prompting-workflow/self-prompting-workflow.js.map +1 -1
- package/dist/workflows/stream-workflow.d.ts +3 -2
- package/dist/workflows/stream-workflow.d.ts.map +1 -1
- package/dist/workflows/stream-workflow.js +11 -3
- package/dist/workflows/stream-workflow.js.map +1 -1
- package/dist/workflows/summarize-workflow.d.ts +3 -2
- package/dist/workflows/summarize-workflow.d.ts.map +1 -1
- package/dist/workflows/summarize-workflow.js +11 -2
- package/dist/workflows/summarize-workflow.js.map +1 -1
- package/package.json +4 -3
- package/dist/workflows/agent-workflow.d.ts +0 -55
- package/dist/workflows/agent-workflow.d.ts.map +0 -1
- package/dist/workflows/agent-workflow.js +0 -337
- package/dist/workflows/agent-workflow.js.map +0 -1
- package/dist/workflows/agentic-workflow/modules/agentic.d.ts +0 -12
- package/dist/workflows/agentic-workflow/modules/agentic.d.ts.map +0 -1
- package/dist/workflows/agentic-workflow/modules/agentic.js +0 -22
- package/dist/workflows/agentic-workflow/modules/agentic.js.map +0 -1
- package/dist/workflows/agentic-workflow/modules/execution-freeform.d.ts +0 -15
- package/dist/workflows/agentic-workflow/modules/execution-freeform.d.ts.map +0 -1
- package/dist/workflows/agentic-workflow/modules/execution-freeform.js +0 -140
- package/dist/workflows/agentic-workflow/modules/execution-freeform.js.map +0 -1
- package/dist/workflows/agentic-workflow/modules/execution.d.ts +0 -11
- package/dist/workflows/agentic-workflow/modules/execution.d.ts.map +0 -1
- package/dist/workflows/agentic-workflow/modules/execution.js +0 -180
- package/dist/workflows/agentic-workflow/modules/execution.js.map +0 -1
- package/dist/workflows/agentic-workflow/modules/index.d.ts +0 -6
- package/dist/workflows/agentic-workflow/modules/index.d.ts.map +0 -1
- package/dist/workflows/agentic-workflow/modules/index.js +0 -7
- package/dist/workflows/agentic-workflow/modules/index.js.map +0 -1
- package/dist/workflows/agentic-workflow/modules/integration.d.ts +0 -11
- package/dist/workflows/agentic-workflow/modules/integration.d.ts.map +0 -1
- package/dist/workflows/agentic-workflow/modules/integration.js +0 -85
- package/dist/workflows/agentic-workflow/modules/integration.js.map +0 -1
- package/dist/workflows/agentic-workflow/modules/planning.d.ts +0 -11
- package/dist/workflows/agentic-workflow/modules/planning.d.ts.map +0 -1
- package/dist/workflows/agentic-workflow/modules/planning.js +0 -103
- package/dist/workflows/agentic-workflow/modules/planning.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-tools.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/process/builtin-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAY,MAAM,aAAa,CAAC;AAInE,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AA4ED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,QAAQ,EAAE,CAiC7F;AAmBD;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,WAAW,EAAE,EACvB,YAAY,EAAE,MAAM,GACnB,QAAQ,EAAE,CAKZ"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agentic workflow 組み込みツール定義 (v2)
|
|
3
|
+
*
|
|
4
|
+
* - __insert_tasks: タスク登録(全タスクから利用可能)
|
|
5
|
+
* - __time: 現在時刻取得
|
|
6
|
+
*/
|
|
7
|
+
import { EXECUTION_TASK_DEFS } from '../task-types/execution-tasks.js';
|
|
8
|
+
export const BUILTIN_TOOL_PREFIX = '__';
|
|
9
|
+
/**
|
|
10
|
+
* 組み込みツールかどうかを判定
|
|
11
|
+
*/
|
|
12
|
+
export function isBuiltinTool(name) {
|
|
13
|
+
return name.startsWith(BUILTIN_TOOL_PREFIX);
|
|
14
|
+
}
|
|
15
|
+
const TASK_ENTRY_SCHEMA = {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
instruction: { type: 'string', description: 'Specific instruction for the task executor.' },
|
|
19
|
+
taskType: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
enum: [...Object.keys(EXECUTION_TASK_DEFS), 'output'],
|
|
22
|
+
description: Object.entries(EXECUTION_TASK_DEFS)
|
|
23
|
+
.map(([name, def]) => `${name}: ${def.toolDescription}`)
|
|
24
|
+
.concat(['output: generate final output (must be the last task)'])
|
|
25
|
+
.join('. ') + '. Default: think',
|
|
26
|
+
},
|
|
27
|
+
driverRole: {
|
|
28
|
+
type: 'string',
|
|
29
|
+
enum: ['default', 'thinking', 'instruct', 'chat', 'plan'],
|
|
30
|
+
description: 'Driver role override. Defaults per task type.',
|
|
31
|
+
},
|
|
32
|
+
withInputs: {
|
|
33
|
+
type: 'boolean',
|
|
34
|
+
description: 'Include ctx.inputs in data. Defaults per task type.',
|
|
35
|
+
},
|
|
36
|
+
withMessages: {
|
|
37
|
+
type: 'boolean',
|
|
38
|
+
description: 'Include ctx.messages in data. Defaults per task type.',
|
|
39
|
+
},
|
|
40
|
+
withMaterials: {
|
|
41
|
+
type: 'boolean',
|
|
42
|
+
description: 'Include ctx.materials in data. Defaults per task type.',
|
|
43
|
+
},
|
|
44
|
+
insertAt: {
|
|
45
|
+
type: 'number',
|
|
46
|
+
description: 'Position in the task list to insert at. If omitted, the task is scheduled as the next task. Values before the current task are ignored.',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
required: ['instruction', 'taskType'],
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* TaskEntry からタスクを登録し、結果メッセージを返す
|
|
53
|
+
* @param currentIndex 現在実行中のタスクのインデックス。insertAt がこれ以下の場合はクランプされる。
|
|
54
|
+
*/
|
|
55
|
+
function registerTask(taskList, entry, currentIndex) {
|
|
56
|
+
const taskType = entry.taskType || 'think';
|
|
57
|
+
const task = {
|
|
58
|
+
instruction: entry.instruction,
|
|
59
|
+
taskType,
|
|
60
|
+
driverRole: entry.driverRole,
|
|
61
|
+
withInputs: entry.withInputs,
|
|
62
|
+
withMessages: entry.withMessages,
|
|
63
|
+
withMaterials: entry.withMaterials,
|
|
64
|
+
};
|
|
65
|
+
const minInsertAt = currentIndex + 1;
|
|
66
|
+
const requestedAt = typeof entry.insertAt === 'number' ? entry.insertAt : minInsertAt;
|
|
67
|
+
const insertAt = Math.max(requestedAt, minInsertAt);
|
|
68
|
+
taskList.splice(insertAt, 0, task);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Planning フェーズ用の組み込みツールを生成
|
|
72
|
+
*
|
|
73
|
+
* __insert_tasks ツールは tasks 配列で複数タスクを一括登録する。
|
|
74
|
+
* 単体の instruction 指定も後方互換として受け付ける。
|
|
75
|
+
*/
|
|
76
|
+
export function createPlanningTools(taskList, currentIndex) {
|
|
77
|
+
return [{
|
|
78
|
+
definition: {
|
|
79
|
+
name: '__insert_tasks',
|
|
80
|
+
description: 'Register tasks in the workflow. Each task is executed by a separate AI instance. Write specific, self-contained instructions. Refer to the current task list in Workflow Status to understand the existing plan before inserting.',
|
|
81
|
+
parameters: {
|
|
82
|
+
type: 'object',
|
|
83
|
+
properties: {
|
|
84
|
+
tasks: {
|
|
85
|
+
type: 'array',
|
|
86
|
+
description: 'Array of Task objects.',
|
|
87
|
+
items: TASK_ENTRY_SCHEMA,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
required: ['tasks'],
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
handler: async (args) => {
|
|
94
|
+
if (!Array.isArray(args.tasks) || args.tasks.length === 0) {
|
|
95
|
+
return 'Error: Provide a non-empty "tasks" array.';
|
|
96
|
+
}
|
|
97
|
+
let insertOffset = 0;
|
|
98
|
+
for (const entry of args.tasks) {
|
|
99
|
+
registerTask(taskList, entry, currentIndex + insertOffset);
|
|
100
|
+
insertOffset++;
|
|
101
|
+
}
|
|
102
|
+
// Return full updated task list so the model can see the current plan
|
|
103
|
+
return 'Updated task list:\n' + taskList
|
|
104
|
+
.map((t, i) => `${i + 1}. (${t.taskType}): ${t.instruction}`)
|
|
105
|
+
.join('\n');
|
|
106
|
+
},
|
|
107
|
+
}];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* 現在時刻を返す組み込みツール
|
|
111
|
+
*/
|
|
112
|
+
const timeTool = {
|
|
113
|
+
definition: {
|
|
114
|
+
name: '__time',
|
|
115
|
+
description: 'Get the current date and time.',
|
|
116
|
+
parameters: {
|
|
117
|
+
type: 'object',
|
|
118
|
+
properties: {},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
handler: async () => {
|
|
122
|
+
return new Date().toISOString();
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Execution フェーズ用の組み込みツールを生成
|
|
127
|
+
*/
|
|
128
|
+
export function createExecutionBuiltinTools(taskList, currentIndex) {
|
|
129
|
+
return [
|
|
130
|
+
createPlanningTools(taskList, currentIndex)[0], // __insert_tasks
|
|
131
|
+
timeTool,
|
|
132
|
+
];
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=builtin-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-tools.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/process/builtin-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC;;GAE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;gBACrD,CAAC;gBACD,IAAI,YAAY,GAAG,CAAC,CAAC;gBACrB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,KAAoB,EAAE,CAAC;oBAC9C,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,YAAY,GAAG,YAAY,CAAC,CAAC;oBAC3D,YAAY,EAAE,CAAC;gBACjB,CAAC;gBAED,sEAAsE;gBACtE,OAAO,sBAAsB,GAAG,QAAQ;qBACrC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;qBAC5D,IAAI,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC;SACF,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,QAAQ,GAAa;IACzB,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,gCAAgC;QAC7C,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;KACF;IACD,OAAO,EAAE,KAAK,IAAI,EAAE;QAClB,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACzC,QAAuB,EACvB,YAAoB;IAEpB,OAAO;QACL,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,iBAAiB;QACjE,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ToolCall } from '@modular-prompt/core';
|
|
2
|
+
import type { AgenticTaskExecutionLog } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* ToolCall(未実行の外部ツール呼び出し)を表示用文字列にフォーマット
|
|
5
|
+
*/
|
|
6
|
+
export declare function formatToolCall(tc: ToolCall): string;
|
|
7
|
+
/**
|
|
8
|
+
* 実行ログの内容を文字列パーツとして生成
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatLogContentParts(log: AgenticTaskExecutionLog): string[];
|
|
11
|
+
//# sourceMappingURL=format-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-helpers.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/process/format-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,CAEnD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,uBAAuB,GAAG,MAAM,EAAE,CAU5E"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolCall(未実行の外部ツール呼び出し)を表示用文字列にフォーマット
|
|
3
|
+
*/
|
|
4
|
+
export function formatToolCall(tc) {
|
|
5
|
+
return `- ${tc.name}(${JSON.stringify(tc.arguments)})`;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 実行ログの内容を文字列パーツとして生成
|
|
9
|
+
*/
|
|
10
|
+
export function formatLogContentParts(log) {
|
|
11
|
+
const parts = [];
|
|
12
|
+
parts.push(`[Result]\n${log.result}`);
|
|
13
|
+
if (log.pendingToolCalls && log.pendingToolCalls.length > 0) {
|
|
14
|
+
parts.push(`[Pending Tool Calls]\n${log.pendingToolCalls.map(formatToolCall).join('\n')}`);
|
|
15
|
+
}
|
|
16
|
+
return parts;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=format-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-helpers.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/process/format-helpers.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,EAAY;IACzC,OAAO,KAAK,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC;AACzD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAA4B;IAChE,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,aAAa,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAEtC,IAAI,GAAG,CAAC,gBAAgB,IAAI,GAAG,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5D,KAAK,CAAC,IAAI,CAAC,yBAAyB,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC7F,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process layer - tool calling and utilities
|
|
3
|
+
*/
|
|
4
|
+
export { queryWithTools, rethrowAsWorkflowError, type QueryWithToolsOptions, type QueryWithToolsResult } from './query-with-tools.js';
|
|
5
|
+
export { createPlanningTools, createExecutionBuiltinTools, isBuiltinTool, BUILTIN_TOOL_PREFIX } from './builtin-tools.js';
|
|
6
|
+
export { formatToolCall, formatLogContentParts } from './format-helpers.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/process/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,aAAa,EACb,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,cAAc,EACd,qBAAqB,EACtB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process layer - tool calling and utilities
|
|
3
|
+
*/
|
|
4
|
+
export { queryWithTools, rethrowAsWorkflowError } from './query-with-tools.js';
|
|
5
|
+
export { createPlanningTools, createExecutionBuiltinTools, isBuiltinTool, BUILTIN_TOOL_PREFIX } from './builtin-tools.js';
|
|
6
|
+
export { formatToolCall, formatLogContentParts } from './format-helpers.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/process/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,cAAc,EACd,sBAAsB,EAGvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,aAAa,EACb,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,cAAc,EACd,qBAAqB,EACtB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool calling loop implementation
|
|
3
|
+
*/
|
|
4
|
+
import type { ToolCall, ResolvedModule } from '@modular-prompt/core';
|
|
5
|
+
import type { ToolChoice, FinishReason, ToolDefinition } from '@modular-prompt/driver';
|
|
6
|
+
import { Logger } from '@modular-prompt/utils';
|
|
7
|
+
import type { AIDriver } from '../../types.js';
|
|
8
|
+
import type { QueryResult } from '@modular-prompt/driver';
|
|
9
|
+
import type { ToolSpec, ToolCallLog, AgenticWorkflowContext } from '../types.js';
|
|
10
|
+
export interface QueryWithToolsOptions {
|
|
11
|
+
/** External tool definitions (passed to driver, NOT executed internally) */
|
|
12
|
+
externalToolDefs?: ToolDefinition[];
|
|
13
|
+
toolChoice?: ToolChoice;
|
|
14
|
+
maxIterations?: number;
|
|
15
|
+
/** Stop after first builtin tool execution without sending result back to model */
|
|
16
|
+
stopAfterToolCall?: boolean;
|
|
17
|
+
logPrefix?: string;
|
|
18
|
+
logger?: Logger;
|
|
19
|
+
}
|
|
20
|
+
export interface QueryWithToolsResult {
|
|
21
|
+
content: string;
|
|
22
|
+
toolCallLog: ToolCallLog[];
|
|
23
|
+
/** External tool calls that the LLM requested (not executed) */
|
|
24
|
+
pendingToolCalls?: ToolCall[];
|
|
25
|
+
usage?: QueryResult['usage'];
|
|
26
|
+
finishReason?: FinishReason;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Run a query with tool calling loop.
|
|
30
|
+
*
|
|
31
|
+
* Only builtin tools (__ prefix) are executed internally.
|
|
32
|
+
* External tool calls cause the loop to stop immediately and
|
|
33
|
+
* return the pending calls for the caller to handle.
|
|
34
|
+
*/
|
|
35
|
+
export declare function queryWithTools(driver: AIDriver, resolved: ResolvedModule, builtinTools: ToolSpec[], options?: QueryWithToolsOptions): Promise<QueryWithToolsResult>;
|
|
36
|
+
export declare function rethrowAsWorkflowError(error: unknown, context: AgenticWorkflowContext, details: Record<string, unknown>): never;
|
|
37
|
+
//# sourceMappingURL=query-with-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-with-tools.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/process/query-with-tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAoD,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEvH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAwCjF,MAAM,WAAW,qBAAqB;IACpC,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,cAAc,EAAE,CAAC;IACpC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mFAAmF;IACnF,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,WAAW,EAAE,CAAC;IAC3B,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC9B,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC7B,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,QAAQ,EAChB,QAAQ,EAAE,cAAc,EACxB,YAAY,EAAE,QAAQ,EAAE,EACxB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,oBAAoB,CAAC,CAmF/B;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,KAAK,CAGP"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool calling loop implementation
|
|
3
|
+
*/
|
|
4
|
+
import { distribute } from '@modular-prompt/core';
|
|
5
|
+
import { Logger } from '@modular-prompt/utils';
|
|
6
|
+
import { WorkflowExecutionError } from '../../types.js';
|
|
7
|
+
import { isBuiltinTool } from './builtin-tools.js';
|
|
8
|
+
const logger = new Logger({ prefix: 'process', context: 'agentic' });
|
|
9
|
+
/**
|
|
10
|
+
* Execute builtin tool calls and return ToolResultMessageElements
|
|
11
|
+
*/
|
|
12
|
+
async function executeBuiltinToolCalls(toolCalls, builtinTools, logger) {
|
|
13
|
+
const results = [];
|
|
14
|
+
for (const tc of toolCalls) {
|
|
15
|
+
const spec = builtinTools.find(s => s.definition.name === tc.name);
|
|
16
|
+
if (!spec) {
|
|
17
|
+
results.push({
|
|
18
|
+
type: 'message', role: 'tool', toolCallId: tc.id, name: tc.name,
|
|
19
|
+
kind: 'error', value: `Unknown builtin tool: ${tc.name}`
|
|
20
|
+
});
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const result = await spec.handler(tc.arguments);
|
|
25
|
+
logger.debug('[tool:result]', tc.name, result);
|
|
26
|
+
results.push({
|
|
27
|
+
type: 'message', role: 'tool', toolCallId: tc.id, name: tc.name,
|
|
28
|
+
kind: typeof result === 'string' ? 'text' : 'data', value: result
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
results.push({
|
|
33
|
+
type: 'message', role: 'tool', toolCallId: tc.id, name: tc.name,
|
|
34
|
+
kind: 'error', value: error instanceof Error ? error.message : String(error)
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return results;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Run a query with tool calling loop.
|
|
42
|
+
*
|
|
43
|
+
* Only builtin tools (__ prefix) are executed internally.
|
|
44
|
+
* External tool calls cause the loop to stop immediately and
|
|
45
|
+
* return the pending calls for the caller to handle.
|
|
46
|
+
*/
|
|
47
|
+
export async function queryWithTools(driver, resolved, builtinTools, options = {}) {
|
|
48
|
+
const { externalToolDefs = [], maxIterations = 10, logger: qLogger = logger } = options;
|
|
49
|
+
const allToolDefs = [
|
|
50
|
+
...builtinTools.map(t => t.definition),
|
|
51
|
+
...externalToolDefs,
|
|
52
|
+
];
|
|
53
|
+
const conversation = [];
|
|
54
|
+
const toolCallLog = [];
|
|
55
|
+
let content = '';
|
|
56
|
+
let lastResult = {};
|
|
57
|
+
for (let i = 0; i <= maxIterations; i++) {
|
|
58
|
+
// Distribute resolved module to CompiledPrompt, appending conversation history
|
|
59
|
+
const prompt = distribute(conversation.length > 0
|
|
60
|
+
? { ...resolved, messages: [...(resolved.messages || []), ...conversation] }
|
|
61
|
+
: resolved);
|
|
62
|
+
const queryResult = await driver.query(prompt, {
|
|
63
|
+
tools: allToolDefs.length > 0 ? allToolDefs : undefined,
|
|
64
|
+
toolChoice: i === 0 ? (options.toolChoice ?? 'auto') : 'auto',
|
|
65
|
+
});
|
|
66
|
+
qLogger.verbose('[output]', queryResult.content);
|
|
67
|
+
if (queryResult.content) {
|
|
68
|
+
content = queryResult.content;
|
|
69
|
+
}
|
|
70
|
+
lastResult = { usage: queryResult.usage, finishReason: queryResult.finishReason };
|
|
71
|
+
if (!queryResult.toolCalls || queryResult.toolCalls.length === 0 || i === maxIterations) {
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
// Partition tool calls into builtin and external
|
|
75
|
+
const builtinCalls = queryResult.toolCalls.filter(tc => isBuiltinTool(tc.name));
|
|
76
|
+
const externalCalls = queryResult.toolCalls.filter(tc => !isBuiltinTool(tc.name));
|
|
77
|
+
// Log tool calls
|
|
78
|
+
for (const tc of queryResult.toolCalls) {
|
|
79
|
+
qLogger.debug('[tool:call]', tc.name, JSON.stringify(tc.arguments));
|
|
80
|
+
}
|
|
81
|
+
// Execute builtin tools
|
|
82
|
+
if (builtinCalls.length > 0) {
|
|
83
|
+
const toolResults = await executeBuiltinToolCalls(builtinCalls, builtinTools, qLogger);
|
|
84
|
+
for (let j = 0; j < builtinCalls.length; j++) {
|
|
85
|
+
toolCallLog.push({
|
|
86
|
+
name: builtinCalls[j].name,
|
|
87
|
+
arguments: builtinCalls[j].arguments,
|
|
88
|
+
result: toolResults[j].value,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
conversation.push({
|
|
92
|
+
type: 'message', role: 'assistant',
|
|
93
|
+
content: queryResult.content || '',
|
|
94
|
+
toolCalls: builtinCalls,
|
|
95
|
+
}, ...toolResults);
|
|
96
|
+
// Stop after first tool call if requested (e.g. planning)
|
|
97
|
+
if (options.stopAfterToolCall) {
|
|
98
|
+
return { content, toolCallLog, usage: lastResult.usage, finishReason: lastResult.finishReason };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// External tool calls → stop immediately and return them
|
|
102
|
+
if (externalCalls.length > 0) {
|
|
103
|
+
return {
|
|
104
|
+
content, toolCallLog,
|
|
105
|
+
pendingToolCalls: externalCalls,
|
|
106
|
+
usage: lastResult.usage, finishReason: lastResult.finishReason
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
// conversation is accumulated; next iteration will distribute with updated messages
|
|
110
|
+
}
|
|
111
|
+
return { content, toolCallLog, usage: lastResult.usage, finishReason: lastResult.finishReason };
|
|
112
|
+
}
|
|
113
|
+
export function rethrowAsWorkflowError(error, context, details) {
|
|
114
|
+
if (error instanceof WorkflowExecutionError)
|
|
115
|
+
throw error;
|
|
116
|
+
throw new WorkflowExecutionError(error, context, details);
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=query-with-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-with-tools.js","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/process/query-with-tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAIxD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,MAAM,GAAG,IAAI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MAAM,UAAU,sBAAsB,CACpC,KAAc,EACd,OAA+B,EAC/B,OAAgC;IAEhC,IAAI,KAAK,YAAY,sBAAsB;QAAE,MAAM,KAAK,CAAC;IACzD,MAAM,IAAI,sBAAsB,CAAC,KAAc,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution task type factory
|
|
3
|
+
*
|
|
4
|
+
* planning と output 以外のタスクタイプは共通構造を持つ。
|
|
5
|
+
* 差分(instruction テキスト、デフォルトオプション)を設定で定義し、
|
|
6
|
+
* ファクトリで PromptModule + TaskTypeConfig を生成する。
|
|
7
|
+
*
|
|
8
|
+
* 新しいタスクタイプの追加:
|
|
9
|
+
* 1. EXECUTION_TASK_DEFS に定義を追加
|
|
10
|
+
* 2. types.ts の TaskType union に追加
|
|
11
|
+
* → レジストリ登録・ツール定義は自動的に反映される
|
|
12
|
+
*/
|
|
13
|
+
import type { ModelRole } from '../../driver-input.js';
|
|
14
|
+
import type { TaskTypeConfig } from './index.js';
|
|
15
|
+
interface ExecutionTaskDef {
|
|
16
|
+
/** Task-specific objective line (falls back to generic if omitted) */
|
|
17
|
+
objective?: string;
|
|
18
|
+
/** Instruction lines shown before the Focus subsection */
|
|
19
|
+
instructions: string[];
|
|
20
|
+
/** Default driver role */
|
|
21
|
+
driverRole: ModelRole;
|
|
22
|
+
/** Default data options */
|
|
23
|
+
defaults: {
|
|
24
|
+
withInputs: boolean;
|
|
25
|
+
withMessages: boolean;
|
|
26
|
+
withMaterials: boolean;
|
|
27
|
+
};
|
|
28
|
+
/** Description for __insert_tasks tool enum */
|
|
29
|
+
toolDescription: string;
|
|
30
|
+
}
|
|
31
|
+
export declare const EXECUTION_TASK_DEFS: Record<string, ExecutionTaskDef>;
|
|
32
|
+
/** All execution task configs, keyed by task type name */
|
|
33
|
+
export declare const executionTaskConfigs: Record<string, TaskTypeConfig>;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=execution-tasks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-tasks.d.ts","sourceRoot":"","sources":["../../../../src/workflows/agentic-workflow/task-types/execution-tasks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAOjD,UAAU,gBAAgB;IACxB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,0BAA0B;IAC1B,UAAU,EAAE,SAAS,CAAC;IACtB,2BAA2B;IAC3B,QAAQ,EAAE;QAAE,UAAU,EAAE,OAAO,CAAC;QAAC,YAAY,EAAE,OAAO,CAAC;QAAC,aAAa,EAAE,OAAO,CAAA;KAAE,CAAC;IACjF,+CAA+C;IAC/C,eAAe,EAAE,MAAM,CAAC;CACzB;AAMD,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAqEhE,CAAC;AAyEF,0DAA0D;AAC1D,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAE/D,CAAC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution task type factory
|
|
3
|
+
*
|
|
4
|
+
* planning と output 以外のタスクタイプは共通構造を持つ。
|
|
5
|
+
* 差分(instruction テキスト、デフォルトオプション)を設定で定義し、
|
|
6
|
+
* ファクトリで PromptModule + TaskTypeConfig を生成する。
|
|
7
|
+
*
|
|
8
|
+
* 新しいタスクタイプの追加:
|
|
9
|
+
* 1. EXECUTION_TASK_DEFS に定義を追加
|
|
10
|
+
* 2. types.ts の TaskType union に追加
|
|
11
|
+
* → レジストリ登録・ツール定義は自動的に反映される
|
|
12
|
+
*/
|
|
13
|
+
import { buildPreviousResultsMaterials } from './index.js';
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Task definitions
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
export const EXECUTION_TASK_DEFS = {
|
|
18
|
+
think: {
|
|
19
|
+
objective: '- Perform reasoning, analysis, or processing as described in the Focus.',
|
|
20
|
+
instructions: [
|
|
21
|
+
'- You will perform reasoning, analysis, or processing as instructed.',
|
|
22
|
+
'- You may call external tools if needed to gather information or perform actions.',
|
|
23
|
+
'- If additional tasks are needed to complete the objective, use `__insert_tasks` to register them.',
|
|
24
|
+
],
|
|
25
|
+
driverRole: 'thinking',
|
|
26
|
+
defaults: { withInputs: false, withMessages: false, withMaterials: false },
|
|
27
|
+
toolDescription: 'general reasoning/analysis',
|
|
28
|
+
},
|
|
29
|
+
toolCall: {
|
|
30
|
+
objective: '- Call external tools as described in the Focus and report the results.',
|
|
31
|
+
instructions: [
|
|
32
|
+
'- You will call external tools as instructed to gather information or perform actions.',
|
|
33
|
+
'- Report the tool results clearly for subsequent Tasks.',
|
|
34
|
+
],
|
|
35
|
+
driverRole: 'instruct',
|
|
36
|
+
defaults: { withInputs: false, withMessages: false, withMaterials: false },
|
|
37
|
+
toolDescription: 'call external tools',
|
|
38
|
+
},
|
|
39
|
+
verify: {
|
|
40
|
+
objective: '- Verify or validate results from previous Tasks as described in the Focus.',
|
|
41
|
+
instructions: [
|
|
42
|
+
'- You will verify or validate results from previous Tasks as instructed.',
|
|
43
|
+
'- Report any issues, inconsistencies, or confirmations clearly.',
|
|
44
|
+
'- If verification fails or results are insufficient, use `__insert_tasks` to register corrective tasks as needed.',
|
|
45
|
+
],
|
|
46
|
+
driverRole: 'thinking',
|
|
47
|
+
defaults: { withInputs: false, withMessages: false, withMaterials: false },
|
|
48
|
+
toolDescription: 'validate previous results',
|
|
49
|
+
},
|
|
50
|
+
extractContext: {
|
|
51
|
+
objective: '- Extract relevant information from the provided data according to the Focus.',
|
|
52
|
+
instructions: [
|
|
53
|
+
'- Extract information from the provided inputs, messages, and materials as specified in the Focus.',
|
|
54
|
+
'- Be exhaustive — do not omit any relevant information.',
|
|
55
|
+
'- Combine direct quoting and summarization: quote key phrases or data verbatim, and summarize surrounding context.',
|
|
56
|
+
'- This is an extraction task: gather and organize what is present in the data. Do not interpret, infer, or add your own reasoning.',
|
|
57
|
+
'- Structure the extracted information clearly so that subsequent Tasks can use it directly.',
|
|
58
|
+
],
|
|
59
|
+
driverRole: 'thinking',
|
|
60
|
+
defaults: { withInputs: true, withMessages: true, withMaterials: true },
|
|
61
|
+
toolDescription: 'extract from inputs/materials',
|
|
62
|
+
},
|
|
63
|
+
recall: {
|
|
64
|
+
objective: '- Retrieve information relevant to the Focus using search tools or training knowledge.',
|
|
65
|
+
instructions: [
|
|
66
|
+
'- You will retrieve information relevant to the Focus.',
|
|
67
|
+
'- If search tools are available, formulate appropriate search queries and use them.',
|
|
68
|
+
'- If the information is already known from your training data and no search is needed, return it directly.',
|
|
69
|
+
'- Do not fabricate information. If uncertain, state what you know and what is unverified.',
|
|
70
|
+
],
|
|
71
|
+
driverRole: 'instruct',
|
|
72
|
+
defaults: { withInputs: false, withMessages: false, withMaterials: false },
|
|
73
|
+
toolDescription: 'retrieve information via search tools or training knowledge',
|
|
74
|
+
},
|
|
75
|
+
determine: {
|
|
76
|
+
objective: '- Make a decision or judgment based on the available information as described in the Focus.',
|
|
77
|
+
instructions: [
|
|
78
|
+
'- You will make a decision or judgment based on the available information.',
|
|
79
|
+
'- You MUST reach a definitive conclusion. Do not defer, leave open, or suggest further investigation.',
|
|
80
|
+
'- State your conclusion clearly with supporting reasoning.',
|
|
81
|
+
],
|
|
82
|
+
driverRole: 'thinking',
|
|
83
|
+
defaults: { withInputs: true, withMessages: true, withMaterials: true },
|
|
84
|
+
toolDescription: 'make a decision or judgment',
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
// ---------------------------------------------------------------------------
|
|
88
|
+
// Factory
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
function buildModule(def) {
|
|
91
|
+
const module = {
|
|
92
|
+
objective: [
|
|
93
|
+
'',
|
|
94
|
+
def.objective ?? '- You will execute the Task described in "Focus" below.',
|
|
95
|
+
],
|
|
96
|
+
instructions: [
|
|
97
|
+
...def.instructions,
|
|
98
|
+
{
|
|
99
|
+
type: 'subsection',
|
|
100
|
+
title: 'Focus',
|
|
101
|
+
items: [
|
|
102
|
+
(ctx) => {
|
|
103
|
+
const task = ctx.taskList?.[ctx.currentTaskIndex ?? 0];
|
|
104
|
+
return task?.instruction ?? '';
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
materials: [
|
|
110
|
+
(ctx) => {
|
|
111
|
+
if (!ctx.executionLog?.length)
|
|
112
|
+
return null;
|
|
113
|
+
return buildPreviousResultsMaterials(ctx.executionLog);
|
|
114
|
+
},
|
|
115
|
+
(ctx) => {
|
|
116
|
+
const task = ctx.taskList?.[ctx.currentTaskIndex ?? 0];
|
|
117
|
+
const withMaterials = task?.withMaterials ?? def.defaults.withMaterials;
|
|
118
|
+
if (!withMaterials || !ctx.userModule?.materials?.length)
|
|
119
|
+
return null;
|
|
120
|
+
return ctx.userModule.materials;
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
inputs: [
|
|
124
|
+
(ctx) => {
|
|
125
|
+
const task = ctx.taskList?.[ctx.currentTaskIndex ?? 0];
|
|
126
|
+
const withInputs = task?.withInputs ?? def.defaults.withInputs;
|
|
127
|
+
if (!withInputs || !ctx.inputs)
|
|
128
|
+
return null;
|
|
129
|
+
return JSON.stringify(ctx.inputs, null, 2);
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
messages: [
|
|
133
|
+
(ctx) => {
|
|
134
|
+
const task = ctx.taskList?.[ctx.currentTaskIndex ?? 0];
|
|
135
|
+
const withMessages = task?.withMessages ?? def.defaults.withMessages;
|
|
136
|
+
if (!withMessages || !ctx.userModule?.messages?.length)
|
|
137
|
+
return null;
|
|
138
|
+
return ctx.userModule.messages;
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
};
|
|
142
|
+
return module;
|
|
143
|
+
}
|
|
144
|
+
function buildConfig(def) {
|
|
145
|
+
return {
|
|
146
|
+
module: buildModule(def),
|
|
147
|
+
builtinToolNames: ['__insert_tasks', '__time'],
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
// ---------------------------------------------------------------------------
|
|
151
|
+
// Exports
|
|
152
|
+
// ---------------------------------------------------------------------------
|
|
153
|
+
/** All execution task configs, keyed by task type name */
|
|
154
|
+
export const executionTaskConfigs = Object.fromEntries(Object.entries(EXECUTION_TASK_DEFS).map(([name, def]) => [name, buildConfig(def)]));
|
|
155
|
+
//# sourceMappingURL=execution-tasks.js.map
|
|
@@ -0,0 +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,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAmB3D,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,mBAAmB,GAAqC;IACnE,KAAK,EAAE;QACL,SAAS,EAAE,yEAAyE;QACpF,YAAY,EAAE;YACZ,sEAAsE;YACtE,mFAAmF;YACnF,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;KAC9C;IACD,QAAQ,EAAE;QACR,SAAS,EAAE,yEAAyE;QACpF,YAAY,EAAE;YACZ,wFAAwF;YACxF,yDAAyD;SAC1D;QACD,UAAU,EAAE,UAAU;QACtB,QAAQ,EAAE,EAAE,UAAU,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**
|
|
2
|
+
* Task type registry and shared utilities
|
|
3
|
+
*/
|
|
4
|
+
import type { PromptModule, MaterialElement, SectionContent } from '@modular-prompt/core';
|
|
5
|
+
import type { AgenticWorkflowContext, TaskType, AgenticTaskExecutionLog } from '../types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Task type configuration
|
|
8
|
+
*/
|
|
9
|
+
export interface TaskTypeConfig {
|
|
10
|
+
/** Static prompt module for this task type */
|
|
11
|
+
module: PromptModule<AgenticWorkflowContext>;
|
|
12
|
+
/** List of builtin tool names available for this task type */
|
|
13
|
+
builtinToolNames: string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get task type configuration
|
|
17
|
+
*/
|
|
18
|
+
export declare function getTaskTypeConfig(taskType: TaskType): TaskTypeConfig;
|
|
19
|
+
/**
|
|
20
|
+
* Convert execution log to MaterialElement array (previous task results)
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildPreviousResultsMaterials(executionLog: AgenticTaskExecutionLog[]): MaterialElement[];
|
|
23
|
+
/**
|
|
24
|
+
* Build task list display for methodology section
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildTaskListDisplay(ctx: AgenticWorkflowContext): string;
|
|
27
|
+
/**
|
|
28
|
+
* Common module shared by all task types.
|
|
29
|
+
* Provides workflow terms, methodology, and state information.
|
|
30
|
+
*/
|
|
31
|
+
export declare const taskCommon: PromptModule<AgenticWorkflowContext>;
|
|
32
|
+
/**
|
|
33
|
+
* Extract static text content from SectionContent.
|
|
34
|
+
* Only extracts strings, ignores DynamicContent and Elements.
|
|
35
|
+
*/
|
|
36
|
+
export declare function extractTextFromSection(section: SectionContent<any> | undefined): string;
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC1F,OAAO,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAK7F;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,MAAM,EAAE,YAAY,CAAC,sBAAsB,CAAC,CAAC;IAC7C,8DAA8D;IAC9D,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAYD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,CAEpE;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,YAAY,EAAE,uBAAuB,EAAE,GACtC,eAAe,EAAE,CAOnB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,sBAAsB,GAAG,MAAM,CAwBxE;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,sBAAsB,CAgB3D,CAAC;AAEF;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,MAAM,CAUvF"}
|