refactor(canvas): host A2UI via gateway
This commit is contained in:
19
scripts/canvas-a2ui-copy.ts
Normal file
19
scripts/canvas-a2ui-copy.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const srcDir = path.join(repoRoot, "src", "canvas-host", "a2ui");
|
||||
const outDir = path.join(repoRoot, "dist", "canvas-host", "a2ui");
|
||||
|
||||
async function main() {
|
||||
await fs.stat(path.join(srcDir, "index.html"));
|
||||
await fs.stat(path.join(srcDir, "a2ui.bundle.js"));
|
||||
await fs.mkdir(path.dirname(outDir), { recursive: true });
|
||||
await fs.cp(srcDir, outDir, { recursive: true });
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
console.error(String(err));
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -156,6 +156,10 @@ if [[ "${SKIP_GATEWAY_PACKAGE:-0}" != "1" ]]; then
|
||||
--define "__CLAWDIS_VERSION__=\\\"$PKG_VERSION\\\""
|
||||
chmod +x "$CLI_OUT"
|
||||
|
||||
echo "🎨 Copying gateway A2UI host assets"
|
||||
rm -rf "$RELAY_DIR/a2ui"
|
||||
cp -R "$ROOT_DIR/src/canvas-host/a2ui" "$RELAY_DIR/a2ui"
|
||||
|
||||
echo "📄 Writing embedded runtime package.json (Pi compatibility)"
|
||||
cat > "$RELAY_DIR/package.json" <<JSON
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ log "==> Killing existing Clawdis instances"
|
||||
kill_all_clawdis
|
||||
stop_launch_agent
|
||||
|
||||
# Bundle built-in Canvas A2UI shell (single-file JS, shipped in the app bundle).
|
||||
# Bundle Gateway-hosted Canvas A2UI assets.
|
||||
run_step "bundle canvas a2ui" bash -lc "cd '${ROOT_DIR}' && pnpm canvas:a2ui:bundle"
|
||||
|
||||
# 2) Rebuild into the same path the packager consumes (.build).
|
||||
|
||||
Reference in New Issue
Block a user