lonny-agent 0.2.2 → 0.2.3

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": "lonny-agent",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "license": "MIT",
5
5
  "repository": "github:as3long/lonny-agent",
6
6
  "description": "AI coding agent that does more with fewer API calls, optimized for Coding Plan (5h 1200-call bundle)",
@@ -116,12 +116,18 @@ export class AnthropicProvider implements LLMProvider {
116
116
  }
117
117
  } else if (event.type === 'content_block_stop') {
118
118
  if (currentToolUse) {
119
+ let input: Record<string, unknown>
120
+ try {
121
+ input = JSON.parse(currentToolUse.input || '{}')
122
+ } catch {
123
+ input = {}
124
+ }
119
125
  yield {
120
126
  type: 'tool_use',
121
127
  tool_call: {
122
128
  id: currentToolUse.id,
123
129
  name: currentToolUse.name,
124
- input: JSON.parse(currentToolUse.input || '{}'),
130
+ input,
125
131
  },
126
132
  }
127
133
  currentToolUse = null
@@ -138,12 +144,18 @@ export class AnthropicProvider implements LLMProvider {
138
144
  }
139
145
  if (event.delta.stop_reason === 'end_turn' || event.delta.stop_reason === 'stop_sequence') {
140
146
  if (currentToolUse) {
147
+ let input: Record<string, unknown>
148
+ try {
149
+ input = JSON.parse(currentToolUse.input || '{}')
150
+ } catch {
151
+ input = {}
152
+ }
141
153
  yield {
142
154
  type: 'tool_use',
143
155
  tool_call: {
144
156
  id: currentToolUse.id,
145
157
  name: currentToolUse.name,
146
- input: JSON.parse(currentToolUse.input || '{}'),
158
+ input,
147
159
  },
148
160
  }
149
161
  currentToolUse = null
@@ -200,12 +200,18 @@ export class OpenAIProvider implements LLMProvider {
200
200
  for (const tc of delta.tool_calls) {
201
201
  if (tc.id) {
202
202
  if (currentToolCall) {
203
+ let input: Record<string, unknown>
204
+ try {
205
+ input = JSON.parse(currentToolCall.arguments || '{}')
206
+ } catch {
207
+ input = {}
208
+ }
203
209
  yield {
204
210
  type: 'tool_use',
205
211
  tool_call: {
206
212
  id: currentToolCall.id,
207
213
  name: currentToolCall.name,
208
- input: JSON.parse(currentToolCall.arguments || '{}'),
214
+ input,
209
215
  },
210
216
  reasoning_content: reasoningContent,
211
217
  }
@@ -296,12 +302,18 @@ export class OpenAIProvider implements LLMProvider {
296
302
  output_tokens: lastUsage.completion_tokens ?? 0,
297
303
  }
298
304
  : undefined
305
+ let input: Record<string, unknown>
306
+ try {
307
+ input = JSON.parse(currentToolCall.arguments || '{}')
308
+ } catch {
309
+ input = {}
310
+ }
299
311
  yield {
300
312
  type: 'tool_use',
301
313
  tool_call: {
302
314
  id: currentToolCall.id,
303
315
  name: currentToolCall.name,
304
- input: JSON.parse(currentToolCall.arguments || '{}'),
316
+ input,
305
317
  },
306
318
  reasoning_content: reasoningContent,
307
319
  usage,