@saadnvd1/agent-os 0.3.551 → 0.3.552

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.
@@ -82,6 +82,25 @@ EOF
82
82
  case "$out" in '{"hookSpecificOutput"'*) printf '%s\n' "$out" ;; esac
83
83
  }
84
84
 
85
+ # No approvals mode: AgentOS answers a permission request with Claude's own
86
+ # allow decision, and says nothing when the mode is off. Prints the decision
87
+ # and returns 0 only when it was given.
88
+ autoallow() {
89
+ where="${AGENTOS_URL:-http://127.0.0.1:3011}/api/approvals/hook?session=$AGENTOS_SESSION_ID"
90
+ auth=
91
+ [ -z "$AGENTOS_TOKEN" ] ||
92
+ auth="header = \"Authorization: Bearer $AGENTOS_TOKEN\""
93
+ out=$(printf '%s' "$input" | curl -s --max-time 2 -K /dev/fd/3 \
94
+ -H 'Content-Type: application/json' --data-binary @- "$where" 2>/dev/null 3<<EOF
95
+ $auth
96
+ EOF
97
+ )
98
+ case "$out" in
99
+ '{"hookSpecificOutput"'*) printf '%s\n' "$out"; return 0 ;;
100
+ esac
101
+ return 1
102
+ }
103
+
85
104
  # Commands that take down every session on the machine, the agent's own
86
105
  # included. Inside tmux, $TMUX names the real server and wins over
87
106
  # TMUX_TMPDIR, so `tmux kill-server` there kills it; only an explicit -S or -L
@@ -126,7 +145,12 @@ case "$event" in
126
145
  esac
127
146
  ;;
128
147
  # Claude asks permission for its own questions too: still a question.
129
- PermissionRequest) asking ;;
148
+ PermissionRequest)
149
+ case "$(field tool_name)" in
150
+ AskUserQuestion) asking ;;
151
+ *) autoallow && report "state=working" || asking ;;
152
+ esac
153
+ ;;
130
154
  Notification)
131
155
  message=$(field message)
132
156
  # PermissionRequest already said which tool; older Claude Code versions