@baize-ai/core 0.3.12 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +2 -0
- package/CHANGELOG.md +6 -0
- package/Dockerfile +17 -0
- package/docker/entrypoint.sh +11 -3
- package/package.json +1 -1
- package/scripts/docker-publish.sh +12 -1
- package/skills/web-console/scripts/a2a-admin.js +41 -0
package/.dockerignore
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to baize-core will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.3.13] - 2026-08-28
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- A2A 上传安装后自动 rebuild 原生模块(D44):上传安装用 --ignore-scripts(vendor 包安全),better-sqlite3 等 native 模块不编译 → 上传后 A2A 状态加载失败;安装流程现追加 `npm rebuild --build-from-source`(只编译、不跑 vendor 脚本),失败回滚
|
|
12
|
+
- Docker 镜像 npm 源修复(D43):容器 npm 运行时是 baize 用户(prefix /home/baize/.npm-global)——镜像只写了 /usr/etc/npmrc(root 视角)npm 不读 → ACR 镜像 npm 仍走 npmjs;现同时写 /home/baize/.npmrc(优先级最高必读)
|
|
13
|
+
|
|
8
14
|
## [0.3.12] - 2026-08-28
|
|
9
15
|
|
|
10
16
|
### Added
|
package/Dockerfile
CHANGED
|
@@ -55,6 +55,10 @@ RUN if [ "${BAIZE_NPM_MIRROR:-off}" = "aliyun" ]; then \
|
|
|
55
55
|
# Also drop a system-wide npmrc so the runtime user (baize) and any
|
|
56
56
|
# docker exec npm use the mainland mirror too.
|
|
57
57
|
mkdir -p /usr/etc && printf 'registry=https://registry.npmmirror.com\n' > /usr/etc/npmrc; \
|
|
58
|
+
# Container npm runs as USER baize with prefix /home/baize/.npm-global —
|
|
59
|
+
# its globalconfig is NOT /usr/etc/npmrc, so also write the user-level
|
|
60
|
+
# ~/.npmrc (highest precedence, always read) or npm stays on npmjs.
|
|
61
|
+
mkdir -p /home/baize && printf 'registry=https://registry.npmmirror.com\n' > /home/baize/.npmrc; \
|
|
58
62
|
fi
|
|
59
63
|
RUN npm install -g pm2@latest
|
|
60
64
|
|
|
@@ -78,6 +82,11 @@ ENV WEB_CONSOLE_BIND=0.0.0.0
|
|
|
78
82
|
# build context) — source stays private, the image matches the npm version
|
|
79
83
|
# exactly. Build with: docker build --build-arg BAZE_CORE_VERSION=0.2.0 .
|
|
80
84
|
ARG BAZE_CORE_VERSION=latest
|
|
85
|
+
# Local-development override: when building from source with
|
|
86
|
+
# --build-arg BAIZE_LOCAL_SKILLS=1, copy the LOCAL skills over the npm-package
|
|
87
|
+
# skills so un-released fixes (e.g. D44) land in the image without publishing.
|
|
88
|
+
# Official builds leave this off — the published npm package is authoritative.
|
|
89
|
+
ARG BAIZE_LOCAL_SKILLS=0
|
|
81
90
|
WORKDIR /home/baize
|
|
82
91
|
RUN npm install -g @baize-ai/core@${BAZE_CORE_VERSION} \
|
|
83
92
|
&& baize --version \
|
|
@@ -120,6 +129,14 @@ RUN npm install -g @baize-ai/core@${BAZE_CORE_VERSION} \
|
|
|
120
129
|
&& node -e "const D=require('/home/baize/baize/.claude/skills/web-console/node_modules/better-sqlite3'); new D(':memory:')" \
|
|
121
130
|
&& echo "native modules OK (locally compiled, baked into runtime skills)"
|
|
122
131
|
|
|
132
|
+
# ── Local-source skills override (BAIZE_LOCAL_SKILLS=1) ─────────────────────
|
|
133
|
+
# docker-publish.sh stages the repo's skills/ into .docker-local-skills/ when
|
|
134
|
+
# BAIZE_LOCAL_SKILLS=1 (empty directory otherwise). They land in
|
|
135
|
+
# /home/baize/.local-skills and are applied by entrypoint AFTER init, because
|
|
136
|
+
# init's postinstall syncSkills uses the npm-package skills as source and
|
|
137
|
+
# would otherwise overwrite them. Official images carry an empty dir — no-op.
|
|
138
|
+
COPY --chown=baize:baize .docker-local-skills/ /home/baize/.local-skills/
|
|
139
|
+
|
|
123
140
|
# ── Workspace directories ─────────────────────────────────────────────────────
|
|
124
141
|
# ~/baize is mounted as a single volume in docker-compose.yml.
|
|
125
142
|
# Creating subdirectories here ensures correct ownership in the image.
|
package/docker/entrypoint.sh
CHANGED
|
@@ -94,10 +94,18 @@ if ! baize init ${INIT_ARGS}; then
|
|
|
94
94
|
fi
|
|
95
95
|
ok "Workspace ready"
|
|
96
96
|
mkdir -p "${BAIZE_DIR}/.baize"
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
# ── Local-source skills override (BAIZE_LOCAL_SKILLS=1 images) ──────────────
|
|
98
|
+
# Images built with BAIZE_LOCAL_SKILLS=1 bake the repo's skills into
|
|
99
|
+
# /home/baize/.local-skills. syncSkills (npm postinstall) runs during init
|
|
100
|
+
# with the npm-package skills as source, so apply the local override AFTER
|
|
101
|
+
# init to keep un-released fixes (e.g. D44) authoritative.
|
|
102
|
+
# Official images ship an empty .local-skills — this is a no-op there.
|
|
103
|
+
if [ -d /home/baize/.local-skills ]; then
|
|
104
|
+
cp -rf /home/baize/.local-skills/. "${BAIZE_DIR}/.claude/skills/" 2>/dev/null \
|
|
105
|
+
&& ok "Local-source skills applied (BAIZE_LOCAL_SKILLS=1)"
|
|
106
|
+
fi
|
|
99
107
|
|
|
100
|
-
|
|
108
|
+
# ── Pass through channel env vars to .env ─────────────────────────────────────
|
|
101
109
|
|
|
102
110
|
# ── Pass through channel env vars to .env ─────────────────────────────────────
|
|
103
111
|
# baize init doesn't write channel tokens — those come from component installs.
|
package/package.json
CHANGED
|
@@ -30,11 +30,22 @@ ACR_NAMESPACE="${ACR_NAMESPACE:-baize01}"
|
|
|
30
30
|
|
|
31
31
|
# ── Build ────────────────────────────────────────────────────────────────────
|
|
32
32
|
echo "==> Building baize-core:${VERSION} (from npm @baize-ai/core@${VERSION})"
|
|
33
|
+
BUILD_ARGS=(--build-arg "BAZE_CORE_VERSION=${VERSION}")
|
|
34
|
+
rm -rf .docker-local-skills && mkdir -p .docker-local-skills
|
|
35
|
+
if [ "${BAIZE_LOCAL_SKILLS:-0}" = "1" ]; then
|
|
36
|
+
BUILD_ARGS+=(--build-arg BAIZE_LOCAL_SKILLS=1)
|
|
37
|
+
echo "==> Overriding skills with LOCAL repo source (BAIZE_LOCAL_SKILLS=1) — un-released fixes baked in"
|
|
38
|
+
cp -r skills/. .docker-local-skills/
|
|
39
|
+
# Never ship host-compiled node_modules (mac binaries break linux runtime) —
|
|
40
|
+
# dependency binaries come from the image's own npm install.
|
|
41
|
+
find .docker-local-skills -type d -name node_modules -prune -exec rm -rf {} +
|
|
42
|
+
fi
|
|
33
43
|
docker build \
|
|
34
|
-
|
|
44
|
+
"${BUILD_ARGS[@]}" \
|
|
35
45
|
-t "${GHCR_IMAGE}:${VERSION}" \
|
|
36
46
|
-t "${GHCR_IMAGE}:latest" \
|
|
37
47
|
.
|
|
48
|
+
rm -rf .docker-local-skills
|
|
38
49
|
|
|
39
50
|
if [ -n "${ACR_REGISTRY}" ] && [ -n "${ACR_NAMESPACE}" ]; then
|
|
40
51
|
ACR_IMAGE="${ACR_REGISTRY}/${ACR_NAMESPACE}/baize-core"
|
|
@@ -328,6 +328,39 @@ function npmInstallDeps(cwd) {
|
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
+
/** Rebuild native modules after --ignore-scripts install (D44).
|
|
332
|
+
* --ignore-scripts skips postinstall, so better-sqlite3 etc. never compile
|
|
333
|
+
* their native binary. Rebuilding runs node-gyp only (no vendor lifecycle
|
|
334
|
+
* scripts) — the security stance is kept while the module becomes loadable. */
|
|
335
|
+
function rebuildNativeDeps(cwd) {
|
|
336
|
+
return new Promise((resolve) => {
|
|
337
|
+
const child = spawn('npm', ['rebuild', '--build-from-source', '--no-audit', '--no-fund'], {
|
|
338
|
+
cwd, env: { ...process.env }, stdio: ['ignore', 'pipe', 'pipe'],
|
|
339
|
+
});
|
|
340
|
+
let stderr = '';
|
|
341
|
+
let settled = false;
|
|
342
|
+
child.stderr.on('data', (d) => { stderr += String(d); });
|
|
343
|
+
const timer = setTimeout(() => {
|
|
344
|
+
if (settled) return;
|
|
345
|
+
settled = true;
|
|
346
|
+
child.kill('SIGTERM');
|
|
347
|
+
resolve({ ok: false, error: `npm rebuild 超时(${Math.round(NPM_INSTALL_TIMEOUT_MS / 1000)}s)` });
|
|
348
|
+
}, NPM_INSTALL_TIMEOUT_MS);
|
|
349
|
+
child.on('error', (err) => {
|
|
350
|
+
if (settled) return;
|
|
351
|
+
settled = true;
|
|
352
|
+
clearTimeout(timer);
|
|
353
|
+
resolve({ ok: false, error: err.message });
|
|
354
|
+
});
|
|
355
|
+
child.on('close', (code) => {
|
|
356
|
+
if (settled) return;
|
|
357
|
+
settled = true;
|
|
358
|
+
clearTimeout(timer);
|
|
359
|
+
resolve(code === 0 ? { ok: true } : { ok: false, error: (stderr.trim() || `exit ${code}`).slice(-500) });
|
|
360
|
+
});
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
|
|
331
364
|
/**
|
|
332
365
|
* Install @baize-ai/baize-a2a from an uploaded .tar.gz (D25 私有交付).
|
|
333
366
|
* Pipeline: entry listing + path-safety vetting (no `..`/absolute/links) →
|
|
@@ -342,6 +375,7 @@ export async function installA2aTarball(tarballPath, {
|
|
|
342
375
|
skillsDir = defaultSkillsDir(),
|
|
343
376
|
componentsFile: componentsPath = componentsFile(),
|
|
344
377
|
installDeps = npmInstallDeps,
|
|
378
|
+
rebuildDeps = rebuildNativeDeps,
|
|
345
379
|
originalName = null,
|
|
346
380
|
} = {}) {
|
|
347
381
|
const file = String(tarballPath || '');
|
|
@@ -401,6 +435,13 @@ export async function installA2aTarball(tarballPath, {
|
|
|
401
435
|
fs.rmSync(targetDir, { recursive: true, force: true });
|
|
402
436
|
return { ok: false, error: `npm install 失败: ${depResult.error}` };
|
|
403
437
|
}
|
|
438
|
+
// D44: --ignore-scripts skipped native compilation — rebuild modules so
|
|
439
|
+
// better-sqlite3 etc. are loadable (node-gyp only, no vendor scripts).
|
|
440
|
+
const rebuildResult = await rebuildDeps(targetDir);
|
|
441
|
+
if (!rebuildResult.ok) {
|
|
442
|
+
fs.rmSync(targetDir, { recursive: true, force: true });
|
|
443
|
+
return { ok: false, error: `native 模块重建失败: ${rebuildResult.error}` };
|
|
444
|
+
}
|
|
404
445
|
const components = readComponents(componentsPath);
|
|
405
446
|
components.a2a = {
|
|
406
447
|
version: pkg.version,
|