@doingdev/opencode-claude-manager-plugin 0.1.46 → 0.1.49

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.
Files changed (55) hide show
  1. package/README.md +29 -31
  2. package/dist/index.d.ts +1 -1
  3. package/dist/manager/team-orchestrator.d.ts +50 -0
  4. package/dist/manager/team-orchestrator.js +360 -0
  5. package/dist/plugin/agent-hierarchy.d.ts +12 -34
  6. package/dist/plugin/agent-hierarchy.js +36 -129
  7. package/dist/plugin/claude-manager.plugin.js +233 -421
  8. package/dist/plugin/service-factory.d.ts +20 -3
  9. package/dist/plugin/service-factory.js +46 -1
  10. package/dist/prompts/registry.d.ts +1 -10
  11. package/dist/prompts/registry.js +42 -261
  12. package/dist/src/claude/claude-agent-sdk-adapter.js +2 -1
  13. package/dist/src/claude/session-live-tailer.js +2 -2
  14. package/dist/src/index.d.ts +1 -1
  15. package/dist/src/manager/git-operations.d.ts +10 -1
  16. package/dist/src/manager/git-operations.js +18 -3
  17. package/dist/src/manager/persistent-manager.d.ts +18 -6
  18. package/dist/src/manager/persistent-manager.js +19 -13
  19. package/dist/src/manager/session-controller.d.ts +7 -10
  20. package/dist/src/manager/session-controller.js +12 -62
  21. package/dist/src/manager/team-orchestrator.d.ts +50 -0
  22. package/dist/src/manager/team-orchestrator.js +360 -0
  23. package/dist/src/plugin/agent-hierarchy.d.ts +12 -26
  24. package/dist/src/plugin/agent-hierarchy.js +36 -99
  25. package/dist/src/plugin/claude-manager.plugin.js +257 -391
  26. package/dist/src/plugin/service-factory.d.ts +20 -3
  27. package/dist/src/plugin/service-factory.js +47 -9
  28. package/dist/src/prompts/registry.d.ts +1 -10
  29. package/dist/src/prompts/registry.js +41 -246
  30. package/dist/src/state/team-state-store.d.ts +17 -0
  31. package/dist/src/state/team-state-store.js +107 -0
  32. package/dist/src/team/roster.d.ts +5 -0
  33. package/dist/src/team/roster.js +38 -0
  34. package/dist/src/types/contracts.d.ts +55 -13
  35. package/dist/src/types/contracts.js +1 -1
  36. package/dist/state/team-state-store.d.ts +17 -0
  37. package/dist/state/team-state-store.js +107 -0
  38. package/dist/team/roster.d.ts +5 -0
  39. package/dist/team/roster.js +38 -0
  40. package/dist/test/claude-manager.plugin.test.js +55 -280
  41. package/dist/test/cto-active-team.test.d.ts +1 -0
  42. package/dist/test/cto-active-team.test.js +52 -0
  43. package/dist/test/git-operations.test.js +65 -1
  44. package/dist/test/persistent-manager.test.js +3 -3
  45. package/dist/test/prompt-registry.test.js +32 -252
  46. package/dist/test/report-claude-event.test.d.ts +1 -0
  47. package/dist/test/report-claude-event.test.js +246 -0
  48. package/dist/test/session-controller.test.js +27 -27
  49. package/dist/test/team-orchestrator.test.d.ts +1 -0
  50. package/dist/test/team-orchestrator.test.js +146 -0
  51. package/dist/test/team-state-store.test.d.ts +1 -0
  52. package/dist/test/team-state-store.test.js +72 -0
  53. package/dist/types/contracts.d.ts +54 -3
  54. package/dist/types/contracts.js +1 -1
  55. 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 AGENT_ENGINEER_EXPLORE = 'engineer_explore';
14
- export const AGENT_ENGINEER_IMPLEMENT = 'engineer_implement';
15
- export const AGENT_ENGINEER_VERIFY = 'engineer_verify';
16
- // ---------------------------------------------------------------------------
17
- // Tool IDs — grouped by domain
18
- // ---------------------------------------------------------------------------
19
- /** Shared engineer session tools (compact, clear, status, diagnostics) */
20
- const ENGINEER_SHARED_TOOL_IDS = [
21
- 'compact_context',
22
- 'clear_session',
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
- /** All engineer tools — mode-locked sends + shared session tools */
28
- const ENGINEER_TOOL_IDS = ['explore', 'implement', 'verify', ...ENGINEER_SHARED_TOOL_IDS];
29
- /** Tools for the engineer_explore wrapper (explore-mode send + shared) */
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 CTO_TOOL_IDS) {
45
+ for (const toolId of CTO_ONLY_TOOL_IDS) {
74
46
  allowed[toolId] = 'allow';
75
47
  }
76
- return {
77
- '*': 'deny',
78
- ...READONLY_TOOLS,
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
- ...READONLY_TOOLS,
54
+ ...CTO_READONLY_TOOLS,
102
55
  ...denied,
103
56
  ...allowed,
57
+ task: taskPermissions,
104
58
  };
105
59
  }
106
- /** Engineer implement wrapper: read-only investigation + implement + shared session tools. */
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
- ...allowed,
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: 'Delegates by default with minimal spot-checks, spawns engineers for exploration and implementation, reviews diffs, and commits.',
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 buildEngineerExploreAgentConfig(prompts) {
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: 'Thin high-judgment wrapper that runs verification commands (tests, lint, typecheck, build) and reports pass/fail.',
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: buildEngineerVerifyPermissions(),
176
- prompt: prompts.engineerVerifyPrompt,
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';