@doingdev/opencode-claude-manager-plugin 0.1.17 → 0.1.19
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.
|
@@ -7,6 +7,22 @@ const defaultFacade = {
|
|
|
7
7
|
};
|
|
8
8
|
const TOOL_INPUT_PREVIEW_MAX = 2000;
|
|
9
9
|
const USER_MESSAGE_MAX = 4000;
|
|
10
|
+
/**
|
|
11
|
+
* Ensures the Claude Agent SDK Skill tool is pre-approved per
|
|
12
|
+
* https://docs.anthropic.com/en/docs/claude-code/sdk/skills
|
|
13
|
+
* Subagents inherit the parent session tool surface unless given a narrower `tools` list.
|
|
14
|
+
*/
|
|
15
|
+
function mergeSkillIntoAllowedTools(allowedTools, disallowedTools) {
|
|
16
|
+
if (disallowedTools?.includes('Skill')) {
|
|
17
|
+
return allowedTools;
|
|
18
|
+
}
|
|
19
|
+
if (allowedTools === undefined) {
|
|
20
|
+
return ['Skill'];
|
|
21
|
+
}
|
|
22
|
+
return allowedTools.includes('Skill')
|
|
23
|
+
? allowedTools
|
|
24
|
+
: [...allowedTools, 'Skill'];
|
|
25
|
+
}
|
|
10
26
|
export class ClaudeAgentSdkAdapter {
|
|
11
27
|
sdkFacade;
|
|
12
28
|
approvalManager;
|
|
@@ -141,7 +157,7 @@ export class ClaudeAgentSdkAdapter {
|
|
|
141
157
|
const options = {
|
|
142
158
|
cwd: input.cwd,
|
|
143
159
|
tools: { type: 'preset', preset: 'claude_code' },
|
|
144
|
-
allowedTools: input.allowedTools,
|
|
160
|
+
allowedTools: mergeSkillIntoAllowedTools(input.allowedTools, input.disallowedTools),
|
|
145
161
|
disallowedTools: input.disallowedTools,
|
|
146
162
|
continue: input.continueSession,
|
|
147
163
|
resume: input.resumeSessionId,
|
|
@@ -90,6 +90,12 @@ function getDefaultRules() {
|
|
|
90
90
|
description: 'Allow bash commands (after dangerous patterns filtered)',
|
|
91
91
|
},
|
|
92
92
|
// Agent / misc
|
|
93
|
+
{
|
|
94
|
+
id: 'allow-skill',
|
|
95
|
+
toolPattern: 'Skill',
|
|
96
|
+
action: 'allow',
|
|
97
|
+
description: 'Allow Agent Skills (filesystem SKILL.md)',
|
|
98
|
+
},
|
|
93
99
|
{
|
|
94
100
|
id: 'allow-agent',
|
|
95
101
|
toolPattern: 'Agent',
|
|
@@ -50,6 +50,9 @@ export const ClaudeManagerPlugin = async ({ worktree }) => {
|
|
|
50
50
|
codesearch: 'allow',
|
|
51
51
|
webfetch: 'allow',
|
|
52
52
|
websearch: 'allow',
|
|
53
|
+
todowrite: 'allow',
|
|
54
|
+
todoread: 'allow',
|
|
55
|
+
question: 'allow',
|
|
53
56
|
...managerPermissions,
|
|
54
57
|
},
|
|
55
58
|
prompt: managerPromptRegistry.managerSystemPrompt,
|
package/dist/prompts/registry.js
CHANGED
|
@@ -14,7 +14,7 @@ export const managerPromptRegistry = {
|
|
|
14
14
|
' commit — checkpoint good work with claude_manager_git_commit',
|
|
15
15
|
' correct — send a targeted fix instruction (never "try again")',
|
|
16
16
|
' reset — discard bad work with claude_manager_git_reset',
|
|
17
|
-
' ask —
|
|
17
|
+
' ask — use the question tool for structured choices, or one narrow text question',
|
|
18
18
|
'',
|
|
19
19
|
'Default order: investigate → delegate → review → validate → commit.',
|
|
20
20
|
'Skip steps only when you have strong evidence they are unnecessary.',
|
|
@@ -46,6 +46,7 @@ export const managerPromptRegistry = {
|
|
|
46
46
|
'When requirements are unclear:',
|
|
47
47
|
'1. First, try to resolve it yourself — read code, check tests, grep for usage.',
|
|
48
48
|
'2. If ambiguity remains, ask the user ONE specific question.',
|
|
49
|
+
' Prefer the question tool when discrete options exist (OpenCode shows choices in the UI).',
|
|
49
50
|
' Bad: "What should I do?"',
|
|
50
51
|
' Good: "The `UserService` has both `deactivate()` and `softDelete()` —',
|
|
51
52
|
' should the new endpoint use deactivation (reversible) or',
|
|
@@ -60,6 +61,7 @@ export const managerPromptRegistry = {
|
|
|
60
61
|
'Never send three corrections for the same problem in one session.',
|
|
61
62
|
'',
|
|
62
63
|
'## Multi-step tasks',
|
|
64
|
+
'- Use todowrite / todoread to track steps in OpenCode; keep items concrete and few.',
|
|
63
65
|
'- Decompose large tasks into sequential focused instructions.',
|
|
64
66
|
'- Commit after each successful step (checkpoint for rollback).',
|
|
65
67
|
'- Tell Claude Code to use subagents for independent parallel work.',
|
|
@@ -74,6 +76,8 @@ export const managerPromptRegistry = {
|
|
|
74
76
|
'- Over 85%: clear the session immediately.',
|
|
75
77
|
'',
|
|
76
78
|
'## Tools reference',
|
|
79
|
+
'todowrite / todoread — OpenCode session todo list (track multi-step work)',
|
|
80
|
+
'question — OpenCode user prompt with options (clarify trade-offs)',
|
|
77
81
|
'claude_manager_send — send instruction (creates or resumes session)',
|
|
78
82
|
'claude_manager_git_diff — review all uncommitted changes',
|
|
79
83
|
'claude_manager_git_commit — stage all + commit',
|
|
@@ -65,6 +65,7 @@ export interface RunClaudeSessionInput {
|
|
|
65
65
|
effort?: 'low' | 'medium' | 'high' | 'max';
|
|
66
66
|
mode?: SessionMode;
|
|
67
67
|
permissionMode?: 'default' | 'acceptEdits' | 'plan' | 'dontAsk';
|
|
68
|
+
/** Merged with `Skill` by the SDK adapter unless `Skill` appears in `disallowedTools`. */
|
|
68
69
|
allowedTools?: string[];
|
|
69
70
|
disallowedTools?: string[];
|
|
70
71
|
continueSession?: boolean;
|