Vendor OpenClaw source as Adolf fork baseline
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
This commit is contained in:
214
scripts/e2e/parallels/macos-discord.ts
Normal file
214
scripts/e2e/parallels/macos-discord.ts
Normal file
@@ -0,0 +1,214 @@
|
||||
// Macos Discord script supports OpenClaw repository automation.
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import type { MacosGuest } from "./guest-transports.ts";
|
||||
import { run, say, shellQuote, warn } from "./host-command.ts";
|
||||
|
||||
export type DiscordSmokePhase = "fresh" | "upgrade";
|
||||
|
||||
export interface MacosDiscordConfig {
|
||||
channelId: string;
|
||||
guildId: string;
|
||||
token: string;
|
||||
}
|
||||
|
||||
export class MacosDiscordSmoke {
|
||||
constructor(
|
||||
private input: {
|
||||
config: MacosDiscordConfig;
|
||||
guest: MacosGuest;
|
||||
guestNode: string;
|
||||
guestOpenClaw: string;
|
||||
guestOpenClawEntry: string;
|
||||
runDir: string;
|
||||
vmName: string;
|
||||
},
|
||||
) {}
|
||||
|
||||
configure(): void {
|
||||
const guilds = JSON.stringify({
|
||||
[this.input.config.guildId]: {
|
||||
channels: {
|
||||
[this.input.config.channelId]: {
|
||||
enabled: true,
|
||||
requireMention: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
this.input.guest.sh(`set -eu
|
||||
${this.input.guestNode} ${this.input.guestOpenClawEntry} config set channels.discord.token ${shellQuote(this.input.config.token)}
|
||||
${this.input.guestNode} ${this.input.guestOpenClawEntry} config set channels.discord.enabled true
|
||||
${this.input.guestNode} ${this.input.guestOpenClawEntry} config set channels.discord.groupPolicy allowlist
|
||||
${this.input.guestNode} ${this.input.guestOpenClawEntry} config set channels.discord.guilds ${shellQuote(guilds)} --strict-json
|
||||
${this.input.guestNode} ${this.input.guestOpenClawEntry} doctor --fix --yes --non-interactive
|
||||
${this.input.guestNode} - <<'JS'
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
const configPath = path.join(process.env.HOME || "", ".openclaw", "openclaw.json");
|
||||
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
||||
config.plugins = config.plugins && typeof config.plugins === "object" ? config.plugins : {};
|
||||
const allow = Array.isArray(config.plugins.allow) ? config.plugins.allow : [];
|
||||
config.plugins.allow = Array.from(new Set([...allow, "discord"]));
|
||||
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\\n");
|
||||
JS
|
||||
${this.input.guestNode} ${this.input.guestOpenClawEntry} plugins enable discord
|
||||
${this.input.guestNode} ${this.input.guestOpenClawEntry} gateway restart
|
||||
${this.input.guestNode} ${this.input.guestOpenClawEntry} channels status --probe --json`);
|
||||
}
|
||||
|
||||
async runRoundtrip(phase: DiscordSmokePhase): Promise<void> {
|
||||
const nonce = randomUUID();
|
||||
const outboundNonce = `${phase}-out-${nonce}`;
|
||||
const inboundNonce = `${phase}-in-${nonce}`;
|
||||
const outboundLog = path.join(this.input.runDir, `${phase}.discord-send.json`);
|
||||
const sentIdFile = path.join(this.input.runDir, `${phase}.discord-sent-message-id`);
|
||||
const hostIdFile = path.join(this.input.runDir, `${phase}.discord-host-message-id`);
|
||||
const outbound = this.input.guest.exec([
|
||||
this.input.guestOpenClaw,
|
||||
"message",
|
||||
"send",
|
||||
"--channel",
|
||||
"discord",
|
||||
"--target",
|
||||
`channel:${this.input.config.channelId}`,
|
||||
"--message",
|
||||
`parallels-macos-smoke-outbound-${outboundNonce}`,
|
||||
"--silent",
|
||||
"--json",
|
||||
]);
|
||||
await writeFile(outboundLog, `${outbound}\n`, "utf8");
|
||||
const sentId = this.discordMessageId(outbound);
|
||||
await writeFile(sentIdFile, `${sentId}\n`, "utf8");
|
||||
await this.waitForHostVisibility(outboundNonce, sentId);
|
||||
const hostId = await this.postDiscordMessage(`parallels-macos-smoke-inbound-${inboundNonce}`);
|
||||
await writeFile(hostIdFile, `${hostId}\n`, "utf8");
|
||||
this.waitForGuestReadback(inboundNonce);
|
||||
}
|
||||
|
||||
async cleanupMessages(): Promise<void> {
|
||||
for (const name of [
|
||||
"fresh.discord-sent-message-id",
|
||||
"fresh.discord-host-message-id",
|
||||
"upgrade.discord-sent-message-id",
|
||||
"upgrade.discord-host-message-id",
|
||||
]) {
|
||||
const filePath = path.join(this.input.runDir, name);
|
||||
const id = await readFile(filePath, "utf8").catch(() => "");
|
||||
if (id.trim()) {
|
||||
await this.discordApi(
|
||||
"DELETE",
|
||||
`/channels/${this.input.config.channelId}/messages/${id.trim()}`,
|
||||
).catch(() => "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stopVmAfterSuccessfulSmoke(freshDiscord: string, upgradeDiscord: string): void {
|
||||
if (freshDiscord !== "pass" && upgradeDiscord !== "pass") {
|
||||
return;
|
||||
}
|
||||
say(`Stop ${this.input.vmName} after successful Discord smoke`);
|
||||
const result = run("prlctl", ["stop", this.input.vmName], {
|
||||
check: false,
|
||||
quiet: true,
|
||||
timeoutMs: 120_000,
|
||||
});
|
||||
if (result.status !== 0) {
|
||||
warn(
|
||||
`failed to stop ${this.input.vmName} after successful Discord smoke (rc=${result.status})`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private discordMessageId(payloadText: string): string {
|
||||
const payload = JSON.parse(payloadText) as {
|
||||
payload?: { messageId?: string; result?: { messageId?: string } };
|
||||
};
|
||||
const id = payload.payload?.messageId || payload.payload?.result?.messageId;
|
||||
if (!id) {
|
||||
throw new Error("messageId missing from send output");
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
private async discordApi(method: string, apiPath: string, payload?: unknown): Promise<string> {
|
||||
const args = [
|
||||
"-fsS",
|
||||
"-X",
|
||||
method,
|
||||
"-H",
|
||||
`Authorization: Bot ${this.input.config.token}`,
|
||||
...(payload == null
|
||||
? []
|
||||
: ["-H", "Content-Type: application/json", "--data", JSON.stringify(payload)]),
|
||||
`https://discord.com/api/v10${apiPath}`,
|
||||
];
|
||||
return run("curl", args, { quiet: true }).stdout;
|
||||
}
|
||||
|
||||
private async waitForHostVisibility(nonce: string, messageId: string): Promise<void> {
|
||||
const deadline = Date.now() + 180_000;
|
||||
while (Date.now() < deadline) {
|
||||
const direct = await this.discordApi(
|
||||
"GET",
|
||||
`/channels/${this.input.config.channelId}/messages/${messageId}`,
|
||||
).catch(() => "");
|
||||
if (direct.includes(nonce)) {
|
||||
return;
|
||||
}
|
||||
const recent = await this.discordApi(
|
||||
"GET",
|
||||
`/channels/${this.input.config.channelId}/messages?limit=20`,
|
||||
).catch(() => "");
|
||||
if (recent.includes(nonce)) {
|
||||
return;
|
||||
}
|
||||
run("sleep", ["2"], { quiet: true });
|
||||
}
|
||||
throw new Error("Discord host visibility timed out");
|
||||
}
|
||||
|
||||
private async postDiscordMessage(content: string): Promise<string> {
|
||||
const response = await this.discordApi(
|
||||
"POST",
|
||||
`/channels/${this.input.config.channelId}/messages`,
|
||||
{
|
||||
content,
|
||||
flags: 4096,
|
||||
},
|
||||
);
|
||||
const id = (JSON.parse(response) as { id?: string }).id;
|
||||
if (!id) {
|
||||
throw new Error("host Discord post missing message id");
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
private waitForGuestReadback(nonce: string): void {
|
||||
const deadline = Date.now() + 180_000;
|
||||
while (Date.now() < deadline) {
|
||||
const result = this.input.guest.run(
|
||||
[
|
||||
this.input.guestOpenClaw,
|
||||
"message",
|
||||
"read",
|
||||
"--channel",
|
||||
"discord",
|
||||
"--target",
|
||||
`channel:${this.input.config.channelId}`,
|
||||
"--limit",
|
||||
"20",
|
||||
"--json",
|
||||
],
|
||||
{ check: false },
|
||||
);
|
||||
if (result.status === 0 && result.stdout.includes(nonce)) {
|
||||
return;
|
||||
}
|
||||
run("sleep", ["3"], { quiet: true });
|
||||
}
|
||||
throw new Error("Discord guest readback timed out");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user