@tablation/crew 0.152.3 → 0.153.0

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/cli.js +67 -16
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1373,10 +1373,44 @@ function toolTarget(name, input) {
1373
1373
  if (typeof v === "string" && v) return v;
1374
1374
  }
1375
1375
  if (name === "Bash" && typeof input.command === "string") {
1376
- return input.command.trim().split(/\s+/)[0];
1376
+ return shellTarget(input.command);
1377
1377
  }
1378
1378
  return void 0;
1379
1379
  }
1380
+ function shellTarget(command2) {
1381
+ let rest = command2.trim();
1382
+ for (; ; ) {
1383
+ const m = /^cd\s+(?:"[^"]*"|'[^']*'|[^\s;&|]+)\s*(?:&&|;)\s*/.exec(rest);
1384
+ if (!m || m[0].length >= rest.length) break;
1385
+ rest = rest.slice(m[0].length);
1386
+ }
1387
+ return rest.split(/\s+/)[0] || void 0;
1388
+ }
1389
+ var TOOL_DETAIL_MAX = 4e3;
1390
+ var TOOL_DETAIL_VALUE_MAX = 1e3;
1391
+ function capText(s, max) {
1392
+ return s.length <= max ? s : `${s.slice(0, Math.max(0, max - 1))}\u2026`;
1393
+ }
1394
+ function toolDetail(input, opts = {}) {
1395
+ if (!input) return {};
1396
+ const out = {};
1397
+ const desc = input.description;
1398
+ if (typeof desc === "string" && desc.trim()) out.description = capText(desc.trim(), TOOL_DETAIL_VALUE_MAX);
1399
+ const lines2 = [];
1400
+ for (const [key, v] of Object.entries(input)) {
1401
+ if (v === void 0 || v === null) continue;
1402
+ if (opts.shell && key === "description") continue;
1403
+ if (typeof v === "string" && opts.target !== void 0 && v === opts.target && !(opts.shell && key === "command")) continue;
1404
+ const text2 = typeof v === "string" ? v : JSON.stringify(v) ?? "";
1405
+ if (opts.shell && key === "command") {
1406
+ lines2.unshift(capText(text2, TOOL_DETAIL_VALUE_MAX));
1407
+ continue;
1408
+ }
1409
+ lines2.push(`${key}: ${capText(text2, TOOL_DETAIL_VALUE_MAX)}`);
1410
+ }
1411
+ if (lines2.length) out.detail = capText(lines2.join("\n"), TOOL_DETAIL_MAX);
1412
+ return out;
1413
+ }
1380
1414
  function mapStreamLine(line) {
1381
1415
  const obj = line;
1382
1416
  if (!obj || obj.type !== "assistant") return [];
@@ -1387,7 +1421,8 @@ function mapStreamLine(line) {
1387
1421
  if (block.type === "thinking") out.push({ kind: "thought", text: block.thinking });
1388
1422
  else if (block.type === "text") out.push({ kind: "text", text: block.text });
1389
1423
  else if (block.type === "tool_use") {
1390
- out.push({ kind: "tool", tool: block.name, target: toolTarget(block.name, block.input), input: block.input });
1424
+ const target = toolTarget(block.name, block.input);
1425
+ out.push({ kind: "tool", tool: block.name, target, ...toolDetail(block.input, { shell: block.name === "Bash", target }), input: block.input });
1391
1426
  }
1392
1427
  }
1393
1428
  return out;
@@ -1953,7 +1988,11 @@ function commandTarget(command2) {
1953
1988
  if (!command2) return void 0;
1954
1989
  const wrapped = /^(?:\S*\/)?(?:ba|z|da)?sh\s+-\w*c\s+(['"]?)([\s\S]*)\1$/.exec(command2.trim());
1955
1990
  const inner = (wrapped ? wrapped[2] : command2).trim();
1956
- return inner.split(/\s+/)[0] || void 0;
1991
+ return shellTarget(inner);
1992
+ }
1993
+ function innerCommand(command2) {
1994
+ const wrapped = /^(?:\S*\/)?(?:ba|z|da)?sh\s+-\w*c\s+(['"]?)([\s\S]*)\1$/.exec(command2.trim());
1995
+ return (wrapped ? wrapped[2] : command2).trim();
1957
1996
  }
1958
1997
  function mapCodexLine(line) {
1959
1998
  const l = line;
@@ -1964,10 +2003,15 @@ function mapCodexLine(line) {
1964
2003
  return it.text ? [{ kind: "thought", text: it.text }] : [];
1965
2004
  case "agent_message":
1966
2005
  return it.text ? [{ kind: "text", text: it.text }] : [];
1967
- case "command_execution":
1968
- return [{ kind: "tool", tool: "command", target: commandTarget(it.command) }];
1969
- case "file_change":
1970
- return [{ kind: "tool", tool: "file_change", target: it.changes?.[0]?.path }];
2006
+ case "command_execution": {
2007
+ const detail = it.command ? toolDetail({ command: innerCommand(it.command) }, { shell: true }) : {};
2008
+ return [{ kind: "tool", tool: "command", target: commandTarget(it.command), ...detail }];
2009
+ }
2010
+ case "file_change": {
2011
+ const paths = (it.changes ?? []).map((c) => c.path).filter((p) => !!p);
2012
+ const rest = paths.slice(1);
2013
+ return [{ kind: "tool", tool: "file_change", target: paths[0], ...rest.length ? { detail: rest.join("\n").slice(0, TOOL_DETAIL_MAX) } : {} }];
2014
+ }
1971
2015
  case "mcp_tool_call":
1972
2016
  return [{ kind: "tool", tool: `mcp__${it.server ?? "mcp"}__${it.tool ?? "tool"}` }];
1973
2017
  case "web_search":
@@ -2435,7 +2479,11 @@ function mapGeminiLine(line) {
2435
2479
  const obj = line;
2436
2480
  if (!obj || typeof obj !== "object") return [];
2437
2481
  if (obj.type === "message" && obj.role === "assistant" && obj.content) return [{ kind: "text", text: obj.content }];
2438
- if (obj.type === "tool_use") return [{ kind: "tool", tool: obj.tool_name, target: toolTarget(obj.tool_name === "run_shell_command" ? "Bash" : obj.tool_name, obj.parameters) }];
2482
+ if (obj.type === "tool_use") {
2483
+ const shell = obj.tool_name === "run_shell_command";
2484
+ const target = toolTarget(shell ? "Bash" : obj.tool_name, obj.parameters);
2485
+ return [{ kind: "tool", tool: obj.tool_name, target, ...toolDetail(obj.parameters, { shell, target }) }];
2486
+ }
2439
2487
  return [];
2440
2488
  }
2441
2489
  function createGeminiStreamMapper() {
@@ -14140,7 +14188,7 @@ var RunObserver = class {
14140
14188
  message: ev.kind === "tool" ? `${ev.tool ?? "tool"}${ev.target ? ` ${ev.target}` : ""}` : ev.kind,
14141
14189
  role: plan.role,
14142
14190
  ...this.liveTicket ? { ticket: this.liveTicket } : {},
14143
- data: { kind: ev.kind, ...ev.text ? { text: ev.text } : {}, ...ev.tool ? { tool: ev.tool } : {}, ...ev.target ? { target: ev.target } : {} }
14191
+ data: { kind: ev.kind, ...ev.text ? { text: ev.text } : {}, ...ev.tool ? { tool: ev.tool } : {}, ...ev.target ? { target: ev.target } : {}, ...ev.detail ? { detail: ev.detail } : {}, ...ev.description ? { description: ev.description } : {} }
14144
14192
  };
14145
14193
  if (!this.muted) this.eventsSink?.write(`${JSON.stringify(e)}
14146
14194
  `);
@@ -25364,8 +25412,11 @@ async function listWorkspaces(o) {
25364
25412
  return res.workspaces.map((w) => ({ slug: w.path ?? w.slug, name: w.name, role: w.role }));
25365
25413
  }
25366
25414
  var eq = (a, b) => (a ?? "").trim().toLowerCase() === b.trim().toLowerCase();
25367
- function seatFor(rows, role) {
25368
- const r = rows.find((x) => (x.name ?? "").toLowerCase().includes(role.toLowerCase()));
25415
+ function seatFor(rows, role, agentId) {
25416
+ const linked = agentId ? rows.find((x) => x.agent_id === agentId) : void 0;
25417
+ if (linked) return linked.id;
25418
+ const byName = (x) => (x.name ?? "").toLowerCase().includes(role.toLowerCase());
25419
+ const r = rows.find((x) => !x.agent_id && byName(x)) ?? rows.find(byName);
25369
25420
  return r?.id;
25370
25421
  }
25371
25422
  var REQUIRED_TABLES = ["Issues"];
@@ -25642,7 +25693,7 @@ async function discover(o) {
25642
25693
  }
25643
25694
  }
25644
25695
  let agentIdFor = () => void 0;
25645
- if (shipRowId) {
25696
+ if (shipRowId || o.ship) {
25646
25697
  try {
25647
25698
  const agentsModel = await get(o, `/data-models/agents?workspaceId=${ws.id}`);
25648
25699
  const agentRows = await get(
@@ -25675,16 +25726,16 @@ async function discover(o) {
25675
25726
  const unclaimed = seatShipId ? rows.filter((r) => !r.ship_id) : [];
25676
25727
  for (const role of ["dev", "design", "qa", "triage"]) {
25677
25728
  const searchTerm = role === "dev" ? "develop" : role;
25678
- let id = seatFor(scoped, searchTerm);
25729
+ let id = seatFor(scoped, searchTerm, agentIdFor(role));
25679
25730
  let seatAction = "matched";
25680
25731
  if (!id && seatShipId && !shipRowId) {
25681
- const legacyId = seatFor(unclaimed, searchTerm);
25732
+ const legacyId = seatFor(unclaimed, searchTerm, agentIdFor(role));
25682
25733
  if (legacyId) {
25683
25734
  id = legacyId;
25684
25735
  seatAction = "claimed";
25685
25736
  }
25686
25737
  } else if (!id && shipRowId) {
25687
- const legacyId = seatFor(unclaimed, searchTerm);
25738
+ const legacyId = seatFor(unclaimed, searchTerm, agentIdFor(role));
25688
25739
  if (legacyId) {
25689
25740
  await patch(o, `/data-models/${out.models.crew}/records/${legacyId}`, { ship_id: shipRowId });
25690
25741
  id = legacyId;
@@ -27421,7 +27472,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
27421
27472
  import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
27422
27473
  import { join as join59 } from "path";
27423
27474
  function builtVersion() {
27424
- return true ? "0.152.3" : null;
27475
+ return true ? "0.153.0" : null;
27425
27476
  }
27426
27477
  var REBUILD_HINT = "rebuild with npm run build";
27427
27478
  function newestMtime(path) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.152.3",
3
+ "version": "0.153.0",
4
4
  "description": "A standing team of headless agents that picks work off a Tablation board, does it on a machine you control, and reports back.",
5
5
  "type": "module",
6
6
  "license": "MIT",