@integrity-labs/agt-cli 0.28.1047 → 0.28.1048

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.
Files changed (24) hide show
  1. package/dist/bin/agt.js +5 -5
  2. package/dist/{chunk-2DUVDY2Y.js → chunk-4BOPLS65.js} +4 -4
  3. package/dist/{chunk-5GCYYWKW.js → chunk-APAEM42J.js} +141 -11
  4. package/dist/chunk-APAEM42J.js.map +1 -0
  5. package/dist/{chunk-QGUJSDN3.js → chunk-QGGDQMWF.js} +2 -2
  6. package/dist/{claude-pair-runtime-TOHT7XVN.js → claude-pair-runtime-KWN4XZ2H.js} +2 -2
  7. package/dist/lib/manager-worker.js +497 -378
  8. package/dist/lib/manager-worker.js.map +1 -1
  9. package/dist/mcp/direct-chat-channel.js +10 -0
  10. package/dist/mcp/index.js +10 -0
  11. package/dist/mcp/origami.js +10 -0
  12. package/dist/mcp/slack-channel.js +10 -0
  13. package/dist/mcp/telegram-channel.js +10 -0
  14. package/dist/{persistent-session-X3C3R22F.js → persistent-session-OSQVHP6N.js} +3 -3
  15. package/dist/{responsiveness-probe-E23YHRUT.js → responsiveness-probe-BFDPJWZE.js} +3 -3
  16. package/dist/{session-auth-dead-WCUXKBHP.js → session-auth-dead-A3WD2YRK.js} +2 -2
  17. package/package.json +1 -1
  18. package/dist/chunk-5GCYYWKW.js.map +0 -1
  19. /package/dist/{chunk-2DUVDY2Y.js.map → chunk-4BOPLS65.js.map} +0 -0
  20. /package/dist/{chunk-QGUJSDN3.js.map → chunk-QGGDQMWF.js.map} +0 -0
  21. /package/dist/{claude-pair-runtime-TOHT7XVN.js.map → claude-pair-runtime-KWN4XZ2H.js.map} +0 -0
  22. /package/dist/{persistent-session-X3C3R22F.js.map → persistent-session-OSQVHP6N.js.map} +0 -0
  23. /package/dist/{responsiveness-probe-E23YHRUT.js.map → responsiveness-probe-BFDPJWZE.js.map} +0 -0
  24. /package/dist/{session-auth-dead-WCUXKBHP.js.map → session-auth-dead-A3WD2YRK.js.map} +0 -0
package/dist/bin/agt.js CHANGED
@@ -40,12 +40,12 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-2DUVDY2Y.js";
43
+ } from "../chunk-4BOPLS65.js";
44
44
  import {
45
45
  getProjectDir,
46
46
  isSessionResumeDisabled,
47
47
  readDirectChatSessionState
48
- } from "../chunk-QGUJSDN3.js";
48
+ } from "../chunk-QGGDQMWF.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-5GCYYWKW.js";
82
+ } from "../chunk-APAEM42J.js";
83
83
  import "../chunk-TQDIIS3X.js";
84
84
  import "../chunk-XWVM4KPK.js";
85
85
  import "../chunk-EL5MWGGH.js";
@@ -5474,7 +5474,7 @@ import { execFileSync, execSync } from "child_process";
5474
5474
  import { existsSync as existsSync11, realpathSync as realpathSync2 } from "fs";
5475
5475
  import chalk18 from "chalk";
5476
5476
  import ora16 from "ora";
5477
- var cliVersion = true ? "0.28.1047" : "dev";
5477
+ var cliVersion = true ? "0.28.1048" : "dev";
5478
5478
  async function fetchLatestVersion() {
5479
5479
  const host2 = getHost();
5480
5480
  if (!host2) return null;
@@ -6734,7 +6734,7 @@ function handleError(err) {
6734
6734
  }
6735
6735
 
6736
6736
  // src/bin/agt.ts
6737
- var cliVersion2 = true ? "0.28.1047" : "dev";
6737
+ var cliVersion2 = true ? "0.28.1048" : "dev";
6738
6738
  var program = new Command();
6739
6739
  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");
6740
6740
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -16,7 +16,7 @@ import {
16
16
  parseEnvFileEntries,
17
17
  parseEnvIntegrations,
18
18
  shellQuote
19
- } from "./chunk-QGUJSDN3.js";
19
+ } from "./chunk-QGGDQMWF.js";
20
20
  import {
21
21
  BIND_FAILURE_QUARANTINE_THRESHOLD,
22
22
  INTEGRATIONS_SECTION_END,
@@ -78,7 +78,7 @@ import {
78
78
  sessionTranscriptDir,
79
79
  worseConnectivityOutcome,
80
80
  wrapScheduledTaskPrompt
81
- } from "./chunk-5GCYYWKW.js";
81
+ } from "./chunk-APAEM42J.js";
82
82
  import {
83
83
  classifyUnanswerablePane,
84
84
  isConsumerTermsDialogVisible,
@@ -7119,7 +7119,7 @@ function exchangeFailureKind(err) {
7119
7119
  }
7120
7120
 
7121
7121
  // src/lib/api-client.ts
7122
- var agtCliVersion = true ? "0.28.1047" : "dev";
7122
+ var agtCliVersion = true ? "0.28.1048" : "dev";
7123
7123
  var lastConfigHash = null;
7124
7124
  function setConfigHash(hash) {
7125
7125
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -12076,4 +12076,4 @@ export {
12076
12076
  managerInstallSystemUnitCommand,
12077
12077
  managerUninstallSystemUnitCommand
12078
12078
  };
12079
- //# sourceMappingURL=chunk-2DUVDY2Y.js.map
12079
+ //# sourceMappingURL=chunk-4BOPLS65.js.map
@@ -14425,11 +14425,11 @@ function sumTranscriptUsageInWindow(jsonl, startMs, endMs) {
14425
14425
  const ts = record.timestamp;
14426
14426
  if (typeof ts !== "string" || !ts)
14427
14427
  continue;
14428
- const tsMs = new Date(ts).getTime();
14429
- if (!Number.isFinite(tsMs))
14428
+ const tsMs2 = new Date(ts).getTime();
14429
+ if (!Number.isFinite(tsMs2))
14430
14430
  continue;
14431
14431
  const id = typeof msg.id === "string" && msg.id ? msg.id : `__noid_${syntheticCounter++}`;
14432
- byId.set(id, { tsMs, contributions: usageContributions(msg, u) });
14432
+ byId.set(id, { tsMs: tsMs2, contributions: usageContributions(msg, u) });
14433
14433
  }
14434
14434
  const byModel = /* @__PURE__ */ new Map();
14435
14435
  const totals = emptyTotals();
@@ -14641,13 +14641,13 @@ function classifyTranscriptLine(line, startMs, endMs, now) {
14641
14641
  const ts = record.timestamp;
14642
14642
  if (typeof ts !== "string" || !ts)
14643
14643
  return null;
14644
- const tsMs = new Date(ts).getTime();
14645
- if (!Number.isFinite(tsMs) || tsMs < startMs || tsMs > endMs)
14644
+ const tsMs2 = new Date(ts).getTime();
14645
+ if (!Number.isFinite(tsMs2) || tsMs2 < startMs || tsMs2 > endMs)
14646
14646
  return null;
14647
14647
  if (record.error === "rate_limit" || record.apiErrorStatus === 429) {
14648
14648
  const text = contentText(record);
14649
14649
  const observation = text ? parseUsageBanner(text, now ?? new Date(endMs)) : null;
14650
- return { verdict: "capped", atMs: tsMs, resetsAt: observation?.weekResetsAt ?? null, text };
14650
+ return { verdict: "capped", atMs: tsMs2, resetsAt: observation?.weekResetsAt ?? null, text };
14651
14651
  }
14652
14652
  if (record.isApiErrorMessage === true)
14653
14653
  return null;
@@ -14664,7 +14664,7 @@ function classifyTranscriptLine(line, startMs, endMs, now) {
14664
14664
  const spent = Number(u.input_tokens ?? 0) + Number(u.output_tokens ?? 0) + Number(u.cache_creation_input_tokens ?? 0) + Number(u.cache_read_input_tokens ?? 0);
14665
14665
  if (!Number.isFinite(spent) || spent <= 0)
14666
14666
  return null;
14667
- return { verdict: "serving", atMs: tsMs, resetsAt: null, text: null };
14667
+ return { verdict: "serving", atMs: tsMs2, resetsAt: null, text: null };
14668
14668
  }
14669
14669
  function pickNewerClassification(current, next) {
14670
14670
  if (next.verdict === "unknown")
@@ -14750,12 +14750,12 @@ function extractQualifyingTurns(jsonl, options = {}) {
14750
14750
  const ts = record.timestamp;
14751
14751
  if (typeof ts !== "string" || !ts)
14752
14752
  continue;
14753
- const tsMs = new Date(ts).getTime();
14754
- if (!Number.isFinite(tsMs))
14753
+ const tsMs2 = new Date(ts).getTime();
14754
+ if (!Number.isFinite(tsMs2))
14755
14755
  continue;
14756
14756
  const id = typeof msg.id === "string" && msg.id ? msg.id : `__noid_${syntheticCounter++}`;
14757
14757
  byId.set(id, {
14758
- tsMs,
14758
+ tsMs: tsMs2,
14759
14759
  outputTokens: nonNegInt2(usage.output_tokens)
14760
14760
  });
14761
14761
  }
@@ -14875,6 +14875,132 @@ function isBucketInOpenCall(bucketStartMs, open) {
14875
14875
  return false;
14876
14876
  }
14877
14877
 
14878
+ // ../../packages/core/dist/claude-code-usage/failing-turn-run.js
14879
+ var FAILING_TURN_RUN_DEFAULT_THRESHOLD = 3;
14880
+ var FAILING_TURN_DEFAULT_MAX_TURN_MS = 5e3;
14881
+ var NO_FAILING_TURN_RUN = Object.freeze({
14882
+ newestTurn: "other",
14883
+ consecutive: 0,
14884
+ firstFailureAtMs: null,
14885
+ lastFailureAtMs: null,
14886
+ lastStatus: null,
14887
+ lastErrorCode: null
14888
+ });
14889
+ function tsMs(record) {
14890
+ const ts = record.timestamp;
14891
+ if (typeof ts !== "string" || !ts)
14892
+ return null;
14893
+ const ms = Date.parse(ts);
14894
+ return Number.isFinite(ms) ? ms : null;
14895
+ }
14896
+ function contentBlocks(record) {
14897
+ const msg = record.message;
14898
+ if (typeof msg !== "object" || msg === null)
14899
+ return null;
14900
+ const content = msg.content;
14901
+ if (typeof content === "string" || Array.isArray(content))
14902
+ return content;
14903
+ return null;
14904
+ }
14905
+ function isPrompt(record) {
14906
+ if (record.type !== "user")
14907
+ return false;
14908
+ if (record.isMeta === true)
14909
+ return false;
14910
+ const content = contentBlocks(record);
14911
+ if (typeof content === "string")
14912
+ return content.length > 0;
14913
+ if (!Array.isArray(content) || content.length === 0)
14914
+ return false;
14915
+ return !content.some((b) => typeof b === "object" && b !== null && b.type === "tool_result");
14916
+ }
14917
+ function isRateLimit(record) {
14918
+ return record.apiErrorStatus === 429 || record.error === "rate_limit";
14919
+ }
14920
+ function analyzeFailingTurnRun(jsonl, opts = {}) {
14921
+ const maxTurnMs = opts.maxTurnMs ?? FAILING_TURN_DEFAULT_MAX_TURN_MS;
14922
+ const turns = [];
14923
+ let current = null;
14924
+ for (const line of jsonl.split("\n")) {
14925
+ const trimmed = line.trim();
14926
+ if (!trimmed)
14927
+ continue;
14928
+ let obj;
14929
+ try {
14930
+ obj = JSON.parse(trimmed);
14931
+ } catch {
14932
+ continue;
14933
+ }
14934
+ if (typeof obj !== "object" || obj === null)
14935
+ continue;
14936
+ const record = obj;
14937
+ if (record.isSidechain === true)
14938
+ continue;
14939
+ if (isPrompt(record)) {
14940
+ current = {
14941
+ startMs: tsMs(record),
14942
+ endMs: null,
14943
+ hasAssistant: false,
14944
+ served: false,
14945
+ rateLimited: false,
14946
+ error: null
14947
+ };
14948
+ turns.push(current);
14949
+ continue;
14950
+ }
14951
+ if (record.type !== "assistant" || current === null)
14952
+ continue;
14953
+ current.hasAssistant = true;
14954
+ const at = tsMs(record);
14955
+ if (at !== null && (current.endMs === null || at > current.endMs))
14956
+ current.endMs = at;
14957
+ if (record.isApiErrorMessage === true) {
14958
+ current.error = {
14959
+ atMs: at,
14960
+ status: typeof record.apiErrorStatus === "number" ? record.apiErrorStatus : null,
14961
+ code: typeof record.error === "string" && record.error ? record.error : null
14962
+ };
14963
+ if (isRateLimit(record))
14964
+ current.rateLimited = true;
14965
+ } else {
14966
+ current.served = true;
14967
+ }
14968
+ }
14969
+ let consecutive = 0;
14970
+ let first = null;
14971
+ let newest = null;
14972
+ let newestTurn = null;
14973
+ for (let i = turns.length - 1; i >= 0; i--) {
14974
+ const turn = turns[i];
14975
+ if (!turn.hasAssistant) {
14976
+ if (i === turns.length - 1)
14977
+ continue;
14978
+ break;
14979
+ }
14980
+ const duration = turn.startMs !== null && turn.endMs !== null ? turn.endMs - turn.startMs : Number.POSITIVE_INFINITY;
14981
+ const failedFast = turn.error !== null && !turn.served && !turn.rateLimited && duration <= maxTurnMs;
14982
+ if (newestTurn === null)
14983
+ newestTurn = failedFast ? "failed" : turn.served ? "served" : "other";
14984
+ if (!failedFast)
14985
+ break;
14986
+ consecutive++;
14987
+ first = turn;
14988
+ if (newest === null)
14989
+ newest = turn;
14990
+ }
14991
+ if (consecutive === 0 || first === null || newest === null) {
14992
+ return newestTurn === "served" ? { ...NO_FAILING_TURN_RUN, newestTurn: "served" } : NO_FAILING_TURN_RUN;
14993
+ }
14994
+ return {
14995
+ newestTurn: "failed",
14996
+ consecutive,
14997
+ firstFailureAtMs: first.startMs,
14998
+ lastFailureAtMs: newest.error?.atMs ?? newest.endMs,
14999
+ lastStatus: newest.error?.status ?? null,
15000
+ lastErrorCode: newest.error?.code ?? null
15001
+ };
15002
+ }
15003
+
14878
15004
  // ../../packages/core/dist/account-enforcement/marker.js
14879
15005
  var ACCOUNT_ENFORCEMENT_MARKER_FILENAME = "account-enforcement.json";
14880
15006
  var ACCOUNT_ENFORCEMENT_MARKER_VERSION = 1;
@@ -15689,6 +15815,10 @@ export {
15689
15815
  pairToolCallBrackets,
15690
15816
  isBucketInBracket,
15691
15817
  isBucketInOpenCall,
15818
+ FAILING_TURN_RUN_DEFAULT_THRESHOLD,
15819
+ FAILING_TURN_DEFAULT_MAX_TURN_MS,
15820
+ NO_FAILING_TURN_RUN,
15821
+ analyzeFailingTurnRun,
15692
15822
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
15693
15823
  serializeAccountEnforcementMarker,
15694
15824
  KANBAN_CHECK_COMMAND,
@@ -15733,4 +15863,4 @@ export {
15733
15863
  peekCurrentSession,
15734
15864
  readDailySessionPin
15735
15865
  };
15736
- //# sourceMappingURL=chunk-5GCYYWKW.js.map
15866
+ //# sourceMappingURL=chunk-APAEM42J.js.map