Files
openclaw/scripts/build-discord-activity-sdk.mjs
Peter Steinberger ddc9ec3f36 feat(discord): opt-in Discord Activities widget support (#107442)
Adds a Discord Activities integration so an agent can show a self-contained
HTML widget to Discord users, opened as a sandboxed Activity inside the client.
Off by default: routes, the discord_widget tool, and the launch handler register
only when channels.discord.activities is configured. OAuth identifies the user
and gates on the account allowlist; widget lookup is capability- or
instance-validated; token exchange is rate-limited; widget HTML runs in a
no-network sandboxed iframe.
2026-07-15 04:07:46 -07:00

25 lines
725 B
JavaScript

#!/usr/bin/env node
import fs from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { build } from "esbuild";
const modulePath = fileURLToPath(import.meta.url);
const repoRoot = path.resolve(path.dirname(modulePath), "..");
const discordDir = path.join(repoRoot, "extensions/discord");
const outputPath = path.join(repoRoot, "extensions/discord/assets/embedded-app-sdk.mjs");
await fs.mkdir(path.dirname(outputPath), { recursive: true });
await build({
entryPoints: ["@discord/embedded-app-sdk"],
absWorkingDir: discordDir,
bundle: true,
platform: "browser",
target: "es2020",
format: "esm",
minify: true,
legalComments: "none",
outfile: outputPath,
});