@integrity-labs/agt-cli 0.28.866 → 0.28.867

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
@@ -40,12 +40,12 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-52JZN5RZ.js";
43
+ } from "../chunk-QNNFNPTJ.js";
44
44
  import {
45
45
  getProjectDir,
46
46
  isSessionResumeDisabled,
47
47
  readDirectChatSessionState
48
- } from "../chunk-AFOW32B6.js";
48
+ } from "../chunk-XHVKILCG.js";
49
49
  import {
50
50
  AnchorSessionClient,
51
51
  CHANNEL_REGISTRY,
@@ -79,7 +79,7 @@ import {
79
79
  serializeManifestForSlackCli,
80
80
  sessionFileExists,
81
81
  sessionTranscriptDir
82
- } from "../chunk-ULLOPIPI.js";
82
+ } from "../chunk-VCPESUZV.js";
83
83
  import "../chunk-XWVM4KPK.js";
84
84
 
85
85
  // src/bin/agt.ts
@@ -5467,7 +5467,7 @@ import { execFileSync, execSync } from "child_process";
5467
5467
  import { existsSync as existsSync11, realpathSync as realpathSync2 } from "fs";
5468
5468
  import chalk18 from "chalk";
5469
5469
  import ora16 from "ora";
5470
- var cliVersion = true ? "0.28.866" : "dev";
5470
+ var cliVersion = true ? "0.28.867" : "dev";
5471
5471
  async function fetchLatestVersion() {
5472
5472
  const host2 = getHost();
5473
5473
  if (!host2) return null;
@@ -6658,7 +6658,7 @@ function handleError(err) {
6658
6658
  }
6659
6659
 
6660
6660
  // src/bin/agt.ts
6661
- var cliVersion2 = true ? "0.28.866" : "dev";
6661
+ var cliVersion2 = true ? "0.28.867" : "dev";
6662
6662
  var program = new Command();
6663
6663
  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");
6664
6664
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -16,7 +16,7 @@ import {
16
16
  parseEnvIntegrations,
17
17
  shellQuote,
18
18
  summarizeUnanswerablePane
19
- } from "./chunk-AFOW32B6.js";
19
+ } from "./chunk-XHVKILCG.js";
20
20
  import {
21
21
  BIND_FAILURE_QUARANTINE_THRESHOLD,
22
22
  INTEGRATIONS_SECTION_END,
@@ -76,7 +76,7 @@ import {
76
76
  sessionTranscriptDir,
77
77
  worseConnectivityOutcome,
78
78
  wrapScheduledTaskPrompt
79
- } from "./chunk-ULLOPIPI.js";
79
+ } from "./chunk-VCPESUZV.js";
80
80
  import {
81
81
  parsePsRows
82
82
  } from "./chunk-XWVM4KPK.js";
@@ -6728,7 +6728,7 @@ function exchangeFailureKind(err) {
6728
6728
  }
6729
6729
 
6730
6730
  // src/lib/api-client.ts
6731
- var agtCliVersion = true ? "0.28.866" : "dev";
6731
+ var agtCliVersion = true ? "0.28.867" : "dev";
6732
6732
  var lastConfigHash = null;
6733
6733
  function setConfigHash(hash) {
6734
6734
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -11338,4 +11338,4 @@ export {
11338
11338
  managerInstallSystemUnitCommand,
11339
11339
  managerUninstallSystemUnitCommand
11340
11340
  };
11341
- //# sourceMappingURL=chunk-52JZN5RZ.js.map
11341
+ //# sourceMappingURL=chunk-QNNFNPTJ.js.map
@@ -12803,6 +12803,30 @@ function nonNegInt(value) {
12803
12803
  function emptyTotals() {
12804
12804
  return { inputTokens: 0, outputTokens: 0, cacheCreationTokens: 0, cacheReadTokens: 0 };
12805
12805
  }
12806
+ function readUsageTotals(u) {
12807
+ return {
12808
+ inputTokens: nonNegInt(u.input_tokens),
12809
+ outputTokens: nonNegInt(u.output_tokens),
12810
+ cacheCreationTokens: nonNegInt(u.cache_creation_input_tokens),
12811
+ cacheReadTokens: nonNegInt(u.cache_read_input_tokens)
12812
+ };
12813
+ }
12814
+ function usageContributions(msg, u) {
12815
+ const model = typeof msg.model === "string" && msg.model ? msg.model : "unknown";
12816
+ const out = [{ model, totals: readUsageTotals(u) }];
12817
+ const iterations = u.iterations;
12818
+ if (Array.isArray(iterations)) {
12819
+ for (const it of iterations) {
12820
+ if (typeof it !== "object" || it === null)
12821
+ continue;
12822
+ const iter = it;
12823
+ if (typeof iter.model !== "string" || !iter.model)
12824
+ continue;
12825
+ out.push({ model: iter.model, totals: readUsageTotals(iter) });
12826
+ }
12827
+ }
12828
+ return out;
12829
+ }
12806
12830
  function parseTranscriptUsage(jsonl) {
12807
12831
  const byId = /* @__PURE__ */ new Map();
12808
12832
  let sessionStartedAt = null;
@@ -12832,18 +12856,8 @@ function parseTranscriptUsage(jsonl) {
12832
12856
  if (typeof usage !== "object" || usage === null)
12833
12857
  continue;
12834
12858
  const u = usage;
12835
- const model = typeof msg.model === "string" && msg.model ? msg.model : "unknown";
12836
- const entry = {
12837
- model,
12838
- totals: {
12839
- inputTokens: nonNegInt(u.input_tokens),
12840
- outputTokens: nonNegInt(u.output_tokens),
12841
- cacheCreationTokens: nonNegInt(u.cache_creation_input_tokens),
12842
- cacheReadTokens: nonNegInt(u.cache_read_input_tokens)
12843
- }
12844
- };
12845
12859
  const id = typeof msg.id === "string" && msg.id ? msg.id : `__noid_${syntheticCounter++}`;
12846
- byId.set(id, entry);
12860
+ byId.set(id, usageContributions(msg, u));
12847
12861
  const ts = record.timestamp;
12848
12862
  if (typeof ts === "string" && ts) {
12849
12863
  if (sessionStartedAt === null || ts < sessionStartedAt)
@@ -12853,13 +12867,15 @@ function parseTranscriptUsage(jsonl) {
12853
12867
  }
12854
12868
  }
12855
12869
  const byModel = /* @__PURE__ */ new Map();
12856
- for (const { model, totals } of byId.values()) {
12857
- const acc = byModel.get(model) ?? emptyTotals();
12858
- acc.inputTokens += totals.inputTokens;
12859
- acc.outputTokens += totals.outputTokens;
12860
- acc.cacheCreationTokens += totals.cacheCreationTokens;
12861
- acc.cacheReadTokens += totals.cacheReadTokens;
12862
- byModel.set(model, acc);
12870
+ for (const contributions of byId.values()) {
12871
+ for (const { model, totals } of contributions) {
12872
+ const acc = byModel.get(model) ?? emptyTotals();
12873
+ acc.inputTokens += totals.inputTokens;
12874
+ acc.outputTokens += totals.outputTokens;
12875
+ acc.cacheCreationTokens += totals.cacheCreationTokens;
12876
+ acc.cacheReadTokens += totals.cacheReadTokens;
12877
+ byModel.set(model, acc);
12878
+ }
12863
12879
  }
12864
12880
  return {
12865
12881
  byModel,
@@ -12900,18 +12916,8 @@ function sumTranscriptUsageInWindow(jsonl, startMs, endMs) {
12900
12916
  const tsMs = new Date(ts).getTime();
12901
12917
  if (!Number.isFinite(tsMs))
12902
12918
  continue;
12903
- const model = typeof msg.model === "string" && msg.model ? msg.model : "unknown";
12904
12919
  const id = typeof msg.id === "string" && msg.id ? msg.id : `__noid_${syntheticCounter++}`;
12905
- byId.set(id, {
12906
- tsMs,
12907
- model,
12908
- totals: {
12909
- inputTokens: nonNegInt(u.input_tokens),
12910
- outputTokens: nonNegInt(u.output_tokens),
12911
- cacheCreationTokens: nonNegInt(u.cache_creation_input_tokens),
12912
- cacheReadTokens: nonNegInt(u.cache_read_input_tokens)
12913
- }
12914
- });
12920
+ byId.set(id, { tsMs, contributions: usageContributions(msg, u) });
12915
12921
  }
12916
12922
  const byModel = /* @__PURE__ */ new Map();
12917
12923
  const totals = emptyTotals();
@@ -12920,16 +12926,18 @@ function sumTranscriptUsageInWindow(jsonl, startMs, endMs) {
12920
12926
  if (e.tsMs < startMs || e.tsMs > endMs)
12921
12927
  continue;
12922
12928
  messageCount++;
12923
- const acc = byModel.get(e.model) ?? emptyTotals();
12924
- acc.inputTokens += e.totals.inputTokens;
12925
- acc.outputTokens += e.totals.outputTokens;
12926
- acc.cacheCreationTokens += e.totals.cacheCreationTokens;
12927
- acc.cacheReadTokens += e.totals.cacheReadTokens;
12928
- byModel.set(e.model, acc);
12929
- totals.inputTokens += e.totals.inputTokens;
12930
- totals.outputTokens += e.totals.outputTokens;
12931
- totals.cacheCreationTokens += e.totals.cacheCreationTokens;
12932
- totals.cacheReadTokens += e.totals.cacheReadTokens;
12929
+ for (const c of e.contributions) {
12930
+ const acc = byModel.get(c.model) ?? emptyTotals();
12931
+ acc.inputTokens += c.totals.inputTokens;
12932
+ acc.outputTokens += c.totals.outputTokens;
12933
+ acc.cacheCreationTokens += c.totals.cacheCreationTokens;
12934
+ acc.cacheReadTokens += c.totals.cacheReadTokens;
12935
+ byModel.set(c.model, acc);
12936
+ totals.inputTokens += c.totals.inputTokens;
12937
+ totals.outputTokens += c.totals.outputTokens;
12938
+ totals.cacheCreationTokens += c.totals.cacheCreationTokens;
12939
+ totals.cacheReadTokens += c.totals.cacheReadTokens;
12940
+ }
12933
12941
  }
12934
12942
  return { byModel, totals, messageCount };
12935
12943
  }
@@ -12988,31 +12996,23 @@ function attributeTranscriptUsageByRun(jsonl) {
12988
12996
  if (typeof usage !== "object" || usage === null)
12989
12997
  continue;
12990
12998
  const u = usage;
12991
- const model = typeof msg.model === "string" && msg.model ? msg.model : "unknown";
12992
12999
  const id = typeof msg.id === "string" && msg.id ? msg.id : `__noid_${syntheticCounter++}`;
12993
- byId.set(id, {
12994
- runId: currentRunId,
12995
- model,
12996
- totals: {
12997
- inputTokens: nonNegInt(u.input_tokens),
12998
- outputTokens: nonNegInt(u.output_tokens),
12999
- cacheCreationTokens: nonNegInt(u.cache_creation_input_tokens),
13000
- cacheReadTokens: nonNegInt(u.cache_read_input_tokens)
13001
- }
13002
- });
13000
+ byId.set(id, { runId: currentRunId, contributions: usageContributions(msg, u) });
13003
13001
  }
13004
13002
  const UNATTR = "\0unattributed";
13005
13003
  const agg = /* @__PURE__ */ new Map();
13006
13004
  for (const e of byId.values()) {
13007
- const key = `${e.runId ?? UNATTR}\0${e.model}`;
13008
- const cur = agg.get(key);
13009
- if (cur) {
13010
- cur.totals.inputTokens += e.totals.inputTokens;
13011
- cur.totals.outputTokens += e.totals.outputTokens;
13012
- cur.totals.cacheCreationTokens += e.totals.cacheCreationTokens;
13013
- cur.totals.cacheReadTokens += e.totals.cacheReadTokens;
13014
- } else {
13015
- agg.set(key, { runId: e.runId, model: e.model, totals: { ...e.totals } });
13005
+ for (const c of e.contributions) {
13006
+ const key = `${e.runId ?? UNATTR}\0${c.model}`;
13007
+ const cur = agg.get(key);
13008
+ if (cur) {
13009
+ cur.totals.inputTokens += c.totals.inputTokens;
13010
+ cur.totals.outputTokens += c.totals.outputTokens;
13011
+ cur.totals.cacheCreationTokens += c.totals.cacheCreationTokens;
13012
+ cur.totals.cacheReadTokens += c.totals.cacheReadTokens;
13013
+ } else {
13014
+ agg.set(key, { runId: e.runId, model: c.model, totals: { ...c.totals } });
13015
+ }
13016
13016
  }
13017
13017
  }
13018
13018
  return { perRunModel: [...agg.values()], runIds: [...runIds] };
@@ -14303,4 +14303,4 @@ export {
14303
14303
  peekCurrentSession,
14304
14304
  readDailySessionPin
14305
14305
  };
14306
- //# sourceMappingURL=chunk-ULLOPIPI.js.map
14306
+ //# sourceMappingURL=chunk-VCPESUZV.js.map