File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,24 @@ ai_load_agent_configuration() {
2121 # return 0
2222 # fi
2323
24- # Return early if not the first shell level
25- # if (( ${SHLVL:-0} != 1 )); then
26- # [[ ${AGENT_DEBUG:-} -eq 1 ]] && echo "Not first shell level, returning"
27- # return 1
28- # fi
24+ # Check expected SHLVL for each agent type, we want to know if the logic here changes
25+ local shlvl="${SHLVL:-0}"
26+ if [[ -n "${CURSOR_AGENT:-}" ]]; then
27+ # Cursor should use SHLVL=3
28+ if [[ "$shlvl" != "3" ]]; then
29+ echo -e "\033[33mWarning: Cursor agent with unexpected SHLVL=$shlvl (expected 3)\033[0m"
30+ fi
31+ elif [[ "${VSCODE_AGENT:-}" == "1" ]]; then
32+ # VS Code should use SHLVL=1
33+ if [[ "$shlvl" != "1" ]]; then
34+ echo -e "\033[33mWarning: VS Code agent with unexpected SHLVL=$shlvl (expected 1)\033[0m"
35+ fi
36+ else
37+ # Other agents should use SHLVL=1
38+ if [[ "$shlvl" != "1" ]]; then
39+ echo -e "\033[33mWarning: Agent with unexpected SHLVL=$shlvl (expected 1)\033[0m"
40+ fi
41+ fi
2942
3043 # VS Code does not operate the same as Cursor: terminals are interactive, not dumb, and no ENV var is set to indicate
3144 # it's being managed by an agent. We manually set a variable in our VCS config to indicate this.
You can’t perform that action at this time.
0 commit comments