@integrity-labs/agt-cli 0.27.161 → 0.27.163

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-V5RAWFRT.js";
36
+ } from "../chunk-DTZKJYJP.js";
37
37
  import {
38
38
  CHANNEL_REGISTRY,
39
39
  DEPLOYMENT_TEMPLATES,
@@ -60,7 +60,7 @@ import {
60
60
  renderTemplate,
61
61
  resolveChannels,
62
62
  serializeManifestForSlackCli
63
- } from "../chunk-BC26YO7P.js";
63
+ } from "../chunk-3A2H4ZLD.js";
64
64
 
65
65
  // src/bin/agt.ts
66
66
  import { join as join21 } from "path";
@@ -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.161" : "dev";
5022
+ var cliVersion = true ? "0.27.163" : "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.161" : "dev";
5945
+ var cliVersion2 = true ? "0.27.163" : "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) => {
@@ -2360,7 +2360,14 @@ var FLAG_REGISTRY = [
2360
2360
  description: "Optional-channel quarantine (ENG-5932): off = disabled, shadow = log matches only, enforce = quarantine.",
2361
2361
  flagType: "enum",
2362
2362
  allowedValues: ["off", "shadow", "enforce"],
2363
- defaultValue: "off",
2363
+ // Declared safe value is `shadow` (compute + log "would quarantine X",
2364
+ // takes no action) — NOT `off`. Two reasons: (1) shadow is observe-only, so
2365
+ // it's as non-destructive as off while staying diagnosable; (2) it matches
2366
+ // the live manager's compiled default since ENG-5932, so migrating the host
2367
+ // reader onto this flag (ENG-6252) preserves fleet behaviour rather than
2368
+ // silently disabling the quarantine logic. Enforcement (`enforce`) stays a
2369
+ // deliberate, audited flip via the admin surface.
2370
+ defaultValue: "shadow",
2364
2371
  envVar: "AGT_CHANNEL_QUARANTINE_MODE",
2365
2372
  // Enforcement gate: weakening it (enforce → shadow/off) drops a channel
2366
2373
  // safety control, so mutations require explicit confirmation.
@@ -4605,6 +4612,71 @@ function parseTranscriptUsage(jsonl) {
4605
4612
  messageCount: byId.size
4606
4613
  };
4607
4614
  }
4615
+ function sumTranscriptUsageInWindow(jsonl, startMs, endMs) {
4616
+ const byId = /* @__PURE__ */ new Map();
4617
+ let syntheticCounter = 0;
4618
+ for (const line of jsonl.split("\n")) {
4619
+ const trimmed = line.trim();
4620
+ if (!trimmed)
4621
+ continue;
4622
+ let obj;
4623
+ try {
4624
+ obj = JSON.parse(trimmed);
4625
+ } catch {
4626
+ continue;
4627
+ }
4628
+ if (typeof obj !== "object" || obj === null)
4629
+ continue;
4630
+ const record = obj;
4631
+ if (record.type !== "assistant")
4632
+ continue;
4633
+ const message = record.message;
4634
+ if (typeof message !== "object" || message === null)
4635
+ continue;
4636
+ const msg = message;
4637
+ const usage = msg.usage;
4638
+ if (typeof usage !== "object" || usage === null)
4639
+ continue;
4640
+ const u = usage;
4641
+ const ts = record.timestamp;
4642
+ if (typeof ts !== "string" || !ts)
4643
+ continue;
4644
+ const tsMs = new Date(ts).getTime();
4645
+ if (!Number.isFinite(tsMs))
4646
+ continue;
4647
+ const model = typeof msg.model === "string" && msg.model ? msg.model : "unknown";
4648
+ const id = typeof msg.id === "string" && msg.id ? msg.id : `__noid_${syntheticCounter++}`;
4649
+ byId.set(id, {
4650
+ tsMs,
4651
+ model,
4652
+ totals: {
4653
+ inputTokens: nonNegInt(u.input_tokens),
4654
+ outputTokens: nonNegInt(u.output_tokens),
4655
+ cacheCreationTokens: nonNegInt(u.cache_creation_input_tokens),
4656
+ cacheReadTokens: nonNegInt(u.cache_read_input_tokens)
4657
+ }
4658
+ });
4659
+ }
4660
+ const byModel = /* @__PURE__ */ new Map();
4661
+ const totals = emptyTotals();
4662
+ let messageCount = 0;
4663
+ for (const e of byId.values()) {
4664
+ if (e.tsMs < startMs || e.tsMs > endMs)
4665
+ continue;
4666
+ messageCount++;
4667
+ const acc = byModel.get(e.model) ?? emptyTotals();
4668
+ acc.inputTokens += e.totals.inputTokens;
4669
+ acc.outputTokens += e.totals.outputTokens;
4670
+ acc.cacheCreationTokens += e.totals.cacheCreationTokens;
4671
+ acc.cacheReadTokens += e.totals.cacheReadTokens;
4672
+ byModel.set(e.model, acc);
4673
+ totals.inputTokens += e.totals.inputTokens;
4674
+ totals.outputTokens += e.totals.outputTokens;
4675
+ totals.cacheCreationTokens += e.totals.cacheCreationTokens;
4676
+ totals.cacheReadTokens += e.totals.cacheReadTokens;
4677
+ }
4678
+ return { byModel, totals, messageCount };
4679
+ }
4608
4680
  function isEmptyTotals(totals) {
4609
4681
  return totals.inputTokens === 0 && totals.outputTokens === 0 && totals.cacheCreationTokens === 0 && totals.cacheReadTokens === 0;
4610
4682
  }
@@ -4994,6 +5066,7 @@ export {
4994
5066
  parseUsageBanner,
4995
5067
  formatRunMarker,
4996
5068
  parseTranscriptUsage,
5069
+ sumTranscriptUsageInWindow,
4997
5070
  isEmptyTotals,
4998
5071
  attributeTranscriptUsageByRun,
4999
5072
  KANBAN_CHECK_COMMAND,
@@ -5003,4 +5076,4 @@ export {
5003
5076
  coerceEnvValue,
5004
5077
  FLAGS_SCHEMA_VERSION
5005
5078
  };
5006
- //# sourceMappingURL=chunk-BC26YO7P.js.map
5079
+ //# sourceMappingURL=chunk-3A2H4ZLD.js.map