@integrity-labs/agt-cli 0.16.2 → 0.16.6

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
@@ -48,7 +48,7 @@ import {
48
48
  success,
49
49
  table,
50
50
  warn
51
- } from "../chunk-MEJGM5RV.js";
51
+ } from "../chunk-PBHUXNV6.js";
52
52
 
53
53
  // src/bin/agt.ts
54
54
  import { join as join10 } from "path";
@@ -3732,7 +3732,7 @@ import { execFileSync, execSync } from "child_process";
3732
3732
  import { existsSync as existsSync5, realpathSync } from "fs";
3733
3733
  import chalk17 from "chalk";
3734
3734
  import ora15 from "ora";
3735
- var cliVersion = true ? "0.16.2" : "dev";
3735
+ var cliVersion = true ? "0.16.6" : "dev";
3736
3736
  async function fetchLatestVersion() {
3737
3737
  const host2 = getHost();
3738
3738
  if (!host2) return null;
@@ -4190,7 +4190,7 @@ function handleError(err) {
4190
4190
  }
4191
4191
 
4192
4192
  // src/bin/agt.ts
4193
- var cliVersion2 = true ? "0.16.2" : "dev";
4193
+ var cliVersion2 = true ? "0.16.6" : "dev";
4194
4194
  var program = new Command();
4195
4195
  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");
4196
4196
  program.hook("preAction", (thisCommand) => {
@@ -3190,24 +3190,25 @@ function provisionStopHook(codeName) {
3190
3190
  const hookScript = [
3191
3191
  "#!/bin/bash",
3192
3192
  "# Auto-generated by Augmented \u2014 captures persistent session task results.",
3193
- "set -euo pipefail",
3193
+ "set -uo pipefail",
3194
+ `trap 'ec=$?; echo "agt-stop-hook failed (exit $ec) at line $LINENO: $BASH_COMMAND" >&2' ERR`,
3194
3195
  "INPUT=$(cat)",
3195
3196
  `TRANSCRIPT_PATH=$(echo "$INPUT" | jq -r '.transcript_path // empty')`,
3196
- '[ -z "$TRANSCRIPT_PATH" ] || [ ! -f "$TRANSCRIPT_PATH" ] && exit 0',
3197
+ 'if [ -z "$TRANSCRIPT_PATH" ] || [ ! -f "$TRANSCRIPT_PATH" ]; then exit 0; fi',
3197
3198
  `CWD=$(echo "$INPUT" | jq -r '.cwd // empty')`,
3198
3199
  'MARKER="${CWD}/.claude/.agt-pending-task.json"',
3199
- '[ ! -f "$MARKER" ] && exit 0',
3200
+ 'if [ ! -f "$MARKER" ]; then exit 0; fi',
3200
3201
  `AGENT_ID=$(jq -r '.agent_id // empty' "$MARKER")`,
3201
3202
  `TEMPLATE_ID=$(jq -r '.template_id // empty' "$MARKER")`,
3202
- '[ -z "$AGENT_ID" ] && { rm -f "$MARKER"; exit 0; }',
3203
- `RESP=$(tail -50 "$TRANSCRIPT_PATH" | jq -rs '[.[] | select(.type == "assistant") | .message.content[]? | select(.type == "text") | .text] | last // empty' 2>/dev/null)`,
3204
- `[ -z "$RESP" ] && RESP=$(tail -50 "$TRANSCRIPT_PATH" | jq -rs '[.[] | select(.role == "assistant") | .content[]? | select(.type == "text") | .text] | last // empty' 2>/dev/null)`,
3205
- '[ -z "$RESP" ] && { rm -f "$MARKER"; exit 0; }',
3203
+ 'if [ -z "$AGENT_ID" ]; then rm -f "$MARKER"; exit 0; fi',
3204
+ `RESP=$(tail -50 "$TRANSCRIPT_PATH" | jq -rs '[.[] | select(.type == "assistant") | .message.content[]? | select(.type == "text") | .text] | last // empty' 2>/dev/null || true)`,
3205
+ `if [ -z "$RESP" ]; then RESP=$(tail -50 "$TRANSCRIPT_PATH" | jq -rs '[.[] | select(.role == "assistant") | .content[]? | select(.type == "text") | .text] | last // empty' 2>/dev/null || true); fi`,
3206
+ 'if [ -z "$RESP" ]; then rm -f "$MARKER"; exit 0; fi',
3206
3207
  'rm -f "$MARKER"',
3207
3208
  'AGT_HOST="${AGT_HOST:-}"; AGT_API_KEY="${AGT_API_KEY:-}"',
3208
- '[ -z "$AGT_HOST" ] || [ -z "$AGT_API_KEY" ] && exit 0',
3209
- 'JWT=$(curl -sf -X POST "${AGT_HOST}/host/exchange" -H "Content-Type: application/json" -d "{\\"api_key\\": \\"${AGT_API_KEY}\\"}" | jq -r \'.token // empty\' 2>/dev/null)',
3210
- '[ -z "$JWT" ] && exit 0',
3209
+ 'if [ -z "$AGT_HOST" ] || [ -z "$AGT_API_KEY" ]; then exit 0; fi',
3210
+ 'JWT=$(curl -sf -X POST "${AGT_HOST}/host/exchange" -H "Content-Type: application/json" -d "{\\"api_key\\": \\"${AGT_API_KEY}\\"}" | jq -r \'.token // empty\' 2>/dev/null || true)',
3211
+ 'if [ -z "$JWT" ]; then exit 0; fi',
3211
3212
  'case "$TEMPLATE_ID" in',
3212
3213
  " daily-standup|standup|weekly-standup)",
3213
3214
  ` curl -sf -X POST "\${AGT_HOST}/host/agent-status" -H "Content-Type: application/json" -H "Authorization: Bearer $JWT" -d "$(jq -n --arg a \\"$AGENT_ID\\" --arg s \\"$RESP\\" '{agent_id:$a,standup:$s,current_status:"idle"}')" >/dev/null 2>&1 & ;;`,
@@ -3222,13 +3223,19 @@ function provisionStopHook(codeName) {
3222
3223
  "#!/bin/bash",
3223
3224
  "# Auto-generated by Augmented (ENG-4569) \u2014 detects ghost replies and",
3224
3225
  "# drops recovery files in the channel outbox dirs. Runs on every Stop.",
3225
- "set -euo pipefail",
3226
+ "# ENG-4660: switched off `set -e` and converted `[ test ] && exit 0`",
3227
+ "# guards to explicit `if`/`then`/`fi`. The old form silently exited",
3228
+ "# non-zero whenever the test was false (the common case), producing the",
3229
+ '# "No stderr output" stop-hook errors. ERR trap reports any unexpected',
3230
+ "# failure to stderr so future regressions surface immediately.",
3231
+ "set -uo pipefail",
3232
+ `trap 'ec=$?; echo "agt-ghost-reply-hook failed (exit $ec) at line $LINENO: $BASH_COMMAND" >&2' ERR`,
3226
3233
  "INPUT=$(cat)",
3227
3234
  `TRANSCRIPT_PATH=$(echo "$INPUT" | jq -r '.transcript_path // empty')`,
3228
- '[ -z "$TRANSCRIPT_PATH" ] || [ ! -f "$TRANSCRIPT_PATH" ] && exit 0',
3235
+ 'if [ -z "$TRANSCRIPT_PATH" ] || [ ! -f "$TRANSCRIPT_PATH" ]; then exit 0; fi',
3229
3236
  `CWD=$(echo "$INPUT" | jq -r '.cwd // empty')`,
3230
3237
  `CODE_NAME=$(echo "$CWD" | sed -nE 's|.*/\\.augmented/([^/]+)/project/?$|\\1|p')`,
3231
- '[ -z "$CODE_NAME" ] && exit 0',
3238
+ 'if [ -z "$CODE_NAME" ]; then exit 0; fi',
3232
3239
  'AGENT_DIR="$(dirname "$CWD")"',
3233
3240
  'TG_MARKER_DIR="${AGENT_DIR}/telegram-pending-inbound"',
3234
3241
  'SL_MARKER_DIR="${AGENT_DIR}/slack-pending-inbound"',
@@ -3240,29 +3247,29 @@ function provisionStopHook(codeName) {
3240
3247
  "# If the tag isn't found, skip recovery \u2014 the timeout will catch it.",
3241
3248
  "pending_markers_count() {",
3242
3249
  ' local dir="$1"',
3243
- ' [ ! -d "$dir" ] && echo 0 && return',
3250
+ ' if [ ! -d "$dir" ]; then echo 0; return; fi',
3244
3251
  " shopt -s nullglob",
3245
3252
  ' local files=("$dir"/*.json)',
3246
3253
  ' echo "${#files[@]}"',
3247
3254
  "}",
3248
3255
  'TG_PENDING=$(pending_markers_count "$TG_MARKER_DIR")',
3249
3256
  'SL_PENDING=$(pending_markers_count "$SL_MARKER_DIR")',
3250
- '[ "$TG_PENDING" = "0" ] && [ "$SL_PENDING" = "0" ] && exit 0',
3251
- `LAST_ASSISTANT=$(tail -200 "$TRANSCRIPT_PATH" | jq -cs '[.[] | select(.type == "assistant" or .role == "assistant")] | last // empty' 2>/dev/null)`,
3252
- '[ -z "$LAST_ASSISTANT" ] || [ "$LAST_ASSISTANT" = "null" ] && exit 0',
3253
- `TEXT=$(echo "$LAST_ASSISTANT" | jq -r '(.message.content // .content // []) | map(select(.type == "text") | .text) | join("\\n\\n")' 2>/dev/null)`,
3257
+ 'if [ "$TG_PENDING" = "0" ] && [ "$SL_PENDING" = "0" ]; then exit 0; fi',
3258
+ `LAST_ASSISTANT=$(tail -200 "$TRANSCRIPT_PATH" | jq -cs '[.[] | select(.type == "assistant" or .role == "assistant")] | last // empty' 2>/dev/null || true)`,
3259
+ 'if [ -z "$LAST_ASSISTANT" ] || [ "$LAST_ASSISTANT" = "null" ]; then exit 0; fi',
3260
+ `TEXT=$(echo "$LAST_ASSISTANT" | jq -r '(.message.content // .content // []) | map(select(.type == "text") | .text) | join("\\n\\n")' 2>/dev/null || true)`,
3254
3261
  "# Strip whitespace and bail only on truly-empty (vs the previous <4-char",
3255
3262
  '# threshold that dropped legit short replies like "ok", "yes", emoji).',
3256
- '[ -z "${TEXT//[[:space:]]/}" ] && exit 0',
3263
+ 'if [ -z "${TEXT//[[:space:]]/}" ]; then exit 0; fi',
3257
3264
  `TOOL_NAMES=$(echo "$LAST_ASSISTANT" | jq -r '(.message.content // .content // []) | map(select(.type == "tool_use") | .name) | .[]' 2>/dev/null || true)`,
3258
3265
  "# Find the LAST <channel ...> tag in user/notification turns. Channel",
3259
3266
  "# notifications are forwarded into the session as text containing this",
3260
3267
  "# tag (slack-channel.ts:1247 / telegram-channel.ts:776 emit content +",
3261
3268
  "# meta which Claude Code wraps in a <channel ...> preamble). Searching",
3262
3269
  "# the raw text gives us the exact pending conversation key.",
3263
- `CHANNEL_TAG=$(tail -400 "$TRANSCRIPT_PATH" | jq -r '(.message.content // .content // []) | map(select(.type == "text") | .text) | join(" ")' 2>/dev/null | grep -oE '<channel [^>]+>' | tail -1)`,
3270
+ `CHANNEL_TAG=$(tail -400 "$TRANSCRIPT_PATH" | jq -r '(.message.content // .content // []) | map(select(.type == "text") | .text) | join(" ")' 2>/dev/null | grep -oE '<channel [^>]+>' | tail -1 || true)`,
3264
3271
  'TAG_SOURCE=""',
3265
- `[ -n "$CHANNEL_TAG" ] && TAG_SOURCE=$(echo "$CHANNEL_TAG" | grep -oE 'source="[^"]+"' | head -1 | sed 's/source="\\(.*\\)"/\\1/')`,
3272
+ `if [ -n "$CHANNEL_TAG" ]; then TAG_SOURCE=$(echo "$CHANNEL_TAG" | grep -oE 'source="[^"]+"' | head -1 | sed 's/source="\\(.*\\)"/\\1/' || true); fi`,
3266
3273
  'extract_attr() { echo "$1" | grep -oE "$2=\\"[^\\"]+\\"" | head -1 | sed -E "s/$2=\\"(.*)\\"/\\\\1/"; }',
3267
3274
  "# Atomic write helper: jq \u2192 tmp file in same dir, then rename. The",
3268
3275
  "# channel-side fs.watch only fires on rename, so the file is never",
@@ -3280,13 +3287,13 @@ function provisionStopHook(codeName) {
3280
3287
  `safe_id() { echo -n "$1" | sed -E 's|[^A-Za-z0-9_-]|_|g'; }`,
3281
3288
  "recover_telegram_for() {",
3282
3289
  ' local chat_id="$1" msg_id="$2"',
3283
- ' [ -z "$chat_id" ] || [ -z "$msg_id" ] && return',
3290
+ ' if [ -z "$chat_id" ] || [ -z "$msg_id" ]; then return; fi',
3284
3291
  " # If the agent DID call telegram.reply this turn, no recovery needed.",
3285
- ` echo "$TOOL_NAMES" | grep -qE '^(telegram\\.reply|telegram\\.send_message)$' && return`,
3292
+ ` if echo "$TOOL_NAMES" | grep -qE '^(telegram\\.reply|telegram\\.send_message)$'; then return; fi`,
3286
3293
  " local marker_name",
3287
3294
  ' marker_name="$(safe_id "$chat_id")__$(safe_id "$msg_id").json"',
3288
3295
  ' local marker_path="${TG_MARKER_DIR}/${marker_name}"',
3289
- ' [ ! -f "$marker_path" ] && return',
3296
+ ' if [ ! -f "$marker_path" ]; then return; fi',
3290
3297
  " local TS",
3291
3298
  " TS=$(date -u +%Y%m%dT%H%M%S%N)",
3292
3299
  ' atomic_write_payload "${AGENT_DIR}/telegram-recovery-outbox" "${TS}.json" \\',
@@ -3296,9 +3303,9 @@ function provisionStopHook(codeName) {
3296
3303
  "}",
3297
3304
  "recover_slack_for() {",
3298
3305
  ' local channel="$1" thread_ts="$2"',
3299
- ' [ -z "$channel" ] && return',
3306
+ ' if [ -z "$channel" ]; then return; fi',
3300
3307
  " # If the agent DID call slack.reply this turn, no recovery needed.",
3301
- ` echo "$TOOL_NAMES" | grep -qE '^slack\\.reply$' && return`,
3308
+ ` if echo "$TOOL_NAMES" | grep -qE '^slack\\.reply$'; then return; fi`,
3302
3309
  " # Find any marker for this channel+thread (in busy threads multiple",
3303
3310
  " # message_ts entries can be pending \u2014 recover the oldest, that's the",
3304
3311
  " # one closest to firing the timeout).",
@@ -3306,9 +3313,9 @@ function provisionStopHook(codeName) {
3306
3313
  ' local marker_path=""',
3307
3314
  " shopt -s nullglob",
3308
3315
  ' for f in "$SL_MARKER_DIR"/${prefix}*.json; do',
3309
- ' [ -z "$marker_path" ] && marker_path="$f"',
3316
+ ' if [ -z "$marker_path" ]; then marker_path="$f"; fi',
3310
3317
  " done",
3311
- ' [ -z "$marker_path" ] && return',
3318
+ ' if [ -z "$marker_path" ]; then return; fi',
3312
3319
  " local TS",
3313
3320
  " TS=$(date -u +%Y%m%dT%H%M%S%N)",
3314
3321
  ' atomic_write_payload "${AGENT_DIR}/slack-recovery-outbox" "${TS}.json" \\',
@@ -3535,9 +3542,7 @@ function buildSettingsJson(input) {
3535
3542
  tools_version: toolsFrontmatter.version
3536
3543
  }
3537
3544
  };
3538
- if (agent.primary_model) {
3539
- settings["model"] = agent.primary_model;
3540
- }
3545
+ settings["model"] = agent.primary_model || "claude-opus-4-7";
3541
3546
  const projectDir = getProjectDir(agent.code_name);
3542
3547
  const agentDir = getAgentDir(agent.code_name);
3543
3548
  const homeDir = getHomeDir3();
@@ -7646,4 +7651,4 @@ export {
7646
7651
  managerInstallCommand,
7647
7652
  managerUninstallCommand
7648
7653
  };
7649
- //# sourceMappingURL=chunk-MEJGM5RV.js.map
7654
+ //# sourceMappingURL=chunk-PBHUXNV6.js.map