@harness-engineering/orchestrator 0.2.2 → 0.2.3

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.
Files changed (2) hide show
  1. package/README.md +135 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # @harness-engineering/orchestrator
2
+
3
+ Orchestrator daemon for dispatching coding agents to issues. Polls an issue tracker for candidate tasks, manages ephemeral workspaces, runs agents to resolve issues, and updates the tracker with progress.
4
+
5
+ ## Architecture
6
+
7
+ ```
8
+ ┌──────────────────────────────────────────────────┐
9
+ │ Issue Tracker │
10
+ │ RoadmapTrackerAdapter · Linear Extension │
11
+ └──────────────────┬───────────────────────────────┘
12
+
13
+ ┌──────────────────────────────────────────────────┐
14
+ │ Core State Machine │
15
+ │ Candidate Selection · Concurrency Control │
16
+ │ Reconciliation · Retry Logic │
17
+ │ Event Sourcing (applyEvent → side effects) │
18
+ └──────────────────┬───────────────────────────────┘
19
+
20
+ ┌────────────────┐ ┌─────────────────┐
21
+ │ Agent Runner │ │ Workspaces │
22
+ │ Claude Backend│ │ WorkspaceManager│
23
+ │ Mock Backend │ │ WorkspaceHooks │
24
+ └───────┬────────┘ └────────┬────────┘
25
+ └────────┬───────────┘
26
+
27
+ ┌──────────────────────────────────────────────────┐
28
+ │ Prompt Rendering (LiquidJS) │
29
+ └──────────────────────────────────────────────────┘
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ ```ts
35
+ import {
36
+ Orchestrator,
37
+ loadWorkflowConfig,
38
+ WorkspaceManager,
39
+ WorkspaceHooks,
40
+ ClaudeBackend,
41
+ PromptRenderer,
42
+ RoadmapTrackerAdapter,
43
+ } from '@harness-engineering/orchestrator';
44
+
45
+ // Load workflow configuration
46
+ const config = loadWorkflowConfig('./workflow.yaml');
47
+
48
+ // Create and start the orchestrator
49
+ const orchestrator = new Orchestrator(config);
50
+ await orchestrator.start();
51
+ ```
52
+
53
+ ## Core Concepts
54
+
55
+ ### Event-Sourced State Machine
56
+
57
+ The orchestrator uses an event-sourced architecture. All state transitions are modeled as events (`OrchestratorEvent`) that produce side effects (`SideEffect`):
58
+
59
+ ```ts
60
+ import { applyEvent, createEmptyState } from '@harness-engineering/orchestrator';
61
+
62
+ const state = createEmptyState();
63
+ const { state: next, effects } = applyEvent(state, event);
64
+ // effects: DispatchEffect, StopEffect, ScheduleRetryEffect, etc.
65
+ ```
66
+
67
+ ### Candidate Selection
68
+
69
+ Issues are ranked and filtered before dispatch:
70
+
71
+ ```ts
72
+ import { sortCandidates, selectCandidates, isEligible } from '@harness-engineering/orchestrator';
73
+
74
+ const ranked = sortCandidates(issues);
75
+ const selected = selectCandidates(ranked, availableSlots);
76
+ ```
77
+
78
+ ### Agent Backends
79
+
80
+ Two backends are available:
81
+
82
+ - **`ClaudeBackend`** — Production backend using the Claude API
83
+ - **`MockBackend`** — Test backend for deterministic behavior in tests
84
+
85
+ ### Workspace Management
86
+
87
+ Each agent run gets an ephemeral workspace with lifecycle hooks:
88
+
89
+ ```ts
90
+ import { WorkspaceManager, WorkspaceHooks } from '@harness-engineering/orchestrator';
91
+
92
+ const manager = new WorkspaceManager(config);
93
+ const hooks = new WorkspaceHooks(config);
94
+ ```
95
+
96
+ ## API
97
+
98
+ ### Orchestrator
99
+
100
+ The main class that ties everything together:
101
+
102
+ - `start()` — Begin polling and dispatching
103
+ - `stop()` — Gracefully shut down
104
+ - Events: `state_change`, `agent_event`
105
+
106
+ ### Core Functions
107
+
108
+ | Export | Description |
109
+ | --------------------- | ----------------------------------------------------------- |
110
+ | `applyEvent` | Apply an event to state, returning new state + side effects |
111
+ | `createEmptyState` | Create an initial empty orchestrator state |
112
+ | `sortCandidates` | Rank issues by priority and eligibility |
113
+ | `selectCandidates` | Select top candidates within concurrency limits |
114
+ | `isEligible` | Check if an issue is eligible for dispatch |
115
+ | `getAvailableSlots` | Get number of available agent slots |
116
+ | `canDispatch` | Check if dispatch is possible given current state |
117
+ | `reconcile` | Reconcile expected state against actual state |
118
+ | `calculateRetryDelay` | Compute exponential backoff delay |
119
+
120
+ ### Tracker Adapters
121
+
122
+ | Export | Description |
123
+ | ------------------------ | ---------------------------------------- |
124
+ | `RoadmapTrackerAdapter` | Reads issues from `docs/roadmap.md` |
125
+ | `LinearTrackerExtension` | Extends tracking with Linear integration |
126
+
127
+ ### Prompt Rendering
128
+
129
+ | Export | Description |
130
+ | ---------------- | -------------------------------------------- |
131
+ | `PromptRenderer` | Renders LiquidJS templates for agent prompts |
132
+
133
+ ## License
134
+
135
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harness-engineering/orchestrator",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Orchestrator daemon for dispatching coding agents to issues",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -41,7 +41,7 @@
41
41
  "chokidar": "^3.5.3",
42
42
  "ink": "^4.4.1",
43
43
  "react": "^18.2.0",
44
- "@harness-engineering/core": "0.13.0",
44
+ "@harness-engineering/core": "0.13.1",
45
45
  "@harness-engineering/types": "0.3.1"
46
46
  },
47
47
  "devDependencies": {