@doingdev/opencode-claude-manager-plugin 0.1.35 → 0.1.43
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/claude/claude-agent-sdk-adapter.js +1 -0
- package/dist/manager/git-operations.d.ts +10 -1
- package/dist/manager/git-operations.js +18 -3
- package/dist/manager/persistent-manager.d.ts +19 -3
- package/dist/manager/persistent-manager.js +21 -9
- package/dist/manager/session-controller.d.ts +8 -5
- package/dist/manager/session-controller.js +25 -20
- package/dist/metadata/claude-metadata.service.d.ts +12 -0
- package/dist/metadata/claude-metadata.service.js +38 -0
- package/dist/metadata/repo-claude-config-reader.d.ts +7 -0
- package/dist/metadata/repo-claude-config-reader.js +154 -0
- package/dist/plugin/agent-hierarchy.d.ts +9 -9
- package/dist/plugin/agent-hierarchy.js +25 -25
- package/dist/plugin/claude-manager.plugin.js +83 -46
- package/dist/plugin/orchestrator.plugin.d.ts +2 -0
- package/dist/plugin/orchestrator.plugin.js +116 -0
- package/dist/plugin/service-factory.js +3 -8
- package/dist/prompts/registry.js +100 -103
- package/dist/providers/claude-code-wrapper.d.ts +13 -0
- package/dist/providers/claude-code-wrapper.js +13 -0
- package/dist/safety/bash-safety.d.ts +21 -0
- package/dist/safety/bash-safety.js +62 -0
- package/dist/src/claude/claude-agent-sdk-adapter.d.ts +27 -0
- package/dist/src/claude/claude-agent-sdk-adapter.js +517 -0
- package/dist/src/claude/claude-session.service.d.ts +10 -0
- package/dist/src/claude/claude-session.service.js +18 -0
- package/dist/src/claude/session-live-tailer.d.ts +51 -0
- package/dist/src/claude/session-live-tailer.js +269 -0
- package/dist/src/claude/tool-approval-manager.d.ts +27 -0
- package/dist/src/claude/tool-approval-manager.js +232 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.js +4 -0
- package/dist/src/manager/context-tracker.d.ts +33 -0
- package/dist/src/manager/context-tracker.js +106 -0
- package/dist/src/manager/git-operations.d.ts +12 -0
- package/dist/src/manager/git-operations.js +76 -0
- package/dist/src/manager/persistent-manager.d.ts +77 -0
- package/dist/src/manager/persistent-manager.js +170 -0
- package/dist/src/manager/session-controller.d.ts +44 -0
- package/dist/src/manager/session-controller.js +147 -0
- package/dist/src/plugin/agent-hierarchy.d.ts +60 -0
- package/dist/src/plugin/agent-hierarchy.js +157 -0
- package/dist/src/plugin/claude-manager.plugin.d.ts +2 -0
- package/dist/src/plugin/claude-manager.plugin.js +563 -0
- package/dist/src/plugin/service-factory.d.ts +12 -0
- package/dist/src/plugin/service-factory.js +38 -0
- package/dist/src/prompts/registry.d.ts +11 -0
- package/dist/src/prompts/registry.js +260 -0
- package/dist/src/state/file-run-state-store.d.ts +14 -0
- package/dist/src/state/file-run-state-store.js +85 -0
- package/dist/src/state/transcript-store.d.ts +15 -0
- package/dist/src/state/transcript-store.js +44 -0
- package/dist/src/types/contracts.d.ts +200 -0
- package/dist/src/types/contracts.js +1 -0
- package/dist/src/util/fs-helpers.d.ts +2 -0
- package/dist/src/util/fs-helpers.js +10 -0
- package/dist/src/util/project-context.d.ts +10 -0
- package/dist/src/util/project-context.js +105 -0
- package/dist/src/util/transcript-append.d.ts +7 -0
- package/dist/src/util/transcript-append.js +29 -0
- package/dist/test/claude-agent-sdk-adapter.test.d.ts +1 -0
- package/dist/test/claude-agent-sdk-adapter.test.js +459 -0
- package/dist/test/claude-manager.plugin.test.d.ts +1 -0
- package/dist/test/claude-manager.plugin.test.js +331 -0
- package/dist/test/context-tracker.test.d.ts +1 -0
- package/dist/test/context-tracker.test.js +138 -0
- package/dist/test/file-run-state-store.test.d.ts +1 -0
- package/dist/test/file-run-state-store.test.js +82 -0
- package/dist/test/git-operations.test.d.ts +1 -0
- package/dist/test/git-operations.test.js +90 -0
- package/dist/test/persistent-manager.test.d.ts +1 -0
- package/dist/test/persistent-manager.test.js +208 -0
- package/dist/test/project-context.test.d.ts +1 -0
- package/dist/test/project-context.test.js +92 -0
- package/dist/test/prompt-registry.test.d.ts +1 -0
- package/dist/test/prompt-registry.test.js +256 -0
- package/dist/test/session-controller.test.d.ts +1 -0
- package/dist/test/session-controller.test.js +149 -0
- package/dist/test/session-live-tailer.test.d.ts +1 -0
- package/dist/test/session-live-tailer.test.js +313 -0
- package/dist/test/tool-approval-manager.test.d.ts +1 -0
- package/dist/test/tool-approval-manager.test.js +264 -0
- package/dist/test/transcript-append.test.d.ts +1 -0
- package/dist/test/transcript-append.test.js +37 -0
- package/dist/test/transcript-store.test.d.ts +1 -0
- package/dist/test/transcript-store.test.js +50 -0
- package/dist/types/contracts.d.ts +3 -4
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.js +11 -0
- package/package.json +2 -2
|
@@ -0,0 +1,157 @@
|
|
|
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
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
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',
|
|
23
|
+
'list_transcripts',
|
|
24
|
+
'list_history',
|
|
25
|
+
];
|
|
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 = {
|
|
48
|
+
read: 'allow',
|
|
49
|
+
grep: 'allow',
|
|
50
|
+
glob: 'allow',
|
|
51
|
+
list: 'allow',
|
|
52
|
+
codesearch: 'allow',
|
|
53
|
+
webfetch: 'allow',
|
|
54
|
+
websearch: 'allow',
|
|
55
|
+
lsp: 'allow',
|
|
56
|
+
todowrite: 'allow',
|
|
57
|
+
todoread: 'allow',
|
|
58
|
+
question: 'allow',
|
|
59
|
+
};
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
// Permission builders
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
/** CTO: pure orchestrator — read-only + git + approval + task (spawn engineers). No session tools. */
|
|
64
|
+
function buildCtoPermissions() {
|
|
65
|
+
const denied = {};
|
|
66
|
+
for (const toolId of ALL_RESTRICTED_TOOL_IDS) {
|
|
67
|
+
denied[toolId] = 'deny';
|
|
68
|
+
}
|
|
69
|
+
const allowed = {};
|
|
70
|
+
for (const toolId of CTO_TOOL_IDS) {
|
|
71
|
+
allowed[toolId] = 'allow';
|
|
72
|
+
}
|
|
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';
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
'*': 'deny',
|
|
97
|
+
...READONLY_TOOLS,
|
|
98
|
+
...denied,
|
|
99
|
+
...allowed,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/** Engineer build wrapper: read-only investigation + implement + shared session tools. */
|
|
103
|
+
function buildEngineerBuildPermissions() {
|
|
104
|
+
const denied = {};
|
|
105
|
+
for (const toolId of ALL_RESTRICTED_TOOL_IDS) {
|
|
106
|
+
denied[toolId] = 'deny';
|
|
107
|
+
}
|
|
108
|
+
const allowed = {};
|
|
109
|
+
for (const toolId of ENGINEER_BUILD_TOOL_IDS) {
|
|
110
|
+
allowed[toolId] = 'allow';
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
'*': 'deny',
|
|
114
|
+
...READONLY_TOOLS,
|
|
115
|
+
...denied,
|
|
116
|
+
...allowed,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
// Agent config builders
|
|
121
|
+
// ---------------------------------------------------------------------------
|
|
122
|
+
export function buildCtoAgentConfig(prompts) {
|
|
123
|
+
return {
|
|
124
|
+
description: 'Delegates by default with minimal spot-checks, spawns engineers for exploration and implementation, reviews diffs, and commits.',
|
|
125
|
+
mode: 'primary',
|
|
126
|
+
color: '#D97757',
|
|
127
|
+
permission: buildCtoPermissions(),
|
|
128
|
+
prompt: prompts.ctoSystemPrompt,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
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) {
|
|
141
|
+
return {
|
|
142
|
+
description: 'Thin high-judgment wrapper that frames work quickly and dispatches to Claude Code in free mode for implementation.',
|
|
143
|
+
mode: 'subagent',
|
|
144
|
+
color: '#D97757',
|
|
145
|
+
permission: buildEngineerBuildPermissions(),
|
|
146
|
+
prompt: prompts.engineerBuildPrompt,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
// ---------------------------------------------------------------------------
|
|
150
|
+
// Global permission helper
|
|
151
|
+
// ---------------------------------------------------------------------------
|
|
152
|
+
/** Deny all restricted tools at the global level so only designated agents can use them. */
|
|
153
|
+
export function denyRestrictedToolsGlobally(permissions) {
|
|
154
|
+
for (const toolId of ALL_RESTRICTED_TOOL_IDS) {
|
|
155
|
+
permissions[toolId] ??= 'deny';
|
|
156
|
+
}
|
|
157
|
+
}
|