miadi 1.0.14 → 2.0.1
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/package.json +17 -48
- package/.env.example +0 -28
- package/ARCHITECTURE.md +0 -290
- package/CLAUDE.md +0 -269
- package/GEMINI.md +0 -80
- package/MCP_CONNECTOR_READY.md +0 -219
- package/MCP_LEARNING_NOTES.md +0 -178
- package/MCP_REBUILD_PLAN.md +0 -159
- package/MCP_REMOTE_SERVER_SPEC.md +0 -373
- package/MIA.md +0 -344
- package/MIETTE.md +0 -195
- package/README.md +0 -264
- package/REMOTE_MCP_TRANSFORMATION_GUIDE.md +0 -384
- package/STATUS.md +0 -191
- package/TOOL_SELECTION_PLAN.md +0 -340
- package/WAKE_UP_SUMMARY.md +0 -102
- package/__PUBLISH.sh +0 -1
- package/book/_/ledgers/ledger_miadi_mcp_analysis_250730.md +0 -0
- package/conversations/2507301433.claude.issue.11.2025-07-30-this-mcp-is-not-working-another-instance-of-yours.txt +0 -756
- package/conversations/2507301601.cursor.reverse_engineer_mcp_service_for.md +0 -808
- package/conversations/2508050125.llmcon.claude.MIADI_TOOLS-implement-what-is-in-toolselectionplanmd.txt +0 -1235
- package/conversations/2508051939.llmcon.claude.issue-14.TransitionToPlanningIT.implement-what-is-in-toolselectionplanmd.txt +0 -1424
- package/conversations/2508082352.llmcon.claude.MCP-Remote-Take-II.txt +0 -1658
- package/dist/index-remote.js +0 -54736
- package/dist/index.js +0 -32363
- package/mcp.sample.json +0 -14
- package/openapi.yml +0 -2161
- package/research/MCP_Research_Perplexity_2508060045.md +0 -410
- package/samples/README.md +0 -2
- package/scripts/ngrokserve.sh +0 -6
- package/scripts/start-remote.sh +0 -141
- package/scripts/start-with-ngrok.sh +0 -140
- package/src/api-client.ts +0 -254
- package/src/index-remote.ts +0 -406
- package/src/index-simple.ts +0 -232
- package/src/index.ts +0 -510
- package/src/tool-registry.ts +0 -223
- package/src/tools/ai-tools.ts +0 -69
- package/src/tools/capability-tools.ts +0 -79
- package/src/tools/forge-tools.ts +0 -51
- package/src/tools/memory-tools.ts +0 -137
- package/src/tools/session-tools.ts +0 -135
- package/src/tools/workflow-tools.ts +0 -65
- package/src/types.ts +0 -291
- package/src/utils.ts +0 -279
- package/tests/quick-test.sh +0 -116
- package/tests/run-all-tests.sh +0 -167
- package/tests/test-agent-capabilities.sh +0 -364
- package/tests/test-connectivity.sh +0 -90
- package/tests/test-memory-operations.sh +0 -236
- package/tests/test-session-management.sh +0 -320
- package/tests/test-tool-discovery.sh +0 -151
- package/tsconfig.json +0 -24
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Test 1: Basic MCP Server Connectivity
|
|
4
|
-
# Validates that the server starts and responds to basic MCP protocol messages
|
|
5
|
-
|
|
6
|
-
set -e
|
|
7
|
-
|
|
8
|
-
# Colors
|
|
9
|
-
RED='\033[0;31m'
|
|
10
|
-
GREEN='\033[0;32m'
|
|
11
|
-
YELLOW='\033[1;33m'
|
|
12
|
-
NC='\033[0m'
|
|
13
|
-
|
|
14
|
-
echo -e "${YELLOW}🔌 Testing MCP Server Connectivity...${NC}"
|
|
15
|
-
|
|
16
|
-
# Test 1: Check if server process is running
|
|
17
|
-
echo -e "${YELLOW} → Checking server process...${NC}"
|
|
18
|
-
if pgrep -f "node dist/index.js" > /dev/null; then
|
|
19
|
-
echo -e "${GREEN} ✅ Server process is running${NC}"
|
|
20
|
-
else
|
|
21
|
-
echo -e "${RED} ❌ Server process not found${NC}"
|
|
22
|
-
exit 1
|
|
23
|
-
fi
|
|
24
|
-
|
|
25
|
-
# Test 2: Check server logs for successful startup
|
|
26
|
-
echo -e "${YELLOW} → Checking server startup logs...${NC}"
|
|
27
|
-
if grep -q "✅ Miadi MCP Server is ready and listening!" tests/server.log 2>/dev/null; then
|
|
28
|
-
echo -e "${GREEN} ✅ Server startup message found in logs${NC}"
|
|
29
|
-
else
|
|
30
|
-
echo -e "${RED} ❌ Server startup message not found${NC}"
|
|
31
|
-
echo -e "${YELLOW} 📋 Current server logs:${NC}"
|
|
32
|
-
tail -10 tests/server.log 2>/dev/null || echo "No logs found"
|
|
33
|
-
exit 1
|
|
34
|
-
fi
|
|
35
|
-
|
|
36
|
-
# Test 3: Check environment variables are loaded
|
|
37
|
-
echo -e "${YELLOW} → Checking environment validation...${NC}"
|
|
38
|
-
if grep -q "✅ Environment variables validated" tests/server.log 2>/dev/null; then
|
|
39
|
-
echo -e "${GREEN} ✅ Environment variables validated${NC}"
|
|
40
|
-
else
|
|
41
|
-
echo -e "${RED} ❌ Environment validation failed${NC}"
|
|
42
|
-
exit 1
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
# Test 4: Simple stdio interaction test
|
|
46
|
-
echo -e "${YELLOW} → Testing basic stdio communication...${NC}"
|
|
47
|
-
|
|
48
|
-
# Create a simple MCP initialize message
|
|
49
|
-
cat > /tmp/mcp_test_message.json << 'EOF'
|
|
50
|
-
{
|
|
51
|
-
"jsonrpc": "2.0",
|
|
52
|
-
"id": 1,
|
|
53
|
-
"method": "initialize",
|
|
54
|
-
"params": {
|
|
55
|
-
"protocolVersion": "2024-11-05",
|
|
56
|
-
"capabilities": {},
|
|
57
|
-
"clientInfo": {
|
|
58
|
-
"name": "test-client",
|
|
59
|
-
"version": "1.0.0"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
EOF
|
|
64
|
-
|
|
65
|
-
# Send the message to the server and capture response
|
|
66
|
-
PROJECT_DIR="$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")"
|
|
67
|
-
cd "$PROJECT_DIR"
|
|
68
|
-
|
|
69
|
-
# Create a test script that sends the message and exits
|
|
70
|
-
timeout 5s bash -c '
|
|
71
|
-
cat /tmp/mcp_test_message.json | node dist/index.js > /tmp/mcp_response.log 2>&1 &
|
|
72
|
-
SERVER_PID=$!
|
|
73
|
-
sleep 2
|
|
74
|
-
kill $SERVER_PID 2>/dev/null || true
|
|
75
|
-
wait $SERVER_PID 2>/dev/null || true
|
|
76
|
-
' || true
|
|
77
|
-
|
|
78
|
-
# Check if we got any response (even if it's an error, it means the server is processing input)
|
|
79
|
-
if [ -f /tmp/mcp_response.log ] && [ -s /tmp/mcp_response.log ]; then
|
|
80
|
-
echo -e "${GREEN} ✅ Server responds to stdio input${NC}"
|
|
81
|
-
echo -e "${YELLOW} 📋 Response preview:${NC}"
|
|
82
|
-
head -3 /tmp/mcp_response.log | sed 's/^/ /'
|
|
83
|
-
else
|
|
84
|
-
echo -e "${YELLOW} ⚠️ No stdio response captured (server may still be working)${NC}"
|
|
85
|
-
fi
|
|
86
|
-
|
|
87
|
-
# Cleanup
|
|
88
|
-
rm -f /tmp/mcp_test_message.json /tmp/mcp_response.log
|
|
89
|
-
|
|
90
|
-
echo -e "${GREEN}🔌 Connectivity tests completed${NC}"
|
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Test 3: Memory Operations
|
|
4
|
-
# Tests the core memory tools against the Miadi API
|
|
5
|
-
|
|
6
|
-
set -e
|
|
7
|
-
|
|
8
|
-
# Colors
|
|
9
|
-
RED='\033[0;31m'
|
|
10
|
-
GREEN='\033[0;32m'
|
|
11
|
-
YELLOW='\033[1;33m'
|
|
12
|
-
BLUE='\033[0;34m'
|
|
13
|
-
NC='\033[0m'
|
|
14
|
-
|
|
15
|
-
echo -e "${YELLOW}💾 Testing Memory Operations...${NC}"
|
|
16
|
-
|
|
17
|
-
PROJECT_DIR="$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")"
|
|
18
|
-
cd "$PROJECT_DIR"
|
|
19
|
-
|
|
20
|
-
# Load environment variables
|
|
21
|
-
if [ -f .env ]; then
|
|
22
|
-
export $(grep -v '^#' .env | xargs)
|
|
23
|
-
fi
|
|
24
|
-
|
|
25
|
-
# Check if API is accessible
|
|
26
|
-
echo -e "${YELLOW} → Testing API connectivity...${NC}"
|
|
27
|
-
if command -v curl >/dev/null 2>&1; then
|
|
28
|
-
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
|
|
29
|
-
-H "Authorization: Bearer $EH_TOKEN" \
|
|
30
|
-
-H "Content-Type: application/json" \
|
|
31
|
-
"$EH_API_URL/api/memory?key=test-connectivity" || echo "000")
|
|
32
|
-
|
|
33
|
-
if [ "$HTTP_STATUS" = "200" ] || [ "$HTTP_STATUS" = "404" ]; then
|
|
34
|
-
echo -e "${GREEN} ✅ API is accessible (HTTP $HTTP_STATUS)${NC}"
|
|
35
|
-
else
|
|
36
|
-
echo -e "${YELLOW} ⚠️ API returned HTTP $HTTP_STATUS - continuing with tests${NC}"
|
|
37
|
-
fi
|
|
38
|
-
else
|
|
39
|
-
echo -e "${YELLOW} ⚠️ curl not available - skipping direct API test${NC}"
|
|
40
|
-
fi
|
|
41
|
-
|
|
42
|
-
# Test 1: Test miadi-get-agent-info (no parameters required)
|
|
43
|
-
echo -e "${YELLOW} → Testing miadi-get-agent-info...${NC}"
|
|
44
|
-
|
|
45
|
-
# Create MCP tool call message
|
|
46
|
-
cat > /tmp/test_agent_info.json << 'EOF'
|
|
47
|
-
{
|
|
48
|
-
"jsonrpc": "2.0",
|
|
49
|
-
"id": 1,
|
|
50
|
-
"method": "tools/call",
|
|
51
|
-
"params": {
|
|
52
|
-
"name": "miadi-get-agent-info",
|
|
53
|
-
"arguments": {}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
EOF
|
|
57
|
-
|
|
58
|
-
# Test the tool (capture output but don't fail on timeout)
|
|
59
|
-
timeout 10s bash -c '
|
|
60
|
-
echo "Sending agent info request..."
|
|
61
|
-
cat /tmp/test_agent_info.json | node dist/index.js > /tmp/agent_info_response.log 2>&1 &
|
|
62
|
-
SERVER_PID=$!
|
|
63
|
-
sleep 3
|
|
64
|
-
kill $SERVER_PID 2>/dev/null || true
|
|
65
|
-
wait $SERVER_PID 2>/dev/null || true
|
|
66
|
-
' || echo "Tool call completed"
|
|
67
|
-
|
|
68
|
-
if [ -f /tmp/agent_info_response.log ]; then
|
|
69
|
-
if grep -q "error" /tmp/agent_info_response.log; then
|
|
70
|
-
echo -e "${YELLOW} ⚠️ Agent info returned an error (API may be down)${NC}"
|
|
71
|
-
echo -e "${YELLOW} 📋 Error preview:${NC}"
|
|
72
|
-
grep -A2 -B2 "error" /tmp/agent_info_response.log || true
|
|
73
|
-
else
|
|
74
|
-
echo -e "${GREEN} ✅ Agent info tool executed${NC}"
|
|
75
|
-
fi
|
|
76
|
-
else
|
|
77
|
-
echo -e "${YELLOW} ⚠️ No response captured${NC}"
|
|
78
|
-
fi
|
|
79
|
-
|
|
80
|
-
# Test 2: Test memory storage operation
|
|
81
|
-
echo -e "${YELLOW} → Testing miadi-store-memory...${NC}"
|
|
82
|
-
|
|
83
|
-
# Create test data
|
|
84
|
-
TEST_KEY="mcp-test-$(date +%s)"
|
|
85
|
-
TEST_VALUE="Test data from MCP server - $(date)"
|
|
86
|
-
|
|
87
|
-
cat > /tmp/test_store_memory.json << EOF
|
|
88
|
-
{
|
|
89
|
-
"jsonrpc": "2.0",
|
|
90
|
-
"id": 2,
|
|
91
|
-
"method": "tools/call",
|
|
92
|
-
"params": {
|
|
93
|
-
"name": "miadi-store-memory",
|
|
94
|
-
"arguments": {
|
|
95
|
-
"key": "$TEST_KEY",
|
|
96
|
-
"value": "$TEST_VALUE",
|
|
97
|
-
"ttl": 3600
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
EOF
|
|
102
|
-
|
|
103
|
-
timeout 10s bash -c '
|
|
104
|
-
echo "Testing memory storage..."
|
|
105
|
-
cat /tmp/test_store_memory.json | node dist/index.js > /tmp/store_memory_response.log 2>&1 &
|
|
106
|
-
SERVER_PID=$!
|
|
107
|
-
sleep 3
|
|
108
|
-
kill $SERVER_PID 2>/dev/null || true
|
|
109
|
-
wait $SERVER_PID 2>/dev/null || true
|
|
110
|
-
' || echo "Store memory test completed"
|
|
111
|
-
|
|
112
|
-
if [ -f /tmp/store_memory_response.log ]; then
|
|
113
|
-
if grep -q "error" /tmp/store_memory_response.log; then
|
|
114
|
-
echo -e "${YELLOW} ⚠️ Memory store returned an error${NC}"
|
|
115
|
-
else
|
|
116
|
-
echo -e "${GREEN} ✅ Memory store tool executed${NC}"
|
|
117
|
-
fi
|
|
118
|
-
fi
|
|
119
|
-
|
|
120
|
-
# Test 3: Test memory retrieval
|
|
121
|
-
echo -e "${YELLOW} → Testing miadi-get-memory...${NC}"
|
|
122
|
-
|
|
123
|
-
cat > /tmp/test_get_memory.json << EOF
|
|
124
|
-
{
|
|
125
|
-
"jsonrpc": "2.0",
|
|
126
|
-
"id": 3,
|
|
127
|
-
"method": "tools/call",
|
|
128
|
-
"params": {
|
|
129
|
-
"name": "miadi-get-memory",
|
|
130
|
-
"arguments": {
|
|
131
|
-
"key": "$TEST_KEY"
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
EOF
|
|
136
|
-
|
|
137
|
-
timeout 10s bash -c '
|
|
138
|
-
echo "Testing memory retrieval..."
|
|
139
|
-
cat /tmp/test_get_memory.json | node dist/index.js > /tmp/get_memory_response.log 2>&1 &
|
|
140
|
-
SERVER_PID=$!
|
|
141
|
-
sleep 3
|
|
142
|
-
kill $SERVER_PID 2>/dev/null || true
|
|
143
|
-
wait $SERVER_PID 2>/dev/null || true
|
|
144
|
-
' || echo "Get memory test completed"
|
|
145
|
-
|
|
146
|
-
if [ -f /tmp/get_memory_response.log ]; then
|
|
147
|
-
if grep -q "error" /tmp/get_memory_response.log; then
|
|
148
|
-
echo -e "${YELLOW} ⚠️ Memory get returned an error${NC}"
|
|
149
|
-
else
|
|
150
|
-
echo -e "${GREEN} ✅ Memory get tool executed${NC}"
|
|
151
|
-
fi
|
|
152
|
-
fi
|
|
153
|
-
|
|
154
|
-
# Test 4: Test key scanning
|
|
155
|
-
echo -e "${YELLOW} → Testing miadi-scan-keys...${NC}"
|
|
156
|
-
|
|
157
|
-
cat > /tmp/test_scan_keys.json << 'EOF'
|
|
158
|
-
{
|
|
159
|
-
"jsonrpc": "2.0",
|
|
160
|
-
"id": 4,
|
|
161
|
-
"method": "tools/call",
|
|
162
|
-
"params": {
|
|
163
|
-
"name": "miadi-scan-keys",
|
|
164
|
-
"arguments": {
|
|
165
|
-
"pattern": "mcp-test*",
|
|
166
|
-
"limit": 10
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
EOF
|
|
171
|
-
|
|
172
|
-
timeout 10s bash -c '
|
|
173
|
-
echo "Testing key scanning..."
|
|
174
|
-
cat /tmp/test_scan_keys.json | node dist/index.js > /tmp/scan_keys_response.log 2>&1 &
|
|
175
|
-
SERVER_PID=$!
|
|
176
|
-
sleep 3
|
|
177
|
-
kill $SERVER_PID 2>/dev/null || true
|
|
178
|
-
wait $SERVER_PID 2>/dev/null || true
|
|
179
|
-
' || echo "Scan keys test completed"
|
|
180
|
-
|
|
181
|
-
if [ -f /tmp/scan_keys_response.log ]; then
|
|
182
|
-
if grep -q "error" /tmp/scan_keys_response.log; then
|
|
183
|
-
echo -e "${YELLOW} ⚠️ Key scan returned an error${NC}"
|
|
184
|
-
else
|
|
185
|
-
echo -e "${GREEN} ✅ Key scan tool executed${NC}"
|
|
186
|
-
fi
|
|
187
|
-
fi
|
|
188
|
-
|
|
189
|
-
# Test 5: Verify tool parameter validation (Zod schemas)
|
|
190
|
-
echo -e "${YELLOW} → Testing parameter validation...${NC}"
|
|
191
|
-
|
|
192
|
-
# Test with invalid parameters for miadi-store-memory
|
|
193
|
-
cat > /tmp/test_invalid_params.json << 'EOF'
|
|
194
|
-
{
|
|
195
|
-
"jsonrpc": "2.0",
|
|
196
|
-
"id": 5,
|
|
197
|
-
"method": "tools/call",
|
|
198
|
-
"params": {
|
|
199
|
-
"name": "miadi-store-memory",
|
|
200
|
-
"arguments": {
|
|
201
|
-
"key": 123,
|
|
202
|
-
"value": {"invalid": "object"}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
EOF
|
|
207
|
-
|
|
208
|
-
timeout 10s bash -c '
|
|
209
|
-
echo "Testing parameter validation..."
|
|
210
|
-
cat /tmp/test_invalid_params.json | node dist/index.js > /tmp/invalid_params_response.log 2>&1 &
|
|
211
|
-
SERVER_PID=$!
|
|
212
|
-
sleep 3
|
|
213
|
-
kill $SERVER_PID 2>/dev/null || true
|
|
214
|
-
wait $SERVER_PID 2>/dev/null || true
|
|
215
|
-
' || echo "Parameter validation test completed"
|
|
216
|
-
|
|
217
|
-
if [ -f /tmp/invalid_params_response.log ]; then
|
|
218
|
-
if grep -qi "validation\|schema\|invalid" /tmp/invalid_params_response.log; then
|
|
219
|
-
echo -e "${GREEN} ✅ Parameter validation is working${NC}"
|
|
220
|
-
else
|
|
221
|
-
echo -e "${YELLOW} ⚠️ Parameter validation may not be working${NC}"
|
|
222
|
-
fi
|
|
223
|
-
fi
|
|
224
|
-
|
|
225
|
-
# Summary
|
|
226
|
-
echo ""
|
|
227
|
-
echo -e "${BLUE}📊 Memory Operations Test Summary:${NC}"
|
|
228
|
-
echo -e "${GREEN} ✅ Tool execution tests completed${NC}"
|
|
229
|
-
echo -e "${GREEN} ✅ Parameter validation tested${NC}"
|
|
230
|
-
echo -e "${YELLOW} ⚠️ Note: Some tools may show errors if API is not accessible${NC}"
|
|
231
|
-
echo -e "${BLUE} 📋 This is expected behavior for infrastructure testing${NC}"
|
|
232
|
-
|
|
233
|
-
# Cleanup
|
|
234
|
-
rm -f /tmp/test_*.json /tmp/*_response.log
|
|
235
|
-
|
|
236
|
-
echo -e "${GREEN}💾 Memory operations tests completed${NC}"
|
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Test 4: Session Management
|
|
4
|
-
# Tests the session-related MCP tools
|
|
5
|
-
|
|
6
|
-
set -e
|
|
7
|
-
|
|
8
|
-
# Colors
|
|
9
|
-
RED='\033[0;31m'
|
|
10
|
-
GREEN='\033[0;32m'
|
|
11
|
-
YELLOW='\033[1;33m'
|
|
12
|
-
BLUE='\033[0;34m'
|
|
13
|
-
NC='\033[0m'
|
|
14
|
-
|
|
15
|
-
echo -e "${YELLOW}👥 Testing Session Management...${NC}"
|
|
16
|
-
|
|
17
|
-
PROJECT_DIR="$(dirname "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")"
|
|
18
|
-
cd "$PROJECT_DIR"
|
|
19
|
-
|
|
20
|
-
# Test 1: Start a new session
|
|
21
|
-
echo -e "${YELLOW} → Testing miadi-start-session...${NC}"
|
|
22
|
-
|
|
23
|
-
cat > /tmp/test_start_session.json << 'EOF'
|
|
24
|
-
{
|
|
25
|
-
"jsonrpc": "2.0",
|
|
26
|
-
"id": 1,
|
|
27
|
-
"method": "tools/call",
|
|
28
|
-
"params": {
|
|
29
|
-
"name": "miadi-start-session",
|
|
30
|
-
"arguments": {
|
|
31
|
-
"persona": "mia-recursive-architect",
|
|
32
|
-
"mode": "desktop",
|
|
33
|
-
"userId": "test-user-123"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
EOF
|
|
38
|
-
|
|
39
|
-
timeout 15s bash -c '
|
|
40
|
-
echo "Starting test session..."
|
|
41
|
-
cat /tmp/test_start_session.json | node dist/index.js > /tmp/start_session_response.log 2>&1 &
|
|
42
|
-
SERVER_PID=$!
|
|
43
|
-
sleep 5
|
|
44
|
-
kill $SERVER_PID 2>/dev/null || true
|
|
45
|
-
wait $SERVER_PID 2>/dev/null || true
|
|
46
|
-
' || echo "Start session test completed"
|
|
47
|
-
|
|
48
|
-
SESSION_ID=""
|
|
49
|
-
if [ -f /tmp/start_session_response.log ]; then
|
|
50
|
-
if grep -q "error" /tmp/start_session_response.log; then
|
|
51
|
-
echo -e "${YELLOW} ⚠️ Session start returned an error (API may be down)${NC}"
|
|
52
|
-
echo -e "${YELLOW} 📋 Error preview:${NC}"
|
|
53
|
-
head -5 /tmp/start_session_response.log | sed 's/^/ /'
|
|
54
|
-
else
|
|
55
|
-
echo -e "${GREEN} ✅ Session start tool executed${NC}"
|
|
56
|
-
# Try to extract session ID if present
|
|
57
|
-
SESSION_ID=$(grep -o '"id":"[^"]*"' /tmp/start_session_response.log 2>/dev/null | head -1 | cut -d'"' -f4 || echo "")
|
|
58
|
-
if [ ! -z "$SESSION_ID" ]; then
|
|
59
|
-
echo -e "${GREEN} 📋 Session ID extracted: $SESSION_ID${NC}"
|
|
60
|
-
fi
|
|
61
|
-
fi
|
|
62
|
-
fi
|
|
63
|
-
|
|
64
|
-
# Test 2: List sessions
|
|
65
|
-
echo -e "${YELLOW} → Testing miadi-list-sessions...${NC}"
|
|
66
|
-
|
|
67
|
-
cat > /tmp/test_list_sessions.json << 'EOF'
|
|
68
|
-
{
|
|
69
|
-
"jsonrpc": "2.0",
|
|
70
|
-
"id": 2,
|
|
71
|
-
"method": "tools/call",
|
|
72
|
-
"params": {
|
|
73
|
-
"name": "miadi-list-sessions",
|
|
74
|
-
"arguments": {
|
|
75
|
-
"userId": "test-user-123",
|
|
76
|
-
"limit": 10
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
EOF
|
|
81
|
-
|
|
82
|
-
timeout 15s bash -c '
|
|
83
|
-
echo "Listing sessions..."
|
|
84
|
-
cat /tmp/test_list_sessions.json | node dist/index.js > /tmp/list_sessions_response.log 2>&1 &
|
|
85
|
-
SERVER_PID=$!
|
|
86
|
-
sleep 5
|
|
87
|
-
kill $SERVER_PID 2>/dev/null || true
|
|
88
|
-
wait $SERVER_PID 2>/dev/null || true
|
|
89
|
-
' || echo "List sessions test completed"
|
|
90
|
-
|
|
91
|
-
if [ -f /tmp/list_sessions_response.log ]; then
|
|
92
|
-
if grep -q "error" /tmp/list_sessions_response.log; then
|
|
93
|
-
echo -e "${YELLOW} ⚠️ Session list returned an error${NC}"
|
|
94
|
-
else
|
|
95
|
-
echo -e "${GREEN} ✅ Session list tool executed${NC}"
|
|
96
|
-
fi
|
|
97
|
-
fi
|
|
98
|
-
|
|
99
|
-
# Test 3: Get current session (if we have a session ID)
|
|
100
|
-
if [ ! -z "$SESSION_ID" ]; then
|
|
101
|
-
echo -e "${YELLOW} → Testing miadi-get-current-session with ID...${NC}"
|
|
102
|
-
|
|
103
|
-
cat > /tmp/test_get_session.json << EOF
|
|
104
|
-
{
|
|
105
|
-
"jsonrpc": "2.0",
|
|
106
|
-
"id": 3,
|
|
107
|
-
"method": "tools/call",
|
|
108
|
-
"params": {
|
|
109
|
-
"name": "miadi-get-current-session",
|
|
110
|
-
"arguments": {
|
|
111
|
-
"sessionId": "$SESSION_ID"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
EOF
|
|
116
|
-
|
|
117
|
-
timeout 15s bash -c '
|
|
118
|
-
echo "Getting current session..."
|
|
119
|
-
cat /tmp/test_get_session.json | node dist/index.js > /tmp/get_session_response.log 2>&1 &
|
|
120
|
-
SERVER_PID=$!
|
|
121
|
-
sleep 5
|
|
122
|
-
kill $SERVER_PID 2>/dev/null || true
|
|
123
|
-
wait $SERVER_PID 2>/dev/null || true
|
|
124
|
-
' || echo "Get session test completed"
|
|
125
|
-
|
|
126
|
-
if [ -f /tmp/get_session_response.log ]; then
|
|
127
|
-
if grep -q "error" /tmp/get_session_response.log; then
|
|
128
|
-
echo -e "${YELLOW} ⚠️ Get session returned an error${NC}"
|
|
129
|
-
else
|
|
130
|
-
echo -e "${GREEN} ✅ Get session tool executed${NC}"
|
|
131
|
-
fi
|
|
132
|
-
fi
|
|
133
|
-
else
|
|
134
|
-
echo -e "${YELLOW} → Testing miadi-get-current-session without ID...${NC}"
|
|
135
|
-
|
|
136
|
-
cat > /tmp/test_get_session_no_id.json << 'EOF'
|
|
137
|
-
{
|
|
138
|
-
"jsonrpc": "2.0",
|
|
139
|
-
"id": 3,
|
|
140
|
-
"method": "tools/call",
|
|
141
|
-
"params": {
|
|
142
|
-
"name": "miadi-get-current-session",
|
|
143
|
-
"arguments": {}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
EOF
|
|
147
|
-
|
|
148
|
-
timeout 15s bash -c '
|
|
149
|
-
echo "Getting current session (no ID)..."
|
|
150
|
-
cat /tmp/test_get_session_no_id.json | node dist/index.js > /tmp/get_session_no_id_response.log 2>&1 &
|
|
151
|
-
SERVER_PID=$!
|
|
152
|
-
sleep 5
|
|
153
|
-
kill $SERVER_PID 2>/dev/null || true
|
|
154
|
-
wait $SERVER_PID 2>/dev/null || true
|
|
155
|
-
' || echo "Get session test completed"
|
|
156
|
-
|
|
157
|
-
if [ -f /tmp/get_session_no_id_response.log ]; then
|
|
158
|
-
echo -e "${GREEN} ✅ Get session (no ID) tool executed${NC}"
|
|
159
|
-
fi
|
|
160
|
-
fi
|
|
161
|
-
|
|
162
|
-
# Test 4: Switch mode (if we have a session ID)
|
|
163
|
-
if [ ! -z "$SESSION_ID" ]; then
|
|
164
|
-
echo -e "${YELLOW} → Testing miadi-switch-mode...${NC}"
|
|
165
|
-
|
|
166
|
-
cat > /tmp/test_switch_mode.json << EOF
|
|
167
|
-
{
|
|
168
|
-
"jsonrpc": "2.0",
|
|
169
|
-
"id": 4,
|
|
170
|
-
"method": "tools/call",
|
|
171
|
-
"params": {
|
|
172
|
-
"name": "miadi-switch-mode",
|
|
173
|
-
"arguments": {
|
|
174
|
-
"sessionId": "$SESSION_ID",
|
|
175
|
-
"newMode": "walking"
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
EOF
|
|
180
|
-
|
|
181
|
-
timeout 15s bash -c '
|
|
182
|
-
echo "Switching mode..."
|
|
183
|
-
cat /tmp/test_switch_mode.json | node dist/index.js > /tmp/switch_mode_response.log 2>&1 &
|
|
184
|
-
SERVER_PID=$!
|
|
185
|
-
sleep 5
|
|
186
|
-
kill $SERVER_PID 2>/dev/null || true
|
|
187
|
-
wait $SERVER_PID 2>/dev/null || true
|
|
188
|
-
' || echo "Switch mode test completed"
|
|
189
|
-
|
|
190
|
-
if [ -f /tmp/switch_mode_response.log ]; then
|
|
191
|
-
if grep -q "error" /tmp/switch_mode_response.log; then
|
|
192
|
-
echo -e "${YELLOW} ⚠️ Switch mode returned an error${NC}"
|
|
193
|
-
else
|
|
194
|
-
echo -e "${GREEN} ✅ Switch mode tool executed${NC}"
|
|
195
|
-
fi
|
|
196
|
-
fi
|
|
197
|
-
fi
|
|
198
|
-
|
|
199
|
-
# Test 5: Switch persona (if we have a session ID)
|
|
200
|
-
if [ ! -z "$SESSION_ID" ]; then
|
|
201
|
-
echo -e "${YELLOW} → Testing miadi-switch-persona...${NC}"
|
|
202
|
-
|
|
203
|
-
cat > /tmp/test_switch_persona.json << EOF
|
|
204
|
-
{
|
|
205
|
-
"jsonrpc": "2.0",
|
|
206
|
-
"id": 5,
|
|
207
|
-
"method": "tools/call",
|
|
208
|
-
"params": {
|
|
209
|
-
"name": "miadi-switch-persona",
|
|
210
|
-
"arguments": {
|
|
211
|
-
"sessionId": "$SESSION_ID",
|
|
212
|
-
"newPersona": "miette-sprite",
|
|
213
|
-
"preserveMode": true
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
EOF
|
|
218
|
-
|
|
219
|
-
timeout 15s bash -c '
|
|
220
|
-
echo "Switching persona..."
|
|
221
|
-
cat /tmp/test_switch_persona.json | node dist/index.js > /tmp/switch_persona_response.log 2>&1 &
|
|
222
|
-
SERVER_PID=$!
|
|
223
|
-
sleep 5
|
|
224
|
-
kill $SERVER_PID 2>/dev/null || true
|
|
225
|
-
wait $SERVER_PID 2>/dev/null || true
|
|
226
|
-
' || echo "Switch persona test completed"
|
|
227
|
-
|
|
228
|
-
if [ -f /tmp/switch_persona_response.log ]; then
|
|
229
|
-
if grep -q "error" /tmp/switch_persona_response.log; then
|
|
230
|
-
echo -e "${YELLOW} ⚠️ Switch persona returned an error${NC}"
|
|
231
|
-
else
|
|
232
|
-
echo -e "${GREEN} ✅ Switch persona tool executed${NC}"
|
|
233
|
-
fi
|
|
234
|
-
fi
|
|
235
|
-
fi
|
|
236
|
-
|
|
237
|
-
# Test 6: End session (if we have a session ID)
|
|
238
|
-
if [ ! -z "$SESSION_ID" ]; then
|
|
239
|
-
echo -e "${YELLOW} → Testing miadi-end-session...${NC}"
|
|
240
|
-
|
|
241
|
-
cat > /tmp/test_end_session.json << EOF
|
|
242
|
-
{
|
|
243
|
-
"jsonrpc": "2.0",
|
|
244
|
-
"id": 6,
|
|
245
|
-
"method": "tools/call",
|
|
246
|
-
"params": {
|
|
247
|
-
"name": "miadi-end-session",
|
|
248
|
-
"arguments": {
|
|
249
|
-
"sessionId": "$SESSION_ID"
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
EOF
|
|
254
|
-
|
|
255
|
-
timeout 15s bash -c '
|
|
256
|
-
echo "Ending session..."
|
|
257
|
-
cat /tmp/test_end_session.json | node dist/index.js > /tmp/end_session_response.log 2>&1 &
|
|
258
|
-
SERVER_PID=$!
|
|
259
|
-
sleep 5
|
|
260
|
-
kill $SERVER_PID 2>/dev/null || true
|
|
261
|
-
wait $SERVER_PID 2>/dev/null || true
|
|
262
|
-
' || echo "End session test completed"
|
|
263
|
-
|
|
264
|
-
if [ -f /tmp/end_session_response.log ]; then
|
|
265
|
-
if grep -q "error" /tmp/end_session_response.log; then
|
|
266
|
-
echo -e "${YELLOW} ⚠️ End session returned an error${NC}"
|
|
267
|
-
else
|
|
268
|
-
echo -e "${GREEN} ✅ End session tool executed${NC}"
|
|
269
|
-
fi
|
|
270
|
-
fi
|
|
271
|
-
fi
|
|
272
|
-
|
|
273
|
-
# Test 7: Parameter validation for session tools
|
|
274
|
-
echo -e "${YELLOW} → Testing session parameter validation...${NC}"
|
|
275
|
-
|
|
276
|
-
# Test with missing required parameters
|
|
277
|
-
cat > /tmp/test_invalid_session.json << 'EOF'
|
|
278
|
-
{
|
|
279
|
-
"jsonrpc": "2.0",
|
|
280
|
-
"id": 7,
|
|
281
|
-
"method": "tools/call",
|
|
282
|
-
"params": {
|
|
283
|
-
"name": "miadi-start-session",
|
|
284
|
-
"arguments": {
|
|
285
|
-
"persona": "",
|
|
286
|
-
"mode": 123
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
EOF
|
|
291
|
-
|
|
292
|
-
timeout 10s bash -c '
|
|
293
|
-
echo "Testing invalid session parameters..."
|
|
294
|
-
cat /tmp/test_invalid_session.json | node dist/index.js > /tmp/invalid_session_response.log 2>&1 &
|
|
295
|
-
SERVER_PID=$!
|
|
296
|
-
sleep 3
|
|
297
|
-
kill $SERVER_PID 2>/dev/null || true
|
|
298
|
-
wait $SERVER_PID 2>/dev/null || true
|
|
299
|
-
' || echo "Invalid session test completed"
|
|
300
|
-
|
|
301
|
-
if [ -f /tmp/invalid_session_response.log ]; then
|
|
302
|
-
if grep -qi "validation\|schema\|required" /tmp/invalid_session_response.log; then
|
|
303
|
-
echo -e "${GREEN} ✅ Session parameter validation is working${NC}"
|
|
304
|
-
else
|
|
305
|
-
echo -e "${YELLOW} ⚠️ Session parameter validation may not be working${NC}"
|
|
306
|
-
fi
|
|
307
|
-
fi
|
|
308
|
-
|
|
309
|
-
# Summary
|
|
310
|
-
echo ""
|
|
311
|
-
echo -e "${BLUE}📊 Session Management Test Summary:${NC}"
|
|
312
|
-
echo -e "${GREEN} ✅ Session lifecycle tools tested${NC}"
|
|
313
|
-
echo -e "${GREEN} ✅ Mode and persona switching tested${NC}"
|
|
314
|
-
echo -e "${GREEN} ✅ Parameter validation tested${NC}"
|
|
315
|
-
echo -e "${YELLOW} ⚠️ Note: Some operations may fail if API is not accessible${NC}"
|
|
316
|
-
|
|
317
|
-
# Cleanup
|
|
318
|
-
rm -f /tmp/test_*.json /tmp/*_response.log
|
|
319
|
-
|
|
320
|
-
echo -e "${GREEN}👥 Session management tests completed${NC}"
|