@tablation/crew 0.29.0 → 0.30.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.
- package/dist/cli.js +38 -10
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -200,11 +200,11 @@ function extractResult(line) {
|
|
|
200
200
|
return {
|
|
201
201
|
sessionId: obj.session_id,
|
|
202
202
|
numTurns: obj.num_turns,
|
|
203
|
-
|
|
203
|
+
costUsd: obj.total_cost_usd,
|
|
204
204
|
inputTokens: obj.usage?.input_tokens,
|
|
205
205
|
outputTokens: obj.usage?.output_tokens,
|
|
206
206
|
cacheReadTokens: obj.usage?.cache_read_input_tokens,
|
|
207
|
-
|
|
207
|
+
cacheWriteTokens: obj.usage?.cache_creation_input_tokens
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
210
|
|
|
@@ -376,6 +376,7 @@ var claudeAdapter = {
|
|
|
376
376
|
...spec.env
|
|
377
377
|
};
|
|
378
378
|
},
|
|
379
|
+
provider: () => "anthropic",
|
|
379
380
|
unsetEnv: BILLING_VARS_TO_UNSET,
|
|
380
381
|
mapStreamLine,
|
|
381
382
|
extractResult,
|
|
@@ -6131,6 +6132,13 @@ function renderEnvironment(i) {
|
|
|
6131
6132
|
}
|
|
6132
6133
|
|
|
6133
6134
|
// src/agent-log.ts
|
|
6135
|
+
var AgentLogHttpError = class extends Error {
|
|
6136
|
+
status;
|
|
6137
|
+
constructor(message, status2) {
|
|
6138
|
+
super(message);
|
|
6139
|
+
this.status = status2;
|
|
6140
|
+
}
|
|
6141
|
+
};
|
|
6134
6142
|
async function post(target, path, body) {
|
|
6135
6143
|
const url = `${target.baseUrl.replace(/\/+$/, "")}/api/workspaces/${target.workspaceId}${path}`;
|
|
6136
6144
|
const res = await fetch(url, {
|
|
@@ -6143,11 +6151,11 @@ async function post(target, path, body) {
|
|
|
6143
6151
|
},
|
|
6144
6152
|
body: JSON.stringify(body)
|
|
6145
6153
|
});
|
|
6146
|
-
if (!res.ok) throw new
|
|
6154
|
+
if (!res.ok) throw new AgentLogHttpError(`${path}: ${res.status} ${res.statusText}`, res.status);
|
|
6147
6155
|
return await res.json();
|
|
6148
6156
|
}
|
|
6149
6157
|
async function reportAgentRun(target, run2) {
|
|
6150
|
-
const
|
|
6158
|
+
const body = {
|
|
6151
6159
|
agentId: target.agentId,
|
|
6152
6160
|
ticketReference: run2.ticketReference,
|
|
6153
6161
|
outcome: run2.outcome,
|
|
@@ -6163,7 +6171,14 @@ async function reportAgentRun(target, run2) {
|
|
|
6163
6171
|
costUsd: run2.costUsd,
|
|
6164
6172
|
promptVersion: run2.promptVersion,
|
|
6165
6173
|
promptSha: run2.promptSha
|
|
6166
|
-
}
|
|
6174
|
+
};
|
|
6175
|
+
let entry;
|
|
6176
|
+
try {
|
|
6177
|
+
entry = await post(target, "/agents/log", { ...body, harness: run2.harness, provider: run2.provider });
|
|
6178
|
+
} catch (e) {
|
|
6179
|
+
if (!(e instanceof AgentLogHttpError) || e.status !== 400 || !run2.harness && !run2.provider) throw e;
|
|
6180
|
+
entry = await post(target, "/agents/log", body);
|
|
6181
|
+
}
|
|
6167
6182
|
for (const cycle of run2.cycles) {
|
|
6168
6183
|
await post(target, `/agents/log/${entry.id}/cycles`, {
|
|
6169
6184
|
cycleIndex: cycle.cycleIndex,
|
|
@@ -6212,6 +6227,7 @@ var TicketAttributionTracker = class {
|
|
|
6212
6227
|
// src/agent.ts
|
|
6213
6228
|
var DIGEST_MAX_AGE_SECONDS = 600;
|
|
6214
6229
|
var LEGACY_TOOLCHAIN_HARNESS = "claude";
|
|
6230
|
+
var LEGACY_TOOLCHAIN_PROVIDER = "anthropic";
|
|
6215
6231
|
function scrubbedEnv(env = process.env, harness = LEGACY_TOOLCHAIN_HARNESS) {
|
|
6216
6232
|
const out = { ...env };
|
|
6217
6233
|
for (const v of adapterFor(harness).unsetEnv) delete out[v];
|
|
@@ -6288,6 +6304,7 @@ function planAgentRun(o) {
|
|
|
6288
6304
|
args: invocation.args,
|
|
6289
6305
|
toolchain: toolchain.name,
|
|
6290
6306
|
harness: toolchain.harness,
|
|
6307
|
+
provider: adapter.provider(toolchain),
|
|
6291
6308
|
resolution: { toolchain: seat.toolchainWhy, model: seat.modelWhy },
|
|
6292
6309
|
warnings: seat.warnings,
|
|
6293
6310
|
prompt,
|
|
@@ -6440,6 +6457,11 @@ function spawnAgent(plan, emit) {
|
|
|
6440
6457
|
await Promise.all([endSink(rawSink), endSink(eventsSink)]);
|
|
6441
6458
|
if (spawnFailed) return;
|
|
6442
6459
|
const attributedTicket = attribution.winner(plan.ticket);
|
|
6460
|
+
const identity = {
|
|
6461
|
+
toolchain: plan.toolchain ?? LEGACY_TOOLCHAIN_HARNESS,
|
|
6462
|
+
harness: adapter.harness,
|
|
6463
|
+
provider: plan.provider ?? LEGACY_TOOLCHAIN_PROVIDER
|
|
6464
|
+
};
|
|
6443
6465
|
try {
|
|
6444
6466
|
writeFileSync4(`${plan.streamPath}.meta.json`, JSON.stringify({
|
|
6445
6467
|
route: plan.route,
|
|
@@ -6449,9 +6471,10 @@ function spawnAgent(plan, emit) {
|
|
|
6449
6471
|
startedAt,
|
|
6450
6472
|
exitCode: code ?? 1,
|
|
6451
6473
|
model: plan.model,
|
|
6474
|
+
...identity,
|
|
6452
6475
|
sessionId: result?.sessionId ?? null,
|
|
6453
6476
|
numTurns: result?.numTurns ?? null,
|
|
6454
|
-
totalCostUsd: result?.
|
|
6477
|
+
totalCostUsd: result?.costUsd ?? null
|
|
6455
6478
|
}));
|
|
6456
6479
|
} catch {
|
|
6457
6480
|
}
|
|
@@ -6460,9 +6483,10 @@ function spawnAgent(plan, emit) {
|
|
|
6460
6483
|
data: {
|
|
6461
6484
|
ms: ms2,
|
|
6462
6485
|
code: code ?? 1,
|
|
6486
|
+
...identity,
|
|
6463
6487
|
...result?.sessionId ? { sessionId: result.sessionId } : {},
|
|
6464
6488
|
...result?.numTurns !== void 0 ? { numTurns: result.numTurns } : {},
|
|
6465
|
-
...result?.
|
|
6489
|
+
...result?.costUsd !== void 0 ? { totalCostUsd: result.costUsd } : {}
|
|
6466
6490
|
}
|
|
6467
6491
|
});
|
|
6468
6492
|
if (plan.agentLog) {
|
|
@@ -6477,8 +6501,10 @@ function spawnAgent(plan, emit) {
|
|
|
6477
6501
|
tokensIn: result?.inputTokens,
|
|
6478
6502
|
tokensOut: result?.outputTokens,
|
|
6479
6503
|
cacheReadTokens: result?.cacheReadTokens,
|
|
6480
|
-
cacheWriteTokens: result?.
|
|
6481
|
-
costUsd: result?.
|
|
6504
|
+
cacheWriteTokens: result?.cacheWriteTokens,
|
|
6505
|
+
costUsd: result?.costUsd,
|
|
6506
|
+
harness: identity.harness,
|
|
6507
|
+
provider: identity.provider,
|
|
6482
6508
|
promptVersion: plan.promptVersion,
|
|
6483
6509
|
promptSha: plan.promptSha
|
|
6484
6510
|
});
|
|
@@ -12697,7 +12723,7 @@ ${changed2.map((c) => ` - ${c}
|
|
|
12697
12723
|
}
|
|
12698
12724
|
for (const e of entries) {
|
|
12699
12725
|
process.stdout.write(
|
|
12700
|
-
`${e.id} ${e.started_at ?? "?"} ${e.outcome ?? "?"}${e.ticket_reference ? ` ${e.ticket_reference}` : ""}${e.model ? ` ${e.model}` : ""}
|
|
12726
|
+
`${e.id} ${e.started_at ?? "?"} ${e.outcome ?? "?"}${e.ticket_reference ? ` ${e.ticket_reference}` : ""}${e.model ? ` ${e.model}` : ""}${e.harness || e.provider ? ` (${[e.harness, e.provider].filter(Boolean).join(" \xB7 ")})` : ""}
|
|
12701
12727
|
`
|
|
12702
12728
|
);
|
|
12703
12729
|
}
|
|
@@ -12713,6 +12739,8 @@ finished: ${entry.finished_at ?? "?"}
|
|
|
12713
12739
|
outcome: ${entry.outcome ?? "?"}
|
|
12714
12740
|
ticket: ${entry.ticket_reference ?? "(none)"}
|
|
12715
12741
|
model: ${entry.model ?? "?"}
|
|
12742
|
+
harness: ${entry.harness ?? "?"}
|
|
12743
|
+
provider: ${entry.provider ?? "?"}
|
|
12716
12744
|
`
|
|
12717
12745
|
);
|
|
12718
12746
|
if (flag("prompt")) {
|
package/package.json
CHANGED