ocpipe 0.5.18 → 0.6.0

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.18",
3
+ "version": "0.6.0",
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.62"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "@anthropic-ai/claude-agent-sdk": {
@@ -39,16 +39,16 @@
39
39
  }
40
40
  },
41
41
  "devDependencies": {
42
- "@anthropic-ai/claude-agent-sdk": "^0.2.47",
42
+ "@anthropic-ai/claude-agent-sdk": "^0.2.62",
43
43
  "@eslint/js": "^10.0.1",
44
- "bun-types": "^1.3.9",
45
- "eslint": "^10.0.0",
44
+ "bun-types": "^1.3.10",
45
+ "eslint": "^10.0.2",
46
46
  "globals": "^17.3.0",
47
47
  "jiti": "^2.6.1",
48
48
  "prettier": "^3.8.1",
49
49
  "typescript": "^5.0.0",
50
- "typescript-eslint": "^8.56.0",
51
- "@typescript/native-preview": "^7.0.0-dev.20260218.1",
50
+ "typescript-eslint": "^8.56.1",
51
+ "@typescript/native-preview": "^7.0.0-dev.20260227.1",
52
52
  "vitest": "^4.0.18"
53
53
  },
54
54
  "scripts": {
package/src/agent.ts CHANGED
@@ -249,6 +249,8 @@ async function exportSession(
249
249
  sessionId,
250
250
  '--format',
251
251
  'json',
252
+ '--turn',
253
+ '-1',
252
254
  '-o',
253
255
  tmpPath,
254
256
  ])
@@ -271,7 +273,8 @@ async function exportSession(
271
273
  }
272
274
  await Bun.write(tmpPath, '') // Clean up
273
275
 
274
- // Extract all assistant text parts
276
+ // Extract all assistant text parts from the exported turn.
277
+ // The --turn -1 flag ensures we only get the last turn's messages.
275
278
  const messages = data.messages || []
276
279
  const textParts: string[] = []
277
280
 
@@ -206,6 +206,10 @@ export async function runClaudeCodeAgent(
206
206
  hooks: {
207
207
  PreToolUse: [{ hooks: [logToolCall] }],
208
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 }),
209
213
  // bypassPermissions requires explicit opt-in
210
214
  ...(permissionMode === 'bypassPermissions' &&
211
215
  claudeCode?.dangerouslySkipPermissions && {
@@ -218,6 +222,12 @@ export async function runClaudeCodeAgent(
218
222
  })(),
219
223
  }
220
224
 
225
+ if (claudeCode?.agents) {
226
+ console.error(`[ocpipe] Subagents defined: ${Object.keys(claudeCode.agents).join(', ')}`)
227
+ }
228
+ if (claudeCode?.allowedTools) {
229
+ console.error(`[ocpipe] Allowed tools: ${claudeCode.allowedTools.join(', ')}`)
230
+ }
221
231
  console.error(
222
232
  `\n>>> Claude Code [${modelStr}] [${permissionMode}] ${sessionInfo}: ${promptPreview}...`,
223
233
  )
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. */