Merge branch 'main' into fix/brave_api

This commit is contained in:
Kuzey Cimen 2026-01-27 16:24:54 +00:00 committed by GitHub
commit 4614b4de4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 161 additions and 73 deletions

View File

@ -76,7 +76,7 @@ jobs:
command: pnpm lint command: pnpm lint
- runtime: node - runtime: node
task: test task: test
command: pnpm test command: pnpm canvas:a2ui:bundle && pnpm test
- runtime: node - runtime: node
task: build task: build
command: pnpm build command: pnpm build
@ -88,7 +88,7 @@ jobs:
command: pnpm format command: pnpm format
- runtime: bun - runtime: bun
task: test task: test
command: bunx vitest run command: pnpm canvas:a2ui:bundle && bunx vitest run
- runtime: bun - runtime: bun
task: build task: build
command: bunx tsc -p tsconfig.json command: bunx tsc -p tsconfig.json
@ -188,6 +188,7 @@ jobs:
runs-on: blacksmith-4vcpu-windows-2025 runs-on: blacksmith-4vcpu-windows-2025
env: env:
NODE_OPTIONS: --max-old-space-size=4096 NODE_OPTIONS: --max-old-space-size=4096
CLAWDBOT_TEST_WORKERS: 1
defaults: defaults:
run: run:
shell: bash shell: bash
@ -200,7 +201,7 @@ jobs:
command: pnpm lint command: pnpm lint
- runtime: node - runtime: node
task: test task: test
command: pnpm test command: pnpm canvas:a2ui:bundle && pnpm test
- runtime: node - runtime: node
task: build task: build
command: pnpm build command: pnpm build

View File

@ -37,5 +37,5 @@ jobs:
CLAWDBOT_NO_ONBOARD: "1" CLAWDBOT_NO_ONBOARD: "1"
CLAWDBOT_INSTALL_SMOKE_SKIP_CLI: "1" CLAWDBOT_INSTALL_SMOKE_SKIP_CLI: "1"
CLAWDBOT_INSTALL_SMOKE_SKIP_NONROOT: ${{ github.event_name == 'pull_request' && '1' || '0' }} CLAWDBOT_INSTALL_SMOKE_SKIP_NONROOT: ${{ github.event_name == 'pull_request' && '1' || '0' }}
CLAWDBOT_INSTALL_SMOKE_PREVIOUS: "2026.1.11-4" CLAWDBOT_INSTALL_SMOKE_SKIP_PREVIOUS: "1"
run: pnpm test:install:smoke run: pnpm test:install:smoke

View File

@ -24,7 +24,7 @@ COPY scripts ./scripts
RUN pnpm install --frozen-lockfile RUN pnpm install --frozen-lockfile
COPY . . COPY . .
RUN pnpm build RUN CLAWDBOT_A2UI_SKIP_MISSING=1 pnpm build
# Force pnpm for UI build (Bun may fail on ARM/Synology architectures) # Force pnpm for UI build (Bun may fail on ARM/Synology architectures)
ENV CLAWDBOT_PREFER_PNPM=1 ENV CLAWDBOT_PREFER_PNPM=1
RUN pnpm ui:install RUN pnpm ui:install

38
pnpm-lock.yaml generated
View File

@ -314,17 +314,17 @@ importers:
specifier: ^10.5.0 specifier: ^10.5.0
version: 10.5.0 version: 10.5.0
devDependencies: devDependencies:
clawdbot: moltbot:
specifier: workspace:* specifier: workspace:*
version: link:../../packages/clawdbot version: link:../..
extensions/imessage: {} extensions/imessage: {}
extensions/line: extensions/line:
devDependencies: devDependencies:
clawdbot: moltbot:
specifier: workspace:* specifier: workspace:*
version: link:../../packages/clawdbot version: link:../..
extensions/llm-task: {} extensions/llm-task: {}
@ -348,17 +348,17 @@ importers:
specifier: ^4.3.6 specifier: ^4.3.6
version: 4.3.6 version: 4.3.6
devDependencies: devDependencies:
clawdbot: moltbot:
specifier: workspace:* specifier: workspace:*
version: link:../../packages/clawdbot version: link:../..
extensions/mattermost: {} extensions/mattermost: {}
extensions/memory-core: extensions/memory-core:
dependencies: dependencies:
clawdbot: moltbot:
specifier: '>=2026.1.24-3' specifier: '>=2026.1.26'
version: 2026.1.24-3(@types/express@5.0.6)(audio-decode@2.2.3)(devtools-protocol@0.0.1561482)(typescript@5.9.3) version: link:../..
extensions/memory-lancedb: extensions/memory-lancedb:
dependencies: dependencies:
@ -383,9 +383,9 @@ importers:
'@microsoft/agents-hosting-extensions-teams': '@microsoft/agents-hosting-extensions-teams':
specifier: ^1.2.2 specifier: ^1.2.2
version: 1.2.2 version: 1.2.2
clawdbot: moltbot:
specifier: workspace:* specifier: workspace:*
version: link:../../packages/clawdbot version: link:../..
express: express:
specifier: ^5.2.1 specifier: ^5.2.1
version: 5.2.1 version: 5.2.1
@ -397,9 +397,9 @@ importers:
extensions/nostr: extensions/nostr:
dependencies: dependencies:
clawdbot: moltbot:
specifier: workspace:* specifier: workspace:*
version: link:../../packages/clawdbot version: link:../..
nostr-tools: nostr-tools:
specifier: ^2.20.0 specifier: ^2.20.0
version: 2.20.0(typescript@5.9.3) version: 2.20.0(typescript@5.9.3)
@ -439,9 +439,9 @@ importers:
specifier: ^4.3.5 specifier: ^4.3.5
version: 4.3.6 version: 4.3.6
devDependencies: devDependencies:
clawdbot: moltbot:
specifier: workspace:* specifier: workspace:*
version: link:../../packages/clawdbot version: link:../..
extensions/voice-call: extensions/voice-call:
dependencies: dependencies:
@ -459,9 +459,9 @@ importers:
extensions/zalo: extensions/zalo:
dependencies: dependencies:
clawdbot: moltbot:
specifier: workspace:* specifier: workspace:*
version: link:../../packages/clawdbot version: link:../..
undici: undici:
specifier: 7.19.0 specifier: 7.19.0
version: 7.19.0 version: 7.19.0
@ -471,9 +471,9 @@ importers:
'@sinclair/typebox': '@sinclair/typebox':
specifier: 0.34.47 specifier: 0.34.47
version: 0.34.47 version: 0.34.47
clawdbot: moltbot:
specifier: workspace:* specifier: workspace:*
version: link:../../packages/clawdbot version: link:../..
packages/clawdbot: packages/clawdbot:
dependencies: dependencies:

View File

@ -10,31 +10,66 @@ trap on_error ERR
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
HASH_FILE="$ROOT_DIR/src/canvas-host/a2ui/.bundle.hash" HASH_FILE="$ROOT_DIR/src/canvas-host/a2ui/.bundle.hash"
OUTPUT_FILE="$ROOT_DIR/src/canvas-host/a2ui/a2ui.bundle.js" OUTPUT_FILE="$ROOT_DIR/src/canvas-host/a2ui/a2ui.bundle.js"
A2UI_RENDERER_DIR="$ROOT_DIR/vendor/a2ui/renderers/lit"
A2UI_APP_DIR="$ROOT_DIR/apps/shared/ClawdbotKit/Tools/CanvasA2UI"
# Docker builds exclude vendor/apps via .dockerignore.
# In that environment we must keep the prebuilt bundle.
if [[ ! -d "$A2UI_RENDERER_DIR" || ! -d "$A2UI_APP_DIR" ]]; then
echo "A2UI sources missing; keeping prebuilt bundle."
exit 0
fi
INPUT_PATHS=( INPUT_PATHS=(
"$ROOT_DIR/package.json" "$ROOT_DIR/package.json"
"$ROOT_DIR/pnpm-lock.yaml" "$ROOT_DIR/pnpm-lock.yaml"
"$ROOT_DIR/vendor/a2ui/renderers/lit" "$A2UI_RENDERER_DIR"
"$ROOT_DIR/apps/shared/ClawdbotKit/Tools/CanvasA2UI" "$A2UI_APP_DIR"
) )
collect_files() { compute_hash() {
local path ROOT_DIR="$ROOT_DIR" node --input-type=module - "${INPUT_PATHS[@]}" <<'NODE'
for path in "${INPUT_PATHS[@]}"; do import { createHash } from "node:crypto";
if [[ -d "$path" ]]; then import { promises as fs } from "node:fs";
find "$path" -type f -print0 import path from "node:path";
else
printf '%s\0' "$path" const rootDir = process.env.ROOT_DIR ?? process.cwd();
fi const inputs = process.argv.slice(2);
done const files = [];
async function walk(entryPath) {
const st = await fs.stat(entryPath);
if (st.isDirectory()) {
const entries = await fs.readdir(entryPath);
for (const entry of entries) {
await walk(path.join(entryPath, entry));
}
return;
}
files.push(entryPath);
} }
compute_hash() { for (const input of inputs) {
collect_files \ await walk(input);
| LC_ALL=C sort -z \ }
| xargs -0 shasum -a 256 \
| shasum -a 256 \ function normalize(p) {
| awk '{print $1}' return p.split(path.sep).join("/");
}
files.sort((a, b) => normalize(a).localeCompare(normalize(b)));
const hash = createHash("sha256");
for (const filePath of files) {
const rel = normalize(path.relative(rootDir, filePath));
hash.update(rel);
hash.update("\0");
hash.update(await fs.readFile(filePath));
hash.update("\0");
}
process.stdout.write(hash.digest("hex"));
NODE
} }
current_hash="$(compute_hash)" current_hash="$(compute_hash)"
@ -46,7 +81,7 @@ if [[ -f "$HASH_FILE" ]]; then
fi fi
fi fi
pnpm -s exec tsc -p vendor/a2ui/renderers/lit/tsconfig.json pnpm -s exec tsc -p "$A2UI_RENDERER_DIR/tsconfig.json"
rolldown -c apps/shared/ClawdbotKit/Tools/CanvasA2UI/rolldown.config.mjs rolldown -c "$A2UI_APP_DIR/rolldown.config.mjs"
echo "$current_hash" > "$HASH_FILE" echo "$current_hash" > "$HASH_FILE"

View File

@ -19,12 +19,17 @@ export async function copyA2uiAssets({
srcDir: string; srcDir: string;
outDir: string; outDir: string;
}) { }) {
const skipMissing = process.env.CLAWDBOT_A2UI_SKIP_MISSING === "1";
try { try {
await fs.stat(path.join(srcDir, "index.html")); await fs.stat(path.join(srcDir, "index.html"));
await fs.stat(path.join(srcDir, "a2ui.bundle.js")); await fs.stat(path.join(srcDir, "a2ui.bundle.js"));
} catch (err) { } catch (err) {
const message = const message =
'Missing A2UI bundle assets. Run "pnpm canvas:a2ui:bundle" and retry.'; 'Missing A2UI bundle assets. Run "pnpm canvas:a2ui:bundle" and retry.';
if (skipMissing) {
console.warn(`${message} Skipping copy (CLAWDBOT_A2UI_SKIP_MISSING=1).`);
return;
}
throw new Error(message, { cause: err }); throw new Error(message, { cause: err });
} }
await fs.mkdir(path.dirname(outDir), { recursive: true }); await fs.mkdir(path.dirname(outDir), { recursive: true });

View File

@ -2,6 +2,16 @@
set -euo pipefail set -euo pipefail
INSTALL_URL="${CLAWDBOT_INSTALL_URL:-https://molt.bot/install.sh}" INSTALL_URL="${CLAWDBOT_INSTALL_URL:-https://molt.bot/install.sh}"
DEFAULT_PACKAGE="moltbot"
if [[ -z "${CLAWDBOT_INSTALL_PACKAGE:-}" && "$INSTALL_URL" == *"clawd.bot"* ]]; then
DEFAULT_PACKAGE="clawdbot"
fi
PACKAGE_NAME="${CLAWDBOT_INSTALL_PACKAGE:-$DEFAULT_PACKAGE}"
if [[ "$PACKAGE_NAME" == "moltbot" ]]; then
ALT_PACKAGE_NAME="clawdbot"
else
ALT_PACKAGE_NAME="moltbot"
fi
echo "==> Pre-flight: ensure git absent" echo "==> Pre-flight: ensure git absent"
if command -v git >/dev/null; then if command -v git >/dev/null; then
@ -18,26 +28,39 @@ export PATH="$HOME/.npm-global/bin:$PATH"
echo "==> Verify git installed" echo "==> Verify git installed"
command -v git >/dev/null command -v git >/dev/null
echo "==> Verify moltbot installed"
EXPECTED_VERSION="${CLAWDBOT_INSTALL_EXPECT_VERSION:-}" EXPECTED_VERSION="${CLAWDBOT_INSTALL_EXPECT_VERSION:-}"
if [[ -n "$EXPECTED_VERSION" ]]; then if [[ -n "$EXPECTED_VERSION" ]]; then
LATEST_VERSION="$EXPECTED_VERSION" LATEST_VERSION="$EXPECTED_VERSION"
else else
LATEST_VERSION="$(npm view moltbot version)" LATEST_VERSION="$(npm view "$PACKAGE_NAME" version)"
fi fi
CMD_PATH="$(command -v moltbot || true)" CLI_NAME="$PACKAGE_NAME"
if [[ -z "$CMD_PATH" && -x "$HOME/.npm-global/bin/moltbot" ]]; then CMD_PATH="$(command -v "$CLI_NAME" || true)"
CMD_PATH="$HOME/.npm-global/bin/moltbot" if [[ -z "$CMD_PATH" ]]; then
CLI_NAME="$ALT_PACKAGE_NAME"
CMD_PATH="$(command -v "$CLI_NAME" || true)"
fi
if [[ -z "$CMD_PATH" && -x "$HOME/.npm-global/bin/$PACKAGE_NAME" ]]; then
CLI_NAME="$PACKAGE_NAME"
CMD_PATH="$HOME/.npm-global/bin/$PACKAGE_NAME"
fi
if [[ -z "$CMD_PATH" && -x "$HOME/.npm-global/bin/$ALT_PACKAGE_NAME" ]]; then
CLI_NAME="$ALT_PACKAGE_NAME"
CMD_PATH="$HOME/.npm-global/bin/$ALT_PACKAGE_NAME"
fi fi
if [[ -z "$CMD_PATH" ]]; then if [[ -z "$CMD_PATH" ]]; then
echo "moltbot not on PATH" >&2 echo "Neither $PACKAGE_NAME nor $ALT_PACKAGE_NAME is on PATH" >&2
exit 1 exit 1
fi fi
if [[ -z "$EXPECTED_VERSION" && "$CLI_NAME" != "$PACKAGE_NAME" ]]; then
LATEST_VERSION="$(npm view "$CLI_NAME" version)"
fi
echo "==> Verify CLI installed: $CLI_NAME"
INSTALLED_VERSION="$("$CMD_PATH" --version 2>/dev/null | head -n 1 | tr -d '\r')" INSTALLED_VERSION="$("$CMD_PATH" --version 2>/dev/null | head -n 1 | tr -d '\r')"
echo "installed=$INSTALLED_VERSION expected=$LATEST_VERSION" echo "cli=$CLI_NAME installed=$INSTALLED_VERSION expected=$LATEST_VERSION"
if [[ "$INSTALLED_VERSION" != "$LATEST_VERSION" ]]; then if [[ "$INSTALLED_VERSION" != "$LATEST_VERSION" ]]; then
echo "ERROR: expected moltbot@$LATEST_VERSION, got @$INSTALLED_VERSION" >&2 echo "ERROR: expected ${CLI_NAME}@${LATEST_VERSION}, got ${CLI_NAME}@${INSTALLED_VERSION}" >&2
exit 1 exit 1
fi fi

View File

@ -4,15 +4,26 @@ set -euo pipefail
INSTALL_URL="${CLAWDBOT_INSTALL_URL:-https://molt.bot/install.sh}" INSTALL_URL="${CLAWDBOT_INSTALL_URL:-https://molt.bot/install.sh}"
SMOKE_PREVIOUS_VERSION="${CLAWDBOT_INSTALL_SMOKE_PREVIOUS:-}" SMOKE_PREVIOUS_VERSION="${CLAWDBOT_INSTALL_SMOKE_PREVIOUS:-}"
SKIP_PREVIOUS="${CLAWDBOT_INSTALL_SMOKE_SKIP_PREVIOUS:-0}" SKIP_PREVIOUS="${CLAWDBOT_INSTALL_SMOKE_SKIP_PREVIOUS:-0}"
DEFAULT_PACKAGE="moltbot"
if [[ -z "${CLAWDBOT_INSTALL_PACKAGE:-}" && "$INSTALL_URL" == *"clawd.bot"* ]]; then
DEFAULT_PACKAGE="clawdbot"
fi
PACKAGE_NAME="${CLAWDBOT_INSTALL_PACKAGE:-$DEFAULT_PACKAGE}"
if [[ "$PACKAGE_NAME" == "moltbot" ]]; then
ALT_PACKAGE_NAME="clawdbot"
else
ALT_PACKAGE_NAME="moltbot"
fi
echo "==> Resolve npm versions" echo "==> Resolve npm versions"
LATEST_VERSION="$(npm view "$PACKAGE_NAME" version)"
if [[ -n "$SMOKE_PREVIOUS_VERSION" ]]; then if [[ -n "$SMOKE_PREVIOUS_VERSION" ]]; then
LATEST_VERSION="$(npm view moltbot version)"
PREVIOUS_VERSION="$SMOKE_PREVIOUS_VERSION" PREVIOUS_VERSION="$SMOKE_PREVIOUS_VERSION"
else else
VERSIONS_JSON="$(npm view moltbot versions --json)" VERSIONS_JSON="$(npm view "$PACKAGE_NAME" versions --json)"
versions_line="$(node - <<'NODE' PREVIOUS_VERSION="$(VERSIONS_JSON="$VERSIONS_JSON" LATEST_VERSION="$LATEST_VERSION" node - <<'NODE'
const raw = process.env.VERSIONS_JSON || "[]"; const raw = process.env.VERSIONS_JSON || "[]";
const latest = process.env.LATEST_VERSION || "";
let versions; let versions;
try { try {
versions = JSON.parse(raw); versions = JSON.parse(raw);
@ -25,41 +36,52 @@ if (!Array.isArray(versions)) {
if (versions.length === 0) { if (versions.length === 0) {
process.exit(1); process.exit(1);
} }
const latest = versions[versions.length - 1]; const latestIndex = latest ? versions.lastIndexOf(latest) : -1;
const previous = versions.length >= 2 ? versions[versions.length - 2] : latest; if (latestIndex > 0) {
process.stdout.write(`${latest} ${previous}`); process.stdout.write(String(versions[latestIndex - 1]));
process.exit(0);
}
process.stdout.write(String(latest || versions[versions.length - 1]));
NODE NODE
)" )"
LATEST_VERSION="${versions_line%% *}"
PREVIOUS_VERSION="${versions_line#* }"
fi fi
if [[ -n "${CLAWDBOT_INSTALL_LATEST_OUT:-}" ]]; then echo "package=$PACKAGE_NAME latest=$LATEST_VERSION previous=$PREVIOUS_VERSION"
printf "%s" "$LATEST_VERSION" > "$CLAWDBOT_INSTALL_LATEST_OUT"
fi
echo "latest=$LATEST_VERSION previous=$PREVIOUS_VERSION"
if [[ "$SKIP_PREVIOUS" == "1" ]]; then if [[ "$SKIP_PREVIOUS" == "1" ]]; then
echo "==> Skip preinstall previous (CLAWDBOT_INSTALL_SMOKE_SKIP_PREVIOUS=1)" echo "==> Skip preinstall previous (CLAWDBOT_INSTALL_SMOKE_SKIP_PREVIOUS=1)"
else else
echo "==> Preinstall previous (forces installer upgrade path)" echo "==> Preinstall previous (forces installer upgrade path)"
npm install -g "moltbot@${PREVIOUS_VERSION}" npm install -g "${PACKAGE_NAME}@${PREVIOUS_VERSION}"
fi fi
echo "==> Run official installer one-liner" echo "==> Run official installer one-liner"
curl -fsSL "$INSTALL_URL" | bash curl -fsSL "$INSTALL_URL" | bash
echo "==> Verify installed version" echo "==> Verify installed version"
INSTALLED_VERSION="$(moltbot --version 2>/dev/null | head -n 1 | tr -d '\r')" CLI_NAME="$PACKAGE_NAME"
echo "installed=$INSTALLED_VERSION expected=$LATEST_VERSION" if ! command -v "$CLI_NAME" >/dev/null 2>&1; then
if command -v "$ALT_PACKAGE_NAME" >/dev/null 2>&1; then
CLI_NAME="$ALT_PACKAGE_NAME"
LATEST_VERSION="$(npm view "$CLI_NAME" version)"
echo "==> Detected alternate CLI: $CLI_NAME"
else
echo "ERROR: neither $PACKAGE_NAME nor $ALT_PACKAGE_NAME is on PATH" >&2
exit 1
fi
fi
if [[ -n "${CLAWDBOT_INSTALL_LATEST_OUT:-}" ]]; then
printf "%s" "$LATEST_VERSION" > "$CLAWDBOT_INSTALL_LATEST_OUT"
fi
INSTALLED_VERSION="$("$CLI_NAME" --version 2>/dev/null | head -n 1 | tr -d '\r')"
echo "cli=$CLI_NAME installed=$INSTALLED_VERSION expected=$LATEST_VERSION"
if [[ "$INSTALLED_VERSION" != "$LATEST_VERSION" ]]; then if [[ "$INSTALLED_VERSION" != "$LATEST_VERSION" ]]; then
echo "ERROR: expected moltbot@$LATEST_VERSION, got moltbot@$INSTALLED_VERSION" >&2 echo "ERROR: expected ${CLI_NAME}@${LATEST_VERSION}, got ${CLI_NAME}@${INSTALLED_VERSION}" >&2
exit 1 exit 1
fi fi
echo "==> Sanity: CLI runs" echo "==> Sanity: CLI runs"
moltbot --help >/dev/null "$CLI_NAME" --help >/dev/null
echo "OK" echo "OK"

View File

@ -18,16 +18,18 @@ const runs = [
}, },
]; ];
const parallelRuns = runs.filter((entry) => entry.name !== "gateway");
const serialRuns = runs.filter((entry) => entry.name === "gateway");
const children = new Set(); const children = new Set();
const isCI = process.env.CI === "true" || process.env.GITHUB_ACTIONS === "true"; const isCI = process.env.CI === "true" || process.env.GITHUB_ACTIONS === "true";
const isMacOS = process.platform === "darwin" || process.env.RUNNER_OS === "macOS"; const isMacOS = process.platform === "darwin" || process.env.RUNNER_OS === "macOS";
const isWindows = process.platform === "win32" || process.env.RUNNER_OS === "Windows";
const isWindowsCi = isCI && isWindows;
const overrideWorkers = Number.parseInt(process.env.CLAWDBOT_TEST_WORKERS ?? "", 10); const overrideWorkers = Number.parseInt(process.env.CLAWDBOT_TEST_WORKERS ?? "", 10);
const resolvedOverride = Number.isFinite(overrideWorkers) && overrideWorkers > 0 ? overrideWorkers : null; const resolvedOverride = Number.isFinite(overrideWorkers) && overrideWorkers > 0 ? overrideWorkers : null;
const parallelRuns = isWindowsCi ? [] : runs.filter((entry) => entry.name !== "gateway");
const serialRuns = isWindowsCi ? runs : runs.filter((entry) => entry.name === "gateway");
const localWorkers = Math.max(4, Math.min(16, os.cpus().length)); const localWorkers = Math.max(4, Math.min(16, os.cpus().length));
const perRunWorkers = Math.max(1, Math.floor(localWorkers / parallelRuns.length)); const parallelCount = Math.max(1, parallelRuns.length);
const perRunWorkers = Math.max(1, Math.floor(localWorkers / parallelCount));
const macCiWorkers = isCI && isMacOS ? 1 : perRunWorkers; const macCiWorkers = isCI && isMacOS ? 1 : perRunWorkers;
// Keep worker counts predictable for local runs; trim macOS CI workers to avoid worker crashes/OOM. // Keep worker counts predictable for local runs; trim macOS CI workers to avoid worker crashes/OOM.
// In CI on linux/windows, prefer Vitest defaults to avoid cross-test interference from lower worker counts. // In CI on linux/windows, prefer Vitest defaults to avoid cross-test interference from lower worker counts.