opencode-orchestrator 1.0.38 → 1.0.41
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 +1 -55
- package/dist/agents/prompts/common/index.d.ts +1 -0
- package/dist/agents/prompts/common/skills.d.ts +1 -0
- package/dist/core/orchestrator/session-manager.d.ts +37 -0
- package/dist/hooks/custom/resource-control.d.ts +0 -1
- package/dist/hooks/custom/strict-role-guard.d.ts +4 -1
- package/dist/hooks/features/mission-loop.d.ts +2 -0
- package/dist/index.js +552 -429
- package/dist/shared/constants/security-patterns.d.ts +13 -0
- package/dist/shared/constants/system-messages.d.ts +23 -0
- package/dist/shared/tool/constants/tool-names.d.ts +2 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ npm install -g opencode-orchestrator
|
|
|
19
19
|
In an OpenCode environment:
|
|
20
20
|
```bash
|
|
21
21
|
/task "Implement"
|
|
22
|
-
```
|
|
22
|
+
```
|
|
23
23
|
|
|
24
24
|
## Overview
|
|
25
25
|
|
|
@@ -68,60 +68,6 @@ OpenCode Orchestrator manages complex software tasks through **parallel multi-ag
|
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
```mermaid
|
|
72
|
-
graph TD
|
|
73
|
-
%% Nodes
|
|
74
|
-
User(("User 👤"))
|
|
75
|
-
LLM(("Brain (LLM) 🧠"))
|
|
76
|
-
Tool(("Tool 🛠️"))
|
|
77
|
-
|
|
78
|
-
%% 1. Chat Processing
|
|
79
|
-
subgraph Chat_Processing [Chat Processing]
|
|
80
|
-
UserAct[UserActivity Hook]
|
|
81
|
-
MissionChat[MissionControl Hook - Start]
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
%% 2. Pre-Execution
|
|
85
|
-
subgraph Pre_Execution [Pre-Execution Guard]
|
|
86
|
-
RoleGuard[StrictRoleGuard]
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
%% 3. Post-Execution
|
|
90
|
-
subgraph Post_Execution [Post-Execution Processing]
|
|
91
|
-
Scanner[SecretScanner]
|
|
92
|
-
UI[AgentUI Hook]
|
|
93
|
-
Resource[ResourceControl - Track]
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
%% 4. Completion
|
|
97
|
-
subgraph Completion [Completion & Loop Control]
|
|
98
|
-
Sanity[SanityCheck]
|
|
99
|
-
MissionDone[MissionControl Hook - Loop]
|
|
100
|
-
ResourceComp[ResourceControl - Compact]
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
%% Flow Connections
|
|
104
|
-
User -->|1. Message| UserAct
|
|
105
|
-
UserAct --> MissionChat
|
|
106
|
-
MissionChat -->|2. Modified Prompt| LLM
|
|
107
|
-
|
|
108
|
-
LLM -->|3. Tool Call| RoleGuard
|
|
109
|
-
RoleGuard -->|4. Safe?| Tool
|
|
110
|
-
RoleGuard -.->|Blocked| LLM
|
|
111
|
-
|
|
112
|
-
Tool -->|5. Output| Scanner
|
|
113
|
-
Scanner --> UI
|
|
114
|
-
UI --> Resource
|
|
115
|
-
Resource -->|6. Result| LLM
|
|
116
|
-
|
|
117
|
-
LLM -->|7. Turn Done| Sanity
|
|
118
|
-
Sanity --> MissionDone
|
|
119
|
-
|
|
120
|
-
MissionDone -.->|No Seal: Auto-Continue| LLM
|
|
121
|
-
MissionDone -->|Yes Seal: Complete| ResourceComp
|
|
122
|
-
ResourceComp -->|9. Final Response| User
|
|
123
|
-
```
|
|
124
|
-
|
|
125
71
|
---
|
|
126
72
|
|
|
127
73
|
## 🚀 Agents
|
|
@@ -14,3 +14,4 @@ export { SHARED_LSP_TOOLS } from "./lsp.js";
|
|
|
14
14
|
export { SHARED_AST_TOOLS } from "./ast.js";
|
|
15
15
|
export { MODULARITY_ENFORCEMENT } from "./modularity.js";
|
|
16
16
|
export { HYPER_PARALLEL_ENFORCEMENT } from "./hyper-parallel.js";
|
|
17
|
+
export { SKILLS_CAPABILITIES } from "./skills.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SKILLS_CAPABILITIES: string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session Manager
|
|
3
|
+
*
|
|
4
|
+
* Centralizes all direct access to the global `state` and session initialization logic.
|
|
5
|
+
* Eliminates redundant state checks across hooks and handlers.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Ensures a local session object exists in the plugin context map.
|
|
9
|
+
* This is "Session State 1" (Plugin-local tracking).
|
|
10
|
+
*/
|
|
11
|
+
export declare function ensureSessionInitialized(sessions: Map<string, any>, sessionID: string): any;
|
|
12
|
+
/**
|
|
13
|
+
* Activates the global mission state for a specific session.
|
|
14
|
+
* This is "Session State 2" (Global Orchestrator State).
|
|
15
|
+
*/
|
|
16
|
+
export declare function activateMissionState(sessionID: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* Checks if the mission is globally active and the session is enabled.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isMissionActive(sessionID: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Deactivates mission state (e.g., on cancellation or error).
|
|
23
|
+
*/
|
|
24
|
+
export declare function deactivateMissionState(sessionID: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Updates token usage and estimated cost for a session.
|
|
27
|
+
*/
|
|
28
|
+
export declare function updateSessionTokens(sessions: Map<string, any>, sessionID: string, inputLen: number, outputLen: number): void;
|
|
29
|
+
/**
|
|
30
|
+
* Anomaly Management
|
|
31
|
+
*/
|
|
32
|
+
export declare function recordAnomaly(sessionID: string): number;
|
|
33
|
+
export declare function resetAnomaly(sessionID: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Task Tracking
|
|
36
|
+
*/
|
|
37
|
+
export declare function updateCurrentTask(sessionID: string, taskID: string): void;
|
|
@@ -10,5 +10,4 @@ export declare class ResourceControlHook implements PostToolUseHook, AssistantDo
|
|
|
10
10
|
private lastCompactionTime;
|
|
11
11
|
execute(ctx: HookContext, toolOrText: string, input?: any, output?: any): Promise<any>;
|
|
12
12
|
private checkMemoryHealth;
|
|
13
|
-
private generateCompactionPrompt;
|
|
14
13
|
}
|
|
@@ -10,7 +10,10 @@ export declare class StrictRoleGuardHook implements PreToolUseHook {
|
|
|
10
10
|
name: "StrictRoleGuard";
|
|
11
11
|
execute(ctx: HookContext, tool: string, args: any): Promise<{
|
|
12
12
|
action: "block";
|
|
13
|
-
reason:
|
|
13
|
+
reason: "Fork bomb detected.";
|
|
14
|
+
} | {
|
|
15
|
+
action: "block";
|
|
16
|
+
reason: "Root deletion blocked.";
|
|
14
17
|
} | {
|
|
15
18
|
action: "allow";
|
|
16
19
|
reason?: undefined;
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* - Mission seal detection (Stop)
|
|
6
6
|
* - Auto-continuation injection (Loop)
|
|
7
7
|
* - User cancellation detection
|
|
8
|
+
*
|
|
9
|
+
* Refactored to use SessionManager and SystemMessages for better maintainability.
|
|
8
10
|
*/
|
|
9
11
|
import type { AssistantDoneHook, ChatMessageHook, HookContext } from "../types.js";
|
|
10
12
|
export declare class MissionControlHook implements AssistantDoneHook, ChatMessageHook {
|