@integrity-labs/agt-cli 0.28.237 → 0.28.238

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
@@ -38,7 +38,7 @@ import {
38
38
  success,
39
39
  table,
40
40
  warn
41
- } from "../chunk-DN4HSL6M.js";
41
+ } from "../chunk-D4HUKRER.js";
42
42
  import {
43
43
  CHANNEL_REGISTRY,
44
44
  DEFAULT_FRAMEWORK,
@@ -67,7 +67,7 @@ import {
67
67
  renderTemplate,
68
68
  resolveChannels,
69
69
  serializeManifestForSlackCli
70
- } from "../chunk-PYVEJMY2.js";
70
+ } from "../chunk-P7TUBBQL.js";
71
71
  import "../chunk-XWVM4KPK.js";
72
72
 
73
73
  // src/bin/agt.ts
@@ -4826,7 +4826,7 @@ import { execFileSync, execSync } from "child_process";
4826
4826
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4827
4827
  import chalk18 from "chalk";
4828
4828
  import ora16 from "ora";
4829
- var cliVersion = true ? "0.28.237" : "dev";
4829
+ var cliVersion = true ? "0.28.238" : "dev";
4830
4830
  async function fetchLatestVersion() {
4831
4831
  const host2 = getHost();
4832
4832
  if (!host2) return null;
@@ -5840,7 +5840,7 @@ function handleError(err) {
5840
5840
  }
5841
5841
 
5842
5842
  // src/bin/agt.ts
5843
- var cliVersion2 = true ? "0.28.237" : "dev";
5843
+ var cliVersion2 = true ? "0.28.238" : "dev";
5844
5844
  var program = new Command();
5845
5845
  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");
5846
5846
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -18,7 +18,7 @@ import {
18
18
  resolveConnectivityProbe,
19
19
  worseConnectivityOutcome,
20
20
  wrapScheduledTaskPrompt
21
- } from "./chunk-PYVEJMY2.js";
21
+ } from "./chunk-P7TUBBQL.js";
22
22
  import {
23
23
  parsePsRows
24
24
  } from "./chunk-XWVM4KPK.js";
@@ -2804,6 +2804,15 @@ function provisionStopHook(codeName) {
2804
2804
  "# recovery-outbox. OFF (default / unset) \u21D2 exactly today's behavior.",
2805
2805
  "BLOCK_TURN_END_ON=0",
2806
2806
  'case "${AGT_CHANNEL_BLOCK_TURN_END_ENABLED:-}" in true|1|TRUE|True) BLOCK_TURN_END_ON=1;; esac',
2807
+ "# WS3 (ENG-7397): block-turn-end-all-markers. When ON (and channel-block-turn-end",
2808
+ "# is also ON), the block scan covers EVERY pending marker across all sources, not",
2809
+ "# just the last-tagged conversation, so an agent that owes replies to several",
2810
+ "# threads at once is blocked until it answers all of them (with WS2 it answers",
2811
+ "# each by inbound_id). Registry flag block-turn-end-all-markers; the env var is",
2812
+ "# the operator/canary override the bash reads directly. OFF (default) leaves the",
2813
+ "# single-marker last-tag behavior exactly as-is.",
2814
+ "BLOCK_ALL_MARKERS_ON=0",
2815
+ 'case "${AGT_BLOCK_TURN_END_ALL_MARKERS_ENABLED:-}" in true|1|TRUE|True) BLOCK_ALL_MARKERS_ON=1;; esac',
2807
2816
  `STOP_ACTIVE=$(echo "$INPUT" | jq -r '.stop_hook_active // false' 2>/dev/null || echo false)`,
2808
2817
  'BLOCK_LEDGER_DIR="${AGENT_DIR}/.agt-block-turn-end-ledger"',
2809
2818
  "# GC stale ledger entries (>1 day) so the per-marker cap dir cannot grow unbounded.",
@@ -2852,11 +2861,76 @@ function provisionStopHook(codeName) {
2852
2861
  ` jq -cn --arg r "$reason" '{decision:"block", reason:$r}'`,
2853
2862
  " return 0",
2854
2863
  "}",
2864
+ "# WS3 (ENG-7397): the multi-marker generalization of emit_block_if_obligated.",
2865
+ "# Enumerates EVERY pending marker across all three source dirs, drops the",
2866
+ "# discretionary/undeliverable ones (same fail-safe defaults) and the ones already",
2867
+ "# answered THIS turn (per-marker replied_this_conv_* on the marker's own coords),",
2868
+ "# and - when 1+ obligated-and-unanswered markers survive and NONE was already",
2869
+ "# blocked once - writes a ledger entry for each and emits ONE block enumerating",
2870
+ "# every owed conversation by inbound_id + source + safe key (never content).",
2871
+ "# Marker-semantics-neutral: arms/clears no markers, only decides WHEN to block.",
2872
+ "# Returns 0 (after printing the block JSON) when it blocked; 1 otherwise.",
2873
+ "emit_block_all_obligated() {",
2874
+ ' if [ "$BLOCK_TURN_END_ON" != "1" ] || [ "$BLOCK_ALL_MARKERS_ON" != "1" ]; then return 1; fi',
2875
+ ' if [ "$STOP_ACTIVE" = "true" ]; then return 1; fi',
2876
+ " local -a owed_paths=()",
2877
+ ' local owed_lines="" owed_count=0 any_capped=0 entry src dir m d u replied ch th cid conv iid key led_name',
2878
+ ' for entry in "slack:$SL_MARKER_DIR" "telegram:$TG_MARKER_DIR" "msteams:$MS_MARKER_DIR"; do',
2879
+ ' src="${entry%%:*}"; dir="${entry#*:}"',
2880
+ ' if [ ! -d "$dir" ]; then continue; fi',
2881
+ " shopt -s nullglob",
2882
+ ' for m in "$dir"/*.json; do',
2883
+ ' if [ ! -f "$m" ]; then continue; fi',
2884
+ ` d=$(jq -r '.discretionary // false' "$m" 2>/dev/null || echo true)`,
2885
+ ` u=$(jq -r '.undeliverable // false' "$m" 2>/dev/null || echo true)`,
2886
+ ' if [ "$d" = "true" ] || [ "$u" = "true" ]; then continue; fi',
2887
+ ' replied=no; ch=""; th=""; cid=""; conv=""',
2888
+ ' case "$src" in',
2889
+ ` slack) ch=$(jq -r '.channel // ""' "$m" 2>/dev/null || echo ""); th=$(jq -r '.thread_ts // ""' "$m" 2>/dev/null || echo ""); if replied_this_conv_slack "$ch" "$th"; then replied=yes; fi ;;`,
2890
+ ` telegram) cid=$(jq -r '.chat_id // ""' "$m" 2>/dev/null || echo ""); if replied_this_conv_telegram "$cid"; then replied=yes; fi ;;`,
2891
+ ` msteams) conv=$(jq -r '.conversation_id // ""' "$m" 2>/dev/null || echo ""); if replied_this_conv_teams "$conv"; then replied=yes; fi ;;`,
2892
+ " esac",
2893
+ ' if [ "$replied" = "yes" ]; then continue; fi',
2894
+ ' led_name="$(basename "$m")"',
2895
+ ' if [ -f "${BLOCK_LEDGER_DIR}/${led_name}" ]; then any_capped=1; fi',
2896
+ ` iid=$(jq -r '.inbound_id // ""' "$m" 2>/dev/null || echo "")`,
2897
+ ' case "$src" in',
2898
+ ' slack) key="thread=$(safe_id "$th")" ;;',
2899
+ ' telegram) key="chat=$(safe_id "$cid")" ;;',
2900
+ ' msteams) key="conv=$(safe_id "$conv")" ;;',
2901
+ ' *) key="" ;;',
2902
+ " esac",
2903
+ " owed_count=$((owed_count + 1))",
2904
+ ' if [ -n "$iid" ]; then owed_lines="${owed_lines}${owed_count}) source=${src} inbound_id=${iid} ${key}; "; else owed_lines="${owed_lines}${owed_count}) source=${src} ${key}; "; fi',
2905
+ ' owed_paths+=("$m")',
2906
+ " done",
2907
+ " done",
2908
+ ' if [ "$owed_count" = "0" ]; then return 1; fi',
2909
+ " # Block only when NONE of the owed markers was already blocked once - a capped",
2910
+ " # marker means the model already ignored a block for it, so fall through to the",
2911
+ " # per-source recovery instead of re-blocking.",
2912
+ ' if [ "$any_capped" = "1" ]; then echo "agt-ghost-reply-hook: block-turn-end-all degraded (an owed marker already blocked) - falling through to recovery" >&2; return 1; fi',
2913
+ ' if ! mkdir -p "$BLOCK_LEDGER_DIR" 2>/dev/null; then echo "agt-ghost-reply-hook: block-turn-end-all degraded (ledger dir create failed) - falling through" >&2; return 1; fi',
2914
+ " local p",
2915
+ ' for p in "${owed_paths[@]}"; do',
2916
+ ' if ! : > "${BLOCK_LEDGER_DIR}/$(basename "$p")" 2>/dev/null; then echo "agt-ghost-reply-hook: block-turn-end-all degraded (ledger write failed) - falling through" >&2; return 1; fi',
2917
+ " done",
2918
+ ' echo "agt-ghost-reply-hook: block-turn-end-all FIRED count=${owed_count}" >&2',
2919
+ ' local reason="You have ${owed_count} conversation(s) you did not answer this turn; the people are waiting and will see only silence. Reply to EACH now with its reply tool, passing its inbound_id so your answer lands in the right thread (never answer one conversation in a different thread). Owed: ${owed_lines}Actually send each answer via the tool; do not just summarize what you intended to say."',
2920
+ ` jq -cn --arg r "$reason" '{decision:"block", reason:$r}'`,
2921
+ " return 0",
2922
+ "}",
2855
2923
  "# Strict correlation: only recover if the last channel tag in the",
2856
2924
  "# transcript points at a channel/key that has an exact-match pending",
2857
2925
  "# marker. No tag found \u2192 skip; let timeout handle it. Block-turn-end (when",
2858
2926
  "# armed) runs FIRST per source; if it blocks we exit before recovery so the",
2859
2927
  "# two mechanisms never both fire on one Stop.",
2928
+ "# WS3: when block-turn-end-all-markers is armed, try the multi-marker block",
2929
+ "# FIRST - it covers every owed conversation, not just the last tag. It self-gates",
2930
+ "# on both flags (returns 1 when off), so this call is a no-op unless armed. If it",
2931
+ "# blocks we exit; otherwise fall through to the per-source single-marker path,",
2932
+ "# which still handles the last-tagged conversation.",
2933
+ "if emit_block_all_obligated; then exit 0; fi",
2860
2934
  'if [ "$TAG_SOURCE" = "telegram" ]; then',
2861
2935
  ' CHAT_ID=$(extract_attr "$CHANNEL_TAG" "chat_id")',
2862
2936
  ' MSG_ID=$(extract_attr "$CHANNEL_TAG" "message_id")',
@@ -5720,7 +5794,7 @@ function requireHost() {
5720
5794
  }
5721
5795
 
5722
5796
  // src/lib/api-client.ts
5723
- var agtCliVersion = true ? "0.28.237" : "dev";
5797
+ var agtCliVersion = true ? "0.28.238" : "dev";
5724
5798
  var lastConfigHash = null;
5725
5799
  function setConfigHash(hash) {
5726
5800
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -7813,4 +7887,4 @@ export {
7813
7887
  managerInstallSystemUnitCommand,
7814
7888
  managerUninstallSystemUnitCommand
7815
7889
  };
7816
- //# sourceMappingURL=chunk-DN4HSL6M.js.map
7890
+ //# sourceMappingURL=chunk-D4HUKRER.js.map