claude-flow-novice 2.14.33 → 2.14.35
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/.claude/commands/switch-api.md +1 -1
- package/.claude/skills/cfn-agent-discovery/agents-registry.json +1 -1
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +3 -9
- package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh +221 -0
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +565 -565
- package/claude-assets/commands/switch-api.md +1 -1
- package/claude-assets/skills/cfn-agent-discovery/agents-registry.json +1 -1
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +3 -9
- package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh +221 -0
- package/dist/agents/agent-loader.js +133 -467
- package/dist/agents/agent-loader.js.map +1 -1
- package/dist/cli/agent-definition-parser.js.map +1 -1
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ Switch Main Chat and Task() tool API provider between Z.ai (cost-optimized) and
|
|
|
15
15
|
**Arguments:**
|
|
16
16
|
- `status` - Show current routing configuration (default)
|
|
17
17
|
- `zai` - Route Main Chat + Task tool to Z.ai for cost savings
|
|
18
|
-
- `max`
|
|
18
|
+
- `max` - Route Main Chat + Task tool to Anthropic for quality (also accepts `claude` or `anthropic` as aliases)
|
|
19
19
|
|
|
20
20
|
**What This Does:**
|
|
21
21
|
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"validation",
|
|
146
146
|
"orchestration"
|
|
147
147
|
],
|
|
148
|
-
"file": "/mnt/c/Users/masha/Documents/claude-flow-novice/.claude/agents/coordinators/cfn-v3-coordinator.md"
|
|
148
|
+
"file": "/mnt/c/Users/masha/Documents/claude-flow-novice/.claude/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md"
|
|
149
149
|
},
|
|
150
150
|
{
|
|
151
151
|
"name": "multi-sprint-coordinator",
|
|
@@ -25,15 +25,9 @@ set -euo pipefail
|
|
|
25
25
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
26
26
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
27
27
|
|
|
28
|
-
# ⚠️ ANTI-023 MEMORY LEAK PROTECTION:
|
|
29
|
-
# Task Mode
|
|
30
|
-
|
|
31
|
-
echo "❌ TASK MODE DETECTED - Orchestration forbidden" >&2
|
|
32
|
-
echo "🚨 ANTI-023: This script is for CLI-spawned coordinators only" >&2
|
|
33
|
-
echo "💡 Task Mode coordination should be handled directly by Main Chat" >&2
|
|
34
|
-
echo "🔧 Coordinator spawned via Task() tool - Main Chat should coordinate directly" >&2
|
|
35
|
-
exit 1
|
|
36
|
-
fi
|
|
28
|
+
# ⚠️ ANTI-023 MEMORY LEAK PROTECTION:
|
|
29
|
+
# Task Mode validation moved to after argument parsing at line 276
|
|
30
|
+
# This allows proper CLI argument processing before validation
|
|
37
31
|
|
|
38
32
|
# ⚠️ ANTI-023 MEMORY LEAK PROTECTION: Environment Sanitization
|
|
39
33
|
# Load and apply environment sanitization to prevent memory leaks
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Invoke Waiting Mode - Agent Coordination for CFN Loop
|
|
4
|
+
# Purpose: Handle coordination between agents using waiting mode and collection
|
|
5
|
+
# Usage: invoke-waiting-mode.sh <collect|wait|signal> [task-id] [agent-id] [timeout]
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
set -euo pipefail
|
|
9
|
+
|
|
10
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
11
|
+
REDIS_COORD_SKILL="$SCRIPT_DIR"
|
|
12
|
+
|
|
13
|
+
# Parse arguments
|
|
14
|
+
COMMAND=${1:-"collect"}
|
|
15
|
+
TASK_ID=${2:-""}
|
|
16
|
+
AGENT_ID=${3:-""}
|
|
17
|
+
TIMEOUT=${4:-120}
|
|
18
|
+
|
|
19
|
+
# Redis configuration
|
|
20
|
+
REDIS_HOST=${REDIS_HOST:-"localhost"}
|
|
21
|
+
REDIS_PORT=${REDIS_PORT:-6379}
|
|
22
|
+
REDIS_DB=${REDIS_DB:-0}
|
|
23
|
+
|
|
24
|
+
# Debug output
|
|
25
|
+
DEBUG=${DEBUG:-false}
|
|
26
|
+
if [[ "$DEBUG" == "true" ]]; then
|
|
27
|
+
echo "DEBUG: invoke-waiting-mode called with: $*" >&2
|
|
28
|
+
echo "DEBUG: REDIS_HOST=$REDIS_HOST, REDIS_PORT=$REDIS_PORT, REDIS_DB=$REDIS_DB" >&2
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# Function to connect to Redis with error handling
|
|
32
|
+
redis_cmd() {
|
|
33
|
+
local cmd="$1"
|
|
34
|
+
shift
|
|
35
|
+
|
|
36
|
+
if command -v redis-cli >/dev/null 2>&1; then
|
|
37
|
+
redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" -n "$REDIS_DB" "$cmd" "$@" 2>/dev/null
|
|
38
|
+
else
|
|
39
|
+
echo "Warning: redis-cli not available, using mock mode" >&2
|
|
40
|
+
return 0
|
|
41
|
+
fi
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# Function to collect agent signals
|
|
45
|
+
collect_signals() {
|
|
46
|
+
local task_id="$1"
|
|
47
|
+
local agent_type="$2"
|
|
48
|
+
local timeout="${3:-120}"
|
|
49
|
+
|
|
50
|
+
echo "📡 Collecting ${agent_type} signals for task: $task_id (timeout: ${timeout}s)" >&2
|
|
51
|
+
|
|
52
|
+
local signals_key="swarm:${task_id}:signals:${agent_type}"
|
|
53
|
+
local start_time=$(date +%s)
|
|
54
|
+
local signals_collected=()
|
|
55
|
+
|
|
56
|
+
while true; do
|
|
57
|
+
# Get all available signals
|
|
58
|
+
local signals=($(redis_cmd SMEMBERS "$signals_key" 2>/dev/null || echo ""))
|
|
59
|
+
|
|
60
|
+
if [[ ${#signals[@]} -gt 0 ]]; then
|
|
61
|
+
for signal in "${signals[@]}"; do
|
|
62
|
+
if [[ ! " ${signals_collected[@]} " =~ " ${signal} " ]]; then
|
|
63
|
+
signals_collected+=("$signal")
|
|
64
|
+
echo " ✓ Signal collected: $signal" >&2
|
|
65
|
+
|
|
66
|
+
# Get detailed signal data
|
|
67
|
+
local signal_key="swarm:${task_id}:agent:${signal}:data"
|
|
68
|
+
local signal_data=$(redis_cmd HGETALL "$signal_key" 2>/dev/null || echo "")
|
|
69
|
+
|
|
70
|
+
if [[ -n "$signal_data" ]]; then
|
|
71
|
+
echo " Data: $signal_data" >&2
|
|
72
|
+
fi
|
|
73
|
+
fi
|
|
74
|
+
done
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# Check if we have all expected signals (this would be based on agent count)
|
|
78
|
+
local expected_signals=${EXPECTED_AGENTS:-1}
|
|
79
|
+
if [[ ${#signals_collected[@]} -ge $expected_signals ]]; then
|
|
80
|
+
echo "✅ All signals collected" >&2
|
|
81
|
+
break
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
# Check timeout
|
|
85
|
+
local current_time=$(date +%s)
|
|
86
|
+
if [[ $((current_time - start_time)) -ge $timeout ]]; then
|
|
87
|
+
echo "⚠️ Timeout reached, proceeding with collected signals" >&2
|
|
88
|
+
break
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
sleep 2
|
|
92
|
+
done
|
|
93
|
+
|
|
94
|
+
# Return collected signals as JSON
|
|
95
|
+
local json_output="{"
|
|
96
|
+
json_output+="\"task_id\":\"$task_id\","
|
|
97
|
+
json_output+="\"agent_type\":\"$agent_type\","
|
|
98
|
+
json_output+="\"signals\":["
|
|
99
|
+
|
|
100
|
+
for i in "${!signals_collected[@]}"; do
|
|
101
|
+
if [[ $i -gt 0 ]]; then
|
|
102
|
+
json_output+=","
|
|
103
|
+
fi
|
|
104
|
+
json_output+='"'"${signals_collected[$i]}"'"'
|
|
105
|
+
done
|
|
106
|
+
|
|
107
|
+
json_output+="],"
|
|
108
|
+
json_output+="\"count\":${#signals_collected[@]},"
|
|
109
|
+
json_output+="\"timeout\":$timeout"
|
|
110
|
+
json_output+="}"
|
|
111
|
+
|
|
112
|
+
echo "$json_output"
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
# Function to wait for specific condition
|
|
116
|
+
wait_for_signal() {
|
|
117
|
+
local task_id="$1"
|
|
118
|
+
local condition="$2"
|
|
119
|
+
local timeout="${3:-120}"
|
|
120
|
+
|
|
121
|
+
echo "⏳ Waiting for signal: $condition (timeout: ${timeout}s)" >&2
|
|
122
|
+
|
|
123
|
+
local start_time=$(date +%s)
|
|
124
|
+
local condition_key="swarm:${task_id}:condition:${condition}"
|
|
125
|
+
|
|
126
|
+
while true; do
|
|
127
|
+
local condition_met=$(redis_cmd GET "$condition_key" 2>/dev/null || echo "")
|
|
128
|
+
|
|
129
|
+
if [[ "$condition_met" == "true" ]]; then
|
|
130
|
+
echo "✅ Condition met: $condition" >&2
|
|
131
|
+
redis_cmd DEL "$condition_key" 2>/dev/null
|
|
132
|
+
echo "true"
|
|
133
|
+
return 0
|
|
134
|
+
fi
|
|
135
|
+
|
|
136
|
+
# Check timeout
|
|
137
|
+
local current_time=$(date +%s)
|
|
138
|
+
if [[ $((current_time - start_time)) -ge $timeout ]]; then
|
|
139
|
+
echo "⚠️ Timeout waiting for: $condition" >&2
|
|
140
|
+
echo "false"
|
|
141
|
+
return 1
|
|
142
|
+
fi
|
|
143
|
+
|
|
144
|
+
sleep 2
|
|
145
|
+
done
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
# Function to signal completion
|
|
149
|
+
signal_completion() {
|
|
150
|
+
local task_id="$1"
|
|
151
|
+
local agent_id="$2"
|
|
152
|
+
local status="${3:-complete}"
|
|
153
|
+
|
|
154
|
+
echo "📤 Signaling completion: $agent_id -> $status" >&2
|
|
155
|
+
|
|
156
|
+
# Add to completed set
|
|
157
|
+
redis_cmd SADD "swarm:${task_id}:completed" "$agent_id" 2>/dev/null || true
|
|
158
|
+
|
|
159
|
+
# Set completion status
|
|
160
|
+
redis_cmd HSET "swarm:${task_id}:agent:${agent_id}:status" "status" "$status" 2>/dev/null || true
|
|
161
|
+
redis_cmd HSET "swarm:${task_id}:agent:${agent_id}:status" "completed_at" "$(date +%s)" 2>/dev/null || true
|
|
162
|
+
|
|
163
|
+
# Broadcast completion signal
|
|
164
|
+
redis_cmd PUBLISH "swarm:${task_id}:signals" "agent:$agent_id:status:$status" 2>/dev/null || true
|
|
165
|
+
|
|
166
|
+
echo "✅ Signal sent: $agent_id completed"
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
# Main command routing
|
|
170
|
+
case "$COMMAND" in
|
|
171
|
+
"collect")
|
|
172
|
+
if [[ -z "$TASK_ID" ]]; then
|
|
173
|
+
echo "Error: collect command requires task-id" >&2
|
|
174
|
+
echo "Usage: $0 collect <task-id> <agent-type> [timeout]" >&2
|
|
175
|
+
exit 1
|
|
176
|
+
fi
|
|
177
|
+
collect_signals "$TASK_ID" "${AGENT_ID:-"loop3"}" "$TIMEOUT"
|
|
178
|
+
;;
|
|
179
|
+
"wait")
|
|
180
|
+
if [[ -z "$TASK_ID" ]] || [[ -z "$AGENT_ID" ]]; then
|
|
181
|
+
echo "Error: wait command requires task-id and condition" >&2
|
|
182
|
+
echo "Usage: $0 wait <task-id> <condition> [timeout]" >&2
|
|
183
|
+
exit 1
|
|
184
|
+
fi
|
|
185
|
+
wait_for_signal "$TASK_ID" "$AGENT_ID" "$TIMEOUT"
|
|
186
|
+
;;
|
|
187
|
+
"signal")
|
|
188
|
+
if [[ -z "$TASK_ID" ]] || [[ -z "$AGENT_ID" ]]; then
|
|
189
|
+
echo "Error: signal command requires task-id and agent-id" >&2
|
|
190
|
+
echo "Usage: $0 signal <task-id> <agent-id> [status]" >&2
|
|
191
|
+
exit 1
|
|
192
|
+
fi
|
|
193
|
+
signal_completion "$TASK_ID" "$AGENT_ID" "$TIMEOUT"
|
|
194
|
+
;;
|
|
195
|
+
"help"|"-h"|"--help")
|
|
196
|
+
cat <<EOF
|
|
197
|
+
Usage: $0 <command> [arguments]
|
|
198
|
+
|
|
199
|
+
Commands:
|
|
200
|
+
collect <task-id> <agent-type> [timeout] Collect signals from agents
|
|
201
|
+
wait <task-id> <condition> [timeout] Wait for condition to be met
|
|
202
|
+
signal <task-id> <agent-id> [status] Signal agent completion
|
|
203
|
+
|
|
204
|
+
Examples:
|
|
205
|
+
$0 collect cfn-cli-12345 loop3 300
|
|
206
|
+
$0 wait cfn-cli-12345 gate-passed 60
|
|
207
|
+
$0 signal cfn-cli-12345 backend-developer-1 complete
|
|
208
|
+
|
|
209
|
+
Environment Variables:
|
|
210
|
+
REDIS_HOST Redis host (default: localhost)
|
|
211
|
+
REDIS_PORT Redis port (default: 6379)
|
|
212
|
+
REDIS_DB Redis database (default: 0)
|
|
213
|
+
DEBUG Enable debug output (true/false)
|
|
214
|
+
EOF
|
|
215
|
+
;;
|
|
216
|
+
*)
|
|
217
|
+
echo "Error: Unknown command '$COMMAND'" >&2
|
|
218
|
+
echo "Use '$0 help' for usage information" >&2
|
|
219
|
+
exit 1
|
|
220
|
+
;;
|
|
221
|
+
esac
|