@integrity-labs/agt-cli 0.24.5 → 0.24.7

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
@@ -26,7 +26,7 @@ import {
26
26
  success,
27
27
  table,
28
28
  warn
29
- } from "../chunk-QWMGMV4N.js";
29
+ } from "../chunk-FK6BJWEC.js";
30
30
  import {
31
31
  CHANNEL_REGISTRY,
32
32
  DEPLOYMENT_TEMPLATES,
@@ -52,7 +52,7 @@ import {
52
52
  renderTemplate,
53
53
  resolveChannels,
54
54
  serializeManifestForSlackCli
55
- } from "../chunk-ECDTRQLA.js";
55
+ } from "../chunk-53TCAGCM.js";
56
56
 
57
57
  // src/bin/agt.ts
58
58
  import { join as join10 } from "path";
@@ -3736,7 +3736,7 @@ import { execFileSync, execSync } from "child_process";
3736
3736
  import { existsSync as existsSync5, realpathSync } from "fs";
3737
3737
  import chalk17 from "chalk";
3738
3738
  import ora15 from "ora";
3739
- var cliVersion = true ? "0.24.5" : "dev";
3739
+ var cliVersion = true ? "0.24.7" : "dev";
3740
3740
  async function fetchLatestVersion() {
3741
3741
  const host2 = getHost();
3742
3742
  if (!host2) return null;
@@ -4268,7 +4268,7 @@ function handleError(err) {
4268
4268
  }
4269
4269
 
4270
4270
  // src/bin/agt.ts
4271
- var cliVersion2 = true ? "0.24.5" : "dev";
4271
+ var cliVersion2 = true ? "0.24.7" : "dev";
4272
4272
  var program = new Command();
4273
4273
  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");
4274
4274
  program.hook("preAction", (thisCommand) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  KANBAN_LOOP_COMMAND
3
- } from "./chunk-ECDTRQLA.js";
3
+ } from "./chunk-53TCAGCM.js";
4
4
 
5
5
  // src/lib/persistent-session.ts
6
6
  import { spawn, execSync, execFileSync as execFileSync2 } from "child_process";
@@ -1165,4 +1165,4 @@ export {
1165
1165
  stopAllSessionsAndWait,
1166
1166
  getProjectDir
1167
1167
  };
1168
- //# sourceMappingURL=chunk-PNTLQKLO.js.map
1168
+ //# sourceMappingURL=chunk-3A2PMQM4.js.map
@@ -999,6 +999,12 @@ function looksLikeNotesOnly(remainder) {
999
999
  return lines.every((line) => NON_DELIVERABLE_REMAINDER_PATTERNS.some((pattern) => pattern.test(line)));
1000
1000
  }
1001
1001
 
1002
+ // ../../packages/core/dist/claude-code-usage/run-marker.js
1003
+ function formatRunMarker(runId) {
1004
+ return `<!-- agt-run:${runId} -->`;
1005
+ }
1006
+ var RUN_MARKER_RE = /<!--\s*agt-run:([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})\s*-->/;
1007
+
1002
1008
  // ../../packages/core/dist/loops/kanban-loop.js
1003
1009
  var KANBAN_LOOP_COMMAND = "/loop 5m kanban_list \u2014 follow Kanban Work Policy.";
1004
1010
 
@@ -3253,6 +3259,87 @@ function parseTranscriptUsage(jsonl) {
3253
3259
  function isEmptyTotals(totals) {
3254
3260
  return totals.inputTokens === 0 && totals.outputTokens === 0 && totals.cacheCreationTokens === 0 && totals.cacheReadTokens === 0;
3255
3261
  }
3262
+ function userTurnText(message) {
3263
+ const content = message.content;
3264
+ if (typeof content === "string")
3265
+ return content;
3266
+ if (Array.isArray(content)) {
3267
+ return content.map((block) => {
3268
+ if (block && typeof block === "object") {
3269
+ const t = block.text;
3270
+ if (typeof t === "string")
3271
+ return t;
3272
+ }
3273
+ return "";
3274
+ }).join("\n");
3275
+ }
3276
+ return "";
3277
+ }
3278
+ function attributeTranscriptUsageByRun(jsonl) {
3279
+ const byId = /* @__PURE__ */ new Map();
3280
+ const runIds = /* @__PURE__ */ new Set();
3281
+ let currentRunId = null;
3282
+ let syntheticCounter = 0;
3283
+ for (const line of jsonl.split("\n")) {
3284
+ const trimmed = line.trim();
3285
+ if (!trimmed)
3286
+ continue;
3287
+ let obj;
3288
+ try {
3289
+ obj = JSON.parse(trimmed);
3290
+ } catch {
3291
+ continue;
3292
+ }
3293
+ if (typeof obj !== "object" || obj === null)
3294
+ continue;
3295
+ const record = obj;
3296
+ const message = record.message;
3297
+ if (typeof message !== "object" || message === null)
3298
+ continue;
3299
+ const msg = message;
3300
+ if (record.type === "user") {
3301
+ const m = userTurnText(msg).match(RUN_MARKER_RE);
3302
+ if (m && m[1]) {
3303
+ currentRunId = m[1];
3304
+ runIds.add(m[1]);
3305
+ }
3306
+ continue;
3307
+ }
3308
+ if (record.type !== "assistant")
3309
+ continue;
3310
+ const usage = msg.usage;
3311
+ if (typeof usage !== "object" || usage === null)
3312
+ continue;
3313
+ const u = usage;
3314
+ const model = typeof msg.model === "string" && msg.model ? msg.model : "unknown";
3315
+ const id = typeof msg.id === "string" && msg.id ? msg.id : `__noid_${syntheticCounter++}`;
3316
+ byId.set(id, {
3317
+ runId: currentRunId,
3318
+ model,
3319
+ totals: {
3320
+ inputTokens: nonNegInt(u.input_tokens),
3321
+ outputTokens: nonNegInt(u.output_tokens),
3322
+ cacheCreationTokens: nonNegInt(u.cache_creation_input_tokens),
3323
+ cacheReadTokens: nonNegInt(u.cache_read_input_tokens)
3324
+ }
3325
+ });
3326
+ }
3327
+ const UNATTR = "\0unattributed";
3328
+ const agg = /* @__PURE__ */ new Map();
3329
+ for (const e of byId.values()) {
3330
+ const key = `${e.runId ?? UNATTR}\0${e.model}`;
3331
+ const cur = agg.get(key);
3332
+ if (cur) {
3333
+ cur.totals.inputTokens += e.totals.inputTokens;
3334
+ cur.totals.outputTokens += e.totals.outputTokens;
3335
+ cur.totals.cacheCreationTokens += e.totals.cacheCreationTokens;
3336
+ cur.totals.cacheReadTokens += e.totals.cacheReadTokens;
3337
+ } else {
3338
+ agg.set(key, { runId: e.runId, model: e.model, totals: { ...e.totals } });
3339
+ }
3340
+ }
3341
+ return { perRunModel: [...agg.values()], runIds: [...runIds] };
3342
+ }
3256
3343
 
3257
3344
  export {
3258
3345
  wrapScheduledTaskPrompt,
@@ -3292,9 +3379,11 @@ export {
3292
3379
  detectDrift,
3293
3380
  classifyOutput,
3294
3381
  parseUsageBanner,
3382
+ formatRunMarker,
3295
3383
  parseTranscriptUsage,
3296
3384
  isEmptyTotals,
3385
+ attributeTranscriptUsageByRun,
3297
3386
  KANBAN_LOOP_COMMAND,
3298
3387
  KANBAN_CHECK_COMMAND
3299
3388
  };
3300
- //# sourceMappingURL=chunk-ECDTRQLA.js.map
3389
+ //# sourceMappingURL=chunk-53TCAGCM.js.map