@workglow/ai 0.0.116 → 0.0.117

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.
@@ -0,0 +1,181 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Steven Roussey <sroussey@gmail.com>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { DataPorts } from "@workglow/task-graph";
7
+ import type { ToolCall, ToolCalls, ToolDefinition } from "./ToolCallingTask";
8
+ /**
9
+ * A text content block within a chat message.
10
+ */
11
+ export interface TextContentBlock {
12
+ readonly type: "text";
13
+ readonly text: string;
14
+ }
15
+ /**
16
+ * An image content block within a chat message.
17
+ */
18
+ export interface ImageContentBlock {
19
+ readonly type: "image";
20
+ readonly mimeType: string;
21
+ readonly data: string;
22
+ }
23
+ /**
24
+ * An audio content block within a chat message.
25
+ */
26
+ export interface AudioContentBlock {
27
+ readonly type: "audio";
28
+ readonly mimeType: string;
29
+ readonly data: string;
30
+ }
31
+ /**
32
+ * A tool-use content block within an assistant message.
33
+ * Represents the LLM requesting a tool invocation.
34
+ */
35
+ export interface ToolUseContentBlock {
36
+ readonly type: "tool_use";
37
+ readonly id: string;
38
+ readonly name: string;
39
+ readonly input: Record<string, unknown>;
40
+ }
41
+ /**
42
+ * A tool-result content block within a tool message.
43
+ * Represents the result of executing a tool call.
44
+ */
45
+ export interface ToolResultContentBlock {
46
+ readonly type: "tool_result";
47
+ readonly tool_use_id: string;
48
+ readonly content: string | ReadonlyArray<ToolResultInnerBlock>;
49
+ readonly is_error?: boolean;
50
+ }
51
+ /** Content blocks allowed in user messages */
52
+ export type UserContentBlock = TextContentBlock | ImageContentBlock | AudioContentBlock;
53
+ /** Content blocks allowed inside tool result content */
54
+ export type ToolResultInnerBlock = TextContentBlock | ImageContentBlock | AudioContentBlock;
55
+ export type ContentBlock = TextContentBlock | ImageContentBlock | AudioContentBlock | ToolUseContentBlock | ToolResultContentBlock;
56
+ /**
57
+ * Provider-agnostic chat message for multi-turn conversations.
58
+ * Uses a discriminated union on `role` to enforce correct content types.
59
+ */
60
+ export type ChatMessage = {
61
+ readonly role: "user";
62
+ readonly content: string | ReadonlyArray<UserContentBlock>;
63
+ } | {
64
+ readonly role: "assistant";
65
+ readonly content: ReadonlyArray<TextContentBlock | ToolUseContentBlock>;
66
+ } | {
67
+ readonly role: "tool";
68
+ readonly content: ReadonlyArray<ToolResultContentBlock>;
69
+ };
70
+ /**
71
+ * A tool backed by a Task in the TaskRegistry. Instantiated and run via
72
+ * `TaskRegistry.all.get(taskType)`. Optional `config` is passed to the
73
+ * task constructor for configurable tasks (e.g. `McpToolCallTask`,
74
+ * `JavaScriptTask`).
75
+ */
76
+ export interface RegistryToolSource {
77
+ readonly type: "registry";
78
+ readonly definition: ToolDefinition;
79
+ readonly taskType: string;
80
+ /** Configuration values passed to the task constructor. */
81
+ readonly config?: DataPorts;
82
+ }
83
+ /**
84
+ * A user-provided tool with a custom executor function.
85
+ */
86
+ export interface FunctionToolSource {
87
+ readonly type: "function";
88
+ readonly definition: ToolDefinition;
89
+ readonly run: (input: DataPorts) => Promise<DataPorts>;
90
+ }
91
+ export type ToolSource = RegistryToolSource | FunctionToolSource;
92
+ export interface ToolResult {
93
+ readonly toolCallId: string;
94
+ readonly toolName: string;
95
+ readonly output: DataPorts;
96
+ readonly isError: boolean;
97
+ /** Optional media content blocks to include alongside the JSON output. */
98
+ readonly mediaContent?: ReadonlyArray<ToolResultInnerBlock>;
99
+ }
100
+ /**
101
+ * Decision returned by the beforeToolCall hook.
102
+ * - `"allow"`: proceed with the tool call as-is
103
+ * - `"deny"`: skip the tool call and return an error to the LLM
104
+ * - `"modify"`: proceed with modified input
105
+ */
106
+ export type ToolCallDecision = {
107
+ readonly action: "allow";
108
+ } | {
109
+ readonly action: "deny";
110
+ readonly reason?: string;
111
+ } | {
112
+ readonly action: "modify";
113
+ readonly input: Record<string, unknown>;
114
+ };
115
+ /**
116
+ * Action returned by the onToolError hook.
117
+ * - `"throw"`: report the error to the LLM (default when no hook)
118
+ * - `"result"`: use a fallback result instead of reporting the error
119
+ */
120
+ export type ToolErrorAction = {
121
+ readonly action: "throw";
122
+ } | {
123
+ readonly action: "result";
124
+ readonly output: Record<string, unknown>;
125
+ };
126
+ /**
127
+ * Action returned by the onIteration hook.
128
+ * - `"continue"`: proceed with the next LLM call
129
+ * - `"stop"`: end the agent loop and return current results
130
+ */
131
+ export type IterationAction = {
132
+ readonly action: "continue";
133
+ } | {
134
+ readonly action: "stop";
135
+ };
136
+ /**
137
+ * Lifecycle hooks for the AgentTask loop.
138
+ * All hooks are optional; the agent runs without intervention by default.
139
+ */
140
+ export interface AgentHooks {
141
+ /** Called before each tool call. Can approve, deny, or modify the call. */
142
+ readonly beforeToolCall?: (call: ToolCall, source: ToolSource) => Promise<ToolCallDecision>;
143
+ /** Called after each successful tool call. Can transform the result. */
144
+ readonly afterToolCall?: (call: ToolCall, result: ToolResult) => Promise<ToolResult>;
145
+ /** Called when a tool call throws. Can provide a fallback result or re-throw. */
146
+ readonly onToolError?: (call: ToolCall, error: Error) => Promise<ToolErrorAction>;
147
+ /**
148
+ * Called at the start of each iteration, before calling the LLM.
149
+ * Can stop the loop or inspect state (e.g. for context trimming).
150
+ */
151
+ readonly onIteration?: (iteration: number, messages: ReadonlyArray<ChatMessage>, stats: {
152
+ readonly totalToolCalls: number;
153
+ }) => Promise<IterationAction>;
154
+ }
155
+ export declare function imageBlock(mimeType: string, data: string): ImageContentBlock;
156
+ export declare function audioBlock(mimeType: string, data: string): AudioContentBlock;
157
+ export declare function imageBlockFromDataUri(dataUri: string): ImageContentBlock;
158
+ export declare function audioBlockFromDataUri(dataUri: string): AudioContentBlock;
159
+ /**
160
+ * Creates a user message from a prompt string or array of content blocks.
161
+ */
162
+ export declare function userMessage(prompt: string | ReadonlyArray<UserContentBlock>): ChatMessage;
163
+ /**
164
+ * Creates an assistant message from text and optional tool calls.
165
+ */
166
+ export declare function assistantMessage(text: string, toolCalls?: ToolCalls): ChatMessage;
167
+ /**
168
+ * Creates a tool message from an array of tool results.
169
+ * When a result has `mediaContent`, emits content as an array of blocks
170
+ * instead of a plain JSON string.
171
+ */
172
+ export declare function toolMessage(results: ReadonlyArray<ToolResult>): ChatMessage;
173
+ /**
174
+ * Extracts all ToolDefinitions from an array of ToolSources.
175
+ */
176
+ export declare function toolSourceDefinitions(sources: ReadonlyArray<ToolSource>): ToolDefinition[];
177
+ /**
178
+ * Finds the ToolSource matching a tool call name.
179
+ */
180
+ export declare function findToolSource(sources: ReadonlyArray<ToolSource>, name: string): ToolSource | undefined;
181
+ //# sourceMappingURL=AgentTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentTypes.d.ts","sourceRoot":"","sources":["../../src/task/AgentTypes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAM7E;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC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AAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,gBAAgB,CAAC,GAAG,WAAW,CAEzF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,WAAW,CAgBjF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,WAAW,CAiB3E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,cAAc,EAAE,CAE1F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,EAClC,IAAI,EAAE,MAAM,GACX,UAAU,GAAG,SAAS,CAExB"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { IExecuteContext } from "@workglow/task-graph";
7
+ import type { ServiceRegistry } from "@workglow/util";
8
+ import type { AgentHooks, ToolResult, ToolSource } from "./AgentTypes";
9
+ import type { ToolCall, ToolCalls, ToolDefinition } from "./ToolCallingTask";
10
+ /**
11
+ * Builds an array of {@link ToolSource} entries from a unified tools list.
12
+ *
13
+ * Each entry is either:
14
+ * - A **string** — resolved from the TaskRegistry via {@link taskTypesToTools}.
15
+ * - A **{@link ToolDefinition}** object — dispatched based on its shape:
16
+ * - Has `execute` function → {@link FunctionToolSource}
17
+ * - Has a backing task in the task constructors (looked up by `name`) →
18
+ * {@link RegistryToolSource} with optional `config` passed through
19
+ * - Otherwise → {@link FunctionToolSource} that throws on invocation
20
+ *
21
+ * This mirrors the model resolution pattern: strings are convenient
22
+ * shorthand, objects give full control (including `config` for
23
+ * configurable tasks like `McpToolCallTask` or `JavaScriptTask`).
24
+ *
25
+ * The original order of entries in `tools` is preserved in the returned
26
+ * sources array. An optional `registry` can be provided to use a
27
+ * DI-scoped constructor map instead of the global TaskRegistry.
28
+ */
29
+ export declare function buildToolSources(tools?: ReadonlyArray<string | ToolDefinition>, registry?: ServiceRegistry): ToolSource[];
30
+ /**
31
+ * Executes a single tool call by dispatching to the appropriate handler
32
+ * based on the tool source type. Applies beforeToolCall, afterToolCall,
33
+ * and onToolError hooks when provided.
34
+ */
35
+ export declare function executeToolCall(toolCall: ToolCall, sources: ReadonlyArray<ToolSource>, context: IExecuteContext, hooks?: AgentHooks): Promise<ToolResult>;
36
+ /**
37
+ * Executes multiple tool calls with concurrency control.
38
+ *
39
+ * Uses the same shared-cursor worker pool pattern as IteratorTaskRunner:
40
+ * spawns N workers that pull from a shared cursor until all items are
41
+ * processed. Results are returned in the original order.
42
+ *
43
+ * @param maxConcurrency - Max parallel tool executions (default: 5)
44
+ */
45
+ export declare function executeToolCalls(toolCalls: ToolCalls, sources: ReadonlyArray<ToolSource>, context: IExecuteContext, hooks?: AgentHooks, maxConcurrency?: number): Promise<ToolResult[]>;
46
+ /**
47
+ * Checks whether a ToolCallingTask output contains any tool calls.
48
+ */
49
+ export declare function hasToolCalls(toolCalls: unknown[] | undefined): boolean;
50
+ //# sourceMappingURL=AgentUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentUtils.d.ts","sourceRoot":"","sources":["../../src/task/AgentUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,KAAK,EACV,UAAU,EAGV,UAAU,EACV,UAAU,EACX,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAM3B;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,cAAc,CAAC,EAC9C,QAAQ,CAAC,EAAE,eAAe,GACzB,UAAU,EAAE,CA+Dd;AAMD;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,EAClC,OAAO,EAAE,eAAe,EACxB,KAAK,CAAC,EAAE,UAAU,GACjB,OAAO,CAAC,UAAU,CAAC,CAsFrB;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,EAClC,OAAO,EAAE,eAAe,EACxB,KAAK,CAAC,EAAE,UAAU,EAClB,cAAc,GAAE,MAAU,GACzB,OAAO,CAAC,UAAU,EAAE,CAAC,CA4BvB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,SAAS,GAAG,OAAO,CAEtE"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Shared message conversion utilities for converting provider-agnostic
8
+ * ChatMessage arrays to provider-specific formats.
9
+ *
10
+ * These are pure functions safe for both main-thread and worker contexts.
11
+ * Providers with unique requirements (Anthropic, Gemini, LlamaCpp)
12
+ * maintain their own conversion logic.
13
+ */
14
+ import type { ToolCallingTaskInput } from "./ToolCallingTask";
15
+ export interface OpenAICompatMessage {
16
+ role: string;
17
+ content: string | null | Array<{
18
+ type: string;
19
+ [key: string]: unknown;
20
+ }>;
21
+ tool_calls?: Array<{
22
+ id: string;
23
+ type: "function";
24
+ function: {
25
+ name: string;
26
+ arguments: string;
27
+ };
28
+ }>;
29
+ tool_call_id?: string;
30
+ }
31
+ /**
32
+ * Converts ToolCallingTaskInput to OpenAI-compatible message format.
33
+ * Used by OpenAI and HuggingFace Inference providers.
34
+ *
35
+ * Multi-turn capable: preserves full tool call metadata across turns.
36
+ */
37
+ export declare function toOpenAIMessages(input: ToolCallingTaskInput): OpenAICompatMessage[];
38
+ export interface TextFlatMessage {
39
+ role: string;
40
+ content: string;
41
+ }
42
+ /**
43
+ * Converts ToolCallingTaskInput to a simplified text-only message format.
44
+ * Used by providers that don't natively support structured multi-turn
45
+ * tool calling (Ollama, HuggingFace Transformers).
46
+ *
47
+ * NOTE: This format discards tool_use blocks from assistant messages.
48
+ * The LLM will not see what tools it previously called. Multi-turn tool
49
+ * calling will have degraded quality on these providers.
50
+ */
51
+ export declare function toTextFlatMessages(input: ToolCallingTaskInput): TextFlatMessage[];
52
+ //# sourceMappingURL=MessageConversion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageConversion.d.ts","sourceRoot":"","sources":["../../src/task/MessageConversion.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAsB9D,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,CAAC;IACzE,UAAU,CAAC,EAAE,KAAK,CAAC;QACjB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,UAAU,CAAC;QACjB,QAAQ,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAE,CAAC;KAC/C,CAAC,CAAC;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,oBAAoB,GAAG,mBAAmB,EAAE,CAuInF;AAMD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,oBAAoB,GAAG,eAAe,EAAE,CAqFjF"}
@@ -9,12 +9,28 @@ import { StreamingAiTask } from "./base/StreamingAiTask";
9
9
  /**
10
10
  * A tool definition that can be passed to an LLM for tool calling.
11
11
  * Can be created manually or generated from TaskRegistry entries via {@link taskTypesToTools}.
12
+ *
13
+ * The `name` is used both as the tool name presented to the LLM and as a
14
+ * lookup key for the backing Task in the TaskRegistry. When a tool is
15
+ * backed by a configurable task (e.g. `McpToolCallTask`, `JavaScriptTask`),
16
+ * `configSchema` describes what configuration the task accepts and `config`
17
+ * provides the concrete values. The LLM never sees `configSchema` or
18
+ * `config` — they are setup-time concerns used when instantiating the task.
12
19
  */
13
20
  export interface ToolDefinition {
14
21
  name: string;
15
22
  description: string;
16
23
  inputSchema: JsonSchema;
17
24
  outputSchema?: JsonSchema;
25
+ /** JSON Schema describing the task's configuration options. */
26
+ configSchema?: JsonSchema;
27
+ /** Concrete configuration values matching {@link configSchema}. */
28
+ config?: Record<string, unknown>;
29
+ /**
30
+ * Optional custom executor function. When provided, the tool is executed
31
+ * by calling this function directly instead of instantiating a Task.
32
+ */
33
+ execute?: (input: Record<string, unknown>) => Promise<Record<string, unknown>>;
18
34
  }
19
35
  /**
20
36
  * A tool call returned by the LLM, requesting invocation of a specific tool.
@@ -24,6 +40,7 @@ export interface ToolCall {
24
40
  name: string;
25
41
  input: Record<string, unknown>;
26
42
  }
43
+ export type ToolCalls = Array<ToolCall>;
27
44
  /**
28
45
  * Controls which tools the model may call.
29
46
  * - `"auto"` — model decides whether to call tools
@@ -43,23 +60,28 @@ export declare function buildToolDescription(tool: ToolDefinition): string;
43
60
  */
44
61
  export declare function isAllowedToolName(name: string, allowedTools: ReadonlyArray<ToolDefinition>): boolean;
45
62
  /**
46
- * Filters a Record of tool calls, removing any whose name does not appear
47
- * in the provided tools list. Returns the filtered Record.
63
+ * Filters an array of tool calls, removing any whose name does not appear
64
+ * in the provided tools list. Returns the filtered array.
48
65
  */
49
- export declare function filterValidToolCalls(toolCalls: Record<string, unknown>, allowedTools: ReadonlyArray<ToolDefinition>): Record<string, unknown>;
66
+ export declare function filterValidToolCalls(toolCalls: ToolCalls, allowedTools: ReadonlyArray<ToolDefinition>): ToolCalls;
67
+ export interface ToolDefinitionWithTaskType extends ToolDefinition {
68
+ /** The task type name this definition was generated from. */
69
+ readonly taskType: string;
70
+ }
50
71
  /**
51
- * Converts an allow-list of task type names into {@link ToolDefinition} objects
52
- * suitable for the ToolCallingTask input.
72
+ * Converts an allow-list of task type names into {@link ToolDefinitionWithTaskType} objects
73
+ * suitable for the ToolCallingTask input. Each entry carries the originating
74
+ * `taskType` so callers don't need to rely on index correspondence.
53
75
  *
54
76
  * Each task's `type`, `description`, `inputSchema()`, and `outputSchema()`
55
77
  * are used to build the tool definition.
56
78
  *
57
79
  * @param taskNames - Array of task type names registered in the task constructors
58
80
  * @param registry - Optional service registry for DI-based lookups
59
- * @returns Array of ToolDefinition objects
81
+ * @returns Array of ToolDefinitionWithTaskType objects
60
82
  * @throws Error if a task name is not found in the registry
61
83
  */
62
- export declare function taskTypesToTools(taskNames: ReadonlyArray<string>, registry?: ServiceRegistry): ToolDefinition[];
84
+ export declare function taskTypesToTools(taskNames: ReadonlyArray<string>, registry?: ServiceRegistry): ToolDefinitionWithTaskType[];
63
85
  export declare const ToolDefinitionSchema: {
64
86
  readonly type: "object";
65
87
  readonly properties: {
@@ -85,9 +107,21 @@ export declare const ToolDefinitionSchema: {
85
107
  readonly description: "JSON Schema describing what the tool returns";
86
108
  readonly additionalProperties: true;
87
109
  };
110
+ readonly configSchema: {
111
+ readonly type: "object";
112
+ readonly title: "Config Schema";
113
+ readonly description: "JSON Schema describing the task's configuration options (not sent to the LLM)";
114
+ readonly additionalProperties: true;
115
+ };
116
+ readonly config: {
117
+ readonly type: "object";
118
+ readonly title: "Config";
119
+ readonly description: "Concrete configuration values for the backing task (not sent to the LLM)";
120
+ readonly additionalProperties: true;
121
+ };
88
122
  };
89
123
  readonly required: readonly ["name", "description", "inputSchema"];
90
- readonly additionalProperties: false;
124
+ readonly additionalProperties: true;
91
125
  };
92
126
  export declare const ToolCallingInputSchema: {
93
127
  readonly type: "object";
@@ -150,24 +184,55 @@ export declare const ToolCallingInputSchema: {
150
184
  readonly format: import(".").TypeModelSemantic;
151
185
  };
152
186
  readonly prompt: {
153
- readonly anyOf: readonly [{
187
+ readonly oneOf: readonly [{
154
188
  readonly type: "string";
155
189
  readonly title: "Prompt";
156
190
  readonly description: "The prompt to send to the model";
157
191
  }, {
158
192
  readonly type: "array";
193
+ readonly title: "Prompt";
194
+ readonly description: "The prompt as an array of strings or content blocks";
159
195
  readonly items: {
160
- readonly type: "string";
161
- readonly title: "Prompt";
162
- readonly description: "The prompt to send to the model";
196
+ readonly oneOf: readonly [{
197
+ readonly type: "string";
198
+ }, {
199
+ readonly type: "object";
200
+ readonly properties: {
201
+ readonly type: {
202
+ readonly type: "string";
203
+ readonly enum: readonly ["text", "image", "audio"];
204
+ };
205
+ };
206
+ readonly required: readonly ["type"];
207
+ readonly additionalProperties: true;
208
+ }];
163
209
  };
164
210
  }];
211
+ readonly title: "Prompt";
212
+ readonly description: "The prompt to send to the model";
165
213
  };
166
214
  readonly systemPrompt: {
167
215
  readonly type: "string";
168
216
  readonly title: "System Prompt";
169
217
  readonly description: "Optional system instructions for the model";
170
218
  };
219
+ readonly messages: {
220
+ readonly type: "array";
221
+ readonly title: "Messages";
222
+ readonly description: "Full conversation history for multi-turn interactions. When provided, used instead of prompt to construct the messages array sent to the provider.";
223
+ readonly items: {
224
+ readonly type: "object";
225
+ readonly properties: {
226
+ readonly role: {
227
+ readonly type: "string";
228
+ readonly enum: readonly ["user", "assistant", "tool"];
229
+ };
230
+ readonly content: {};
231
+ };
232
+ readonly required: readonly ["role", "content"];
233
+ readonly additionalProperties: true;
234
+ };
235
+ };
171
236
  readonly tools: {
172
237
  readonly type: "array";
173
238
  readonly format: "tasks";
@@ -203,9 +268,21 @@ export declare const ToolCallingInputSchema: {
203
268
  readonly description: "JSON Schema describing what the tool returns";
204
269
  readonly additionalProperties: true;
205
270
  };
271
+ readonly configSchema: {
272
+ readonly type: "object";
273
+ readonly title: "Config Schema";
274
+ readonly description: "JSON Schema describing the task's configuration options (not sent to the LLM)";
275
+ readonly additionalProperties: true;
276
+ };
277
+ readonly config: {
278
+ readonly type: "object";
279
+ readonly title: "Config";
280
+ readonly description: "Concrete configuration values for the backing task (not sent to the LLM)";
281
+ readonly additionalProperties: true;
282
+ };
206
283
  };
207
284
  readonly required: readonly ["name", "description", "inputSchema"];
208
- readonly additionalProperties: false;
285
+ readonly additionalProperties: true;
209
286
  }];
210
287
  };
211
288
  };
@@ -255,19 +332,53 @@ export declare const ToolCallingOutputSchema: {
255
332
  };
256
333
  readonly toolCalls: {
257
334
  readonly anyOf: readonly [{
258
- readonly type: "object";
259
- readonly title: "Tool Calls";
260
- readonly description: "Tool invocations requested by the model, keyed by call id";
261
- readonly additionalProperties: true;
262
335
  readonly "x-stream": "object";
336
+ readonly type: "object";
337
+ readonly properties: {
338
+ readonly id: {
339
+ readonly type: "string";
340
+ readonly title: "ID";
341
+ readonly description: "Unique identifier for this tool call";
342
+ };
343
+ readonly name: {
344
+ readonly type: "string";
345
+ readonly title: "Name";
346
+ readonly description: "The name of the tool to invoke";
347
+ };
348
+ readonly input: {
349
+ readonly type: "object";
350
+ readonly title: "Input";
351
+ readonly description: "The input arguments for the tool call";
352
+ readonly additionalProperties: true;
353
+ };
354
+ };
355
+ readonly required: readonly ["id", "name", "input"];
356
+ readonly additionalProperties: false;
263
357
  }, {
264
358
  readonly type: "array";
265
359
  readonly items: {
266
- readonly type: "object";
267
- readonly title: "Tool Calls";
268
- readonly description: "Tool invocations requested by the model, keyed by call id";
269
- readonly additionalProperties: true;
270
360
  readonly "x-stream": "object";
361
+ readonly type: "object";
362
+ readonly properties: {
363
+ readonly id: {
364
+ readonly type: "string";
365
+ readonly title: "ID";
366
+ readonly description: "Unique identifier for this tool call";
367
+ };
368
+ readonly name: {
369
+ readonly type: "string";
370
+ readonly title: "Name";
371
+ readonly description: "The name of the tool to invoke";
372
+ };
373
+ readonly input: {
374
+ readonly type: "object";
375
+ readonly title: "Input";
376
+ readonly description: "The input arguments for the tool call";
377
+ readonly additionalProperties: true;
378
+ };
379
+ };
380
+ readonly required: readonly ["id", "name", "input"];
381
+ readonly additionalProperties: false;
271
382
  };
272
383
  }];
273
384
  };
@@ -282,9 +393,17 @@ export declare const ToolCallingOutputSchema: {
282
393
  * references and inline tool definitions, but the input resolver converts all
283
394
  * strings to {@link ToolDefinition} objects before execution. The `tools` field
284
395
  * is therefore narrowed to `ToolDefinition[]` here.
396
+ *
397
+ * Extends the schema-derived base with the
398
+ * `messages` field typed explicitly (the loose `content: {}` in the
399
+ * schema prevents `FromSchema` from producing a useful type).
285
400
  */
286
401
  export type ToolCallingTaskInput = Omit<FromSchema<typeof ToolCallingInputSchema>, "tools"> & {
287
402
  readonly tools: ToolDefinition[];
403
+ readonly messages?: ReadonlyArray<{
404
+ readonly role: "user" | "assistant" | "tool";
405
+ readonly content: unknown;
406
+ }>;
288
407
  };
289
408
  export type ToolCallingTaskOutput = FromSchema<typeof ToolCallingOutputSchema>;
290
409
  export declare class ToolCallingTask extends StreamingAiTask<ToolCallingTaskInput, ToolCallingTaskOutput, JobQueueTaskConfig> {
@@ -301,10 +420,18 @@ export declare class ToolCallingTask extends StreamingAiTask<ToolCallingTaskInpu
301
420
  export declare const toolCalling: (input: ToolCallingTaskInput, config?: JobQueueTaskConfig) => Promise<{
302
421
  text: string | string[];
303
422
  toolCalls: {
304
- [x: string]: unknown;
305
- }[] | {
306
- [x: string]: unknown;
307
- };
423
+ id: string;
424
+ name: string;
425
+ input: {
426
+ [x: string]: unknown;
427
+ };
428
+ } | {
429
+ id: string;
430
+ name: string;
431
+ input: {
432
+ [x: string]: unknown;
433
+ };
434
+ }[];
308
435
  }>;
309
436
  declare module "@workglow/task-graph" {
310
437
  interface Workflow {
@@ -1 +1 @@
1
- {"version":3,"file":"ToolCallingTask.d.ts","sourceRoot":"","sources":["../../src/task/ToolCallingTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,EAEd,kBAAkB,EAEnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAa,UAAU,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEpG,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAMzD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,UAAU,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAM5E;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAMjE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,GAC1C,OAAO,CAET;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,GAC1C,MAAM,CAAC,MAAM,EAAE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AAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;QAC7C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;KAC3B,CAAC,CAAC;CACJ,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAM/E,qBAAa,eAAgB,SAAQ,eAAe,CAClD,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,CACnB;IACC,OAAc,IAAI,SAAqB;IACvC,OAAc,QAAQ,SAAmB;IACzC,OAAc,KAAK,SAAkB;IACrC,OAAc,WAAW,SACkG;WAC7G,WAAW,IAAI,cAAc;WAG7B,YAAY,IAAI,cAAc;CAG7C;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,oBAAoB,EAAE,SAAS,kBAAkB;;;;;;;;;;;;;;;EAEnF,CAAC;AAEF,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,QAAQ;QAChB,WAAW,EAAE,cAAc,CAAC,oBAAoB,EAAE,qBAAqB,EAAE,kBAAkB,CAAC,CAAC;KAC9F;CACF"}
@@ -75,7 +75,7 @@ export type VectorSimilarityTaskInput = FromSchema<typeof SimilarityInputSchema,
75
75
  export type VectorSimilarityTaskOutput = FromSchema<typeof SimilarityOutputSchema, TypedArraySchemaOptions>;
76
76
  export declare class VectorSimilarityTask extends GraphAsTask<VectorSimilarityTaskInput, VectorSimilarityTaskOutput, JobQueueTaskConfig> {
77
77
  static readonly type = "VectorSimilarityTask";
78
- static readonly category = "Analysis";
78
+ static readonly category = "Vector";
79
79
  static readonly title = "Vector Similarity";
80
80
  static description: string;
81
81
  static readonly cacheable = true;
@@ -1 +1 @@
1
- {"version":3,"file":"VectorSimilarityTask.d.ts","sourceRoot":"","sources":["../../src/task/VectorSimilarityTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,kBAAkB,EAAY,MAAM,sBAAsB,C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;IACpC,UAAU,QAAQ;QAChB,UAAU,EAAE,cAAc,CACxB,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,CACnB,CAAC;KACH;CACF"}
@@ -3,6 +3,7 @@
3
3
  * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import { AgentTask } from "./AgentTask";
6
7
  import { BackgroundRemovalTask } from "./BackgroundRemovalTask";
7
8
  import { ChunkRetrievalTask } from "./ChunkRetrievalTask";
8
9
  import { ChunkToVectorTask } from "./ChunkToVectorTask";
@@ -45,7 +46,11 @@ import { TopicSegmenterTask } from "./TopicSegmenterTask";
45
46
  import { UnloadModelTask } from "./UnloadModelTask";
46
47
  import { VectorQuantizeTask } from "./VectorQuantizeTask";
47
48
  import { VectorSimilarityTask } from "./VectorSimilarityTask";
48
- export declare const registerAiTasks: () => (typeof BackgroundRemovalTask | typeof ChunkToVectorTask | typeof CountTokensTask | typeof ContextBuilderTask | typeof DocumentEnricherTask | typeof ChunkRetrievalTask | typeof ChunkVectorHybridSearchTask | typeof ChunkVectorSearchTask | typeof ChunkVectorUpsertTask | typeof FaceDetectorTask | typeof FaceLandmarkerTask | typeof GestureRecognizerTask | typeof HandLandmarkerTask | typeof HierarchicalChunkerTask | typeof HierarchyJoinTask | typeof ImageClassificationTask | typeof ImageEmbeddingTask | typeof ImageSegmentationTask | typeof ImageToTextTask | typeof ModelInfoTask | typeof ObjectDetectionTask | typeof PoseLandmarkerTask | typeof QueryExpanderTask | typeof RerankerTask | typeof StructuralParserTask | typeof StructuredGenerationTask | typeof TextChunkerTask | typeof TextClassificationTask | typeof TextEmbeddingTask | typeof TextFillMaskTask | typeof TextGenerationTask | typeof TextLanguageDetectionTask | typeof TextNamedEntityRecognitionTask | typeof TextQuestionAnswerTask | typeof TextRewriterTask | typeof TextSummaryTask | typeof TextTranslationTask | typeof ToolCallingTask | typeof TopicSegmenterTask | typeof UnloadModelTask | typeof VectorQuantizeTask | typeof VectorSimilarityTask)[];
49
+ export declare const registerAiTasks: () => (typeof AgentTask | typeof BackgroundRemovalTask | typeof ChunkToVectorTask | typeof CountTokensTask | typeof ContextBuilderTask | typeof DocumentEnricherTask | typeof ChunkRetrievalTask | typeof ChunkVectorHybridSearchTask | typeof ChunkVectorSearchTask | typeof ChunkVectorUpsertTask | typeof FaceDetectorTask | typeof FaceLandmarkerTask | typeof GestureRecognizerTask | typeof HandLandmarkerTask | typeof HierarchicalChunkerTask | typeof HierarchyJoinTask | typeof ImageClassificationTask | typeof ImageEmbeddingTask | typeof ImageSegmentationTask | typeof ImageToTextTask | typeof ModelInfoTask | typeof ObjectDetectionTask | typeof PoseLandmarkerTask | typeof QueryExpanderTask | typeof RerankerTask | typeof StructuralParserTask | typeof StructuredGenerationTask | typeof TextChunkerTask | typeof TextClassificationTask | typeof TextEmbeddingTask | typeof TextFillMaskTask | typeof TextGenerationTask | typeof TextLanguageDetectionTask | typeof TextNamedEntityRecognitionTask | typeof TextQuestionAnswerTask | typeof TextRewriterTask | typeof TextSummaryTask | typeof TextTranslationTask | typeof ToolCallingTask | typeof TopicSegmenterTask | typeof UnloadModelTask | typeof VectorQuantizeTask | typeof VectorSimilarityTask)[];
50
+ export * from "./AgentTask";
51
+ export * from "./AgentTypes";
52
+ export * from "./AgentUtils";
53
+ export * from "./MessageConversion";
49
54
  export * from "./BackgroundRemovalTask";
50
55
  export * from "./base/AiTask";
51
56
  export * from "./base/AiTaskSchemas";