@tablation/crew 0.149.1 → 0.149.3
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 +48 -45
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5303,6 +5303,13 @@ import { createHash as createHash3 } from "crypto";
|
|
|
5303
5303
|
function isCompiledBinary(moduleUrl) {
|
|
5304
5304
|
return moduleUrl.includes("$bunfs");
|
|
5305
5305
|
}
|
|
5306
|
+
function selfLaunch(env = currentLaunchEnv()) {
|
|
5307
|
+
if (env.compiled) return { command: env.execPath, args: [] };
|
|
5308
|
+
return { command: env.execPath, args: [...env.execArgv, env.argv1 ?? "crew"] };
|
|
5309
|
+
}
|
|
5310
|
+
function currentLaunchEnv() {
|
|
5311
|
+
return { compiled: isCompiledBinary(import.meta.url), execPath: process.execPath, execArgv: process.execArgv, argv1: process.argv[1] };
|
|
5312
|
+
}
|
|
5306
5313
|
|
|
5307
5314
|
// src/install.ts
|
|
5308
5315
|
function crewInvocation(crewHome) {
|
|
@@ -6624,12 +6631,13 @@ function repoPlatformUnreleasableItem(repo, detail, nowIso = (/* @__PURE__ */ ne
|
|
|
6624
6631
|
};
|
|
6625
6632
|
}
|
|
6626
6633
|
var agentLogRefusedKey = (route2) => `agent_log_refused:${route2}`;
|
|
6627
|
-
function agentLogRefusedItem(route2, role, status2, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
6634
|
+
function agentLogRefusedItem(route2, role, status2, request2, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
6635
|
+
const what = request2 ? request2.replace(/[0-9a-f]{8}-[0-9a-f-]{27}/gi, (id) => id.slice(0, 8)) : "the report";
|
|
6628
6636
|
return {
|
|
6629
6637
|
kind: "agent_log_refused",
|
|
6630
6638
|
key: agentLogRefusedKey(route2),
|
|
6631
6639
|
since: nowIso,
|
|
6632
|
-
message: `${route2}: the tracker refused
|
|
6640
|
+
message: `${route2}: the tracker refused ${what} (${status2}) for the ${role} seat \u2014 runs and ticket spend are not being recorded; update crew if a newer version exists, otherwise report this`
|
|
6633
6641
|
};
|
|
6634
6642
|
}
|
|
6635
6643
|
var workspaceAuthKey = (role) => `workspace_auth:${role}`;
|
|
@@ -11044,9 +11052,12 @@ var AgentLogHttpError = class extends Error {
|
|
|
11044
11052
|
status;
|
|
11045
11053
|
/** True when the refusal was of the Agent Log row itself (not a later cycle post): the tracker is not taking this seat's reports (CREW-2832). */
|
|
11046
11054
|
row = false;
|
|
11047
|
-
|
|
11055
|
+
/** The refused request as "METHOD /path", ids shortened, for the ship attention item (CREW-3273). */
|
|
11056
|
+
request;
|
|
11057
|
+
constructor(message, status2, request2) {
|
|
11048
11058
|
super(message);
|
|
11049
11059
|
this.status = status2;
|
|
11060
|
+
this.request = request2;
|
|
11050
11061
|
}
|
|
11051
11062
|
};
|
|
11052
11063
|
async function request(target, method, path, body) {
|
|
@@ -11060,7 +11071,7 @@ async function request(target, method, path, body) {
|
|
|
11060
11071
|
},
|
|
11061
11072
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
11062
11073
|
});
|
|
11063
|
-
if (!res.ok) throw new AgentLogHttpError(`${path}: ${res.status} ${res.statusText}`, res.status);
|
|
11074
|
+
if (!res.ok) throw new AgentLogHttpError(`${path}: ${res.status} ${res.statusText}`, res.status, `${method} ${path}`);
|
|
11064
11075
|
return await res.json();
|
|
11065
11076
|
}
|
|
11066
11077
|
var issueColumns = /* @__PURE__ */ new Map();
|
|
@@ -11134,7 +11145,6 @@ async function writeBeforeFirstEdit(target, rowId, b) {
|
|
|
11134
11145
|
} catch {
|
|
11135
11146
|
}
|
|
11136
11147
|
}
|
|
11137
|
-
var HANDOFF_BOUNCES_COLUMN = "handoff_bounces";
|
|
11138
11148
|
async function countAcceptanceBounces(target, issuesModelId, ticketRecordId) {
|
|
11139
11149
|
try {
|
|
11140
11150
|
const filters = encodeURIComponent(JSON.stringify([{ columnName: "event_type", operator: "EQ", value: "bounced" }]));
|
|
@@ -11150,13 +11160,7 @@ async function countAcceptanceBounces(target, issuesModelId, ticketRecordId) {
|
|
|
11150
11160
|
}
|
|
11151
11161
|
async function writeHandoffBounces(target, rowId, count) {
|
|
11152
11162
|
try {
|
|
11153
|
-
|
|
11154
|
-
target,
|
|
11155
|
-
"GET",
|
|
11156
|
-
`/data-models/agent_log?workspaceId=${encodeURIComponent(target.workspaceId)}`
|
|
11157
|
-
);
|
|
11158
|
-
if (!(await columnsOf(target, model.id)).has(HANDOFF_BOUNCES_COLUMN)) return;
|
|
11159
|
-
await request(target, "PATCH", `/data-models/${model.id}/records/${rowId}`, { [HANDOFF_BOUNCES_COLUMN]: count });
|
|
11163
|
+
await send(target, "PATCH", `/agents/log/${rowId}`, { handoffBounces: count });
|
|
11160
11164
|
} catch {
|
|
11161
11165
|
}
|
|
11162
11166
|
}
|
|
@@ -11175,14 +11179,23 @@ async function send(target, method, path, body) {
|
|
|
11175
11179
|
},
|
|
11176
11180
|
body: JSON.stringify(body)
|
|
11177
11181
|
});
|
|
11178
|
-
if (!res.ok) throw new AgentLogHttpError(`${path}: ${res.status} ${res.statusText}`, res.status);
|
|
11182
|
+
if (!res.ok) throw new AgentLogHttpError(`${path}: ${res.status} ${res.statusText}`, res.status, `${method} ${path}`);
|
|
11179
11183
|
return await res.json();
|
|
11180
11184
|
}
|
|
11181
11185
|
async function startAgentRunRow(target, s) {
|
|
11182
11186
|
if (!target.actor && !s.runId) return void 0;
|
|
11187
|
+
let workItem = {};
|
|
11188
|
+
if (target.tickets && s.ticketReference) {
|
|
11189
|
+
try {
|
|
11190
|
+
const recordId = await findTicketRecord(target, target.tickets, s.ticketReference);
|
|
11191
|
+
if (recordId) workItem = { workItemTable: target.tickets.issuesModelId, workItemRecordId: recordId };
|
|
11192
|
+
} catch {
|
|
11193
|
+
}
|
|
11194
|
+
}
|
|
11183
11195
|
const body = {
|
|
11184
11196
|
agentId: target.agentId,
|
|
11185
11197
|
ticketReference: s.ticketReference,
|
|
11198
|
+
...workItem,
|
|
11186
11199
|
startedAt: s.startedAt,
|
|
11187
11200
|
source: "client",
|
|
11188
11201
|
client: "crew",
|
|
@@ -11217,38 +11230,24 @@ async function startAgentRunRow(target, s) {
|
|
|
11217
11230
|
return void 0;
|
|
11218
11231
|
}
|
|
11219
11232
|
}
|
|
11220
|
-
function finishedRowBody(run4
|
|
11233
|
+
function finishedRowBody(run4) {
|
|
11221
11234
|
const values = {
|
|
11222
|
-
ticket_reference: run4.ticketReference,
|
|
11223
11235
|
outcome: run4.outcome,
|
|
11224
|
-
|
|
11236
|
+
finishedAt: run4.finishedAt,
|
|
11225
11237
|
model: run4.model,
|
|
11226
|
-
|
|
11227
|
-
|
|
11228
|
-
|
|
11229
|
-
|
|
11230
|
-
|
|
11231
|
-
|
|
11232
|
-
|
|
11233
|
-
prompt_version: run4.promptVersion,
|
|
11234
|
-
prompt_sha: run4.promptSha,
|
|
11235
|
-
harness: run4.harness,
|
|
11236
|
-
provider: run4.provider,
|
|
11237
|
-
work_item_table: workItem.workItemTable,
|
|
11238
|
-
work_item_record_id: workItem.workItemRecordId
|
|
11238
|
+
tokensIn: run4.tokensIn,
|
|
11239
|
+
tokensOut: run4.tokensOut,
|
|
11240
|
+
cacheReadTokens: run4.cacheReadTokens,
|
|
11241
|
+
cacheWriteTokens: run4.cacheWriteTokens,
|
|
11242
|
+
costUsd: run4.costUsd,
|
|
11243
|
+
numTurns: run4.numTurns,
|
|
11244
|
+
prefixTokens: run4.prefixTokens
|
|
11239
11245
|
};
|
|
11240
11246
|
return Object.fromEntries(Object.entries(values).filter(([, v]) => v !== void 0));
|
|
11241
11247
|
}
|
|
11242
11248
|
async function updateStartedRow(target, rowId, body) {
|
|
11243
11249
|
try {
|
|
11244
|
-
|
|
11245
|
-
target,
|
|
11246
|
-
"GET",
|
|
11247
|
-
`/data-models/agent_log?workspaceId=${encodeURIComponent(target.workspaceId)}`
|
|
11248
|
-
);
|
|
11249
|
-
const have = await columnsOf(target, model.id);
|
|
11250
|
-
const values = Object.fromEntries(Object.entries(body).filter(([column]) => have.has(column)));
|
|
11251
|
-
await request(target, "PATCH", `/data-models/${model.id}/records/${rowId}`, values);
|
|
11250
|
+
await send(target, "PATCH", `/agents/log/${rowId}`, body);
|
|
11252
11251
|
return true;
|
|
11253
11252
|
} catch (e) {
|
|
11254
11253
|
if (!(e instanceof AgentLogHttpError)) throw new AgentLogUnreachableError(e.message);
|
|
@@ -11439,7 +11438,7 @@ async function reportAgentRun(target, run4) {
|
|
|
11439
11438
|
const { runId, ...legacyBody } = { ...body, runId: run4.runId };
|
|
11440
11439
|
const workItem = target.tickets && ticketRecordId ? { workItemTable: target.tickets.issuesModelId, workItemRecordId: ticketRecordId } : {};
|
|
11441
11440
|
let entry;
|
|
11442
|
-
if (run4.rowId && await updateStartedRow(target, run4.rowId, finishedRowBody(run4
|
|
11441
|
+
if (run4.rowId && await updateStartedRow(target, run4.rowId, finishedRowBody(run4))) entry = { id: run4.rowId };
|
|
11443
11442
|
if (!entry) {
|
|
11444
11443
|
try {
|
|
11445
11444
|
entry = await post(target, "/agents/log", { ...body, ...runId ? { runId } : {}, ...workItem, harness: run4.harness, provider: run4.provider });
|
|
@@ -13538,6 +13537,7 @@ function codeBridgeFor(o, harness) {
|
|
|
13538
13537
|
}
|
|
13539
13538
|
if (!wantsCodeBridge(intel)) return void 0;
|
|
13540
13539
|
const sandbox = o.ship.runner === "sandbox";
|
|
13540
|
+
const self = selfLaunch();
|
|
13541
13541
|
const args = sandbox ? [
|
|
13542
13542
|
SANDBOX_BRIDGE_PATH,
|
|
13543
13543
|
"--attach-file",
|
|
@@ -13551,8 +13551,8 @@ function codeBridgeFor(o, harness) {
|
|
|
13551
13551
|
"--ticket",
|
|
13552
13552
|
number,
|
|
13553
13553
|
...seed ? ["--seed-cache", seed] : []
|
|
13554
|
-
] : [...
|
|
13555
|
-
const bridge = { command: sandbox ? "node" :
|
|
13554
|
+
] : [...self.args, "intel", "bridge", o.route.route, number, "--state-dir", o.stateDir];
|
|
13555
|
+
const bridge = { command: sandbox ? "node" : self.command, args };
|
|
13556
13556
|
if (harness === "gemini") {
|
|
13557
13557
|
const text2 = `${JSON.stringify({ mcpServers: { [INTEL_SERVER_NAME]: { command: bridge.command, args } } }, null, 2)}
|
|
13558
13558
|
`;
|
|
@@ -14183,7 +14183,7 @@ async function finishRun(id, obs, emit, startedAt, end, agentLogKey, hintMoved)
|
|
|
14183
14183
|
try {
|
|
14184
14184
|
await raiseShipAttention(
|
|
14185
14185
|
{ state: new State(stateDirOfStream(id.streamPath)), emit },
|
|
14186
|
-
agentLogRefusedItem(id.route, id.role, e.status)
|
|
14186
|
+
agentLogRefusedItem(id.route, id.role, e.status, e.request)
|
|
14187
14187
|
);
|
|
14188
14188
|
} catch {
|
|
14189
14189
|
}
|
|
@@ -26802,7 +26802,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
|
|
|
26802
26802
|
import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
|
|
26803
26803
|
import { join as join58 } from "path";
|
|
26804
26804
|
function builtVersion() {
|
|
26805
|
-
return true ? "0.149.
|
|
26805
|
+
return true ? "0.149.3" : null;
|
|
26806
26806
|
}
|
|
26807
26807
|
var REBUILD_HINT = "rebuild with npm run build";
|
|
26808
26808
|
function newestMtime(path) {
|
|
@@ -27146,7 +27146,8 @@ function syncPassengerSyncDaemons(plans, cfg, stateDir, deps = {}) {
|
|
|
27146
27146
|
}
|
|
27147
27147
|
const secret = existing && existing.mountsHash === plan.mountsHash ? existing.secret : generateSyncSecret();
|
|
27148
27148
|
const targets = passengerCheckoutSyncSpecs(cfg, plan.workspaceId);
|
|
27149
|
-
const
|
|
27149
|
+
const self = selfLaunch();
|
|
27150
|
+
const child = spawnFn(self.command, [...self.args, "passenger-sync-daemon"], {
|
|
27150
27151
|
...process.env,
|
|
27151
27152
|
PASSENGER_SYNC_PORT: String(port),
|
|
27152
27153
|
PASSENGER_SYNC_SECRET: secret,
|
|
@@ -27828,7 +27829,8 @@ async function handlePeriscopes(h, q2) {
|
|
|
27828
27829
|
}
|
|
27829
27830
|
function runCrew(args, onLine, timeoutMs = 20 * 6e4) {
|
|
27830
27831
|
return new Promise((resolve8) => {
|
|
27831
|
-
const
|
|
27832
|
+
const self = selfLaunch();
|
|
27833
|
+
const child = spawn11(self.command, [...self.args, ...args], { stdio: ["ignore", "pipe", "pipe"] });
|
|
27832
27834
|
let stdout = "";
|
|
27833
27835
|
let stderr = "";
|
|
27834
27836
|
let pending = "";
|
|
@@ -28341,7 +28343,8 @@ function schedulerHandler(control, run4 = runDetached) {
|
|
|
28341
28343
|
}
|
|
28342
28344
|
function crewJson(args, timeoutMs = 6e4) {
|
|
28343
28345
|
return new Promise((resolve8) => {
|
|
28344
|
-
|
|
28346
|
+
const self = selfLaunch();
|
|
28347
|
+
execFile6(self.command, [...self.args, ...args], { timeout: timeoutMs, maxBuffer: 16 * 1024 * 1024 }, (_e, stdout) => {
|
|
28345
28348
|
try {
|
|
28346
28349
|
const v = JSON.parse(String(stdout));
|
|
28347
28350
|
resolve8(v && typeof v === "object" && !Array.isArray(v) ? v : null);
|
package/package.json
CHANGED