@cabane/companion 0.6.183 → 0.6.185

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
@@ -1128,7 +1128,7 @@ function classifyRuntimeNoticeText(text) {
1128
1128
  }
1129
1129
  return null;
1130
1130
  }
1131
- var turnFailureSchema, USAGE_CAPPED, RATE_LIMITED, SERVER_ERROR, AUTH_EXPIRED, AUTH_PATTERNS, SERVER_PATTERNS, CAP_PATTERNS, NEGATED_CAP, RATE_PATTERNS, BARE_LIMIT;
1131
+ var turnFailureSchema, ERROR_REASON_MAX, USAGE_CAPPED, RATE_LIMITED, SERVER_ERROR, AUTH_EXPIRED, AUTH_PATTERNS, SERVER_PATTERNS, CAP_PATTERNS, NEGATED_CAP, RATE_PATTERNS, BARE_LIMIT;
1132
1132
  var init_failure = __esm({
1133
1133
  "packages/agent-runtime/src/failure.ts"() {
1134
1134
  "use strict";
@@ -1138,6 +1138,7 @@ var init_failure = __esm({
1138
1138
  z4.object({ kind: z4.literal("server_error") }),
1139
1139
  z4.object({ kind: z4.literal("auth_expired") })
1140
1140
  ]);
1141
+ ERROR_REASON_MAX = 2e3;
1141
1142
  USAGE_CAPPED = "usage_capped";
1142
1143
  RATE_LIMITED = "rate_limited";
1143
1144
  SERVER_ERROR = "server_error";
@@ -2588,7 +2589,7 @@ var init_prompt_guidance = __esm({
2588
2589
  ask: "put a structured question to a person",
2589
2590
  cancel_wake: "cancel your own armed wake in this conversation",
2590
2591
  skip_turn: "end without posting a reply",
2591
- wake_me: "schedule your own return; when it fires, say first what you came back to check",
2592
+ wake_me: "schedule your own return; when it fires, say what you came back to check",
2592
2593
  withdraw_ask: "withdraw an open ask in this conversation with a reason"
2593
2594
  };
2594
2595
  }
@@ -2966,7 +2967,7 @@ function createFailureEvidence() {
2966
2967
  const failure = classifyResultFailure(msg, signals);
2967
2968
  const resultText = msg.result ?? "";
2968
2969
  const isError = msg.is_error === true;
2969
- return failure ? encodeFailureReason(failure) : isError ? `error:${resultText.slice(0, 200) || "unknown"}` : `result_error:${msg.subtype}`;
2970
+ return failure ? encodeFailureReason(failure) : isError ? `error:${resultText || "unknown"}`.slice(0, ERROR_REASON_MAX) : `result_error:${msg.subtype}`;
2970
2971
  },
2971
2972
  thrownFailure(message2, initReceived) {
2972
2973
  return initReceived ? classifyErrorText(message2) : classifyFailure(signals, { text: message2 });
@@ -4058,9 +4059,7 @@ var init_addendum2 = __esm({
4058
4059
  "local machine \u2014 a workspace read is `query` with the operation name `files.read`. The",
4059
4060
  "collision runs the other way too: `read` is a host tool here AND `files.read` is an",
4060
4061
  "operation name, so keep the bare verb and the dotted name apart. If a tool ever appears with",
4061
- "an `mcp__\u2026__` prefix, that prefix is not part of its name here. One more harness fact: you",
4062
- "can interleave narration with tool calls, but your final message is the",
4063
- "turn's answer \u2014 write your closing answer last."
4062
+ "an `mcp__\u2026__` prefix, that prefix is not part of its name here."
4064
4063
  ].join(" ");
4065
4064
  }
4066
4065
  });
@@ -4260,7 +4259,7 @@ async function* decodeOpencodeStream(events, ctx2) {
4260
4259
  yield { type: "runtime_notice", body: notice };
4261
4260
  }
4262
4261
  const failure = classifyErrorText(errorText);
4263
- reason = failure ? encodeFailureReason(failure) : `error:${errorText.slice(0, 200)}`;
4262
+ reason = failure ? encodeFailureReason(failure) : `error:${errorText}`.slice(0, ERROR_REASON_MAX);
4264
4263
  settled = true;
4265
4264
  break;
4266
4265
  }
@@ -5214,10 +5213,7 @@ var init_addendum3 = __esm({
5214
5213
  "`mcp__cabane__begin_upload`, `mcp__cabane__finalize_upload` and",
5215
5214
  "`mcp__cabane__mint_render_token` \u2014 all possibly deferred too.",
5216
5215
  "There is no Cabane `read`/`write`/`search` tool \u2014 those are",
5217
- "operation NAMES you pass to `query` / `mutate`. One more harness fact: you can interleave",
5218
- "narration",
5219
- "with tool calls, but your final message is the turn's answer \u2014 write your",
5220
- "closing answer last."
5216
+ "operation NAMES you pass to `query` / `mutate`."
5221
5217
  ].join(" ");
5222
5218
  }
5223
5219
  });
@@ -5500,7 +5496,7 @@ async function* decodeCodexStream(events, ctx2) {
5500
5496
  if (isModelMetadataError(message2)) {
5501
5497
  yield* flushInterim();
5502
5498
  ok = false;
5503
- reason = `model_unavailable:${message2.slice(0, 200)}`;
5499
+ reason = `model_unavailable:${message2}`.slice(0, ERROR_REASON_MAX);
5504
5500
  settled = true;
5505
5501
  break;
5506
5502
  }
@@ -5568,7 +5564,7 @@ async function* decodeCodexStream(events, ctx2) {
5568
5564
  yield { type: "runtime_notice", body: notice };
5569
5565
  }
5570
5566
  const failure = classifyErrorText(text);
5571
- reason = failure ? encodeFailureReason(failure) : `error:${text.slice(0, 200)}`;
5567
+ reason = failure ? encodeFailureReason(failure) : `error:${text}`.slice(0, ERROR_REASON_MAX);
5572
5568
  settled = true;
5573
5569
  break;
5574
5570
  }
@@ -7760,16 +7756,16 @@ function missingSecretReason(missing) {
7760
7756
  }
7761
7757
  return `${prefix}+${missing.length}`;
7762
7758
  }
7763
- var PLACEHOLDER_RE, secretStoreSchema, SECRET_ENV_NAME, ERROR_REASON_MAX;
7759
+ var PLACEHOLDER_RE, secretStoreSchema, SECRET_ENV_NAME;
7764
7760
  var init_secrets = __esm({
7765
7761
  "src/secrets.ts"() {
7766
7762
  "use strict";
7763
+ init_src();
7767
7764
  init_config();
7768
7765
  init_errors();
7769
7766
  PLACEHOLDER_RE = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
7770
7767
  secretStoreSchema = z15.record(z15.string(), z15.string());
7771
7768
  SECRET_ENV_NAME = /^CABANE_MCP_(\d+)$/;
7772
- ERROR_REASON_MAX = 200;
7773
7769
  }
7774
7770
  });
7775
7771
 
@@ -8133,7 +8129,7 @@ async function settleUnstarted(opts, payload, turnId, errorReason, log2) {
8133
8129
  activeRunStartedAt: null,
8134
8130
  turnId,
8135
8131
  outcome: "failed",
8136
- ...errorReason ? { errorReason: errorReason.slice(0, 200) } : {},
8132
+ ...errorReason ? { errorReason: errorReason.slice(0, ERROR_REASON_MAX) } : {},
8137
8133
  readThrough: payload.messageId
8138
8134
  });
8139
8135
  } catch (err) {
@@ -8155,7 +8151,7 @@ function sandboxInputs(launch, log2) {
8155
8151
  }
8156
8152
  if (!policy.ok) {
8157
8153
  log2.warn({ error: policy.error }, "runners: the sandbox policy is invalid; refusing the turn");
8158
- return { ok: false, reason: `setup_failed: ${policy.error}`.slice(0, 200) };
8154
+ return { ok: false, reason: `setup_failed: ${policy.error}`.slice(0, ERROR_REASON_MAX) };
8159
8155
  }
8160
8156
  if (!policyHasCredentials(policy.policy)) return { ok: true, credentials: [] };
8161
8157
  const store = (launch.secretStore ?? defaultSecretStore)(log2);
@@ -8393,7 +8389,7 @@ async function runTurnInRunner(opts, launch, duties, payload, handleOpts) {
8393
8389
  activeRunStartedAt: null,
8394
8390
  turnId,
8395
8391
  outcome: "failed",
8396
- errorReason: reason.slice(0, 200),
8392
+ errorReason: reason.slice(0, ERROR_REASON_MAX),
8397
8393
  readThrough: payload.messageId
8398
8394
  });
8399
8395
  } catch (err) {
@@ -8419,6 +8415,7 @@ var PINO_LEVELS;
8419
8415
  var init_launch = __esm({
8420
8416
  "src/runner/launch.ts"() {
8421
8417
  "use strict";
8418
+ init_src();
8422
8419
  init_sandbox_policy();
8423
8420
  init_opencode_lock();
8424
8421
  init_api_error_shape();
@@ -9556,7 +9553,7 @@ var init_turn_execution = __esm({
9556
9553
  async concludeBeforeRun(reason, errorReason) {
9557
9554
  const { payload, turnLog, startedAt, turnId } = this;
9558
9555
  const body = { activeRunStartedAt: null, turnId, outcome: "failed" };
9559
- if (errorReason) body.errorReason = errorReason.slice(0, 200);
9556
+ if (errorReason) body.errorReason = errorReason.slice(0, ERROR_REASON_MAX);
9560
9557
  const context = this.turnContext;
9561
9558
  if (context?.readThrough !== void 0) {
9562
9559
  body.readThrough = context.readThrough;
@@ -9595,7 +9592,7 @@ var init_turn_execution = __esm({
9595
9592
  // `errorReason`, so the inference alone would read it as settled.
9596
9593
  outcome: errorReason || this.outcome.runtimeIncomplete ? "failed" : "settled"
9597
9594
  };
9598
- if (errorReason) body.errorReason = errorReason.slice(0, 200);
9595
+ if (errorReason) body.errorReason = errorReason.slice(0, ERROR_REASON_MAX);
9599
9596
  try {
9600
9597
  await this.opts.api.setActiveRun(
9601
9598
  this.opts.workspaceId,
@@ -10007,7 +10004,7 @@ var init_turn_execution = __esm({
10007
10004
  }) : null;
10008
10005
  } catch (err) {
10009
10006
  if (!(err instanceof HarnessSandboxRefused)) throw err;
10010
- const reason = `setup_failed: ${err.message}`.slice(0, 200);
10007
+ const reason = `setup_failed: ${err.message}`.slice(0, ERROR_REASON_MAX);
10011
10008
  throw this.concluded(reason, reason);
10012
10009
  }
10013
10010
  const adapters = [];
@@ -10407,7 +10404,7 @@ var init_turn_execution = __esm({
10407
10404
  body.resolvedConfig = o.turnResolvedConfig;
10408
10405
  }
10409
10406
  if (!o.okResult && o.resultReason && o.resultReason !== "cancelled" && !userCancelled && !o.leaseLost && !o.runtimeIncomplete && !this.skipState.skipped) {
10410
- body.errorReason = o.resultReason.slice(0, 200);
10407
+ body.errorReason = o.resultReason.slice(0, ERROR_REASON_MAX);
10411
10408
  }
10412
10409
  body.outcome = o.okResult ? committer.spoke ? "settled" : "passed" : body.errorReason || o.runtimeIncomplete ? "failed" : "interrupted";
10413
10410
  if (body.outcome === "settled") body.lastMessageSeq = committer.lastMessageSeq;
package/dist/runtime.js CHANGED
@@ -1758,6 +1758,7 @@ var turnFailureSchema = z4.discriminatedUnion("kind", [
1758
1758
  z4.object({ kind: z4.literal("server_error") }),
1759
1759
  z4.object({ kind: z4.literal("auth_expired") })
1760
1760
  ]);
1761
+ var ERROR_REASON_MAX = 2e3;
1761
1762
  var USAGE_CAPPED = "usage_capped";
1762
1763
  var RATE_LIMITED = "rate_limited";
1763
1764
  var SERVER_ERROR = "server_error";
@@ -3561,7 +3562,7 @@ var MEANINGS = {
3561
3562
  ask: "put a structured question to a person",
3562
3563
  cancel_wake: "cancel your own armed wake in this conversation",
3563
3564
  skip_turn: "end without posting a reply",
3564
- wake_me: "schedule your own return; when it fires, say first what you came back to check",
3565
+ wake_me: "schedule your own return; when it fires, say what you came back to check",
3565
3566
  withdraw_ask: "withdraw an open ask in this conversation with a reason"
3566
3567
  };
3567
3568
  function turnControlPromptGuidance(prefix) {
@@ -3902,7 +3903,7 @@ function createFailureEvidence() {
3902
3903
  const failure = classifyResultFailure(msg, signals);
3903
3904
  const resultText = msg.result ?? "";
3904
3905
  const isError = msg.is_error === true;
3905
- return failure ? encodeFailureReason(failure) : isError ? `error:${resultText.slice(0, 200) || "unknown"}` : `result_error:${msg.subtype}`;
3906
+ return failure ? encodeFailureReason(failure) : isError ? `error:${resultText || "unknown"}`.slice(0, ERROR_REASON_MAX) : `result_error:${msg.subtype}`;
3906
3907
  },
3907
3908
  thrownFailure(message2, initReceived) {
3908
3909
  return initReceived ? classifyErrorText(message2) : classifyFailure(signals, { text: message2 });
@@ -4926,9 +4927,7 @@ var OPENCODE_ADDENDUM = [
4926
4927
  "local machine \u2014 a workspace read is `query` with the operation name `files.read`. The",
4927
4928
  "collision runs the other way too: `read` is a host tool here AND `files.read` is an",
4928
4929
  "operation name, so keep the bare verb and the dotted name apart. If a tool ever appears with",
4929
- "an `mcp__\u2026__` prefix, that prefix is not part of its name here. One more harness fact: you",
4930
- "can interleave narration with tool calls, but your final message is the",
4931
- "turn's answer \u2014 write your closing answer last."
4930
+ "an `mcp__\u2026__` prefix, that prefix is not part of its name here."
4932
4931
  ].join(" ");
4933
4932
 
4934
4933
  // packages/agent-runtime/src/opencode/events.ts
@@ -5120,7 +5119,7 @@ async function* decodeOpencodeStream(events, ctx) {
5120
5119
  yield { type: "runtime_notice", body: notice };
5121
5120
  }
5122
5121
  const failure = classifyErrorText(errorText);
5123
- reason = failure ? encodeFailureReason(failure) : `error:${errorText.slice(0, 200)}`;
5122
+ reason = failure ? encodeFailureReason(failure) : `error:${errorText}`.slice(0, ERROR_REASON_MAX);
5124
5123
  settled = true;
5125
5124
  break;
5126
5125
  }
@@ -6002,10 +6001,7 @@ var CODEX_ADDENDUM = [
6002
6001
  "`mcp__cabane__begin_upload`, `mcp__cabane__finalize_upload` and",
6003
6002
  "`mcp__cabane__mint_render_token` \u2014 all possibly deferred too.",
6004
6003
  "There is no Cabane `read`/`write`/`search` tool \u2014 those are",
6005
- "operation NAMES you pass to `query` / `mutate`. One more harness fact: you can interleave",
6006
- "narration",
6007
- "with tool calls, but your final message is the turn's answer \u2014 write your",
6008
- "closing answer last."
6004
+ "operation NAMES you pass to `query` / `mutate`."
6009
6005
  ].join(" ");
6010
6006
 
6011
6007
  // packages/agent-runtime/src/codex/events.ts
@@ -6276,7 +6272,7 @@ async function* decodeCodexStream(events, ctx) {
6276
6272
  if (isModelMetadataError(message2)) {
6277
6273
  yield* flushInterim();
6278
6274
  ok = false;
6279
- reason = `model_unavailable:${message2.slice(0, 200)}`;
6275
+ reason = `model_unavailable:${message2}`.slice(0, ERROR_REASON_MAX);
6280
6276
  settled = true;
6281
6277
  break;
6282
6278
  }
@@ -6344,7 +6340,7 @@ async function* decodeCodexStream(events, ctx) {
6344
6340
  yield { type: "runtime_notice", body: notice };
6345
6341
  }
6346
6342
  const failure = classifyErrorText(text);
6347
- reason = failure ? encodeFailureReason(failure) : `error:${text.slice(0, 200)}`;
6343
+ reason = failure ? encodeFailureReason(failure) : `error:${text}`.slice(0, ERROR_REASON_MAX);
6348
6344
  settled = true;
6349
6345
  break;
6350
6346
  }
@@ -8411,7 +8407,6 @@ function resolveMcpSecrets(mcpServers, store, serverSecretEnv = {}) {
8411
8407
  }
8412
8408
  return { servers, secretEnv, missing: [...missing].sort() };
8413
8409
  }
8414
- var ERROR_REASON_MAX = 200;
8415
8410
  function missingSecretReason(missing) {
8416
8411
  const prefix = "missing_secret: ";
8417
8412
  for (let shown = missing.length; shown >= 0; shown--) {
@@ -8746,7 +8741,7 @@ async function settleUnstarted(opts, payload, turnId, errorReason, log) {
8746
8741
  activeRunStartedAt: null,
8747
8742
  turnId,
8748
8743
  outcome: "failed",
8749
- ...errorReason ? { errorReason: errorReason.slice(0, 200) } : {},
8744
+ ...errorReason ? { errorReason: errorReason.slice(0, ERROR_REASON_MAX) } : {},
8750
8745
  readThrough: payload.messageId
8751
8746
  });
8752
8747
  } catch (err) {
@@ -8768,7 +8763,7 @@ function sandboxInputs(launch, log) {
8768
8763
  }
8769
8764
  if (!policy.ok) {
8770
8765
  log.warn({ error: policy.error }, "runners: the sandbox policy is invalid; refusing the turn");
8771
- return { ok: false, reason: `setup_failed: ${policy.error}`.slice(0, 200) };
8766
+ return { ok: false, reason: `setup_failed: ${policy.error}`.slice(0, ERROR_REASON_MAX) };
8772
8767
  }
8773
8768
  if (!policyHasCredentials(policy.policy)) return { ok: true, credentials: [] };
8774
8769
  const store = (launch.secretStore ?? defaultSecretStore)(log);
@@ -9006,7 +9001,7 @@ async function runTurnInRunner(opts, launch, duties, payload, handleOpts) {
9006
9001
  activeRunStartedAt: null,
9007
9002
  turnId,
9008
9003
  outcome: "failed",
9009
- errorReason: reason.slice(0, 200),
9004
+ errorReason: reason.slice(0, ERROR_REASON_MAX),
9010
9005
  readThrough: payload.messageId
9011
9006
  });
9012
9007
  } catch (err) {
@@ -10035,7 +10030,7 @@ var TurnExecution = class {
10035
10030
  async concludeBeforeRun(reason, errorReason) {
10036
10031
  const { payload, turnLog, startedAt, turnId } = this;
10037
10032
  const body = { activeRunStartedAt: null, turnId, outcome: "failed" };
10038
- if (errorReason) body.errorReason = errorReason.slice(0, 200);
10033
+ if (errorReason) body.errorReason = errorReason.slice(0, ERROR_REASON_MAX);
10039
10034
  const context = this.turnContext;
10040
10035
  if (context?.readThrough !== void 0) {
10041
10036
  body.readThrough = context.readThrough;
@@ -10074,7 +10069,7 @@ var TurnExecution = class {
10074
10069
  // `errorReason`, so the inference alone would read it as settled.
10075
10070
  outcome: errorReason || this.outcome.runtimeIncomplete ? "failed" : "settled"
10076
10071
  };
10077
- if (errorReason) body.errorReason = errorReason.slice(0, 200);
10072
+ if (errorReason) body.errorReason = errorReason.slice(0, ERROR_REASON_MAX);
10078
10073
  try {
10079
10074
  await this.opts.api.setActiveRun(
10080
10075
  this.opts.workspaceId,
@@ -10486,7 +10481,7 @@ var TurnExecution = class {
10486
10481
  }) : null;
10487
10482
  } catch (err) {
10488
10483
  if (!(err instanceof HarnessSandboxRefused)) throw err;
10489
- const reason = `setup_failed: ${err.message}`.slice(0, 200);
10484
+ const reason = `setup_failed: ${err.message}`.slice(0, ERROR_REASON_MAX);
10490
10485
  throw this.concluded(reason, reason);
10491
10486
  }
10492
10487
  const adapters = [];
@@ -10886,7 +10881,7 @@ var TurnExecution = class {
10886
10881
  body.resolvedConfig = o.turnResolvedConfig;
10887
10882
  }
10888
10883
  if (!o.okResult && o.resultReason && o.resultReason !== "cancelled" && !userCancelled && !o.leaseLost && !o.runtimeIncomplete && !this.skipState.skipped) {
10889
- body.errorReason = o.resultReason.slice(0, 200);
10884
+ body.errorReason = o.resultReason.slice(0, ERROR_REASON_MAX);
10890
10885
  }
10891
10886
  body.outcome = o.okResult ? committer.spoke ? "settled" : "passed" : body.errorReason || o.runtimeIncomplete ? "failed" : "interrupted";
10892
10887
  if (body.outcome === "settled") body.lastMessageSeq = committer.lastMessageSeq;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cabane/companion",
3
- "version": "0.6.183",
3
+ "version": "0.6.185",
4
4
  "type": "module",
5
5
  "description": "The Cabane Companion (headless): connect an 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",