openclaw/scripts/bundle-a2ui.sh
Iris Deploy e954a55f1f feat(ndr): add NDR channel plugin for nostr-double-ratchet
Adds NDR (Nostr Double Ratchet) as a channel extension providing
forward-secure E2E encrypted messaging over Nostr relays.

Features:
- Full channel implementation with send/receive/react
- Onboarding flow with invite URL acceptance and hello message
- Auto-generated identity if not configured
- Configurable relays (defaults to popular Nostr relays)
- Owner pubkey authentication for message filtering

Requires external `ndr` CLI (cargo install ndr).

Control surface: chat.iris.to

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-27 12:09:26 +01:00

65 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
on_error() {
echo "A2UI bundling failed. Re-run with: pnpm canvas:a2ui:bundle" >&2
echo "If this persists, verify pnpm deps and try again." >&2
}
trap on_error ERR
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
HASH_FILE="$ROOT_DIR/src/canvas-host/a2ui/.bundle.hash"
OUTPUT_FILE="$ROOT_DIR/src/canvas-host/a2ui/a2ui.bundle.js"
INPUT_PATHS=(
"$ROOT_DIR/package.json"
"$ROOT_DIR/pnpm-lock.yaml"
"$ROOT_DIR/vendor/a2ui/renderers/lit"
"$ROOT_DIR/apps/shared/ClawdbotKit/Tools/CanvasA2UI"
)
collect_files() {
local path
for path in "${INPUT_PATHS[@]}"; do
if [[ -d "$path" ]]; then
find "$path" -type f -print0
else
printf '%s\0' "$path"
fi
done
}
compute_hash() {
collect_files \
| LC_ALL=C sort -z \
| xargs -0 shasum -a 256 \
| shasum -a 256 \
| awk '{print $1}'
}
# In Docker builds (vendor/ and apps/ excluded), skip bundling if output exists
for path in "${INPUT_PATHS[@]}"; do
if [[ ! -e "$path" ]]; then
if [[ -f "$OUTPUT_FILE" ]]; then
echo "A2UI bundle exists; source files unavailable (docker build?); skipping."
exit 0
fi
echo "Error: Required path $path not found and no pre-built bundle exists." >&2
exit 1
fi
done
current_hash="$(compute_hash)"
if [[ -f "$HASH_FILE" ]]; then
previous_hash="$(cat "$HASH_FILE")"
if [[ "$previous_hash" == "$current_hash" && -f "$OUTPUT_FILE" ]]; then
echo "A2UI bundle up to date; skipping."
exit 0
fi
fi
pnpm -s exec tsc -p vendor/a2ui/renderers/lit/tsconfig.json
rolldown -c apps/shared/ClawdbotKit/Tools/CanvasA2UI/rolldown.config.mjs
echo "$current_hash" > "$HASH_FILE"