@tablation/crew 0.149.1 → 0.149.2
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 +32 -40
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6624,12 +6624,13 @@ function repoPlatformUnreleasableItem(repo, detail, nowIso = (/* @__PURE__ */ ne
|
|
|
6624
6624
|
};
|
|
6625
6625
|
}
|
|
6626
6626
|
var agentLogRefusedKey = (route2) => `agent_log_refused:${route2}`;
|
|
6627
|
-
function agentLogRefusedItem(route2, role, status2, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
6627
|
+
function agentLogRefusedItem(route2, role, status2, request2, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
6628
|
+
const what = request2 ? request2.replace(/[0-9a-f]{8}-[0-9a-f-]{27}/gi, (id) => id.slice(0, 8)) : "the report";
|
|
6628
6629
|
return {
|
|
6629
6630
|
kind: "agent_log_refused",
|
|
6630
6631
|
key: agentLogRefusedKey(route2),
|
|
6631
6632
|
since: nowIso,
|
|
6632
|
-
message: `${route2}: the tracker refused
|
|
6633
|
+
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
6634
|
};
|
|
6634
6635
|
}
|
|
6635
6636
|
var workspaceAuthKey = (role) => `workspace_auth:${role}`;
|
|
@@ -11044,9 +11045,12 @@ var AgentLogHttpError = class extends Error {
|
|
|
11044
11045
|
status;
|
|
11045
11046
|
/** 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
11047
|
row = false;
|
|
11047
|
-
|
|
11048
|
+
/** The refused request as "METHOD /path", ids shortened, for the ship attention item (CREW-3273). */
|
|
11049
|
+
request;
|
|
11050
|
+
constructor(message, status2, request2) {
|
|
11048
11051
|
super(message);
|
|
11049
11052
|
this.status = status2;
|
|
11053
|
+
this.request = request2;
|
|
11050
11054
|
}
|
|
11051
11055
|
};
|
|
11052
11056
|
async function request(target, method, path, body) {
|
|
@@ -11060,7 +11064,7 @@ async function request(target, method, path, body) {
|
|
|
11060
11064
|
},
|
|
11061
11065
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
11062
11066
|
});
|
|
11063
|
-
if (!res.ok) throw new AgentLogHttpError(`${path}: ${res.status} ${res.statusText}`, res.status);
|
|
11067
|
+
if (!res.ok) throw new AgentLogHttpError(`${path}: ${res.status} ${res.statusText}`, res.status, `${method} ${path}`);
|
|
11064
11068
|
return await res.json();
|
|
11065
11069
|
}
|
|
11066
11070
|
var issueColumns = /* @__PURE__ */ new Map();
|
|
@@ -11134,7 +11138,6 @@ async function writeBeforeFirstEdit(target, rowId, b) {
|
|
|
11134
11138
|
} catch {
|
|
11135
11139
|
}
|
|
11136
11140
|
}
|
|
11137
|
-
var HANDOFF_BOUNCES_COLUMN = "handoff_bounces";
|
|
11138
11141
|
async function countAcceptanceBounces(target, issuesModelId, ticketRecordId) {
|
|
11139
11142
|
try {
|
|
11140
11143
|
const filters = encodeURIComponent(JSON.stringify([{ columnName: "event_type", operator: "EQ", value: "bounced" }]));
|
|
@@ -11150,13 +11153,7 @@ async function countAcceptanceBounces(target, issuesModelId, ticketRecordId) {
|
|
|
11150
11153
|
}
|
|
11151
11154
|
async function writeHandoffBounces(target, rowId, count) {
|
|
11152
11155
|
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 });
|
|
11156
|
+
await send(target, "PATCH", `/agents/log/${rowId}`, { handoffBounces: count });
|
|
11160
11157
|
} catch {
|
|
11161
11158
|
}
|
|
11162
11159
|
}
|
|
@@ -11175,14 +11172,23 @@ async function send(target, method, path, body) {
|
|
|
11175
11172
|
},
|
|
11176
11173
|
body: JSON.stringify(body)
|
|
11177
11174
|
});
|
|
11178
|
-
if (!res.ok) throw new AgentLogHttpError(`${path}: ${res.status} ${res.statusText}`, res.status);
|
|
11175
|
+
if (!res.ok) throw new AgentLogHttpError(`${path}: ${res.status} ${res.statusText}`, res.status, `${method} ${path}`);
|
|
11179
11176
|
return await res.json();
|
|
11180
11177
|
}
|
|
11181
11178
|
async function startAgentRunRow(target, s) {
|
|
11182
11179
|
if (!target.actor && !s.runId) return void 0;
|
|
11180
|
+
let workItem = {};
|
|
11181
|
+
if (target.tickets && s.ticketReference) {
|
|
11182
|
+
try {
|
|
11183
|
+
const recordId = await findTicketRecord(target, target.tickets, s.ticketReference);
|
|
11184
|
+
if (recordId) workItem = { workItemTable: target.tickets.issuesModelId, workItemRecordId: recordId };
|
|
11185
|
+
} catch {
|
|
11186
|
+
}
|
|
11187
|
+
}
|
|
11183
11188
|
const body = {
|
|
11184
11189
|
agentId: target.agentId,
|
|
11185
11190
|
ticketReference: s.ticketReference,
|
|
11191
|
+
...workItem,
|
|
11186
11192
|
startedAt: s.startedAt,
|
|
11187
11193
|
source: "client",
|
|
11188
11194
|
client: "crew",
|
|
@@ -11217,38 +11223,24 @@ async function startAgentRunRow(target, s) {
|
|
|
11217
11223
|
return void 0;
|
|
11218
11224
|
}
|
|
11219
11225
|
}
|
|
11220
|
-
function finishedRowBody(run4
|
|
11226
|
+
function finishedRowBody(run4) {
|
|
11221
11227
|
const values = {
|
|
11222
|
-
ticket_reference: run4.ticketReference,
|
|
11223
11228
|
outcome: run4.outcome,
|
|
11224
|
-
|
|
11229
|
+
finishedAt: run4.finishedAt,
|
|
11225
11230
|
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
|
|
11231
|
+
tokensIn: run4.tokensIn,
|
|
11232
|
+
tokensOut: run4.tokensOut,
|
|
11233
|
+
cacheReadTokens: run4.cacheReadTokens,
|
|
11234
|
+
cacheWriteTokens: run4.cacheWriteTokens,
|
|
11235
|
+
costUsd: run4.costUsd,
|
|
11236
|
+
numTurns: run4.numTurns,
|
|
11237
|
+
prefixTokens: run4.prefixTokens
|
|
11239
11238
|
};
|
|
11240
11239
|
return Object.fromEntries(Object.entries(values).filter(([, v]) => v !== void 0));
|
|
11241
11240
|
}
|
|
11242
11241
|
async function updateStartedRow(target, rowId, body) {
|
|
11243
11242
|
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);
|
|
11243
|
+
await send(target, "PATCH", `/agents/log/${rowId}`, body);
|
|
11252
11244
|
return true;
|
|
11253
11245
|
} catch (e) {
|
|
11254
11246
|
if (!(e instanceof AgentLogHttpError)) throw new AgentLogUnreachableError(e.message);
|
|
@@ -11439,7 +11431,7 @@ async function reportAgentRun(target, run4) {
|
|
|
11439
11431
|
const { runId, ...legacyBody } = { ...body, runId: run4.runId };
|
|
11440
11432
|
const workItem = target.tickets && ticketRecordId ? { workItemTable: target.tickets.issuesModelId, workItemRecordId: ticketRecordId } : {};
|
|
11441
11433
|
let entry;
|
|
11442
|
-
if (run4.rowId && await updateStartedRow(target, run4.rowId, finishedRowBody(run4
|
|
11434
|
+
if (run4.rowId && await updateStartedRow(target, run4.rowId, finishedRowBody(run4))) entry = { id: run4.rowId };
|
|
11443
11435
|
if (!entry) {
|
|
11444
11436
|
try {
|
|
11445
11437
|
entry = await post(target, "/agents/log", { ...body, ...runId ? { runId } : {}, ...workItem, harness: run4.harness, provider: run4.provider });
|
|
@@ -14183,7 +14175,7 @@ async function finishRun(id, obs, emit, startedAt, end, agentLogKey, hintMoved)
|
|
|
14183
14175
|
try {
|
|
14184
14176
|
await raiseShipAttention(
|
|
14185
14177
|
{ state: new State(stateDirOfStream(id.streamPath)), emit },
|
|
14186
|
-
agentLogRefusedItem(id.route, id.role, e.status)
|
|
14178
|
+
agentLogRefusedItem(id.route, id.role, e.status, e.request)
|
|
14187
14179
|
);
|
|
14188
14180
|
} catch {
|
|
14189
14181
|
}
|
|
@@ -26802,7 +26794,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
|
|
|
26802
26794
|
import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
|
|
26803
26795
|
import { join as join58 } from "path";
|
|
26804
26796
|
function builtVersion() {
|
|
26805
|
-
return true ? "0.149.
|
|
26797
|
+
return true ? "0.149.2" : null;
|
|
26806
26798
|
}
|
|
26807
26799
|
var REBUILD_HINT = "rebuild with npm run build";
|
|
26808
26800
|
function newestMtime(path) {
|
package/package.json
CHANGED