@termhub/agent 0.5.2 → 0.5.3

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.
Files changed (2) hide show
  1. package/dist/cli.js +13 -4
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -693,6 +693,15 @@ if [ "$KIND_REST" != "$EVENT" ]; then
693
693
  else
694
694
  KIND=
695
695
  fi
696
+ # A subagent's event (Claude Code 2.1.69+) carries an "agent_id" key before its own "hook_event_name" \u2014
697
+ # the order is session_id, transcript_path, cwd, prompt_id, permission_mode, agent_id, agent_type,
698
+ # hook_event_name, \u2026 \u2014 and the main thread's never does. Only that prefix is searched, and only for the
699
+ # key form: a value holding the text "agent_id": would have its quotes escaped. The reduced bodies below
700
+ # carry the flag; the server never lets a subagent's event close a card (spec 2026-09-26 \xA74.5). The
701
+ # dedupe marker ignores it.
702
+ BEFORE_KIND=\${EVENT%%'"hook_event_name"'*}
703
+ SUB=
704
+ case "$BEFORE_KIND" in *'"agent_id":'*) SUB=',"subagent":true' ;; esac
696
705
  case "$KIND" in
697
706
  PreToolUse)
698
707
  # The event's own tool name is the FIRST "tool_name" of the payload (Claude Code serialises it
@@ -742,9 +751,9 @@ case "$KIND" in
742
751
  [ "$(cat "$MARK" 2>/dev/null)" = "$KEY" ] && exit 0
743
752
  printf '%s' "$KEY" 2>/dev/null > "$MARK"
744
753
  if [ -n "$VERB" ]; then
745
- EVENT=$(printf '{"hook_event_name":"PreToolUse","tool_name":"%s","verb":"%s"}' "$NAME" "$VERB")
754
+ EVENT=$(printf '{"hook_event_name":"PreToolUse","tool_name":"%s","verb":"%s"%s}' "$NAME" "$VERB" "$SUB")
746
755
  else
747
- EVENT=$(printf '{"hook_event_name":"PreToolUse","tool_name":"%s"}' "$NAME")
756
+ EVENT=$(printf '{"hook_event_name":"PreToolUse","tool_name":"%s"%s}' "$NAME" "$SUB")
748
757
  fi
749
758
  fi
750
759
  ;;
@@ -757,7 +766,7 @@ case "$KIND" in
757
766
  REST=\${REST#*'"'}
758
767
  NAME=\${REST%%'"'*}
759
768
  case "$NAME" in '' | *[!A-Za-z0-9_.-]* | AskUserQuestion) exit 0 ;; esac
760
- EVENT=$(printf '{"hook_event_name":"PermissionRequest","tool_name":"%s"}' "$NAME")
769
+ EVENT=$(printf '{"hook_event_name":"PermissionRequest","tool_name":"%s"%s}' "$NAME" "$SUB")
761
770
  ;;
762
771
  # A new turn starts fresh, and so does an answered notification: a permission prompt takes the tab
763
772
  # out of working, and the tool the person approves is the same one that set the marker, so without
@@ -2317,7 +2326,7 @@ async function status3() {
2317
2326
  }
2318
2327
 
2319
2328
  // src/version.ts
2320
- var AGENT_VERSION = "0.5.2";
2329
+ var AGENT_VERSION = "0.5.3";
2321
2330
 
2322
2331
  // src/rpc/update.ts
2323
2332
  var PACKAGE = "@termhub/agent";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@termhub/agent",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Agente do termhub: conecta esta máquina ao servidor por WebSocket de saída (sem SSH) e expõe os terminais tmux no navegador.",
5
5
  "license": "MIT",
6
6
  "private": false,