opencode-orchestrator 0.5.23 → 0.5.25
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/dist/index.js +40 -35
- package/dist/utils/sanity.d.ts +9 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -114,13 +114,13 @@ var MISSION = {
|
|
|
114
114
|
CANCEL_COMMAND: "/cancel"
|
|
115
115
|
};
|
|
116
116
|
var AGENT_EMOJI = {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
117
|
+
Architect: "\u{1F3D7}\uFE0F",
|
|
118
|
+
Builder: "\u{1F528}",
|
|
119
|
+
Inspector: "\u{1F50D}",
|
|
120
|
+
Recorder: "\u{1F4BE}",
|
|
121
|
+
Commander: "\u{1F3AF}",
|
|
122
|
+
Librarian: "\u{1F4DA}",
|
|
123
|
+
Researcher: "\u{1F52C}"
|
|
124
124
|
};
|
|
125
125
|
var PART_TYPES = {
|
|
126
126
|
TEXT: "text",
|
|
@@ -507,15 +507,15 @@ MISSION: [goal in one line]
|
|
|
507
507
|
|
|
508
508
|
TODO_HIERARCHY:
|
|
509
509
|
- [L1] Main objective 1
|
|
510
|
-
- [L2] Sub-task 1.1 | agent:
|
|
511
|
-
- [L2] Sub-task 1.2 | agent:
|
|
512
|
-
- [L2] Sub-task 1.3 | agent:
|
|
510
|
+
- [L2] Sub-task 1.1 | agent:Builder | parallel_group:A
|
|
511
|
+
- [L2] Sub-task 1.2 | agent:Builder | parallel_group:A
|
|
512
|
+
- [L2] Sub-task 1.3 | agent:Inspector | depends:1.1,1.2
|
|
513
513
|
- [L1] Main objective 2
|
|
514
|
-
- [L2] Sub-task 2.1 | agent:
|
|
515
|
-
- [L2] Sub-task 2.2 | agent:
|
|
516
|
-
- [L3] Atomic action 2.2.1 | agent:
|
|
517
|
-
- [L3] Atomic action 2.2.2 | agent:
|
|
518
|
-
- [L3] Verify 2.2 | agent:
|
|
514
|
+
- [L2] Sub-task 2.1 | agent:Librarian
|
|
515
|
+
- [L2] Sub-task 2.2 | agent:Builder | depends:2.1
|
|
516
|
+
- [L3] Atomic action 2.2.1 | agent:Builder
|
|
517
|
+
- [L3] Atomic action 2.2.2 | agent:Builder | parallel_group:B
|
|
518
|
+
- [L3] Verify 2.2 | agent:Inspector | depends:2.2.1,2.2.2
|
|
519
519
|
|
|
520
520
|
PARALLEL_EXECUTION:
|
|
521
521
|
- Group A: [1.1, 1.2] \u2192 Run simultaneously
|
|
@@ -540,17 +540,17 @@ REVISED_HIERARCHY:
|
|
|
540
540
|
</strategy_mode>
|
|
541
541
|
|
|
542
542
|
<agents_available>
|
|
543
|
-
-
|
|
544
|
-
-
|
|
545
|
-
-
|
|
546
|
-
-
|
|
543
|
+
- Builder: Code implementation
|
|
544
|
+
- Inspector: Verification and bug fixing
|
|
545
|
+
- Librarian: Documentation research (use BEFORE unfamiliar APIs)
|
|
546
|
+
- Researcher: Pre-task investigation
|
|
547
547
|
</agents_available>
|
|
548
548
|
|
|
549
549
|
<rules>
|
|
550
550
|
- One action per task
|
|
551
|
-
- Always end branches with
|
|
551
|
+
- Always end branches with Inspector task
|
|
552
552
|
- Group unrelated tasks (parallel execution)
|
|
553
|
-
- Use
|
|
553
|
+
- Use Librarian/Researcher before implementing unfamiliar features
|
|
554
554
|
- Be specific about files, patterns, and verification
|
|
555
555
|
</rules>`,
|
|
556
556
|
canWrite: false,
|
|
@@ -13582,12 +13582,12 @@ Before any planning or coding, you MUST understand:
|
|
|
13582
13582
|
</phase_1>
|
|
13583
13583
|
|
|
13584
13584
|
<phase_2 name="PLAN">
|
|
13585
|
-
- Call
|
|
13585
|
+
- Call Architect with Environment Context.
|
|
13586
13586
|
- Plan must respect the Infra (e.g. build location).
|
|
13587
13587
|
</phase_2>
|
|
13588
13588
|
|
|
13589
13589
|
<phase_3 name="EXECUTE">
|
|
13590
|
-
- Use
|
|
13590
|
+
- Use Builder with environment constraints.
|
|
13591
13591
|
- Match existing patterns exactly.
|
|
13592
13592
|
</phase_3>
|
|
13593
13593
|
|
|
@@ -15308,22 +15308,27 @@ function formatElapsedTime(startMs, endMs = Date.now()) {
|
|
|
15308
15308
|
}
|
|
15309
15309
|
|
|
15310
15310
|
// src/utils/sanity.ts
|
|
15311
|
+
var SEVERITY = {
|
|
15312
|
+
OK: "ok",
|
|
15313
|
+
WARNING: "warning",
|
|
15314
|
+
CRITICAL: "critical"
|
|
15315
|
+
};
|
|
15311
15316
|
function checkOutputSanity(text) {
|
|
15312
15317
|
if (!text || text.length < 50) {
|
|
15313
|
-
return { isHealthy: true, severity:
|
|
15318
|
+
return { isHealthy: true, severity: SEVERITY.OK };
|
|
15314
15319
|
}
|
|
15315
15320
|
if (/(.)\1{15,}/.test(text)) {
|
|
15316
15321
|
return {
|
|
15317
15322
|
isHealthy: false,
|
|
15318
15323
|
reason: "Single character repetition detected",
|
|
15319
|
-
severity:
|
|
15324
|
+
severity: SEVERITY.CRITICAL
|
|
15320
15325
|
};
|
|
15321
15326
|
}
|
|
15322
15327
|
if (/(.{2,6})\1{8,}/.test(text)) {
|
|
15323
15328
|
return {
|
|
15324
15329
|
isHealthy: false,
|
|
15325
15330
|
reason: "Pattern loop detected",
|
|
15326
|
-
severity:
|
|
15331
|
+
severity: SEVERITY.CRITICAL
|
|
15327
15332
|
};
|
|
15328
15333
|
}
|
|
15329
15334
|
if (text.length > 200) {
|
|
@@ -15335,7 +15340,7 @@ function checkOutputSanity(text) {
|
|
|
15335
15340
|
return {
|
|
15336
15341
|
isHealthy: false,
|
|
15337
15342
|
reason: "Low information density",
|
|
15338
|
-
severity:
|
|
15343
|
+
severity: SEVERITY.CRITICAL
|
|
15339
15344
|
};
|
|
15340
15345
|
}
|
|
15341
15346
|
}
|
|
@@ -15345,7 +15350,7 @@ function checkOutputSanity(text) {
|
|
|
15345
15350
|
return {
|
|
15346
15351
|
isHealthy: false,
|
|
15347
15352
|
reason: "Visual gibberish detected",
|
|
15348
|
-
severity:
|
|
15353
|
+
severity: SEVERITY.CRITICAL
|
|
15349
15354
|
};
|
|
15350
15355
|
}
|
|
15351
15356
|
const lines = text.split("\n").filter((l) => l.trim().length > 10);
|
|
@@ -15355,7 +15360,7 @@ function checkOutputSanity(text) {
|
|
|
15355
15360
|
return {
|
|
15356
15361
|
isHealthy: false,
|
|
15357
15362
|
reason: "Excessive line repetition",
|
|
15358
|
-
severity:
|
|
15363
|
+
severity: SEVERITY.WARNING
|
|
15359
15364
|
};
|
|
15360
15365
|
}
|
|
15361
15366
|
}
|
|
@@ -15368,11 +15373,11 @@ function checkOutputSanity(text) {
|
|
|
15368
15373
|
return {
|
|
15369
15374
|
isHealthy: false,
|
|
15370
15375
|
reason: "CJK character spam detected",
|
|
15371
|
-
severity:
|
|
15376
|
+
severity: SEVERITY.CRITICAL
|
|
15372
15377
|
};
|
|
15373
15378
|
}
|
|
15374
15379
|
}
|
|
15375
|
-
return { isHealthy: true, severity:
|
|
15380
|
+
return { isHealthy: true, severity: SEVERITY.OK };
|
|
15376
15381
|
}
|
|
15377
15382
|
var RECOVERY_PROMPT = `<anomaly_recovery>
|
|
15378
15383
|
\u26A0\uFE0F SYSTEM NOTICE: Previous output was malformed (gibberish/loop detected).
|
|
@@ -15387,7 +15392,7 @@ var RECOVERY_PROMPT = `<anomaly_recovery>
|
|
|
15387
15392
|
<instructions>
|
|
15388
15393
|
- If a sub-agent produced bad output: try a different agent or simpler task
|
|
15389
15394
|
- If stuck in a loop: break down the task into smaller pieces
|
|
15390
|
-
- If context seems corrupted: call
|
|
15395
|
+
- If context seems corrupted: call Recorder to restore context
|
|
15391
15396
|
- THINK in English for maximum stability
|
|
15392
15397
|
</instructions>
|
|
15393
15398
|
|
|
@@ -15399,8 +15404,8 @@ var ESCALATION_PROMPT = `<critical_anomaly>
|
|
|
15399
15404
|
<emergency_protocol>
|
|
15400
15405
|
1. STOP current execution path immediately
|
|
15401
15406
|
2. DO NOT continue with the same approach - it is failing
|
|
15402
|
-
3. CALL
|
|
15403
|
-
4. If
|
|
15407
|
+
3. CALL Architect for a completely new strategy
|
|
15408
|
+
4. If Architect also fails: report status to user and await guidance
|
|
15404
15409
|
</emergency_protocol>
|
|
15405
15410
|
|
|
15406
15411
|
<diagnosis>
|
|
@@ -15408,7 +15413,7 @@ The current approach is producing corrupted output.
|
|
|
15408
15413
|
This may indicate: context overload, model instability, or task complexity.
|
|
15409
15414
|
</diagnosis>
|
|
15410
15415
|
|
|
15411
|
-
Request a fresh plan from
|
|
15416
|
+
Request a fresh plan from Architect with reduced scope.
|
|
15412
15417
|
</critical_anomaly>`;
|
|
15413
15418
|
|
|
15414
15419
|
// src/core/cache/constants.ts
|
package/dist/utils/sanity.d.ts
CHANGED
|
@@ -8,10 +8,16 @@
|
|
|
8
8
|
* - Visual gibberish (box drawing characters)
|
|
9
9
|
* - Line repetition
|
|
10
10
|
*/
|
|
11
|
+
export declare const SEVERITY: {
|
|
12
|
+
readonly OK: "ok";
|
|
13
|
+
readonly WARNING: "warning";
|
|
14
|
+
readonly CRITICAL: "critical";
|
|
15
|
+
};
|
|
16
|
+
export type Severity = (typeof SEVERITY)[keyof typeof SEVERITY];
|
|
11
17
|
export interface SanityResult {
|
|
12
18
|
isHealthy: boolean;
|
|
13
19
|
reason?: string;
|
|
14
|
-
severity:
|
|
20
|
+
severity: Severity;
|
|
15
21
|
}
|
|
16
22
|
/**
|
|
17
23
|
* Check if LLM output shows signs of degeneration
|
|
@@ -24,8 +30,8 @@ export declare function isEmptyOrMeaningless(text: string): boolean;
|
|
|
24
30
|
/**
|
|
25
31
|
* Recovery prompt for single anomaly
|
|
26
32
|
*/
|
|
27
|
-
export declare const RECOVERY_PROMPT = "<anomaly_recovery>\n\u26A0\uFE0F SYSTEM NOTICE: Previous output was malformed (gibberish/loop detected).\n\n<recovery_protocol>\n1. DISCARD the corrupted output completely - do not reference it\n2. RECALL the original mission objective\n3. IDENTIFY the last confirmed successful step\n4. RESTART with a simpler, more focused approach\n</recovery_protocol>\n\n<instructions>\n- If a sub-agent produced bad output: try a different agent or simpler task\n- If stuck in a loop: break down the task into smaller pieces\n- If context seems corrupted: call
|
|
33
|
+
export declare const RECOVERY_PROMPT = "<anomaly_recovery>\n\u26A0\uFE0F SYSTEM NOTICE: Previous output was malformed (gibberish/loop detected).\n\n<recovery_protocol>\n1. DISCARD the corrupted output completely - do not reference it\n2. RECALL the original mission objective\n3. IDENTIFY the last confirmed successful step\n4. RESTART with a simpler, more focused approach\n</recovery_protocol>\n\n<instructions>\n- If a sub-agent produced bad output: try a different agent or simpler task\n- If stuck in a loop: break down the task into smaller pieces\n- If context seems corrupted: call Recorder to restore context\n- THINK in English for maximum stability\n</instructions>\n\nWhat was the original task? Proceed from the last known good state.\n</anomaly_recovery>";
|
|
28
34
|
/**
|
|
29
35
|
* Escalation prompt for multiple consecutive anomalies
|
|
30
36
|
*/
|
|
31
|
-
export declare const ESCALATION_PROMPT = "<critical_anomaly>\n\uD83D\uDEA8 CRITICAL: Multiple consecutive malformed outputs detected.\n\n<emergency_protocol>\n1. STOP current execution path immediately\n2. DO NOT continue with the same approach - it is failing\n3. CALL
|
|
37
|
+
export declare const ESCALATION_PROMPT = "<critical_anomaly>\n\uD83D\uDEA8 CRITICAL: Multiple consecutive malformed outputs detected.\n\n<emergency_protocol>\n1. STOP current execution path immediately\n2. DO NOT continue with the same approach - it is failing\n3. CALL Architect for a completely new strategy\n4. If Architect also fails: report status to user and await guidance\n</emergency_protocol>\n\n<diagnosis>\nThe current approach is producing corrupted output.\nThis may indicate: context overload, model instability, or task complexity.\n</diagnosis>\n\nRequest a fresh plan from Architect with reduced scope.\n</critical_anomaly>";
|
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.5.
|
|
5
|
+
"version": "0.5.25",
|
|
6
6
|
"author": "agnusdei1207",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|