@bunny-agent/runner-cli 0.9.37 → 0.9.38-beta.2

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/dist/bundle.mjs +42 -37
  2. package/package.json +2 -2
package/dist/bundle.mjs CHANGED
@@ -2117,14 +2117,23 @@ var PiAISDKStreamConverter = class {
2117
2117
  const raw = event.result?.details?.usage?.raw;
2118
2118
  if (raw != null)
2119
2119
  accumulateToolUsage(this.toolUsageTally, raw);
2120
- chunks.push(sseData({
2121
- type: "tool-output-available",
2122
- toolCallId: event.toolCallId,
2123
- output,
2124
- isError: event.isError,
2125
- dynamic: true,
2126
- providerExecuted: true
2127
- }));
2120
+ if (event.isError) {
2121
+ chunks.push(sseData({
2122
+ type: "tool-output-error",
2123
+ toolCallId: event.toolCallId,
2124
+ errorText: output,
2125
+ dynamic: true,
2126
+ providerExecuted: true
2127
+ }));
2128
+ } else {
2129
+ chunks.push(sseData({
2130
+ type: "tool-output-available",
2131
+ toolCallId: event.toolCallId,
2132
+ output,
2133
+ dynamic: true,
2134
+ providerExecuted: true
2135
+ }));
2136
+ }
2128
2137
  return chunks;
2129
2138
  }
2130
2139
  if (event.type === "agent_end") {
@@ -5219,7 +5228,15 @@ __export(type_exports2, {
5219
5228
  var Type = type_exports2;
5220
5229
 
5221
5230
  // ../../packages/runner-pi/dist/tool-refs.js
5222
- var LOG_PREFIX2 = "[bunny-agent:pi-tool-ref]";
5231
+ var PiToolRefError = class extends Error {
5232
+ constructor(message, opts) {
5233
+ super(message);
5234
+ this.name = "PiToolRefError";
5235
+ this.toolName = opts.toolName;
5236
+ this.status = opts.status;
5237
+ this.body = opts.body;
5238
+ }
5239
+ };
5223
5240
  function buildToolDefinitionsFromRefs(tools) {
5224
5241
  return tools.map((spec) => buildOne(spec));
5225
5242
  }
@@ -5236,15 +5253,25 @@ function buildOne(spec) {
5236
5253
  response = await executeToolRef(spec, params, signal);
5237
5254
  } catch (error) {
5238
5255
  const message = error instanceof Error ? error.message : String(error);
5239
- return transportErrorResult(spec.name, message);
5256
+ throw new PiToolRefError(`Tool "${spec.name}" transport error: ${message}`, { toolName: spec.name });
5240
5257
  }
5241
5258
  if (response.status < 200 || response.status >= 300) {
5242
- return statusErrorResult(spec.name, response.status, response.body);
5259
+ throw new PiToolRefError(formatToolRuntimeErrorMessage(response), {
5260
+ toolName: spec.name,
5261
+ status: response.status,
5262
+ body: response.body
5263
+ });
5243
5264
  }
5244
5265
  return okResult(response.body);
5245
5266
  }
5246
5267
  };
5247
5268
  }
5269
+ function formatToolRuntimeErrorMessage(response) {
5270
+ const body = response.body.trim();
5271
+ if (body.length > 0)
5272
+ return body;
5273
+ return `Tool execution failed with status ${response.status}`;
5274
+ }
5248
5275
  async function executeToolRef(spec, params, signal) {
5249
5276
  switch (spec.runtime.type) {
5250
5277
  case "http":
@@ -5285,28 +5312,6 @@ function okResult(text) {
5285
5312
  details: void 0
5286
5313
  };
5287
5314
  }
5288
- function statusErrorResult(toolName, status, body) {
5289
- return {
5290
- content: [
5291
- {
5292
- type: "text",
5293
- text: `${LOG_PREFIX2} tool "${toolName}" failed (status ${status}): ${body}`
5294
- }
5295
- ],
5296
- details: void 0
5297
- };
5298
- }
5299
- function transportErrorResult(toolName, message) {
5300
- return {
5301
- content: [
5302
- {
5303
- type: "text",
5304
- text: `${LOG_PREFIX2} tool "${toolName}" transport error: ${message}`
5305
- }
5306
- ],
5307
- details: void 0
5308
- };
5309
- }
5310
5315
  function serializeResult(result) {
5311
5316
  if (typeof result === "string")
5312
5317
  return result;
@@ -5314,7 +5319,7 @@ function serializeResult(result) {
5314
5319
  }
5315
5320
 
5316
5321
  // ../../packages/runner-pi/dist/pi-runner.js
5317
- var LOG_PREFIX3 = "[bunny-agent:pi]";
5322
+ var LOG_PREFIX2 = "[bunny-agent:pi]";
5318
5323
  function applyAllowedTools(tools, allowedTools) {
5319
5324
  if (!allowedTools)
5320
5325
  return tools;
@@ -5445,11 +5450,11 @@ function createPiRunner(options = {}) {
5445
5450
  return SessionManager2.open(resume);
5446
5451
  }
5447
5452
  const sessionPath2 = resolveSessionPathById(cwd, resume);
5448
- console.error(`${LOG_PREFIX3} resume: id=${resume} path=${sessionPath2 ?? "(not found)"}`);
5453
+ console.error(`${LOG_PREFIX2} resume: id=${resume} path=${sessionPath2 ?? "(not found)"}`);
5449
5454
  if (sessionPath2) {
5450
5455
  if (isSessionFileTooLarge(sessionPath2)) {
5451
5456
  const context = extractSessionContext(sessionPath2);
5452
- console.error(`${LOG_PREFIX3} session file too large, starting fresh${context ? " (with context)" : ""}`);
5457
+ console.error(`${LOG_PREFIX2} session file too large, starting fresh${context ? " (with context)" : ""}`);
5453
5458
  const newMgr = SessionManager2.create(cwd);
5454
5459
  if (context) {
5455
5460
  const firstId = newMgr.getEntries()[0]?.id ?? "";
@@ -5469,7 +5474,7 @@ function createPiRunner(options = {}) {
5469
5474
  appendSystemPrompt: options.systemPrompt
5470
5475
  }) : void 0;
5471
5476
  if (options.skillPaths && options.skillPaths.length > 0) {
5472
- console.error(`${LOG_PREFIX3} runner: cwd=${cwd} skillPaths=${JSON.stringify(options.skillPaths)}`);
5477
+ console.error(`${LOG_PREFIX2} runner: cwd=${cwd} skillPaths=${JSON.stringify(options.skillPaths)}`);
5473
5478
  }
5474
5479
  if (resourceLoader) {
5475
5480
  await resourceLoader.reload();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunny-agent/runner-cli",
3
- "version": "0.9.37",
3
+ "version": "0.9.38-beta.2",
4
4
  "description": "BunnyAgent Runner CLI - Like gemini-cli or claude-code, runs in your local terminal with AI SDK UI streaming",
5
5
  "type": "module",
6
6
  "bin": {
@@ -55,8 +55,8 @@
55
55
  "vitest": "^1.6.1",
56
56
  "@bunny-agent/runner-harness": "0.1.1-beta.0",
57
57
  "@bunny-agent/runner-claude": "0.6.2",
58
- "@bunny-agent/runner-codex": "0.6.2",
59
58
  "@bunny-agent/runner-gemini": "0.6.2",
59
+ "@bunny-agent/runner-codex": "0.6.2",
60
60
  "@bunny-agent/runner-opencode": "0.6.2",
61
61
  "@bunny-agent/runner-pi": "0.6.4-beta.0"
62
62
  },