@doingdev/opencode-claude-manager-plugin 0.1.46 → 0.1.47
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 +29 -31
- package/dist/index.d.ts +1 -1
- package/dist/manager/team-orchestrator.d.ts +50 -0
- package/dist/manager/team-orchestrator.js +360 -0
- package/dist/plugin/agent-hierarchy.d.ts +12 -34
- package/dist/plugin/agent-hierarchy.js +36 -129
- package/dist/plugin/claude-manager.plugin.js +190 -423
- package/dist/plugin/service-factory.d.ts +18 -3
- package/dist/plugin/service-factory.js +32 -1
- package/dist/prompts/registry.d.ts +1 -10
- package/dist/prompts/registry.js +42 -261
- package/dist/src/claude/claude-agent-sdk-adapter.js +2 -1
- package/dist/src/claude/session-live-tailer.js +2 -2
- package/dist/src/index.d.ts +1 -1
- package/dist/src/manager/git-operations.d.ts +10 -1
- package/dist/src/manager/git-operations.js +18 -3
- package/dist/src/manager/persistent-manager.d.ts +18 -6
- package/dist/src/manager/persistent-manager.js +19 -13
- package/dist/src/manager/session-controller.d.ts +7 -10
- package/dist/src/manager/session-controller.js +12 -62
- package/dist/src/manager/team-orchestrator.d.ts +50 -0
- package/dist/src/manager/team-orchestrator.js +360 -0
- package/dist/src/plugin/agent-hierarchy.d.ts +12 -26
- package/dist/src/plugin/agent-hierarchy.js +36 -99
- package/dist/src/plugin/claude-manager.plugin.js +214 -393
- package/dist/src/plugin/service-factory.d.ts +18 -3
- package/dist/src/plugin/service-factory.js +33 -9
- package/dist/src/prompts/registry.d.ts +1 -10
- package/dist/src/prompts/registry.js +41 -246
- package/dist/src/state/team-state-store.d.ts +14 -0
- package/dist/src/state/team-state-store.js +85 -0
- package/dist/src/team/roster.d.ts +5 -0
- package/dist/src/team/roster.js +38 -0
- package/dist/src/types/contracts.d.ts +55 -13
- package/dist/src/types/contracts.js +1 -1
- package/dist/state/team-state-store.d.ts +14 -0
- package/dist/state/team-state-store.js +85 -0
- package/dist/team/roster.d.ts +5 -0
- package/dist/team/roster.js +38 -0
- package/dist/test/claude-manager.plugin.test.js +55 -280
- package/dist/test/git-operations.test.js +65 -1
- package/dist/test/persistent-manager.test.js +3 -3
- package/dist/test/prompt-registry.test.js +32 -252
- package/dist/test/session-controller.test.js +27 -27
- package/dist/test/team-orchestrator.test.d.ts +1 -0
- package/dist/test/team-orchestrator.test.js +146 -0
- package/dist/test/team-state-store.test.d.ts +1 -0
- package/dist/test/team-state-store.test.js +54 -0
- package/dist/types/contracts.d.ts +54 -3
- package/dist/types/contracts.js +1 -1
- package/package.json +1 -1
|
@@ -1,53 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
* Agent hierarchy configuration for the CTO + Engineer Wrapper architecture.
|
|
3
|
-
*
|
|
4
|
-
* CTO (cto) — pure orchestrator, spawns engineers, reviews diffs, commits
|
|
5
|
-
* Engineer Explore (engineer_explore) — manages a Claude Code session for read-only investigation
|
|
6
|
-
* Engineer Implement (engineer_implement) — manages a Claude Code session for implementation
|
|
7
|
-
* Claude Code session — the underlying AI session (prompt only, no OpenCode agent)
|
|
8
|
-
*/
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
// Agent names
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
1
|
+
import { TEAM_ENGINEERS } from '../team/roster.js';
|
|
12
2
|
export const AGENT_CTO = 'cto';
|
|
13
|
-
export const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
'
|
|
23
|
-
'session_health',
|
|
3
|
+
export const ENGINEER_AGENT_IDS = {
|
|
4
|
+
Tom: 'tom',
|
|
5
|
+
John: 'john',
|
|
6
|
+
Maya: 'maya',
|
|
7
|
+
Sara: 'sara',
|
|
8
|
+
Alex: 'alex',
|
|
9
|
+
};
|
|
10
|
+
export const ENGINEER_AGENT_NAMES = TEAM_ENGINEERS;
|
|
11
|
+
const CTO_ONLY_TOOL_IDS = [
|
|
12
|
+
'team_status',
|
|
24
13
|
'list_transcripts',
|
|
25
14
|
'list_history',
|
|
15
|
+
'git_diff',
|
|
16
|
+
'git_commit',
|
|
17
|
+
'git_reset',
|
|
18
|
+
'git_status',
|
|
19
|
+
'git_log',
|
|
20
|
+
'approval_policy',
|
|
21
|
+
'approval_decisions',
|
|
22
|
+
'approval_update',
|
|
26
23
|
];
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
const ENGINEER_EXPLORE_TOOL_IDS = ['explore', ...ENGINEER_SHARED_TOOL_IDS];
|
|
31
|
-
/** Tools for the engineer_implement wrapper (implement-mode send + shared) */
|
|
32
|
-
const ENGINEER_IMPLEMENT_TOOL_IDS = ['implement', ...ENGINEER_SHARED_TOOL_IDS];
|
|
33
|
-
/** Tools for the engineer_verify wrapper (verify-mode send + shared) */
|
|
34
|
-
const ENGINEER_VERIFY_TOOL_IDS = ['verify', ...ENGINEER_SHARED_TOOL_IDS];
|
|
35
|
-
/** Git tools — owned by CTO */
|
|
36
|
-
const GIT_TOOL_IDS = ['git_diff', 'git_commit', 'git_reset', 'git_status', 'git_log'];
|
|
37
|
-
/** Approval tools — owned by CTO */
|
|
38
|
-
const APPROVAL_TOOL_IDS = ['approval_policy', 'approval_decisions', 'approval_update'];
|
|
39
|
-
/** All restricted tool IDs (union of all domain groups) */
|
|
40
|
-
export const ALL_RESTRICTED_TOOL_IDS = [
|
|
41
|
-
...ENGINEER_TOOL_IDS,
|
|
42
|
-
...GIT_TOOL_IDS,
|
|
43
|
-
...APPROVAL_TOOL_IDS,
|
|
44
|
-
];
|
|
45
|
-
/** Tools the CTO can use directly (git + approval only, NO engineer tools) */
|
|
46
|
-
const CTO_TOOL_IDS = [...GIT_TOOL_IDS, ...APPROVAL_TOOL_IDS];
|
|
47
|
-
// ---------------------------------------------------------------------------
|
|
48
|
-
// Shared read-only tool permissions
|
|
49
|
-
// ---------------------------------------------------------------------------
|
|
50
|
-
const READONLY_TOOLS = {
|
|
24
|
+
const ENGINEER_TOOL_IDS = ['claude'];
|
|
25
|
+
export const ALL_RESTRICTED_TOOL_IDS = [...CTO_ONLY_TOOL_IDS, ...ENGINEER_TOOL_IDS];
|
|
26
|
+
const CTO_READONLY_TOOLS = {
|
|
51
27
|
read: 'allow',
|
|
52
28
|
grep: 'allow',
|
|
53
29
|
glob: 'allow',
|
|
@@ -60,126 +36,57 @@ const READONLY_TOOLS = {
|
|
|
60
36
|
todoread: 'allow',
|
|
61
37
|
question: 'allow',
|
|
62
38
|
};
|
|
63
|
-
// ---------------------------------------------------------------------------
|
|
64
|
-
// Permission builders
|
|
65
|
-
// ---------------------------------------------------------------------------
|
|
66
|
-
/** CTO: pure orchestrator — read-only + git + approval + task (spawn engineers). No session tools. */
|
|
67
39
|
function buildCtoPermissions() {
|
|
68
40
|
const denied = {};
|
|
69
41
|
for (const toolId of ALL_RESTRICTED_TOOL_IDS) {
|
|
70
42
|
denied[toolId] = 'deny';
|
|
71
43
|
}
|
|
72
44
|
const allowed = {};
|
|
73
|
-
for (const toolId of
|
|
45
|
+
for (const toolId of CTO_ONLY_TOOL_IDS) {
|
|
74
46
|
allowed[toolId] = 'allow';
|
|
75
47
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
...denied,
|
|
80
|
-
...allowed,
|
|
81
|
-
task: {
|
|
82
|
-
'*': 'deny',
|
|
83
|
-
[AGENT_ENGINEER_EXPLORE]: 'allow',
|
|
84
|
-
[AGENT_ENGINEER_IMPLEMENT]: 'allow',
|
|
85
|
-
[AGENT_ENGINEER_VERIFY]: 'allow',
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
/** Engineer explore wrapper: read-only investigation + explore + shared session tools. */
|
|
90
|
-
function buildEngineerExplorePermissions() {
|
|
91
|
-
const denied = {};
|
|
92
|
-
for (const toolId of ALL_RESTRICTED_TOOL_IDS) {
|
|
93
|
-
denied[toolId] = 'deny';
|
|
94
|
-
}
|
|
95
|
-
const allowed = {};
|
|
96
|
-
for (const toolId of ENGINEER_EXPLORE_TOOL_IDS) {
|
|
97
|
-
allowed[toolId] = 'allow';
|
|
48
|
+
const taskPermissions = { '*': 'deny' };
|
|
49
|
+
for (const engineer of ENGINEER_AGENT_NAMES) {
|
|
50
|
+
taskPermissions[ENGINEER_AGENT_IDS[engineer]] = 'allow';
|
|
98
51
|
}
|
|
99
52
|
return {
|
|
100
53
|
'*': 'deny',
|
|
101
|
-
...
|
|
54
|
+
...CTO_READONLY_TOOLS,
|
|
102
55
|
...denied,
|
|
103
56
|
...allowed,
|
|
57
|
+
task: taskPermissions,
|
|
104
58
|
};
|
|
105
59
|
}
|
|
106
|
-
|
|
107
|
-
function buildEngineerImplementPermissions() {
|
|
60
|
+
function buildEngineerPermissions() {
|
|
108
61
|
const denied = {};
|
|
109
62
|
for (const toolId of ALL_RESTRICTED_TOOL_IDS) {
|
|
110
63
|
denied[toolId] = 'deny';
|
|
111
64
|
}
|
|
112
|
-
const allowed = {};
|
|
113
|
-
for (const toolId of ENGINEER_IMPLEMENT_TOOL_IDS) {
|
|
114
|
-
allowed[toolId] = 'allow';
|
|
115
|
-
}
|
|
116
65
|
return {
|
|
117
66
|
'*': 'deny',
|
|
118
|
-
...READONLY_TOOLS,
|
|
119
67
|
...denied,
|
|
120
|
-
|
|
68
|
+
claude: 'allow',
|
|
121
69
|
};
|
|
122
70
|
}
|
|
123
|
-
/** Engineer verify wrapper: read-only + verify + restricted bash for test/lint/typecheck/build. */
|
|
124
|
-
function buildEngineerVerifyPermissions() {
|
|
125
|
-
const denied = {};
|
|
126
|
-
for (const toolId of ALL_RESTRICTED_TOOL_IDS) {
|
|
127
|
-
denied[toolId] = 'deny';
|
|
128
|
-
}
|
|
129
|
-
const allowed = {};
|
|
130
|
-
for (const toolId of ENGINEER_VERIFY_TOOL_IDS) {
|
|
131
|
-
allowed[toolId] = 'allow';
|
|
132
|
-
}
|
|
133
|
-
return {
|
|
134
|
-
'*': 'deny',
|
|
135
|
-
...READONLY_TOOLS,
|
|
136
|
-
...denied,
|
|
137
|
-
...allowed,
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
// ---------------------------------------------------------------------------
|
|
141
|
-
// Agent config builders
|
|
142
|
-
// ---------------------------------------------------------------------------
|
|
143
71
|
export function buildCtoAgentConfig(prompts) {
|
|
144
72
|
return {
|
|
145
|
-
description: '
|
|
73
|
+
description: 'Technical orchestrator. Finds missing requirements, explicitly assigns engineers, compares plans, reviews diffs, and owns the final outcome.',
|
|
146
74
|
mode: 'primary',
|
|
147
75
|
color: '#D97757',
|
|
148
76
|
permission: buildCtoPermissions(),
|
|
149
77
|
prompt: prompts.ctoSystemPrompt,
|
|
150
78
|
};
|
|
151
79
|
}
|
|
152
|
-
export function
|
|
153
|
-
return {
|
|
154
|
-
description: 'Thin high-judgment wrapper that frames work quickly and dispatches to Claude Code in plan mode for read-only investigation.',
|
|
155
|
-
mode: 'subagent',
|
|
156
|
-
color: '#D97757',
|
|
157
|
-
permission: buildEngineerExplorePermissions(),
|
|
158
|
-
prompt: prompts.engineerExplorePrompt,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
export function buildEngineerImplementAgentConfig(prompts) {
|
|
162
|
-
return {
|
|
163
|
-
description: 'Thin high-judgment wrapper that frames work quickly and dispatches to Claude Code in free mode for implementation.',
|
|
164
|
-
mode: 'subagent',
|
|
165
|
-
color: '#D97757',
|
|
166
|
-
permission: buildEngineerImplementPermissions(),
|
|
167
|
-
prompt: prompts.engineerImplementPrompt,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
export function buildEngineerVerifyAgentConfig(prompts) {
|
|
80
|
+
export function buildEngineerAgentConfig(prompts, engineer) {
|
|
171
81
|
return {
|
|
172
|
-
description:
|
|
82
|
+
description: `${engineer} is a persistent engineer who works through one Claude Code session and remembers prior turns.`,
|
|
173
83
|
mode: 'subagent',
|
|
84
|
+
hidden: false,
|
|
174
85
|
color: '#D97757',
|
|
175
|
-
permission:
|
|
176
|
-
prompt: prompts.
|
|
86
|
+
permission: buildEngineerPermissions(),
|
|
87
|
+
prompt: `You are ${engineer}.\n\n${prompts.engineerAgentPrompt}`,
|
|
177
88
|
};
|
|
178
89
|
}
|
|
179
|
-
// ---------------------------------------------------------------------------
|
|
180
|
-
// Global permission helper
|
|
181
|
-
// ---------------------------------------------------------------------------
|
|
182
|
-
/** Deny all restricted tools at the global level so only designated agents can use them. */
|
|
183
90
|
export function denyRestrictedToolsGlobally(permissions) {
|
|
184
91
|
for (const toolId of ALL_RESTRICTED_TOOL_IDS) {
|
|
185
92
|
permissions[toolId] ??= 'deny';
|