@cabane/companion 0.6.144 → 0.6.145

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
@@ -2259,24 +2259,18 @@ function summarizeToolInput(input) {
2259
2259
  }
2260
2260
  return "";
2261
2261
  }
2262
- function summarizeToolIo(input) {
2262
+ function renderToolIo(input) {
2263
2263
  if (input === void 0 || input === null) return "";
2264
- if (typeof input === "string") {
2265
- const trimmed = input.trim();
2266
- return trimmed.length > 0 ? truncate(trimmed, TOOL_IO_MAX_CHARS) : "";
2267
- }
2264
+ if (typeof input === "string") return input.trim();
2268
2265
  try {
2269
- return truncate(JSON.stringify(input), TOOL_IO_MAX_CHARS);
2266
+ return JSON.stringify(input) ?? "";
2270
2267
  } catch {
2271
2268
  return "";
2272
2269
  }
2273
2270
  }
2274
- function summarizeToolResult(content) {
2271
+ function renderToolResult(content) {
2275
2272
  if (content === void 0 || content === null) return "";
2276
- if (typeof content === "string") {
2277
- const trimmed = content.trim();
2278
- return trimmed.length > 0 ? truncate(trimmed, TOOL_IO_MAX_CHARS) : "";
2279
- }
2273
+ if (typeof content === "string") return content.trim();
2280
2274
  if (Array.isArray(content)) {
2281
2275
  const parts = [];
2282
2276
  let sawContentEntry = false;
@@ -2291,12 +2285,12 @@ function summarizeToolResult(content) {
2291
2285
  }
2292
2286
  }
2293
2287
  const joined = parts.join("\n").trim();
2294
- if (joined.length > 0) return truncate(joined, TOOL_IO_MAX_CHARS);
2288
+ if (joined.length > 0) return joined;
2295
2289
  if (sawContentEntry || content.length === 0) return "";
2296
2290
  }
2297
2291
  if (typeof content !== "object") return "";
2298
2292
  if (!Array.isArray(content) && Object.keys(content).length === 0) return "";
2299
- return summarizeToolIo(content);
2293
+ return renderToolIo(content);
2300
2294
  }
2301
2295
  function truncate(s, max) {
2302
2296
  if (s.length <= max) return s;
@@ -2320,14 +2314,19 @@ function sinkEmitter(sink, _onError) {
2320
2314
  return;
2321
2315
  case "tool":
2322
2316
  if (sink.onToolActivity) {
2317
+ const input = renderToolIo(event.input);
2318
+ const result = event.result === void 0 ? null : renderToolResult(event.result);
2323
2319
  await sink.onToolActivity({
2324
2320
  toolUseId: event.id,
2325
2321
  toolName: event.name,
2326
2322
  summary: event.summary,
2327
- // SJ529: render the raw payloads for the tool log here — the single
2328
- // truncation site (CT255 consumer concern).
2329
- input: summarizeToolIo(event.input),
2330
- result: event.result === void 0 ? "" : summarizeToolResult(event.result),
2323
+ input: truncate(input, TOOL_IO_MAX_CHARS),
2324
+ result: result === null ? "" : truncate(result, TOOL_IO_MAX_CHARS),
2325
+ // CT1752: only when the event carried an input — a completion whose
2326
+ // start this process never saw has none, and a zero would overwrite
2327
+ // the size its start recorded.
2328
+ ...event.input === void 0 ? {} : { inputChars: input.length },
2329
+ ...result === null ? {} : { resultChars: result.length },
2331
2330
  // CT496: carry the originating MCP server (null when absent / a host tool).
2332
2331
  mcpServer: event.mcpServer ?? null,
2333
2332
  phase: event.phase
@@ -2400,6 +2399,8 @@ var init_pump = __esm({
2400
2399
  summary: evt.summary,
2401
2400
  input: evt.input,
2402
2401
  result: evt.result,
2402
+ ...evt.inputChars !== void 0 ? { inputChars: evt.inputChars } : {},
2403
+ ...evt.resultChars !== void 0 ? { resultChars: evt.resultChars } : {},
2403
2404
  mcpServer: evt.mcpServer,
2404
2405
  phase: evt.phase,
2405
2406
  seq
@@ -8973,6 +8974,8 @@ var init_turn_committer = __esm({
8973
8974
  summary,
8974
8975
  input,
8975
8976
  result,
8977
+ inputChars,
8978
+ resultChars,
8976
8979
  mcpServer,
8977
8980
  phase,
8978
8981
  seq
@@ -8988,6 +8991,8 @@ var init_turn_committer = __esm({
8988
8991
  summary,
8989
8992
  input,
8990
8993
  result,
8994
+ ...inputChars !== void 0 ? { inputChars } : {},
8995
+ ...resultChars !== void 0 ? { resultChars } : {},
8991
8996
  mcpServer,
8992
8997
  phase,
8993
8998
  seq,
package/dist/runtime.js CHANGED
@@ -3719,24 +3719,18 @@ function summarizeToolInput(input) {
3719
3719
  return "";
3720
3720
  }
3721
3721
  var TOOL_IO_MAX_CHARS = 1e4;
3722
- function summarizeToolIo(input) {
3722
+ function renderToolIo(input) {
3723
3723
  if (input === void 0 || input === null) return "";
3724
- if (typeof input === "string") {
3725
- const trimmed = input.trim();
3726
- return trimmed.length > 0 ? truncate(trimmed, TOOL_IO_MAX_CHARS) : "";
3727
- }
3724
+ if (typeof input === "string") return input.trim();
3728
3725
  try {
3729
- return truncate(JSON.stringify(input), TOOL_IO_MAX_CHARS);
3726
+ return JSON.stringify(input) ?? "";
3730
3727
  } catch {
3731
3728
  return "";
3732
3729
  }
3733
3730
  }
3734
- function summarizeToolResult(content) {
3731
+ function renderToolResult(content) {
3735
3732
  if (content === void 0 || content === null) return "";
3736
- if (typeof content === "string") {
3737
- const trimmed = content.trim();
3738
- return trimmed.length > 0 ? truncate(trimmed, TOOL_IO_MAX_CHARS) : "";
3739
- }
3733
+ if (typeof content === "string") return content.trim();
3740
3734
  if (Array.isArray(content)) {
3741
3735
  const parts = [];
3742
3736
  let sawContentEntry = false;
@@ -3751,12 +3745,12 @@ function summarizeToolResult(content) {
3751
3745
  }
3752
3746
  }
3753
3747
  const joined = parts.join("\n").trim();
3754
- if (joined.length > 0) return truncate(joined, TOOL_IO_MAX_CHARS);
3748
+ if (joined.length > 0) return joined;
3755
3749
  if (sawContentEntry || content.length === 0) return "";
3756
3750
  }
3757
3751
  if (typeof content !== "object") return "";
3758
3752
  if (!Array.isArray(content) && Object.keys(content).length === 0) return "";
3759
- return summarizeToolIo(content);
3753
+ return renderToolIo(content);
3760
3754
  }
3761
3755
  function truncate(s, max) {
3762
3756
  if (s.length <= max) return s;
@@ -3773,14 +3767,19 @@ function sinkEmitter(sink, _onError) {
3773
3767
  return;
3774
3768
  case "tool":
3775
3769
  if (sink.onToolActivity) {
3770
+ const input = renderToolIo(event.input);
3771
+ const result = event.result === void 0 ? null : renderToolResult(event.result);
3776
3772
  await sink.onToolActivity({
3777
3773
  toolUseId: event.id,
3778
3774
  toolName: event.name,
3779
3775
  summary: event.summary,
3780
- // SJ529: render the raw payloads for the tool log here — the single
3781
- // truncation site (CT255 consumer concern).
3782
- input: summarizeToolIo(event.input),
3783
- result: event.result === void 0 ? "" : summarizeToolResult(event.result),
3776
+ input: truncate(input, TOOL_IO_MAX_CHARS),
3777
+ result: result === null ? "" : truncate(result, TOOL_IO_MAX_CHARS),
3778
+ // CT1752: only when the event carried an input — a completion whose
3779
+ // start this process never saw has none, and a zero would overwrite
3780
+ // the size its start recorded.
3781
+ ...event.input === void 0 ? {} : { inputChars: input.length },
3782
+ ...result === null ? {} : { resultChars: result.length },
3784
3783
  // CT496: carry the originating MCP server (null when absent / a host tool).
3785
3784
  mcpServer: event.mcpServer ?? null,
3786
3785
  phase: event.phase
@@ -3841,6 +3840,8 @@ var TurnPump = class {
3841
3840
  summary: evt.summary,
3842
3841
  input: evt.input,
3843
3842
  result: evt.result,
3843
+ ...evt.inputChars !== void 0 ? { inputChars: evt.inputChars } : {},
3844
+ ...evt.resultChars !== void 0 ? { resultChars: evt.resultChars } : {},
3844
3845
  mcpServer: evt.mcpServer,
3845
3846
  phase: evt.phase,
3846
3847
  seq
@@ -9992,6 +9993,8 @@ var TurnCommitter = class {
9992
9993
  summary,
9993
9994
  input,
9994
9995
  result,
9996
+ inputChars,
9997
+ resultChars,
9995
9998
  mcpServer,
9996
9999
  phase,
9997
10000
  seq
@@ -10007,6 +10010,8 @@ var TurnCommitter = class {
10007
10010
  summary,
10008
10011
  input,
10009
10012
  result,
10013
+ ...inputChars !== void 0 ? { inputChars } : {},
10014
+ ...resultChars !== void 0 ? { resultChars } : {},
10010
10015
  mcpServer,
10011
10016
  phase,
10012
10017
  seq,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cabane/companion",
3
- "version": "0.6.144",
3
+ "version": "0.6.145",
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",