@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.
Files changed (51) 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 +190 -423
  8. package/dist/plugin/service-factory.d.ts +18 -3
  9. package/dist/plugin/service-factory.js +32 -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 +214 -393
  26. package/dist/src/plugin/service-factory.d.ts +18 -3
  27. package/dist/src/plugin/service-factory.js +33 -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 +14 -0
  31. package/dist/src/state/team-state-store.js +85 -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 +14 -0
  37. package/dist/state/team-state-store.js +85 -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/git-operations.test.js +65 -1
  42. package/dist/test/persistent-manager.test.js +3 -3
  43. package/dist/test/prompt-registry.test.js +32 -252
  44. package/dist/test/session-controller.test.js +27 -27
  45. package/dist/test/team-orchestrator.test.d.ts +1 -0
  46. package/dist/test/team-orchestrator.test.js +146 -0
  47. package/dist/test/team-state-store.test.d.ts +1 -0
  48. package/dist/test/team-state-store.test.js +54 -0
  49. package/dist/types/contracts.d.ts +54 -3
  50. package/dist/types/contracts.js +1 -1
  51. package/package.json +1 -1
@@ -1,17 +1,14 @@
1
- /**
2
- * Agent hierarchy configuration for the CTO + Engineer Wrapper architecture.
3
- *
4
- * CTO (cto) — pure orchestrator, spawns engineers, reviews diffs, commits
5
- * Engineer Plan (engineer_plan) — manages a Claude Code session for read-only investigation
6
- * Engineer Build (engineer_build) — manages a Claude Code session for implementation
7
- * Claude Code session — the underlying AI session (prompt only, no OpenCode agent)
8
- */
9
- import type { ManagerPromptRegistry } from '../types/contracts.js';
1
+ import type { EngineerName, ManagerPromptRegistry } from '../types/contracts.js';
10
2
  export declare const AGENT_CTO = "cto";
11
- export declare const AGENT_ENGINEER_PLAN = "engineer_plan";
12
- export declare const AGENT_ENGINEER_BUILD = "engineer_build";
13
- /** All restricted tool IDs (union of all domain groups) */
14
- export declare const ALL_RESTRICTED_TOOL_IDS: readonly ["explore", "implement", "compact_context", "clear_session", "session_health", "list_transcripts", "list_history", "git_diff", "git_commit", "git_reset", "approval_policy", "approval_decisions", "approval_update"];
3
+ export declare const ENGINEER_AGENT_IDS: {
4
+ readonly Tom: "tom";
5
+ readonly John: "john";
6
+ readonly Maya: "maya";
7
+ readonly Sara: "sara";
8
+ readonly Alex: "alex";
9
+ };
10
+ export declare const ENGINEER_AGENT_NAMES: readonly ["Tom", "John", "Maya", "Sara", "Alex"];
11
+ export declare const ALL_RESTRICTED_TOOL_IDS: readonly ["team_status", "list_transcripts", "list_history", "git_diff", "git_commit", "git_reset", "git_status", "git_log", "approval_policy", "approval_decisions", "approval_update", "claude"];
15
12
  type ToolPermission = 'allow' | 'ask' | 'deny';
16
13
  type AgentPermission = {
17
14
  '*'?: ToolPermission;
@@ -23,13 +20,9 @@ type AgentPermission = {
23
20
  webfetch?: ToolPermission;
24
21
  websearch?: ToolPermission;
25
22
  lsp?: ToolPermission;
26
- /** OpenCode built-in: manage session todo list */
27
23
  todowrite?: ToolPermission;
28
- /** OpenCode built-in: read session todo list */
29
24
  todoread?: ToolPermission;
30
- /** OpenCode built-in: ask the user structured questions with options */
31
25
  question?: ToolPermission;
32
- /** OpenCode built-in: launch subagents (matches subagent type, last-match-wins) */
33
26
  task?: ToolPermission | Record<string, ToolPermission>;
34
27
  bash?: ToolPermission | Record<string, ToolPermission>;
35
28
  [tool: string]: ToolPermission | Record<string, ToolPermission> | undefined;
@@ -41,20 +34,13 @@ export declare function buildCtoAgentConfig(prompts: ManagerPromptRegistry): {
41
34
  permission: AgentPermission;
42
35
  prompt: string;
43
36
  };
44
- export declare function buildEngineerPlanAgentConfig(prompts: ManagerPromptRegistry): {
45
- description: string;
46
- mode: "subagent";
47
- color: string;
48
- permission: AgentPermission;
49
- prompt: string;
50
- };
51
- export declare function buildEngineerBuildAgentConfig(prompts: ManagerPromptRegistry): {
37
+ export declare function buildEngineerAgentConfig(prompts: ManagerPromptRegistry, engineer: EngineerName): {
52
38
  description: string;
53
39
  mode: "subagent";
40
+ hidden: boolean;
54
41
  color: string;
55
42
  permission: AgentPermission;
56
43
  prompt: string;
57
44
  };
58
- /** Deny all restricted tools at the global level so only designated agents can use them. */
59
45
  export declare function denyRestrictedToolsGlobally(permissions: Record<string, ToolPermission>): void;
60
46
  export {};
@@ -1,50 +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 Plan (engineer_plan) — manages a Claude Code session for read-only investigation
6
- * Engineer Build (engineer_build) — 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_PLAN = 'engineer_plan';
14
- export const AGENT_ENGINEER_BUILD = 'engineer_build';
15
- // ---------------------------------------------------------------------------
16
- // Tool IDs — grouped by domain
17
- // ---------------------------------------------------------------------------
18
- /** Shared engineer session tools (compact, clear, status, diagnostics) */
19
- const ENGINEER_SHARED_TOOL_IDS = [
20
- 'compact_context',
21
- 'clear_session',
22
- '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',
23
13
  'list_transcripts',
24
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',
25
23
  ];
26
- /** All engineer tools — mode-locked sends + shared session tools */
27
- const ENGINEER_TOOL_IDS = ['explore', 'implement', ...ENGINEER_SHARED_TOOL_IDS];
28
- /** Tools for the engineer_plan wrapper (plan-mode send + shared) */
29
- const ENGINEER_PLAN_TOOL_IDS = ['explore', ...ENGINEER_SHARED_TOOL_IDS];
30
- /** Tools for the engineer_build wrapper (build-mode send + shared) */
31
- const ENGINEER_BUILD_TOOL_IDS = ['implement', ...ENGINEER_SHARED_TOOL_IDS];
32
- /** Git tools — owned by CTO */
33
- const GIT_TOOL_IDS = ['git_diff', 'git_commit', 'git_reset'];
34
- /** Approval tools — owned by CTO */
35
- const APPROVAL_TOOL_IDS = ['approval_policy', 'approval_decisions', 'approval_update'];
36
- /** All restricted tool IDs (union of all domain groups) */
37
- export const ALL_RESTRICTED_TOOL_IDS = [
38
- ...ENGINEER_TOOL_IDS,
39
- ...GIT_TOOL_IDS,
40
- ...APPROVAL_TOOL_IDS,
41
- ];
42
- /** Tools the CTO can use directly (git + approval only, NO engineer tools) */
43
- const CTO_TOOL_IDS = [...GIT_TOOL_IDS, ...APPROVAL_TOOL_IDS];
44
- // ---------------------------------------------------------------------------
45
- // Shared read-only tool permissions
46
- // ---------------------------------------------------------------------------
47
- 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 = {
48
27
  read: 'allow',
49
28
  grep: 'allow',
50
29
  glob: 'allow',
@@ -57,99 +36,57 @@ const READONLY_TOOLS = {
57
36
  todoread: 'allow',
58
37
  question: 'allow',
59
38
  };
60
- // ---------------------------------------------------------------------------
61
- // Permission builders
62
- // ---------------------------------------------------------------------------
63
- /** CTO: pure orchestrator — read-only + git + approval + task (spawn engineers). No session tools. */
64
39
  function buildCtoPermissions() {
65
40
  const denied = {};
66
41
  for (const toolId of ALL_RESTRICTED_TOOL_IDS) {
67
42
  denied[toolId] = 'deny';
68
43
  }
69
44
  const allowed = {};
70
- for (const toolId of CTO_TOOL_IDS) {
45
+ for (const toolId of CTO_ONLY_TOOL_IDS) {
71
46
  allowed[toolId] = 'allow';
72
47
  }
73
- return {
74
- '*': 'deny',
75
- ...READONLY_TOOLS,
76
- ...denied,
77
- ...allowed,
78
- task: {
79
- '*': 'deny',
80
- [AGENT_ENGINEER_PLAN]: 'allow',
81
- [AGENT_ENGINEER_BUILD]: 'allow',
82
- },
83
- };
84
- }
85
- /** Engineer plan wrapper: read-only investigation + explore + shared session tools. */
86
- function buildEngineerPlanPermissions() {
87
- const denied = {};
88
- for (const toolId of ALL_RESTRICTED_TOOL_IDS) {
89
- denied[toolId] = 'deny';
90
- }
91
- const allowed = {};
92
- for (const toolId of ENGINEER_PLAN_TOOL_IDS) {
93
- allowed[toolId] = 'allow';
48
+ const taskPermissions = { '*': 'deny' };
49
+ for (const engineer of ENGINEER_AGENT_NAMES) {
50
+ taskPermissions[ENGINEER_AGENT_IDS[engineer]] = 'allow';
94
51
  }
95
52
  return {
96
53
  '*': 'deny',
97
- ...READONLY_TOOLS,
54
+ ...CTO_READONLY_TOOLS,
98
55
  ...denied,
99
56
  ...allowed,
57
+ task: taskPermissions,
100
58
  };
101
59
  }
102
- /** Engineer build wrapper: read-only investigation + implement + shared session tools. */
103
- function buildEngineerBuildPermissions() {
60
+ function buildEngineerPermissions() {
104
61
  const denied = {};
105
62
  for (const toolId of ALL_RESTRICTED_TOOL_IDS) {
106
63
  denied[toolId] = 'deny';
107
64
  }
108
- const allowed = {};
109
- for (const toolId of ENGINEER_BUILD_TOOL_IDS) {
110
- allowed[toolId] = 'allow';
111
- }
112
65
  return {
113
66
  '*': 'deny',
114
- ...READONLY_TOOLS,
115
67
  ...denied,
116
- ...allowed,
68
+ claude: 'allow',
117
69
  };
118
70
  }
119
- // ---------------------------------------------------------------------------
120
- // Agent config builders
121
- // ---------------------------------------------------------------------------
122
71
  export function buildCtoAgentConfig(prompts) {
123
72
  return {
124
- 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.',
125
74
  mode: 'primary',
126
75
  color: '#D97757',
127
76
  permission: buildCtoPermissions(),
128
77
  prompt: prompts.ctoSystemPrompt,
129
78
  };
130
79
  }
131
- export function buildEngineerPlanAgentConfig(prompts) {
132
- return {
133
- description: 'Thin high-judgment wrapper that frames work quickly and dispatches to Claude Code in plan mode for read-only investigation.',
134
- mode: 'subagent',
135
- color: '#D97757',
136
- permission: buildEngineerPlanPermissions(),
137
- prompt: prompts.engineerPlanPrompt,
138
- };
139
- }
140
- export function buildEngineerBuildAgentConfig(prompts) {
80
+ export function buildEngineerAgentConfig(prompts, engineer) {
141
81
  return {
142
- description: 'Thin high-judgment wrapper that frames work quickly and dispatches to Claude Code in free mode for implementation.',
82
+ description: `${engineer} is a persistent engineer who works through one Claude Code session and remembers prior turns.`,
143
83
  mode: 'subagent',
84
+ hidden: false,
144
85
  color: '#D97757',
145
- permission: buildEngineerBuildPermissions(),
146
- prompt: prompts.engineerBuildPrompt,
86
+ permission: buildEngineerPermissions(),
87
+ prompt: `You are ${engineer}.\n\n${prompts.engineerAgentPrompt}`,
147
88
  };
148
89
  }
149
- // ---------------------------------------------------------------------------
150
- // Global permission helper
151
- // ---------------------------------------------------------------------------
152
- /** Deny all restricted tools at the global level so only designated agents can use them. */
153
90
  export function denyRestrictedToolsGlobally(permissions) {
154
91
  for (const toolId of ALL_RESTRICTED_TOOL_IDS) {
155
92
  permissions[toolId] ??= 'deny';