@@ -54,48 +54,33 @@ has_session_for_workdir() {
5454 if [ -d " $project_sessions_dir " ]; then
5555 for file in " $project_sessions_dir " /* .jsonl; do
5656 [ -f " $file " ] || continue
57-
5857 if grep -q ' "type":"user"' " $file " 2> /dev/null; then
59- local user_msg_count=$( grep -c ' "type":"user"' " $file " 2> /dev/null || echo " 0" )
60- local warmup_count=$( grep -c ' "content":"Warmup"' " $file " 2> /dev/null || echo " 0" )
61-
62- if [ " $user_msg_count " -gt " $warmup_count " ]; then
58+ if grep -q ' "isSidechain":false' " $file " 2> /dev/null; then
6359 return 0
6460 fi
6561 fi
6662 done
6763 fi
68-
6964 return 1
7065}
7166
7267ARGS=()
7368
74- function build_claude_args() {
69+ function start_agentapi() {
70+ mkdir -p " $ARG_WORKDIR "
71+ cd " $ARG_WORKDIR "
72+
7573 if [ -n " $ARG_MODEL " ]; then
7674 ARGS+=(--model " $ARG_MODEL " )
7775 fi
7876
79- if [ -n " $ARG_RESUME_SESSION_ID " ]; then
80- ARGS+=(--resume " $ARG_RESUME_SESSION_ID " )
81- fi
82-
83- if [ " $ARG_CONTINUE " = " true" ]; then
84- ARGS+=(--continue)
85- fi
86-
8777 if [ -n " $ARG_PERMISSION_MODE " ]; then
8878 ARGS+=(--permission-mode " $ARG_PERMISSION_MODE " )
8979 fi
9080
91- }
92-
93- function start_agentapi() {
94- mkdir -p " $ARG_WORKDIR "
95- cd " $ARG_WORKDIR "
96-
9781 if [ -n " $ARG_RESUME_SESSION_ID " ]; then
9882 echo " Using explicit resume_session_id: $ARG_RESUME_SESSION_ID "
83+ ARGS+=(--resume " $ARG_RESUME_SESSION_ID " )
9984 if [ -n " $ARG_DANGEROUSLY_SKIP_PERMISSIONS " ]; then
10085 ARGS+=(--dangerously-skip-permissions)
10186 fi
@@ -137,5 +122,4 @@ function start_agentapi() {
137122}
138123
139124validate_claude_installation
140- build_claude_args
141125start_agentapi
0 commit comments