Skip to content

Commit 371d6db

Browse files
authored
feat(ai): ToolCallingTask and AgentTask
* feat(ai): restore ToolCallingTask and AgentTask for development * refactor(ai): update timeout handling and enhance tool parsing functionality * refactor: enhance error handling and diagnostics across job queue and execution strategies * feat(ai-provider): introduce ToolCallParser and enhance tool calling functionality * fix(ai-provider): improve tool choice mapping logic * fix: resolve remaining constructor signature issues * refactor: enhance JsonTaskConfig to include 'defaults' property * refactor: simplify tool choice handling in OpenAI_ToolCalling * refactor: enable noImplicitOverride and update classes for TypeScript compliance * refactor(ai): update timeout handling and enhance tool parsing functionality * feat(tasks): add human-in-the-loop tasks (HumanInputTask, HumanApprovalTask) Introduce a system for pausing task graph execution to request human input. Three concerns are addressed: WHO (target human via string ID), HOW (IHumanConnector interface resolved from ServiceRegistry), and WHAT (JSON schema describing the UI to render). - IHumanConnector: interface for reaching humans, supports single and multi-turn interaction modes. UI layers implement this contract. - HumanInputTask: pauses graph execution, sends schema to connector, returns human response as output. Supports dynamic output schemas. - HumanApprovalTask: convenience task for approve/deny pattern with fixed {approved, reason} output schema. - Both tasks integrate with Workflow builder (humanInput, humanApproval). * feat(tasks): integrate human-in-the-loop with MCP elicitation protocol * feat(tasks): redesign human-in-the-loop to unified schema-driven interface Replace request/response model with unified IHumanRequest that supports three interaction kinds: notify (fire-and-forget), display (show content), and elicit (request structured input via MCP elicitation). The `kind` field determines interaction pattern while contentSchema describes what to render. * fix(tasks): only require action in output schema, use strict boolean * refactor(tests): simplify HumanInputTask instantiation in tests * fix(settings): enable ESLint code actions on save in VSCode settings * fix(security): resolve 12 CodeQL high-severity vulnerabilities
1 parent 197fc6d commit 371d6db

205 files changed

Lines changed: 3861 additions & 1586 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/settings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
"**/*.tsbuildinfo": true,
2323
"**/node_modules": true
2424
},
25-
// "editor.codeActionsOnSave": {
26-
// "source.fixAll.eslint": "explicit",
27-
// "source.organizeImports": "explicit"
28-
// },
25+
"editor.codeActionsOnSave": {
26+
"source.fixAll.eslint": "explicit",
27+
"source.organizeImports": "explicit"
28+
},
2929
"eslint.codeActionsOnSave.rules": null,
3030
"explorer.autoRevealExclude": {
3131
"data-out/**": true,

examples/cli/src/commands/agent.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@
77
import {
88
computeGraphInputSchema,
99
createGraphFromGraphJSON,
10-
type TaskGraphJson,
1110
type TaskDeserializationOptions,
11+
type TaskGraphJson,
1212
} from "@workglow/task-graph";
1313
import type { DataPortSchemaObject } from "@workglow/util/schema";
1414
import type { Command } from "commander";
15-
import { editStringInExternalEditor } from "../editInEditor";
1615
import { loadConfig } from "../config";
16+
import { editStringInExternalEditor } from "../editInEditor";
1717
import {
18-
parseDynamicFlags,
1918
generateSchemaHelpText,
20-
resolveInput,
19+
parseDynamicFlags,
20+
readJsonInput,
2121
resolveConfig,
22+
resolveInput,
2223
validateInput,
23-
readJsonInput,
2424
} from "../input";
2525
import { createAgentRepository } from "../storage";
2626
import { formatError, formatTable, outputResult } from "../util";

examples/cli/src/commands/init.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
import type { Command } from "commander";
88
import { writeFile, mkdir } from "fs/promises";
99
import { stringify } from "smol-toml";
10-
import { CONFIG_PATH, DEFAULT_CONFIG, type CliConfig } from "../config";
10+
import { CONFIG_PATH, DEFAULT_CONFIG } from "../config";
11+
import type { CliConfig } from "../config";
1112

1213
export function registerInitCommand(program: Command): void {
1314
program

examples/cli/src/commands/mcp.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
import { searchMcpRegistryPage, type McpSearchResultItem } from "@workglow/tasks";
7+
import { searchMcpRegistryPage } from "@workglow/tasks";
8+
import type { McpSearchResultItem } from "@workglow/tasks";
89
import type { Command } from "commander";
910
import { editStringInExternalEditor } from "../editInEditor";
1011
import { loadConfig } from "../config";

examples/cli/src/commands/model.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
import {
8-
modelSearch,
9-
ModelRecordSchema,
10-
type ModelRecord,
11-
type ModelSearchResultItem,
12-
} from "@workglow/ai";
7+
import { modelSearch, ModelRecordSchema } from "@workglow/ai";
8+
import type { ModelRecord, ModelSearchResultItem } from "@workglow/ai";
139
import { AnthropicModelRecordSchema } from "@workglow/ai-provider/anthropic";
1410
import { GeminiModelRecordSchema } from "@workglow/ai-provider/gemini";
1511
import { HfInferenceModelRecordSchema } from "@workglow/ai-provider/hf-inference";

examples/cli/src/commands/task.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
import { TaskRegistry, type ITask } from "@workglow/task-graph";
7+
import { TaskRegistry } from "@workglow/task-graph";
8+
import type { ITask } from "@workglow/task-graph";
89
import type { DataPortSchemaObject } from "@workglow/util/schema";
910
import type { Command } from "commander";
1011
import { formatError, formatTable, outputResult } from "../util";

examples/cli/src/commands/workflow.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
import {
8-
computeGraphInputSchema,
9-
createGraphFromGraphJSON,
10-
type TaskGraphJson,
11-
} from "@workglow/task-graph";
7+
import { computeGraphInputSchema, createGraphFromGraphJSON } from "@workglow/task-graph";
8+
import type { TaskGraphJson } from "@workglow/task-graph";
129
import type { DataPortSchemaObject } from "@workglow/util/schema";
1310
import type { Command } from "commander";
1411
import { editStringInExternalEditor } from "../editInEditor";

examples/cli/src/run-interactive.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
import {
8-
TaskGraph,
9-
type ITask,
10-
type IWorkflow,
11-
type TaskGraphRunConfig,
12-
type WorkflowRunConfig,
13-
} from "@workglow/task-graph";
7+
import { TaskGraph } from "@workglow/task-graph";
8+
import type { ITask, IWorkflow, TaskGraphRunConfig, WorkflowRunConfig } from "@workglow/task-graph";
149
import { detectCliTheme, setCliTheme } from "./terminal/detectTerminalTheme";
1510
import { renderTaskInstanceRun, renderWorkflowRun } from "./ui/render";
1611

examples/web/src/Resize.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ function ResizablePanelGroup({
1616
}: ComponentProps<typeof ResizablePrimitive.Group>) {
1717
return (
1818
<ResizablePrimitive.Group
19-
className={cn(
20-
"flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
21-
className
22-
)}
19+
className={cn("flex h-full w-full data-[panel-group-direction=vertical]:flex-col", className)}
2320
{...props}
2421
/>
2522
);

examples/web/src/util.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { clsx, type ClassValue } from "clsx";
1+
import { clsx } from "clsx";
2+
import type { ClassValue } from "clsx";
23
import { twMerge } from "tailwind-merge";
34

45
export function cn(...inputs: ClassValue[]) {

0 commit comments

Comments
 (0)