@baize-ai/core 0.3.1 → 0.3.2
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/CHANGELOG.md +6 -0
- package/docs/hook-activity-tracking.md +2 -2
- package/package.json +2 -2
- package/scripts/install.sh +140 -26
- package/templates/.claude/settings.json +1 -1
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.2] - 2026-08-26
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- templates/.claude/settings.json statusLine path `~/zylos/...` → `~/baize/...`(运行时路径残留,新装用户 statusLine 失效)
|
|
12
|
+
- docs/hook-activity-tracking.md zylos 历史引用清理
|
|
13
|
+
|
|
8
14
|
## [0.3.1] - 2026-08-25
|
|
9
15
|
|
|
10
16
|
### Added
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Hook-Based Activity Tracking for baize-core
|
|
2
2
|
|
|
3
|
-
**Status:** Implemented (proposal archived — shipped in the Baize rebrand;
|
|
4
|
-
**Original:** Reviewed and approved · Branch: feat/heartbeat-v2 · Target version: v0.1.8 (
|
|
3
|
+
**Status:** Implemented (proposal archived — shipped in the Baize rebrand; the pre-rebrand target version no longer applies)
|
|
4
|
+
**Original:** Reviewed and approved · Branch: feat/heartbeat-v2 · Target version: v0.1.8 (pre-rebrand)
|
|
5
5
|
**Implementation:** `skills/activity-monitor/scripts/hook-activity.js` (+ tests), configured via `settings.json` hooks in `skills/activity-monitor/scripts/activity-monitor.js`
|
|
6
6
|
|
|
7
7
|
## Problem
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baize-ai/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Baize (
|
|
5
|
+
"description": "Baize (\u767d\u6cfd) \u2014 autonomous AI agent infrastructure",
|
|
6
6
|
"main": "cli/baize.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"baize": "./cli/baize.js"
|
package/scripts/install.sh
CHANGED
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
# Install environment only (no init):
|
|
22
22
|
# curl -fsSL .../install.sh | bash -s -- --no-init
|
|
23
23
|
#
|
|
24
|
+
# China mainland — use the domestic npm mirror (auto-detected, or force it):
|
|
25
|
+
# curl -fsSL .../install.sh | bash -s -- --cn
|
|
26
|
+
# curl -fsSL .../install.sh | bash -s -- --npm-registry https://registry.npmmirror.com
|
|
27
|
+
#
|
|
24
28
|
# Supported platforms: Linux (Debian/Ubuntu/RHEL), macOS
|
|
25
29
|
# ──────────────────────────────────────────────────────────────
|
|
26
30
|
set -euo pipefail
|
|
@@ -33,6 +37,8 @@ _main() {
|
|
|
33
37
|
# ── Parse Arguments ───────────────────────────────────────────
|
|
34
38
|
BRANCH=""
|
|
35
39
|
NO_INIT=false
|
|
40
|
+
FORCE_CN=false
|
|
41
|
+
NPM_REGISTRY="" # explicit --npm-registry; empty = auto-detect
|
|
36
42
|
INIT_ARGS=()
|
|
37
43
|
while [ $# -gt 0 ]; do
|
|
38
44
|
case "$1" in
|
|
@@ -48,6 +54,18 @@ while [ $# -gt 0 ]; do
|
|
|
48
54
|
NO_INIT=true
|
|
49
55
|
shift
|
|
50
56
|
;;
|
|
57
|
+
--cn)
|
|
58
|
+
FORCE_CN=true
|
|
59
|
+
shift
|
|
60
|
+
;;
|
|
61
|
+
--npm-registry)
|
|
62
|
+
if [ -z "${2:-}" ]; then
|
|
63
|
+
echo "[baize] Error: --npm-registry requires a value" >&2
|
|
64
|
+
exit 1
|
|
65
|
+
fi
|
|
66
|
+
NPM_REGISTRY="$2"
|
|
67
|
+
shift 2
|
|
68
|
+
;;
|
|
51
69
|
# Flags that take a value — forward both flag and value to baize init
|
|
52
70
|
--timezone|--setup-token|--api-key|--codex-api-key|--base-url|--codex-base-url|--domain|--web-password|--runtime)
|
|
53
71
|
if [ -z "${2:-}" ]; then
|
|
@@ -62,6 +80,14 @@ while [ $# -gt 0 ]; do
|
|
|
62
80
|
INIT_ARGS+=("$1")
|
|
63
81
|
shift
|
|
64
82
|
;;
|
|
83
|
+
--domain)
|
|
84
|
+
if [ -z "${2:-}" ]; then
|
|
85
|
+
echo "[baize] Error: --domain requires a value" >&2
|
|
86
|
+
exit 1
|
|
87
|
+
fi
|
|
88
|
+
INIT_ARGS+=("$1" "$2")
|
|
89
|
+
shift 2
|
|
90
|
+
;;
|
|
65
91
|
# Combined short flags (e.g., -yq) — only allow [yqh] characters
|
|
66
92
|
-[yqh][yqh]|-[yqh][yqh][yqh])
|
|
67
93
|
INIT_ARGS+=("$1")
|
|
@@ -99,16 +125,13 @@ warn() { printf "${YELLOW}[baize]${NC} %s\n" "$*"; }
|
|
|
99
125
|
fail() { printf "${RED}[baize]${NC} %s\n" "$*" >&2; exit 1; }
|
|
100
126
|
|
|
101
127
|
# ── Resolve install ref ───────────────────────────────────────
|
|
128
|
+
# No --branch specified → install the published npm package
|
|
129
|
+
# (@baize-ai/core from the npm registry; no GitHub repo required).
|
|
130
|
+
# An explicit --branch installs from the GitHub source repository.
|
|
102
131
|
if [ -z "$BRANCH" ]; then
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
| sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p')"
|
|
107
|
-
if [ -n "$LATEST_TAG" ]; then
|
|
108
|
-
BRANCH="$LATEST_TAG"
|
|
109
|
-
else
|
|
110
|
-
fail "Could not resolve latest release. GitHub API may be rate-limited or unreachable. Retry later or use: --branch main"
|
|
111
|
-
fi
|
|
132
|
+
INSTALL_MODE="npm"
|
|
133
|
+
else
|
|
134
|
+
INSTALL_MODE="github"
|
|
112
135
|
fi
|
|
113
136
|
|
|
114
137
|
# ── OS Detection ──────────────────────────────────────────────
|
|
@@ -212,6 +235,39 @@ ensure_node() {
|
|
|
212
235
|
warn "node found but npm is missing, installing via nvm..."
|
|
213
236
|
fi
|
|
214
237
|
|
|
238
|
+
# China mainland: raw.githubusercontent.com (nvm installer) is unreachable —
|
|
239
|
+
# download the Node binary directly from the npmmirror mirror instead.
|
|
240
|
+
if [ "$FORCE_CN" = true ] || [ "$(detect_registry)" = "https://registry.npmmirror.com" ]; then
|
|
241
|
+
local node_major node_full node_dir node_os node_arch
|
|
242
|
+
node_major="$(echo "${NODE_VERSION}" | cut -d. -f1)"
|
|
243
|
+
case "$OS" in
|
|
244
|
+
macos) node_os="darwin" ;;
|
|
245
|
+
*) node_os="linux" ;;
|
|
246
|
+
esac
|
|
247
|
+
node_arch="$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/')"
|
|
248
|
+
# npmmirror binary listing is a JSON array of {"name": ...} entries
|
|
249
|
+
node_full="$(curl -fsSL --max-time 15 "https://registry.npmmirror.com/-/binary/node/latest-v${node_major}.x/" 2>/dev/null \
|
|
250
|
+
| grep -oE '"name":"node-v[^"]+"' | sed 's/"name":"//;s/"$//' \
|
|
251
|
+
| grep -E "^node-v${node_major}" | grep -E "${node_os}-${node_arch}" | grep -vE '\.(md5|sha|asc|sig|sum|exe|msi|pkg|zip)$' | sort -V | tail -1)"
|
|
252
|
+
if [ -n "$node_full" ]; then
|
|
253
|
+
node_dir="$HOME/.local/node"
|
|
254
|
+
if [ ! -x "$node_dir/bin/node" ]; then
|
|
255
|
+
info "Downloading Node ${node_full} from npmmirror (China mirror)..."
|
|
256
|
+
mkdir -p "$node_dir"
|
|
257
|
+
curl -fsSL --max-time 300 "https://registry.npmmirror.com/-/binary/node/latest-v${node_major}.x/${node_full}" -o "/tmp/${node_full}"
|
|
258
|
+
if [ "${node_full##*.}" = "xz" ]; then
|
|
259
|
+
tar -xJf "/tmp/${node_full}" -C "$node_dir" --strip-components=1
|
|
260
|
+
else
|
|
261
|
+
tar -xzf "/tmp/${node_full}" -C "$node_dir" --strip-components=1
|
|
262
|
+
fi
|
|
263
|
+
rm -f "/tmp/${node_full}"
|
|
264
|
+
fi
|
|
265
|
+
export PATH="$node_dir/bin:$PATH"
|
|
266
|
+
ok "node: $("$node_dir/bin/node" -v) (npmmirror binary)"
|
|
267
|
+
return
|
|
268
|
+
fi
|
|
269
|
+
fi
|
|
270
|
+
|
|
215
271
|
# Install or load nvm
|
|
216
272
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
|
217
273
|
|
|
@@ -294,6 +350,35 @@ FISH_EOF
|
|
|
294
350
|
}
|
|
295
351
|
|
|
296
352
|
# ── Install Baize ─────────────────────────────────────────────
|
|
353
|
+
# npm registry selection: explicit --npm-registry wins; --cn forces the
|
|
354
|
+
# domestic mirror; otherwise auto-detect (npmjs slow/unreachable → npmmirror).
|
|
355
|
+
detect_registry() {
|
|
356
|
+
if [ -n "$NPM_REGISTRY" ]; then
|
|
357
|
+
printf '%s\n' "$NPM_REGISTRY"
|
|
358
|
+
return
|
|
359
|
+
fi
|
|
360
|
+
if [ "$FORCE_CN" = true ]; then
|
|
361
|
+
printf '%s\n' "https://registry.npmmirror.com"
|
|
362
|
+
return
|
|
363
|
+
fi
|
|
364
|
+
local npmjs_ms
|
|
365
|
+
npmjs_ms="$(curl -o /dev/null -s -w '%{time_total}' --max-time 5 https://registry.npmjs.org/-/ping 2>/dev/null || echo '99')"
|
|
366
|
+
local slow
|
|
367
|
+
if command -v bc &>/dev/null; then
|
|
368
|
+
slow="$(echo "$npmjs_ms > 3" | bc 2>/dev/null || echo 1)"
|
|
369
|
+
else
|
|
370
|
+
slow=1
|
|
371
|
+
fi
|
|
372
|
+
if [ "$slow" = "1" ]; then
|
|
373
|
+
if curl -o /dev/null -s --max-time 3 https://registry.npmmirror.com 2>/dev/null; then
|
|
374
|
+
info "npmjs registry slow/unreachable — switching to npmmirror (China mirror)"
|
|
375
|
+
printf '%s\n' "https://registry.npmmirror.com"
|
|
376
|
+
return
|
|
377
|
+
fi
|
|
378
|
+
fi
|
|
379
|
+
printf '%s\n' "https://registry.npmjs.org"
|
|
380
|
+
}
|
|
381
|
+
|
|
297
382
|
install_baize() {
|
|
298
383
|
if command -v baize &>/dev/null; then
|
|
299
384
|
local current_version
|
|
@@ -301,40 +386,55 @@ install_baize() {
|
|
|
301
386
|
warn "baize is already installed (${current_version}). Upgrading..."
|
|
302
387
|
fi
|
|
303
388
|
|
|
304
|
-
local install_url="${BAIZE_REPO}#${BRANCH}"
|
|
305
|
-
info "Installing baize from GitHub (${BRANCH})..."
|
|
306
|
-
|
|
307
389
|
# If npm global prefix is not user-writable (system-installed node),
|
|
308
390
|
# use sudo for npm install -g
|
|
309
391
|
local npm_prefix
|
|
310
392
|
npm_prefix="$(npm config get prefix 2>/dev/null || echo "")"
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
else
|
|
393
|
+
local npm_cmd=(npm install -g)
|
|
394
|
+
if [ -z "$npm_prefix" ] || [ ! -w "$npm_prefix" ]; then
|
|
314
395
|
warn "npm global directory (${npm_prefix:-unknown}) requires elevated permissions, using sudo..."
|
|
315
|
-
if [ "$(id -u)" -
|
|
316
|
-
npm install -g
|
|
317
|
-
else
|
|
318
|
-
sudo npm install -g --install-links "$install_url"
|
|
396
|
+
if [ "$(id -u)" -ne 0 ]; then
|
|
397
|
+
npm_cmd=(sudo npm install -g)
|
|
319
398
|
fi
|
|
320
399
|
fi
|
|
321
400
|
|
|
401
|
+
if [ "$INSTALL_MODE" = "npm" ]; then
|
|
402
|
+
local REGISTRY
|
|
403
|
+
REGISTRY="$(detect_registry)"
|
|
404
|
+
# Persist the mirror as the user-level npm registry so `baize init` and
|
|
405
|
+
# component dependency installs inherit it (they run plain `npm install`).
|
|
406
|
+
if [ "$REGISTRY" != "https://registry.npmjs.org" ]; then
|
|
407
|
+
npm config set registry "$REGISTRY"
|
|
408
|
+
ok "npm registry configured: $REGISTRY (user-level)"
|
|
409
|
+
fi
|
|
410
|
+
info "Installing @baize-ai/core from ${REGISTRY}..."
|
|
411
|
+
if ! "${npm_cmd[@]}" --registry "$REGISTRY" @baize-ai/core 2>/dev/null; then
|
|
412
|
+
# Mirror may not have synced the package yet — fall back to npmjs
|
|
413
|
+
warn "Install from ${REGISTRY} failed, retrying with the official registry..."
|
|
414
|
+
"${npm_cmd[@]}" --registry "https://registry.npmjs.org" @baize-ai/core
|
|
415
|
+
fi
|
|
416
|
+
else
|
|
417
|
+
local install_url="${BAIZE_REPO}#${BRANCH}"
|
|
418
|
+
info "Installing baize from GitHub (${BRANCH})..."
|
|
419
|
+
"${npm_cmd[@]}" --install-links "$install_url"
|
|
420
|
+
fi
|
|
421
|
+
|
|
322
422
|
ok "baize: $(baize --version 2>/dev/null || echo 'installed')"
|
|
323
423
|
}
|
|
324
424
|
|
|
325
425
|
# ── Entry Point ───────────────────────────────────────────────
|
|
326
426
|
echo ""
|
|
327
427
|
printf '%b' "${BCYAN}"
|
|
328
|
-
echo "
|
|
329
|
-
echo "
|
|
330
|
-
echo "
|
|
428
|
+
echo " ██████╗ █████╗ ██╗███████╗███████╗"
|
|
429
|
+
echo " ██╔══██╗██╔══██╗██║╚══███╔╝██╔════╝"
|
|
430
|
+
echo " ██████╔╝███████║██║ ███╔╝ █████╗ "
|
|
331
431
|
printf '%b' "${CYAN}"
|
|
332
|
-
echo "
|
|
333
|
-
echo "
|
|
334
|
-
echo "
|
|
432
|
+
echo " ██╔══██╗██╔══██║██║ ███╔╝ ██╔══╝ "
|
|
433
|
+
echo " ██████╔╝██║ ██║██║███████╗███████╗"
|
|
434
|
+
echo " ╚═════╝ ╚═╝ ╚═╝╚═╝╚══════╝╚══════╝"
|
|
335
435
|
printf '%b' "${NC}"
|
|
336
436
|
echo ""
|
|
337
|
-
printf '%b' " ${BOLD}Give your AI
|
|
437
|
+
printf '%b' " ${BOLD}Give your AI memory, autonomy & collaboration.${NC}"
|
|
338
438
|
echo ""
|
|
339
439
|
echo ""
|
|
340
440
|
|
|
@@ -410,6 +510,20 @@ if ! _has_yes_flag && [ -t 0 -o -e /dev/tty ]; then
|
|
|
410
510
|
esac
|
|
411
511
|
fi
|
|
412
512
|
|
|
513
|
+
# Caddy (needed for --domain/--https) downloads from GitHub releases —
|
|
514
|
+
# unreachable in mainland China. Warn up front for a --cn deployment.
|
|
515
|
+
if [ "$FORCE_CN" = true ]; then
|
|
516
|
+
for arg in "${INIT_ARGS[@]+"${INIT_ARGS[@]}"}"; do
|
|
517
|
+
case "$arg" in
|
|
518
|
+
--domain|--https)
|
|
519
|
+
warn "--cn: --domain/--https require Caddy, which downloads from GitHub (unreachable in mainland)."
|
|
520
|
+
warn " Either skip them (web console runs on http://localhost), or install Caddy manually."
|
|
521
|
+
break
|
|
522
|
+
;;
|
|
523
|
+
esac
|
|
524
|
+
done
|
|
525
|
+
fi
|
|
526
|
+
|
|
413
527
|
echo ""
|
|
414
528
|
info "Checking prerequisites..."
|
|
415
529
|
echo ""
|