feat: add rule dispatch, cross-plugin API, and Docker integration test
Wire rule registry and authenticated callbacks into both client and server runtimes; expose __yonexusClient / __yonexusServer on globalThis for cross-plugin communication. Add Docker-based integration test with server-test-plugin (test_ping echo) and client-test-plugin (test_pong receiver), plus docker-compose setup. Fix transport race condition where a stale _connections entry caused promoteToAuthenticated to silently fail. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
69
tests/docker/client/entrypoint.sh
Normal file
69
tests/docker/client/entrypoint.sh
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
: "${IDENTIFIER:?IDENTIFIER is required}"
|
||||
: "${NOTIFY_BOT_TOKEN:?NOTIFY_BOT_TOKEN is required}"
|
||||
: "${ADMIN_USER_ID:?ADMIN_USER_ID is required}"
|
||||
: "${YONEXUS_SERVER_URL:?YONEXUS_SERVER_URL is required}"
|
||||
|
||||
STATE_DIR=/app/.openclaw-state
|
||||
PLUGIN_DIR="$STATE_DIR/plugins/Yonexus.Client"
|
||||
TEST_PLUGIN_DIR="$STATE_DIR/plugins/yonexus-client-test"
|
||||
|
||||
# Install plugin dist + manifest into isolated state directory
|
||||
node /app/scripts/install.mjs --install --openclaw-profile-path "$STATE_DIR"
|
||||
# Symlink node_modules so bare-module imports (e.g. ws) resolve from plugin dir
|
||||
ln -sf /app/node_modules "$PLUGIN_DIR/node_modules"
|
||||
|
||||
# Install test plugin (plain .mjs, no compilation needed)
|
||||
mkdir -p "$TEST_PLUGIN_DIR"
|
||||
cp /app/client-test-plugin/index.mjs "$TEST_PLUGIN_DIR/"
|
||||
cp /app/client-test-plugin/openclaw.plugin.json "$TEST_PLUGIN_DIR/"
|
||||
|
||||
# Write openclaw config — plugin id is "yonexus-client" per openclaw.plugin.json
|
||||
mkdir -p "$STATE_DIR"
|
||||
cat > "$STATE_DIR/openclaw.json" << EOF
|
||||
{
|
||||
"meta": { "lastTouchedVersion": "2026.4.9" },
|
||||
"gateway": { "bind": "loopback" },
|
||||
"agents": { "defaults": { "workspace": "$STATE_DIR/workspace" } },
|
||||
"plugins": {
|
||||
"allow": ["yonexus-client", "yonexus-client-test"],
|
||||
"load": { "paths": ["$PLUGIN_DIR", "$TEST_PLUGIN_DIR"] },
|
||||
"installs": {
|
||||
"yonexus-client": {
|
||||
"source": "path",
|
||||
"sourcePath": "$PLUGIN_DIR",
|
||||
"installPath": "$PLUGIN_DIR",
|
||||
"version": "0.1.0",
|
||||
"installedAt": "2026-04-10T00:00:00.000Z"
|
||||
},
|
||||
"yonexus-client-test": {
|
||||
"source": "path",
|
||||
"sourcePath": "$TEST_PLUGIN_DIR",
|
||||
"installPath": "$TEST_PLUGIN_DIR",
|
||||
"version": "0.1.0",
|
||||
"installedAt": "2026-04-10T00:00:00.000Z"
|
||||
}
|
||||
},
|
||||
"entries": {
|
||||
"yonexus-client": {
|
||||
"enabled": true,
|
||||
"config": {
|
||||
"mainHost": "$YONEXUS_SERVER_URL",
|
||||
"identifier": "$IDENTIFIER",
|
||||
"notifyBotToken": "$NOTIFY_BOT_TOKEN",
|
||||
"adminUserId": "$ADMIN_USER_ID"
|
||||
}
|
||||
},
|
||||
"yonexus-client-test": {
|
||||
"enabled": true,
|
||||
"config": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
export OPENCLAW_STATE_DIR="$STATE_DIR"
|
||||
exec openclaw gateway run --allow-unconfigured
|
||||
Reference in New Issue
Block a user