@integrity-labs/agt-cli 0.28.478 → 0.28.479

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-RBMN5KPX.js";
43
+ } from "../chunk-MLA5NJWV.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -4830,7 +4830,7 @@ import { execFileSync, execSync } from "child_process";
4830
4830
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4831
4831
  import chalk18 from "chalk";
4832
4832
  import ora16 from "ora";
4833
- var cliVersion = true ? "0.28.478" : "dev";
4833
+ var cliVersion = true ? "0.28.479" : "dev";
4834
4834
  async function fetchLatestVersion() {
4835
4835
  const host2 = getHost();
4836
4836
  if (!host2) return null;
@@ -6002,7 +6002,7 @@ function handleError(err) {
6002
6002
  }
6003
6003
 
6004
6004
  // src/bin/agt.ts
6005
- var cliVersion2 = true ? "0.28.478" : "dev";
6005
+ var cliVersion2 = true ? "0.28.479" : "dev";
6006
6006
  var program = new Command();
6007
6007
  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");
6008
6008
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -4932,7 +4932,7 @@ function exchangeFailureKind(err) {
4932
4932
  }
4933
4933
 
4934
4934
  // src/lib/api-client.ts
4935
- var agtCliVersion = true ? "0.28.478" : "dev";
4935
+ var agtCliVersion = true ? "0.28.479" : "dev";
4936
4936
  var lastConfigHash = null;
4937
4937
  function setConfigHash(hash) {
4938
4938
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -7661,4 +7661,4 @@ export {
7661
7661
  managerInstallSystemUnitCommand,
7662
7662
  managerUninstallSystemUnitCommand
7663
7663
  };
7664
- //# sourceMappingURL=chunk-RBMN5KPX.js.map
7664
+ //# sourceMappingURL=chunk-MLA5NJWV.js.map
@@ -44,7 +44,7 @@ import {
44
44
  resolveEffectivePinRaw,
45
45
  safeWriteJsonAtomic,
46
46
  setConfigHash
47
- } from "../chunk-RBMN5KPX.js";
47
+ } from "../chunk-MLA5NJWV.js";
48
48
  import {
49
49
  getProjectDir as getProjectDir2,
50
50
  getReadyTasks,
@@ -10064,7 +10064,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
10064
10064
  var lastVersionCheckAt = 0;
10065
10065
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
10066
10066
  var lastResponsivenessProbeAt = 0;
10067
- var agtCliVersion = true ? "0.28.478" : "dev";
10067
+ var agtCliVersion = true ? "0.28.479" : "dev";
10068
10068
  function resolveBrewPath(execFileSync2) {
10069
10069
  try {
10070
10070
  const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -36228,6 +36228,31 @@ import { createHash } from "crypto";
36228
36228
  function shouldArmWatch(opts) {
36229
36229
  return !opts.isBot && opts.replyOwed;
36230
36230
  }
36231
+ function decideUsageLimitCursorCall(opts) {
36232
+ if (opts.throttled) {
36233
+ return {
36234
+ route: "/host/direct-chat/consume",
36235
+ body: {
36236
+ agent_id: opts.agentId,
36237
+ session_id: opts.sessionId,
36238
+ message_ids: [opts.messageId]
36239
+ }
36240
+ };
36241
+ }
36242
+ return {
36243
+ route: "/host/direct-chat/reply",
36244
+ body: {
36245
+ agent_id: opts.agentId,
36246
+ session_id: opts.sessionId,
36247
+ content: opts.noticeText,
36248
+ message_ids: [opts.messageId],
36249
+ // ENG-8274: a cap refusal is the SYSTEM speaking, not the agent.
36250
+ // Orthogonal to message_ids — consuming the cursor is about delivery,
36251
+ // `kind` is about who authored this and whether a reply is owed.
36252
+ kind: "notice"
36253
+ }
36254
+ };
36255
+ }
36231
36256
  function describeUnparsedRefusal(text) {
36232
36257
  if (!text) return "refusal=absent";
36233
36258
  const hash = createHash("sha256").update(text).digest("hex").slice(0, 12);
@@ -36962,17 +36987,13 @@ function armUsageLimitWatch(args) {
36962
36987
  cooldownMs: DIRECT_CHAT_MAINTENANCE_COOLDOWN_MS,
36963
36988
  now: Date.now()
36964
36989
  });
36965
- const route = throttle.reply ? "/host/direct-chat/reply" : "/host/direct-chat/consume";
36966
- const body = throttle.reply ? {
36967
- agent_id: AGT_AGENT_ID,
36968
- session_id: args.sessionId,
36969
- content: buildUsageLimitReplyText(refusal.resetsAt),
36970
- message_ids: [args.messageId],
36971
- // ENG-8274: a cap refusal is the SYSTEM speaking, not the agent.
36972
- // Orthogonal to message_ids — consuming the cursor is about delivery,
36973
- // `kind` is about who authored this and whether a reply is owed.
36974
- kind: "notice"
36975
- } : { agent_id: AGT_AGENT_ID, session_id: args.sessionId, message_ids: [args.messageId] };
36990
+ const { route, body } = decideUsageLimitCursorCall({
36991
+ throttled: !throttle.reply,
36992
+ agentId: AGT_AGENT_ID,
36993
+ sessionId: args.sessionId,
36994
+ messageId: args.messageId,
36995
+ noticeText: buildUsageLimitReplyText(refusal.resetsAt)
36996
+ });
36976
36997
  const res = await apiPost(route, body);
36977
36998
  const data = await res.json().catch(() => ({}));
36978
36999
  if (res.ok && data.error == null) {
@@ -36959,6 +36959,18 @@ function decideRefusalAction(opts) {
36959
36959
  if (!refusal.resetsAt) return "missing-reset";
36960
36960
  return "notify";
36961
36961
  }
36962
+ function describeNoticeOutcome(outcome) {
36963
+ switch (outcome) {
36964
+ case "posted":
36965
+ return "reported";
36966
+ case "throttled":
36967
+ return "notice throttled";
36968
+ case "failed":
36969
+ return "notice failed";
36970
+ case "skipped":
36971
+ return "no notice (unaddressable)";
36972
+ }
36973
+ }
36962
36974
  function describeUnparsedRefusal(text) {
36963
36975
  if (!text) return "refusal=absent";
36964
36976
  const hash = createHash("sha256").update(text).digest("hex").slice(0, 12);
@@ -39943,8 +39955,8 @@ async function maybeSendMaintenanceNotice(args) {
39943
39955
  }
39944
39956
  var SLACK_USAGE_LIMIT_NOTICE_CACHE = /* @__PURE__ */ new Map();
39945
39957
  async function maybeSendUsageLimitNotice(args) {
39946
- if (!BOT_TOKEN) return;
39947
- if (!args.channel || !args.senderId) return;
39958
+ if (!BOT_TOKEN) return "skipped";
39959
+ if (!args.channel || !args.senderId) return "skipped";
39948
39960
  const key2 = `${args.channel}|${args.senderId}|usage_limit`;
39949
39961
  const decision = decideDeclineReply({
39950
39962
  cache: SLACK_USAGE_LIMIT_NOTICE_CACHE,
@@ -39957,7 +39969,7 @@ async function maybeSendUsageLimitNotice(args) {
39957
39969
  `slack-channel(${AGENT_CODE_NAME}): usage-limit notice suppressed by cooldown (channel=${redactSlackId(args.channel)}, sender=${redactSlackId(args.senderId)}, remaining=${decision.remainingMs}ms)
39958
39970
  `
39959
39971
  );
39960
- return;
39972
+ return "throttled";
39961
39973
  }
39962
39974
  const controller = new AbortController();
39963
39975
  const timeoutId = setTimeout(() => controller.abort(), 1e4);
@@ -39982,7 +39994,16 @@ async function maybeSendUsageLimitNotice(args) {
39982
39994
  `slack-channel(${AGENT_CODE_NAME}): usage-limit notice post failed: ${data.error ?? "unknown"}
39983
39995
  `
39984
39996
  );
39997
+ return "failed";
39985
39998
  }
39999
+ return "posted";
40000
+ } catch (err) {
40001
+ SLACK_USAGE_LIMIT_NOTICE_CACHE.delete(key2);
40002
+ process.stderr.write(
40003
+ `slack-channel(${AGENT_CODE_NAME}): usage-limit notice failed: ${err.message}
40004
+ `
40005
+ );
40006
+ return "failed";
39986
40007
  } finally {
39987
40008
  clearTimeout(timeoutId);
39988
40009
  }
@@ -40002,7 +40023,7 @@ function armSlackUsageLimitWatch(args) {
40002
40023
  }
40003
40024
  const resetsAt = refusal?.resetsAt;
40004
40025
  if (!resetsAt) return;
40005
- await maybeSendUsageLimitNotice({
40026
+ const outcome = await maybeSendUsageLimitNotice({
40006
40027
  channel: args.channel,
40007
40028
  senderId: args.senderId,
40008
40029
  threadTs: args.threadTs,
@@ -40012,7 +40033,7 @@ function armSlackUsageLimitWatch(args) {
40012
40033
  clearSlackPendingMarkerByMessageTs2(args.channel, args.messageTs);
40013
40034
  }
40014
40035
  process.stderr.write(
40015
- `slack-channel(${AGENT_CODE_NAME}): [usage-limit-reactive] reported refusal for channel=${redactSlackId(args.channel)} ts=${redactSlackId(args.messageTs)} resets=${resetsAt.toISOString()}
40036
+ `slack-channel(${AGENT_CODE_NAME}): [usage-limit-reactive] ${describeNoticeOutcome(outcome)} refusal for channel=${redactSlackId(args.channel)} ts=${redactSlackId(args.messageTs)} resets=${resetsAt.toISOString()}
40016
40037
  `
40017
40038
  );
40018
40039
  } catch (err) {
@@ -37767,6 +37767,18 @@ function decideRefusalAction(opts) {
37767
37767
  if (!refusal.resetsAt) return "missing-reset";
37768
37768
  return "notify";
37769
37769
  }
37770
+ function describeNoticeOutcome(outcome) {
37771
+ switch (outcome) {
37772
+ case "posted":
37773
+ return "reported";
37774
+ case "throttled":
37775
+ return "notice throttled";
37776
+ case "failed":
37777
+ return "notice failed";
37778
+ case "skipped":
37779
+ return "no notice (unaddressable)";
37780
+ }
37781
+ }
37770
37782
  function describeUnparsedRefusal(text) {
37771
37783
  if (!text) return "refusal=absent";
37772
37784
  const hash = createHash("sha256").update(text).digest("hex").slice(0, 12);
@@ -38996,7 +39008,7 @@ async function maybeSendTelegramMaintenanceNotice(args) {
38996
39008
  }
38997
39009
  var TELEGRAM_USAGE_LIMIT_NOTICE_CACHE = /* @__PURE__ */ new Map();
38998
39010
  async function maybeSendTelegramUsageLimitNotice(args) {
38999
- if (args.senderId === void 0) return;
39011
+ if (args.senderId === void 0) return "skipped";
39000
39012
  const key2 = `${args.chatId}|${args.senderId}|usage_limit`;
39001
39013
  const decision = decideDeclineReply({
39002
39014
  cache: TELEGRAM_USAGE_LIMIT_NOTICE_CACHE,
@@ -39009,7 +39021,7 @@ async function maybeSendTelegramUsageLimitNotice(args) {
39009
39021
  `telegram-channel(${AGENT_CODE_NAME}): usage-limit notice suppressed by cooldown (chat=${redactId(String(args.chatId))}, remaining=${decision.remainingMs}ms)
39010
39022
  `
39011
39023
  );
39012
- return;
39024
+ return "throttled";
39013
39025
  }
39014
39026
  try {
39015
39027
  const resp = await telegramApiCall(
@@ -39027,13 +39039,16 @@ async function maybeSendTelegramUsageLimitNotice(args) {
39027
39039
  `telegram-channel(${AGENT_CODE_NAME}): usage-limit notice rejected (chat=${redactId(String(args.chatId))}): ${resp.description ?? "unknown"}
39028
39040
  `
39029
39041
  );
39042
+ return "failed";
39030
39043
  }
39044
+ return "posted";
39031
39045
  } catch (err) {
39032
39046
  TELEGRAM_USAGE_LIMIT_NOTICE_CACHE.delete(key2);
39033
39047
  process.stderr.write(
39034
39048
  `telegram-channel(${AGENT_CODE_NAME}): usage-limit notice failed: ${err.message}
39035
39049
  `
39036
39050
  );
39051
+ return "failed";
39037
39052
  }
39038
39053
  }
39039
39054
  function armTelegramUsageLimitWatch(args) {
@@ -39051,7 +39066,7 @@ function armTelegramUsageLimitWatch(args) {
39051
39066
  }
39052
39067
  const resetsAt = refusal?.resetsAt;
39053
39068
  if (!resetsAt) return;
39054
- await maybeSendTelegramUsageLimitNotice({
39069
+ const outcome = await maybeSendTelegramUsageLimitNotice({
39055
39070
  chatId: args.chatId,
39056
39071
  senderId: args.senderId,
39057
39072
  ...args.messageThreadId != null ? { messageThreadId: args.messageThreadId } : {},
@@ -39059,7 +39074,7 @@ function armTelegramUsageLimitWatch(args) {
39059
39074
  });
39060
39075
  clearPendingMessage(args.chatId, args.sinceMs);
39061
39076
  process.stderr.write(
39062
- `telegram-channel(${AGENT_CODE_NAME}): [usage-limit-reactive] reported refusal for chat=${redactId(args.chatId)} resets=${resetsAt.toISOString()}
39077
+ `telegram-channel(${AGENT_CODE_NAME}): [usage-limit-reactive] ${describeNoticeOutcome(outcome)} refusal for chat=${redactId(args.chatId)} resets=${resetsAt.toISOString()}
39063
39078
  `
39064
39079
  );
39065
39080
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.478",
3
+ "version": "0.28.479",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {