@doingdev/opencode-claude-manager-plugin 0.1.7 → 0.1.9

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.
@@ -193,20 +193,21 @@ function normalizeSdkMessage(message) {
193
193
  rawType: message.type,
194
194
  };
195
195
  }
196
+ function isRecord(value) {
197
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
198
+ }
196
199
  function extractPartialEventText(event) {
197
- if (!event || typeof event !== 'object') {
200
+ if (!isRecord(event)) {
198
201
  return null;
199
202
  }
200
- const eventRecord = event;
201
- const delta = eventRecord.delta;
202
- if (delta && typeof delta === 'object') {
203
- const deltaRecord = delta;
204
- if (typeof deltaRecord.text === 'string' && deltaRecord.text.length > 0) {
205
- return deltaRecord.text;
203
+ const delta = event.delta;
204
+ if (isRecord(delta)) {
205
+ if (typeof delta.text === 'string' && delta.text.length > 0) {
206
+ return delta.text;
206
207
  }
207
- if (typeof deltaRecord.partial_json === 'string' &&
208
- deltaRecord.partial_json.length > 0) {
209
- return deltaRecord.partial_json;
208
+ if (typeof delta.partial_json === 'string' &&
209
+ delta.partial_json.length > 0) {
210
+ return delta.partial_json;
210
211
  }
211
212
  }
212
213
  return null;
@@ -215,23 +216,21 @@ function extractText(payload) {
215
216
  if (typeof payload === 'string') {
216
217
  return payload;
217
218
  }
218
- if (!payload || typeof payload !== 'object') {
219
+ if (!isRecord(payload)) {
219
220
  return '';
220
221
  }
221
- const payloadRecord = payload;
222
- if (Array.isArray(payloadRecord.content)) {
223
- const parts = payloadRecord.content
222
+ if (Array.isArray(payload.content)) {
223
+ const parts = payload.content
224
224
  .map((contentPart) => {
225
- if (!contentPart || typeof contentPart !== 'object') {
225
+ if (!isRecord(contentPart)) {
226
226
  return '';
227
227
  }
228
- const partRecord = contentPart;
229
- if (typeof partRecord.text === 'string') {
230
- return partRecord.text;
228
+ if (typeof contentPart.text === 'string') {
229
+ return contentPart.text;
231
230
  }
232
- if (partRecord.type === 'tool_use' &&
233
- typeof partRecord.name === 'string') {
234
- return `[tool:${partRecord.name}]`;
231
+ if (contentPart.type === 'tool_use' &&
232
+ typeof contentPart.name === 'string') {
233
+ return `[tool:${contentPart.name}]`;
235
234
  }
236
235
  return '';
237
236
  })
@@ -8,7 +8,6 @@ const MANAGER_TOOL_IDS = [
8
8
  'claude_manager_runs',
9
9
  'claude_manager_cleanup_run',
10
10
  ];
11
- const RESTRICTED_AGENT_TOOLS = buildRestrictedToolMap(MANAGER_TOOL_IDS);
12
11
  export const ClaudeManagerPlugin = async ({ worktree }) => {
13
12
  const services = getOrCreatePluginServices(worktree);
14
13
  return {
@@ -38,8 +37,10 @@ export const ClaudeManagerPlugin = async ({ worktree }) => {
38
37
  description: 'Primary agent that manages Claude Code sessions through the bundled plugin tools.',
39
38
  mode: 'primary',
40
39
  color: 'accent',
41
- tools: RESTRICTED_AGENT_TOOLS,
42
- permission: managerPermissions,
40
+ permission: {
41
+ '*': 'deny',
42
+ ...managerPermissions,
43
+ },
43
44
  prompt: [
44
45
  managerPromptRegistry.managerSystemPrompt,
45
46
  'When Claude Code delegation is useful, prefer the claude_manager_run tool instead of simulating the work yourself.',
@@ -51,12 +52,10 @@ export const ClaudeManagerPlugin = async ({ worktree }) => {
51
52
  description: 'Subagent that inspects Claude metadata, prior sessions, and manager runs without changing repository state.',
52
53
  mode: 'subagent',
53
54
  color: 'info',
54
- tools: {
55
- ...RESTRICTED_AGENT_TOOLS,
56
- claude_manager_run: false,
57
- claude_manager_cleanup_run: false,
55
+ permission: {
56
+ '*': 'deny',
57
+ ...researchPermissions,
58
58
  },
59
- permission: researchPermissions,
60
59
  prompt: [
61
60
  managerPromptRegistry.subagentSystemPrompt,
62
61
  'Focus on inspection and summarization.',
@@ -250,13 +249,6 @@ function rewriteCommandParts(parts, text) {
250
249
  });
251
250
  return rewrittenParts;
252
251
  }
253
- function buildRestrictedToolMap(toolIds) {
254
- const tools = { '*': false };
255
- for (const toolId of toolIds) {
256
- tools[toolId] = true;
257
- }
258
- return tools;
259
- }
260
252
  export function formatManagerRunToolResult(run) {
261
253
  const finalSummary = run.finalSummary ?? summarizeSessionOutputs(run.sessions);
262
254
  const output = run.sessions.length === 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doingdev/opencode-claude-manager-plugin",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "OpenCode plugin that orchestrates Claude Code sessions.",
5
5
  "keywords": [
6
6
  "opencode",