opencode-orchestrator 1.2.62 β 1.2.67
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.
- package/README.md +197 -42
- package/dist/core/agents/consts/task-status.const.d.ts +2 -21
- package/dist/core/loop/circuit-breaker.d.ts +19 -0
- package/dist/core/loop/compaction-guard.d.ts +15 -0
- package/dist/core/loop/mission-loop-handler.d.ts +3 -12
- package/dist/core/loop/mission-loop.d.ts +0 -4
- package/dist/core/loop/progress-tracker.d.ts +39 -0
- package/dist/core/loop/session-state-store.d.ts +26 -0
- package/dist/core/notification/toast-core.d.ts +1 -1
- package/dist/core/plugins/plugin-manager.d.ts +2 -1
- package/dist/index.js +578 -113
- package/dist/scripts/postinstall.js +296 -38
- package/dist/scripts/preuninstall.js +268 -20
- package/dist/shared/index.d.ts +0 -1
- package/dist/shared/loop/constants/index.d.ts +1 -0
- package/dist/shared/loop/constants/task-status.d.ts +9 -0
- package/package.json +11 -6
- package/scripts/run-install-hook.mjs +66 -0
package/README.md
CHANGED
|
@@ -8,8 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
[](LICENSE)
|
|
10
10
|
[](https://www.npmjs.com/package/opencode-orchestrator)
|
|
11
|
+
<!-- VERSION:START -->
|
|
12
|
+
**Version:** `1.2.67`
|
|
13
|
+
<!-- VERSION:END -->
|
|
11
14
|
</div>
|
|
12
15
|
|
|
16
|
+
|
|
13
17
|
---
|
|
14
18
|
|
|
15
19
|
## β‘ Quick Start
|
|
@@ -18,61 +22,184 @@
|
|
|
18
22
|
npm install -g opencode-orchestrator
|
|
19
23
|
```
|
|
20
24
|
|
|
25
|
+
Install hooks are source-checkout safe, prefer `opencode.jsonc` when present, preserve sibling plugin entries, and skip automatic config mutation in CI environments.
|
|
26
|
+
|
|
21
27
|
Inside an OpenCode environment:
|
|
22
28
|
```bash
|
|
23
29
|
/task "Implement a new authentication module with JWT and audit logs"
|
|
24
30
|
```
|
|
25
31
|
|
|
32
|
+
|
|
26
33
|
---
|
|
27
34
|
|
|
28
35
|
## π Engine Workflow
|
|
29
36
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
β
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
37
|
+
**Hub-and-Spoke Architecture** with Work-Stealing Queues for parallel, context-isolated task execution.
|
|
38
|
+
```
|
|
39
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
40
|
+
β USER INPUT /task "..." β
|
|
41
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
42
|
+
β
|
|
43
|
+
βΌ
|
|
44
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
45
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
46
|
+
β β C O M M A N D E R β β
|
|
47
|
+
β β [ Mission Analysis & Delegation ] β β
|
|
48
|
+
β β β β
|
|
49
|
+
β β β’ Interprets user intent β’ Coordinates multi-agent workflow β β
|
|
50
|
+
β β β’ Monitors progress β’ Manages work-stealing queues β β
|
|
51
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
52
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
53
|
+
β
|
|
54
|
+
βββββββββββββββββΌββββββββββββββββ
|
|
55
|
+
βΌ βΌ βΌ
|
|
56
|
+
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
|
|
57
|
+
β P L A N N E R β β W O R K E R β β W O R K E R β
|
|
58
|
+
β [Architect] β β [Implementer] β β [Implementer] β
|
|
59
|
+
β β β β β β
|
|
60
|
+
β β’ Dependency β β β’ File coding β β β’ File coding β
|
|
61
|
+
β analysis β β β’ TDD workflow β β β’ TDD workflow β
|
|
62
|
+
β β’ Roadmap gen β β β’ Documentationβ β β’ Documentationβ
|
|
63
|
+
β β’ TODO.md β β β β β
|
|
64
|
+
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
|
|
65
|
+
β β β
|
|
66
|
+
β ββββββββββββββββΌββββββββββββββββββββββ
|
|
67
|
+
β β β
|
|
68
|
+
βΌ βΌ βΌ
|
|
69
|
+
ββββββββββββββββββββββββββββββββββββββββ
|
|
70
|
+
β SESSION POOL (MVCC Sync) β
|
|
71
|
+
β βββββββββββββββββββββββββββββββββββ β
|
|
72
|
+
β β Object Pool β Buffer Pool β β
|
|
73
|
+
β β String Pool β Connection Pool β β
|
|
74
|
+
β βββββββββββββββββββββββββββββββββββ β
|
|
75
|
+
ββββββββββββββββββββββββββββββββββββββββ
|
|
76
|
+
β
|
|
77
|
+
βΌ
|
|
78
|
+
ββββββββββββββββββββββββββββββββββββββββ
|
|
79
|
+
β MSVP MONITOR / REVIEWER β
|
|
80
|
+
β βββββββββββββββββββββββββββββββββββ β
|
|
81
|
+
β β β’ Adaptive polling (500ms-5s) β β
|
|
82
|
+
β β β’ Stability detection β β
|
|
83
|
+
β β β’ Unit test verification β β
|
|
84
|
+
β βββββββββββββββββββββββββββββββββββ β
|
|
85
|
+
ββββββββββββββββββββββββββββββββββββββββ
|
|
86
|
+
β
|
|
87
|
+
βΌ
|
|
88
|
+
ββββββββββββββββββ
|
|
89
|
+
β β¨ COMPLETED β
|
|
90
|
+
ββββββββββββββββββ
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## ποΈ Architecture Layers
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
99
|
+
β PRESENTATION LAYER β
|
|
100
|
+
β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββββββ β
|
|
101
|
+
β β Task Toast β β Progress β β Notificationβ β Mission Summary β β
|
|
102
|
+
β β Manager β β Notifier β β Manager β β Display β β
|
|
103
|
+
β βββββββββββββββ βββββββββββββββ βββββββββββββββ βββββββββββββββββββ β
|
|
104
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
105
|
+
β BUSINESS LOGIC LAYER β
|
|
106
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
107
|
+
β β Parallel Agent Orchestration β β
|
|
108
|
+
β β ββββββββββββββ ββββββββββββββ ββββββββββββββ ββββββββββββββββββ β β
|
|
109
|
+
β β β Commander β β Planner β β Worker β β Reviewer β β β
|
|
110
|
+
β β β Agent β β Agent β β Agent β β Agent β β β
|
|
111
|
+
β β ββββββββββββββ ββββββββββββββ ββββββββββββββ ββββββββββββββββββ β β
|
|
112
|
+
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
113
|
+
β βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββββββββββββββββ
|
|
114
|
+
β β Concurrency β β Task Store β β Hook System ββ
|
|
115
|
+
β β Controller β β (In-Memory) β β [Early/Normal/Late Phases] ββ
|
|
116
|
+
β βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββββββββββββββββ
|
|
117
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
118
|
+
β INFRASTRUCTURE LAYER β
|
|
119
|
+
β ββββββββββββββββββ ββββββββββββββββββ ββββββββββββββββββββββββββββββ β
|
|
120
|
+
β β Session Pool β β Work-Stealing β β Memory Pools β β
|
|
121
|
+
β β [5 per agent] β β [Chase-Lev] β β ββββββββ ββββββββ ββββββββ β
|
|
122
|
+
β β [10 reuse max] β β [LIFO/FIFO] β β βObjectβ βStringβ βBufferββ β
|
|
123
|
+
β ββββββββββββββββββ ββββββββββββββββββ β β 200 β β internβ β 4KB ββ β
|
|
124
|
+
β β ββββββββ ββββββββ ββββββββ β
|
|
125
|
+
β ββββββββββββββββββ ββββββββββββββββββ ββββββββββββββββββββββββββββββ β
|
|
126
|
+
β β MVCC State β β Circuit Breaker β ββββββββββββββββββββββββββββββ β
|
|
127
|
+
β β [Atomic Sync] β β [5 failuresβopenβ β Rust Connection Pool β β
|
|
128
|
+
β β β β [2 successβcloseβ β [4 processes, 30s idle] β β
|
|
129
|
+
β ββββββββββββββββββ ββββββββββββββββββ ββββββββββββββββββββββββββββββ β
|
|
130
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
131
|
+
β SAFETY LAYER β
|
|
132
|
+
β ββββββββββββββββββ ββββββββββββββββββ βββββββββββββββββββββββββββββββ β
|
|
133
|
+
β β RAII Pattern β β Shutdown β β Auto-Recovery β β
|
|
134
|
+
β β [Zero Leaks] β β Manager β β [Exponential Backoff] β β
|
|
135
|
+
β β β β [5s timeout] β β [Rate limit handling] β β
|
|
136
|
+
β ββββββββββββββββββ ββββββββββββββββββ βββββββββββββββββββββββββββββββ β
|
|
137
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## π§ͺ Test Utilities
|
|
143
|
+
|
|
144
|
+
Reusable test helpers keep filesystem, task, and process-heavy flows deterministic:
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
tests/harness/
|
|
148
|
+
βββ fixture.ts Disposable tmpdir utilities
|
|
149
|
+
β βββ tmpdir() async disposable with cleanup
|
|
150
|
+
β βββ tmpdirSync() sync disposable with cleanup
|
|
151
|
+
β βββ createMockFs() In-memory fs mock
|
|
152
|
+
β βββ waitFor() Async condition waiter
|
|
153
|
+
β
|
|
154
|
+
βββ builders.ts Factory functions for test objects
|
|
155
|
+
β βββ createParallelTask() Build ParallelTask instances
|
|
156
|
+
β βββ createBackgroundTask() Build BackgroundTask instances
|
|
157
|
+
β βββ createTodo() Build Todo instances
|
|
158
|
+
β
|
|
159
|
+
βββ mocks.ts Mock utilities
|
|
160
|
+
β βββ mockConsole() Spy on console.log/error
|
|
161
|
+
β βββ mockProcessExit() Mock process.exit
|
|
162
|
+
β βββ useFakeTimers() Time manipulation
|
|
163
|
+
β βββ createMockEmitter() EventEmitter spy
|
|
164
|
+
β
|
|
165
|
+
βββ index.ts Unified exports
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Usage Example
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
import { tmpdir, createParallelTask, mockConsole } from "@/tests/harness";
|
|
172
|
+
|
|
173
|
+
describe("My test", () => {
|
|
174
|
+
let consoleMock;
|
|
175
|
+
|
|
176
|
+
beforeEach(() => {
|
|
177
|
+
consoleMock = mockConsole();
|
|
178
|
+
consoleMock.setup();
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
afterEach(() => {
|
|
182
|
+
consoleMock.restore();
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it("should work", async () => {
|
|
186
|
+
await using tmp = await tmpdir({ git: true });
|
|
187
|
+
const task = createParallelTask({ description: "Test" });
|
|
188
|
+
expect(task.status).toBe("pending");
|
|
189
|
+
});
|
|
190
|
+
});
|
|
63
191
|
```
|
|
64
192
|
|
|
65
193
|
---
|
|
66
194
|
|
|
67
195
|
## β‘ Elite Multi-Agent Swarm
|
|
68
196
|
|
|
69
|
-
| Agent |
|
|
70
|
-
|
|
71
|
-
| **Commander** | Mission Hub |
|
|
72
|
-
| **Planner** | Architect |
|
|
197
|
+
| Agent | Role | Core Responsibilities |
|
|
198
|
+
|:------|:-----|:------------------------|
|
|
199
|
+
| **Commander** | Mission Hub | Task decomposition, agent coordination, work-stealing orchestration, final mission seal |
|
|
200
|
+
| **Planner** | Architect | Dependency analysis, roadmap generation, TODO.md creation via MVCC, file-level planning |
|
|
73
201
|
| **Worker** | Implementer | High-throughput coding, TDD workflow, documentation, isolated file execution |
|
|
74
|
-
| **Reviewer** | Auditor |
|
|
75
|
-
|
|
202
|
+
| **Reviewer** | Auditor | Unit test verification, LSP/Lint validation, integration testing, quality gate |
|
|
76
203
|
---
|
|
77
204
|
|
|
78
205
|
## π οΈ Core Capabilities
|
|
@@ -104,7 +231,7 @@ Maintains focus across thousands of conversation turns using a 4-tier memory str
|
|
|
104
231
|
|
|
105
232
|
---
|
|
106
233
|
|
|
107
|
-
##
|
|
234
|
+
## βοΈ Performance Benchmarks
|
|
108
235
|
|
|
109
236
|
| Metric | Improvement |
|
|
110
237
|
|:-------|:------------|
|
|
@@ -153,6 +280,9 @@ The installation process is **production-safe** with multiple protection layers:
|
|
|
153
280
|
3. β
**Atomic writes** β temp file + rename (OS-level atomic)
|
|
154
281
|
4. β
**Automatic rollback** β restores from backup on any failure
|
|
155
282
|
5. β
**Cross-platform** β Windows (native, Git Bash, WSL2), macOS, Linux
|
|
283
|
+
6. β
**CI-aware** β skips non-essential operations in CI environments
|
|
284
|
+
7. β
**Timeout protection** β 30s timeout prevents hanging
|
|
285
|
+
8. β
**Graceful degradation** β exits 0 on non-critical failures
|
|
156
286
|
|
|
157
287
|
### Configuration Logs
|
|
158
288
|
- Unix: `/tmp/opencode-orchestrator.log`
|
|
@@ -160,11 +290,36 @@ The installation process is **production-safe** with multiple protection layers:
|
|
|
160
290
|
|
|
161
291
|
---
|
|
162
292
|
|
|
293
|
+
## π§ͺ Testing & Stability
|
|
294
|
+
|
|
295
|
+
### Test Utilities
|
|
296
|
+
Reusable helpers under `tests/harness/` provide:
|
|
297
|
+
- **Disposable tmpdir**: Automatic cleanup with `Symbol.asyncDispose` / `Symbol.dispose`
|
|
298
|
+
- **Test builders**: Factory functions for `ParallelTask`, `BackgroundTask`, `Todo`
|
|
299
|
+
- **Mock utilities**: Console, process, timers, file system, event emitter mocks
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
import { tmpdir, createParallelTask, mockConsole } from "@/tests/harness";
|
|
303
|
+
|
|
304
|
+
await using tmp = await tmpdir({ git: true });
|
|
305
|
+
const task = createParallelTask({ description: "Test" });
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### TUI Stability
|
|
309
|
+
- **Cleanup guarantees**: `initToastClient()` returns a cleanup function
|
|
310
|
+
- **Timeout protection**: AbortController-based 2-10s timeout for async toast operations
|
|
311
|
+
- **Error isolation**: Try/catch around all toast operations prevents cascade failures
|
|
312
|
+
|
|
313
|
+
### Cross-Platform Reliability
|
|
314
|
+
- **Windows guard**: Proper handling of WSL2, Git Bash, native Windows paths
|
|
315
|
+
- **Signal handling**: Graceful shutdown on SIGINT/SIGTERM
|
|
316
|
+
- **Process isolation**: Child process cleanup with timeout
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
163
320
|
## π Documentation
|
|
164
321
|
|
|
165
|
-
- [Why We Built a Custom Orchestrator β](docs/WHY_CUSTOM_ORCHESTRATOR.md)
|
|
166
322
|
- [System Architecture Deep-Dive β](docs/SYSTEM_ARCHITECTURE.md)
|
|
167
|
-
- [Windows Configuration Guide β](docs/WINDOWS_CONFIGURATION.md)
|
|
168
323
|
- [Developer Notes β](docs/DEVELOPERS_NOTE.md)
|
|
169
324
|
|
|
170
325
|
---
|
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
export declare const TASK_STATUS: {
|
|
5
|
-
readonly PENDING: "pending";
|
|
6
|
-
readonly RUNNING: "running";
|
|
7
|
-
readonly COMPLETED: "completed";
|
|
8
|
-
readonly FAILED: "failed";
|
|
9
|
-
readonly ERROR: "error";
|
|
10
|
-
readonly TIMEOUT: "timeout";
|
|
11
|
-
readonly CANCELLED: "cancelled";
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* TODO_STATUS - Todo item status constants
|
|
15
|
-
*/
|
|
16
|
-
export declare const TODO_STATUS: {
|
|
17
|
-
readonly PENDING: "pending";
|
|
18
|
-
readonly IN_PROGRESS: "in_progress";
|
|
19
|
-
readonly COMPLETED: "completed";
|
|
20
|
-
readonly CANCELLED: "cancelled";
|
|
21
|
-
};
|
|
1
|
+
export { TASK_STATUS } from "../../../shared/loop/constants/task-status.js";
|
|
2
|
+
export { TODO_STATUS } from "../../../shared/loop/constants/todo-status.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Circuit Breaker - Loop Detection and Prevention
|
|
3
|
+
*
|
|
4
|
+
* Detects repetitive patterns and trips the circuit to prevent
|
|
5
|
+
* infinite loops. Uses tool call history for pattern detection.
|
|
6
|
+
*/
|
|
7
|
+
export interface CircuitBreakerState {
|
|
8
|
+
lastAccessedAt: number;
|
|
9
|
+
lastTrippedAt: number;
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
toolCallHistory: string[];
|
|
12
|
+
}
|
|
13
|
+
export declare function isCircuitOpen(sessionID: string): boolean;
|
|
14
|
+
export declare function detectRepetitiveToolUse(sessionID: string): string | null;
|
|
15
|
+
export declare function shouldTripCircuit(sessionID: string): boolean;
|
|
16
|
+
export declare function recordToolCall(sessionID: string, toolName: string): void;
|
|
17
|
+
export declare function clearCircuitState(sessionID: string): void;
|
|
18
|
+
export declare function getCircuitState(sessionID: string): CircuitBreakerState | undefined;
|
|
19
|
+
export declare function shutdownCircuitBreaker(): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compaction Guard - Prevents post-compaction Resume Errors
|
|
3
|
+
*
|
|
4
|
+
* After session compaction, continuation prompts may reference deleted context.
|
|
5
|
+
* This guard ensures continuation only happens after a newer compaction epoch.
|
|
6
|
+
*/
|
|
7
|
+
export interface CompactionGuardState {
|
|
8
|
+
compactionEpoch: number;
|
|
9
|
+
lastAccessedAt: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function armCompactionGuard(sessionID: string, timestamp: number): number;
|
|
12
|
+
export declare function isCompactionSafe(sessionID: string, currentEpoch: number): boolean;
|
|
13
|
+
export declare function clearCompactionState(sessionID: string): void;
|
|
14
|
+
export declare function getCompactionState(sessionID: string): CompactionGuardState | undefined;
|
|
15
|
+
export declare function shutdownCompactionGuard(): void;
|
|
@@ -3,23 +3,14 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Monitors session events and ensures the mission loop continues
|
|
5
5
|
* until all verification requirements are met.
|
|
6
|
+
*
|
|
7
|
+
* Integrates: ProgressTracker, SessionStateStore, CompactionGuard, CircuitBreaker
|
|
6
8
|
*/
|
|
7
9
|
import type { PluginInput } from "@opencode-ai/plugin";
|
|
8
10
|
type OpencodeClient = PluginInput["client"];
|
|
9
|
-
/**
|
|
10
|
-
* Handle session.idle event for mission loop
|
|
11
|
-
*/
|
|
12
11
|
export declare function handleMissionIdle(client: OpencodeClient, directory: string, sessionID: string, mainSessionID?: string): Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* Handle user message - cancel countdown
|
|
15
|
-
*/
|
|
16
12
|
export declare function handleUserMessage(sessionID: string): void;
|
|
17
|
-
/**
|
|
18
|
-
* Handle abort
|
|
19
|
-
*/
|
|
20
13
|
export declare function handleAbort(sessionID: string): void;
|
|
21
|
-
/**
|
|
22
|
-
* Clean up session state
|
|
23
|
-
*/
|
|
24
14
|
export declare function cleanupSession(sessionID: string): void;
|
|
15
|
+
export declare function handleSessionCompacted(sessionID: string): void;
|
|
25
16
|
export {};
|
|
@@ -42,7 +42,3 @@ export declare function generateMissionContinuationPrompt(state: MissionLoopStat
|
|
|
42
42
|
* Generate completion notification
|
|
43
43
|
*/
|
|
44
44
|
export declare function generateCompletionNotification(state: MissionLoopState): string;
|
|
45
|
-
/**
|
|
46
|
-
* Generate max iterations reached notification
|
|
47
|
-
*/
|
|
48
|
-
export declare function generateMaxIterationsNotification(state: MissionLoopState): string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress Tracker - Snapshot-based Progress Tracking
|
|
3
|
+
*
|
|
4
|
+
* Implements content-hash-based progress detection to identify when
|
|
5
|
+
* agents are truly making progress vs just cycling without completion.
|
|
6
|
+
*/
|
|
7
|
+
export interface NormalizedTodo {
|
|
8
|
+
id: string | null;
|
|
9
|
+
content: string;
|
|
10
|
+
priority: string;
|
|
11
|
+
status: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ProgressUpdateResult {
|
|
14
|
+
hasProgressed: boolean;
|
|
15
|
+
stagnationCount: number;
|
|
16
|
+
previousIncompleteCount?: number;
|
|
17
|
+
progressSource: "none" | "count" | "snapshot";
|
|
18
|
+
recoveredFromStagnation?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const DEFAULT_STAGNATION_THRESHOLD = 3;
|
|
21
|
+
export declare const PROGRESS_GRACE_PERIOD_MS = 5000;
|
|
22
|
+
export declare function hashTodos(todos: NormalizedTodo[]): string;
|
|
23
|
+
export declare function countCompleted(todos: NormalizedTodo[]): number;
|
|
24
|
+
export declare function resetProgress(sessionID: string): void;
|
|
25
|
+
export declare function clearSession(sessionID: string): void;
|
|
26
|
+
export declare function trackProgress(sessionID: string, incompleteCount: number, todos?: NormalizedTodo[]): ProgressUpdateResult;
|
|
27
|
+
export declare function markInjectionPerformed(sessionID: string): void;
|
|
28
|
+
export declare function isStagnant(sessionID: string, threshold?: number): boolean;
|
|
29
|
+
export declare function getStagnationCount(sessionID: string): number;
|
|
30
|
+
export interface ProgressTracker {
|
|
31
|
+
trackProgress: typeof trackProgress;
|
|
32
|
+
resetProgress: typeof resetProgress;
|
|
33
|
+
clearSession: typeof clearSession;
|
|
34
|
+
hashTodos: typeof hashTodos;
|
|
35
|
+
isStagnant: typeof isStagnant;
|
|
36
|
+
getStagnationCount: typeof getStagnationCount;
|
|
37
|
+
markInjectionPerformed: typeof markInjectionPerformed;
|
|
38
|
+
}
|
|
39
|
+
export declare function createProgressTracker(): ProgressTracker;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session State Store - TTL-based Session State Management
|
|
3
|
+
*
|
|
4
|
+
* Provides automatic cleanup of stale session states to prevent memory leaks.
|
|
5
|
+
*/
|
|
6
|
+
export interface SessionState {
|
|
7
|
+
stagnationCount: number;
|
|
8
|
+
countdownTimer?: ReturnType<typeof setTimeout>;
|
|
9
|
+
countdownStartedAt?: number;
|
|
10
|
+
lastCheckTime?: number;
|
|
11
|
+
isRecovering: boolean;
|
|
12
|
+
isAborting: boolean;
|
|
13
|
+
inFlight: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const SESSION_STATE_TTL_MS: number;
|
|
16
|
+
export declare const PRUNE_INTERVAL_MS: number;
|
|
17
|
+
export interface SessionStateStore {
|
|
18
|
+
getState: (sessionID: string) => SessionState;
|
|
19
|
+
getExistingState: (sessionID: string) => SessionState | undefined;
|
|
20
|
+
cancelCountdown: (sessionID: string) => void;
|
|
21
|
+
cleanup: (sessionID: string) => void;
|
|
22
|
+
cancelAllCountdowns: () => void;
|
|
23
|
+
shutdown: () => void;
|
|
24
|
+
}
|
|
25
|
+
declare function createSessionStateStore(): SessionStateStore;
|
|
26
|
+
export { createSessionStateStore };
|
|
@@ -8,7 +8,7 @@ type OpencodeClient = PluginInput["client"];
|
|
|
8
8
|
/**
|
|
9
9
|
* Initialize the toast system with the OpenCode client
|
|
10
10
|
*/
|
|
11
|
-
export declare function initToastClient(client: OpencodeClient): void;
|
|
11
|
+
export declare function initToastClient(client: OpencodeClient): () => void;
|
|
12
12
|
/**
|
|
13
13
|
* Register a notification handler
|
|
14
14
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PluginManager - Manages dynamic loading of orchestrator plugins
|
|
3
3
|
*/
|
|
4
|
+
import type { ToolDefinition } from "@opencode-ai/plugin";
|
|
4
5
|
export declare class PluginManager {
|
|
5
6
|
private static instance;
|
|
6
7
|
private plugins;
|
|
@@ -17,7 +18,7 @@ export declare class PluginManager {
|
|
|
17
18
|
/**
|
|
18
19
|
* Get all dynamically registered tools
|
|
19
20
|
*/
|
|
20
|
-
getDynamicTools(): Record<string,
|
|
21
|
+
getDynamicTools(): Record<string, ToolDefinition>;
|
|
21
22
|
/**
|
|
22
23
|
* Shutdown - cleanup all plugins
|
|
23
24
|
*/
|