opencode-orchestrator 0.8.3 → 0.8.5
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TASK_STATUS - Task status constants
|
|
2
|
+
* TASK_STATUS - Task status constants (for parallel tasks)
|
|
3
3
|
*/
|
|
4
4
|
export declare const TASK_STATUS: {
|
|
5
5
|
readonly PENDING: "pending";
|
|
@@ -10,3 +10,12 @@ export declare const TASK_STATUS: {
|
|
|
10
10
|
readonly TIMEOUT: "timeout";
|
|
11
11
|
readonly CANCELLED: "cancelled";
|
|
12
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
|
+
};
|
|
@@ -8,6 +8,7 @@ import type { Todo } from "./interfaces.js";
|
|
|
8
8
|
export declare function formatProgress(todos: Todo[]): string;
|
|
9
9
|
/**
|
|
10
10
|
* Generate continuation prompt when todos remain
|
|
11
|
+
* Enforces parallel dispatch when multiple independent tasks exist
|
|
11
12
|
*/
|
|
12
13
|
export declare function generateContinuationPrompt(todos: Todo[]): string;
|
|
13
14
|
/**
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,12 @@ var TASK_STATUS = {
|
|
|
30
30
|
TIMEOUT: "timeout",
|
|
31
31
|
CANCELLED: "cancelled"
|
|
32
32
|
};
|
|
33
|
+
var TODO_STATUS = {
|
|
34
|
+
PENDING: "pending",
|
|
35
|
+
IN_PROGRESS: "in_progress",
|
|
36
|
+
COMPLETED: "completed",
|
|
37
|
+
CANCELLED: "cancelled"
|
|
38
|
+
};
|
|
33
39
|
|
|
34
40
|
// src/shared/constants.ts
|
|
35
41
|
var TIME = {
|
|
@@ -14017,7 +14023,7 @@ function formatDuration(start, end) {
|
|
|
14017
14023
|
}
|
|
14018
14024
|
function buildNotificationMessage(tasks) {
|
|
14019
14025
|
const summary = tasks.map((t) => {
|
|
14020
|
-
const status = t.status ===
|
|
14026
|
+
const status = t.status === TASK_STATUS.COMPLETED ? "\u2705" : "\u274C";
|
|
14021
14027
|
return `${status} \`${t.id}\`: ${t.description}`;
|
|
14022
14028
|
}).join("\n");
|
|
14023
14029
|
return `<system-notification>
|
|
@@ -14396,9 +14402,9 @@ Still running: ${remaining.length} | Queued: ${queued.length}`;
|
|
|
14396
14402
|
if (!this.client) return;
|
|
14397
14403
|
const tuiClient2 = this.client;
|
|
14398
14404
|
if (!tuiClient2.tui?.showToast) return;
|
|
14399
|
-
const successCount = completedTasks.filter((t) => t.status ===
|
|
14400
|
-
const failCount = completedTasks.filter((t) => t.status ===
|
|
14401
|
-
const taskList = completedTasks.map((t) => `- ${t.status ===
|
|
14405
|
+
const successCount = completedTasks.filter((t) => t.status === TASK_STATUS.COMPLETED).length;
|
|
14406
|
+
const failCount = completedTasks.filter((t) => t.status === TASK_STATUS.ERROR || t.status === TASK_STATUS.CANCELLED).length;
|
|
14407
|
+
const taskList = completedTasks.map((t) => `- ${t.status === TASK_STATUS.COMPLETED ? "\u2705" : "\u274C"} ${t.description} (${t.duration})`).join("\n");
|
|
14402
14408
|
tuiClient2.tui.showToast({
|
|
14403
14409
|
body: {
|
|
14404
14410
|
title: "\u{1F389} All Tasks Completed",
|
|
@@ -15335,10 +15341,10 @@ var createListTasksTool = (manager) => tool({
|
|
|
15335
15341
|
tasks = manager.getRunningTasks();
|
|
15336
15342
|
break;
|
|
15337
15343
|
case "completed":
|
|
15338
|
-
tasks = manager.getAllTasks().filter((t) => t.status ===
|
|
15344
|
+
tasks = manager.getAllTasks().filter((t) => t.status === TASK_STATUS.COMPLETED);
|
|
15339
15345
|
break;
|
|
15340
15346
|
case "error":
|
|
15341
|
-
tasks = manager.getAllTasks().filter((t) => t.status ===
|
|
15347
|
+
tasks = manager.getAllTasks().filter((t) => t.status === TASK_STATUS.ERROR || t.status === TASK_STATUS.TIMEOUT);
|
|
15342
15348
|
break;
|
|
15343
15349
|
default:
|
|
15344
15350
|
tasks = manager.getAllTasks();
|
|
@@ -16290,7 +16296,7 @@ ${r.content}
|
|
|
16290
16296
|
// src/core/loop/stats.ts
|
|
16291
16297
|
function getIncompleteCount(todos) {
|
|
16292
16298
|
return todos.filter(
|
|
16293
|
-
(t) => t.status !==
|
|
16299
|
+
(t) => t.status !== TODO_STATUS.COMPLETED && t.status !== TODO_STATUS.CANCELLED
|
|
16294
16300
|
).length;
|
|
16295
16301
|
}
|
|
16296
16302
|
function hasRemainingWork(todos) {
|
|
@@ -16298,7 +16304,7 @@ function hasRemainingWork(todos) {
|
|
|
16298
16304
|
}
|
|
16299
16305
|
function getNextPending(todos) {
|
|
16300
16306
|
const pending = todos.filter(
|
|
16301
|
-
(t) => t.status ===
|
|
16307
|
+
(t) => t.status === TODO_STATUS.PENDING || t.status === TODO_STATUS.IN_PROGRESS
|
|
16302
16308
|
);
|
|
16303
16309
|
const priorityOrder = { high: 0, medium: 1, low: 2 };
|
|
16304
16310
|
pending.sort((a, b) => priorityOrder[a.priority] - priorityOrder[b.priority]);
|
|
@@ -16307,10 +16313,10 @@ function getNextPending(todos) {
|
|
|
16307
16313
|
function getStats(todos) {
|
|
16308
16314
|
const stats2 = {
|
|
16309
16315
|
total: todos.length,
|
|
16310
|
-
pending: todos.filter((t) => t.status ===
|
|
16311
|
-
inProgress: todos.filter((t) => t.status ===
|
|
16312
|
-
completed: todos.filter((t) => t.status ===
|
|
16313
|
-
cancelled: todos.filter((t) => t.status ===
|
|
16316
|
+
pending: todos.filter((t) => t.status === TODO_STATUS.PENDING).length,
|
|
16317
|
+
inProgress: todos.filter((t) => t.status === TODO_STATUS.IN_PROGRESS).length,
|
|
16318
|
+
completed: todos.filter((t) => t.status === TODO_STATUS.COMPLETED).length,
|
|
16319
|
+
cancelled: todos.filter((t) => t.status === TODO_STATUS.CANCELLED).length,
|
|
16314
16320
|
percentComplete: 0
|
|
16315
16321
|
};
|
|
16316
16322
|
if (stats2.total > 0) {
|
|
@@ -16329,19 +16335,21 @@ function formatProgress(todos) {
|
|
|
16329
16335
|
}
|
|
16330
16336
|
function generateContinuationPrompt(todos) {
|
|
16331
16337
|
const incomplete = todos.filter(
|
|
16332
|
-
(t) => t.status !==
|
|
16338
|
+
(t) => t.status !== TODO_STATUS.COMPLETED && t.status !== TODO_STATUS.CANCELLED
|
|
16333
16339
|
);
|
|
16334
16340
|
if (incomplete.length === 0) {
|
|
16335
16341
|
return "";
|
|
16336
16342
|
}
|
|
16337
16343
|
const next = getNextPending(todos);
|
|
16344
|
+
const pendingTasks = incomplete.filter((t) => t.status === TODO_STATUS.PENDING);
|
|
16345
|
+
const pendingCount = pendingTasks.length;
|
|
16338
16346
|
let prompt = `<todo_continuation>
|
|
16339
16347
|
\u{1F4CB} **TODO Progress**: ${formatProgress(todos)}
|
|
16340
16348
|
|
|
16341
16349
|
**Incomplete Tasks** (${incomplete.length} remaining):
|
|
16342
16350
|
`;
|
|
16343
16351
|
for (const todo of incomplete.slice(0, 5)) {
|
|
16344
|
-
const status = todo.status ===
|
|
16352
|
+
const status = todo.status === TODO_STATUS.IN_PROGRESS ? "\u{1F504}" : "\u23F3";
|
|
16345
16353
|
const priority = todo.priority === "high" ? "\u{1F534}" : todo.priority === "medium" ? "\u{1F7E1}" : "\u{1F7E2}";
|
|
16346
16354
|
prompt += `${status} ${priority} [${todo.id}] ${todo.content}
|
|
16347
16355
|
`;
|
|
@@ -16350,13 +16358,33 @@ function generateContinuationPrompt(todos) {
|
|
|
16350
16358
|
prompt += `... and ${incomplete.length - 5} more
|
|
16351
16359
|
`;
|
|
16352
16360
|
}
|
|
16353
|
-
|
|
16361
|
+
if (pendingCount >= 2) {
|
|
16362
|
+
prompt += `
|
|
16363
|
+
\u26A1 **PARALLEL DISPATCH REQUIRED** \u26A1
|
|
16364
|
+
You have ${pendingCount} pending tasks. Launch them ALL IN PARALLEL for maximum efficiency:
|
|
16365
|
+
|
|
16366
|
+
\`\`\`
|
|
16367
|
+
// EXECUTE NOW - Launch all ${pendingCount} tasks simultaneously:
|
|
16368
|
+
`;
|
|
16369
|
+
for (const todo of pendingTasks.slice(0, 6)) {
|
|
16370
|
+
prompt += `delegate_task({ agent: "Worker", prompt: "${todo.content}", background: true })
|
|
16371
|
+
`;
|
|
16372
|
+
}
|
|
16373
|
+
prompt += `\`\`\`
|
|
16374
|
+
|
|
16375
|
+
\u26A0\uFE0F Do NOT run these sequentially. Use background=true for ALL.
|
|
16376
|
+
After launching, use list_tasks to monitor progress.
|
|
16377
|
+
|
|
16378
|
+
`;
|
|
16379
|
+
} else {
|
|
16380
|
+
prompt += `
|
|
16354
16381
|
**Action Required**:
|
|
16355
16382
|
1. Continue working on incomplete todos
|
|
16356
16383
|
2. Mark each task complete when finished
|
|
16357
16384
|
3. Do NOT stop until all todos are completed or cancelled
|
|
16358
16385
|
|
|
16359
16386
|
`;
|
|
16387
|
+
}
|
|
16360
16388
|
if (next) {
|
|
16361
16389
|
prompt += `**Next Task**: [${next.id}] ${next.content}
|
|
16362
16390
|
`;
|
|
@@ -129,7 +129,7 @@ export declare const PROMPTS: {
|
|
|
129
129
|
readonly CONTINUE_DEFAULT: "continue from where we left off";
|
|
130
130
|
};
|
|
131
131
|
export { AGENT_NAMES } from "./agent.js";
|
|
132
|
-
export { TASK_STATUS } from "../core/agents/consts/task-status.const.js";
|
|
132
|
+
export { TASK_STATUS, TODO_STATUS } from "../core/agents/consts/task-status.const.js";
|
|
133
133
|
export type { ParallelTaskStatus } from "../core/agents/types/parallel-task-status.type.js";
|
|
134
134
|
export declare const STATUS_EMOJI: {
|
|
135
135
|
readonly pending: "⏳";
|
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": "0.8.
|
|
5
|
+
"version": "0.8.5",
|
|
6
6
|
"author": "agnusdei1207",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|