@tablation/crew 0.152.4 → 0.153.1
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 +88 -13
- 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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
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")
|
|
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() {
|
|
@@ -5997,6 +6045,16 @@ function gitOk(cwd, args) {
|
|
|
5997
6045
|
return null;
|
|
5998
6046
|
}
|
|
5999
6047
|
}
|
|
6048
|
+
function probeGit(env = process.env) {
|
|
6049
|
+
try {
|
|
6050
|
+
const out = execFileSync7("git", ["--version"], { encoding: "utf8", env, stdio: ["ignore", "pipe", "pipe"] });
|
|
6051
|
+
return { ok: true, version: out.trim() };
|
|
6052
|
+
} catch (e) {
|
|
6053
|
+
const err3 = e;
|
|
6054
|
+
const why = [err3.stderr, err3.stdout].map(streamText).filter(Boolean).join(" / ");
|
|
6055
|
+
return { ok: false, detail: why || err3.message.trim() };
|
|
6056
|
+
}
|
|
6057
|
+
}
|
|
6000
6058
|
function commitDate(cwd, sha) {
|
|
6001
6059
|
const out = gitOk(cwd, ["show", "-s", "--format=%cI", sha]);
|
|
6002
6060
|
if (!out) return null;
|
|
@@ -14140,7 +14198,7 @@ var RunObserver = class {
|
|
|
14140
14198
|
message: ev.kind === "tool" ? `${ev.tool ?? "tool"}${ev.target ? ` ${ev.target}` : ""}` : ev.kind,
|
|
14141
14199
|
role: plan.role,
|
|
14142
14200
|
...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 } : {} }
|
|
14201
|
+
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
14202
|
};
|
|
14145
14203
|
if (!this.muted) this.eventsSink?.write(`${JSON.stringify(e)}
|
|
14146
14204
|
`);
|
|
@@ -27424,7 +27482,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
|
|
|
27424
27482
|
import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
|
|
27425
27483
|
import { join as join59 } from "path";
|
|
27426
27484
|
function builtVersion() {
|
|
27427
|
-
return true ? "0.
|
|
27485
|
+
return true ? "0.153.1" : null;
|
|
27428
27486
|
}
|
|
27429
27487
|
var REBUILD_HINT = "rebuild with npm run build";
|
|
27430
27488
|
function newestMtime(path) {
|
|
@@ -32842,7 +32900,16 @@ ${f.tail.trimEnd()}
|
|
|
32842
32900
|
break;
|
|
32843
32901
|
}
|
|
32844
32902
|
const target = resolvePath(addPath.replace(/^~(?=\/|$)/, homedir11()));
|
|
32845
|
-
|
|
32903
|
+
if (!existsSync60(target)) throw new ReposError(`${target} does not exist`);
|
|
32904
|
+
let top;
|
|
32905
|
+
try {
|
|
32906
|
+
top = git(target, ["rev-parse", "--show-toplevel"]);
|
|
32907
|
+
} catch (e) {
|
|
32908
|
+
const msg = e.message;
|
|
32909
|
+
if (/not a git repository/i.test(msg)) throw new ReposError(`${target} is not a git checkout`);
|
|
32910
|
+
const line = msg.replace(/^git rev-parse --show-toplevel:\s*/, "").split("\n").find((l) => l.trim()) ?? msg;
|
|
32911
|
+
throw new ReposError(`git failed in ${target}, so it could not be checked: ${line.trim()}`);
|
|
32912
|
+
}
|
|
32846
32913
|
if (!top) throw new ReposError(`${target} is not a git checkout`);
|
|
32847
32914
|
const origin = originOf(top);
|
|
32848
32915
|
const plan = planRepoAdd({
|
|
@@ -35484,6 +35551,10 @@ ${where.join("\n")}`);
|
|
|
35484
35551
|
problems.push(...routePeriscopeProblems({ route: route2.route, hosts: true, repos: settled.map((r) => ({ name: r.name, hasPreviewHook: !!r.config.hooks.preview })), tablePresent, snapshotStale: !!jsonDiff && isStale(jsonDiff) }));
|
|
35485
35552
|
if (!flag("offline")) problems.push(...await duplicateLivePeriscopeProblems(route2, cfg.ship));
|
|
35486
35553
|
}
|
|
35554
|
+
const jsonGit = findOnPath("git", doctorSchedulerPath) ? probeGit({ ...process.env, PATH: doctorSchedulerPath }) : void 0;
|
|
35555
|
+
if (jsonGit && !jsonGit.ok) {
|
|
35556
|
+
problems.push({ severity: "blocker", kind: "git_unrunnable", message: `git failed to run: ${jsonGit.detail}`, remedy: "fix the git on the scheduler PATH (on macOS, install the Xcode command line tools), then re-run `crew doctor`" });
|
|
35557
|
+
}
|
|
35487
35558
|
problems.push(...attentionProblems(openShipAttention(state), problems));
|
|
35488
35559
|
if (problems.some((p) => p.severity === "blocker")) process.exitCode = 1;
|
|
35489
35560
|
process.stdout.write(`${JSON.stringify({ offline: flag("offline"), pushAuth, tools: toolRows, daemon: daemonLiveness, problems, passed }, null, 2)}
|
|
@@ -35896,8 +35967,12 @@ crew manifest: ${seats2.length ? seats2.map((c) => c.name).join(", ") : "non
|
|
|
35896
35967
|
if (cfg.ship.forges) R.line(formatPushAuth("credential helper", probeCredentialHelper(crewCommandLine())).replace("push auth credential helper:", "credential helper:".padEnd(19)));
|
|
35897
35968
|
for (const p of pushAuth) R.line(formatPushAuth(`${p.repo}`, p.result), { repo: p.repo });
|
|
35898
35969
|
for (const t of toolRows) R.line(formatToolCheck(t));
|
|
35899
|
-
|
|
35900
|
-
|
|
35970
|
+
const gitProbe = gitPath ? probeGit({ ...process.env, PATH: schedulerPath }) : void 0;
|
|
35971
|
+
const gitBroken = gitProbe && !gitProbe.ok ? gitProbe.detail : void 0;
|
|
35972
|
+
R.line(
|
|
35973
|
+
`git: ${!gitPath ? "NOT FOUND on the scheduler PATH" : gitBroken !== void 0 ? `FAILED to run (${gitPath}): ${gitBroken}` : `OK (${gitPath})`}
|
|
35974
|
+
`
|
|
35975
|
+
);
|
|
35901
35976
|
if (!allBinsFound || !gitPath) {
|
|
35902
35977
|
R.line(
|
|
35903
35978
|
` scheduler PATH is ${schedulerPath} \u2014 add the directory holding the missing binary to ship.extraPath in crew.yaml, then re-run \`crew doctor\`.
|
package/package.json
CHANGED