@cabane/companion 0.6.114 → 0.6.115

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/dist/cli.js CHANGED
@@ -2877,6 +2877,14 @@ function apiErrorCode(err) {
2877
2877
  const body = err.body;
2878
2878
  return typeof body === "object" && body !== null && typeof body.error === "string" ? body.error : null;
2879
2879
  }
2880
+ function apiErrorMessage(err) {
2881
+ const body = err instanceof ApiError ? err.body : void 0;
2882
+ if (body !== null && typeof body === "object") {
2883
+ const message = body.message;
2884
+ if (typeof message === "string" && message.length > 0) return message;
2885
+ }
2886
+ return err instanceof Error ? err.message : String(err);
2887
+ }
2880
2888
  function leaseRefusal(err) {
2881
2889
  const code = apiErrorCode(err);
2882
2890
  if (code && LEASE_REFUSALS.has(code)) return code;
@@ -8421,12 +8429,12 @@ async function performAct(acts, act) {
8421
8429
  );
8422
8430
  } catch (err) {
8423
8431
  if (err instanceof ApiError) {
8424
- if (err.status === 409) {
8432
+ if (err.status === 409 && apiErrorCode(err) === "no_active_turn") {
8425
8433
  return toolError(
8426
8434
  "No active turn: this turn has already settled, so the act was not performed."
8427
8435
  );
8428
8436
  }
8429
- return toolError(`The act was refused (${err.status}): ${err.message}`);
8437
+ return toolError(`The act was refused (${err.status}): ${apiErrorMessage(err)}`);
8430
8438
  }
8431
8439
  const message = err instanceof Error ? err.message : String(err);
8432
8440
  return toolError(
package/dist/runtime.js CHANGED
@@ -2211,6 +2211,14 @@ function apiErrorCode(err) {
2211
2211
  const body = err.body;
2212
2212
  return typeof body === "object" && body !== null && typeof body.error === "string" ? body.error : null;
2213
2213
  }
2214
+ function apiErrorMessage(err) {
2215
+ const body = err instanceof ApiError ? err.body : void 0;
2216
+ if (body !== null && typeof body === "object") {
2217
+ const message = body.message;
2218
+ if (typeof message === "string" && message.length > 0) return message;
2219
+ }
2220
+ return err instanceof Error ? err.message : String(err);
2221
+ }
2214
2222
  function leaseRefusal(err) {
2215
2223
  const code = apiErrorCode(err);
2216
2224
  if (code && LEASE_REFUSALS.has(code)) return code;
@@ -7844,12 +7852,12 @@ async function performAct(acts, act) {
7844
7852
  );
7845
7853
  } catch (err) {
7846
7854
  if (err instanceof ApiError) {
7847
- if (err.status === 409) {
7855
+ if (err.status === 409 && apiErrorCode(err) === "no_active_turn") {
7848
7856
  return toolError(
7849
7857
  "No active turn: this turn has already settled, so the act was not performed."
7850
7858
  );
7851
7859
  }
7852
- return toolError(`The act was refused (${err.status}): ${err.message}`);
7860
+ return toolError(`The act was refused (${err.status}): ${apiErrorMessage(err)}`);
7853
7861
  }
7854
7862
  const message = err instanceof Error ? err.message : String(err);
7855
7863
  return toolError(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cabane/companion",
3
- "version": "0.6.114",
3
+ "version": "0.6.115",
4
4
  "type": "module",
5
5
  "description": "The Cabane Companion (headless): connect a coding agent on your machine to your Cabane workspace as a responder — drive work against your own codebase, files, and MCP servers without putting any of it in Cabane.",
6
6
  "license": "UNLICENSED",