@phenixstar/talon 1.0.2 → 1.1.0

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/talon CHANGED
@@ -20,13 +20,45 @@ else
20
20
  fi
21
21
  COMPOSE_FILE="$COMPOSE_BASE"
22
22
 
23
- # Load .env if present
23
+ # Talon home directory
24
+ TALON_HOME="${TALON_HOME:-$HOME/.talon}"
25
+
26
+ # Load .env — check CWD first, then ~/.talon/
24
27
  if [ -f .env ]; then
25
28
  set -a
26
29
  source .env
27
30
  set +a
31
+ elif [ -f "$TALON_HOME/.env" ]; then
32
+ set -a
33
+ source "$TALON_HOME/.env"
34
+ set +a
28
35
  fi
29
36
 
37
+ # Resolve host paths for Docker volume mounts.
38
+ # CWD-local takes priority over ~/.talon/ (project mode vs global mode).
39
+ resolve_talon_paths() {
40
+ if [ -d "./configs" ]; then TALON_CONFIGS_DIR="$(pwd)/configs"
41
+ elif [ -d "$TALON_HOME/configs" ]; then TALON_CONFIGS_DIR="$TALON_HOME/configs"
42
+ else TALON_CONFIGS_DIR="$(pwd)/configs"; fi
43
+
44
+ if [ -d "./prompts" ]; then TALON_PROMPTS_DIR="$(pwd)/prompts"
45
+ else TALON_PROMPTS_DIR="$(cd "$(dirname "$0")" && pwd)/prompts"; fi
46
+
47
+ if [ -d "./audit-logs" ]; then TALON_AUDIT_DIR="$(pwd)/audit-logs"
48
+ elif [ -d "$TALON_HOME/audit-logs" ]; then TALON_AUDIT_DIR="$TALON_HOME/audit-logs"
49
+ else TALON_AUDIT_DIR="$TALON_HOME/audit-logs"; fi
50
+
51
+ if [ -d "./credentials" ]; then TALON_CREDENTIALS_DIR="$(pwd)/credentials"
52
+ elif [ -d "$TALON_HOME/credentials" ]; then TALON_CREDENTIALS_DIR="$TALON_HOME/credentials"
53
+ else TALON_CREDENTIALS_DIR="$TALON_HOME/credentials"; fi
54
+
55
+ if [ -d "./repos" ]; then TALON_REPOS_DIR="$(pwd)/repos"
56
+ elif [ -d "$TALON_HOME/repos" ]; then TALON_REPOS_DIR="$TALON_HOME/repos"
57
+ else TALON_REPOS_DIR="$(pwd)/repos"; fi
58
+
59
+ export TALON_CONFIGS_DIR TALON_PROMPTS_DIR TALON_AUDIT_DIR TALON_CREDENTIALS_DIR TALON_REPOS_DIR
60
+ }
61
+
30
62
  show_help() {
31
63
  cat << 'EOF'
32
64
 
@@ -45,6 +77,8 @@ Usage:
45
77
  ./talon start URL=<url> REPO=<name> Start a pentest workflow
46
78
  ./talon benchmark TARGET=<name> Run benchmark and compute F1 metrics
47
79
  ./talon evolve GENERATIONS=<n> Run N evolution generations on gene pool
80
+ ./talon tui <workflow-id> Live TUI dashboard for a running workflow
81
+ ./talon tui --list List workspaces in TUI
48
82
  ./talon workspaces List all workspaces
49
83
  ./talon logs ID=<workflow-id> Tail logs for a specific workflow
50
84
  ./talon stop Stop all containers
@@ -145,9 +179,15 @@ cmd_start() {
145
179
  exit 1
146
180
  fi
147
181
 
148
- # Check for API key (Bedrock and router modes can bypass this)
182
+ # Resolve all host paths for Docker mounts
183
+ resolve_talon_paths
184
+
185
+ # Check for API key (Bedrock, Vertex, router, and custom base URL modes can bypass this)
149
186
  if [ -z "$ANTHROPIC_API_KEY" ] && [ -z "$CLAUDE_CODE_OAUTH_TOKEN" ]; then
150
- if [ "$CLAUDE_CODE_USE_BEDROCK" = "1" ]; then
187
+ if [ -n "$ANTHROPIC_BASE_URL" ] && [ -n "$ANTHROPIC_AUTH_TOKEN" ]; then
188
+ # Custom base URL mode — use auth token as API key for SDK initialization
189
+ echo "Using custom base URL: $ANTHROPIC_BASE_URL"
190
+ elif [ "$CLAUDE_CODE_USE_BEDROCK" = "1" ]; then
151
191
  # Bedrock mode — validate required AWS credentials
152
192
  MISSING=""
153
193
  [ -z "$AWS_REGION" ] && MISSING="$MISSING AWS_REGION"
@@ -197,16 +237,19 @@ cmd_start() {
197
237
 
198
238
  # Determine container path for REPO
199
239
  # - If REPO is already a container path (/benchmarks/*, /repos/*), use as-is
200
- # - Otherwise, treat as a folder name under ./repos/ (mounted at /repos in container)
240
+ # - Otherwise, check resolved repos dir (CWD/repos/ then ~/.talon/repos/)
201
241
  case "$REPO" in
202
242
  /benchmarks/*|/repos/*)
203
243
  CONTAINER_REPO="$REPO"
204
244
  ;;
205
245
  *)
206
- if [ ! -d "./repos/$REPO" ]; then
207
- echo "ERROR: Repository not found at ./repos/$REPO"
246
+ if [ ! -d "$TALON_REPOS_DIR/$REPO" ]; then
247
+ echo "ERROR: Repository not found"
248
+ echo " Checked: ./repos/$REPO"
249
+ echo " Checked: $TALON_HOME/repos/$REPO"
208
250
  echo ""
209
- echo "Place your target repository under the ./repos/ directory"
251
+ echo "Add a repo: talon repo add <git-url>"
252
+ echo "Or clone: git clone <url> $TALON_REPOS_DIR/$REPO"
210
253
  exit 1
211
254
  fi
212
255
  CONTAINER_REPO="/repos/$REPO"
@@ -234,16 +277,21 @@ cmd_start() {
234
277
  export ANTHROPIC_AUTH_TOKEN="$TALON_ROUTER_KEY"
235
278
  fi
236
279
 
237
- # Ensure audit-logs directory exists with write permissions for container user (UID 1001)
238
- mkdir -p ./audit-logs ./credentials
239
- chmod 777 ./audit-logs # 777 required: container UID 1001 differs from host UID
280
+ # Ensure directories exist with write permissions for container user (UID 1001)
281
+ mkdir -p "$TALON_AUDIT_DIR" "$TALON_CREDENTIALS_DIR"
282
+ chmod 777 "$TALON_AUDIT_DIR" # 777 required: container UID 1001 differs from host UID
240
283
 
241
284
  # Ensure repo deliverables directory is writable by container user (UID 1001)
242
- if [ -d "./repos/$REPO" ]; then
243
- mkdir -p "./repos/$REPO/deliverables"
244
- chmod 777 "./repos/$REPO/deliverables" # 777 required: container UID 1001 differs from host UID
285
+ if [ -d "$TALON_REPOS_DIR/$REPO" ]; then
286
+ mkdir -p "$TALON_REPOS_DIR/$REPO/deliverables"
287
+ chmod 777 "$TALON_REPOS_DIR/$REPO/deliverables" # 777 required: container UID 1001 differs from host UID
245
288
  fi
246
289
 
290
+ # Log resolved paths
291
+ echo "Repos: $TALON_REPOS_DIR"
292
+ echo "Configs: $TALON_CONFIGS_DIR"
293
+ echo "Audit logs: $TALON_AUDIT_DIR"
294
+
247
295
  # Start router BEFORE main containers so worker can reach it on boot
248
296
  if [ "$ROUTER" = "true" ]; then
249
297
  if [ -z "$OPENAI_API_KEY" ] && [ -z "$OPENROUTER_API_KEY" ]; then
@@ -409,6 +457,30 @@ cmd_doctor() {
409
457
  node dist/cli/doctor.js "$@"
410
458
  }
411
459
 
460
+ cmd_repo() {
461
+ if ! command -v node &>/dev/null; then
462
+ echo "Node.js is required. Install: https://nodejs.org/en/download"
463
+ exit 1
464
+ fi
465
+ if [ ! -f "dist/cli/repo-commands.js" ]; then
466
+ echo "Building Talon..."
467
+ npm install --silent && npm run build
468
+ fi
469
+ node dist/cli/repo-commands.js "$@"
470
+ }
471
+
472
+ cmd_tui() {
473
+ if ! command -v node &>/dev/null; then
474
+ echo "Node.js is required for TUI. Install: https://nodejs.org/en/download"
475
+ exit 1
476
+ fi
477
+ if [ ! -f "dist/tui/tui-entry.js" ]; then
478
+ echo "Building Talon..."
479
+ npm install --silent && npm run build
480
+ fi
481
+ node dist/tui/tui-entry.js "$@"
482
+ }
483
+
412
484
  cmd_stop() {
413
485
  parse_args "$@"
414
486
 
@@ -429,6 +501,10 @@ case "${1:-help}" in
429
501
  shift
430
502
  cmd_doctor "$@"
431
503
  ;;
504
+ repo)
505
+ shift
506
+ cmd_repo "$@"
507
+ ;;
432
508
  start)
433
509
  shift
434
510
  cmd_start "$@"
@@ -445,6 +521,10 @@ case "${1:-help}" in
445
521
  shift
446
522
  cmd_evolve "$@"
447
523
  ;;
524
+ tui)
525
+ shift
526
+ cmd_tui "$@"
527
+ ;;
448
528
  workspaces)
449
529
  shift
450
530
  cmd_workspaces