opencode-orchestrator 0.8.2 → 0.8.4
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 = {
|
|
@@ -233,39 +239,56 @@ EXECUTION FLOW:
|
|
|
233
239
|
</phase_2_execute>
|
|
234
240
|
|
|
235
241
|
<parallel_execution>
|
|
236
|
-
\u26A1 USE
|
|
242
|
+
\u26A1 AGGRESSIVELY USE: Parallel Agents + Background Commands + Session Resume
|
|
237
243
|
|
|
238
|
-
|
|
239
|
-
- Tasks that DON'T depend on each other \u2192 background=true (parallel)
|
|
240
|
-
- Task B needs Task A's output \u2192 background=false (sequential)
|
|
241
|
-
- Model should judge based on task dependencies
|
|
244
|
+
\u{1F680} THESE 3 FEATURES ARE YOUR SUPERPOWERS - USE THEM!
|
|
242
245
|
|
|
243
|
-
|
|
246
|
+
1\uFE0F\u20E3 PARALLEL AGENTS (Strongly Recommended)
|
|
247
|
+
Launch multiple agents simultaneously for independent work:
|
|
244
248
|
\`\`\`
|
|
245
|
-
//
|
|
246
|
-
${TOOL_NAMES.DELEGATE_TASK}({ agent: "${AGENT_NAMES.
|
|
247
|
-
${TOOL_NAMES.DELEGATE_TASK}({ agent: "${AGENT_NAMES.
|
|
249
|
+
// Research multiple topics at once
|
|
250
|
+
${TOOL_NAMES.DELEGATE_TASK}({ agent: "${AGENT_NAMES.PLANNER}", prompt: "Research React docs", background: true })
|
|
251
|
+
${TOOL_NAMES.DELEGATE_TASK}({ agent: "${AGENT_NAMES.PLANNER}", prompt: "Research API patterns", background: true })
|
|
252
|
+
${TOOL_NAMES.DELEGATE_TASK}({ agent: "${AGENT_NAMES.PLANNER}", prompt: "Research testing libs", background: true })
|
|
253
|
+
// \u2192 3x faster than sequential!
|
|
254
|
+
|
|
255
|
+
// Create multiple files at once
|
|
256
|
+
${TOOL_NAMES.DELEGATE_TASK}({ agent: "${AGENT_NAMES.WORKER}", prompt: "Create component A", background: true })
|
|
257
|
+
${TOOL_NAMES.DELEGATE_TASK}({ agent: "${AGENT_NAMES.WORKER}", prompt: "Create component B", background: true })
|
|
248
258
|
\`\`\`
|
|
249
259
|
|
|
250
|
-
|
|
260
|
+
2\uFE0F\u20E3 BACKGROUND COMMANDS (Strongly Recommended)
|
|
261
|
+
Run slow shell commands without blocking:
|
|
251
262
|
\`\`\`
|
|
252
|
-
//
|
|
253
|
-
|
|
254
|
-
|
|
263
|
+
// Start build, keep working
|
|
264
|
+
${TOOL_NAMES.RUN_BACKGROUND}({ command: "npm run build", description: "Building..." })
|
|
265
|
+
// ...continue with other work...
|
|
266
|
+
${TOOL_NAMES.CHECK_BACKGROUND}({ taskId: "xxx" }) // check when needed
|
|
255
267
|
\`\`\`
|
|
256
268
|
|
|
257
|
-
|
|
269
|
+
3\uFE0F\u20E3 SESSION RESUME (Strongly Recommended)
|
|
270
|
+
Preserve context across multiple interactions:
|
|
258
271
|
\`\`\`
|
|
259
|
-
|
|
272
|
+
// First task returns sessionID
|
|
273
|
+
result = ${TOOL_NAMES.DELEGATE_TASK}({ agent: "${AGENT_NAMES.WORKER}", prompt: "Start feature" })
|
|
274
|
+
// Session: session_abc123
|
|
275
|
+
|
|
276
|
+
// Later: continue with full context
|
|
277
|
+
${TOOL_NAMES.DELEGATE_TASK}({ prompt: "Add tests to feature", resume: "session_abc123" })
|
|
260
278
|
\`\`\`
|
|
261
279
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
|
268
|
-
|
|
280
|
+
\u{1F4CB} SYNC STRATEGY (When to wait)
|
|
281
|
+
- Use background=false ONLY when: next task needs THIS task's output
|
|
282
|
+
- Collect results with ${TOOL_NAMES.GET_TASK_RESULT} before dependent work
|
|
283
|
+
- Use ${TOOL_NAMES.LIST_TASKS} to monitor all parallel tasks
|
|
284
|
+
|
|
285
|
+
| Task Type | Approach |
|
|
286
|
+
|-----------|----------|
|
|
287
|
+
| Research/Exploration | PARALLEL - spawn multiple Planners |
|
|
288
|
+
| File creation (different files) | PARALLEL - spawn multiple Workers |
|
|
289
|
+
| Build/Test/Install | BACKGROUND - use run_background |
|
|
290
|
+
| Sequential chain (A\u2192B\u2192C) | SYNC - background=false |
|
|
291
|
+
| Follow-up to previous work | RESUME - use sessionID |
|
|
269
292
|
</parallel_execution>
|
|
270
293
|
|
|
271
294
|
<agents>
|
|
@@ -16312,19 +16335,21 @@ function formatProgress(todos) {
|
|
|
16312
16335
|
}
|
|
16313
16336
|
function generateContinuationPrompt(todos) {
|
|
16314
16337
|
const incomplete = todos.filter(
|
|
16315
|
-
(t) => t.status !==
|
|
16338
|
+
(t) => t.status !== TODO_STATUS.COMPLETED && t.status !== TODO_STATUS.CANCELLED
|
|
16316
16339
|
);
|
|
16317
16340
|
if (incomplete.length === 0) {
|
|
16318
16341
|
return "";
|
|
16319
16342
|
}
|
|
16320
16343
|
const next = getNextPending(todos);
|
|
16344
|
+
const pendingTasks = incomplete.filter((t) => t.status === TODO_STATUS.PENDING);
|
|
16345
|
+
const pendingCount = pendingTasks.length;
|
|
16321
16346
|
let prompt = `<todo_continuation>
|
|
16322
16347
|
\u{1F4CB} **TODO Progress**: ${formatProgress(todos)}
|
|
16323
16348
|
|
|
16324
16349
|
**Incomplete Tasks** (${incomplete.length} remaining):
|
|
16325
16350
|
`;
|
|
16326
16351
|
for (const todo of incomplete.slice(0, 5)) {
|
|
16327
|
-
const status = todo.status ===
|
|
16352
|
+
const status = todo.status === TODO_STATUS.IN_PROGRESS ? "\u{1F504}" : "\u23F3";
|
|
16328
16353
|
const priority = todo.priority === "high" ? "\u{1F534}" : todo.priority === "medium" ? "\u{1F7E1}" : "\u{1F7E2}";
|
|
16329
16354
|
prompt += `${status} ${priority} [${todo.id}] ${todo.content}
|
|
16330
16355
|
`;
|
|
@@ -16333,13 +16358,33 @@ function generateContinuationPrompt(todos) {
|
|
|
16333
16358
|
prompt += `... and ${incomplete.length - 5} more
|
|
16334
16359
|
`;
|
|
16335
16360
|
}
|
|
16336
|
-
|
|
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 += `
|
|
16337
16381
|
**Action Required**:
|
|
16338
16382
|
1. Continue working on incomplete todos
|
|
16339
16383
|
2. Mark each task complete when finished
|
|
16340
16384
|
3. Do NOT stop until all todos are completed or cancelled
|
|
16341
16385
|
|
|
16342
16386
|
`;
|
|
16387
|
+
}
|
|
16343
16388
|
if (next) {
|
|
16344
16389
|
prompt += `**Next Task**: [${next.id}] ${next.content}
|
|
16345
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.4",
|
|
6
6
|
"author": "agnusdei1207",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|