agentk8 1.0.0 → 1.0.2
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/README.md +5 -3
- package/agentk +16 -14
- package/bin/agentk-wrapper.js +0 -0
- package/lib/core.sh +30 -20
- package/lib/ipc.sh +5 -3
- package/lib/spawn.sh +123 -119
- package/lib/ui.sh +5 -3
- package/lib/visual.sh +6 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,19 +64,21 @@ curl -sSL https://raw.githubusercontent.com/de5truct0/agentk/main/install.sh | b
|
|
|
64
64
|
### Homebrew (macOS/Linux)
|
|
65
65
|
```bash
|
|
66
66
|
brew tap de5truct0/agentk
|
|
67
|
-
brew install
|
|
67
|
+
brew install agentk8
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
### npm
|
|
71
71
|
```bash
|
|
72
|
-
npm install -g
|
|
72
|
+
npm install -g agentk8
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
### pip
|
|
76
76
|
```bash
|
|
77
|
-
pip install
|
|
77
|
+
pip install agentk8
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
+
> **Note**: Package name is `agentk8` on all registries. The installed command is `agentk`.
|
|
81
|
+
|
|
80
82
|
### From Source
|
|
81
83
|
```bash
|
|
82
84
|
git clone https://github.com/de5truct0/agentk.git
|
package/agentk
CHANGED
|
@@ -8,14 +8,14 @@ set -euo pipefail
|
|
|
8
8
|
# INITIALIZATION
|
|
9
9
|
# =============================================================================
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
export AGENTK_ROOT="$
|
|
11
|
+
_AGENTK_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
12
|
+
export AGENTK_ROOT="$_AGENTK_SCRIPT_DIR"
|
|
13
13
|
|
|
14
|
-
# Source libraries
|
|
15
|
-
source "$
|
|
16
|
-
source "$
|
|
17
|
-
source "$
|
|
18
|
-
source "$
|
|
14
|
+
# Source libraries (use AGENTK_ROOT to avoid variable scope issues)
|
|
15
|
+
source "$AGENTK_ROOT/lib/core.sh"
|
|
16
|
+
source "$AGENTK_ROOT/lib/ui.sh"
|
|
17
|
+
source "$AGENTK_ROOT/lib/ipc.sh"
|
|
18
|
+
source "$AGENTK_ROOT/lib/spawn.sh"
|
|
19
19
|
|
|
20
20
|
# =============================================================================
|
|
21
21
|
# CONFIGURATION
|
|
@@ -186,19 +186,21 @@ handle_command() {
|
|
|
186
186
|
cmd_status() {
|
|
187
187
|
print_section "Agent Status"
|
|
188
188
|
|
|
189
|
-
local agents
|
|
189
|
+
local agents
|
|
190
190
|
case "$AGENTK_MODE" in
|
|
191
|
-
dev) agents=
|
|
192
|
-
ml) agents=
|
|
191
|
+
dev) agents="orchestrator engineer tester security scout" ;;
|
|
192
|
+
ml) agents="orchestrator researcher ml-engineer data-engineer evaluator scout" ;;
|
|
193
193
|
esac
|
|
194
194
|
|
|
195
|
-
for agent in
|
|
195
|
+
for agent in $agents; do
|
|
196
196
|
local status
|
|
197
197
|
status=$(get_agent_status "$agent")
|
|
198
198
|
local message=""
|
|
199
|
+
local task_id
|
|
200
|
+
task_id=$(_get_agent_task "$agent" 2>/dev/null || echo "")
|
|
199
201
|
|
|
200
|
-
if [[ -n "$
|
|
201
|
-
message=$(get_task_field "$
|
|
202
|
+
if [[ -n "$task_id" ]]; then
|
|
203
|
+
message=$(get_task_field "$task_id" "prompt" 2>/dev/null | head -c 40)
|
|
202
204
|
[[ ${#message} -eq 40 ]] && message="${message}..."
|
|
203
205
|
fi
|
|
204
206
|
|
|
@@ -279,7 +281,7 @@ cmd_visual() {
|
|
|
279
281
|
cmd_exit() {
|
|
280
282
|
print_info "Ending session..."
|
|
281
283
|
end_session
|
|
282
|
-
|
|
284
|
+
kill_all_agents
|
|
283
285
|
echo
|
|
284
286
|
echo "${GREEN}Goodbye!${RESET}"
|
|
285
287
|
exit 0
|
package/bin/agentk-wrapper.js
CHANGED
|
File without changes
|
package/lib/core.sh
CHANGED
|
@@ -8,7 +8,7 @@ set -euo pipefail
|
|
|
8
8
|
# CONSTANTS
|
|
9
9
|
# =============================================================================
|
|
10
10
|
|
|
11
|
-
AGENTK_VERSION="1.0.
|
|
11
|
+
AGENTK_VERSION="1.0.2"
|
|
12
12
|
AGENTK_ROOT="${AGENTK_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
|
|
13
13
|
AGENTK_WORKSPACE="${AGENTK_ROOT}/workspace"
|
|
14
14
|
CLAUDE_KNOWLEDGE_CUTOFF="2024-04"
|
|
@@ -38,9 +38,18 @@ fi
|
|
|
38
38
|
# LOGGING
|
|
39
39
|
# =============================================================================
|
|
40
40
|
|
|
41
|
-
# Log levels
|
|
41
|
+
# Log levels (bash 3.x compatible - no associative arrays)
|
|
42
42
|
LOG_LEVEL="${LOG_LEVEL:-info}"
|
|
43
|
-
|
|
43
|
+
|
|
44
|
+
_get_log_level_num() {
|
|
45
|
+
case "$1" in
|
|
46
|
+
debug) echo 0 ;;
|
|
47
|
+
info) echo 1 ;;
|
|
48
|
+
warn) echo 2 ;;
|
|
49
|
+
error) echo 3 ;;
|
|
50
|
+
*) echo 1 ;;
|
|
51
|
+
esac
|
|
52
|
+
}
|
|
44
53
|
|
|
45
54
|
_log() {
|
|
46
55
|
local level="$1"
|
|
@@ -49,8 +58,10 @@ _log() {
|
|
|
49
58
|
timestamp=$(date '+%Y-%m-%d %H:%M:%S')
|
|
50
59
|
|
|
51
60
|
# Check if we should log this level
|
|
52
|
-
local current_level
|
|
53
|
-
|
|
61
|
+
local current_level
|
|
62
|
+
current_level=$(_get_log_level_num "$LOG_LEVEL")
|
|
63
|
+
local msg_level
|
|
64
|
+
msg_level=$(_get_log_level_num "$level")
|
|
54
65
|
|
|
55
66
|
if [[ $msg_level -ge $current_level ]]; then
|
|
56
67
|
case "$level" in
|
|
@@ -220,21 +231,20 @@ generate_task_id() {
|
|
|
220
231
|
# =============================================================================
|
|
221
232
|
|
|
222
233
|
check_dependencies() {
|
|
223
|
-
local
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
log_info "Install with: brew install ${missing[*]}"
|
|
234
|
+
local has_jq has_claude
|
|
235
|
+
has_jq=$(command -v jq 2>/dev/null)
|
|
236
|
+
has_claude=$(command -v claude 2>/dev/null)
|
|
237
|
+
|
|
238
|
+
# Check required dependencies
|
|
239
|
+
if [[ -z "$has_jq" ]] || [[ -z "$has_claude" ]]; then
|
|
240
|
+
if [[ -z "$has_jq" ]]; then
|
|
241
|
+
log_error "Missing dependency: jq"
|
|
242
|
+
log_info "Install with: brew install jq"
|
|
243
|
+
fi
|
|
244
|
+
if [[ -z "$has_claude" ]]; then
|
|
245
|
+
log_error "Missing dependency: claude (Claude Code CLI)"
|
|
246
|
+
log_info "Install from: https://claude.ai/code"
|
|
247
|
+
fi
|
|
238
248
|
exit 1
|
|
239
249
|
fi
|
|
240
250
|
|
package/lib/ipc.sh
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
set -euo pipefail
|
|
6
6
|
|
|
7
|
-
# Source core for utilities
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
# Source core for utilities (use AGENTK_ROOT if set, otherwise compute local path)
|
|
8
|
+
_IPC_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
+
if [[ -z "${AGENTK_ROOT:-}" ]]; then
|
|
10
|
+
source "$_IPC_SCRIPT_DIR/core.sh"
|
|
11
|
+
fi
|
|
10
12
|
|
|
11
13
|
# =============================================================================
|
|
12
14
|
# TASK STATUS CONSTANTS
|
package/lib/spawn.sh
CHANGED
|
@@ -1,21 +1,89 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# AGENT-K Spawn Library
|
|
3
3
|
# Claude subprocess spawning and management
|
|
4
|
+
# Compatible with bash 3.x (no associative arrays)
|
|
4
5
|
|
|
5
6
|
set -euo pipefail
|
|
6
7
|
|
|
7
|
-
# Source dependencies
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
source "$
|
|
8
|
+
# Source dependencies (use AGENTK_ROOT if set, otherwise compute local path)
|
|
9
|
+
_SPAWN_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
10
|
+
if [[ -z "${AGENTK_ROOT:-}" ]]; then
|
|
11
|
+
source "$_SPAWN_SCRIPT_DIR/core.sh"
|
|
12
|
+
source "$_SPAWN_SCRIPT_DIR/ipc.sh"
|
|
13
|
+
fi
|
|
11
14
|
|
|
12
15
|
# =============================================================================
|
|
13
|
-
#
|
|
16
|
+
# PID FILE MANAGEMENT (bash 3.x compatible)
|
|
14
17
|
# =============================================================================
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
_get_agent_pid_file() {
|
|
20
|
+
local agent="$1"
|
|
21
|
+
echo "$AGENTK_WORKSPACE/.pids/${agent}.pid"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_get_agent_task_file() {
|
|
25
|
+
local agent="$1"
|
|
26
|
+
echo "$AGENTK_WORKSPACE/.pids/${agent}.task"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_set_agent_pid() {
|
|
30
|
+
local agent="$1"
|
|
31
|
+
local pid="$2"
|
|
32
|
+
local pid_dir="$AGENTK_WORKSPACE/.pids"
|
|
33
|
+
mkdir -p "$pid_dir"
|
|
34
|
+
echo "$pid" > "$(_get_agent_pid_file "$agent")"
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_get_agent_pid() {
|
|
38
|
+
local agent="$1"
|
|
39
|
+
local pid_file
|
|
40
|
+
pid_file="$(_get_agent_pid_file "$agent")"
|
|
41
|
+
if [[ -f "$pid_file" ]]; then
|
|
42
|
+
cat "$pid_file"
|
|
43
|
+
else
|
|
44
|
+
echo ""
|
|
45
|
+
fi
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
_clear_agent_pid() {
|
|
49
|
+
local agent="$1"
|
|
50
|
+
rm -f "$(_get_agent_pid_file "$agent")"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
_set_agent_task() {
|
|
54
|
+
local agent="$1"
|
|
55
|
+
local task_id="$2"
|
|
56
|
+
local pid_dir="$AGENTK_WORKSPACE/.pids"
|
|
57
|
+
mkdir -p "$pid_dir"
|
|
58
|
+
echo "$task_id" > "$(_get_agent_task_file "$agent")"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
_get_agent_task() {
|
|
62
|
+
local agent="$1"
|
|
63
|
+
local task_file
|
|
64
|
+
task_file="$(_get_agent_task_file "$agent")"
|
|
65
|
+
if [[ -f "$task_file" ]]; then
|
|
66
|
+
cat "$task_file"
|
|
67
|
+
else
|
|
68
|
+
echo ""
|
|
69
|
+
fi
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
_clear_agent_task() {
|
|
73
|
+
local agent="$1"
|
|
74
|
+
rm -f "$(_get_agent_task_file "$agent")"
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
_list_active_agents() {
|
|
78
|
+
local pid_dir="$AGENTK_WORKSPACE/.pids"
|
|
79
|
+
if [[ -d "$pid_dir" ]]; then
|
|
80
|
+
for pid_file in "$pid_dir"/*.pid; do
|
|
81
|
+
if [[ -f "$pid_file" ]]; then
|
|
82
|
+
basename "$pid_file" .pid
|
|
83
|
+
fi
|
|
84
|
+
done
|
|
85
|
+
fi
|
|
86
|
+
}
|
|
19
87
|
|
|
20
88
|
# =============================================================================
|
|
21
89
|
# AGENT PROMPT LOADING
|
|
@@ -144,8 +212,8 @@ Context Files: $context_files"
|
|
|
144
212
|
) >> "$log_file" 2>&1 &
|
|
145
213
|
|
|
146
214
|
local pid=$!
|
|
147
|
-
|
|
148
|
-
|
|
215
|
+
_set_agent_pid "$agent" "$pid"
|
|
216
|
+
_set_agent_task "$agent" "$task_id"
|
|
149
217
|
|
|
150
218
|
log_debug "Agent $agent spawned with PID: $pid"
|
|
151
219
|
echo "$pid"
|
|
@@ -185,16 +253,18 @@ spawn_agent_interactive() {
|
|
|
185
253
|
is_agent_running() {
|
|
186
254
|
local agent="$1"
|
|
187
255
|
|
|
188
|
-
|
|
256
|
+
local pid
|
|
257
|
+
pid=$(_get_agent_pid "$agent")
|
|
258
|
+
|
|
259
|
+
if [[ -z "$pid" ]]; then
|
|
189
260
|
return 1
|
|
190
261
|
fi
|
|
191
262
|
|
|
192
|
-
local pid="${AGENT_PIDS[$agent]}"
|
|
193
263
|
if kill -0 "$pid" 2>/dev/null; then
|
|
194
264
|
return 0
|
|
195
265
|
else
|
|
196
266
|
# Agent finished, clean up
|
|
197
|
-
|
|
267
|
+
_clear_agent_pid "$agent"
|
|
198
268
|
return 1
|
|
199
269
|
fi
|
|
200
270
|
}
|
|
@@ -203,12 +273,14 @@ wait_agent() {
|
|
|
203
273
|
local agent="$1"
|
|
204
274
|
local timeout="${2:-300}"
|
|
205
275
|
|
|
206
|
-
|
|
276
|
+
local pid
|
|
277
|
+
pid=$(_get_agent_pid "$agent")
|
|
278
|
+
|
|
279
|
+
if [[ -z "$pid" ]]; then
|
|
207
280
|
log_warn "Agent not running: $agent"
|
|
208
281
|
return 1
|
|
209
282
|
fi
|
|
210
283
|
|
|
211
|
-
local pid="${AGENT_PIDS[$agent]}"
|
|
212
284
|
local elapsed=0
|
|
213
285
|
|
|
214
286
|
while kill -0 "$pid" 2>/dev/null && [[ $elapsed -lt $timeout ]]; do
|
|
@@ -223,7 +295,7 @@ wait_agent() {
|
|
|
223
295
|
|
|
224
296
|
# Get exit status
|
|
225
297
|
wait "$pid" 2>/dev/null || true
|
|
226
|
-
|
|
298
|
+
_clear_agent_pid "$agent"
|
|
227
299
|
|
|
228
300
|
log_debug "Agent $agent finished"
|
|
229
301
|
return 0
|
|
@@ -232,13 +304,14 @@ wait_agent() {
|
|
|
232
304
|
kill_agent() {
|
|
233
305
|
local agent="$1"
|
|
234
306
|
|
|
235
|
-
|
|
307
|
+
local pid
|
|
308
|
+
pid=$(_get_agent_pid "$agent")
|
|
309
|
+
|
|
310
|
+
if [[ -z "$pid" ]]; then
|
|
236
311
|
log_warn "Agent not running: $agent"
|
|
237
312
|
return 0
|
|
238
313
|
fi
|
|
239
314
|
|
|
240
|
-
local pid="${AGENT_PIDS[$agent]}"
|
|
241
|
-
|
|
242
315
|
# Try graceful shutdown first
|
|
243
316
|
kill -TERM "$pid" 2>/dev/null || true
|
|
244
317
|
sleep 1
|
|
@@ -249,19 +322,22 @@ kill_agent() {
|
|
|
249
322
|
fi
|
|
250
323
|
|
|
251
324
|
# Cancel any active task
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
325
|
+
local task_id
|
|
326
|
+
task_id=$(_get_agent_task "$agent")
|
|
327
|
+
if [[ -n "$task_id" ]]; then
|
|
328
|
+
cancel_task "$task_id"
|
|
329
|
+
_clear_agent_task "$agent"
|
|
255
330
|
fi
|
|
256
331
|
|
|
257
|
-
|
|
332
|
+
_clear_agent_pid "$agent"
|
|
258
333
|
update_session_agent "$agent" "stopped" "Killed by user"
|
|
259
334
|
|
|
260
335
|
log_info "Killed agent: $agent"
|
|
261
336
|
}
|
|
262
337
|
|
|
263
338
|
kill_all_agents() {
|
|
264
|
-
|
|
339
|
+
local agent
|
|
340
|
+
for agent in $(_list_active_agents); do
|
|
265
341
|
kill_agent "$agent"
|
|
266
342
|
done
|
|
267
343
|
}
|
|
@@ -275,124 +351,52 @@ get_agent_status() {
|
|
|
275
351
|
|
|
276
352
|
if is_agent_running "$agent"; then
|
|
277
353
|
echo "running"
|
|
278
|
-
elif [[ -n "${AGENT_TASKS[$agent]:-}" ]]; then
|
|
279
|
-
local task_status
|
|
280
|
-
task_status=$(get_task_status "${AGENT_TASKS[$agent]}")
|
|
281
|
-
echo "$task_status"
|
|
282
354
|
else
|
|
283
|
-
|
|
355
|
+
local task_id
|
|
356
|
+
task_id=$(_get_agent_task "$agent")
|
|
357
|
+
if [[ -n "$task_id" ]]; then
|
|
358
|
+
local task_status
|
|
359
|
+
task_status=$(get_task_status "$task_id")
|
|
360
|
+
echo "$task_status"
|
|
361
|
+
else
|
|
362
|
+
echo "idle"
|
|
363
|
+
fi
|
|
284
364
|
fi
|
|
285
365
|
}
|
|
286
366
|
|
|
287
367
|
get_all_agent_status() {
|
|
288
368
|
local mode="${1:-dev}"
|
|
289
|
-
local agents
|
|
369
|
+
local agents
|
|
290
370
|
|
|
291
371
|
case "$mode" in
|
|
292
|
-
dev) agents=
|
|
293
|
-
ml) agents=
|
|
372
|
+
dev) agents="orchestrator engineer tester security scout" ;;
|
|
373
|
+
ml) agents="orchestrator researcher ml-engineer data-engineer evaluator scout" ;;
|
|
374
|
+
*) agents="orchestrator engineer tester security scout" ;;
|
|
294
375
|
esac
|
|
295
376
|
|
|
296
377
|
echo "{"
|
|
297
378
|
local first=true
|
|
298
|
-
for agent in
|
|
379
|
+
for agent in $agents; do
|
|
299
380
|
local status
|
|
300
381
|
status=$(get_agent_status "$agent")
|
|
301
|
-
local message=""
|
|
302
|
-
|
|
303
|
-
if [[ -n "${AGENT_TASKS[$agent]:-}" ]]; then
|
|
304
|
-
message=$(get_task_field "${AGENT_TASKS[$agent]}" "prompt" | head -c 50)
|
|
305
|
-
fi
|
|
306
382
|
|
|
307
383
|
if [[ "$first" == "true" ]]; then
|
|
308
384
|
first=false
|
|
309
385
|
else
|
|
310
386
|
echo ","
|
|
311
387
|
fi
|
|
312
|
-
|
|
313
|
-
printf ' "%s": {"status": "%s", "message": "%s"}' "$agent" "$status" "$message"
|
|
388
|
+
echo " \"$agent\": \"$status\""
|
|
314
389
|
done
|
|
315
|
-
echo
|
|
316
390
|
echo "}"
|
|
317
391
|
}
|
|
318
392
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
local log_file
|
|
328
|
-
log_file=$(get_agent_log "$agent")
|
|
329
|
-
|
|
330
|
-
if [[ -f "$log_file" ]]; then
|
|
331
|
-
tail -n "$lines" "$log_file"
|
|
332
|
-
else
|
|
333
|
-
echo "No logs found for agent: $agent"
|
|
334
|
-
fi
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
follow_agent_log() {
|
|
338
|
-
local agent="$1"
|
|
339
|
-
|
|
340
|
-
local log_file
|
|
341
|
-
log_file=$(get_agent_log "$agent")
|
|
342
|
-
|
|
343
|
-
if [[ -f "$log_file" ]]; then
|
|
344
|
-
tail -f "$log_file"
|
|
345
|
-
else
|
|
346
|
-
echo "No logs found for agent: $agent"
|
|
347
|
-
fi
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
clear_agent_log() {
|
|
351
|
-
local agent="$1"
|
|
352
|
-
|
|
353
|
-
local log_file
|
|
354
|
-
log_file=$(get_agent_log "$agent")
|
|
355
|
-
|
|
356
|
-
if [[ -f "$log_file" ]]; then
|
|
357
|
-
> "$log_file"
|
|
358
|
-
log_debug "Cleared log for agent: $agent"
|
|
359
|
-
fi
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
# =============================================================================
|
|
363
|
-
# PARALLEL SPAWNING
|
|
364
|
-
# =============================================================================
|
|
365
|
-
|
|
366
|
-
spawn_agents_parallel() {
|
|
367
|
-
local mode="$1"
|
|
368
|
-
shift
|
|
369
|
-
local task_ids=("$@")
|
|
370
|
-
|
|
371
|
-
local pids=()
|
|
372
|
-
|
|
373
|
-
for task_id in "${task_ids[@]}"; do
|
|
374
|
-
local assigned_to
|
|
375
|
-
assigned_to=$(get_task_field "$task_id" "assigned_to")
|
|
376
|
-
|
|
377
|
-
spawn_agent "$assigned_to" "$task_id" "$mode" &
|
|
378
|
-
pids+=($!)
|
|
379
|
-
done
|
|
380
|
-
|
|
381
|
-
# Wait for all spawns to complete
|
|
382
|
-
for pid in "${pids[@]}"; do
|
|
383
|
-
wait "$pid" 2>/dev/null || true
|
|
393
|
+
get_running_agent_count() {
|
|
394
|
+
local count=0
|
|
395
|
+
local agent
|
|
396
|
+
for agent in $(_list_active_agents); do
|
|
397
|
+
if is_agent_running "$agent"; then
|
|
398
|
+
count=$((count + 1))
|
|
399
|
+
fi
|
|
384
400
|
done
|
|
401
|
+
echo "$count"
|
|
385
402
|
}
|
|
386
|
-
|
|
387
|
-
# =============================================================================
|
|
388
|
-
# CLEANUP
|
|
389
|
-
# =============================================================================
|
|
390
|
-
|
|
391
|
-
cleanup_agents() {
|
|
392
|
-
log_info "Cleaning up agents..."
|
|
393
|
-
kill_all_agents
|
|
394
|
-
cancel_all_tasks
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
# Trap for cleanup on exit
|
|
398
|
-
trap cleanup_agents EXIT INT TERM
|
package/lib/ui.sh
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
set -euo pipefail
|
|
6
6
|
|
|
7
|
-
# Source core for colors
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
# Source core for colors (use AGENTK_ROOT if set, otherwise compute local path)
|
|
8
|
+
_UI_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
+
if [[ -z "${AGENTK_ROOT:-}" ]]; then
|
|
10
|
+
source "$_UI_SCRIPT_DIR/core.sh"
|
|
11
|
+
fi
|
|
10
12
|
|
|
11
13
|
# =============================================================================
|
|
12
14
|
# UNICODE CHARACTERS
|
package/lib/visual.sh
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
set -euo pipefail
|
|
6
6
|
|
|
7
|
-
# Source dependencies
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
source "$
|
|
7
|
+
# Source dependencies (use AGENTK_ROOT if set, otherwise compute local path)
|
|
8
|
+
_VISUAL_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
+
if [[ -z "${AGENTK_ROOT:-}" ]]; then
|
|
10
|
+
source "$_VISUAL_SCRIPT_DIR/core.sh"
|
|
11
|
+
source "$_VISUAL_SCRIPT_DIR/ui.sh"
|
|
12
|
+
fi
|
|
11
13
|
|
|
12
14
|
# =============================================================================
|
|
13
15
|
# CONSTANTS
|