Files
Agentic-Compaction-and-Pipl…/pipeline-system/index.ts
admin c629646b9f Complete Agent Pipeline System with Claude Code & OpenClaw Integration
- Added Claude Code integration with full context compaction support
- Added OpenClaw integration with deterministic pipeline support
- Implemented parallel agent execution (4 projects x 3 roles pattern)
- Added workspace isolation with permissions and quotas
- Implemented Lobster-compatible YAML workflow parser
- Added persistent memory store for cross-session context
- Created comprehensive README with hero section

This project was 100% autonomously built by Z.AI GLM-5
2026-03-03 13:12:14 +00:00

207 lines
6.9 KiB
TypeScript

/**
* Deterministic Multi-Agent Pipeline System
*
* A comprehensive system for building deterministic, parallel, event-driven
* multi-agent pipelines that integrate with Claude Code and OpenClaw.
*
* Key Features:
* - Deterministic orchestration (state machine, not LLM decision)
* - Parallel execution (up to 12 concurrent agent sessions)
* - Event-driven coordination (agents finish → next triggers)
* - Full agent capabilities (tools, memory, identity, workspace)
*
* @module pipeline-system
*/
// Core
export {
DeterministicStateMachine,
StateMachineRegistry,
stateMachineRegistry
} from './core/state-machine';
export type {
State,
StateStatus,
Transition,
Condition,
RetryConfig,
StateMachineDefinition,
StateMachineInstance,
StateTransition,
Event,
ErrorHandling
} from './core/state-machine';
// Engine
export {
ParallelExecutionEngine,
defaultExecutor
} from './engine/parallel-executor';
export type {
AgentRole,
TaskStatus,
WorkerStatus,
AgentSession,
AgentIdentity,
PipelineTask,
Worker,
ExecutionConfig,
ExecutionResult
} from './engine/parallel-executor';
// Events
export {
EventBus,
EventChain,
PipelineEventTypes,
defaultEventBus
} from './events/event-bus';
export type {
PipelineEvent,
EventHandler,
EventFilter,
Subscription,
EventBusConfig,
EventBusStats,
EventPriority
} from './events/event-bus';
// Workspace
export {
WorkspaceManager,
WorkspaceFactory,
defaultWorkspaceFactory
} from './workspace/agent-workspace';
export type {
Permission,
WorkspaceConfig,
ResourceLimits,
MountPoint,
AgentTool,
ToolContext,
ToolResult,
MemoryStore
} from './workspace/agent-workspace';
// Workflows
export {
WorkflowParser,
WorkflowRegistry,
CODE_PIPELINE_WORKFLOW,
PARALLEL_PROJECTS_WORKFLOW,
HUMAN_APPROVAL_WORKFLOW,
defaultWorkflowRegistry
} from './workflows/yaml-workflow';
export type {
YAMLWorkflow,
YAMLState,
YAMLTransition,
YAMLCondition,
YAMLRetryConfig,
YAMLLoopConfig
} from './workflows/yaml-workflow';
// Integrations
export {
PipelineOrchestrator,
createCodePipeline,
createParallelPipeline,
runWorkflow,
defaultOrchestrator
} from './integrations/claude-code';
export type {
PipelineConfig,
ProjectConfig,
TaskConfig,
PipelineResult,
ProjectResult,
TaskResult,
AgentMessage
} from './integrations/claude-code';
// Version
export const VERSION = '1.0.0';
/**
* Quick Start Example:
*
* ```typescript
* import {
* PipelineOrchestrator,
* createCodePipeline,
* runWorkflow
* } from './pipeline-system';
*
* // Option 1: Simple code pipeline
* const pipelineId = await createCodePipeline([
* {
* id: 'project-1',
* name: 'My Project',
* tasks: [
* { type: 'implement', description: 'Create auth module', role: 'programmer' },
* { type: 'review', description: 'Review auth module', role: 'reviewer' },
* { type: 'test', description: 'Test auth module', role: 'tester' }
* ]
* }
* ]);
*
* // Option 2: Run predefined workflow
* const workflowId = await runWorkflow('code-pipeline', {
* projectId: 'my-project',
* requirements: 'Build REST API'
* });
*
* // Option 3: Custom configuration
* const orchestrator = new PipelineOrchestrator();
* await orchestrator.initialize();
*
* const customPipelineId = await orchestrator.createPipeline({
* name: 'Custom Pipeline',
* projects: [...],
* roles: ['programmer', 'reviewer', 'tester'],
* maxConcurrency: 12
* });
*
* // Subscribe to events
* orchestrator.onEvent('agent.completed', (event) => {
* console.log('Agent completed:', event.payload);
* });
* ```
*
* ## Architecture
*
* ```
* ┌─────────────────────────────────────────────────────────────────┐
* │ Pipeline Orchestrator │
* │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
* │ │ State Machine│ │Event Bus │ │ Parallel Exec│ │
* │ │ (Deterministic│ │(Coordination)│ │ (Concurrency)│ │
* │ └──────────────┘ └──────────────┘ └──────────────┘ │
* │ │ │ │ │
* │ ┌──────┴────────────────┴─────────────────┴──────┐ │
* │ │ Agent Workspaces │ │
* │ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
* │ │ │Programmer│ │Reviewer │ │ Tester │ │ │
* │ │ │Workspace │ │Workspace│ │Workspace│ │ │
* │ │ │ • Tools │ │ • Tools │ │ • Tools │ │ │
* │ │ │ • Memory │ │ • Memory│ │ • Memory│ │ │
* │ │ │ • Files │ │ • Files │ │ • Files │ │ │
* │ │ └─────────┘ └─────────┘ └─────────┘ │ │
* │ └────────────────────────────────────────────────┘ │
* └─────────────────────────────────────────────────────────────────┘
* │
* ▼
* ┌─────────────────────────────────────────────────────────────────┐
* │ LLM Provider (ZAI SDK) │
* └─────────────────────────────────────────────────────────────────┘
* ```
*
* ## Key Principles
*
* 1. **Deterministic Flow**: State machines control the pipeline, not LLM decisions
* 2. **Event-Driven**: Agents communicate through events, enabling loose coupling
* 3. **Parallel Execution**: Multiple agents work concurrently with resource isolation
* 4. **Workspace Isolation**: Each agent has its own tools, memory, and file space
* 5. **YAML Workflows**: Define pipelines declaratively, compatible with Lobster
*/