provisioning/docs/src/architecture/orchestrator-integration-model.md

2 lines
22 KiB
Markdown
Raw Normal View History

# Orchestrator Integration Model - Deep Dive\n\n**Date:** 2025-10-01\n**Status:** Clarification Document\n**Related:** [Multi-Repo Strategy](multi-repo-strategy.md), [Hybrid Orchestrator v3.0](../user/hybrid-orchestrator.md)\n\n## Executive Summary\n\nThis document clarifies **how the Rust orchestrator integrates with Nushell core** in both monorepo and multi-repo architectures. The orchestrator is\na **critical performance layer** that coordinates Nushell business logic execution, solving deep call stack limitations while preserving all existing\nfunctionality.\n\n---\n\n## Current Architecture (Hybrid Orchestrator v3.0)\n\n### The Problem Being Solved\n\n**Original Issue:**\n\n```\nDeep call stack in Nushell (template.nu:71)\n→ "Type not supported" errors\n→ Cannot handle complex nested workflows\n→ Performance bottlenecks with recursive calls\n```\n\n**Solution:** Rust orchestrator provides:\n\n1. **Task queue management** (file-based, reliable)\n2. **Priority scheduling** (intelligent task ordering)\n3. **Deep call stack elimination** (Rust handles recursion)\n4. **Performance optimization** (async/await, parallel execution)\n5. **State management** (workflow checkpointing)\n\n### How It Works Today (Monorepo)\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│ User │\n└───────────────────────────┬─────────────────────────────────┘\n │ calls\n ↓\n ┌───────────────┐\n │ provisioning │ (Nushell CLI)\n │ CLI │\n └───────┬───────┘\n │\n ┌───────────────────┼───────────────────┐\n │ │ │\n ↓ ↓ ↓\n┌───────────────┐ ┌───────────────┐ ┌──────────────┐\n│ Direct Mode │ │Orchestrated │ │ Workflow │\n│ (Simple ops) │ │ Mode │ │ Mode │\n└───────────────┘ └───────┬───────┘ └──────┬───────┘\n │ │\n ↓ ↓\n ┌────────────────────────────────┐\n │ Rust Orchestrator Service │\n │ (Background daemon) │\n │ │\n │ • Task Queue (file-based) │\n │ • Priority Scheduler │\n │ • Workflow Engine │\n │ • REST API Server │\n └────────┬───────────────────────┘\n │ spawns\n ↓\n ┌────────────────┐\n │ Nushell │\n │ Business Logic │\n │ │\n │ • servers.nu │\n │ • taskservs.nu │\n │ • clusters.nu │\n └────────────────┘\n```\n\n### Three Execution Modes\n\n#### Mode 1: Direct Mo