@integrity-labs/agt-cli 0.27.165 → 0.27.166
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/bin/agt.js
CHANGED
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
success,
|
|
34
34
|
table,
|
|
35
35
|
warn
|
|
36
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-DMZQM4DY.js";
|
|
37
37
|
import {
|
|
38
38
|
CHANNEL_REGISTRY,
|
|
39
39
|
DEPLOYMENT_TEMPLATES,
|
|
@@ -5019,7 +5019,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
5019
5019
|
import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
|
|
5020
5020
|
import chalk18 from "chalk";
|
|
5021
5021
|
import ora16 from "ora";
|
|
5022
|
-
var cliVersion = true ? "0.27.
|
|
5022
|
+
var cliVersion = true ? "0.27.166" : "dev";
|
|
5023
5023
|
async function fetchLatestVersion() {
|
|
5024
5024
|
const host2 = getHost();
|
|
5025
5025
|
if (!host2) return null;
|
|
@@ -5942,7 +5942,7 @@ function handleError(err) {
|
|
|
5942
5942
|
}
|
|
5943
5943
|
|
|
5944
5944
|
// src/bin/agt.ts
|
|
5945
|
-
var cliVersion2 = true ? "0.27.
|
|
5945
|
+
var cliVersion2 = true ? "0.27.166" : "dev";
|
|
5946
5946
|
var program = new Command();
|
|
5947
5947
|
program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
|
|
5948
5948
|
program.hook("preAction", async (thisCommand, actionCommand) => {
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
provisionStopHook,
|
|
23
23
|
requireHost,
|
|
24
24
|
safeWriteJsonAtomic
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-DMZQM4DY.js";
|
|
26
26
|
import {
|
|
27
27
|
getProjectDir as getProjectDir2,
|
|
28
28
|
getReadyTasks,
|
|
@@ -2038,16 +2038,20 @@ function enumerateTranscriptFiles(transcriptDir, nowMs, minMtimeMs = nowMs - TRA
|
|
|
2038
2038
|
}
|
|
2039
2039
|
return out;
|
|
2040
2040
|
}
|
|
2041
|
-
function
|
|
2042
|
-
const
|
|
2041
|
+
function sumWindowedUsageByModelAcrossContents(contents, startMs, endMs) {
|
|
2042
|
+
const byModel = /* @__PURE__ */ new Map();
|
|
2043
2043
|
for (const content of contents) {
|
|
2044
2044
|
const r = sumTranscriptUsageInWindow(content, startMs, endMs);
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2045
|
+
for (const [model, t] of r.byModel) {
|
|
2046
|
+
const acc = byModel.get(model) ?? emptyTotals();
|
|
2047
|
+
acc.inputTokens += t.inputTokens;
|
|
2048
|
+
acc.outputTokens += t.outputTokens;
|
|
2049
|
+
acc.cacheCreationTokens += t.cacheCreationTokens;
|
|
2050
|
+
acc.cacheReadTokens += t.cacheReadTokens;
|
|
2051
|
+
byModel.set(model, acc);
|
|
2052
|
+
}
|
|
2049
2053
|
}
|
|
2050
|
-
return
|
|
2054
|
+
return byModel;
|
|
2051
2055
|
}
|
|
2052
2056
|
async function maybeReconcileWorkflowRunTokens(args) {
|
|
2053
2057
|
const { api: api2, codeName, agentId, log: log2 } = args;
|
|
@@ -2084,13 +2088,29 @@ async function maybeReconcileWorkflowRunTokens(args) {
|
|
|
2084
2088
|
const startMs = new Date(run.started_at).getTime();
|
|
2085
2089
|
const endMs = new Date(run.finished_at).getTime();
|
|
2086
2090
|
if (!Number.isFinite(startMs) || !Number.isFinite(endMs) || endMs < startMs) continue;
|
|
2087
|
-
const
|
|
2091
|
+
const byModel = sumWindowedUsageByModelAcrossContents(contents, startMs, endMs);
|
|
2092
|
+
const totals = emptyTotals();
|
|
2093
|
+
const byModelPayload = [];
|
|
2094
|
+
for (const [model, t] of byModel) {
|
|
2095
|
+
totals.inputTokens += t.inputTokens;
|
|
2096
|
+
totals.outputTokens += t.outputTokens;
|
|
2097
|
+
totals.cacheCreationTokens += t.cacheCreationTokens;
|
|
2098
|
+
totals.cacheReadTokens += t.cacheReadTokens;
|
|
2099
|
+
byModelPayload.push({
|
|
2100
|
+
model,
|
|
2101
|
+
input_tokens: t.inputTokens,
|
|
2102
|
+
output_tokens: t.outputTokens,
|
|
2103
|
+
cache_creation_tokens: t.cacheCreationTokens,
|
|
2104
|
+
cache_read_tokens: t.cacheReadTokens
|
|
2105
|
+
});
|
|
2106
|
+
}
|
|
2088
2107
|
try {
|
|
2089
2108
|
await api2.post(`/host/workflow-runs/${run.id}/reconcile-tokens`, {
|
|
2090
2109
|
total_input_tokens: totals.inputTokens,
|
|
2091
2110
|
total_output_tokens: totals.outputTokens,
|
|
2092
2111
|
total_cache_creation_tokens: totals.cacheCreationTokens,
|
|
2093
|
-
total_cache_read_tokens: totals.cacheReadTokens
|
|
2112
|
+
total_cache_read_tokens: totals.cacheReadTokens,
|
|
2113
|
+
by_model: byModelPayload
|
|
2094
2114
|
});
|
|
2095
2115
|
reconciled++;
|
|
2096
2116
|
} catch (err) {
|
|
@@ -5021,7 +5041,7 @@ var cachedMaintenanceWindow = null;
|
|
|
5021
5041
|
var lastVersionCheckAt = 0;
|
|
5022
5042
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
5023
5043
|
var lastResponsivenessProbeAt = 0;
|
|
5024
|
-
var agtCliVersion = true ? "0.27.
|
|
5044
|
+
var agtCliVersion = true ? "0.27.166" : "dev";
|
|
5025
5045
|
function resolveBrewPath(execFileSync4) {
|
|
5026
5046
|
try {
|
|
5027
5047
|
const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
|