@integrity-labs/agt-cli 0.28.572 → 0.28.573

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,7 +40,7 @@ import {
40
40
  success,
41
41
  table,
42
42
  warn
43
- } from "../chunk-NG2MFOSH.js";
43
+ } from "../chunk-GW2JI7NO.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -71,7 +71,7 @@ import {
71
71
  requiredMcpWildcard,
72
72
  resolveChannels,
73
73
  serializeManifestForSlackCli
74
- } from "../chunk-72K46XUZ.js";
74
+ } from "../chunk-5Z6RJ3RX.js";
75
75
  import "../chunk-XWVM4KPK.js";
76
76
 
77
77
  // src/bin/agt.ts
@@ -4853,7 +4853,7 @@ import { execFileSync, execSync } from "child_process";
4853
4853
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4854
4854
  import chalk18 from "chalk";
4855
4855
  import ora16 from "ora";
4856
- var cliVersion = true ? "0.28.572" : "dev";
4856
+ var cliVersion = true ? "0.28.573" : "dev";
4857
4857
  async function fetchLatestVersion() {
4858
4858
  const host2 = getHost();
4859
4859
  if (!host2) return null;
@@ -6028,7 +6028,7 @@ function handleError(err) {
6028
6028
  }
6029
6029
 
6030
6030
  // src/bin/agt.ts
6031
- var cliVersion2 = true ? "0.28.572" : "dev";
6031
+ var cliVersion2 = true ? "0.28.573" : "dev";
6032
6032
  var program = new Command();
6033
6033
  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");
6034
6034
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -6112,6 +6112,28 @@ var SCOPE_DEFICIT_ERROR_PATTERNS = [
6112
6112
  "write_content",
6113
6113
  "sales channel is not enabled"
6114
6114
  ];
6115
+ var QUOTA_EXHAUSTED_ERROR_PATTERNS = [
6116
+ "resource_exhausted",
6117
+ "resource has been exhausted",
6118
+ "rate limit",
6119
+ "rate_limit",
6120
+ "ratelimit",
6121
+ "ratescope",
6122
+ "rate_scope",
6123
+ "too many requests",
6124
+ "quota exceeded",
6125
+ "quota_exceeded",
6126
+ "quotaexceeded",
6127
+ "quota error",
6128
+ "quotaerror",
6129
+ "quota_error",
6130
+ "exceeded your quota",
6131
+ "out of quota",
6132
+ "insufficient quota",
6133
+ "check quota",
6134
+ "usage limit",
6135
+ "daily limit exceeded"
6136
+ ];
6115
6137
  function isReadonlyToolDescriptor(t) {
6116
6138
  if (!t?.name)
6117
6139
  return false;
@@ -6168,9 +6190,47 @@ function isScopeDeficitError(message) {
6168
6190
  return true;
6169
6191
  return m.includes("scope") && ["doesn't have", "does not have", "not have the", "not granted", "lacks the", "not authorized for"].some((p2) => m.includes(p2));
6170
6192
  }
6193
+ function isQuotaExhaustedError(message) {
6194
+ const m = message.toLowerCase();
6195
+ if (QUOTA_EXHAUSTED_ERROR_PATTERNS.some((p2) => m.includes(p2)))
6196
+ return true;
6197
+ if (/\b429\s+client error/.test(m))
6198
+ return true;
6199
+ return /(status(?:_?code)?|http_?status(?:_code)?|mercury_last_http_status_code|["'\\]code)["'\\\s]*[:=]["'\\\s]*429\b/.test(m);
6200
+ }
6201
+ function extractRetryAfterSeconds(message) {
6202
+ const m = message.toLowerCase();
6203
+ const patterns = [
6204
+ /retry\s+in\s+(\d+)\s*(?:s\b|sec\b|secs\b|second)/,
6205
+ /retry[-_ ]?after["'\\\s]*[:=]["'\\\s]*(\d+)/,
6206
+ /retry_?delay["'\\\s]*[:=]["'\\\s]*"?(\d+)s?/
6207
+ ];
6208
+ for (const re of patterns) {
6209
+ const hit = re.exec(m);
6210
+ if (!hit?.[1])
6211
+ continue;
6212
+ const seconds = Number(hit[1]);
6213
+ if (Number.isFinite(seconds) && seconds > 0)
6214
+ return seconds;
6215
+ }
6216
+ return null;
6217
+ }
6218
+ function formatRetryWindow(seconds) {
6219
+ if (seconds < 90)
6220
+ return `${seconds} seconds`;
6221
+ const minutes = seconds / 60;
6222
+ if (minutes < 90)
6223
+ return `about ${Math.round(minutes)} minutes`;
6224
+ const hours = minutes / 60;
6225
+ if (hours < 24)
6226
+ return `about ${Math.round(hours * 10) / 10} hours`;
6227
+ return `about ${Math.round(hours / 24 * 10) / 10} days`;
6228
+ }
6171
6229
  function classifyToolCallFailure(text) {
6172
6230
  if (isAccountResolutionError(text))
6173
6231
  return "account";
6232
+ if (isQuotaExhaustedError(text))
6233
+ return "quota";
6174
6234
  if (isScopeDeficitError(text))
6175
6235
  return "scope";
6176
6236
  if (isUpstreamAuthError(text))
@@ -6298,6 +6358,19 @@ async function probeComposioMcpToolCall(config, fetchImpl = fetch) {
6298
6358
  details: baseDetails
6299
6359
  };
6300
6360
  }
6361
+ if (kind === "quota") {
6362
+ const retryAfterSeconds = extractRetryAfterSeconds(failureText);
6363
+ const retryPhrase = retryAfterSeconds ? ` The provider says to retry in ${formatRetryWindow(retryAfterSeconds)}.` : "";
6364
+ return {
6365
+ status: "degraded",
6366
+ message: `Live tool call '${toolName}' reached the provider and was refused: a quota or rate limit is exhausted. The connection itself is valid \u2014 do NOT reconnect, this resolves when the window resets.${retryPhrase} ${snippet}`,
6367
+ details: {
6368
+ ...baseDetails,
6369
+ reason: "quota_exhausted",
6370
+ ...retryAfterSeconds ? { retry_after_seconds: retryAfterSeconds } : {}
6371
+ }
6372
+ };
6373
+ }
6301
6374
  if (kind === "scope") {
6302
6375
  return {
6303
6376
  status: "degraded",
@@ -6319,7 +6392,11 @@ async function probeComposioMcpToolCall(config, fetchImpl = fetch) {
6319
6392
  details: { ...baseDetails, reason: "site_unresolved" }
6320
6393
  };
6321
6394
  }
6322
- return { status: "ok", message: `Live tool call '${toolName}' resolved the account (tool error: ${snippet})`, details: baseDetails };
6395
+ return {
6396
+ status: "ok",
6397
+ message: `Live tool call '${toolName}' resolved the account (tool error: ${snippet})`,
6398
+ details: { ...baseDetails, tool_error: snippet }
6399
+ };
6323
6400
  }
6324
6401
  return { status: "ok", message: `Live tool call '${toolName}' resolved the connected account`, details: baseDetails };
6325
6402
  } catch (err) {
@@ -10439,7 +10516,7 @@ var FLAG_REGISTRY = [
10439
10516
  },
10440
10517
  {
10441
10518
  key: "direct-chat-per-user",
10442
- description: "Scope a STANDARD agent's Direct Chat to the user who had the conversation (ENG-8712). Today two teammates who open the same agent land in the same thread and read each other's messages: the /recent and per-session reads carry no user predicate unless the agent is the per-org system_support concierge. When on, both reads return only sessions the requester authored in PLUS sessions no user has authored in \u2014 the second arm is load-bearing, since every server-originated row (kanban and scheduled-task nudges, integration failures, HITL approvals, degradation alerts) is written as role=user with no user_id and would otherwise vanish from every console (ENG-8431). Does NOT make the thread private in the live direction: assistant replies still fan out on the per-TEAM realtime topic direct-chat-agent:{agentId}, so a teammate holding the drawer open still receives them. Narrowing that topic is follow-up work.",
10519
+ description: "Scope a STANDARD agent's Direct Chat to the user who had the conversation (ENG-8712). Today two teammates who open the same agent land in the same thread and read each other's messages: the /recent and per-session reads carry no user predicate unless the agent is the per-org system_support concierge. When on, both reads return only sessions the requester authored in PLUS sessions no user has authored in \u2014 the second arm is load-bearing, since every server-originated row (kanban and scheduled-task nudges, integration failures, HITL approvals, degradation alerts) is written as role=user with no user_id and would otherwise vanish from every console (ENG-8431). Does NOT by itself make the thread private in the live direction: assistant replies fan out on the per-TEAM realtime topic direct-chat-agent:{agentId}, so a teammate holding the drawer open still receives them. That half is direct-chat-live-per-user (ENG-8760), which is a SEPARATE flag on purpose \u2014 turn both on for a private thread.",
10443
10520
  flagType: "boolean",
10444
10521
  // Declared safe value is `false` — today's team-wide thread. Server-side only
10445
10522
  // (the two reads in routes/agents.ts); the browser needs no knowledge of it,
@@ -10452,6 +10529,27 @@ var FLAG_REGISTRY = [
10452
10529
  // backfill in migration 20260812000006 is not reversed by the flag.
10453
10530
  defaultValue: false
10454
10531
  },
10532
+ {
10533
+ key: "direct-chat-live-per-user",
10534
+ description: "The LIVE half of per-user Direct Chat (ENG-8760). direct-chat-per-user scoped the two REST reads; assistant replies kept fanning out on the per-TEAM realtime topic direct-chat-agent:{agentId}, whose RLS (20260804000003) has no session and no user predicate \u2014 so a teammate holding the drawer open still received another member's replies live, and only a reload hid them. When on, a reply in a session a human has authored in is broadcast to direct-chat-user:{agentId}:{userId} instead, whose policy (20260812000009) pins the third segment to auth.uid(). Sessions NO human has authored in \u2014 the agent's inbound work queue: kanban and scheduled-task nudges, integration failures, HITL approvals, degradation alerts \u2014 keep going to the per-TEAM topic, matching arm 2 of the REST read, or this would repeat ENG-8431 in the live lane. Also admits the system_support concierge to the per-user topic, which the per-TEAM topic denies outright (its live delivery is additive here, never narrowed).",
10535
+ flagType: "boolean",
10536
+ // Declared safe value is `false` — today's per-TEAM fan-out, byte for byte,
10537
+ // for every agent kind including the concierge. Server-side only: the browser
10538
+ // subscribes to BOTH topics unconditionally and needs no knowledge of the
10539
+ // flag, so NOT public — which is also what keeps client and server from
10540
+ // disagreeing about it. No envVar: an org/team-scoped rollout gate with no
10541
+ // host-side consumer, and a declared envVar pinned in sst.config.ts would
10542
+ // make every admin-UI override unreachable (ENG-8303).
10543
+ //
10544
+ // DELIBERATELY INDEPENDENT of direct-chat-per-user. The two are separable in
10545
+ // both directions and neither ordering is unsafe: this one alone narrows live
10546
+ // delivery below what the REST read still serves (a teammate can load the
10547
+ // thread but stops receiving it live), and that one alone is the state
10548
+ // ENG-8712 shipped. Coupling them into one switch would have removed the
10549
+ // ability to soak the live change on an org that is already comfortable with
10550
+ // the read change.
10551
+ defaultValue: false
10552
+ },
10455
10553
  {
10456
10554
  key: "onboarding-auto-deploy",
10457
10555
  description: `Auto-deploy the first agent during onboarding (ENG-7378): the agent edit page's Deploy & Test tab fires the existing deploy (draft -> active) automatically once the agent's host is fully deployed (active + manager heartbeating, not provisioning) AND Claude-authenticated (claude_auth_status=valid), replacing the manual "Deploy Agent" click in the recruit funnel. Only draft, non-system_support agents; a failed or timed-out attempt falls back to the manual button (no auto-retry loop).`,
@@ -15832,4 +15930,4 @@ export {
15832
15930
  stopAllSessionsAndWait,
15833
15931
  getProjectDir
15834
15932
  };
15835
- //# sourceMappingURL=chunk-72K46XUZ.js.map
15933
+ //# sourceMappingURL=chunk-5Z6RJ3RX.js.map