@integrity-labs/agt-cli 0.28.328 → 0.28.329

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-XRO2EOEM.js";
41
+ } from "../chunk-AOSBSVNB.js";
42
42
  import {
43
43
  AnchorSessionClient,
44
44
  CHANNEL_REGISTRY,
@@ -68,7 +68,7 @@ import {
68
68
  renderTemplate,
69
69
  resolveChannels,
70
70
  serializeManifestForSlackCli
71
- } from "../chunk-GAWNDPGM.js";
71
+ } from "../chunk-J2WYEOBH.js";
72
72
  import "../chunk-XWVM4KPK.js";
73
73
 
74
74
  // src/bin/agt.ts
@@ -4827,7 +4827,7 @@ import { execFileSync, execSync } from "child_process";
4827
4827
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4828
4828
  import chalk18 from "chalk";
4829
4829
  import ora16 from "ora";
4830
- var cliVersion = true ? "0.28.328" : "dev";
4830
+ var cliVersion = true ? "0.28.329" : "dev";
4831
4831
  async function fetchLatestVersion() {
4832
4832
  const host2 = getHost();
4833
4833
  if (!host2) return null;
@@ -5931,7 +5931,7 @@ function handleError(err) {
5931
5931
  }
5932
5932
 
5933
5933
  // src/bin/agt.ts
5934
- var cliVersion2 = true ? "0.28.328" : "dev";
5934
+ var cliVersion2 = true ? "0.28.329" : "dev";
5935
5935
  var program = new Command();
5936
5936
  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");
5937
5937
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -19,7 +19,7 @@ import {
19
19
  resolveConnectivityProbe,
20
20
  worseConnectivityOutcome,
21
21
  wrapScheduledTaskPrompt
22
- } from "./chunk-GAWNDPGM.js";
22
+ } from "./chunk-J2WYEOBH.js";
23
23
  import {
24
24
  parsePsRows
25
25
  } from "./chunk-XWVM4KPK.js";
@@ -2906,6 +2906,39 @@ function provisionStopHook(codeName) {
2906
2906
  ' rm -f "$marker_path" 2>/dev/null || true',
2907
2907
  ' log_ghost "teams RECOVERED conv=$(safe_id "$conversation_id") text_len=${#TEXT}"',
2908
2908
  "}",
2909
+ "# ENG-7814 (ENG-6722 slice E): always-on direct-chat recovery. Re-send the last",
2910
+ "# assistant text to the (unambiguous) session via a direct-chat-recovery-outbox the",
2911
+ "# direct-chat MCP consumes. NO recency/replied_other guard: session_id is unambiguous",
2912
+ "# (one session per marker), so there is no cross-thread mis-correlation risk that the",
2913
+ "# recover_slack_for recency guard exists to prevent. Confirm-before-clear: unlike the",
2914
+ "# slack/telegram/teams recover_*_for above (which rm the marker here), this leaves the",
2915
+ "# marker armed and caps re-fire with a per-marker ledger; the MCP consumer clears the",
2916
+ "# marker only after /host/direct-chat/reply confirms, and removes the ledger entry on",
2917
+ "# success OR failure (re-arm), so a failed re-send retries on a later Stop.",
2918
+ "recover_directchat_for() {",
2919
+ ' local session_id="$1" hex_session="$2"',
2920
+ ' if [ -z "$session_id" ] || [ -z "$hex_session" ]; then return; fi',
2921
+ ' local marker_path=""',
2922
+ " shopt -s nullglob",
2923
+ ' for f in "$DC_MARKER_DIR"/${hex_session}__*.json; do',
2924
+ ' if [ -z "$marker_path" ]; then marker_path="$f"; fi',
2925
+ " done",
2926
+ ' if [ -z "$marker_path" ]; then log_ghost "direct-chat skip=no_pending_marker session=$(safe_id "$session_id")"; return; fi',
2927
+ ' local marker_name; marker_name="$(basename "$marker_path")"',
2928
+ " # Already recovered once and awaiting delivery confirmation \u21D2 do not re-send.",
2929
+ ' if [ -f "${DC_RECOVERY_LEDGER_DIR}/${marker_name}" ]; then log_ghost "direct-chat skip=recovery_in_flight session=$(safe_id "$session_id")"; return; fi',
2930
+ " # Persist the per-marker cap BEFORE the side effect (same fail-safe as",
2931
+ " # block-turn-end): if the ledger dir/file write fails we could re-recover every",
2932
+ " # Stop, so degrade to a logged skip and write no payload.",
2933
+ ' if ! mkdir -p "$DC_RECOVERY_LEDGER_DIR" 2>/dev/null; then log_ghost "direct-chat skip=recovery_ledger_unwritable session=$(safe_id "$session_id")"; return; fi',
2934
+ ' if ! : > "${DC_RECOVERY_LEDGER_DIR}/${marker_name}" 2>/dev/null; then log_ghost "direct-chat skip=recovery_ledger_unwritable session=$(safe_id "$session_id")"; return; fi',
2935
+ " local TS",
2936
+ " TS=$(date -u +%Y%m%dT%H%M%S%N)",
2937
+ ' atomic_write_payload "$DC_RECOVERY_OUTBOX_DIR" "${TS}.json" \\',
2938
+ ` '{session_id:$s, text:$t, marker_name:$mn, source:"ghost-reply-recovery"}' \\`,
2939
+ ' --arg s "$session_id" --arg t "$TEXT" --arg mn "$marker_name"',
2940
+ ' log_ghost "direct-chat RECOVERED session=$(safe_id "$session_id") text_len=${#TEXT}"',
2941
+ "}",
2909
2942
  '# ENG-6467 / ADR-0024 Slice 2.5 \u2014 block-turn-end (the D1 "composed-but-unsent"',
2910
2943
  "# fix), gated dark behind AGT_CHANNEL_BLOCK_TURN_END_ENABLED (registry flag",
2911
2944
  "# channel-block-turn-end; the env var is the operator/canary override the bash",
@@ -2933,6 +2966,21 @@ function provisionStopHook(codeName) {
2933
2966
  'BLOCK_LEDGER_DIR="${AGENT_DIR}/.agt-block-turn-end-ledger"',
2934
2967
  "# GC stale ledger entries (>1 day) so the per-marker cap dir cannot grow unbounded.",
2935
2968
  'if [ -d "$BLOCK_LEDGER_DIR" ]; then find "$BLOCK_LEDGER_DIR" -type f -mtime +1 -delete 2>/dev/null || true; fi',
2969
+ "# ENG-7814 (ENG-6722 slice E): always-on direct-chat recovery. When ON, an owed",
2970
+ "# and unanswered direct-chat inbound that block-turn-end did NOT handle gets its",
2971
+ "# last assistant text written to a direct-chat-recovery-outbox that the direct-chat",
2972
+ "# MCP re-sends via /host/direct-chat/reply. Registry flag direct-chat-recovery; the",
2973
+ "# env var is the operator/host override the bash reads directly. OFF (default) keeps",
2974
+ "# today's behavior (direct-chat gets block-turn-end only, no recovery).",
2975
+ "DC_RECOVERY_ON=0",
2976
+ 'case "${AGT_DIRECT_CHAT_RECOVERY_ENABLED:-}" in true|1|TRUE|True) DC_RECOVERY_ON=1;; esac',
2977
+ 'DC_RECOVERY_OUTBOX_DIR="${AGENT_DIR}/direct-chat-recovery-outbox"',
2978
+ "# Per-marker recovery ledger: caps ONE in-flight recovery per inbound (so a marker",
2979
+ "# left pending for confirm-before-clear is not re-recovered every Stop). The MCP",
2980
+ "# consumer removes the entry on delivery success OR failure (re-arm); we GC stale",
2981
+ "# entries here as a backstop, same as the block ledger.",
2982
+ 'DC_RECOVERY_LEDGER_DIR="${AGENT_DIR}/.agt-direct-chat-recovery-ledger"',
2983
+ 'if [ -d "$DC_RECOVERY_LEDGER_DIR" ]; then find "$DC_RECOVERY_LEDGER_DIR" -type f -mtime +1 -delete 2>/dev/null || true; fi',
2936
2984
  "# Returns 0 (after printing the block JSON to stdout) when it blocked; 1 otherwise.",
2937
2985
  '# $1 = "yes"/"no" \u2014 did the agent reply to THIS conversation in the final turn?',
2938
2986
  "# (ENG-6727: per-conversation, computed by the caller via replied_this_conv_*)",
@@ -3082,14 +3130,12 @@ function provisionStopHook(codeName) {
3082
3130
  " fi",
3083
3131
  ' recover_teams_for "$CONVERSATION_ID" "$REPLY_TO_ID" "$SERVICE_URL"',
3084
3132
  'elif [ "$TAG_SOURCE" = "direct-chat" ]; then',
3085
- " # ENG-7808 (ENG-6722 fm4): direct-chat backstop. BLOCK-TURN-END ONLY - there",
3086
- " # is no direct-chat recovery-outbox yet (that is ENG-7814 / slice E), so when",
3087
- " # block-turn-end is off (or already fired once for this inbound) we log the",
3088
- " # miss and stand down rather than synthesize a recovery. session_id is",
3089
- " # unambiguous (one session per marker), so there is no cross-thread class and",
3090
- " # no recency guard is needed. Previously direct-chat fell through every branch",
3091
- " # to a silent no-op (fenced out by design); it now at least blocks the turn",
3092
- " # end so the model re-sends direct_chat.reply itself when the flag is armed.",
3133
+ " # ENG-7808 (ENG-6722 fm4) + ENG-7814 (slice E): direct-chat backstop. First try",
3134
+ " # block-turn-end (make the MODEL re-send). If that does not fire and the flag",
3135
+ " # direct-chat-recovery is ON, re-send the composed text via the recovery-outbox",
3136
+ " # (ENG-7814). session_id is unambiguous (one session per marker), so there is no",
3137
+ " # cross-thread class and no recency guard is needed. With both off we just log the",
3138
+ " # miss and stand down.",
3093
3139
  ' SESSION_ID=$(extract_attr "$CHANNEL_TAG" "session_id")',
3094
3140
  ' if [ -n "$SESSION_ID" ]; then',
3095
3141
  " shopt -s nullglob",
@@ -3099,7 +3145,13 @@ function provisionStopHook(codeName) {
3099
3145
  " DC_CAND=$(printf '%s\\n' \"${DC_MARKER_DIR}/${HEX_SESSION}__\"*.json)",
3100
3146
  ' DC_REPLIED=no; if replied_this_conv_directchat "$SESSION_ID"; then DC_REPLIED=yes; fi',
3101
3147
  ` if emit_block_if_obligated "$DC_REPLIED" "$DC_CAND" 'direct_chat.reply'; then exit 0; fi`,
3102
- ' if [ "$DC_REPLIED" = "no" ]; then log_ghost "direct-chat skip=no_recovery_path session=$(safe_id "$SESSION_ID") (block-turn-end off/capped; recovery is ENG-7814)"; fi',
3148
+ ' if [ "$DC_REPLIED" = "no" ]; then',
3149
+ ' if [ "$DC_RECOVERY_ON" = "1" ]; then',
3150
+ ' recover_directchat_for "$SESSION_ID" "$HEX_SESSION"',
3151
+ " else",
3152
+ ' log_ghost "direct-chat skip=no_recovery_path session=$(safe_id "$SESSION_ID") (block-turn-end off/capped; direct-chat-recovery off)"',
3153
+ " fi",
3154
+ " fi",
3103
3155
  " fi",
3104
3156
  'elif [ -z "$TAG_SOURCE" ]; then',
3105
3157
  " # ENG-6467: TAG_SOURCE=none fallback (AC1). Guarded on an EMPTY source, not",
@@ -6745,7 +6797,7 @@ function requireHost() {
6745
6797
  }
6746
6798
 
6747
6799
  // src/lib/api-client.ts
6748
- var agtCliVersion = true ? "0.28.328" : "dev";
6800
+ var agtCliVersion = true ? "0.28.329" : "dev";
6749
6801
  var lastConfigHash = null;
6750
6802
  function setConfigHash(hash) {
6751
6803
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -9142,4 +9194,4 @@ export {
9142
9194
  managerInstallSystemUnitCommand,
9143
9195
  managerUninstallSystemUnitCommand
9144
9196
  };
9145
- //# sourceMappingURL=chunk-XRO2EOEM.js.map
9197
+ //# sourceMappingURL=chunk-AOSBSVNB.js.map