@integrity-labs/agt-cli 0.28.421 → 0.28.422

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-HVVEMQWZ.js";
43
+ } from "../chunk-6JC5YLU5.js";
44
44
  import {
45
45
  AnchorSessionClient,
46
46
  CHANNEL_REGISTRY,
@@ -70,7 +70,7 @@ import {
70
70
  renderTemplate,
71
71
  resolveChannels,
72
72
  serializeManifestForSlackCli
73
- } from "../chunk-B4NX2T2H.js";
73
+ } from "../chunk-XFC7YVGS.js";
74
74
  import "../chunk-XWVM4KPK.js";
75
75
 
76
76
  // src/bin/agt.ts
@@ -4829,7 +4829,7 @@ import { execFileSync, execSync } from "child_process";
4829
4829
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4830
4830
  import chalk18 from "chalk";
4831
4831
  import ora16 from "ora";
4832
- var cliVersion = true ? "0.28.421" : "dev";
4832
+ var cliVersion = true ? "0.28.422" : "dev";
4833
4833
  async function fetchLatestVersion() {
4834
4834
  const host2 = getHost();
4835
4835
  if (!host2) return null;
@@ -6001,7 +6001,7 @@ function handleError(err) {
6001
6001
  }
6002
6002
 
6003
6003
  // src/bin/agt.ts
6004
- var cliVersion2 = true ? "0.28.421" : "dev";
6004
+ var cliVersion2 = true ? "0.28.422" : "dev";
6005
6005
  var program = new Command();
6006
6006
  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");
6007
6007
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -25,7 +25,7 @@ import {
25
25
  resolveConnectivityProbe,
26
26
  worseConnectivityOutcome,
27
27
  wrapScheduledTaskPrompt
28
- } from "./chunk-B4NX2T2H.js";
28
+ } from "./chunk-XFC7YVGS.js";
29
29
  import {
30
30
  parsePsRows
31
31
  } from "./chunk-XWVM4KPK.js";
@@ -2392,6 +2392,17 @@ function provisionStopHook(codeName) {
2392
2392
  'chmod 600 "$RECENT_FILE" 2>/dev/null || true',
2393
2393
  `trap 'rm -f "$RECENT_FILE" 2>/dev/null || true' EXIT`,
2394
2394
  'tail -400 "$TRANSCRIPT_PATH" > "$RECENT_FILE" 2>/dev/null || true',
2395
+ "# ENG-8142: collect the tool_use ids whose tool_result came back",
2396
+ "# `is_error: true`. A REFUSED reply is not a delivered reply, but the",
2397
+ "# replied_this_conv_* predicates below only ever saw the tool_use half of",
2398
+ '# the pair, so any errored exit read as "the agent replied" \u2014 returning',
2399
+ "# early before the recovery outbox is written AND setting SL_REPLIED=yes so",
2400
+ "# emit_block_if_obligated skipped the owed-reply re-prompt. Both halves of",
2401
+ "# the safety net stood down and the human just saw silence. slack.reply",
2402
+ "# alone has eight isError branches, so this is a whole class, not one bug.",
2403
+ "# Computed once here (not per predicate) to hold the ENG-6288 budget of a",
2404
+ "# single jq pass over the snapshot.",
2405
+ `ERRORED_TOOL_IDS=$(jq -r '(.message.content // .content // []) | if type=="array" then .[] else empty end | select((type=="object") and (.type=="tool_result") and (.is_error==true)) | (.tool_use_id // empty)' "$RECENT_FILE" 2>/dev/null | sort -u || true)`,
2395
2406
  `LAST_ASSISTANT=$(jq -cs '[.[] | select(.type == "assistant" or .role == "assistant")] | last // empty' "$RECENT_FILE" 2>/dev/null || true)`,
2396
2407
  'if [ -z "$LAST_ASSISTANT" ] || [ "$LAST_ASSISTANT" = "null" ]; then exit 0; fi',
2397
2408
  "# Assistant content is array-shaped today; normalize anyway so a shape",
@@ -2467,19 +2478,24 @@ function provisionStopHook(codeName) {
2467
2478
  "# (the chronic sherlock symptom). These scope the check to the conversation",
2468
2479
  "# keyed by the inbound tag, comparing the reply tool's input against it.",
2469
2480
  '# Output "yes"/"no" (never a jq nonzero exit) to stay clear of the ERR trap.',
2481
+ "# ENG-8142: `$bad` is the errored-tool_use id set; a tool_use whose id is in",
2482
+ "# it was REFUSED, so it must not count as a reply. A tool_use with no `.id`",
2483
+ "# cannot be correlated and deliberately still counts as a reply \u2014 that is the",
2484
+ "# pre-ENG-8142 behaviour, and it is the safe direction, because the failure",
2485
+ "# mode of guessing the other way is double-delivering to the customer.",
2470
2486
  "replied_this_conv_slack() {",
2471
2487
  ' local channel="$1" thread_ts="$2" hit',
2472
- ` hit=$(printf '%s' "$LAST_ASSISTANT" | jq -r --arg ch "$channel" --arg th "$thread_ts" '(.message.content // .content // []) | (if type=="array" then . else [] end) | (if any(.[]; (type=="object") and (.type=="tool_use") and ((.name|tostring)|test("(^|__)slack[._]reply$")) and ((.input.channel // "") as $c | (.input.thread_ts // "") as $t | (.input.message_ts // "") as $m | (($th != "" and ($t==$th or $m==$th)) or ($th=="" and $c!="" and $c==$ch)))) then "yes" else "no" end)' 2>/dev/null || echo no)`,
2488
+ ` hit=$(printf '%s' "$LAST_ASSISTANT" | jq -r --arg ch "$channel" --arg th "$thread_ts" --arg errids "$ERRORED_TOOL_IDS" '(($errids // "") | split("\\n") | map(select(length > 0))) as $bad | (.message.content // .content // []) | (if type=="array" then . else [] end) | (if any(.[]; (type=="object") and (.type=="tool_use") and ((.name|tostring)|test("(^|__)slack[._]reply$")) and ((.id // "") as $tid | ($bad | index($tid)) == null) and ((.input.channel // "") as $c | (.input.thread_ts // "") as $t | (.input.message_ts // "") as $m | (($th != "" and ($t==$th or $m==$th)) or ($th=="" and $c!="" and $c==$ch)))) then "yes" else "no" end)' 2>/dev/null || echo no)`,
2473
2489
  ' [ "$hit" = "yes" ]',
2474
2490
  "}",
2475
2491
  "replied_this_conv_telegram() {",
2476
2492
  ' local chat_id="$1" hit',
2477
- ` hit=$(printf '%s' "$LAST_ASSISTANT" | jq -r --arg cid "$chat_id" '(.message.content // .content // []) | (if type=="array" then . else [] end) | (if any(.[]; (type=="object") and (.type=="tool_use") and ((.name|tostring)|test("(^|__)telegram[._](reply|send_message)$")) and (((.input.chat_id // "")|tostring)==$cid)) then "yes" else "no" end)' 2>/dev/null || echo no)`,
2493
+ ` hit=$(printf '%s' "$LAST_ASSISTANT" | jq -r --arg cid "$chat_id" --arg errids "$ERRORED_TOOL_IDS" '(($errids // "") | split("\\n") | map(select(length > 0))) as $bad | (.message.content // .content // []) | (if type=="array" then . else [] end) | (if any(.[]; (type=="object") and (.type=="tool_use") and ((.name|tostring)|test("(^|__)telegram[._](reply|send_message)$")) and ((.id // "") as $tid | ($bad | index($tid)) == null) and (((.input.chat_id // "")|tostring)==$cid)) then "yes" else "no" end)' 2>/dev/null || echo no)`,
2478
2494
  ' [ "$hit" = "yes" ]',
2479
2495
  "}",
2480
2496
  "replied_this_conv_teams() {",
2481
2497
  ' local conversation_id="$1" hit',
2482
- ` hit=$(printf '%s' "$LAST_ASSISTANT" | jq -r --arg cid "$conversation_id" '(.message.content // .content // []) | (if type=="array" then . else [] end) | (if any(.[]; (type=="object") and (.type=="tool_use") and ((.name|tostring)|test("(^|__)teams[._]reply$")) and (((.input.conversation_id // "")|tostring)==$cid)) then "yes" else "no" end)' 2>/dev/null || echo no)`,
2498
+ ` hit=$(printf '%s' "$LAST_ASSISTANT" | jq -r --arg cid "$conversation_id" --arg errids "$ERRORED_TOOL_IDS" '(($errids // "") | split("\\n") | map(select(length > 0))) as $bad | (.message.content // .content // []) | (if type=="array" then . else [] end) | (if any(.[]; (type=="object") and (.type=="tool_use") and ((.name|tostring)|test("(^|__)teams[._]reply$")) and ((.id // "") as $tid | ($bad | index($tid)) == null) and (((.input.conversation_id // "")|tostring)==$cid)) then "yes" else "no" end)' 2>/dev/null || echo no)`,
2483
2499
  ' [ "$hit" = "yes" ]',
2484
2500
  "}",
2485
2501
  '# ENG-7808 (ENG-6722 fm4): "did the agent reply to THIS direct-chat session in',
@@ -6011,7 +6027,7 @@ function requireHost() {
6011
6027
  }
6012
6028
 
6013
6029
  // src/lib/api-client.ts
6014
- var agtCliVersion = true ? "0.28.421" : "dev";
6030
+ var agtCliVersion = true ? "0.28.422" : "dev";
6015
6031
  var lastConfigHash = null;
6016
6032
  function setConfigHash(hash) {
6017
6033
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -8515,4 +8531,4 @@ export {
8515
8531
  managerInstallSystemUnitCommand,
8516
8532
  managerUninstallSystemUnitCommand
8517
8533
  };
8518
- //# sourceMappingURL=chunk-HVVEMQWZ.js.map
8534
+ //# sourceMappingURL=chunk-6JC5YLU5.js.map