






















@@ -21,6 +21,7 @@ run_channel_scenario() {
2121set -euo pipefail
22222323source scripts/lib/openclaw-e2e-instance.sh
24+source scripts/e2e/lib/bundled-channel/common.sh
2425openclaw_e2e_eval_test_state_from_b64 "${OPENCLAW_TEST_STATE_SCRIPT_B64:?missing OPENCLAW_TEST_STATE_SCRIPT_B64}"
2526export NPM_CONFIG_PREFIX="$HOME/.npm-global"
2627export PATH="$NPM_CONFIG_PREFIX/bin:$PATH"
@@ -79,154 +80,12 @@ test -d "$package_root/dist/extensions/slack"
7980test -d "$package_root/dist/extensions/feishu"
8081test -d "$package_root/dist/extensions/memory-lancedb"
818282-stage_root() {
83- printf "%s/.openclaw/plugin-runtime-deps" "$HOME"
84-}
85-86-find_external_dep_package() {
87- local dep_path="$1"
88- find "$(stage_root)" -maxdepth 12 -path "*/node_modules/$dep_path/package.json" -type f -print -quit 2>/dev/null || true
89-}
90-91-assert_package_dep_absent() {
92- local channel="$1"
93- local dep_path="$2"
94- for candidate in \
95- "$package_root/dist/extensions/$channel/node_modules/$dep_path/package.json" \
96- "$package_root/dist/extensions/node_modules/$dep_path/package.json" \
97- "$package_root/node_modules/$dep_path/package.json"; do
98- if [ -f "$candidate" ]; then
99- echo "packaged install should not mutate package tree for $channel: $candidate" >&2
100- exit 1
101- fi
102- done
103-}
104-10583if [ -d "$package_root/dist/extensions/$CHANNEL/node_modules" ]; then
10684 echo "$CHANNEL runtime deps should not be preinstalled in package" >&2
10785 find "$package_root/dist/extensions/$CHANNEL/node_modules" -maxdepth 2 -type f | head -20 >&2 || true
10886 exit 1
10987fi
11088111-write_config() {
112- local mode="$1"
113- node - <<'NODE' "$mode" "$TOKEN" "$PORT"
114-const fs = require("node:fs");
115-const path = require("node:path");
116-117-const mode = process.argv[2];
118-const token = process.argv[3];
119-const port = Number(process.argv[4]);
120-const configPath = path.join(process.env.HOME, ".openclaw", "openclaw.json");
121-const config = fs.existsSync(configPath)
122- ? JSON.parse(fs.readFileSync(configPath, "utf8"))
123- : {};
124-125-config.gateway = {
126- ...(config.gateway || {}),
127- port,
128- auth: { mode: "token", token },
129- controlUi: { enabled: false },
130-};
131-config.agents = {
132- ...(config.agents || {}),
133- defaults: {
134- ...(config.agents?.defaults || {}),
135- model: { primary: "openai/gpt-4.1-mini" },
136- },
137-};
138-config.models = {
139- ...(config.models || {}),
140- providers: {
141- ...(config.models?.providers || {}),
142- openai: {
143- ...(config.models?.providers?.openai || {}),
144- apiKey: process.env.OPENAI_API_KEY,
145- baseUrl: "https://api.openai.com/v1",
146- models: [],
147- },
148- },
149-};
150-config.plugins = {
151- ...(config.plugins || {}),
152- enabled: true,
153-};
154-155-if (mode === "telegram") {
156- config.channels = {
157- ...(config.channels || {}),
158- telegram: {
159- ...(config.channels?.telegram || {}),
160- enabled: true,
161- dmPolicy: "disabled",
162- groupPolicy: "disabled",
163- },
164- };
165-}
166-if (mode === "discord") {
167- config.channels = {
168- ...(config.channels || {}),
169- discord: {
170- ...(config.channels?.discord || {}),
171- enabled: true,
172- dmPolicy: "disabled",
173- groupPolicy: "disabled",
174- },
175- };
176-}
177-if (mode === "slack") {
178- config.channels = {
179- ...(config.channels || {}),
180- slack: {
181- ...(config.channels?.slack || {}),
182- enabled: true,
183- },
184- };
185-}
186-if (mode === "feishu") {
187- config.channels = {
188- ...(config.channels || {}),
189- feishu: {
190- ...(config.channels?.feishu || {}),
191- enabled: true,
192- },
193- };
194-}
195-if (mode === "memory-lancedb") {
196- config.plugins = {
197- ...(config.plugins || {}),
198- enabled: true,
199- allow: [...new Set([...(config.plugins?.allow || []), "memory-lancedb"])],
200- slots: {
201- ...(config.plugins?.slots || {}),
202- memory: "memory-lancedb",
203- },
204- entries: {
205- ...(config.plugins?.entries || {}),
206- "memory-lancedb": {
207- ...(config.plugins?.entries?.["memory-lancedb"] || {}),
208- enabled: true,
209- config: {
210- ...(config.plugins?.entries?.["memory-lancedb"]?.config || {}),
211- embedding: {
212- ...(config.plugins?.entries?.["memory-lancedb"]?.config?.embedding || {}),
213- apiKey: process.env.OPENAI_API_KEY,
214- model: "text-embedding-3-small",
215- },
216- dbPath: "~/.openclaw/memory/lancedb-e2e",
217- autoCapture: false,
218- autoRecall: false,
219- },
220- },
221- },
222- };
223-}
224-225-fs.mkdirSync(path.dirname(configPath), { recursive: true });
226-fs.writeFileSync(configPath, `${JSON.stringify(config, null, 2)}\n`, "utf8");
227-NODE
228-}
229-23089start_gateway() {
23190 local log_file="$1"
23291 local skip_sidecars="${2:-0}"
@@ -347,12 +206,12 @@ assert_installed_once() {
347206 if [ "$count" -eq 1 ]; then
348207 return 0
349208 fi
350- if [ "$count" -eq 0 ] && [ -n "$(find_external_dep_package "$dep_path")" ]; then
209+ if [ "$count" -eq 0 ] && [ -n "$(bundled_channel_find_external_dep_package "$dep_path")" ]; then
351210 return 0
352211 fi
353212 echo "expected one runtime deps install log or staged dependency sentinel for $channel, got $count log lines" >&2
354213 cat "$log_file" >&2
355- find "$(stage_root)" -maxdepth 12 -type f | sort | head -120 >&2 || true
214+ find "$(bundled_channel_stage_root)" -maxdepth 12 -type f | sort | head -120 >&2 || true
356215 exit 1
357216}
358217@@ -369,24 +228,13 @@ assert_not_installed() {
369228assert_dep_sentinel() {
370229 local channel="$1"
371230 local dep_path="$2"
372- local sentinel
373- sentinel="$(find_external_dep_package "$dep_path")"
374- if [ -z "$sentinel" ]; then
375- echo "missing external dependency sentinel for $channel: $dep_path" >&2
376- find "$(stage_root)" -maxdepth 12 -type f | sort | head -120 >&2 || true
377- exit 1
378- fi
379- assert_package_dep_absent "$channel" "$dep_path"
231+ bundled_channel_assert_dep_available "$channel" "$dep_path" "$package_root"
380232}
381233382234assert_no_dep_sentinel() {
383235 local channel="$1"
384236 local dep_path="$2"
385- assert_package_dep_absent "$channel" "$dep_path"
386- if [ -n "$(find_external_dep_package "$dep_path")" ]; then
387- echo "external dependency sentinel should be absent before activation for $channel: $dep_path" >&2
388- exit 1
389- fi
237+ bundled_channel_assert_no_dep_available "$channel" "$dep_path" "$package_root"
390238}
391239392240assert_no_install_stage() {
@@ -400,14 +248,14 @@ assert_no_install_stage() {
400248}
401249402250echo "Starting baseline gateway with OpenAI configured..."
403-write_config baseline
251+bundled_channel_write_config baseline
404252start_gateway "/tmp/openclaw-$CHANNEL-baseline.log" 1
405253wait_for_gateway_health "/tmp/openclaw-$CHANNEL-baseline.log"
406254stop_gateway
407255assert_no_dep_sentinel "$CHANNEL" "$DEP_SENTINEL"
408256409257echo "Enabling $CHANNEL by config edit, then restarting gateway..."
410-write_config "$CHANNEL"
258+bundled_channel_write_config "$CHANNEL"
411259start_gateway "/tmp/openclaw-$CHANNEL-first.log"
412260wait_for_gateway_health "/tmp/openclaw-$CHANNEL-first.log"
413261assert_installed_once "/tmp/openclaw-$CHANNEL-first.log" "$CHANNEL" "$DEP_SENTINEL"
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。