@integrity-labs/agt-cli 0.28.645 → 0.28.646

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,10 +40,10 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-T47HZECK.js";
43
+ } from "../chunk-NVIFY3WZ.js";
44
44
  import {
45
45
  readDirectChatSessionState
46
- } from "../chunk-Z2SA7JLD.js";
46
+ } from "../chunk-PJSEFPIS.js";
47
47
  import {
48
48
  AnchorSessionClient,
49
49
  CHANNEL_REGISTRY,
@@ -73,7 +73,7 @@ import {
73
73
  requiredMcpWildcard,
74
74
  resolveChannels,
75
75
  serializeManifestForSlackCli
76
- } from "../chunk-2MDR3ZHP.js";
76
+ } from "../chunk-3ZK66WZZ.js";
77
77
  import "../chunk-XWVM4KPK.js";
78
78
 
79
79
  // src/bin/agt.ts
@@ -4909,7 +4909,7 @@ import { execFileSync, execSync } from "child_process";
4909
4909
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4910
4910
  import chalk18 from "chalk";
4911
4911
  import ora16 from "ora";
4912
- var cliVersion = true ? "0.28.645" : "dev";
4912
+ var cliVersion = true ? "0.28.646" : "dev";
4913
4913
  async function fetchLatestVersion() {
4914
4914
  const host2 = getHost();
4915
4915
  if (!host2) return null;
@@ -6089,7 +6089,7 @@ function handleError(err) {
6089
6089
  }
6090
6090
 
6091
6091
  // src/bin/agt.ts
6092
- var cliVersion2 = true ? "0.28.645" : "dev";
6092
+ var cliVersion2 = true ? "0.28.646" : "dev";
6093
6093
  var program = new Command();
6094
6094
  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");
6095
6095
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -11316,6 +11316,99 @@ function isBucketQualified(bucketStartMs, turnTimes, neighbourhoodMs = DEFAULT_N
11316
11316
  }
11317
11317
  return false;
11318
11318
  }
11319
+ function extractToolCallEvents(jsonl, options = {}) {
11320
+ const startMs = options.startMs ?? Number.NEGATIVE_INFINITY;
11321
+ const endMs = options.endMs ?? Number.POSITIVE_INFINITY;
11322
+ const out = [];
11323
+ for (const line of jsonl.split("\n")) {
11324
+ const trimmed = line.trim();
11325
+ if (!trimmed)
11326
+ continue;
11327
+ let obj;
11328
+ try {
11329
+ obj = JSON.parse(trimmed);
11330
+ } catch {
11331
+ continue;
11332
+ }
11333
+ if (typeof obj !== "object" || obj === null)
11334
+ continue;
11335
+ const record = obj;
11336
+ const ts = record.timestamp;
11337
+ if (typeof ts !== "string" || !ts)
11338
+ continue;
11339
+ const atMs = new Date(ts).getTime();
11340
+ if (!Number.isFinite(atMs))
11341
+ continue;
11342
+ if (atMs < startMs || atMs > endMs)
11343
+ continue;
11344
+ const message = record.message;
11345
+ if (typeof message !== "object" || message === null)
11346
+ continue;
11347
+ const content = message.content;
11348
+ if (!Array.isArray(content))
11349
+ continue;
11350
+ for (const raw of content) {
11351
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
11352
+ continue;
11353
+ const block = raw;
11354
+ if (block.type === "tool_use") {
11355
+ const id = typeof block.id === "string" ? block.id : "";
11356
+ if (id)
11357
+ out.push({ id, kind: "use", atMs });
11358
+ continue;
11359
+ }
11360
+ if (block.type === "tool_result") {
11361
+ const id = typeof block.tool_use_id === "string" ? block.tool_use_id : "";
11362
+ if (id)
11363
+ out.push({ id, kind: "result", atMs });
11364
+ }
11365
+ }
11366
+ }
11367
+ return out;
11368
+ }
11369
+ function pairToolCallBrackets(events, carriedOpen = []) {
11370
+ const open = /* @__PURE__ */ new Map();
11371
+ for (const c of carriedOpen) {
11372
+ const prev = open.get(c.id);
11373
+ if (prev === void 0 || c.startMs < prev)
11374
+ open.set(c.id, c.startMs);
11375
+ }
11376
+ const brackets = [];
11377
+ for (const ev of events) {
11378
+ if (ev.kind === "use") {
11379
+ const prev = open.get(ev.id);
11380
+ if (prev === void 0 || ev.atMs < prev)
11381
+ open.set(ev.id, ev.atMs);
11382
+ continue;
11383
+ }
11384
+ const startMs = open.get(ev.id);
11385
+ if (startMs === void 0)
11386
+ continue;
11387
+ open.delete(ev.id);
11388
+ brackets.push({ id: ev.id, startMs, endMs: Math.max(startMs, ev.atMs) });
11389
+ }
11390
+ brackets.sort((a, b) => a.startMs - b.startMs);
11391
+ const stillOpen = [...open.entries()].map(([id, startMs]) => ({ id, startMs })).sort((a, b) => a.startMs - b.startMs);
11392
+ return { brackets, open: stillOpen };
11393
+ }
11394
+ function isBucketInBracket(bucketStartMs, brackets) {
11395
+ const bucketEndMs = bucketStartMs + BUCKET_MS;
11396
+ for (const b of brackets) {
11397
+ if (b.startMs > bucketEndMs)
11398
+ continue;
11399
+ if (b.endMs >= bucketStartMs)
11400
+ return true;
11401
+ }
11402
+ return false;
11403
+ }
11404
+ function isBucketInOpenCall(bucketStartMs, open) {
11405
+ const bucketEndMs = bucketStartMs + BUCKET_MS;
11406
+ for (const c of open) {
11407
+ if (c.startMs <= bucketEndMs)
11408
+ return true;
11409
+ }
11410
+ return false;
11411
+ }
11319
11412
 
11320
11413
  // ../../packages/core/dist/account-enforcement/marker.js
11321
11414
  var ACCOUNT_ENFORCEMENT_MARKER_FILENAME = "account-enforcement.json";
@@ -12077,6 +12170,10 @@ export {
12077
12170
  DEFAULT_NEIGHBOURHOOD_MS,
12078
12171
  extractQualifyingTurns,
12079
12172
  isBucketQualified,
12173
+ extractToolCallEvents,
12174
+ pairToolCallBrackets,
12175
+ isBucketInBracket,
12176
+ isBucketInOpenCall,
12080
12177
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
12081
12178
  serializeAccountEnforcementMarker,
12082
12179
  KANBAN_CHECK_COMMAND,
@@ -12118,4 +12215,4 @@ export {
12118
12215
  minutesSinceLocalMidnight,
12119
12216
  peekCurrentSession
12120
12217
  };
12121
- //# sourceMappingURL=chunk-2MDR3ZHP.js.map
12218
+ //# sourceMappingURL=chunk-3ZK66WZZ.js.map