@integrity-labs/agt-cli 0.28.1046 → 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-5W7ZBCWC.js → chunk-4BOPLS65.js} +4 -4
  3. package/dist/{chunk-46YPCLWA.js → chunk-APAEM42J.js} +150 -11
  4. package/dist/chunk-APAEM42J.js.map +1 -0
  5. package/dist/{chunk-TAINRP4T.js → chunk-QGGDQMWF.js} +2 -2
  6. package/dist/{claude-pair-runtime-OWDSHL6M.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 +19 -0
  10. package/dist/mcp/index.js +19 -0
  11. package/dist/mcp/origami.js +19 -0
  12. package/dist/mcp/slack-channel.js +19 -0
  13. package/dist/mcp/telegram-channel.js +19 -0
  14. package/dist/{persistent-session-VZANOGV5.js → persistent-session-OSQVHP6N.js} +3 -3
  15. package/dist/{responsiveness-probe-Z3K7LFCV.js → responsiveness-probe-BFDPJWZE.js} +3 -3
  16. package/dist/{session-auth-dead-3NF6MPSR.js → session-auth-dead-A3WD2YRK.js} +2 -2
  17. package/package.json +1 -1
  18. package/dist/chunk-46YPCLWA.js.map +0 -1
  19. /package/dist/{chunk-5W7ZBCWC.js.map → chunk-4BOPLS65.js.map} +0 -0
  20. /package/dist/{chunk-TAINRP4T.js.map → chunk-QGGDQMWF.js.map} +0 -0
  21. /package/dist/{claude-pair-runtime-OWDSHL6M.js.map → claude-pair-runtime-KWN4XZ2H.js.map} +0 -0
  22. /package/dist/{persistent-session-VZANOGV5.js.map → persistent-session-OSQVHP6N.js.map} +0 -0
  23. /package/dist/{responsiveness-probe-Z3K7LFCV.js.map → responsiveness-probe-BFDPJWZE.js.map} +0 -0
  24. /package/dist/{session-auth-dead-3NF6MPSR.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-5W7ZBCWC.js";
43
+ } from "../chunk-4BOPLS65.js";
44
44
  import {
45
45
  getProjectDir,
46
46
  isSessionResumeDisabled,
47
47
  readDirectChatSessionState
48
- } from "../chunk-TAINRP4T.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-46YPCLWA.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.1046" : "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.1046" : "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-TAINRP4T.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-46YPCLWA.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.1046" : "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-5W7ZBCWC.js.map
12079
+ //# sourceMappingURL=chunk-4BOPLS65.js.map
@@ -5629,6 +5629,15 @@ var FLAG_REGISTRY = [
5629
5629
  flagType: "boolean",
5630
5630
  defaultValue: false
5631
5631
  },
5632
+ {
5633
+ key: "live-team-only-default",
5634
+ description: "Make a NEW Ninja Canvas (Augmented Live) page team-only by default (ENG-11089, ADR-0122): when on, a publish that names no visibility is readable only by signed-in members of the publishing agent's team, and sharing it wider is an explicit choice. Evaluated per-org. Chooses the DEFAULT only: it never changes an existing page, and turning it off never un-protects a page that is already team-only. INERT until ENG-11150 lands - until then every publish is public and a non-public request is refused. Boolean gate; ships dark.",
5635
+ flagType: "boolean",
5636
+ defaultValue: false,
5637
+ // An org owner/admin must not arm a confidentiality default before the edge
5638
+ // can enforce it (ENG-11150); the ADR-0120 / ninja-lists precedent.
5639
+ platformAdminOnly: true
5640
+ },
5632
5641
  {
5633
5642
  key: "integration-multi-connection",
5634
5643
  description: "Allow adding a SECOND+ connection of one managed integration on the same agent (ENG-7543 / ADR-0045 Phase 3), discriminated by connection_key (e.g. two Gmail mailboxes). When OFF, only the default connection can be created (today's behaviour: a duplicate 409s). Gates 2nd-connection CREATION only; runtime N-server surfacing is a later phase. Evaluated per-org. Additive capability, not an enforcement control. Boolean gate; ships dark.",
@@ -14416,11 +14425,11 @@ function sumTranscriptUsageInWindow(jsonl, startMs, endMs) {
14416
14425
  const ts = record.timestamp;
14417
14426
  if (typeof ts !== "string" || !ts)
14418
14427
  continue;
14419
- const tsMs = new Date(ts).getTime();
14420
- if (!Number.isFinite(tsMs))
14428
+ const tsMs2 = new Date(ts).getTime();
14429
+ if (!Number.isFinite(tsMs2))
14421
14430
  continue;
14422
14431
  const id = typeof msg.id === "string" && msg.id ? msg.id : `__noid_${syntheticCounter++}`;
14423
- byId.set(id, { tsMs, contributions: usageContributions(msg, u) });
14432
+ byId.set(id, { tsMs: tsMs2, contributions: usageContributions(msg, u) });
14424
14433
  }
14425
14434
  const byModel = /* @__PURE__ */ new Map();
14426
14435
  const totals = emptyTotals();
@@ -14632,13 +14641,13 @@ function classifyTranscriptLine(line, startMs, endMs, now) {
14632
14641
  const ts = record.timestamp;
14633
14642
  if (typeof ts !== "string" || !ts)
14634
14643
  return null;
14635
- const tsMs = new Date(ts).getTime();
14636
- if (!Number.isFinite(tsMs) || tsMs < startMs || tsMs > endMs)
14644
+ const tsMs2 = new Date(ts).getTime();
14645
+ if (!Number.isFinite(tsMs2) || tsMs2 < startMs || tsMs2 > endMs)
14637
14646
  return null;
14638
14647
  if (record.error === "rate_limit" || record.apiErrorStatus === 429) {
14639
14648
  const text = contentText(record);
14640
14649
  const observation = text ? parseUsageBanner(text, now ?? new Date(endMs)) : null;
14641
- return { verdict: "capped", atMs: tsMs, resetsAt: observation?.weekResetsAt ?? null, text };
14650
+ return { verdict: "capped", atMs: tsMs2, resetsAt: observation?.weekResetsAt ?? null, text };
14642
14651
  }
14643
14652
  if (record.isApiErrorMessage === true)
14644
14653
  return null;
@@ -14655,7 +14664,7 @@ function classifyTranscriptLine(line, startMs, endMs, now) {
14655
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);
14656
14665
  if (!Number.isFinite(spent) || spent <= 0)
14657
14666
  return null;
14658
- return { verdict: "serving", atMs: tsMs, resetsAt: null, text: null };
14667
+ return { verdict: "serving", atMs: tsMs2, resetsAt: null, text: null };
14659
14668
  }
14660
14669
  function pickNewerClassification(current, next) {
14661
14670
  if (next.verdict === "unknown")
@@ -14741,12 +14750,12 @@ function extractQualifyingTurns(jsonl, options = {}) {
14741
14750
  const ts = record.timestamp;
14742
14751
  if (typeof ts !== "string" || !ts)
14743
14752
  continue;
14744
- const tsMs = new Date(ts).getTime();
14745
- if (!Number.isFinite(tsMs))
14753
+ const tsMs2 = new Date(ts).getTime();
14754
+ if (!Number.isFinite(tsMs2))
14746
14755
  continue;
14747
14756
  const id = typeof msg.id === "string" && msg.id ? msg.id : `__noid_${syntheticCounter++}`;
14748
14757
  byId.set(id, {
14749
- tsMs,
14758
+ tsMs: tsMs2,
14750
14759
  outputTokens: nonNegInt2(usage.output_tokens)
14751
14760
  });
14752
14761
  }
@@ -14866,6 +14875,132 @@ function isBucketInOpenCall(bucketStartMs, open) {
14866
14875
  return false;
14867
14876
  }
14868
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
+
14869
15004
  // ../../packages/core/dist/account-enforcement/marker.js
14870
15005
  var ACCOUNT_ENFORCEMENT_MARKER_FILENAME = "account-enforcement.json";
14871
15006
  var ACCOUNT_ENFORCEMENT_MARKER_VERSION = 1;
@@ -15680,6 +15815,10 @@ export {
15680
15815
  pairToolCallBrackets,
15681
15816
  isBucketInBracket,
15682
15817
  isBucketInOpenCall,
15818
+ FAILING_TURN_RUN_DEFAULT_THRESHOLD,
15819
+ FAILING_TURN_DEFAULT_MAX_TURN_MS,
15820
+ NO_FAILING_TURN_RUN,
15821
+ analyzeFailingTurnRun,
15683
15822
  ACCOUNT_ENFORCEMENT_MARKER_FILENAME,
15684
15823
  serializeAccountEnforcementMarker,
15685
15824
  KANBAN_CHECK_COMMAND,
@@ -15724,4 +15863,4 @@ export {
15724
15863
  peekCurrentSession,
15725
15864
  readDailySessionPin
15726
15865
  };
15727
- //# sourceMappingURL=chunk-46YPCLWA.js.map
15866
+ //# sourceMappingURL=chunk-APAEM42J.js.map