ocpipe 0.5.17 → 0.5.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ocpipe",
3
- "version": "0.5.17",
3
+ "version": "0.5.19",
4
4
  "description": "SDK for LLM pipelines with OpenCode and Zod",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -31,7 +31,7 @@
31
31
  "dependencies": {},
32
32
  "peerDependencies": {
33
33
  "zod": "4.3.6",
34
- "@anthropic-ai/claude-agent-sdk": "0.2.45"
34
+ "@anthropic-ai/claude-agent-sdk": "0.2.47"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "@anthropic-ai/claude-agent-sdk": {
@@ -185,10 +185,18 @@ export async function runClaudeCodeAgent(
185
185
  )
186
186
  }
187
187
 
188
+ // Strip CLAUDECODE env var to allow nested Claude Code sessions.
189
+ // The parent session sets this to block nesting, but SDK-spawned subagents
190
+ // are independent processes that should be allowed to run.
191
+ const cleanEnv = Object.fromEntries(
192
+ Object.entries(process.env).filter(([key]) => key !== 'CLAUDECODE'),
193
+ )
194
+
188
195
  const queryOptions: Options = {
189
196
  model: modelStr,
190
197
  permissionMode,
191
198
  abortController,
199
+ env: cleanEnv,
192
200
  // v1 persistSession defaults to true, but set explicitly for clarity
193
201
  persistSession: true,
194
202
  ...(workdir && { cwd: workdir }),
@@ -198,6 +206,10 @@ export async function runClaudeCodeAgent(
198
206
  hooks: {
199
207
  PreToolUse: [{ hooks: [logToolCall] }],
200
208
  },
209
+ // Subagent definitions for Task tool dispatch
210
+ ...(claudeCode?.agents && { agents: claudeCode.agents }),
211
+ // Tool allow-list (must include 'Task' for subagent dispatch)
212
+ ...(claudeCode?.allowedTools && { allowedTools: claudeCode.allowedTools }),
201
213
  // bypassPermissions requires explicit opt-in
202
214
  ...(permissionMode === 'bypassPermissions' &&
203
215
  claudeCode?.dangerouslySkipPermissions && {
package/src/index.ts CHANGED
@@ -87,6 +87,7 @@ export type { MockResponse } from './testing.js'
87
87
  // Types
88
88
  export type {
89
89
  // Core types
90
+ AgentDefinition,
90
91
  BackendType,
91
92
  PermissionMode,
92
93
  ClaudeCodeOptions,
package/src/types.ts CHANGED
@@ -18,6 +18,18 @@ export type PermissionMode =
18
18
  | 'bypassPermissions'
19
19
  | 'plan'
20
20
 
21
+ /** Subagent definition for Claude Code's Task tool dispatch. */
22
+ export interface AgentDefinition {
23
+ /** Natural language description of when to use this agent. */
24
+ description: string
25
+ /** The agent's system prompt defining its role and behavior. */
26
+ prompt: string
27
+ /** Array of allowed tool names. If omitted, inherits all tools from parent. */
28
+ tools?: string[]
29
+ /** Model override for this agent ('sonnet' | 'opus' | 'haiku' | 'inherit'). */
30
+ model?: 'sonnet' | 'opus' | 'haiku' | 'inherit'
31
+ }
32
+
21
33
  /** Claude Code specific session options. */
22
34
  export interface ClaudeCodeOptions {
23
35
  /** Permission mode (default: 'acceptEdits'). */
@@ -31,6 +43,16 @@ export interface ClaudeCodeOptions {
31
43
  * Can be a full string or use the preset format with append.
32
44
  */
33
45
  systemPrompt?: string | { type: 'preset'; preset: 'claude_code'; append: string }
46
+ /**
47
+ * Subagent definitions for parallel task dispatch via the Task tool.
48
+ * Keys are agent names, values are agent definitions.
49
+ */
50
+ agents?: Record<string, AgentDefinition>
51
+ /**
52
+ * Tools that are auto-allowed without prompting for permission.
53
+ * Must include 'Task' for subagent dispatch.
54
+ */
55
+ allowedTools?: string[]
34
56
  }
35
57
 
36
58
  /** Model configuration for LLM backends. */