agent-relay 2.0.24 → 2.0.26
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/dist/src/cli/index.js +100 -10
- package/package.json +16 -16
- package/packages/api-types/package.json +1 -1
- package/packages/bridge/package.json +8 -8
- package/packages/cli-tester/package.json +1 -1
- package/packages/config/package.json +2 -2
- package/packages/continuity/package.json +1 -1
- package/packages/daemon/dist/consensus-integration.d.ts +2 -1
- package/packages/daemon/dist/consensus.d.ts +1 -3
- package/packages/daemon/dist/enhanced-features.d.ts +2 -1
- package/packages/daemon/dist/orchestrator.js +4 -3
- package/packages/daemon/dist/server.js +48 -0
- package/packages/daemon/package.json +12 -12
- package/packages/hooks/dist/inbox-check/types.d.ts +6 -1
- package/packages/hooks/dist/inbox-check/utils.d.ts +3 -3
- package/packages/hooks/package.json +4 -4
- package/packages/mcp/dist/client.d.ts +57 -46
- package/packages/mcp/dist/client.js +107 -81
- package/packages/mcp/dist/server.js +61 -1
- package/packages/mcp/dist/tools/index.d.ts +5 -0
- package/packages/mcp/dist/tools/index.js +5 -0
- package/packages/mcp/dist/tools/relay-broadcast.d.ts +20 -0
- package/packages/mcp/dist/tools/relay-broadcast.js +25 -0
- package/packages/mcp/dist/tools/relay-channel.d.ts +49 -0
- package/packages/mcp/dist/tools/relay-channel.js +76 -0
- package/packages/mcp/dist/tools/relay-consensus.d.ts +45 -0
- package/packages/mcp/dist/tools/relay-consensus.js +80 -0
- package/packages/mcp/dist/tools/relay-inbox.d.ts +1 -1
- package/packages/mcp/dist/tools/relay-send.d.ts +2 -2
- package/packages/mcp/dist/tools/relay-shadow.d.ts +30 -0
- package/packages/mcp/dist/tools/relay-shadow.js +55 -0
- package/packages/mcp/dist/tools/relay-subscribe.d.ts +27 -0
- package/packages/mcp/dist/tools/relay-subscribe.js +49 -0
- package/packages/mcp/package.json +3 -2
- package/packages/memory/package.json +2 -2
- package/packages/policy/package.json +2 -2
- package/packages/protocol/dist/types.d.ts +130 -2
- package/packages/protocol/package.json +1 -1
- package/packages/resiliency/package.json +1 -1
- package/packages/sdk/dist/client.d.ts +21 -1
- package/packages/sdk/dist/client.js +26 -2
- package/packages/sdk/dist/index.d.ts +1 -1
- package/packages/sdk/dist/protocol/index.d.ts +4 -2
- package/packages/sdk/dist/protocol/index.js +4 -2
- package/packages/sdk/package.json +2 -2
- package/packages/spawner/package.json +1 -1
- package/packages/state/package.json +1 -1
- package/packages/storage/package.json +2 -2
- package/packages/telemetry/package.json +1 -1
- package/packages/trajectory/package.json +2 -2
- package/packages/user-directory/package.json +2 -2
- package/packages/utils/package.json +1 -1
- package/packages/wrapper/package.json +6 -6
- package/scripts/post-publish-verify/README.md +80 -0
- package/scripts/post-publish-verify/run-verify.sh +127 -0
- package/scripts/post-publish-verify/verify-install.sh +249 -0
- package/packages/sdk/dist/protocol/framing.d.ts +0 -80
- package/packages/sdk/dist/protocol/framing.js +0 -206
- package/packages/sdk/dist/protocol/types.d.ts +0 -560
- package/packages/sdk/dist/protocol/types.js +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-relay/storage",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.26",
|
|
4
4
|
"description": "Storage adapters and interfaces for Relay message/session persistence",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@agent-relay/protocol": "2.0.
|
|
59
|
+
"@agent-relay/protocol": "2.0.26"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/node": "^22.19.3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-relay/trajectory",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.26",
|
|
4
4
|
"description": "Trajectory integration utilities (trail/PDERO) for Relay",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test:watch": "vitest"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agent-relay/config": "2.0.
|
|
25
|
+
"@agent-relay/config": "2.0.26"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.19.3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-relay/user-directory",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.26",
|
|
4
4
|
"description": "User directory service for agent-relay (per-user credential storage)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test:watch": "vitest"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agent-relay/resiliency": "2.0.
|
|
25
|
+
"@agent-relay/resiliency": "2.0.26"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.19.3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-relay/wrapper",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.26",
|
|
4
4
|
"description": "CLI agent wrappers for Agent Relay - tmux, pty integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"clean": "rm -rf dist"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@agent-relay/api-types": "2.0.
|
|
34
|
-
"@agent-relay/protocol": "2.0.
|
|
35
|
-
"@agent-relay/config": "2.0.
|
|
36
|
-
"@agent-relay/continuity": "2.0.
|
|
37
|
-
"@agent-relay/resiliency": "2.0.
|
|
33
|
+
"@agent-relay/api-types": "2.0.26",
|
|
34
|
+
"@agent-relay/protocol": "2.0.26",
|
|
35
|
+
"@agent-relay/config": "2.0.26",
|
|
36
|
+
"@agent-relay/continuity": "2.0.26",
|
|
37
|
+
"@agent-relay/resiliency": "2.0.26"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"typescript": "^5.9.3",
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Post-Publish Verification
|
|
2
|
+
|
|
3
|
+
Automated tests to verify the `agent-relay` npm package works correctly after publishing.
|
|
4
|
+
|
|
5
|
+
## What It Tests
|
|
6
|
+
|
|
7
|
+
1. **Global npm install** (`npm install -g agent-relay`)
|
|
8
|
+
- `--version` flag
|
|
9
|
+
- `-V` flag
|
|
10
|
+
- `version` command
|
|
11
|
+
- `--help` flag
|
|
12
|
+
|
|
13
|
+
2. **npx execution** (`npx agent-relay`)
|
|
14
|
+
- Version commands
|
|
15
|
+
- Help output
|
|
16
|
+
|
|
17
|
+
3. **Local project install** (`npm install agent-relay`)
|
|
18
|
+
- npx within project
|
|
19
|
+
- Direct bin execution (`./node_modules/.bin/agent-relay`)
|
|
20
|
+
|
|
21
|
+
## Node.js Versions
|
|
22
|
+
|
|
23
|
+
Tests run across all supported Node.js versions:
|
|
24
|
+
- Node.js 18 (minimum supported)
|
|
25
|
+
- Node.js 20 (LTS)
|
|
26
|
+
- Node.js 22 (Current)
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
### Local Testing (Docker)
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Test latest published version
|
|
34
|
+
./scripts/post-publish-verify/run-verify.sh
|
|
35
|
+
|
|
36
|
+
# Test specific version
|
|
37
|
+
./scripts/post-publish-verify/run-verify.sh 2.0.25
|
|
38
|
+
|
|
39
|
+
# Test in parallel (faster)
|
|
40
|
+
./scripts/post-publish-verify/run-verify.sh latest --parallel
|
|
41
|
+
|
|
42
|
+
# Test single Node.js version
|
|
43
|
+
./scripts/post-publish-verify/run-verify.sh latest --node 20
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Docker Compose Directly
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
cd scripts/post-publish-verify
|
|
50
|
+
|
|
51
|
+
# Test latest
|
|
52
|
+
docker compose up --build
|
|
53
|
+
|
|
54
|
+
# Test specific version
|
|
55
|
+
PACKAGE_VERSION=2.0.25 docker compose up --build
|
|
56
|
+
|
|
57
|
+
# Test single Node version
|
|
58
|
+
docker compose up --build node20
|
|
59
|
+
|
|
60
|
+
# Cleanup
|
|
61
|
+
docker compose down --rmi local
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### GitHub Actions
|
|
65
|
+
|
|
66
|
+
The verification runs automatically after publishing via the `verify-publish.yml` workflow.
|
|
67
|
+
|
|
68
|
+
You can also trigger it manually:
|
|
69
|
+
1. Go to Actions tab
|
|
70
|
+
2. Select "Verify Published Package"
|
|
71
|
+
3. Click "Run workflow"
|
|
72
|
+
4. Optionally specify a version to test
|
|
73
|
+
|
|
74
|
+
## Files
|
|
75
|
+
|
|
76
|
+
- `Dockerfile` - Multi-stage Dockerfile supporting different Node versions
|
|
77
|
+
- `verify-install.sh` - Main verification script run inside containers
|
|
78
|
+
- `docker-compose.yml` - Orchestrates tests across Node versions
|
|
79
|
+
- `run-verify.sh` - Local runner script with nice output
|
|
80
|
+
- `.github/workflows/verify-publish.yml` - GitHub Actions workflow
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Post-publish verification runner
|
|
3
|
+
#
|
|
4
|
+
# Tests agent-relay npm package across multiple Node.js versions using Docker
|
|
5
|
+
#
|
|
6
|
+
# Usage:
|
|
7
|
+
# ./run-verify.sh # Test latest version
|
|
8
|
+
# ./run-verify.sh 2.0.25 # Test specific version
|
|
9
|
+
# ./run-verify.sh latest --parallel # Run all versions in parallel
|
|
10
|
+
# ./run-verify.sh 2.0.25 --node 20 # Test specific Node.js version only
|
|
11
|
+
|
|
12
|
+
set -e
|
|
13
|
+
|
|
14
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
15
|
+
cd "$SCRIPT_DIR"
|
|
16
|
+
|
|
17
|
+
# Colors for output
|
|
18
|
+
RED='\033[0;31m'
|
|
19
|
+
GREEN='\033[0;32m'
|
|
20
|
+
YELLOW='\033[1;33m'
|
|
21
|
+
BLUE='\033[0;34m'
|
|
22
|
+
NC='\033[0m' # No Color
|
|
23
|
+
|
|
24
|
+
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
|
25
|
+
log_success() { echo -e "${GREEN}[PASS]${NC} $1"; }
|
|
26
|
+
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
|
27
|
+
log_error() { echo -e "${RED}[FAIL]${NC} $1"; }
|
|
28
|
+
log_header() { echo -e "\n${BLUE}════════════════════════════════════════${NC}"; echo -e "${BLUE} $1${NC}"; echo -e "${BLUE}════════════════════════════════════════${NC}\n"; }
|
|
29
|
+
|
|
30
|
+
# Parse arguments
|
|
31
|
+
PACKAGE_VERSION="${1:-latest}"
|
|
32
|
+
PARALLEL=false
|
|
33
|
+
SPECIFIC_NODE=""
|
|
34
|
+
FAILED_VERSIONS=()
|
|
35
|
+
|
|
36
|
+
shift || true
|
|
37
|
+
while [[ $# -gt 0 ]]; do
|
|
38
|
+
case $1 in
|
|
39
|
+
--parallel|-p)
|
|
40
|
+
PARALLEL=true
|
|
41
|
+
shift
|
|
42
|
+
;;
|
|
43
|
+
--node|-n)
|
|
44
|
+
SPECIFIC_NODE="$2"
|
|
45
|
+
shift 2
|
|
46
|
+
;;
|
|
47
|
+
--help|-h)
|
|
48
|
+
echo "Usage: $0 [VERSION] [OPTIONS]"
|
|
49
|
+
echo ""
|
|
50
|
+
echo "Arguments:"
|
|
51
|
+
echo " VERSION Package version to test (default: latest)"
|
|
52
|
+
echo ""
|
|
53
|
+
echo "Options:"
|
|
54
|
+
echo " --parallel, -p Run all Node versions in parallel"
|
|
55
|
+
echo " --node, -n VER Test only specific Node.js version (18, 20, or 22)"
|
|
56
|
+
echo " --help, -h Show this help"
|
|
57
|
+
echo ""
|
|
58
|
+
echo "Examples:"
|
|
59
|
+
echo " $0 # Test latest across all Node versions"
|
|
60
|
+
echo " $0 2.0.25 # Test version 2.0.25"
|
|
61
|
+
echo " $0 latest --parallel # Test in parallel"
|
|
62
|
+
echo " $0 2.0.25 --node 20 # Test only Node 20"
|
|
63
|
+
exit 0
|
|
64
|
+
;;
|
|
65
|
+
*)
|
|
66
|
+
log_error "Unknown option: $1"
|
|
67
|
+
exit 1
|
|
68
|
+
;;
|
|
69
|
+
esac
|
|
70
|
+
done
|
|
71
|
+
|
|
72
|
+
log_header "Agent Relay Post-Publish Verification"
|
|
73
|
+
log_info "Package version: $PACKAGE_VERSION"
|
|
74
|
+
log_info "Parallel mode: $PARALLEL"
|
|
75
|
+
if [ -n "$SPECIFIC_NODE" ]; then
|
|
76
|
+
log_info "Testing Node.js version: $SPECIFIC_NODE only"
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
# Export for docker-compose
|
|
80
|
+
export PACKAGE_VERSION
|
|
81
|
+
|
|
82
|
+
# Determine which services to run
|
|
83
|
+
if [ -n "$SPECIFIC_NODE" ]; then
|
|
84
|
+
SERVICES="node${SPECIFIC_NODE}"
|
|
85
|
+
else
|
|
86
|
+
SERVICES="node18 node20 node22"
|
|
87
|
+
fi
|
|
88
|
+
|
|
89
|
+
# Build images
|
|
90
|
+
log_info "Building Docker images..."
|
|
91
|
+
docker compose build $SERVICES
|
|
92
|
+
|
|
93
|
+
# Run tests
|
|
94
|
+
if [ "$PARALLEL" = true ]; then
|
|
95
|
+
log_info "Running verification in parallel..."
|
|
96
|
+
docker compose up --abort-on-container-exit $SERVICES
|
|
97
|
+
EXIT_CODE=$?
|
|
98
|
+
else
|
|
99
|
+
# Run sequentially to see output clearly
|
|
100
|
+
for service in $SERVICES; do
|
|
101
|
+
log_header "Testing $service"
|
|
102
|
+
if docker compose up --abort-on-container-exit "$service"; then
|
|
103
|
+
log_success "$service verification passed"
|
|
104
|
+
else
|
|
105
|
+
log_error "$service verification failed"
|
|
106
|
+
FAILED_VERSIONS+=("$service")
|
|
107
|
+
fi
|
|
108
|
+
# Clean up container
|
|
109
|
+
docker compose rm -f "$service" 2>/dev/null || true
|
|
110
|
+
done
|
|
111
|
+
fi
|
|
112
|
+
|
|
113
|
+
# Cleanup
|
|
114
|
+
log_info "Cleaning up..."
|
|
115
|
+
docker compose down --rmi local 2>/dev/null || true
|
|
116
|
+
|
|
117
|
+
# Summary
|
|
118
|
+
log_header "Verification Complete"
|
|
119
|
+
log_info "Package version tested: $PACKAGE_VERSION"
|
|
120
|
+
|
|
121
|
+
if [ ${#FAILED_VERSIONS[@]} -eq 0 ]; then
|
|
122
|
+
log_success "All Node.js versions passed verification!"
|
|
123
|
+
exit 0
|
|
124
|
+
else
|
|
125
|
+
log_error "Failed versions: ${FAILED_VERSIONS[*]}"
|
|
126
|
+
exit 1
|
|
127
|
+
fi
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Post-publish verification script
|
|
3
|
+
# Tests both global npm install and npx installation of agent-relay
|
|
4
|
+
#
|
|
5
|
+
# Environment variables:
|
|
6
|
+
# PACKAGE_VERSION: Version to install (default: latest)
|
|
7
|
+
# NODE_VERSION: Node version being tested (for logging)
|
|
8
|
+
|
|
9
|
+
# Don't use set -e so we can collect all test results
|
|
10
|
+
# set -e
|
|
11
|
+
|
|
12
|
+
# Colors for output
|
|
13
|
+
RED='\033[0;31m'
|
|
14
|
+
GREEN='\033[0;32m'
|
|
15
|
+
YELLOW='\033[1;33m'
|
|
16
|
+
BLUE='\033[0;34m'
|
|
17
|
+
NC='\033[0m' # No Color
|
|
18
|
+
|
|
19
|
+
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
|
20
|
+
log_success() { echo -e "${GREEN}[PASS]${NC} $1"; }
|
|
21
|
+
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
|
22
|
+
log_error() { echo -e "${RED}[FAIL]${NC} $1"; }
|
|
23
|
+
log_header() { echo -e "\n${BLUE}========================================${NC}"; echo -e "${BLUE}$1${NC}"; echo -e "${BLUE}========================================${NC}"; }
|
|
24
|
+
|
|
25
|
+
# Track test results
|
|
26
|
+
TESTS_PASSED=0
|
|
27
|
+
TESTS_FAILED=0
|
|
28
|
+
|
|
29
|
+
record_pass() {
|
|
30
|
+
((TESTS_PASSED++))
|
|
31
|
+
log_success "$1"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
record_fail() {
|
|
35
|
+
((TESTS_FAILED++))
|
|
36
|
+
log_error "$1"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# Get package specification
|
|
40
|
+
PACKAGE_SPEC="agent-relay"
|
|
41
|
+
if [ -n "$PACKAGE_VERSION" ] && [ "$PACKAGE_VERSION" != "latest" ]; then
|
|
42
|
+
PACKAGE_SPEC="agent-relay@${PACKAGE_VERSION}"
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
log_header "Post-Publish Verification"
|
|
46
|
+
log_info "Node.js version: $(node --version)"
|
|
47
|
+
log_info "npm version: $(npm --version)"
|
|
48
|
+
log_info "Package to test: $PACKAGE_SPEC"
|
|
49
|
+
log_info "User: $(whoami)"
|
|
50
|
+
log_info "Working directory: $(pwd)"
|
|
51
|
+
log_info "PATH: $PATH"
|
|
52
|
+
log_info "NPM prefix: $(npm config get prefix)"
|
|
53
|
+
log_info "NPM bin location: $(npm config get prefix)/bin"
|
|
54
|
+
|
|
55
|
+
# ============================================
|
|
56
|
+
# Test 1: Global npm install
|
|
57
|
+
# ============================================
|
|
58
|
+
log_header "Test 1: Global npm install"
|
|
59
|
+
|
|
60
|
+
# Ensure npm global bin is in PATH
|
|
61
|
+
NPM_BIN="$(npm config get prefix)/bin"
|
|
62
|
+
export PATH="$NPM_BIN:$PATH"
|
|
63
|
+
log_info "Updated PATH to include: $NPM_BIN"
|
|
64
|
+
|
|
65
|
+
# Clean any previous installation
|
|
66
|
+
log_info "Cleaning previous global installation..."
|
|
67
|
+
npm uninstall -g agent-relay 2>/dev/null || true
|
|
68
|
+
|
|
69
|
+
# Install globally
|
|
70
|
+
log_info "Installing ${PACKAGE_SPEC} globally..."
|
|
71
|
+
npm install -g "$PACKAGE_SPEC"
|
|
72
|
+
INSTALL_EXIT=$?
|
|
73
|
+
log_info "npm install exit code: $INSTALL_EXIT"
|
|
74
|
+
if [ $INSTALL_EXIT -eq 0 ]; then
|
|
75
|
+
record_pass "Global npm install succeeded"
|
|
76
|
+
else
|
|
77
|
+
record_fail "Global npm install failed with exit code $INSTALL_EXIT"
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
# Verify the binary exists
|
|
81
|
+
log_info "Checking if agent-relay binary exists..."
|
|
82
|
+
if [ -f "$NPM_BIN/agent-relay" ]; then
|
|
83
|
+
log_info "Binary found at: $NPM_BIN/agent-relay"
|
|
84
|
+
ls -la "$NPM_BIN/agent-relay"
|
|
85
|
+
else
|
|
86
|
+
log_warn "Binary not found at expected location: $NPM_BIN/agent-relay"
|
|
87
|
+
log_info "Contents of $NPM_BIN:"
|
|
88
|
+
ls -la "$NPM_BIN" 2>/dev/null || echo "Directory does not exist"
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
# Test --version flag
|
|
92
|
+
log_info "Testing 'agent-relay --version'..."
|
|
93
|
+
GLOBAL_VERSION=$(agent-relay --version 2>&1) || true
|
|
94
|
+
if [ -n "$GLOBAL_VERSION" ]; then
|
|
95
|
+
log_info "Output: $GLOBAL_VERSION"
|
|
96
|
+
# Verify it contains a version number pattern
|
|
97
|
+
if echo "$GLOBAL_VERSION" | grep -qE '[0-9]+\.[0-9]+\.[0-9]+'; then
|
|
98
|
+
record_pass "Global install --version returns valid version: $GLOBAL_VERSION"
|
|
99
|
+
else
|
|
100
|
+
record_fail "Global install --version output doesn't contain version number"
|
|
101
|
+
fi
|
|
102
|
+
else
|
|
103
|
+
record_fail "Global install --version returned empty output"
|
|
104
|
+
fi
|
|
105
|
+
|
|
106
|
+
# Test -V flag (short version flag)
|
|
107
|
+
log_info "Testing 'agent-relay -V'..."
|
|
108
|
+
GLOBAL_V=$(agent-relay -V 2>&1) || true
|
|
109
|
+
if [ -n "$GLOBAL_V" ]; then
|
|
110
|
+
record_pass "Global install -V works: $GLOBAL_V"
|
|
111
|
+
else
|
|
112
|
+
record_fail "Global install -V failed"
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
# Test version command
|
|
116
|
+
log_info "Testing 'agent-relay version'..."
|
|
117
|
+
GLOBAL_VERSION_CMD=$(agent-relay version 2>&1) || true
|
|
118
|
+
if echo "$GLOBAL_VERSION_CMD" | grep -qE '[0-9]+\.[0-9]+\.[0-9]+'; then
|
|
119
|
+
record_pass "Global install 'version' command works"
|
|
120
|
+
else
|
|
121
|
+
record_fail "Global install 'version' command failed"
|
|
122
|
+
fi
|
|
123
|
+
|
|
124
|
+
# Test help command
|
|
125
|
+
log_info "Testing 'agent-relay --help'..."
|
|
126
|
+
GLOBAL_HELP=$(agent-relay --help 2>&1) || true
|
|
127
|
+
if echo "$GLOBAL_HELP" | grep -q "agent-relay"; then
|
|
128
|
+
record_pass "Global install --help works"
|
|
129
|
+
else
|
|
130
|
+
record_fail "Global install --help failed"
|
|
131
|
+
fi
|
|
132
|
+
|
|
133
|
+
# Cleanup global install
|
|
134
|
+
log_info "Cleaning up global installation..."
|
|
135
|
+
npm uninstall -g agent-relay 2>/dev/null || true
|
|
136
|
+
|
|
137
|
+
# ============================================
|
|
138
|
+
# Test 2: npx execution (without prior install)
|
|
139
|
+
# ============================================
|
|
140
|
+
log_header "Test 2: npx execution"
|
|
141
|
+
|
|
142
|
+
# Clear npm cache to ensure fresh download
|
|
143
|
+
log_info "Clearing npm cache for npx test..."
|
|
144
|
+
npm cache clean --force 2>/dev/null || true
|
|
145
|
+
|
|
146
|
+
# Test npx --version
|
|
147
|
+
log_info "Testing 'npx ${PACKAGE_SPEC} --version'..."
|
|
148
|
+
NPX_VERSION=$(npx -y "$PACKAGE_SPEC" --version 2>&1) || true
|
|
149
|
+
if [ -n "$NPX_VERSION" ]; then
|
|
150
|
+
log_info "Output: $NPX_VERSION"
|
|
151
|
+
if echo "$NPX_VERSION" | grep -qE '[0-9]+\.[0-9]+\.[0-9]+'; then
|
|
152
|
+
record_pass "npx --version returns valid version: $NPX_VERSION"
|
|
153
|
+
else
|
|
154
|
+
record_fail "npx --version output doesn't contain version number"
|
|
155
|
+
fi
|
|
156
|
+
else
|
|
157
|
+
record_fail "npx --version returned empty output"
|
|
158
|
+
fi
|
|
159
|
+
|
|
160
|
+
# Test npx help
|
|
161
|
+
log_info "Testing 'npx ${PACKAGE_SPEC} --help'..."
|
|
162
|
+
NPX_HELP=$(npx -y "$PACKAGE_SPEC" --help 2>&1) || true
|
|
163
|
+
if echo "$NPX_HELP" | grep -q "agent-relay"; then
|
|
164
|
+
record_pass "npx --help works"
|
|
165
|
+
else
|
|
166
|
+
record_fail "npx --help failed"
|
|
167
|
+
fi
|
|
168
|
+
|
|
169
|
+
# Test npx version command
|
|
170
|
+
log_info "Testing 'npx ${PACKAGE_SPEC} version'..."
|
|
171
|
+
NPX_VERSION_CMD=$(npx -y "$PACKAGE_SPEC" version 2>&1) || true
|
|
172
|
+
if echo "$NPX_VERSION_CMD" | grep -qE '[0-9]+\.[0-9]+\.[0-9]+'; then
|
|
173
|
+
record_pass "npx 'version' command works"
|
|
174
|
+
else
|
|
175
|
+
record_fail "npx 'version' command failed"
|
|
176
|
+
fi
|
|
177
|
+
|
|
178
|
+
# ============================================
|
|
179
|
+
# Test 3: Local project install
|
|
180
|
+
# ============================================
|
|
181
|
+
log_header "Test 3: Local project install"
|
|
182
|
+
|
|
183
|
+
# Create a test project
|
|
184
|
+
TEST_PROJECT_DIR=$(mktemp -d)
|
|
185
|
+
log_info "Created test project at: $TEST_PROJECT_DIR"
|
|
186
|
+
cd "$TEST_PROJECT_DIR"
|
|
187
|
+
|
|
188
|
+
# Initialize package.json
|
|
189
|
+
log_info "Initializing package.json..."
|
|
190
|
+
npm init -y > /dev/null 2>&1
|
|
191
|
+
|
|
192
|
+
# Install as local dependency
|
|
193
|
+
log_info "Installing ${PACKAGE_SPEC} locally..."
|
|
194
|
+
if npm install "$PACKAGE_SPEC" 2>&1; then
|
|
195
|
+
record_pass "Local npm install succeeded"
|
|
196
|
+
else
|
|
197
|
+
record_fail "Local npm install failed"
|
|
198
|
+
fi
|
|
199
|
+
|
|
200
|
+
# Test via npx (should use local version)
|
|
201
|
+
log_info "Testing 'npx agent-relay --version' (local)..."
|
|
202
|
+
LOCAL_VERSION=$(npx agent-relay --version 2>&1) || true
|
|
203
|
+
if [ -n "$LOCAL_VERSION" ]; then
|
|
204
|
+
if echo "$LOCAL_VERSION" | grep -qE '[0-9]+\.[0-9]+\.[0-9]+'; then
|
|
205
|
+
record_pass "Local install via npx works: $LOCAL_VERSION"
|
|
206
|
+
else
|
|
207
|
+
record_fail "Local install via npx doesn't return version"
|
|
208
|
+
fi
|
|
209
|
+
else
|
|
210
|
+
record_fail "Local install via npx failed"
|
|
211
|
+
fi
|
|
212
|
+
|
|
213
|
+
# Test via node_modules/.bin
|
|
214
|
+
log_info "Testing './node_modules/.bin/agent-relay --version'..."
|
|
215
|
+
if [ -x "./node_modules/.bin/agent-relay" ]; then
|
|
216
|
+
BIN_VERSION=$(./node_modules/.bin/agent-relay --version 2>&1) || true
|
|
217
|
+
if echo "$BIN_VERSION" | grep -qE '[0-9]+\.[0-9]+\.[0-9]+'; then
|
|
218
|
+
record_pass "Local bin executable works: $BIN_VERSION"
|
|
219
|
+
else
|
|
220
|
+
record_fail "Local bin executable doesn't return version"
|
|
221
|
+
fi
|
|
222
|
+
else
|
|
223
|
+
record_fail "Local bin executable not found or not executable"
|
|
224
|
+
fi
|
|
225
|
+
|
|
226
|
+
# Cleanup test project
|
|
227
|
+
log_info "Cleaning up test project..."
|
|
228
|
+
cd /home/testuser
|
|
229
|
+
rm -rf "$TEST_PROJECT_DIR"
|
|
230
|
+
|
|
231
|
+
# ============================================
|
|
232
|
+
# Summary
|
|
233
|
+
# ============================================
|
|
234
|
+
log_header "Verification Summary"
|
|
235
|
+
echo ""
|
|
236
|
+
log_info "Node.js: $(node --version)"
|
|
237
|
+
log_info "Package: $PACKAGE_SPEC"
|
|
238
|
+
echo ""
|
|
239
|
+
echo -e "Tests passed: ${GREEN}${TESTS_PASSED}${NC}"
|
|
240
|
+
echo -e "Tests failed: ${RED}${TESTS_FAILED}${NC}"
|
|
241
|
+
echo ""
|
|
242
|
+
|
|
243
|
+
if [ $TESTS_FAILED -eq 0 ]; then
|
|
244
|
+
log_success "All tests passed!"
|
|
245
|
+
exit 0
|
|
246
|
+
else
|
|
247
|
+
log_error "Some tests failed!"
|
|
248
|
+
exit 1
|
|
249
|
+
fi
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Frame encoding/decoding for the Agent Relay protocol.
|
|
3
|
-
* @agent-relay/sdk
|
|
4
|
-
*
|
|
5
|
-
* Wire format:
|
|
6
|
-
* - 1 byte: format indicator (0 = JSON, 1 = MessagePack)
|
|
7
|
-
* - 4 bytes: big-endian payload length
|
|
8
|
-
* - N bytes: payload (JSON or MessagePack encoded)
|
|
9
|
-
*
|
|
10
|
-
* Legacy format (for backwards compatibility):
|
|
11
|
-
* - 4 bytes: big-endian payload length
|
|
12
|
-
* - N bytes: JSON payload
|
|
13
|
-
*/
|
|
14
|
-
import type { Envelope } from './types.js';
|
|
15
|
-
export declare const MAX_FRAME_BYTES: number;
|
|
16
|
-
export declare const HEADER_SIZE = 5;
|
|
17
|
-
export declare const LEGACY_HEADER_SIZE = 4;
|
|
18
|
-
export type WireFormat = 'json' | 'msgpack';
|
|
19
|
-
/**
|
|
20
|
-
* Initialize MessagePack support.
|
|
21
|
-
* Install @msgpack/msgpack to enable: npm install @msgpack/msgpack
|
|
22
|
-
*/
|
|
23
|
-
export declare function initMessagePack(): Promise<boolean>;
|
|
24
|
-
/**
|
|
25
|
-
* Check if MessagePack is available.
|
|
26
|
-
*/
|
|
27
|
-
export declare function hasMessagePack(): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Encode a message envelope into a framed buffer.
|
|
30
|
-
*
|
|
31
|
-
* @param envelope - The envelope to encode
|
|
32
|
-
* @param format - Wire format to use (default: 'json')
|
|
33
|
-
* @returns Framed buffer ready for socket write
|
|
34
|
-
*/
|
|
35
|
-
export declare function encodeFrame(envelope: Envelope, format?: WireFormat): Buffer;
|
|
36
|
-
/**
|
|
37
|
-
* Encode a frame in legacy format (no format byte, JSON only).
|
|
38
|
-
* Used for backwards compatibility with older clients.
|
|
39
|
-
*/
|
|
40
|
-
export declare function encodeFrameLegacy(envelope: Envelope): Buffer;
|
|
41
|
-
/**
|
|
42
|
-
* Ring buffer-based frame parser for streaming data.
|
|
43
|
-
*/
|
|
44
|
-
export declare class FrameParser {
|
|
45
|
-
private ring;
|
|
46
|
-
private head;
|
|
47
|
-
private tail;
|
|
48
|
-
private readonly capacity;
|
|
49
|
-
private readonly maxFrameBytes;
|
|
50
|
-
private format;
|
|
51
|
-
private legacyMode;
|
|
52
|
-
constructor(maxFrameBytes?: number);
|
|
53
|
-
/**
|
|
54
|
-
* Set the expected wire format for parsing.
|
|
55
|
-
*/
|
|
56
|
-
setFormat(format: WireFormat): void;
|
|
57
|
-
/**
|
|
58
|
-
* Enable legacy mode (4-byte header, JSON only).
|
|
59
|
-
*/
|
|
60
|
-
setLegacyMode(legacy: boolean): void;
|
|
61
|
-
/**
|
|
62
|
-
* Get current unread bytes in buffer.
|
|
63
|
-
*/
|
|
64
|
-
get pendingBytes(): number;
|
|
65
|
-
/**
|
|
66
|
-
* Push data into the parser and extract complete frames.
|
|
67
|
-
*
|
|
68
|
-
* @param data - Incoming data buffer
|
|
69
|
-
* @returns Array of parsed envelope frames
|
|
70
|
-
*/
|
|
71
|
-
push(data: Buffer): Envelope[];
|
|
72
|
-
private extractFrames;
|
|
73
|
-
private decodePayload;
|
|
74
|
-
private compact;
|
|
75
|
-
/**
|
|
76
|
-
* Reset parser state.
|
|
77
|
-
*/
|
|
78
|
-
reset(): void;
|
|
79
|
-
}
|
|
80
|
-
//# sourceMappingURL=framing.d.ts.map
|