ocpipe 0.5.19 → 0.6.1
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 +7 -7
- package/src/agent.ts +24 -2
- package/src/claude-code.ts +6 -0
- package/src/types.ts +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ocpipe",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
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.
|
|
34
|
+
"@anthropic-ai/claude-agent-sdk": "0.2.69"
|
|
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.
|
|
42
|
+
"@anthropic-ai/claude-agent-sdk": "^0.2.62",
|
|
43
43
|
"@eslint/js": "^10.0.1",
|
|
44
|
-
"bun-types": "^1.3.
|
|
45
|
-
"eslint": "^10.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.
|
|
51
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
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
|
@@ -34,7 +34,15 @@ export async function runAgent(
|
|
|
34
34
|
async function runOpencodeAgent(
|
|
35
35
|
options: RunAgentOptions,
|
|
36
36
|
): Promise<RunAgentResult> {
|
|
37
|
-
const {
|
|
37
|
+
const {
|
|
38
|
+
prompt,
|
|
39
|
+
agent,
|
|
40
|
+
model,
|
|
41
|
+
sessionId,
|
|
42
|
+
timeoutSec = 3600,
|
|
43
|
+
workdir,
|
|
44
|
+
signal,
|
|
45
|
+
} = options
|
|
38
46
|
|
|
39
47
|
if (!model.providerID) {
|
|
40
48
|
throw new Error('providerID is required for OpenCode backend')
|
|
@@ -75,6 +83,17 @@ async function runOpencodeAgent(
|
|
|
75
83
|
args.push('--session', sessionId)
|
|
76
84
|
}
|
|
77
85
|
|
|
86
|
+
if (model.variant) {
|
|
87
|
+
args.push('--model-variant', model.variant)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (model.variantThinkingBudget !== undefined) {
|
|
91
|
+
args.push(
|
|
92
|
+
'--model-variant-thinking-budget',
|
|
93
|
+
String(model.variantThinkingBudget),
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
78
97
|
return new Promise((resolve, reject) => {
|
|
79
98
|
const opencodeCmd = getOpencodeCommand(args)
|
|
80
99
|
console.error(
|
|
@@ -249,6 +268,8 @@ async function exportSession(
|
|
|
249
268
|
sessionId,
|
|
250
269
|
'--format',
|
|
251
270
|
'json',
|
|
271
|
+
'--turn',
|
|
272
|
+
'-1',
|
|
252
273
|
'-o',
|
|
253
274
|
tmpPath,
|
|
254
275
|
])
|
|
@@ -271,7 +292,8 @@ async function exportSession(
|
|
|
271
292
|
}
|
|
272
293
|
await Bun.write(tmpPath, '') // Clean up
|
|
273
294
|
|
|
274
|
-
// Extract all assistant text parts
|
|
295
|
+
// Extract all assistant text parts from the exported turn.
|
|
296
|
+
// The --turn -1 flag ensures we only get the last turn's messages.
|
|
275
297
|
const messages = data.messages || []
|
|
276
298
|
const textParts: string[] = []
|
|
277
299
|
|
package/src/claude-code.ts
CHANGED
|
@@ -222,6 +222,12 @@ export async function runClaudeCodeAgent(
|
|
|
222
222
|
})(),
|
|
223
223
|
}
|
|
224
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
|
+
}
|
|
225
231
|
console.error(
|
|
226
232
|
`\n>>> Claude Code [${modelStr}] [${permissionMode}] ${sessionInfo}: ${promptPreview}...`,
|
|
227
233
|
)
|
package/src/types.ts
CHANGED
|
@@ -42,7 +42,9 @@ export interface ClaudeCodeOptions {
|
|
|
42
42
|
* System prompt for the Claude Code session.
|
|
43
43
|
* Can be a full string or use the preset format with append.
|
|
44
44
|
*/
|
|
45
|
-
systemPrompt?:
|
|
45
|
+
systemPrompt?:
|
|
46
|
+
| string
|
|
47
|
+
| { type: 'preset'; preset: 'claude_code'; append: string }
|
|
46
48
|
/**
|
|
47
49
|
* Subagent definitions for parallel task dispatch via the Task tool.
|
|
48
50
|
* Keys are agent names, values are agent definitions.
|
|
@@ -62,6 +64,10 @@ export interface ModelConfig {
|
|
|
62
64
|
/** Provider ID (required for OpenCode, ignored for Claude Code). */
|
|
63
65
|
providerID?: string
|
|
64
66
|
modelID: string
|
|
67
|
+
/** Model variant for reasoning effort (e.g. 'low', 'medium', 'high', 'max'). */
|
|
68
|
+
variant?: string
|
|
69
|
+
/** Override the thinking token budget for the selected variant. */
|
|
70
|
+
variantThinkingBudget?: number
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
// ============================================================================
|