Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 13 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ export default defineConfig(
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
"react/react-in-jsx-scope": "off",
// `disallowTypeAnnotations` must stay off: inline `import()` types are how
// optional peer dependencies are typed here (e.g. `typeof import("pg")`)
// without forcing a static import that would break consumers who have not
// installed the package. Turning it on flags those deliberate annotations,
// and they are not autofixable.
"@typescript-eslint/consistent-type-imports": [
"error",
{
prefer: "type-imports",
fixStyle: "separate-type-imports",
disallowTypeAnnotations: false,
},
],
},
},
{
Expand Down
10 changes: 8 additions & 2 deletions examples/cli/src/run-interactive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type { ITask, IWorkflow, TaskGraphRunConfig, WorkflowRunConfig } from "@workglow/task-graph";
import { IRunConfig, TaskGraph } from "@workglow/task-graph";
import type {
IRunConfig,
ITask,
IWorkflow,
TaskGraphRunConfig,
WorkflowRunConfig,
} from "@workglow/task-graph";
import { TaskGraph } from "@workglow/task-graph";
import { detectCliTheme, setCliTheme } from "./terminal/detectTerminalTheme";
import { renderTaskInstanceRun, renderWorkflowRun } from "./ui/render";

Expand Down
2 changes: 1 addition & 1 deletion examples/cli/src/test/samples.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

import { registerAiTasks } from "@workglow/ai";
import { InMemoryTabularStorage } from "@workglow/storage";
import type { Task } from "@workglow/task-graph";
import {
computeGraphInputSchema,
createGraphFromGraphJSON,
registerBaseTasks,
Task,
TaskGraph,
TaskGraphPrimaryKeyNames,
TaskGraphSchema,
Expand Down
2 changes: 1 addition & 1 deletion examples/cli/src/ui/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import type { IRunConfig, ITask, ITaskConstructor, TaskGraph } from "@workglow/task-graph";
import { InputTaskConfig } from "@workglow/tasks";
import type { InputTaskConfig } from "@workglow/tasks";
import { render } from "ink";
import React from "react";
import type { PromptFieldDescriptor } from "../input/prompt";
Expand Down
2 changes: 1 addition & 1 deletion examples/web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

import { registerAiTasks } from "@workglow/ai";
import { registerHuggingFaceTransformers } from "@workglow/huggingface-transformers/ai";
import type { JsonTaskItem } from "@workglow/task-graph";
import {
CACHE_REGISTRY,
DefaultCacheRegistry,
getTaskQueueRegistry,
JsonTaskItem,
registerBaseTasks,
TaskGraph,
Workflow,
Expand Down
3 changes: 2 additions & 1 deletion examples/web/src/components/TaskDataButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ITask, TaskStatus } from "@workglow/task-graph";
import type { ITask } from "@workglow/task-graph";
import { TaskStatus } from "@workglow/task-graph";
import { ViewportPortal } from "@xyflow/react";
import React, { useState } from "react";
import { DataDialog } from "./DataDialog";
Expand Down
3 changes: 2 additions & 1 deletion examples/web/src/dependencyJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { createGraphFromDependencyJSON, JsonTaskItem, TaskGraph } from "@workglow/task-graph";
import type { JsonTaskItem, TaskGraph } from "@workglow/task-graph";
import { createGraphFromDependencyJSON } from "@workglow/task-graph";

/** True if any task item (including nested subtasks) is a synthetic boundary task. */
export function dependencyJsonHasBoundaryTasks(items: JsonTaskItem[]): boolean {
Expand Down
6 changes: 4 additions & 2 deletions examples/web/src/graph/DataflowEdge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { Dataflow, TaskStatus } from "@workglow/task-graph";
import { BaseEdge, Edge, EdgeLabelRenderer, EdgeProps, getBezierPath } from "@xyflow/react";
import type { Dataflow } from "@workglow/task-graph";
import { TaskStatus } from "@workglow/task-graph";
import type { Edge, EdgeProps } from "@xyflow/react";
import { BaseEdge, EdgeLabelRenderer, getBezierPath } from "@xyflow/react";
import { useEffect, useMemo, useState } from "react";
import { DataDialog } from "../components/DataDialog";
import { getStatusColorBg } from "./util";
Expand Down
2 changes: 1 addition & 1 deletion examples/web/src/graph/NodeContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { TaskStatus } from "@workglow/task-graph";
import type { TaskStatus } from "@workglow/task-graph";
import { Handle, Position } from "@xyflow/react";
import React from "react";

Expand Down
2 changes: 1 addition & 1 deletion examples/web/src/graph/NodeHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { TaskStatus } from "@workglow/task-graph";
import type { TaskStatus } from "@workglow/task-graph";
import React from "react";
import { getStatusColorBg } from "./util";

Expand Down
2 changes: 1 addition & 1 deletion examples/web/src/graph/NodeTaskProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { ITask, TaskStatus } from "@workglow/task-graph";
import type { ITask, TaskStatus } from "@workglow/task-graph";

// Common props for all node types
export interface NodeTaskProps {
Expand Down
24 changes: 9 additions & 15 deletions examples/web/src/graph/RunGraphFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,16 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { Dataflow, TaskGraph, TaskGraphEvents } from "@workglow/task-graph";
import {
Controls,
Edge,
EdgeTypes,
Node,
NodeTypes,
ReactFlow,
useEdgesState,
useNodesState,
useReactFlow,
} from "@xyflow/react";
import React, { Dispatch, SetStateAction, useCallback, useEffect, useRef } from "react";
import type { Dataflow, TaskGraph, TaskGraphEvents } from "@workglow/task-graph";
import type { Edge, EdgeTypes, Node, NodeTypes } from "@xyflow/react";
import { Controls, ReactFlow, useEdgesState, useNodesState, useReactFlow } from "@xyflow/react";
import type { Dispatch, SetStateAction } from "react";
import React, { useCallback, useEffect, useRef } from "react";
import { computeLayout, GraphPipelineCenteredLayout, GraphPipelineLayout } from "../layout";
import { DataflowEdge, DataflowEdgeData } from "./DataflowEdge";
import { TaskNode, TaskNodeData } from "./TaskNode";
import type { DataflowEdgeData } from "./DataflowEdge";
import { DataflowEdge } from "./DataflowEdge";
import type { TaskNodeData } from "./TaskNode";
import { TaskNode } from "./TaskNode";
import { updateNode } from "./util";

import "@xyflow/react/dist/base.css";
Expand Down
5 changes: 3 additions & 2 deletions examples/web/src/graph/TaskNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { ITask, TaskStatus, type StreamEvent } from "@workglow/task-graph";
import type { ITask, StreamEvent } from "@workglow/task-graph";
import { TaskStatus } from "@workglow/task-graph";
import { ArrayTask } from "@workglow/tasks";
import { Node, NodeProps } from "@xyflow/react";
import type { Node, NodeProps } from "@xyflow/react";
import { useEffect, useRef, useState } from "react";
import { FiCloud, FiCloudLightning } from "react-icons/fi";
import { ProgressBar } from "../components/ProgressBar";
Expand Down
3 changes: 2 additions & 1 deletion examples/web/src/graph/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { ITask, TaskStatus } from "@workglow/task-graph";
import type { ITask } from "@workglow/task-graph";
import { TaskStatus } from "@workglow/task-graph";

export const getStatusColorBg = (status: TaskStatus): string => {
switch (status) {
Expand Down
2 changes: 1 addition & 1 deletion examples/web/src/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { DirectedAcyclicGraph } from "@workglow/util/graph";
import { Edge, Node } from "@xyflow/react";
import type { Edge, Node } from "@xyflow/react";

type PositionXY = {
x: number;
Expand Down
2 changes: 1 addition & 1 deletion examples/web/src/status/GraphStoreStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { TaskGraphRepository } from "@workglow/task-graph";
import type { TaskGraphRepository } from "@workglow/task-graph";
import { useCallback } from "react";

export function GraphStoreStatus({ repository }: { repository: TaskGraphRepository }) {
Expand Down
2 changes: 1 addition & 1 deletion examples/web/src/status/OutputRepositoryStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { TaskOutputRepository } from "@workglow/task-graph";
import type { TaskOutputRepository } from "@workglow/task-graph";
import { useCallback, useEffect, useState } from "react";

export function OutputRepositoryStatus({
Expand Down
4 changes: 2 additions & 2 deletions packages/ai/src/job/AiJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type { IJobExecuteContext } from "@workglow/job-queue";
import {
AbortSignalJobError,
IJobExecuteContext,
Job,
PermanentJobError,
RetryableJobError,
withJobErrorDiagnostics,
} from "@workglow/job-queue";
import { TaskInput, TaskOutput } from "@workglow/task-graph";
import type { TaskInput, TaskOutput } from "@workglow/task-graph";
import type { JsonSchema } from "@workglow/util/schema";
import type { AiEmit } from "../capability/AiEmit";
import type { Capability } from "../capability/Capabilities";
Expand Down
4 changes: 2 additions & 2 deletions packages/ai/src/model/ModelRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type { ServiceRegistry } from "@workglow/util";
import {
createServiceToken,
globalServiceRegistry,
registerInputCompactor,
registerInputResolver,
ServiceRegistry,
} from "@workglow/util";
import { InMemoryModelRepository } from "./InMemoryModelRepository";
import { ModelRepository } from "./ModelRepository";
import type { ModelRepository } from "./ModelRepository";
import type { ModelConfig } from "./ModelSchema";

export const MODEL_REPOSITORY = createServiceToken<ModelRepository>("model.repository");
Expand Down
8 changes: 5 additions & 3 deletions packages/ai/src/model/ModelRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { ITabularStorage } from "@workglow/storage";
import { EventEmitter, EventParameters } from "@workglow/util";
import type { ITabularStorage } from "@workglow/storage";
import type { EventParameters } from "@workglow/util";
import { EventEmitter } from "@workglow/util";
import type { DataPortSchemaObject, SchemaNode } from "@workglow/util/schema";
import { compileSchema } from "@workglow/util/schema";

import { ModelPrimaryKeyNames, ModelRecord, ModelRecordSchema } from "./ModelSchema";
import type { ModelPrimaryKeyNames, ModelRecord } from "./ModelSchema";
import { ModelRecordSchema } from "./ModelSchema";

export type ModelEventListeners = {
model_added: (model: ModelRecord) => void;
Expand Down
2 changes: 1 addition & 1 deletion packages/ai/src/model/ModelSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { DataPortSchemaObject } from "@workglow/util/worker";
import type { DataPortSchemaObject } from "@workglow/util/worker";

/**
* A model configuration suitable for task/job inputs.
Expand Down
3 changes: 1 addition & 2 deletions packages/ai/src/provider/AiProviderRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type { StreamEvent } from "@workglow/task-graph";
import { TaskInput, TaskOutput } from "@workglow/task-graph";
import type { StreamEvent, TaskInput, TaskOutput } from "@workglow/task-graph";
import type { JsonSchema, ServiceRegistry } from "@workglow/util/worker";
import { createServiceToken, globalServiceRegistry, WORKER_MANAGER } from "@workglow/util/worker";
import type { AiEmit } from "../capability/AiEmit";
Expand Down
11 changes: 6 additions & 5 deletions packages/ai/src/task/ChunkRetrievalTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type { ChunkRecord, ChunkSearchResult } from "@workglow/knowledge-base";
import { KnowledgeBase, TypeKnowledgeBase } from "@workglow/knowledge-base";
import type { IRunConfig, TaskConfig } from "@workglow/task-graph";
import { CreateWorkflow, IExecuteContext, Task, Workflow } from "@workglow/task-graph";
import { DataPortSchema, isTypedArray, TypedArray, TypedArraySchema } from "@workglow/util/schema";
import type { ChunkRecord, ChunkSearchResult, KnowledgeBase } from "@workglow/knowledge-base";
import { TypeKnowledgeBase } from "@workglow/knowledge-base";
import type { IExecuteContext, IRunConfig, TaskConfig } from "@workglow/task-graph";
import { CreateWorkflow, Task, Workflow } from "@workglow/task-graph";
import type { DataPortSchema, TypedArray } from "@workglow/util/schema";
import { isTypedArray, TypedArraySchema } from "@workglow/util/schema";
import type { Capability } from "../capability/Capabilities";
import type { ModelConfig } from "../model/ModelSchema";
import { TypeModel } from "./base/AiTaskSchemas";
Expand Down
7 changes: 4 additions & 3 deletions packages/ai/src/task/ChunkVectorUpsertTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

import type { ChunkRecord, KnowledgeBase } from "@workglow/knowledge-base";
import { ChunkRecordArraySchema, TypeKnowledgeBase } from "@workglow/knowledge-base";
import type { CachePolicy, IRunConfig, TaskConfig } from "@workglow/task-graph";
import { CreateWorkflow, IExecuteContext, Task, Workflow } from "@workglow/task-graph";
import { DataPortSchema, TypedArray, TypedArraySchema } from "@workglow/util/schema";
import type { CachePolicy, IExecuteContext, IRunConfig, TaskConfig } from "@workglow/task-graph";
import { CreateWorkflow, Task, Workflow } from "@workglow/task-graph";
import type { DataPortSchema, TypedArray } from "@workglow/util/schema";
import { TypedArraySchema } from "@workglow/util/schema";
import type { Capability } from "../capability/Capabilities";
import { TypeSingleOrArray } from "./base/AiTaskSchemas";

Expand Down
11 changes: 5 additions & 6 deletions packages/ai/src/task/ContextBuilderTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
*/

import { estimateTokens } from "@workglow/knowledge-base";
import type { IRunConfig, TaskConfig } from "@workglow/task-graph";
import {
CreateWorkflow,
import type {
IExecuteContext,
IExecutePreviewContext,
Task,
Workflow,
IRunConfig,
TaskConfig,
} from "@workglow/task-graph";
import { DataPortSchema } from "@workglow/util/schema";
import { CreateWorkflow, Task, Workflow } from "@workglow/task-graph";
import type { DataPortSchema } from "@workglow/util/schema";
import type { Capability } from "../capability/Capabilities";
import type { ModelConfig } from "../model/ModelSchema";
import { CountTokensTask } from "./CountTokensTask";
Expand Down
2 changes: 1 addition & 1 deletion packages/ai/src/task/CountTokensTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import type { IRunConfig, TaskConfig } from "@workglow/task-graph";
import { CreateWorkflow, Workflow } from "@workglow/task-graph";
import { DataPortSchema } from "@workglow/util/schema";
import type { DataPortSchema } from "@workglow/util/schema";
import type { Capability } from "../capability/Capabilities";
import type { ModelConfig } from "../model/ModelSchema";
import { AiTask } from "./base/AiTask";
Expand Down
19 changes: 12 additions & 7 deletions packages/ai/src/task/DocumentEnricherTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { DocumentRootNode, getChildren, hasChildren } from "@workglow/knowledge-base";

import type { DocumentNode, Entity, NodeEnrichment } from "@workglow/knowledge-base";
import type { IRunConfig, TaskConfig } from "@workglow/task-graph";
import { CreateWorkflow, IExecuteContext, Task, Workflow } from "@workglow/task-graph";
import { DataPortSchema } from "@workglow/util/schema";
import { getChildren, hasChildren } from "@workglow/knowledge-base";

import type {
DocumentNode,
DocumentRootNode,
Entity,
NodeEnrichment,
} from "@workglow/knowledge-base";
import type { IExecuteContext, IRunConfig, TaskConfig } from "@workglow/task-graph";
import { CreateWorkflow, Task, Workflow } from "@workglow/task-graph";
import type { DataPortSchema } from "@workglow/util/schema";
import type { Capability } from "../capability/Capabilities";
import { ModelConfig } from "../model/ModelSchema";
import type { ModelConfig } from "../model/ModelSchema";
import { TextNamedEntityRecognitionTask } from "./TextNamedEntityRecognitionTask";
import { TextSummaryTask } from "./TextSummaryTask";
import { TypeModel } from "./base/AiTaskSchemas";
Expand Down
15 changes: 5 additions & 10 deletions packages/ai/src/task/DocumentUpsertTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type { DocumentMetadata, DocumentNode } from "@workglow/knowledge-base";
import {
Document,
DocumentMetadataSchema,
KnowledgeBase,
TypeKnowledgeBase,
} from "@workglow/knowledge-base";
import type { CachePolicy, IRunConfig, TaskConfig } from "@workglow/task-graph";
import { CreateWorkflow, IExecuteContext, Task, Workflow } from "@workglow/task-graph";
import { DataPortSchema } from "@workglow/util/schema";
import type { DocumentMetadata, DocumentNode, KnowledgeBase } from "@workglow/knowledge-base";
import { Document, DocumentMetadataSchema, TypeKnowledgeBase } from "@workglow/knowledge-base";
import type { CachePolicy, IExecuteContext, IRunConfig, TaskConfig } from "@workglow/task-graph";
import { CreateWorkflow, Task, Workflow } from "@workglow/task-graph";
import type { DataPortSchema } from "@workglow/util/schema";
import type { Capability } from "../capability/Capabilities";

const inputSchema = {
Expand Down
Loading
Loading