@workglow/ai 0.2.7 → 0.2.8

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/bun.js CHANGED
@@ -56,6 +56,19 @@ class AiProviderRegistry {
56
56
  }
57
57
  return this.defaultStrategy;
58
58
  }
59
+ createSession(providerName, model) {
60
+ const provider = this.providers.get(providerName);
61
+ if (!provider) {
62
+ throw new Error(`No provider found for "${providerName}". Register the provider before creating sessions.`);
63
+ }
64
+ return provider.createSession(model);
65
+ }
66
+ async disposeSession(providerName, sessionId) {
67
+ const provider = this.providers.get(providerName);
68
+ if (provider) {
69
+ await provider.disposeSession(sessionId);
70
+ }
71
+ }
59
72
  getProviderIdsForTask(taskType) {
60
73
  const taskMap = this.runFnRegistry.get(taskType);
61
74
  if (!taskMap)
@@ -69,9 +82,9 @@ class AiProviderRegistry {
69
82
  this.runFnRegistry.get(taskType).set(modelProvider, runFn);
70
83
  }
71
84
  registerAsWorkerRunFn(modelProvider, taskType) {
72
- const workerFn = async (input, model, update_progress, signal, outputSchema) => {
85
+ const workerFn = async (input, model, update_progress, signal, outputSchema, sessionId) => {
73
86
  const workerManager = globalServiceRegistry.get(WORKER_MANAGER);
74
- const result = await workerManager.callWorkerFunction(modelProvider, taskType, [input, model, outputSchema], {
87
+ const result = await workerManager.callWorkerFunction(modelProvider, taskType, [input, model, outputSchema, sessionId], {
75
88
  signal,
76
89
  onProgress: update_progress
77
90
  });
@@ -86,9 +99,9 @@ class AiProviderRegistry {
86
99
  this.streamFnRegistry.get(taskType).set(modelProvider, streamFn);
87
100
  }
88
101
  registerAsWorkerStreamFn(modelProvider, taskType) {
89
- const streamFn = async function* (input, model, signal, outputSchema) {
102
+ const streamFn = async function* (input, model, signal, outputSchema, sessionId) {
90
103
  const workerManager = globalServiceRegistry.get(WORKER_MANAGER);
91
- yield* workerManager.callWorkerStreamFunction(modelProvider, taskType, [input, model, outputSchema], { signal });
104
+ yield* workerManager.callWorkerStreamFunction(modelProvider, taskType, [input, model, outputSchema, sessionId], { signal });
92
105
  };
93
106
  this.registerStreamFn(modelProvider, taskType, streamFn);
94
107
  }
@@ -216,7 +229,7 @@ class AiJob extends Job {
216
229
  const timeoutMs = resolveAiJobTimeoutMs(input.aiProvider, input.timeoutMs);
217
230
  const timeoutSignal = AbortSignal.timeout(timeoutMs);
218
231
  const combinedSignal = AbortSignal.any([context.signal, timeoutSignal]);
219
- return await fn(input.taskInput, model, context.updateProgress, combinedSignal, input.outputSchema);
232
+ return await fn(input.taskInput, model, context.updateProgress, combinedSignal, input.outputSchema, input.sessionId);
220
233
  };
221
234
  const runFnPromise = runFn();
222
235
  return await Promise.race([runFnPromise, abortPromise]);
@@ -244,7 +257,7 @@ class AiJob extends Job {
244
257
  const timeoutSignal = AbortSignal.timeout(timeoutMs);
245
258
  const combinedSignal = AbortSignal.any([context.signal, timeoutSignal]);
246
259
  try {
247
- for await (const event of streamFn(input.taskInput, model, combinedSignal, input.outputSchema)) {
260
+ for await (const event of streamFn(input.taskInput, model, combinedSignal, input.outputSchema, input.sessionId)) {
248
261
  if (event.type === "finish") {
249
262
  lastFinishData = event.data;
250
263
  }
@@ -760,6 +773,10 @@ class AiProvider {
760
773
  }
761
774
  async onInitialize(_options) {}
762
775
  async dispose() {}
776
+ createSession(_model) {
777
+ return crypto.randomUUID();
778
+ }
779
+ async disposeSession(_sessionId) {}
763
780
  async afterRegister(_options) {}
764
781
  }
765
782
 
@@ -783,74 +800,8 @@ class QueuedAiProvider extends AiProvider {
783
800
  // src/task/index.ts
784
801
  import { TaskRegistry } from "@workglow/task-graph";
785
802
 
786
- // src/task/AgentTask.ts
787
- import { CreateWorkflow as CreateWorkflow2, Task as Task2, Workflow as Workflow2 } from "@workglow/task-graph";
788
- import { getLogger as getLogger4 } from "@workglow/util";
789
-
790
- // src/task/AgentTypes.ts
791
- import { parseDataUri } from "@workglow/util/media";
792
- function imageBlock(mimeType, data) {
793
- return { type: "image", mimeType, data };
794
- }
795
- function audioBlock(mimeType, data) {
796
- return { type: "audio", mimeType, data };
797
- }
798
- function imageBlockFromDataUri(dataUri) {
799
- const { mimeType, base64 } = parseDataUri(dataUri);
800
- return { type: "image", mimeType, data: base64 };
801
- }
802
- function audioBlockFromDataUri(dataUri) {
803
- const { mimeType, base64 } = parseDataUri(dataUri);
804
- return { type: "audio", mimeType, data: base64 };
805
- }
806
- function userMessage(prompt) {
807
- return { role: "user", content: prompt };
808
- }
809
- function assistantMessage(text, toolCalls) {
810
- const content = [];
811
- if (text) {
812
- content.push({ type: "text", text });
813
- }
814
- if (toolCalls) {
815
- for (const tc of toolCalls) {
816
- content.push({
817
- type: "tool_use",
818
- id: tc.id,
819
- name: tc.name,
820
- input: tc.input
821
- });
822
- }
823
- }
824
- return { role: "assistant", content };
825
- }
826
- function toolMessage(results) {
827
- return {
828
- role: "tool",
829
- content: results.map((r) => {
830
- const jsonText = JSON.stringify(r.output);
831
- const content = r.mediaContent && r.mediaContent.length > 0 ? [{ type: "text", text: jsonText }, ...r.mediaContent] : jsonText;
832
- return {
833
- type: "tool_result",
834
- tool_use_id: r.toolCallId,
835
- content,
836
- is_error: r.isError || undefined
837
- };
838
- })
839
- };
840
- }
841
- function toolSourceDefinitions(sources) {
842
- return sources.map((s) => s.definition);
843
- }
844
- function findToolSource(sources, name) {
845
- return sources.find((s) => s.definition.name === name);
846
- }
847
-
848
- // src/task/AgentUtils.ts
849
- import { getTaskConstructors as getTaskConstructors2, TaskAbortedError } from "@workglow/task-graph";
850
- import { getLogger as getLogger3 } from "@workglow/util";
851
-
852
- // src/task/ToolCallingTask.ts
853
- import { CreateWorkflow, getTaskConstructors, Workflow } from "@workglow/task-graph";
803
+ // src/task/BackgroundRemovalTask.ts
804
+ import { CreateWorkflow, Workflow } from "@workglow/task-graph";
854
805
 
855
806
  // src/task/base/AiTaskSchemas.ts
856
807
  var TypeLanguage = (annotations = {}) => ({
@@ -1009,8 +960,8 @@ var TypeCategory = {
1009
960
  description: "Classification category with label and score"
1010
961
  };
1011
962
 
1012
- // src/task/base/StreamingAiTask.ts
1013
- import { getStreamingPorts, TaskConfigurationError as TaskConfigurationError3 } from "@workglow/task-graph";
963
+ // src/task/base/AiVisionTask.ts
964
+ import { convertImageDataToUseableForm } from "@workglow/util/media";
1014
965
 
1015
966
  // src/task/base/AiTask.ts
1016
967
  import {
@@ -1019,882 +970,184 @@ import {
1019
970
  TaskConfigSchema,
1020
971
  TaskConfigurationError as TaskConfigurationError2,
1021
972
  hasStructuredOutput
1022
- } from "@workglow/task-graph";
1023
- function schemaFormat(schema) {
1024
- return typeof schema === "object" && schema !== null && "format" in schema ? schema.format : undefined;
1025
- }
1026
- var aiTaskConfigSchema = {
1027
- type: "object",
1028
- properties: {
1029
- ...TaskConfigSchema["properties"]
1030
- },
1031
- additionalProperties: false
1032
- };
1033
-
1034
- class AiTask extends Task {
1035
- static type = "AiTask";
1036
- static hasDynamicEntitlements = true;
1037
- static entitlements() {
1038
- return {
1039
- entitlements: [{ id: Entitlements.AI_INFERENCE, reason: "Runs AI model inference" }]
1040
- };
1041
- }
1042
- entitlements() {
1043
- const base = [
1044
- { id: Entitlements.AI_INFERENCE, reason: "Runs AI model inference" }
1045
- ];
1046
- const runModel = this.runInputData?.model;
1047
- const modelId = typeof runModel === "string" ? runModel : typeof this.defaults.model === "string" ? this.defaults.model : undefined;
1048
- if (modelId) {
1049
- base.push({
1050
- id: Entitlements.AI_MODEL,
1051
- reason: `Uses model ${modelId}`,
1052
- resources: [modelId]
1053
- });
1054
- }
1055
- return { entitlements: base };
1056
- }
1057
- static configSchema() {
1058
- return aiTaskConfigSchema;
1059
- }
1060
- async execute(input, executeContext) {
1061
- const model = input.model;
1062
- if (!model || typeof model !== "object") {
1063
- throw new TaskConfigurationError2("AiTask: Model was not resolved to ModelConfig - this indicates a bug in the resolution system");
1064
- }
1065
- const jobInput = await this.getJobInput(input);
1066
- const strategy = getAiProviderRegistry().getStrategy(model);
1067
- const output = await strategy.execute(jobInput, executeContext, this.runConfig.runnerId);
1068
- if (executeContext.resourceScope) {
1069
- const registry = getAiProviderRegistry();
1070
- const provider = registry.getProvider(model.provider);
1071
- const unloadFn = provider?.getRunFn("UnloadModelTask");
1072
- if (unloadFn) {
1073
- const modelPath = model.provider_config?.model_path ?? model.model;
1074
- const resourceKey = `ai:${model.provider}:${modelPath}`;
1075
- executeContext.resourceScope.register(resourceKey, async () => {
1076
- await unloadFn({ model }, model, () => {}, AbortSignal.timeout(30000));
1077
- });
1078
- }
1079
- }
1080
- return output;
1081
- }
1082
- async getJobInput(input) {
1083
- const model = input.model;
1084
- const runtype = this.constructor.runtype ?? this.constructor.type;
1085
- const jobInput = {
1086
- taskType: runtype,
1087
- aiProvider: model.provider,
1088
- taskInput: input
1089
- };
1090
- const taskTimeoutMs = this.config.timeout;
1091
- if (typeof taskTimeoutMs === "number" && taskTimeoutMs > 0) {
1092
- jobInput.timeoutMs = taskTimeoutMs;
1093
- }
1094
- const inputOutputSchema = input.outputSchema;
1095
- if (inputOutputSchema && typeof inputOutputSchema === "object" && !Array.isArray(inputOutputSchema) && typeof inputOutputSchema.type === "string") {
1096
- jobInput.outputSchema = inputOutputSchema;
1097
- } else {
1098
- const taskOutputSchema = this.outputSchema();
1099
- if (hasStructuredOutput(taskOutputSchema)) {
1100
- jobInput.outputSchema = taskOutputSchema;
1101
- }
1102
- }
1103
- return jobInput;
1104
- }
1105
- async createJob(input, queueName) {
1106
- const jobInput = await this.getJobInput(input);
1107
- const resolvedQueueName = queueName ?? await this.getDefaultQueueName(input);
1108
- if (!resolvedQueueName) {
1109
- throw new TaskConfigurationError2("AiTask: Unable to determine queue for AI provider");
1110
- }
1111
- const job = new AiJob({
1112
- queueName: resolvedQueueName,
1113
- jobRunId: this.runConfig.runnerId,
1114
- input: jobInput
1115
- });
1116
- return job;
1117
- }
1118
- async getDefaultQueueName(input) {
1119
- const model = input.model;
1120
- return model?.provider;
1121
- }
1122
- async executeReactive(input, output, context) {
1123
- const model = input.model;
1124
- if (model && typeof model === "object" && model.provider) {
1125
- const taskType = this.constructor.runtype ?? this.constructor.type;
1126
- const reactiveFn = getAiProviderRegistry().getReactiveRunFn(model.provider, taskType);
1127
- if (reactiveFn) {
1128
- return reactiveFn(input, output, model);
1129
- }
1130
- }
1131
- return super.executeReactive(input, output, context);
1132
- }
1133
- async validateInput(input) {
1134
- const inputSchema = this.inputSchema();
1135
- if (typeof inputSchema === "boolean") {
1136
- if (inputSchema === false) {
1137
- throw new TaskConfigurationError2(`AiTask: Input schema is 'false' and accepts no inputs`);
1138
- }
1139
- return true;
1140
- }
1141
- const modelTaskProperties = Object.entries(inputSchema.properties || {}).filter(([key, schema]) => schemaFormat(schema)?.startsWith("model:"));
1142
- for (const [key] of modelTaskProperties) {
1143
- const model = input[key];
1144
- if (typeof model === "object" && model !== null) {
1145
- const tasks = model.tasks;
1146
- if (Array.isArray(tasks) && tasks.length > 0 && !tasks.includes(this.type)) {
1147
- const modelId = model.model_id ?? "(inline config)";
1148
- throw new TaskConfigurationError2(`AiTask: Model "${modelId}" for '${key}' is not compatible with task '${this.type}'. ` + `Model supports: [${tasks.join(", ")}]`);
1149
- }
1150
- } else if (model !== undefined && model !== null) {
1151
- throw new TaskConfigurationError2(`AiTask: Invalid model for '${key}' - expected ModelConfig object but got ${typeof model}. ` + `Ensure the model ID was registered in the ModelRepository before running the task.`);
1152
- }
1153
- }
1154
- const modelPlainProperties = Object.entries(inputSchema.properties || {}).filter(([key, schema]) => schemaFormat(schema) === "model");
1155
- for (const [key] of modelPlainProperties) {
1156
- const model = input[key];
1157
- if (model !== undefined && model !== null && typeof model !== "object") {
1158
- throw new TaskConfigurationError2(`AiTask: Invalid model for '${key}' - expected ModelConfig object but got ${typeof model}. ` + `Ensure the model ID was registered in the ModelRepository before running the task.`);
1159
- }
1160
- }
1161
- return super.validateInput(input);
1162
- }
1163
- async narrowInput(input, registry) {
1164
- const inputSchema = this.inputSchema();
1165
- if (typeof inputSchema === "boolean") {
1166
- if (inputSchema === false) {
1167
- throw new TaskConfigurationError2(`AiTask: Input schema is 'false' and accepts no inputs`);
1168
- }
1169
- return input;
1170
- }
1171
- const modelTaskProperties = Object.entries(inputSchema.properties || {}).filter(([key, schema]) => schemaFormat(schema)?.startsWith("model:"));
1172
- if (modelTaskProperties.length > 0) {
1173
- const modelRepo = registry.get(MODEL_REPOSITORY);
1174
- const taskModels = await modelRepo.findModelsByTask(this.type) ?? [];
1175
- for (const [key] of modelTaskProperties) {
1176
- const requestedModel = input[key];
1177
- if (typeof requestedModel === "string") {
1178
- const found = taskModels?.find((m) => m.model_id === requestedModel);
1179
- if (!found) {
1180
- input[key] = undefined;
1181
- }
1182
- } else if (typeof requestedModel === "object" && requestedModel !== null) {
1183
- const model = requestedModel;
1184
- const tasks = model.tasks;
1185
- if (Array.isArray(tasks) && tasks.length > 0 && !tasks.includes(this.type)) {
1186
- input[key] = undefined;
1187
- }
1188
- }
1189
- }
1190
- }
1191
- return input;
1192
- }
1193
- }
1194
-
1195
- // src/task/base/StreamingAiTask.ts
1196
- class StreamingAiTask extends AiTask {
1197
- static type = "StreamingAiTask";
1198
- async* executeStream(input, context) {
1199
- const model = input.model;
1200
- if (!model || typeof model !== "object") {
1201
- throw new TaskConfigurationError3("StreamingAiTask: Model was not resolved to ModelConfig - this indicates a bug in the resolution system");
1202
- }
1203
- const jobInput = await this.getJobInput(input);
1204
- const strategy = getAiProviderRegistry().getStrategy(model);
1205
- const outSchema = this.outputSchema();
1206
- const ports = getStreamingPorts(outSchema);
1207
- let defaultPort = "text";
1208
- if (ports.length > 0) {
1209
- defaultPort = ports[0].port;
1210
- } else {
1211
- if (typeof outSchema === "object" && outSchema.properties) {
1212
- const firstProp = Object.keys(outSchema.properties)[0];
1213
- if (firstProp)
1214
- defaultPort = firstProp;
1215
- }
1216
- }
1217
- for await (const event of strategy.executeStream(jobInput, context, this.runConfig.runnerId)) {
1218
- if (event.type === "text-delta") {
1219
- yield { ...event, port: event.port ?? defaultPort };
1220
- } else if (event.type === "object-delta") {
1221
- yield { ...event, port: event.port ?? defaultPort };
1222
- } else {
1223
- yield event;
1224
- }
1225
- }
1226
- }
1227
- }
1228
-
1229
- // src/task/ToolCallingTask.ts
1230
- function taskTypesToTools(taskNames, registry) {
1231
- const constructors = getTaskConstructors(registry);
1232
- return taskNames.map((name) => {
1233
- const ctor = constructors.get(name);
1234
- if (!ctor) {
1235
- throw new Error(`taskTypesToTools: Unknown task type "${name}" \u2014 not found in task constructors registry (ServiceRegistry: ${registry ? "custom" : "default"})`);
1236
- }
1237
- const configSchema = "configSchema" in ctor && typeof ctor.configSchema === "function" ? ctor.configSchema() : undefined;
1238
- return {
1239
- name: ctor.type,
1240
- description: ctor.description ?? "",
1241
- inputSchema: ctor.inputSchema(),
1242
- outputSchema: ctor.outputSchema(),
1243
- ...configSchema ? { configSchema } : {},
1244
- taskType: name
1245
- };
1246
- });
1247
- }
1248
- var ToolDefinitionSchema = {
1249
- type: "object",
1250
- properties: {
1251
- name: {
1252
- type: "string",
1253
- title: "Name",
1254
- description: "The tool name"
1255
- },
1256
- description: {
1257
- type: "string",
1258
- title: "Description",
1259
- description: "A description of what the tool does"
1260
- },
1261
- inputSchema: {
1262
- type: "object",
1263
- title: "Input Schema",
1264
- description: "JSON Schema describing the tool's input parameters",
1265
- additionalProperties: true
1266
- },
1267
- outputSchema: {
1268
- type: "object",
1269
- title: "Output Schema",
1270
- description: "JSON Schema describing what the tool returns",
1271
- additionalProperties: true
1272
- },
1273
- configSchema: {
1274
- type: "object",
1275
- title: "Config Schema",
1276
- description: "JSON Schema describing the task's configuration options (not sent to the LLM)",
1277
- additionalProperties: true
1278
- },
1279
- config: {
1280
- type: "object",
1281
- title: "Config",
1282
- description: "Concrete configuration values for the backing task (not sent to the LLM)",
1283
- additionalProperties: true
1284
- }
1285
- },
1286
- required: ["name", "description", "inputSchema"],
1287
- additionalProperties: true
1288
- };
1289
- var ToolCallSchema = {
1290
- type: "object",
1291
- properties: {
1292
- id: {
1293
- type: "string",
1294
- title: "ID",
1295
- description: "Unique identifier for this tool call"
1296
- },
1297
- name: {
1298
- type: "string",
1299
- title: "Name",
1300
- description: "The name of the tool to invoke"
1301
- },
1302
- input: {
1303
- type: "object",
1304
- title: "Input",
1305
- description: "The input arguments for the tool call",
1306
- additionalProperties: true
1307
- }
1308
- },
1309
- required: ["id", "name", "input"],
1310
- additionalProperties: false
1311
- };
1312
- var modelSchema = TypeModel("model:ToolCallingTask");
1313
- var ToolCallingInputSchema = {
1314
- type: "object",
1315
- properties: {
1316
- model: modelSchema,
1317
- prompt: {
1318
- oneOf: [
1319
- { type: "string", title: "Prompt", description: "The prompt to send to the model" },
1320
- {
1321
- type: "array",
1322
- title: "Prompt",
1323
- description: "The prompt as an array of strings or content blocks",
1324
- items: {
1325
- oneOf: [
1326
- { type: "string" },
1327
- {
1328
- type: "object",
1329
- properties: {
1330
- type: { type: "string", enum: ["text", "image", "audio"] }
1331
- },
1332
- required: ["type"],
1333
- additionalProperties: true
1334
- }
1335
- ]
1336
- }
1337
- }
1338
- ],
1339
- title: "Prompt",
1340
- description: "The prompt to send to the model"
1341
- },
1342
- systemPrompt: {
1343
- type: "string",
1344
- title: "System Prompt",
1345
- description: "Optional system instructions for the model"
1346
- },
1347
- messages: {
1348
- type: "array",
1349
- title: "Messages",
1350
- description: "Full conversation history for multi-turn interactions. When provided, used instead of prompt to construct the messages array sent to the provider.",
1351
- items: {
1352
- type: "object",
1353
- properties: {
1354
- role: { type: "string", enum: ["user", "assistant", "tool"] },
1355
- content: {}
1356
- },
1357
- required: ["role", "content"],
1358
- additionalProperties: true
1359
- }
1360
- },
1361
- tools: {
1362
- type: "array",
1363
- format: "tasks",
1364
- title: "Tools",
1365
- description: "Tool definitions available for the model to call",
1366
- items: {
1367
- oneOf: [
1368
- { type: "string", format: "tasks", description: "Task type name" },
1369
- ToolDefinitionSchema
1370
- ]
1371
- }
1372
- },
1373
- toolChoice: {
1374
- type: "string",
1375
- title: "Tool Choice",
1376
- description: 'Controls tool selection: "auto" (model decides), "none" (no tools), "required" (must call a tool), or a specific tool name',
1377
- "x-ui-group": "Configuration"
1378
- },
1379
- maxTokens: {
1380
- type: "number",
1381
- title: "Max Tokens",
1382
- description: "The maximum number of tokens to generate",
1383
- minimum: 1,
1384
- "x-ui-group": "Configuration"
1385
- },
1386
- temperature: {
1387
- type: "number",
1388
- title: "Temperature",
1389
- description: "The temperature to use for sampling",
1390
- minimum: 0,
1391
- maximum: 2,
1392
- "x-ui-group": "Configuration"
1393
- }
1394
- },
1395
- required: ["model", "prompt", "tools"],
1396
- additionalProperties: false
1397
- };
1398
- var ToolCallingOutputSchema = {
1399
- type: "object",
1400
- properties: {
1401
- text: {
1402
- type: "string",
1403
- title: "Text",
1404
- description: "Any text content generated by the model",
1405
- "x-stream": "append"
1406
- },
1407
- toolCalls: {
1408
- type: "array",
1409
- items: ToolCallSchema,
1410
- title: "Tool Calls",
1411
- description: "Tool calls requested by the model",
1412
- "x-stream": "object"
1413
- }
1414
- },
1415
- required: ["text", "toolCalls"],
1416
- additionalProperties: false
1417
- };
1418
-
1419
- class ToolCallingTask extends StreamingAiTask {
1420
- static type = "ToolCallingTask";
1421
- static category = "AI Text Model";
1422
- static title = "Tool Calling";
1423
- static description = "Sends a prompt with tool definitions to a language model and returns text along with any tool calls the model requests";
1424
- static inputSchema() {
1425
- return ToolCallingInputSchema;
1426
- }
1427
- static outputSchema() {
1428
- return ToolCallingOutputSchema;
1429
- }
1430
- }
1431
- var toolCalling = (input, config) => {
1432
- return new ToolCallingTask(config).run(input);
1433
- };
1434
- Workflow.prototype.toolCalling = CreateWorkflow(ToolCallingTask);
1435
-
1436
- // src/task/AgentUtils.ts
1437
- function resolveToolConfig(toolName, config, taskConfigSchema) {
1438
- if (config && !taskConfigSchema) {
1439
- getLogger3().warn(`AgentTask: Tool "${toolName}" provided config but task has no configSchema \u2014 config ignored`);
1440
- return {};
1441
- }
1442
- return config;
1443
- }
1444
- function buildToolSources(tools, registry) {
1445
- if (!tools || tools.length === 0)
1446
- return [];
1447
- const stringNames = tools.filter((t) => typeof t === "string");
1448
- const resolvedDefs = new Map(taskTypesToTools(stringNames, registry).map((d) => [d.taskType, d]));
1449
- const constructors = getTaskConstructors2(registry);
1450
- const sources = [];
1451
- for (const tool of tools) {
1452
- if (typeof tool === "string") {
1453
- const def = resolvedDefs.get(tool);
1454
- if (def) {
1455
- const { taskType, ...definition } = def;
1456
- sources.push({
1457
- type: "registry",
1458
- definition,
1459
- taskType
1460
- });
1461
- }
1462
- } else if (tool.type === "function" || !tool.type && tool.execute) {
1463
- if (!tool.execute) {
1464
- getLogger3().warn(`AgentTask: Tool "${tool.name}" has type "function" but no execute function \u2014 will throw on invocation`);
1465
- }
1466
- const { execute, configSchema: _cs, config: _c, type: _t, ...definition } = tool;
1467
- sources.push({
1468
- type: "function",
1469
- definition,
1470
- run: execute ?? (async () => {
1471
- throw new Error(`No execute function for tool "${tool.name}"`);
1472
- })
1473
- });
1474
- } else if (tool.type === "task") {
1475
- const ctor = constructors.get(tool.name);
1476
- if (!ctor) {
1477
- getLogger3().warn(`AgentTask: Tool "${tool.name}" has type "task" but is not in TaskRegistry \u2014 will throw on invocation`);
1478
- const { execute: _e, configSchema: _cs, config: _c, type: _t, ...definition } = tool;
1479
- sources.push({
1480
- type: "function",
1481
- definition,
1482
- run: async () => {
1483
- throw new Error(`Task "${tool.name}" not found in TaskRegistry`);
1484
- }
1485
- });
1486
- } else {
1487
- const safeConfig = resolveToolConfig(tool.name, tool.config, ctor.configSchema?.());
1488
- const { execute: _e, configSchema: _cs, config: _c, type: _t, ...definition } = tool;
1489
- sources.push({
1490
- type: "registry",
1491
- definition,
1492
- taskType: tool.name,
1493
- config: safeConfig
1494
- });
1495
- }
1496
- } else {
1497
- const ctor = constructors.get(tool.name);
1498
- if (ctor) {
1499
- const safeConfig = resolveToolConfig(tool.name, tool.config, ctor.configSchema?.());
1500
- const { execute: _e, configSchema: _cs, config: _c, type: _t, ...definition } = tool;
1501
- sources.push({
1502
- type: "registry",
1503
- definition,
1504
- taskType: tool.name,
1505
- config: safeConfig
1506
- });
1507
- } else {
1508
- const { execute: _e, configSchema: _cs, config: _c, type: _t, ...definition } = tool;
1509
- sources.push({
1510
- type: "function",
1511
- definition,
1512
- run: async () => {
1513
- throw new Error(`No executor registered for tool "${tool.name}"`);
1514
- }
1515
- });
1516
- }
1517
- }
1518
- }
1519
- return sources;
1520
- }
1521
- async function executeToolCall(toolCall, sources, context, hooks) {
1522
- const source = findToolSource(sources, toolCall.name);
1523
- if (!source) {
1524
- getLogger3().warn(`AgentTask: Unknown tool "${toolCall.name}" \u2014 not found in tool sources`);
1525
- return {
1526
- toolCallId: toolCall.id,
1527
- toolName: toolCall.name,
1528
- output: { error: `Unknown tool: ${toolCall.name}` },
1529
- isError: true
1530
- };
1531
- }
1532
- let effectiveCall = toolCall;
1533
- if (hooks?.beforeToolCall) {
1534
- const decision = await hooks.beforeToolCall(toolCall, source);
1535
- if (decision.action === "deny") {
1536
- return {
1537
- toolCallId: toolCall.id,
1538
- toolName: toolCall.name,
1539
- output: { error: decision.reason ?? "Tool call denied by hook" },
1540
- isError: true
1541
- };
1542
- }
1543
- if (decision.action === "modify") {
1544
- effectiveCall = { ...toolCall, input: decision.input };
1545
- }
1546
- }
1547
- try {
1548
- let output;
1549
- switch (source.type) {
1550
- case "registry": {
1551
- const ctor = getTaskConstructors2(context.registry).get(source.taskType);
1552
- if (!ctor) {
1553
- throw new Error(`Task type "${source.taskType}" not found in TaskRegistry`);
1554
- }
1555
- const taskConfig = source.config ?? {};
1556
- const task = context.own(new ctor({}, taskConfig));
1557
- output = await task.run(effectiveCall.input) ?? {};
1558
- break;
1559
- }
1560
- case "function": {
1561
- output = await source.run(effectiveCall.input);
1562
- break;
1563
- }
1564
- }
1565
- let result = {
1566
- toolCallId: toolCall.id,
1567
- toolName: toolCall.name,
1568
- output,
1569
- isError: false
1570
- };
1571
- if (hooks?.afterToolCall) {
1572
- result = await hooks.afterToolCall(toolCall, result);
1573
- }
1574
- return result;
1575
- } catch (err) {
1576
- const error = err instanceof Error ? err : new Error(String(err));
1577
- if (hooks?.onToolError) {
1578
- const action = await hooks.onToolError(toolCall, error);
1579
- if (action.action === "result") {
1580
- return {
1581
- toolCallId: toolCall.id,
1582
- toolName: toolCall.name,
1583
- output: action.output,
1584
- isError: false
1585
- };
1586
- }
1587
- }
1588
- getLogger3().warn(`AgentTask: Tool "${toolCall.name}" failed: ${error.message}`);
1589
- return {
1590
- toolCallId: toolCall.id,
1591
- toolName: toolCall.name,
1592
- output: { error: error.message },
1593
- isError: true
1594
- };
1595
- }
1596
- }
1597
- async function executeToolCalls(toolCalls, sources, context, hooks, maxConcurrency = 5) {
1598
- const calls = toolCalls;
1599
- if (calls.length === 0)
1600
- return [];
1601
- const concurrency = Math.max(1, Math.min(maxConcurrency, calls.length));
1602
- const results = new Array(calls.length);
1603
- let cursor = 0;
1604
- const workers = Array.from({ length: concurrency }, async () => {
1605
- while (true) {
1606
- if (context.signal.aborted) {
1607
- throw context.signal.reason ?? new TaskAbortedError("The operation was aborted");
1608
- }
1609
- const position = cursor;
1610
- cursor += 1;
1611
- if (position >= calls.length)
1612
- return;
1613
- results[position] = await executeToolCall(calls[position], sources, context, hooks);
1614
- }
1615
- });
1616
- await Promise.all(workers);
1617
- return results;
1618
- }
1619
- function hasToolCalls(toolCalls) {
1620
- return toolCalls !== undefined && toolCalls.length > 0;
1621
- }
1622
- function countAssistantToolUses(messages) {
1623
- let n = 0;
1624
- for (const m of messages) {
1625
- if (m.role !== "assistant")
1626
- continue;
1627
- for (const block of m.content) {
1628
- if (block.type === "tool_use")
1629
- n += 1;
1630
- }
1631
- }
1632
- return n;
1633
- }
1634
-
1635
- // src/task/AgentTask.ts
1636
- var MAX_CONTEXT_MESSAGES = 1000;
1637
- var modelSchema2 = TypeModel("model:ToolCallingTask");
1638
- var AgentInputSchema = {
1639
- type: "object",
1640
- properties: {
1641
- model: modelSchema2,
1642
- prompt: {
1643
- oneOf: [
1644
- { type: "string" },
1645
- {
1646
- type: "array",
1647
- items: {
1648
- type: "object",
1649
- properties: {
1650
- type: { type: "string", enum: ["text", "image", "audio"] }
1651
- },
1652
- required: ["type"],
1653
- additionalProperties: true
1654
- }
1655
- }
1656
- ],
1657
- title: "Prompt",
1658
- description: "The user prompt to start the agent loop. Can be a string or an array of content blocks (text, image, audio)."
1659
- },
1660
- systemPrompt: {
1661
- type: "string",
1662
- title: "System Prompt",
1663
- description: "Optional system instructions for the agent"
1664
- },
1665
- tools: {
1666
- type: "array",
1667
- format: "tasks",
1668
- title: "Tools",
1669
- description: "Tools available to the agent. Each entry is a task type name (string, resolved from TaskRegistry) or a full ToolDefinition object with optional config for configurable tasks.",
1670
- items: {
1671
- oneOf: [
1672
- { type: "string", format: "tasks", description: "Task type name" },
1673
- ToolDefinitionSchema
1674
- ]
1675
- }
1676
- },
1677
- stopTool: {
1678
- type: "string",
1679
- title: "Stop Tool",
1680
- description: "Name of a tool that signals agent completion. When called, the loop ends and the tool input becomes structuredOutput.",
1681
- "x-ui-group": "Configuration"
1682
- },
1683
- maxIterations: {
1684
- type: "number",
1685
- title: "Max Iterations",
1686
- description: "Maximum number of agent loop iterations (default: 10)",
1687
- minimum: 1,
1688
- "x-ui-group": "Configuration"
1689
- },
1690
- maxContextMessages: {
1691
- type: "number",
1692
- title: "Max Context Messages",
1693
- description: "Maximum messages in conversation history. Older messages are trimmed to prevent context overflow.",
1694
- minimum: 3,
1695
- "x-ui-group": "Configuration"
1696
- },
1697
- maxTokens: {
1698
- type: "number",
1699
- title: "Max Tokens",
1700
- description: "Maximum tokens per LLM call",
1701
- minimum: 1,
1702
- "x-ui-group": "Configuration"
1703
- },
1704
- temperature: {
1705
- type: "number",
1706
- title: "Temperature",
1707
- description: "Sampling temperature for LLM calls",
1708
- minimum: 0,
1709
- maximum: 2,
1710
- "x-ui-group": "Configuration"
1711
- }
1712
- },
1713
- required: ["model", "prompt"],
1714
- additionalProperties: false
1715
- };
1716
- var AgentOutputSchema = {
1717
- type: "object",
1718
- properties: {
1719
- text: {
1720
- type: "string",
1721
- title: "Text",
1722
- description: "The final text response from the agent",
1723
- "x-stream": "append"
1724
- },
1725
- messages: {
1726
- type: "array",
1727
- title: "Messages",
1728
- description: "Full conversation history including all tool calls and results",
1729
- items: {
1730
- type: "object",
1731
- additionalProperties: true
1732
- }
1733
- },
1734
- iterations: {
1735
- type: "number",
1736
- title: "Iterations",
1737
- description: "Number of LLM calls made during the agent loop"
1738
- },
1739
- toolCallCount: {
1740
- type: "number",
1741
- title: "Tool Call Count",
1742
- description: "Total number of tool calls the assistant requested (tool_use blocks in assistant messages)"
1743
- },
1744
- structuredOutput: {
1745
- type: "object",
1746
- title: "Structured Output",
1747
- description: "Present when the agent terminated via a stop tool",
1748
- additionalProperties: true
1749
- }
973
+ } from "@workglow/task-graph";
974
+ function schemaFormat(schema) {
975
+ return typeof schema === "object" && schema !== null && "format" in schema ? schema.format : undefined;
976
+ }
977
+ var aiTaskConfigSchema = {
978
+ type: "object",
979
+ properties: {
980
+ ...TaskConfigSchema["properties"]
1750
981
  },
1751
- required: ["text", "messages", "iterations", "toolCallCount"],
1752
982
  additionalProperties: false
1753
983
  };
1754
984
 
1755
- class AgentTask extends Task2 {
1756
- static type = "AgentTask";
1757
- static category = "AI Agent";
1758
- static title = "Agent";
1759
- static description = "Multi-turn agentic loop that calls an LLM with tools, executes tool calls, and iterates until done";
1760
- static cacheable = false;
1761
- static inputSchema() {
1762
- return AgentInputSchema;
985
+ class AiTask extends Task {
986
+ static type = "AiTask";
987
+ static hasDynamicEntitlements = true;
988
+ static entitlements() {
989
+ return {
990
+ entitlements: [{ id: Entitlements.AI_INFERENCE, reason: "Runs AI model inference" }]
991
+ };
1763
992
  }
1764
- static outputSchema() {
1765
- return AgentOutputSchema;
993
+ entitlements() {
994
+ const base = [
995
+ { id: Entitlements.AI_INFERENCE, reason: "Runs AI model inference" }
996
+ ];
997
+ const runModel = this.runInputData?.model;
998
+ const modelId = typeof runModel === "string" ? runModel : typeof this.defaults.model === "string" ? this.defaults.model : undefined;
999
+ if (modelId) {
1000
+ base.push({
1001
+ id: Entitlements.AI_MODEL,
1002
+ reason: `Uses model ${modelId}`,
1003
+ resources: [modelId]
1004
+ });
1005
+ }
1006
+ return { entitlements: base };
1766
1007
  }
1767
- async execute(input, context) {
1768
- let result;
1769
- for await (const event of this.agentLoop(input, context)) {
1770
- if (event.type === "finish") {
1771
- result = event.data;
1008
+ static configSchema() {
1009
+ return aiTaskConfigSchema;
1010
+ }
1011
+ async execute(input, executeContext) {
1012
+ const model = input.model;
1013
+ if (!model || typeof model !== "object") {
1014
+ throw new TaskConfigurationError2("AiTask: Model was not resolved to ModelConfig - this indicates a bug in the resolution system");
1015
+ }
1016
+ const jobInput = await this.getJobInput(input);
1017
+ const strategy = getAiProviderRegistry().getStrategy(model);
1018
+ const output = await strategy.execute(jobInput, executeContext, this.runConfig.runnerId);
1019
+ if (executeContext.resourceScope) {
1020
+ const registry = getAiProviderRegistry();
1021
+ const provider = registry.getProvider(model.provider);
1022
+ const unloadFn = provider?.getRunFn("UnloadModelTask");
1023
+ if (unloadFn) {
1024
+ const modelPath = model.provider_config?.model_path ?? model.model;
1025
+ const resourceKey = `ai:${model.provider}:${modelPath}`;
1026
+ executeContext.resourceScope.register(resourceKey, async () => {
1027
+ await unloadFn({ model }, model, () => {}, AbortSignal.timeout(30000));
1028
+ });
1029
+ }
1030
+ }
1031
+ return output;
1032
+ }
1033
+ async getJobInput(input) {
1034
+ const model = input.model;
1035
+ const runtype = this.constructor.runtype ?? this.constructor.type;
1036
+ const jobInput = {
1037
+ taskType: runtype,
1038
+ aiProvider: model.provider,
1039
+ taskInput: input
1040
+ };
1041
+ const taskTimeoutMs = this.config.timeout;
1042
+ if (typeof taskTimeoutMs === "number" && taskTimeoutMs > 0) {
1043
+ jobInput.timeoutMs = taskTimeoutMs;
1044
+ }
1045
+ const inputOutputSchema = input.outputSchema;
1046
+ if (inputOutputSchema && typeof inputOutputSchema === "object" && !Array.isArray(inputOutputSchema) && typeof inputOutputSchema.type === "string") {
1047
+ jobInput.outputSchema = inputOutputSchema;
1048
+ } else {
1049
+ const taskOutputSchema = this.outputSchema();
1050
+ if (hasStructuredOutput(taskOutputSchema)) {
1051
+ jobInput.outputSchema = taskOutputSchema;
1772
1052
  }
1773
1053
  }
1774
- if (!result) {
1775
- throw new Error("AgentTask: loop ended without producing output");
1054
+ const sessionId = input.sessionId;
1055
+ if (sessionId) {
1056
+ jobInput.sessionId = sessionId;
1776
1057
  }
1777
- return result;
1058
+ return jobInput;
1778
1059
  }
1779
- async* executeStream(input, context) {
1780
- yield* this.agentLoop(input, context);
1781
- }
1782
- async* agentLoop(input, context) {
1783
- const maxIterations = input.maxIterations ?? 10;
1784
- const hooks = this.config.hooks;
1785
- const maxConcurrency = this.config.maxConcurrency ?? 5;
1786
- const toolSources = this.resolveToolSources(input, context);
1787
- const toolDefs = this.resolveToolDefs(toolSources, input.stopTool);
1788
- const messages = [userMessage(input.prompt)];
1789
- let finalText = "";
1790
- let structuredOutput;
1791
- for (let iteration = 0;iteration < maxIterations; iteration++) {
1792
- if (context.signal.aborted)
1793
- break;
1794
- if (hooks?.onIteration) {
1795
- const action = await hooks.onIteration(iteration, messages, {
1796
- totalToolCalls: countAssistantToolUses(messages)
1797
- });
1798
- if (action.action === "stop")
1799
- break;
1060
+ async createJob(input, queueName) {
1061
+ const jobInput = await this.getJobInput(input);
1062
+ const resolvedQueueName = queueName ?? await this.getDefaultQueueName(input);
1063
+ if (!resolvedQueueName) {
1064
+ throw new TaskConfigurationError2("AiTask: Unable to determine queue for AI provider");
1065
+ }
1066
+ const job = new AiJob({
1067
+ queueName: resolvedQueueName,
1068
+ jobRunId: this.runConfig.runnerId,
1069
+ input: jobInput
1070
+ });
1071
+ return job;
1072
+ }
1073
+ async getDefaultQueueName(input) {
1074
+ const model = input.model;
1075
+ return model?.provider;
1076
+ }
1077
+ async executeReactive(input, output, context) {
1078
+ const model = input.model;
1079
+ if (model && typeof model === "object" && model.provider) {
1080
+ const taskType = this.constructor.runtype ?? this.constructor.type;
1081
+ const reactiveFn = getAiProviderRegistry().getReactiveRunFn(model.provider, taskType);
1082
+ if (reactiveFn) {
1083
+ return reactiveFn(input, output, model);
1800
1084
  }
1801
- await context.updateProgress(Math.round(iteration / maxIterations * 100), `Agent iteration ${iteration + 1}`);
1802
- const contextMessages = this.trimMessages(messages, input.maxContextMessages ?? MAX_CONTEXT_MESSAGES);
1803
- const llmTask = context.own(new ToolCallingTask);
1804
- let iterationText = "";
1805
- let toolCalls = [];
1806
- for await (const event of llmTask.executeStream({
1807
- model: input.model,
1808
- prompt: input.prompt,
1809
- systemPrompt: input.systemPrompt,
1810
- tools: toolDefs,
1811
- messages: contextMessages,
1812
- maxTokens: input.maxTokens,
1813
- temperature: input.temperature
1814
- }, context)) {
1815
- if (event.type === "text-delta") {
1816
- yield { type: "text-delta", port: "text", textDelta: event.textDelta };
1817
- iterationText += event.textDelta;
1818
- } else if (event.type === "object-delta" && event.port === "toolCalls") {
1819
- const items = event.objectDelta;
1820
- for (const item of items) {
1821
- const idx = toolCalls.findIndex((tc) => tc.id === item.id);
1822
- if (idx >= 0)
1823
- toolCalls[idx] = item;
1824
- else
1825
- toolCalls.push(item);
1826
- }
1827
- } else if (event.type === "finish") {
1828
- const data = event.data;
1829
- iterationText = data?.text ?? iterationText;
1830
- if (data?.toolCalls && data.toolCalls.length > 0) {
1831
- toolCalls = data.toolCalls;
1832
- }
1833
- }
1085
+ }
1086
+ return super.executeReactive(input, output, context);
1087
+ }
1088
+ async validateInput(input) {
1089
+ const inputSchema = this.inputSchema();
1090
+ if (typeof inputSchema === "boolean") {
1091
+ if (inputSchema === false) {
1092
+ throw new TaskConfigurationError2(`AiTask: Input schema is 'false' and accepts no inputs`);
1834
1093
  }
1835
- finalText = iterationText;
1836
- messages.push(assistantMessage(iterationText, toolCalls));
1837
- if (input.stopTool) {
1838
- const stopCall = toolCalls.find((tc) => tc.name === input.stopTool);
1839
- if (stopCall) {
1840
- structuredOutput = stopCall.input;
1841
- break;
1094
+ return true;
1095
+ }
1096
+ const modelTaskProperties = Object.entries(inputSchema.properties || {}).filter(([key, schema]) => schemaFormat(schema)?.startsWith("model:"));
1097
+ for (const [key] of modelTaskProperties) {
1098
+ const model = input[key];
1099
+ if (typeof model === "object" && model !== null) {
1100
+ const tasks = model.tasks;
1101
+ if (Array.isArray(tasks) && tasks.length > 0 && !tasks.includes(this.type)) {
1102
+ const modelId = model.model_id ?? "(inline config)";
1103
+ throw new TaskConfigurationError2(`AiTask: Model "${modelId}" for '${key}' is not compatible with task '${this.type}'. ` + `Model supports: [${tasks.join(", ")}]`);
1842
1104
  }
1105
+ } else if (model !== undefined && model !== null) {
1106
+ throw new TaskConfigurationError2(`AiTask: Invalid model for '${key}' - expected ModelConfig object but got ${typeof model}. ` + `Ensure the model ID was registered in the ModelRepository before running the task.`);
1843
1107
  }
1844
- if (!hasToolCalls(toolCalls)) {
1845
- break;
1846
- }
1847
- const results = await executeToolCalls(toolCalls, toolSources, context, hooks, maxConcurrency);
1848
- messages.push(toolMessage(results));
1849
1108
  }
1850
- const output = {
1851
- text: finalText,
1852
- messages,
1853
- iterations: messages.filter((m) => m.role === "assistant").length,
1854
- toolCallCount: countAssistantToolUses(messages),
1855
- ...structuredOutput !== undefined ? { structuredOutput } : {}
1856
- };
1857
- yield { type: "finish", data: output };
1858
- }
1859
- resolveToolSources(input, context) {
1860
- return buildToolSources(input.tools, context.registry);
1861
- }
1862
- resolveToolDefs(toolSources, stopTool) {
1863
- const defs = toolSourceDefinitions(toolSources);
1864
- if (stopTool && !defs.some((d) => d.name === stopTool)) {
1865
- defs.push({
1866
- name: stopTool,
1867
- description: "Call this tool when you have completed the task. Pass your final structured result as the input.",
1868
- inputSchema: { type: "object", additionalProperties: true }
1869
- });
1109
+ const modelPlainProperties = Object.entries(inputSchema.properties || {}).filter(([key, schema]) => schemaFormat(schema) === "model");
1110
+ for (const [key] of modelPlainProperties) {
1111
+ const model = input[key];
1112
+ if (model !== undefined && model !== null && typeof model !== "object") {
1113
+ throw new TaskConfigurationError2(`AiTask: Invalid model for '${key}' - expected ModelConfig object but got ${typeof model}. ` + `Ensure the model ID was registered in the ModelRepository before running the task.`);
1114
+ }
1870
1115
  }
1871
- return defs;
1116
+ return super.validateInput(input);
1872
1117
  }
1873
- trimMessages(messages, maxContextMessages) {
1874
- if (!maxContextMessages || messages.length <= maxContextMessages) {
1875
- return messages;
1118
+ async narrowInput(input, registry) {
1119
+ const inputSchema = this.inputSchema();
1120
+ if (typeof inputSchema === "boolean") {
1121
+ if (inputSchema === false) {
1122
+ throw new TaskConfigurationError2(`AiTask: Input schema is 'false' and accepts no inputs`);
1123
+ }
1124
+ return input;
1876
1125
  }
1877
- getLogger4().debug(`AgentTask: Trimming context from ${messages.length} to ${maxContextMessages} messages`);
1878
- const tail = messages.slice(1);
1879
- let startIdx = tail.length - (maxContextMessages - 1);
1880
- if (startIdx < 0)
1881
- startIdx = 0;
1882
- while (startIdx > 0 && startIdx < tail.length && tail[startIdx].role === "tool") {
1883
- startIdx -= 1;
1126
+ const modelTaskProperties = Object.entries(inputSchema.properties || {}).filter(([key, schema]) => schemaFormat(schema)?.startsWith("model:"));
1127
+ if (modelTaskProperties.length > 0) {
1128
+ const modelRepo = registry.get(MODEL_REPOSITORY);
1129
+ const taskModels = await modelRepo.findModelsByTask(this.type) ?? [];
1130
+ for (const [key] of modelTaskProperties) {
1131
+ const requestedModel = input[key];
1132
+ if (typeof requestedModel === "string") {
1133
+ const found = taskModels?.find((m) => m.model_id === requestedModel);
1134
+ if (!found) {
1135
+ input[key] = undefined;
1136
+ }
1137
+ } else if (typeof requestedModel === "object" && requestedModel !== null) {
1138
+ const model = requestedModel;
1139
+ const tasks = model.tasks;
1140
+ if (Array.isArray(tasks) && tasks.length > 0 && !tasks.includes(this.type)) {
1141
+ input[key] = undefined;
1142
+ }
1143
+ }
1144
+ }
1884
1145
  }
1885
- return [messages[0], ...tail.slice(startIdx)];
1146
+ return input;
1886
1147
  }
1887
1148
  }
1888
- var agent = (input, config) => {
1889
- return new AgentTask(config).run(input);
1890
- };
1891
- Workflow2.prototype.agent = CreateWorkflow2(AgentTask);
1892
-
1893
- // src/task/BackgroundRemovalTask.ts
1894
- import { CreateWorkflow as CreateWorkflow3, Workflow as Workflow3 } from "@workglow/task-graph";
1895
1149
 
1896
1150
  // src/task/base/AiVisionTask.ts
1897
- import { convertImageDataToUseableForm } from "@workglow/util/media";
1898
1151
  class AiVisionTask extends AiTask {
1899
1152
  static type = "AiVisionTask";
1900
1153
  async getJobInput(input) {
@@ -1915,7 +1168,7 @@ class AiVisionTask extends AiTask {
1915
1168
  }
1916
1169
 
1917
1170
  // src/task/BackgroundRemovalTask.ts
1918
- var modelSchema3 = TypeModel("model:BackgroundRemovalTask");
1171
+ var modelSchema = TypeModel("model:BackgroundRemovalTask");
1919
1172
  var processedImageSchema = {
1920
1173
  type: "string",
1921
1174
  contentEncoding: "base64",
@@ -1927,7 +1180,7 @@ var BackgroundRemovalInputSchema = {
1927
1180
  type: "object",
1928
1181
  properties: {
1929
1182
  image: TypeImageInput,
1930
- model: modelSchema3
1183
+ model: modelSchema
1931
1184
  },
1932
1185
  required: ["image", "model"],
1933
1186
  additionalProperties: false
@@ -1956,22 +1209,22 @@ class BackgroundRemovalTask extends AiVisionTask {
1956
1209
  var backgroundRemoval = (input, config) => {
1957
1210
  return new BackgroundRemovalTask(config).run(input);
1958
1211
  };
1959
- Workflow3.prototype.backgroundRemoval = CreateWorkflow3(BackgroundRemovalTask);
1212
+ Workflow.prototype.backgroundRemoval = CreateWorkflow(BackgroundRemovalTask);
1960
1213
 
1961
1214
  // src/task/ChunkRetrievalTask.ts
1962
1215
  import { TypeKnowledgeBase } from "@workglow/knowledge-base";
1963
- import { CreateWorkflow as CreateWorkflow5, Task as Task3, Workflow as Workflow5 } from "@workglow/task-graph";
1216
+ import { CreateWorkflow as CreateWorkflow3, Task as Task2, Workflow as Workflow3 } from "@workglow/task-graph";
1964
1217
  import {
1965
1218
  isTypedArray,
1966
1219
  TypedArraySchema as TypedArraySchema2
1967
1220
  } from "@workglow/util/schema";
1968
1221
 
1969
1222
  // src/task/TextEmbeddingTask.ts
1970
- import { CreateWorkflow as CreateWorkflow4, Workflow as Workflow4 } from "@workglow/task-graph";
1223
+ import { CreateWorkflow as CreateWorkflow2, Workflow as Workflow2 } from "@workglow/task-graph";
1971
1224
  import {
1972
1225
  TypedArraySchema
1973
1226
  } from "@workglow/util/schema";
1974
- var modelSchema4 = TypeModel("model:TextEmbeddingTask");
1227
+ var modelSchema2 = TypeModel("model:TextEmbeddingTask");
1975
1228
  var TextEmbeddingInputSchema = {
1976
1229
  type: "object",
1977
1230
  properties: {
@@ -1980,7 +1233,7 @@ var TextEmbeddingInputSchema = {
1980
1233
  title: "Text",
1981
1234
  description: "The text to embed"
1982
1235
  }),
1983
- model: modelSchema4
1236
+ model: modelSchema2
1984
1237
  },
1985
1238
  required: ["text", "model"],
1986
1239
  additionalProperties: false
@@ -2012,7 +1265,7 @@ class TextEmbeddingTask extends AiTask {
2012
1265
  var textEmbedding = async (input, config) => {
2013
1266
  return new TextEmbeddingTask(config).run(input);
2014
1267
  };
2015
- Workflow4.prototype.textEmbedding = CreateWorkflow4(TextEmbeddingTask);
1268
+ Workflow2.prototype.textEmbedding = CreateWorkflow2(TextEmbeddingTask);
2016
1269
 
2017
1270
  // src/task/ChunkRetrievalTask.ts
2018
1271
  var inputSchema = {
@@ -2137,7 +1390,7 @@ var outputSchema = {
2137
1390
  additionalProperties: false
2138
1391
  };
2139
1392
 
2140
- class ChunkRetrievalTask extends Task3 {
1393
+ class ChunkRetrievalTask extends Task2 {
2141
1394
  static type = "ChunkRetrievalTask";
2142
1395
  static category = "RAG";
2143
1396
  static title = "Chunk Retrieval";
@@ -2204,11 +1457,11 @@ class ChunkRetrievalTask extends Task3 {
2204
1457
  var chunkRetrieval = (input, config) => {
2205
1458
  return new ChunkRetrievalTask(config).run(input);
2206
1459
  };
2207
- Workflow5.prototype.chunkRetrieval = CreateWorkflow5(ChunkRetrievalTask);
1460
+ Workflow3.prototype.chunkRetrieval = CreateWorkflow3(ChunkRetrievalTask);
2208
1461
 
2209
1462
  // src/task/ChunkToVectorTask.ts
2210
1463
  import { ChunkRecordSchema } from "@workglow/knowledge-base";
2211
- import { CreateWorkflow as CreateWorkflow6, Task as Task4, Workflow as Workflow6 } from "@workglow/task-graph";
1464
+ import { CreateWorkflow as CreateWorkflow4, Task as Task3, Workflow as Workflow4 } from "@workglow/task-graph";
2212
1465
  import {
2213
1466
  TypedArraySchema as TypedArraySchema3
2214
1467
  } from "@workglow/util/schema";
@@ -2283,7 +1536,7 @@ var outputSchema2 = {
2283
1536
  additionalProperties: false
2284
1537
  };
2285
1538
 
2286
- class ChunkToVectorTask extends Task4 {
1539
+ class ChunkToVectorTask extends Task3 {
2287
1540
  static type = "ChunkToVectorTask";
2288
1541
  static category = "Document";
2289
1542
  static title = "Chunk to Vector";
@@ -2334,11 +1587,11 @@ class ChunkToVectorTask extends Task4 {
2334
1587
  var chunkToVector = (input, config) => {
2335
1588
  return new ChunkToVectorTask(config).run(input);
2336
1589
  };
2337
- Workflow6.prototype.chunkToVector = CreateWorkflow6(ChunkToVectorTask);
1590
+ Workflow4.prototype.chunkToVector = CreateWorkflow4(ChunkToVectorTask);
2338
1591
 
2339
1592
  // src/task/ChunkVectorHybridSearchTask.ts
2340
1593
  import { TypeKnowledgeBase as TypeKnowledgeBase2 } from "@workglow/knowledge-base";
2341
- import { CreateWorkflow as CreateWorkflow7, Task as Task5, Workflow as Workflow7 } from "@workglow/task-graph";
1594
+ import { CreateWorkflow as CreateWorkflow5, Task as Task4, Workflow as Workflow5 } from "@workglow/task-graph";
2342
1595
  import {
2343
1596
  TypedArraySchema as TypedArraySchema4
2344
1597
  } from "@workglow/util/schema";
@@ -2451,7 +1704,7 @@ var outputSchema3 = {
2451
1704
  additionalProperties: false
2452
1705
  };
2453
1706
 
2454
- class ChunkVectorHybridSearchTask extends Task5 {
1707
+ class ChunkVectorHybridSearchTask extends Task4 {
2455
1708
  static type = "ChunkVectorHybridSearchTask";
2456
1709
  static category = "RAG";
2457
1710
  static title = "Hybrid Search";
@@ -2504,11 +1757,11 @@ class ChunkVectorHybridSearchTask extends Task5 {
2504
1757
  var hybridSearch = async (input, config) => {
2505
1758
  return new ChunkVectorHybridSearchTask(config).run(input);
2506
1759
  };
2507
- Workflow7.prototype.hybridSearch = CreateWorkflow7(ChunkVectorHybridSearchTask);
1760
+ Workflow5.prototype.hybridSearch = CreateWorkflow5(ChunkVectorHybridSearchTask);
2508
1761
 
2509
1762
  // src/task/ChunkVectorSearchTask.ts
2510
1763
  import { TypeKnowledgeBase as TypeKnowledgeBase3 } from "@workglow/knowledge-base";
2511
- import { CreateWorkflow as CreateWorkflow8, Task as Task6, Workflow as Workflow8 } from "@workglow/task-graph";
1764
+ import { CreateWorkflow as CreateWorkflow6, Task as Task5, Workflow as Workflow6 } from "@workglow/task-graph";
2512
1765
  import {
2513
1766
  TypedArraySchema as TypedArraySchema5
2514
1767
  } from "@workglow/util/schema";
@@ -2591,7 +1844,7 @@ var outputSchema4 = {
2591
1844
  additionalProperties: false
2592
1845
  };
2593
1846
 
2594
- class ChunkVectorSearchTask extends Task6 {
1847
+ class ChunkVectorSearchTask extends Task5 {
2595
1848
  static type = "ChunkVectorSearchTask";
2596
1849
  static category = "Vector Store";
2597
1850
  static title = "Vector Store Search";
@@ -2623,11 +1876,11 @@ class ChunkVectorSearchTask extends Task6 {
2623
1876
  var vectorStoreSearch = (input, config) => {
2624
1877
  return new ChunkVectorSearchTask(config).run(input);
2625
1878
  };
2626
- Workflow8.prototype.vectorStoreSearch = CreateWorkflow8(ChunkVectorSearchTask);
1879
+ Workflow6.prototype.vectorStoreSearch = CreateWorkflow6(ChunkVectorSearchTask);
2627
1880
 
2628
1881
  // src/task/ChunkVectorUpsertTask.ts
2629
1882
  import { TypeKnowledgeBase as TypeKnowledgeBase4 } from "@workglow/knowledge-base";
2630
- import { CreateWorkflow as CreateWorkflow9, Task as Task7, Workflow as Workflow9 } from "@workglow/task-graph";
1883
+ import { CreateWorkflow as CreateWorkflow7, Task as Task6, Workflow as Workflow7 } from "@workglow/task-graph";
2631
1884
  import {
2632
1885
  TypedArraySchema as TypedArraySchema6
2633
1886
  } from "@workglow/util/schema";
@@ -2681,7 +1934,7 @@ var outputSchema5 = {
2681
1934
  additionalProperties: false
2682
1935
  };
2683
1936
 
2684
- class ChunkVectorUpsertTask extends Task7 {
1937
+ class ChunkVectorUpsertTask extends Task6 {
2685
1938
  static type = "ChunkVectorUpsertTask";
2686
1939
  static category = "Vector Store";
2687
1940
  static title = "Add to Vector Store";
@@ -2741,15 +1994,15 @@ class ChunkVectorUpsertTask extends Task7 {
2741
1994
  var chunkVectorUpsert = (input, config) => {
2742
1995
  return new ChunkVectorUpsertTask(config).run(input);
2743
1996
  };
2744
- Workflow9.prototype.chunkVectorUpsert = CreateWorkflow9(ChunkVectorUpsertTask);
1997
+ Workflow7.prototype.chunkVectorUpsert = CreateWorkflow7(ChunkVectorUpsertTask);
2745
1998
 
2746
1999
  // src/task/ContextBuilderTask.ts
2747
2000
  import { estimateTokens } from "@workglow/knowledge-base";
2748
- import { CreateWorkflow as CreateWorkflow11, Task as Task8, Workflow as Workflow11 } from "@workglow/task-graph";
2001
+ import { CreateWorkflow as CreateWorkflow9, Task as Task7, Workflow as Workflow9 } from "@workglow/task-graph";
2749
2002
 
2750
2003
  // src/task/CountTokensTask.ts
2751
- import { CreateWorkflow as CreateWorkflow10, Workflow as Workflow10 } from "@workglow/task-graph";
2752
- var modelSchema5 = TypeModel("model");
2004
+ import { CreateWorkflow as CreateWorkflow8, Workflow as Workflow8 } from "@workglow/task-graph";
2005
+ var modelSchema3 = TypeModel("model");
2753
2006
  var CountTokensInputSchema = {
2754
2007
  type: "object",
2755
2008
  properties: {
@@ -2758,7 +2011,7 @@ var CountTokensInputSchema = {
2758
2011
  title: "Text",
2759
2012
  description: "The text to count tokens for"
2760
2013
  },
2761
- model: modelSchema5
2014
+ model: modelSchema3
2762
2015
  },
2763
2016
  required: ["text", "model"],
2764
2017
  additionalProperties: false
@@ -2792,7 +2045,7 @@ class CountTokensTask extends AiTask {
2792
2045
  var countTokens = async (input, config) => {
2793
2046
  return new CountTokensTask(config).run(input);
2794
2047
  };
2795
- Workflow10.prototype.countTokens = CreateWorkflow10(CountTokensTask);
2048
+ Workflow8.prototype.countTokens = CreateWorkflow8(CountTokensTask);
2796
2049
 
2797
2050
  // src/task/ContextBuilderTask.ts
2798
2051
  var ContextFormat = {
@@ -2802,7 +2055,7 @@ var ContextFormat = {
2802
2055
  MARKDOWN: "markdown",
2803
2056
  JSON: "json"
2804
2057
  };
2805
- var modelSchema6 = TypeModel("model", {
2058
+ var modelSchema4 = TypeModel("model", {
2806
2059
  title: "Model",
2807
2060
  description: "Model to use for token counting (optional, falls back to estimation)"
2808
2061
  });
@@ -2866,7 +2119,7 @@ var inputSchema6 = {
2866
2119
 
2867
2120
  `
2868
2121
  },
2869
- model: modelSchema6
2122
+ model: modelSchema4
2870
2123
  },
2871
2124
  required: ["chunks"],
2872
2125
  additionalProperties: false
@@ -2899,7 +2152,7 @@ var outputSchema6 = {
2899
2152
  additionalProperties: false
2900
2153
  };
2901
2154
 
2902
- class ContextBuilderTask extends Task8 {
2155
+ class ContextBuilderTask extends Task7 {
2903
2156
  static type = "ContextBuilderTask";
2904
2157
  static category = "RAG";
2905
2158
  static title = "Context Builder";
@@ -3092,15 +2345,15 @@ class ContextBuilderTask extends Task8 {
3092
2345
  var contextBuilder = (input, config) => {
3093
2346
  return new ContextBuilderTask(config).run(input);
3094
2347
  };
3095
- Workflow11.prototype.contextBuilder = CreateWorkflow11(ContextBuilderTask);
2348
+ Workflow9.prototype.contextBuilder = CreateWorkflow9(ContextBuilderTask);
3096
2349
 
3097
2350
  // src/task/DocumentEnricherTask.ts
3098
2351
  import { getChildren, hasChildren } from "@workglow/knowledge-base";
3099
- import { CreateWorkflow as CreateWorkflow14, Task as Task9, Workflow as Workflow14 } from "@workglow/task-graph";
2352
+ import { CreateWorkflow as CreateWorkflow12, Task as Task8, Workflow as Workflow12 } from "@workglow/task-graph";
3100
2353
 
3101
2354
  // src/task/TextNamedEntityRecognitionTask.ts
3102
- import { CreateWorkflow as CreateWorkflow12, Workflow as Workflow12 } from "@workglow/task-graph";
3103
- var modelSchema7 = TypeModel("model:TextNamedEntityRecognitionTask");
2355
+ import { CreateWorkflow as CreateWorkflow10, Workflow as Workflow10 } from "@workglow/task-graph";
2356
+ var modelSchema5 = TypeModel("model:TextNamedEntityRecognitionTask");
3104
2357
  var TextNamedEntityRecognitionInputSchema = {
3105
2358
  type: "object",
3106
2359
  properties: {
@@ -3119,7 +2372,7 @@ var TextNamedEntityRecognitionInputSchema = {
3119
2372
  "x-ui-group": "Configuration",
3120
2373
  "x-ui-group-open": false
3121
2374
  },
3122
- model: modelSchema7
2375
+ model: modelSchema5
3123
2376
  },
3124
2377
  required: ["text", "model"],
3125
2378
  additionalProperties: false
@@ -3174,11 +2427,48 @@ class TextNamedEntityRecognitionTask extends AiTask {
3174
2427
  var textNamedEntityRecognition = (input, config) => {
3175
2428
  return new TextNamedEntityRecognitionTask(config).run(input);
3176
2429
  };
3177
- Workflow12.prototype.textNamedEntityRecognition = CreateWorkflow12(TextNamedEntityRecognitionTask);
2430
+ Workflow10.prototype.textNamedEntityRecognition = CreateWorkflow10(TextNamedEntityRecognitionTask);
2431
+
2432
+ // src/task/TextSummaryTask.ts
2433
+ import { CreateWorkflow as CreateWorkflow11, Workflow as Workflow11 } from "@workglow/task-graph";
2434
+
2435
+ // src/task/base/StreamingAiTask.ts
2436
+ import { getStreamingPorts, TaskConfigurationError as TaskConfigurationError3 } from "@workglow/task-graph";
2437
+ class StreamingAiTask extends AiTask {
2438
+ static type = "StreamingAiTask";
2439
+ async* executeStream(input, context) {
2440
+ const model = input.model;
2441
+ if (!model || typeof model !== "object") {
2442
+ throw new TaskConfigurationError3("StreamingAiTask: Model was not resolved to ModelConfig - this indicates a bug in the resolution system");
2443
+ }
2444
+ const jobInput = await this.getJobInput(input);
2445
+ const strategy = getAiProviderRegistry().getStrategy(model);
2446
+ const outSchema = this.outputSchema();
2447
+ const ports = getStreamingPorts(outSchema);
2448
+ let defaultPort = "text";
2449
+ if (ports.length > 0) {
2450
+ defaultPort = ports[0].port;
2451
+ } else {
2452
+ if (typeof outSchema === "object" && outSchema.properties) {
2453
+ const firstProp = Object.keys(outSchema.properties)[0];
2454
+ if (firstProp)
2455
+ defaultPort = firstProp;
2456
+ }
2457
+ }
2458
+ for await (const event of strategy.executeStream(jobInput, context, this.runConfig.runnerId)) {
2459
+ if (event.type === "text-delta") {
2460
+ yield { ...event, port: event.port ?? defaultPort };
2461
+ } else if (event.type === "object-delta") {
2462
+ yield { ...event, port: event.port ?? defaultPort };
2463
+ } else {
2464
+ yield event;
2465
+ }
2466
+ }
2467
+ }
2468
+ }
3178
2469
 
3179
2470
  // src/task/TextSummaryTask.ts
3180
- import { CreateWorkflow as CreateWorkflow13, Workflow as Workflow13 } from "@workglow/task-graph";
3181
- var modelSchema8 = TypeModel("model:TextSummaryTask");
2471
+ var modelSchema6 = TypeModel("model:TextSummaryTask");
3182
2472
  var TextSummaryInputSchema = {
3183
2473
  type: "object",
3184
2474
  properties: {
@@ -3187,7 +2477,7 @@ var TextSummaryInputSchema = {
3187
2477
  title: "Text",
3188
2478
  description: "The text to summarize"
3189
2479
  },
3190
- model: modelSchema8
2480
+ model: modelSchema6
3191
2481
  },
3192
2482
  required: ["text", "model"],
3193
2483
  additionalProperties: false
@@ -3221,7 +2511,7 @@ class TextSummaryTask extends StreamingAiTask {
3221
2511
  var textSummary = async (input, config) => {
3222
2512
  return new TextSummaryTask(config).run(input);
3223
2513
  };
3224
- Workflow13.prototype.textSummary = CreateWorkflow13(TextSummaryTask);
2514
+ Workflow11.prototype.textSummary = CreateWorkflow11(TextSummaryTask);
3225
2515
 
3226
2516
  // src/task/DocumentEnricherTask.ts
3227
2517
  var inputSchema7 = {
@@ -3295,7 +2585,7 @@ var outputSchema7 = {
3295
2585
  additionalProperties: false
3296
2586
  };
3297
2587
 
3298
- class DocumentEnricherTask extends Task9 {
2588
+ class DocumentEnricherTask extends Task8 {
3299
2589
  static type = "DocumentEnricherTask";
3300
2590
  static category = "Document";
3301
2591
  static title = "Document Enricher";
@@ -3454,12 +2744,12 @@ class DocumentEnricherTask extends Task9 {
3454
2744
  var documentEnricher = (input, config) => {
3455
2745
  return new DocumentEnricherTask(config).run(input);
3456
2746
  };
3457
- Workflow14.prototype.documentEnricher = CreateWorkflow14(DocumentEnricherTask);
2747
+ Workflow12.prototype.documentEnricher = CreateWorkflow12(DocumentEnricherTask);
3458
2748
 
3459
2749
  // src/task/DocumentUpsertTask.ts
3460
2750
  import { Document, TypeKnowledgeBase as TypeKnowledgeBase5 } from "@workglow/knowledge-base";
3461
2751
  import { DocumentMetadataSchema } from "@workglow/knowledge-base";
3462
- import { CreateWorkflow as CreateWorkflow15, Task as Task10, Workflow as Workflow15 } from "@workglow/task-graph";
2752
+ import { CreateWorkflow as CreateWorkflow13, Task as Task9, Workflow as Workflow13 } from "@workglow/task-graph";
3463
2753
  var inputSchema8 = {
3464
2754
  type: "object",
3465
2755
  properties: {
@@ -3504,7 +2794,7 @@ var outputSchema8 = {
3504
2794
  additionalProperties: false
3505
2795
  };
3506
2796
 
3507
- class DocumentUpsertTask extends Task10 {
2797
+ class DocumentUpsertTask extends Task9 {
3508
2798
  static type = "DocumentUpsertTask";
3509
2799
  static category = "Vector Store";
3510
2800
  static title = "Add Document";
@@ -3537,15 +2827,15 @@ class DocumentUpsertTask extends Task10 {
3537
2827
  var documentUpsert = (input, config) => {
3538
2828
  return new DocumentUpsertTask(config).run(input);
3539
2829
  };
3540
- Workflow15.prototype.documentUpsert = CreateWorkflow15(DocumentUpsertTask);
2830
+ Workflow13.prototype.documentUpsert = CreateWorkflow13(DocumentUpsertTask);
3541
2831
 
3542
2832
  // src/task/DownloadModelTask.ts
3543
- import { CreateWorkflow as CreateWorkflow16, Workflow as Workflow16 } from "@workglow/task-graph";
3544
- var modelSchema9 = TypeModel("model");
2833
+ import { CreateWorkflow as CreateWorkflow14, Workflow as Workflow14 } from "@workglow/task-graph";
2834
+ var modelSchema7 = TypeModel("model");
3545
2835
  var DownloadModelInputSchema = {
3546
2836
  type: "object",
3547
2837
  properties: {
3548
- model: modelSchema9
2838
+ model: modelSchema7
3549
2839
  },
3550
2840
  required: ["model"],
3551
2841
  additionalProperties: false
@@ -3553,7 +2843,7 @@ var DownloadModelInputSchema = {
3553
2843
  var DownloadModelOutputSchema = {
3554
2844
  type: "object",
3555
2845
  properties: {
3556
- model: modelSchema9
2846
+ model: modelSchema7
3557
2847
  },
3558
2848
  required: ["model"],
3559
2849
  additionalProperties: false
@@ -3607,11 +2897,11 @@ class DownloadModelTask extends AiTask {
3607
2897
  var downloadModel = (input, config) => {
3608
2898
  return new DownloadModelTask(config).run(input);
3609
2899
  };
3610
- Workflow16.prototype.downloadModel = CreateWorkflow16(DownloadModelTask);
2900
+ Workflow14.prototype.downloadModel = CreateWorkflow14(DownloadModelTask);
3611
2901
 
3612
2902
  // src/task/FaceDetectorTask.ts
3613
- import { CreateWorkflow as CreateWorkflow17, Workflow as Workflow17 } from "@workglow/task-graph";
3614
- var modelSchema10 = TypeModel("model:FaceDetectorTask");
2903
+ import { CreateWorkflow as CreateWorkflow15, Workflow as Workflow15 } from "@workglow/task-graph";
2904
+ var modelSchema8 = TypeModel("model:FaceDetectorTask");
3615
2905
  var TypeBoundingBox2 = {
3616
2906
  type: "object",
3617
2907
  properties: {
@@ -3684,7 +2974,7 @@ var FaceDetectorInputSchema = {
3684
2974
  type: "object",
3685
2975
  properties: {
3686
2976
  image: TypeImageInput,
3687
- model: modelSchema10,
2977
+ model: modelSchema8,
3688
2978
  minDetectionConfidence: {
3689
2979
  type: "number",
3690
2980
  minimum: 0,
@@ -3738,11 +3028,11 @@ class FaceDetectorTask extends AiVisionTask {
3738
3028
  var faceDetector = (input, config) => {
3739
3029
  return new FaceDetectorTask(config).run(input);
3740
3030
  };
3741
- Workflow17.prototype.faceDetector = CreateWorkflow17(FaceDetectorTask);
3031
+ Workflow15.prototype.faceDetector = CreateWorkflow15(FaceDetectorTask);
3742
3032
 
3743
3033
  // src/task/FaceLandmarkerTask.ts
3744
- import { CreateWorkflow as CreateWorkflow18, Workflow as Workflow18 } from "@workglow/task-graph";
3745
- var modelSchema11 = TypeModel("model:FaceLandmarkerTask");
3034
+ import { CreateWorkflow as CreateWorkflow16, Workflow as Workflow16 } from "@workglow/task-graph";
3035
+ var modelSchema9 = TypeModel("model:FaceLandmarkerTask");
3746
3036
  var TypeLandmark = {
3747
3037
  type: "object",
3748
3038
  properties: {
@@ -3814,7 +3104,7 @@ var FaceLandmarkerInputSchema = {
3814
3104
  type: "object",
3815
3105
  properties: {
3816
3106
  image: TypeImageInput,
3817
- model: modelSchema11,
3107
+ model: modelSchema9,
3818
3108
  numFaces: {
3819
3109
  type: "number",
3820
3110
  minimum: 1,
@@ -3900,11 +3190,11 @@ class FaceLandmarkerTask extends AiVisionTask {
3900
3190
  var faceLandmarker = (input, config) => {
3901
3191
  return new FaceLandmarkerTask(config).run(input);
3902
3192
  };
3903
- Workflow18.prototype.faceLandmarker = CreateWorkflow18(FaceLandmarkerTask);
3193
+ Workflow16.prototype.faceLandmarker = CreateWorkflow16(FaceLandmarkerTask);
3904
3194
 
3905
3195
  // src/task/GestureRecognizerTask.ts
3906
- import { CreateWorkflow as CreateWorkflow19, Workflow as Workflow19 } from "@workglow/task-graph";
3907
- var modelSchema12 = TypeModel("model:GestureRecognizerTask");
3196
+ import { CreateWorkflow as CreateWorkflow17, Workflow as Workflow17 } from "@workglow/task-graph";
3197
+ var modelSchema10 = TypeModel("model:GestureRecognizerTask");
3908
3198
  var TypeLandmark2 = {
3909
3199
  type: "object",
3910
3200
  properties: {
@@ -3996,7 +3286,7 @@ var GestureRecognizerInputSchema = {
3996
3286
  type: "object",
3997
3287
  properties: {
3998
3288
  image: TypeImageInput,
3999
- model: modelSchema12,
3289
+ model: modelSchema10,
4000
3290
  numHands: {
4001
3291
  type: "number",
4002
3292
  minimum: 1,
@@ -4068,11 +3358,11 @@ class GestureRecognizerTask extends AiVisionTask {
4068
3358
  var gestureRecognizer = (input, config) => {
4069
3359
  return new GestureRecognizerTask(config).run(input);
4070
3360
  };
4071
- Workflow19.prototype.gestureRecognizer = CreateWorkflow19(GestureRecognizerTask);
3361
+ Workflow17.prototype.gestureRecognizer = CreateWorkflow17(GestureRecognizerTask);
4072
3362
 
4073
3363
  // src/task/HandLandmarkerTask.ts
4074
- import { CreateWorkflow as CreateWorkflow20, Workflow as Workflow20 } from "@workglow/task-graph";
4075
- var modelSchema13 = TypeModel("model:HandLandmarkerTask");
3364
+ import { CreateWorkflow as CreateWorkflow18, Workflow as Workflow18 } from "@workglow/task-graph";
3365
+ var modelSchema11 = TypeModel("model:HandLandmarkerTask");
4076
3366
  var TypeLandmark3 = {
4077
3367
  type: "object",
4078
3368
  properties: {
@@ -4141,7 +3431,7 @@ var HandLandmarkerInputSchema = {
4141
3431
  type: "object",
4142
3432
  properties: {
4143
3433
  image: TypeImageInput,
4144
- model: modelSchema13,
3434
+ model: modelSchema11,
4145
3435
  numHands: {
4146
3436
  type: "number",
4147
3437
  minimum: 1,
@@ -4213,7 +3503,7 @@ class HandLandmarkerTask extends AiVisionTask {
4213
3503
  var handLandmarker = (input, config) => {
4214
3504
  return new HandLandmarkerTask(config).run(input);
4215
3505
  };
4216
- Workflow20.prototype.handLandmarker = CreateWorkflow20(HandLandmarkerTask);
3506
+ Workflow18.prototype.handLandmarker = CreateWorkflow18(HandLandmarkerTask);
4217
3507
 
4218
3508
  // src/task/HierarchicalChunkerTask.ts
4219
3509
  import {
@@ -4222,9 +3512,9 @@ import {
4222
3512
  getChildren as getChildren2,
4223
3513
  hasChildren as hasChildren2
4224
3514
  } from "@workglow/knowledge-base";
4225
- import { CreateWorkflow as CreateWorkflow21, Task as Task11, Workflow as Workflow21 } from "@workglow/task-graph";
3515
+ import { CreateWorkflow as CreateWorkflow19, Task as Task10, Workflow as Workflow19 } from "@workglow/task-graph";
4226
3516
  import { uuid4 } from "@workglow/util";
4227
- var modelSchema14 = TypeModel("model", {
3517
+ var modelSchema12 = TypeModel("model", {
4228
3518
  title: "Model",
4229
3519
  description: "Model to use for token counting"
4230
3520
  });
@@ -4270,7 +3560,7 @@ var inputSchema9 = {
4270
3560
  description: "Strategy for chunking",
4271
3561
  default: "hierarchical"
4272
3562
  },
4273
- model: modelSchema14
3563
+ model: modelSchema12
4274
3564
  },
4275
3565
  required: ["doc_id", "documentTree"],
4276
3566
  additionalProperties: false
@@ -4305,7 +3595,7 @@ var outputSchema9 = {
4305
3595
  additionalProperties: false
4306
3596
  };
4307
3597
 
4308
- class HierarchicalChunkerTask extends Task11 {
3598
+ class HierarchicalChunkerTask extends Task10 {
4309
3599
  static type = "HierarchicalChunkerTask";
4310
3600
  static category = "Document";
4311
3601
  static title = "Hierarchical Chunker";
@@ -4449,11 +3739,11 @@ class HierarchicalChunkerTask extends Task11 {
4449
3739
  var hierarchicalChunker = (input, config) => {
4450
3740
  return new HierarchicalChunkerTask(config).run(input);
4451
3741
  };
4452
- Workflow21.prototype.hierarchicalChunker = CreateWorkflow21(HierarchicalChunkerTask);
3742
+ Workflow19.prototype.hierarchicalChunker = CreateWorkflow19(HierarchicalChunkerTask);
4453
3743
 
4454
3744
  // src/task/HierarchyJoinTask.ts
4455
3745
  import { ChunkRecordArraySchema, TypeKnowledgeBase as TypeKnowledgeBase6 } from "@workglow/knowledge-base";
4456
- import { CreateWorkflow as CreateWorkflow22, Task as Task12, Workflow as Workflow22 } from "@workglow/task-graph";
3746
+ import { CreateWorkflow as CreateWorkflow20, Task as Task11, Workflow as Workflow20 } from "@workglow/task-graph";
4457
3747
  var inputSchema10 = {
4458
3748
  type: "object",
4459
3749
  properties: {
@@ -4528,7 +3818,7 @@ var outputSchema10 = {
4528
3818
  additionalProperties: false
4529
3819
  };
4530
3820
 
4531
- class HierarchyJoinTask extends Task12 {
3821
+ class HierarchyJoinTask extends Task11 {
4532
3822
  static type = "HierarchyJoinTask";
4533
3823
  static category = "RAG";
4534
3824
  static title = "Hierarchy Join";
@@ -4622,11 +3912,11 @@ class HierarchyJoinTask extends Task12 {
4622
3912
  var hierarchyJoin = (input, config) => {
4623
3913
  return new HierarchyJoinTask(config).run(input);
4624
3914
  };
4625
- Workflow22.prototype.hierarchyJoin = CreateWorkflow22(HierarchyJoinTask);
3915
+ Workflow20.prototype.hierarchyJoin = CreateWorkflow20(HierarchyJoinTask);
4626
3916
 
4627
3917
  // src/task/KbToDocumentsTask.ts
4628
3918
  import { TypeKnowledgeBase as TypeKnowledgeBase7 } from "@workglow/knowledge-base";
4629
- import { CreateWorkflow as CreateWorkflow23, Task as Task13, Workflow as Workflow23 } from "@workglow/task-graph";
3919
+ import { CreateWorkflow as CreateWorkflow21, Task as Task12, Workflow as Workflow21 } from "@workglow/task-graph";
4630
3920
  var inputSchema11 = {
4631
3921
  type: "object",
4632
3922
  properties: {
@@ -4670,7 +3960,7 @@ var outputSchema11 = {
4670
3960
  additionalProperties: false
4671
3961
  };
4672
3962
 
4673
- class KbToDocumentsTask extends Task13 {
3963
+ class KbToDocumentsTask extends Task12 {
4674
3964
  static type = "KbToDocumentsTask";
4675
3965
  static category = "Vector Store";
4676
3966
  static title = "Knowledge Base to Documents";
@@ -4711,16 +4001,16 @@ class KbToDocumentsTask extends Task13 {
4711
4001
  var kbToDocuments = (input, config) => {
4712
4002
  return new KbToDocumentsTask(config).run(input);
4713
4003
  };
4714
- Workflow23.prototype.kbToDocuments = CreateWorkflow23(KbToDocumentsTask);
4004
+ Workflow21.prototype.kbToDocuments = CreateWorkflow21(KbToDocumentsTask);
4715
4005
 
4716
4006
  // src/task/ImageClassificationTask.ts
4717
- import { CreateWorkflow as CreateWorkflow24, Workflow as Workflow24 } from "@workglow/task-graph";
4718
- var modelSchema15 = TypeModel("model:ImageClassificationTask");
4007
+ import { CreateWorkflow as CreateWorkflow22, Workflow as Workflow22 } from "@workglow/task-graph";
4008
+ var modelSchema13 = TypeModel("model:ImageClassificationTask");
4719
4009
  var ImageClassificationInputSchema = {
4720
4010
  type: "object",
4721
4011
  properties: {
4722
4012
  image: TypeImageInput,
4723
- model: modelSchema15,
4013
+ model: modelSchema13,
4724
4014
  categories: {
4725
4015
  type: "array",
4726
4016
  items: {
@@ -4774,19 +4064,19 @@ class ImageClassificationTask extends AiVisionTask {
4774
4064
  var imageClassification = (input, config) => {
4775
4065
  return new ImageClassificationTask(config).run(input);
4776
4066
  };
4777
- Workflow24.prototype.imageClassification = CreateWorkflow24(ImageClassificationTask);
4067
+ Workflow22.prototype.imageClassification = CreateWorkflow22(ImageClassificationTask);
4778
4068
 
4779
4069
  // src/task/ImageEmbeddingTask.ts
4780
- import { CreateWorkflow as CreateWorkflow25, Workflow as Workflow25 } from "@workglow/task-graph";
4070
+ import { CreateWorkflow as CreateWorkflow23, Workflow as Workflow23 } from "@workglow/task-graph";
4781
4071
  import {
4782
4072
  TypedArraySchema as TypedArraySchema7
4783
4073
  } from "@workglow/util/schema";
4784
- var modelSchema16 = TypeModel("model:ImageEmbeddingTask");
4074
+ var modelSchema14 = TypeModel("model:ImageEmbeddingTask");
4785
4075
  var ImageEmbeddingInputSchema = {
4786
4076
  type: "object",
4787
4077
  properties: {
4788
4078
  image: TypeSingleOrArray(TypeImageInput),
4789
- model: modelSchema16
4079
+ model: modelSchema14
4790
4080
  },
4791
4081
  required: ["image", "model"],
4792
4082
  additionalProperties: false
@@ -4818,16 +4108,16 @@ class ImageEmbeddingTask extends AiVisionTask {
4818
4108
  var imageEmbedding = (input, config) => {
4819
4109
  return new ImageEmbeddingTask(config).run(input);
4820
4110
  };
4821
- Workflow25.prototype.imageEmbedding = CreateWorkflow25(ImageEmbeddingTask);
4111
+ Workflow23.prototype.imageEmbedding = CreateWorkflow23(ImageEmbeddingTask);
4822
4112
 
4823
4113
  // src/task/ImageSegmentationTask.ts
4824
- import { CreateWorkflow as CreateWorkflow26, Workflow as Workflow26 } from "@workglow/task-graph";
4825
- var modelSchema17 = TypeModel("model:ImageSegmentationTask");
4114
+ import { CreateWorkflow as CreateWorkflow24, Workflow as Workflow24 } from "@workglow/task-graph";
4115
+ var modelSchema15 = TypeModel("model:ImageSegmentationTask");
4826
4116
  var ImageSegmentationInputSchema = {
4827
4117
  type: "object",
4828
4118
  properties: {
4829
4119
  image: TypeImageInput,
4830
- model: modelSchema17,
4120
+ model: modelSchema15,
4831
4121
  threshold: {
4832
4122
  type: "number",
4833
4123
  title: "Threshold",
@@ -4906,11 +4196,11 @@ class ImageSegmentationTask extends AiVisionTask {
4906
4196
  var imageSegmentation = (input, config) => {
4907
4197
  return new ImageSegmentationTask(config).run(input);
4908
4198
  };
4909
- Workflow26.prototype.imageSegmentation = CreateWorkflow26(ImageSegmentationTask);
4199
+ Workflow24.prototype.imageSegmentation = CreateWorkflow24(ImageSegmentationTask);
4910
4200
 
4911
4201
  // src/task/ImageToTextTask.ts
4912
- import { CreateWorkflow as CreateWorkflow27, Workflow as Workflow27 } from "@workglow/task-graph";
4913
- var modelSchema18 = TypeModel("model:ImageToTextTask");
4202
+ import { CreateWorkflow as CreateWorkflow25, Workflow as Workflow25 } from "@workglow/task-graph";
4203
+ var modelSchema16 = TypeModel("model:ImageToTextTask");
4914
4204
  var generatedTextSchema = {
4915
4205
  type: "string",
4916
4206
  title: "Text",
@@ -4920,7 +4210,7 @@ var ImageToTextInputSchema = {
4920
4210
  type: "object",
4921
4211
  properties: {
4922
4212
  image: TypeImageInput,
4923
- model: modelSchema18,
4213
+ model: modelSchema16,
4924
4214
  maxTokens: {
4925
4215
  type: "number",
4926
4216
  title: "Max Tokens",
@@ -4961,15 +4251,15 @@ class ImageToTextTask extends AiVisionTask {
4961
4251
  var imageToText = (input, config) => {
4962
4252
  return new ImageToTextTask(config).run(input);
4963
4253
  };
4964
- Workflow27.prototype.imageToText = CreateWorkflow27(ImageToTextTask);
4254
+ Workflow25.prototype.imageToText = CreateWorkflow25(ImageToTextTask);
4965
4255
 
4966
4256
  // src/task/ModelInfoTask.ts
4967
- import { CreateWorkflow as CreateWorkflow28, Workflow as Workflow28 } from "@workglow/task-graph";
4968
- var modelSchema19 = TypeModel("model");
4257
+ import { CreateWorkflow as CreateWorkflow26, Workflow as Workflow26 } from "@workglow/task-graph";
4258
+ var modelSchema17 = TypeModel("model");
4969
4259
  var ModelInfoInputSchema = {
4970
4260
  type: "object",
4971
4261
  properties: {
4972
- model: modelSchema19,
4262
+ model: modelSchema17,
4973
4263
  detail: {
4974
4264
  type: "string",
4975
4265
  enum: ["cached_status", "files", "files_with_metadata", "dimensions"],
@@ -4982,7 +4272,7 @@ var ModelInfoInputSchema = {
4982
4272
  var ModelInfoOutputSchema = {
4983
4273
  type: "object",
4984
4274
  properties: {
4985
- model: modelSchema19,
4275
+ model: modelSchema17,
4986
4276
  is_local: { type: "boolean" },
4987
4277
  is_remote: { type: "boolean" },
4988
4278
  supports_browser: { type: "boolean" },
@@ -5040,10 +4330,10 @@ class ModelInfoTask extends AiTask {
5040
4330
  var modelInfo = (input, config) => {
5041
4331
  return new ModelInfoTask(config).run(input);
5042
4332
  };
5043
- Workflow28.prototype.modelInfo = CreateWorkflow28(ModelInfoTask);
4333
+ Workflow26.prototype.modelInfo = CreateWorkflow26(ModelInfoTask);
5044
4334
 
5045
4335
  // src/task/ModelSearchTask.ts
5046
- import { CreateWorkflow as CreateWorkflow29, Task as Task14, Workflow as Workflow29 } from "@workglow/task-graph";
4336
+ import { CreateWorkflow as CreateWorkflow27, Task as Task13, Workflow as Workflow27 } from "@workglow/task-graph";
5047
4337
  var ModelSearchInputSchema = {
5048
4338
  type: "object",
5049
4339
  properties: {
@@ -5108,7 +4398,7 @@ var ModelSearchOutputSchema = {
5108
4398
  additionalProperties: false
5109
4399
  };
5110
4400
 
5111
- class ModelSearchTask extends Task14 {
4401
+ class ModelSearchTask extends Task13 {
5112
4402
  static type = "ModelSearchTask";
5113
4403
  static category = "AI Model";
5114
4404
  static title = "Model Search";
@@ -5134,11 +4424,11 @@ class ModelSearchTask extends Task14 {
5134
4424
  var modelSearch = (input, config) => {
5135
4425
  return new ModelSearchTask(config).run(input);
5136
4426
  };
5137
- Workflow29.prototype.modelSearch = CreateWorkflow29(ModelSearchTask);
4427
+ Workflow27.prototype.modelSearch = CreateWorkflow27(ModelSearchTask);
5138
4428
 
5139
4429
  // src/task/ObjectDetectionTask.ts
5140
- import { CreateWorkflow as CreateWorkflow30, Workflow as Workflow30 } from "@workglow/task-graph";
5141
- var modelSchema20 = TypeModel("model:ObjectDetectionTask");
4430
+ import { CreateWorkflow as CreateWorkflow28, Workflow as Workflow28 } from "@workglow/task-graph";
4431
+ var modelSchema18 = TypeModel("model:ObjectDetectionTask");
5142
4432
  var detectionSchema = {
5143
4433
  type: "object",
5144
4434
  properties: {
@@ -5163,7 +4453,7 @@ var ObjectDetectionInputSchema = {
5163
4453
  type: "object",
5164
4454
  properties: {
5165
4455
  image: TypeImageInput,
5166
- model: modelSchema20,
4456
+ model: modelSchema18,
5167
4457
  labels: {
5168
4458
  type: "array",
5169
4459
  items: {
@@ -5217,11 +4507,11 @@ class ObjectDetectionTask extends AiVisionTask {
5217
4507
  var objectDetection = (input, config) => {
5218
4508
  return new ObjectDetectionTask(config).run(input);
5219
4509
  };
5220
- Workflow30.prototype.objectDetection = CreateWorkflow30(ObjectDetectionTask);
4510
+ Workflow28.prototype.objectDetection = CreateWorkflow28(ObjectDetectionTask);
5221
4511
 
5222
4512
  // src/task/PoseLandmarkerTask.ts
5223
- import { CreateWorkflow as CreateWorkflow31, Workflow as Workflow31 } from "@workglow/task-graph";
5224
- var modelSchema21 = TypeModel("model:PoseLandmarkerTask");
4513
+ import { CreateWorkflow as CreateWorkflow29, Workflow as Workflow29 } from "@workglow/task-graph";
4514
+ var modelSchema19 = TypeModel("model:PoseLandmarkerTask");
5225
4515
  var TypePoseLandmark = {
5226
4516
  type: "object",
5227
4517
  properties: {
@@ -5300,7 +4590,7 @@ var PoseLandmarkerInputSchema = {
5300
4590
  type: "object",
5301
4591
  properties: {
5302
4592
  image: TypeImageInput,
5303
- model: modelSchema21,
4593
+ model: modelSchema19,
5304
4594
  numPoses: {
5305
4595
  type: "number",
5306
4596
  minimum: 1,
@@ -5379,10 +4669,10 @@ class PoseLandmarkerTask extends AiVisionTask {
5379
4669
  var poseLandmarker = (input, config) => {
5380
4670
  return new PoseLandmarkerTask(config).run(input);
5381
4671
  };
5382
- Workflow31.prototype.poseLandmarker = CreateWorkflow31(PoseLandmarkerTask);
4672
+ Workflow29.prototype.poseLandmarker = CreateWorkflow29(PoseLandmarkerTask);
5383
4673
 
5384
4674
  // src/task/QueryExpanderTask.ts
5385
- import { CreateWorkflow as CreateWorkflow32, Task as Task15, Workflow as Workflow32 } from "@workglow/task-graph";
4675
+ import { CreateWorkflow as CreateWorkflow30, Task as Task14, Workflow as Workflow30 } from "@workglow/task-graph";
5386
4676
  var QueryExpansionMethod = {
5387
4677
  MULTI_QUERY: "multi-query",
5388
4678
  HYDE: "hyde",
@@ -5450,7 +4740,7 @@ var outputSchema12 = {
5450
4740
  additionalProperties: false
5451
4741
  };
5452
4742
 
5453
- class QueryExpanderTask extends Task15 {
4743
+ class QueryExpanderTask extends Task14 {
5454
4744
  static type = "QueryExpanderTask";
5455
4745
  static category = "RAG";
5456
4746
  static title = "Query Expander";
@@ -5592,14 +4882,14 @@ class QueryExpanderTask extends Task15 {
5592
4882
  var queryExpander = (input, config) => {
5593
4883
  return new QueryExpanderTask(config).run(input);
5594
4884
  };
5595
- Workflow32.prototype.queryExpander = CreateWorkflow32(QueryExpanderTask);
4885
+ Workflow30.prototype.queryExpander = CreateWorkflow30(QueryExpanderTask);
5596
4886
 
5597
4887
  // src/task/RerankerTask.ts
5598
- import { CreateWorkflow as CreateWorkflow34, Task as Task16, Workflow as Workflow34 } from "@workglow/task-graph";
4888
+ import { CreateWorkflow as CreateWorkflow32, Task as Task15, Workflow as Workflow32 } from "@workglow/task-graph";
5599
4889
 
5600
4890
  // src/task/TextClassificationTask.ts
5601
- import { CreateWorkflow as CreateWorkflow33, Workflow as Workflow33 } from "@workglow/task-graph";
5602
- var modelSchema22 = TypeModel("model:TextClassificationTask");
4891
+ import { CreateWorkflow as CreateWorkflow31, Workflow as Workflow31 } from "@workglow/task-graph";
4892
+ var modelSchema20 = TypeModel("model:TextClassificationTask");
5603
4893
  var TextClassificationInputSchema = {
5604
4894
  type: "object",
5605
4895
  properties: {
@@ -5626,7 +4916,7 @@ var TextClassificationInputSchema = {
5626
4916
  description: "The maximum number of categories to return",
5627
4917
  "x-ui-group": "Configuration"
5628
4918
  },
5629
- model: modelSchema22
4919
+ model: modelSchema20
5630
4920
  },
5631
4921
  required: ["text", "model"],
5632
4922
  additionalProperties: false
@@ -5676,7 +4966,7 @@ class TextClassificationTask extends AiTask {
5676
4966
  var textClassification = (input, config) => {
5677
4967
  return new TextClassificationTask(config).run(input);
5678
4968
  };
5679
- Workflow33.prototype.textClassification = CreateWorkflow33(TextClassificationTask);
4969
+ Workflow31.prototype.textClassification = CreateWorkflow31(TextClassificationTask);
5680
4970
 
5681
4971
  // src/task/RerankerTask.ts
5682
4972
  var inputSchema13 = {
@@ -5771,7 +5061,7 @@ var outputSchema13 = {
5771
5061
  additionalProperties: false
5772
5062
  };
5773
5063
 
5774
- class RerankerTask extends Task16 {
5064
+ class RerankerTask extends Task15 {
5775
5065
  static type = "RerankerTask";
5776
5066
  static category = "RAG";
5777
5067
  static title = "Reranker";
@@ -5899,11 +5189,11 @@ class RerankerTask extends Task16 {
5899
5189
  var reranker = (input, config) => {
5900
5190
  return new RerankerTask(config).run(input);
5901
5191
  };
5902
- Workflow34.prototype.reranker = CreateWorkflow34(RerankerTask);
5192
+ Workflow32.prototype.reranker = CreateWorkflow32(RerankerTask);
5903
5193
 
5904
5194
  // src/task/StructuralParserTask.ts
5905
5195
  import { StructuralParser } from "@workglow/knowledge-base";
5906
- import { CreateWorkflow as CreateWorkflow35, Task as Task17, Workflow as Workflow35 } from "@workglow/task-graph";
5196
+ import { CreateWorkflow as CreateWorkflow33, Task as Task16, Workflow as Workflow33 } from "@workglow/task-graph";
5907
5197
  import { uuid4 as uuid42 } from "@workglow/util";
5908
5198
  var inputSchema14 = {
5909
5199
  type: "object",
@@ -5963,7 +5253,7 @@ var outputSchema14 = {
5963
5253
  additionalProperties: false
5964
5254
  };
5965
5255
 
5966
- class StructuralParserTask extends Task17 {
5256
+ class StructuralParserTask extends Task16 {
5967
5257
  static type = "StructuralParserTask";
5968
5258
  static category = "Document";
5969
5259
  static title = "Structural Parser";
@@ -6006,15 +5296,15 @@ class StructuralParserTask extends Task17 {
6006
5296
  var structuralParser = (input, config) => {
6007
5297
  return new StructuralParserTask(config).run(input);
6008
5298
  };
6009
- Workflow35.prototype.structuralParser = CreateWorkflow35(StructuralParserTask);
5299
+ Workflow33.prototype.structuralParser = CreateWorkflow33(StructuralParserTask);
6010
5300
 
6011
5301
  // src/task/StructuredGenerationTask.ts
6012
- import { CreateWorkflow as CreateWorkflow36, Workflow as Workflow36 } from "@workglow/task-graph";
6013
- var modelSchema23 = TypeModel("model:StructuredGenerationTask");
5302
+ import { CreateWorkflow as CreateWorkflow34, Workflow as Workflow34 } from "@workglow/task-graph";
5303
+ var modelSchema21 = TypeModel("model:StructuredGenerationTask");
6014
5304
  var StructuredGenerationInputSchema = {
6015
5305
  type: "object",
6016
5306
  properties: {
6017
- model: modelSchema23,
5307
+ model: modelSchema21,
6018
5308
  prompt: {
6019
5309
  type: "string",
6020
5310
  title: "Prompt",
@@ -6077,10 +5367,10 @@ class StructuredGenerationTask extends StreamingAiTask {
6077
5367
  var structuredGeneration = (input, config) => {
6078
5368
  return new StructuredGenerationTask(config).run(input);
6079
5369
  };
6080
- Workflow36.prototype.structuredGeneration = CreateWorkflow36(StructuredGenerationTask);
5370
+ Workflow34.prototype.structuredGeneration = CreateWorkflow34(StructuredGenerationTask);
6081
5371
 
6082
5372
  // src/task/TextChunkerTask.ts
6083
- import { CreateWorkflow as CreateWorkflow37, Task as Task18, Workflow as Workflow37 } from "@workglow/task-graph";
5373
+ import { CreateWorkflow as CreateWorkflow35, Task as Task17, Workflow as Workflow35 } from "@workglow/task-graph";
6084
5374
  var ChunkingStrategy = {
6085
5375
  FIXED: "fixed",
6086
5376
  SENTENCE: "sentence",
@@ -6149,7 +5439,7 @@ var outputSchema15 = {
6149
5439
  additionalProperties: false
6150
5440
  };
6151
5441
 
6152
- class TextChunkerTask extends Task18 {
5442
+ class TextChunkerTask extends Task17 {
6153
5443
  static type = "TextChunkerTask";
6154
5444
  static category = "Document";
6155
5445
  static title = "Text Chunker";
@@ -6329,11 +5619,11 @@ class TextChunkerTask extends Task18 {
6329
5619
  var textChunker = (input, config) => {
6330
5620
  return new TextChunkerTask(config).run(input);
6331
5621
  };
6332
- Workflow37.prototype.textChunker = CreateWorkflow37(TextChunkerTask);
5622
+ Workflow35.prototype.textChunker = CreateWorkflow35(TextChunkerTask);
6333
5623
 
6334
5624
  // src/task/TextFillMaskTask.ts
6335
- import { CreateWorkflow as CreateWorkflow38, Workflow as Workflow38 } from "@workglow/task-graph";
6336
- var modelSchema24 = TypeModel("model:TextFillMaskTask");
5625
+ import { CreateWorkflow as CreateWorkflow36, Workflow as Workflow36 } from "@workglow/task-graph";
5626
+ var modelSchema22 = TypeModel("model:TextFillMaskTask");
6337
5627
  var TextFillMaskInputSchema = {
6338
5628
  type: "object",
6339
5629
  properties: {
@@ -6342,7 +5632,7 @@ var TextFillMaskInputSchema = {
6342
5632
  title: "Text",
6343
5633
  description: "The text with a mask token to fill"
6344
5634
  },
6345
- model: modelSchema24
5635
+ model: modelSchema22
6346
5636
  },
6347
5637
  required: ["text", "model"],
6348
5638
  additionalProperties: false
@@ -6397,21 +5687,21 @@ class TextFillMaskTask extends AiTask {
6397
5687
  var textFillMask = (input, config) => {
6398
5688
  return new TextFillMaskTask(config).run(input);
6399
5689
  };
6400
- Workflow38.prototype.textFillMask = CreateWorkflow38(TextFillMaskTask);
5690
+ Workflow36.prototype.textFillMask = CreateWorkflow36(TextFillMaskTask);
6401
5691
 
6402
5692
  // src/task/TextGenerationTask.ts
6403
- import { CreateWorkflow as CreateWorkflow39, Workflow as Workflow39 } from "@workglow/task-graph";
5693
+ import { CreateWorkflow as CreateWorkflow37, Workflow as Workflow37 } from "@workglow/task-graph";
6404
5694
  var generatedTextSchema2 = {
6405
5695
  type: "string",
6406
5696
  title: "Text",
6407
5697
  description: "The generated text",
6408
5698
  "x-stream": "append"
6409
5699
  };
6410
- var modelSchema25 = TypeModel("model:TextGenerationTask");
5700
+ var modelSchema23 = TypeModel("model:TextGenerationTask");
6411
5701
  var TextGenerationInputSchema = {
6412
5702
  type: "object",
6413
5703
  properties: {
6414
- model: modelSchema25,
5704
+ model: modelSchema23,
6415
5705
  prompt: {
6416
5706
  type: "string",
6417
5707
  title: "Prompt",
@@ -6485,11 +5775,11 @@ class TextGenerationTask extends StreamingAiTask {
6485
5775
  var textGeneration = (input, config) => {
6486
5776
  return new TextGenerationTask(config).run(input);
6487
5777
  };
6488
- Workflow39.prototype.textGeneration = CreateWorkflow39(TextGenerationTask);
5778
+ Workflow37.prototype.textGeneration = CreateWorkflow37(TextGenerationTask);
6489
5779
 
6490
5780
  // src/task/TextLanguageDetectionTask.ts
6491
- import { CreateWorkflow as CreateWorkflow40, Workflow as Workflow40 } from "@workglow/task-graph";
6492
- var modelSchema26 = TypeModel("model:TextLanguageDetectionTask");
5781
+ import { CreateWorkflow as CreateWorkflow38, Workflow as Workflow38 } from "@workglow/task-graph";
5782
+ var modelSchema24 = TypeModel("model:TextLanguageDetectionTask");
6493
5783
  var TextLanguageDetectionInputSchema = {
6494
5784
  type: "object",
6495
5785
  properties: {
@@ -6506,7 +5796,7 @@ var TextLanguageDetectionInputSchema = {
6506
5796
  title: "Max Languages",
6507
5797
  description: "The maximum number of languages to return"
6508
5798
  },
6509
- model: modelSchema26
5799
+ model: modelSchema24
6510
5800
  },
6511
5801
  required: ["text", "model"],
6512
5802
  additionalProperties: false
@@ -6556,10 +5846,10 @@ class TextLanguageDetectionTask extends AiTask {
6556
5846
  var textLanguageDetection = (input, config) => {
6557
5847
  return new TextLanguageDetectionTask(config).run(input);
6558
5848
  };
6559
- Workflow40.prototype.textLanguageDetection = CreateWorkflow40(TextLanguageDetectionTask);
5849
+ Workflow38.prototype.textLanguageDetection = CreateWorkflow38(TextLanguageDetectionTask);
6560
5850
 
6561
5851
  // src/task/TextQuestionAnswerTask.ts
6562
- import { CreateWorkflow as CreateWorkflow41, Workflow as Workflow41 } from "@workglow/task-graph";
5852
+ import { CreateWorkflow as CreateWorkflow39, Workflow as Workflow39 } from "@workglow/task-graph";
6563
5853
  var contextSchema = {
6564
5854
  type: "string",
6565
5855
  title: "Context",
@@ -6576,13 +5866,13 @@ var textSchema = {
6576
5866
  description: "The generated text",
6577
5867
  "x-stream": "append"
6578
5868
  };
6579
- var modelSchema27 = TypeModel("model:TextQuestionAnswerTask");
5869
+ var modelSchema25 = TypeModel("model:TextQuestionAnswerTask");
6580
5870
  var TextQuestionAnswerInputSchema = {
6581
5871
  type: "object",
6582
5872
  properties: {
6583
5873
  context: contextSchema,
6584
5874
  question: questionSchema,
6585
- model: modelSchema27
5875
+ model: modelSchema25
6586
5876
  },
6587
5877
  required: ["context", "question", "model"],
6588
5878
  additionalProperties: false
@@ -6611,11 +5901,11 @@ class TextQuestionAnswerTask extends StreamingAiTask {
6611
5901
  var textQuestionAnswer = (input, config) => {
6612
5902
  return new TextQuestionAnswerTask(config).run(input);
6613
5903
  };
6614
- Workflow41.prototype.textQuestionAnswer = CreateWorkflow41(TextQuestionAnswerTask);
5904
+ Workflow39.prototype.textQuestionAnswer = CreateWorkflow39(TextQuestionAnswerTask);
6615
5905
 
6616
5906
  // src/task/TextRewriterTask.ts
6617
- import { CreateWorkflow as CreateWorkflow42, Workflow as Workflow42 } from "@workglow/task-graph";
6618
- var modelSchema28 = TypeModel("model:TextRewriterTask");
5907
+ import { CreateWorkflow as CreateWorkflow40, Workflow as Workflow40 } from "@workglow/task-graph";
5908
+ var modelSchema26 = TypeModel("model:TextRewriterTask");
6619
5909
  var TextRewriterInputSchema = {
6620
5910
  type: "object",
6621
5911
  properties: {
@@ -6629,7 +5919,7 @@ var TextRewriterInputSchema = {
6629
5919
  title: "Prompt",
6630
5920
  description: "The prompt to direct the rewriting"
6631
5921
  },
6632
- model: modelSchema28
5922
+ model: modelSchema26
6633
5923
  },
6634
5924
  required: ["text", "prompt", "model"],
6635
5925
  additionalProperties: false
@@ -6663,11 +5953,11 @@ class TextRewriterTask extends StreamingAiTask {
6663
5953
  var textRewriter = (input, config) => {
6664
5954
  return new TextRewriterTask(config).run(input);
6665
5955
  };
6666
- Workflow42.prototype.textRewriter = CreateWorkflow42(TextRewriterTask);
5956
+ Workflow40.prototype.textRewriter = CreateWorkflow40(TextRewriterTask);
6667
5957
 
6668
5958
  // src/task/TextTranslationTask.ts
6669
- import { CreateWorkflow as CreateWorkflow43, Workflow as Workflow43 } from "@workglow/task-graph";
6670
- var modelSchema29 = TypeModel("model:TextTranslationTask");
5959
+ import { CreateWorkflow as CreateWorkflow41, Workflow as Workflow41 } from "@workglow/task-graph";
5960
+ var modelSchema27 = TypeModel("model:TextTranslationTask");
6671
5961
  var translationTextSchema = {
6672
5962
  type: "string",
6673
5963
  title: "Text",
@@ -6694,7 +5984,7 @@ var TextTranslationInputSchema = {
6694
5984
  minLength: 2,
6695
5985
  maxLength: 2
6696
5986
  }),
6697
- model: modelSchema29
5987
+ model: modelSchema27
6698
5988
  },
6699
5989
  required: ["text", "source_lang", "target_lang", "model"],
6700
5990
  additionalProperties: false
@@ -6729,10 +6019,253 @@ class TextTranslationTask extends StreamingAiTask {
6729
6019
  var textTranslation = (input, config) => {
6730
6020
  return new TextTranslationTask(config).run(input);
6731
6021
  };
6732
- Workflow43.prototype.textTranslation = CreateWorkflow43(TextTranslationTask);
6022
+ Workflow41.prototype.textTranslation = CreateWorkflow41(TextTranslationTask);
6023
+
6024
+ // src/task/ToolCallingTask.ts
6025
+ import { CreateWorkflow as CreateWorkflow42, getTaskConstructors, Workflow as Workflow42 } from "@workglow/task-graph";
6026
+ import { makeFingerprint } from "@workglow/util";
6027
+ function taskTypesToTools(taskNames, registry) {
6028
+ const constructors = getTaskConstructors(registry);
6029
+ return taskNames.map((name) => {
6030
+ const ctor = constructors.get(name);
6031
+ if (!ctor) {
6032
+ throw new Error(`taskTypesToTools: Unknown task type "${name}" \u2014 not found in task constructors registry (ServiceRegistry: ${registry ? "custom" : "default"})`);
6033
+ }
6034
+ const configSchema = "configSchema" in ctor && typeof ctor.configSchema === "function" ? ctor.configSchema() : undefined;
6035
+ return {
6036
+ name: ctor.type,
6037
+ description: ctor.description ?? "",
6038
+ inputSchema: ctor.inputSchema(),
6039
+ outputSchema: ctor.outputSchema(),
6040
+ ...configSchema ? { configSchema } : {},
6041
+ taskType: name
6042
+ };
6043
+ });
6044
+ }
6045
+ var ToolDefinitionSchema = {
6046
+ type: "object",
6047
+ properties: {
6048
+ name: {
6049
+ type: "string",
6050
+ title: "Name",
6051
+ description: "The tool name"
6052
+ },
6053
+ description: {
6054
+ type: "string",
6055
+ title: "Description",
6056
+ description: "A description of what the tool does"
6057
+ },
6058
+ inputSchema: {
6059
+ type: "object",
6060
+ title: "Input Schema",
6061
+ description: "JSON Schema describing the tool's input parameters",
6062
+ additionalProperties: true
6063
+ },
6064
+ outputSchema: {
6065
+ type: "object",
6066
+ title: "Output Schema",
6067
+ description: "JSON Schema describing what the tool returns",
6068
+ additionalProperties: true
6069
+ },
6070
+ configSchema: {
6071
+ type: "object",
6072
+ title: "Config Schema",
6073
+ description: "JSON Schema describing the task's configuration options (not sent to the LLM)",
6074
+ additionalProperties: true
6075
+ },
6076
+ config: {
6077
+ type: "object",
6078
+ title: "Config",
6079
+ description: "Concrete configuration values for the backing task (not sent to the LLM)",
6080
+ additionalProperties: true
6081
+ }
6082
+ },
6083
+ required: ["name", "description", "inputSchema"],
6084
+ additionalProperties: true
6085
+ };
6086
+ var ToolCallSchema = {
6087
+ type: "object",
6088
+ properties: {
6089
+ id: {
6090
+ type: "string",
6091
+ title: "ID",
6092
+ description: "Unique identifier for this tool call"
6093
+ },
6094
+ name: {
6095
+ type: "string",
6096
+ title: "Name",
6097
+ description: "The name of the tool to invoke"
6098
+ },
6099
+ input: {
6100
+ type: "object",
6101
+ title: "Input",
6102
+ description: "The input arguments for the tool call",
6103
+ additionalProperties: true
6104
+ }
6105
+ },
6106
+ required: ["id", "name", "input"],
6107
+ additionalProperties: false
6108
+ };
6109
+ var modelSchema28 = TypeModel("model:ToolCallingTask");
6110
+ var ToolCallingInputSchema = {
6111
+ type: "object",
6112
+ properties: {
6113
+ model: modelSchema28,
6114
+ prompt: {
6115
+ oneOf: [
6116
+ { type: "string", title: "Prompt", description: "The prompt to send to the model" },
6117
+ {
6118
+ type: "array",
6119
+ title: "Prompt",
6120
+ description: "The prompt as an array of strings or content blocks",
6121
+ items: {
6122
+ oneOf: [
6123
+ { type: "string" },
6124
+ {
6125
+ type: "object",
6126
+ properties: {
6127
+ type: { type: "string", enum: ["text", "image", "audio"] }
6128
+ },
6129
+ required: ["type"],
6130
+ additionalProperties: true
6131
+ }
6132
+ ]
6133
+ }
6134
+ }
6135
+ ],
6136
+ title: "Prompt",
6137
+ description: "The prompt to send to the model"
6138
+ },
6139
+ systemPrompt: {
6140
+ type: "string",
6141
+ title: "System Prompt",
6142
+ description: "Optional system instructions for the model"
6143
+ },
6144
+ messages: {
6145
+ type: "array",
6146
+ title: "Messages",
6147
+ description: "Full conversation history for multi-turn interactions. When provided, used instead of prompt to construct the messages array sent to the provider.",
6148
+ items: {
6149
+ type: "object",
6150
+ properties: {
6151
+ role: { type: "string", enum: ["user", "assistant", "tool"] },
6152
+ content: {}
6153
+ },
6154
+ required: ["role", "content"],
6155
+ additionalProperties: true
6156
+ }
6157
+ },
6158
+ tools: {
6159
+ type: "array",
6160
+ format: "tasks",
6161
+ title: "Tools",
6162
+ description: "Tool definitions available for the model to call",
6163
+ items: {
6164
+ oneOf: [
6165
+ { type: "string", format: "tasks", description: "Task type name" },
6166
+ ToolDefinitionSchema
6167
+ ]
6168
+ }
6169
+ },
6170
+ toolChoice: {
6171
+ type: "string",
6172
+ title: "Tool Choice",
6173
+ description: 'Controls tool selection: "auto" (model decides), "none" (no tools), "required" (must call a tool), or a specific tool name',
6174
+ "x-ui-group": "Configuration"
6175
+ },
6176
+ maxTokens: {
6177
+ type: "number",
6178
+ title: "Max Tokens",
6179
+ description: "The maximum number of tokens to generate",
6180
+ minimum: 1,
6181
+ "x-ui-group": "Configuration"
6182
+ },
6183
+ temperature: {
6184
+ type: "number",
6185
+ title: "Temperature",
6186
+ description: "The temperature to use for sampling",
6187
+ minimum: 0,
6188
+ maximum: 2,
6189
+ "x-ui-group": "Configuration"
6190
+ }
6191
+ },
6192
+ required: ["model", "prompt", "tools"],
6193
+ additionalProperties: false
6194
+ };
6195
+ var ToolCallingOutputSchema = {
6196
+ type: "object",
6197
+ properties: {
6198
+ text: {
6199
+ type: "string",
6200
+ title: "Text",
6201
+ description: "Any text content generated by the model",
6202
+ "x-stream": "append"
6203
+ },
6204
+ toolCalls: {
6205
+ type: "array",
6206
+ items: ToolCallSchema,
6207
+ title: "Tool Calls",
6208
+ description: "Tool calls requested by the model",
6209
+ "x-stream": "object"
6210
+ }
6211
+ },
6212
+ required: ["text", "toolCalls"],
6213
+ additionalProperties: false
6214
+ };
6215
+
6216
+ class ToolCallingTask extends StreamingAiTask {
6217
+ static type = "ToolCallingTask";
6218
+ static category = "AI Text Model";
6219
+ static title = "Tool Calling";
6220
+ static description = "Sends a prompt with tool definitions to a language model and returns text along with any tool calls the model requests";
6221
+ static inputSchema() {
6222
+ return ToolCallingInputSchema;
6223
+ }
6224
+ static outputSchema() {
6225
+ return ToolCallingOutputSchema;
6226
+ }
6227
+ _computedSessionId;
6228
+ async getJobInput(input) {
6229
+ const jobInput = await super.getJobInput(input);
6230
+ if (!jobInput.sessionId && input.tools && input.tools.length > 0) {
6231
+ jobInput.sessionId = await makeFingerprint({
6232
+ tools: input.tools,
6233
+ systemPrompt: input.systemPrompt,
6234
+ runnerId: this.runConfig.runnerId
6235
+ });
6236
+ this._computedSessionId = jobInput.sessionId;
6237
+ }
6238
+ return jobInput;
6239
+ }
6240
+ registerSessionDispose(input, context) {
6241
+ const sessionId = this._computedSessionId;
6242
+ if (!sessionId || !context.resourceScope)
6243
+ return;
6244
+ const model = input.model;
6245
+ if (!model || typeof model !== "object")
6246
+ return;
6247
+ const providerName = model.provider;
6248
+ context.resourceScope.register(`ai:session:${sessionId}`, async () => {
6249
+ await getAiProviderRegistry().disposeSession(providerName, sessionId);
6250
+ });
6251
+ }
6252
+ async execute(input, executeContext) {
6253
+ const result = await super.execute(input, executeContext);
6254
+ this.registerSessionDispose(input, executeContext);
6255
+ return result;
6256
+ }
6257
+ async* executeStream(input, context) {
6258
+ yield* super.executeStream(input, context);
6259
+ this.registerSessionDispose(input, context);
6260
+ }
6261
+ }
6262
+ var toolCalling = (input, config) => {
6263
+ return new ToolCallingTask(config).run(input);
6264
+ };
6265
+ Workflow42.prototype.toolCalling = CreateWorkflow42(ToolCallingTask);
6733
6266
 
6734
6267
  // src/task/TopicSegmenterTask.ts
6735
- import { CreateWorkflow as CreateWorkflow44, Task as Task19, Workflow as Workflow44 } from "@workglow/task-graph";
6268
+ import { CreateWorkflow as CreateWorkflow43, Task as Task18, Workflow as Workflow43 } from "@workglow/task-graph";
6736
6269
  var SegmentationMethod = {
6737
6270
  HEURISTIC: "heuristic",
6738
6271
  EMBEDDING_SIMILARITY: "embedding-similarity",
@@ -6807,7 +6340,7 @@ var outputSchema16 = {
6807
6340
  additionalProperties: false
6808
6341
  };
6809
6342
 
6810
- class TopicSegmenterTask extends Task19 {
6343
+ class TopicSegmenterTask extends Task18 {
6811
6344
  static type = "TopicSegmenterTask";
6812
6345
  static category = "Document";
6813
6346
  static title = "Topic Segmenter";
@@ -7012,15 +6545,15 @@ class TopicSegmenterTask extends Task19 {
7012
6545
  var topicSegmenter = (input, config) => {
7013
6546
  return new TopicSegmenterTask(config).run(input);
7014
6547
  };
7015
- Workflow44.prototype.topicSegmenter = CreateWorkflow44(TopicSegmenterTask);
6548
+ Workflow43.prototype.topicSegmenter = CreateWorkflow43(TopicSegmenterTask);
7016
6549
 
7017
6550
  // src/task/UnloadModelTask.ts
7018
- import { CreateWorkflow as CreateWorkflow45, Workflow as Workflow45 } from "@workglow/task-graph";
7019
- var modelSchema30 = TypeModel("model");
6551
+ import { CreateWorkflow as CreateWorkflow44, Workflow as Workflow44 } from "@workglow/task-graph";
6552
+ var modelSchema29 = TypeModel("model");
7020
6553
  var UnloadModelInputSchema = {
7021
6554
  type: "object",
7022
6555
  properties: {
7023
- model: modelSchema30
6556
+ model: modelSchema29
7024
6557
  },
7025
6558
  required: ["model"],
7026
6559
  additionalProperties: false
@@ -7028,7 +6561,7 @@ var UnloadModelInputSchema = {
7028
6561
  var UnloadModelOutputSchema = {
7029
6562
  type: "object",
7030
6563
  properties: {
7031
- model: modelSchema30
6564
+ model: modelSchema29
7032
6565
  },
7033
6566
  required: ["model"],
7034
6567
  additionalProperties: false
@@ -7050,10 +6583,10 @@ class UnloadModelTask extends AiTask {
7050
6583
  var unloadModel = (input, config) => {
7051
6584
  return new UnloadModelTask(config).run(input);
7052
6585
  };
7053
- Workflow45.prototype.unloadModel = CreateWorkflow45(UnloadModelTask);
6586
+ Workflow44.prototype.unloadModel = CreateWorkflow44(UnloadModelTask);
7054
6587
 
7055
6588
  // src/task/VectorQuantizeTask.ts
7056
- import { CreateWorkflow as CreateWorkflow46, Task as Task20, Workflow as Workflow46 } from "@workglow/task-graph";
6589
+ import { CreateWorkflow as CreateWorkflow45, Task as Task19, Workflow as Workflow45 } from "@workglow/task-graph";
7057
6590
  import {
7058
6591
  normalizeNumberArray,
7059
6592
  TensorType,
@@ -7133,7 +6666,7 @@ var outputSchema17 = {
7133
6666
  additionalProperties: false
7134
6667
  };
7135
6668
 
7136
- class VectorQuantizeTask extends Task20 {
6669
+ class VectorQuantizeTask extends Task19 {
7137
6670
  static type = "VectorQuantizeTask";
7138
6671
  static category = "Vector";
7139
6672
  static title = "Quantize";
@@ -7233,10 +6766,10 @@ class VectorQuantizeTask extends Task20 {
7233
6766
  var vectorQuantize = (input, config) => {
7234
6767
  return new VectorQuantizeTask(config).run(input);
7235
6768
  };
7236
- Workflow46.prototype.vectorQuantize = CreateWorkflow46(VectorQuantizeTask);
6769
+ Workflow45.prototype.vectorQuantize = CreateWorkflow45(VectorQuantizeTask);
7237
6770
 
7238
6771
  // src/task/VectorSimilarityTask.ts
7239
- import { CreateWorkflow as CreateWorkflow47, GraphAsTask, Workflow as Workflow47 } from "@workglow/task-graph";
6772
+ import { CreateWorkflow as CreateWorkflow46, GraphAsTask, Workflow as Workflow46 } from "@workglow/task-graph";
7240
6773
  import {
7241
6774
  cosineSimilarity,
7242
6775
  hammingSimilarity,
@@ -7342,7 +6875,8 @@ class VectorSimilarityTask extends GraphAsTask {
7342
6875
  var similarity = (input, config) => {
7343
6876
  return new VectorSimilarityTask(config).run(input);
7344
6877
  };
7345
- Workflow47.prototype.similarity = CreateWorkflow47(VectorSimilarityTask);
6878
+ Workflow46.prototype.similarity = CreateWorkflow46(VectorSimilarityTask);
6879
+
7346
6880
  // src/task/MessageConversion.ts
7347
6881
  function getInputMessages(input) {
7348
6882
  const messages = input.messages;
@@ -7543,7 +7077,6 @@ function toTextFlatMessages(input) {
7543
7077
  // src/task/index.ts
7544
7078
  var registerAiTasks = () => {
7545
7079
  const tasks = [
7546
- AgentTask,
7547
7080
  BackgroundRemovalTask,
7548
7081
  ChunkToVectorTask,
7549
7082
  CountTokensTask,
@@ -7597,11 +7130,8 @@ var registerAiTasks = () => {
7597
7130
  export {
7598
7131
  vectorStoreSearch,
7599
7132
  vectorQuantize,
7600
- userMessage,
7601
7133
  unloadModel,
7602
7134
  topicSegmenter,
7603
- toolSourceDefinitions,
7604
- toolMessage,
7605
7135
  toolCalling,
7606
7136
  toTextFlatMessages,
7607
7137
  toOpenAIMessages,
@@ -7636,38 +7166,26 @@ export {
7636
7166
  imageSegmentation,
7637
7167
  imageEmbedding,
7638
7168
  imageClassification,
7639
- imageBlockFromDataUri,
7640
- imageBlock,
7641
7169
  hybridSearch,
7642
7170
  hierarchyJoin,
7643
7171
  hierarchicalChunker,
7644
- hasToolCalls,
7645
7172
  handLandmarker,
7646
7173
  getGlobalModelRepository,
7647
7174
  getAiProviderRegistry,
7648
7175
  gestureRecognizer,
7649
- findToolSource,
7650
7176
  filterValidToolCalls,
7651
7177
  faceLandmarker,
7652
7178
  faceDetector,
7653
- executeToolCalls,
7654
- executeToolCall,
7655
7179
  downloadModel,
7656
7180
  documentUpsert,
7657
7181
  documentEnricher,
7658
7182
  countTokens,
7659
- countAssistantToolUses,
7660
7183
  contextBuilder,
7661
7184
  chunkVectorUpsert,
7662
7185
  chunkToVector,
7663
7186
  chunkRetrieval,
7664
- buildToolSources,
7665
7187
  buildToolDescription,
7666
7188
  backgroundRemoval,
7667
- audioBlockFromDataUri,
7668
- audioBlock,
7669
- assistantMessage,
7670
- agent,
7671
7189
  VectorSimilarityTask,
7672
7190
  VectorQuantizeTask,
7673
7191
  UnloadModelTask,
@@ -7791,10 +7309,7 @@ export {
7791
7309
  AiTask,
7792
7310
  AiProviderRegistry,
7793
7311
  AiProvider,
7794
- AiJob,
7795
- AgentTask,
7796
- AgentOutputSchema,
7797
- AgentInputSchema
7312
+ AiJob
7798
7313
  };
7799
7314
 
7800
- //# debugId=8A9763DF6FDECCDA64756E2164756E21
7315
+ //# debugId=F0E9DA50FF60D85564756E2164756E21