ocpipe 0.5.9 → 0.5.10

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/claude-code.ts +12 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ocpipe",
3
- "version": "0.5.9",
3
+ "version": "0.5.10",
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.29"
34
+ "@anthropic-ai/claude-agent-sdk": "0.2.31"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "@anthropic-ai/claude-agent-sdk": {
@@ -34,8 +34,14 @@ const TOOL_COLORS: Record<string, string> = {
34
34
  Grep: Style.TEXT_INFO_BOLD,
35
35
  }
36
36
 
37
+ /** Track whether the last stderr write ended with a newline. */
38
+ let lastOutputEndedWithNewline = true
39
+
37
40
  /** Print a tool event with colored pipe prefix. */
38
41
  function printToolEvent(color: string, type: string, title: string): void {
42
+ if (!lastOutputEndedWithNewline) {
43
+ process.stderr.write('\n')
44
+ }
39
45
  const line = [
40
46
  color + '|',
41
47
  Style.TEXT_NORMAL + Style.TEXT_DIM + ` ${type.padEnd(7)}`,
@@ -197,6 +203,7 @@ export async function runClaudeCodeAgent(
197
203
  if (text) {
198
204
  textParts.push(text)
199
205
  process.stderr.write(text)
206
+ lastOutputEndedWithNewline = text.endsWith('\n')
200
207
  }
201
208
  }
202
209
  })()
@@ -216,6 +223,11 @@ export async function runClaudeCodeAgent(
216
223
  `\n<<< Claude Code done (${response.length} chars) [session:${sessionStr}]`,
217
224
  )
218
225
 
226
+ // Detect rate limit errors in the response
227
+ if (response.includes("You've hit your limit")) {
228
+ throw new Error('Claude Code rate limit exceeded')
229
+ }
230
+
219
231
  return {
220
232
  text: response,
221
233
  sessionId: newSessionId,