opencode-orchestrator 1.2.1 → 1.2.6

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 CHANGED
@@ -93,8 +93,14 @@ Combines LLM reasoning with deterministic **AST/LSP verification**. Every code c
93
93
  - **Diagnostic Intervention**: Forces the agent into a "Diagnostic Mode" when stagnation is detected, mandating log audits and strategy pivots.
94
94
  - **Proactive Agency**: Mandates Speculative Planning and Parallel Thinking during background task execution.
95
95
 
96
- ### 📊 Real-time TUI Monitor
97
- A live dashboard directly in your TUI. Monitor **Mission Progress**, active **Agent Sub-sessions**, and **Technical Metrics** through optimized, protocol-safe channels.
96
+ ### 📊 Native TUI Integration
97
+ Seamless integration with OpenCode's native TUI via **TaskToastManager**. Provides non-intrusive, real-time feedback on **Mission Progress**, active **Agent Sub-sessions**, and **Technical Metrics** using protocol-safe Toast notifications.
98
+
99
+ ### ⚡ Event-Driven Architecture
100
+ Utilizes a hybrid event-driven pipeline (`EventHandler` + `TaskPoller`) to maximize responsiveness while maintaining robust state tracking and resource cleanup.
101
+
102
+ ### 🔒 Secure Configuration
103
+ Runtime agent configuration is strictly validated using **Zod schemas**, ensuring that custom agent definitions in `agents.json` are type-safe and error-free before execution.
98
104
 
99
105
  ---
100
106
 
@@ -117,7 +123,7 @@ A live dashboard directly in your TUI. Monitor **Mission Progress**, active **Ag
117
123
 
118
124
  ---
119
125
 
120
- [Internal Architecture Deep-Dive →](docs/SYSTEM_ARCHITECTURE.md)
126
+ [Internal Architecture Deep-Dive →](docs/SYSTEM_ARCHITECTURE.md) | [Windows Configuration Guide →](docs/WINDOWS_CONFIGURATION.md)
121
127
 
122
128
  ## 📄 License
123
129
  MIT License.
@@ -25,5 +25,4 @@ export declare class AgentRegistry {
25
25
  * Load custom agents from .opencode/agents.json
26
26
  */
27
27
  private loadCustomAgents;
28
- private isValidAgentDefinition;
29
28
  }
package/dist/index.js CHANGED
@@ -18927,14 +18927,12 @@ var TaskToastManager = class {
18927
18927
  * Show consolidated toast with all running/queued tasks
18928
18928
  */
18929
18929
  showTaskListToast(newTask) {
18930
- if (!this.client) return;
18931
- const tuiClient2 = this.client;
18932
- if (!tuiClient2.tui?.showToast) return;
18930
+ if (!this.client || !this.client.tui) return;
18933
18931
  const message = this.buildTaskListMessage(newTask);
18934
18932
  const running = this.getRunningTasks();
18935
18933
  const queued = this.getQueuedTasks();
18936
18934
  const title = newTask.isBackground ? `Background Task Started` : `Task Started`;
18937
- tuiClient2.tui.showToast({
18935
+ this.client.tui.showToast({
18938
18936
  body: {
18939
18937
  title,
18940
18938
  message: message || `${newTask.description} (${newTask.agent})`,
@@ -18948,9 +18946,7 @@ var TaskToastManager = class {
18948
18946
  * Show task completion toast
18949
18947
  */
18950
18948
  showCompletionToast(info) {
18951
- if (!this.client) return;
18952
- const tuiClient2 = this.client;
18953
- if (!tuiClient2.tui?.showToast) return;
18949
+ if (!this.client || !this.client.tui) return;
18954
18950
  this.removeTask(info.id);
18955
18951
  const remaining = this.getRunningTasks();
18956
18952
  const queued = this.getQueuedTasks();
@@ -18972,7 +18968,7 @@ ${info.error || ""}`;
18972
18968
 
18973
18969
  Still running: ${remaining.length} | Queued: ${queued.length}`;
18974
18970
  }
18975
- tuiClient2.tui.showToast({
18971
+ this.client.tui.showToast({
18976
18972
  body: {
18977
18973
  title,
18978
18974
  message,
@@ -18986,13 +18982,11 @@ Still running: ${remaining.length} | Queued: ${queued.length}`;
18986
18982
  * Show all-tasks-complete summary toast
18987
18983
  */
18988
18984
  showAllCompleteToast(parentSessionID, completedTasks) {
18989
- if (!this.client) return;
18990
- const tuiClient2 = this.client;
18991
- if (!tuiClient2.tui?.showToast) return;
18985
+ if (!this.client || !this.client.tui) return;
18992
18986
  const successCount = completedTasks.filter((t) => t.status === STATUS_LABEL.COMPLETED).length;
18993
18987
  const failCount = completedTasks.filter((t) => t.status === STATUS_LABEL.ERROR || t.status === STATUS_LABEL.CANCELLED || t.status === STATUS_LABEL.FAILED).length;
18994
18988
  const taskList = completedTasks.map((t) => `- [${t.status === STATUS_LABEL.COMPLETED ? "OK" : "FAIL"}] ${t.description} (${t.duration})`).join("\n");
18995
- tuiClient2.tui.showToast({
18989
+ this.client.tui.showToast({
18996
18990
  body: {
18997
18991
  title: "All Tasks Completed",
18998
18992
  message: `${successCount} succeeded, ${failCount} failed
@@ -19008,9 +19002,7 @@ ${taskList}`,
19008
19002
  * Show Mission Complete toast (Grand Finale)
19009
19003
  */
19010
19004
  showMissionCompleteToast(title = "Mission Complete", message = "All tasks completed successfully.") {
19011
- if (!this.client) return;
19012
- const tuiClient2 = this.client;
19013
- if (!tuiClient2.tui?.showToast) return;
19005
+ if (!this.client || !this.client.tui) return;
19014
19006
  const decoratedMessage = `
19015
19007
  ${TUI_ICONS.MISSION_COMPLETE} ${TUI_MESSAGES.MISSION_COMPLETE_TITLE} ${TUI_ICONS.MISSION_COMPLETE}
19016
19008
  \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
@@ -19018,7 +19010,7 @@ ${message}
19018
19010
  \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
19019
19011
  ${TUI_MESSAGES.MISSION_COMPLETE_SUBTITLE}
19020
19012
  `.trim();
19021
- tuiClient2.tui.showToast({
19013
+ this.client.tui.showToast({
19022
19014
  body: {
19023
19015
  title: `${TUI_ICONS.SHIELD} ${title}`,
19024
19016
  message: decoratedMessage,
@@ -19033,14 +19025,12 @@ ${TUI_MESSAGES.MISSION_COMPLETE_SUBTITLE}
19033
19025
  * Show progress toast (for long-running tasks)
19034
19026
  */
19035
19027
  showProgressToast(taskId, progress) {
19036
- if (!this.client) return;
19037
- const tuiClient2 = this.client;
19038
- if (!tuiClient2.tui?.showToast) return;
19028
+ if (!this.client || !this.client.tui) return;
19039
19029
  const task = this.tasks.get(taskId);
19040
19030
  if (!task) return;
19041
19031
  const percentage = Math.round(progress.current / progress.total * 100);
19042
19032
  const progressBar = `[${"#".repeat(Math.floor(percentage / 10))}${"-".repeat(10 - Math.floor(percentage / 10))}]`;
19043
- tuiClient2.tui.showToast({
19033
+ this.client.tui.showToast({
19044
19034
  body: {
19045
19035
  title: `Task Progress: ${task.description}`,
19046
19036
  message: `${progressBar} ${percentage}%
@@ -19433,6 +19423,22 @@ var MemoryManager = class _MemoryManager {
19433
19423
  init_shared();
19434
19424
  import * as fs4 from "fs/promises";
19435
19425
  import * as path4 from "path";
19426
+ var AgentDefinitionSchema = external_exports.object({
19427
+ id: external_exports.string(),
19428
+ // ID is required inside the definition object
19429
+ description: external_exports.string(),
19430
+ systemPrompt: external_exports.string(),
19431
+ mode: external_exports.enum(["primary", "subagent"]).optional(),
19432
+ color: external_exports.string().optional(),
19433
+ hidden: external_exports.boolean().optional(),
19434
+ thinking: external_exports.boolean().optional(),
19435
+ maxTokens: external_exports.number().optional(),
19436
+ budgetTokens: external_exports.number().optional(),
19437
+ canWrite: external_exports.boolean(),
19438
+ // Required per interface
19439
+ canBash: external_exports.boolean()
19440
+ // Required per interface
19441
+ });
19436
19442
  var AgentRegistry = class _AgentRegistry {
19437
19443
  static instance;
19438
19444
  agents = /* @__PURE__ */ new Map();
@@ -19482,10 +19488,11 @@ var AgentRegistry = class _AgentRegistry {
19482
19488
  const customAgents = JSON.parse(content);
19483
19489
  if (typeof customAgents === "object" && customAgents !== null) {
19484
19490
  for (const [name, def] of Object.entries(customAgents)) {
19485
- if (this.isValidAgentDefinition(def)) {
19491
+ const result = AgentDefinitionSchema.safeParse(def);
19492
+ if (result.success) {
19486
19493
  this.registerAgent(name, def);
19487
19494
  } else {
19488
- log(`[AgentRegistry] Invalid custom agent definition for: ${name}`);
19495
+ log(`[AgentRegistry] Invalid custom agent definition for: ${name}. Errors: ${result.error.message}`);
19489
19496
  }
19490
19497
  }
19491
19498
  }
@@ -19495,9 +19502,6 @@ var AgentRegistry = class _AgentRegistry {
19495
19502
  }
19496
19503
  }
19497
19504
  }
19498
- isValidAgentDefinition(def) {
19499
- return typeof def.id === "string" && typeof def.description === "string" && typeof def.systemPrompt === "string" && typeof def.canWrite === "boolean" && typeof def.canBash === "boolean";
19500
- }
19501
19505
  };
19502
19506
 
19503
19507
  // src/core/agents/manager/task-launcher.ts
@@ -20402,32 +20406,6 @@ var sessionPool = {
20402
20406
  getInstance: SessionPool.getInstance.bind(SessionPool)
20403
20407
  };
20404
20408
 
20405
- // src/core/progress/terminal-monitor.ts
20406
- var TerminalMonitor = class _TerminalMonitor {
20407
- static instance;
20408
- lastLineCount = 0;
20409
- active = false;
20410
- constructor() {
20411
- stateBroadcaster.subscribe(this.render.bind(this));
20412
- }
20413
- static getInstance() {
20414
- if (!_TerminalMonitor.instance) {
20415
- _TerminalMonitor.instance = new _TerminalMonitor();
20416
- }
20417
- return _TerminalMonitor.instance;
20418
- }
20419
- start() {
20420
- this.active = true;
20421
- }
20422
- stop() {
20423
- this.active = false;
20424
- process.stdout.write("\n");
20425
- }
20426
- render(state2) {
20427
- if (!this.active) return;
20428
- }
20429
- };
20430
-
20431
20409
  // src/core/agents/manager.ts
20432
20410
  init_core2();
20433
20411
 
@@ -20674,7 +20652,6 @@ var ParallelAgentManager = class _ParallelAgentManager {
20674
20652
  (task) => this.handleTaskComplete(task)
20675
20653
  );
20676
20654
  progressNotifier.setManager(this);
20677
- TerminalMonitor.getInstance().start();
20678
20655
  this.recoverActiveTasks().catch((err) => {
20679
20656
  log("Recovery error:", err);
20680
20657
  });
@@ -20765,7 +20742,6 @@ var ParallelAgentManager = class _ParallelAgentManager {
20765
20742
  this.poller.stop();
20766
20743
  this.store.clear();
20767
20744
  MemoryManager.getInstance().clearTaskMemory();
20768
- TerminalMonitor.getInstance().stop();
20769
20745
  Promise.resolve().then(() => (init_store(), store_exports)).then((store) => store.clearAll()).catch(() => {
20770
20746
  });
20771
20747
  }
@@ -22743,7 +22719,6 @@ function startMissionLoop(directory, sessionID, prompt, options = {}) {
22743
22719
  };
22744
22720
  const success2 = writeLoopState(directory, state2);
22745
22721
  if (success2) {
22746
- TerminalMonitor.getInstance().start();
22747
22722
  log(`[${MISSION_CONTROL.LOG_SOURCE}] Loop started`, {
22748
22723
  sessionID,
22749
22724
  maxIterations: state2.maxIterations
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "opencode-orchestrator",
3
3
  "displayName": "OpenCode Orchestrator",
4
4
  "description": "Distributed Cognitive Architecture for OpenCode. Turns simple prompts into specialized multi-agent workflows (Planner, Coder, Reviewer).",
5
- "version": "1.2.1",
5
+ "version": "1.2.6",
6
6
  "author": "agnusdei1207",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -1,13 +0,0 @@
1
- /**
2
- * TerminalMonitor - Real-time TUI for mission progress
3
- */
4
- export declare class TerminalMonitor {
5
- private static instance;
6
- private lastLineCount;
7
- private active;
8
- private constructor();
9
- static getInstance(): TerminalMonitor;
10
- start(): void;
11
- stop(): void;
12
- private render;
13
- }