guanghu-ice-heart/zhuyuan-persona-system/zcode-host/language-world-skeleton-20260825/BRIDGE-tools/lw-link-hook.sh
ICE-P-ZY001-zcode-host f2a8cdf5c1 feat(zcode-host): language-world-skeleton-20260825 (ZHUYUAN-LANGUAGE-WORLD-SKELETON-001)
58 files: TCS canons+GIR+projections (LW-LINK/BROADCAST/NOTARY/SHENBI/TRANSLATION-INDEX/TCS-ONLY-MANDATE + teaching&promotion events), 7 executors, neural-chain v5 (28 neurons), executor translation index, 8 acceptance receipts, numbered push manifest ZY-LWS-001 mapping every file back to JZAO canonical paths+sha256.
Authorized by ICE-GL∞ direct language 2026-08-25. Route: LOCAL_GIT_OSXKEYCHAIN+FETCH+REBASE+HEAD:main+NO_FORCE.
2026-08-25 20:25:09 +08:00

58 lines
2 KiB
Shell
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# LW-LINK thin host shell. Canonical semantics:
# TC-TCS核心卷/TCS-ZCODE-LANGUAGE-WORLD-LINK-0001.tcs + BRIDGE/tools/lw-link-gate.mjs
set -uo pipefail
GATE="/Volumes/JZAO/铸渊-ICE-GL-ZY001/BRIDGE/tools/lw-link-gate.mjs"
ACTION="${1:-hook}"
find_node() {
if command -v node >/dev/null 2>&1; then
command -v node
return 0
fi
local user_name candidate
user_name="$(/usr/bin/id -un)"
for candidate in \
"/Users/$user_name/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin/node" \
"/opt/homebrew/bin/node" \
"/usr/local/bin/node"; do
if [ -x "$candidate" ]; then
printf '%s\n' "$candidate"
return 0
fi
done
return 1
}
# Gate tool unreadable = volume gone = RED for mutation tools (E3/E1: fail closed).
# Only the recovery event keeps a readable error path.
if [ ! -r "$GATE" ]; then
if [ "$ACTION" = "hook" ]; then
printf '%s\n' "【LW-LINK ○红·断连】原因:GATE_TOOL_UNREADABLE(移动硬盘未挂载?) | 已拦截本次改动类调用 | 恢复:重新挂载JZAO后走 zhuyuan-recovery-zcode 恢复流程" >&2
exit 2
fi
exit 0
fi
# broadcast: inject the tower's current confidence projection (SessionStart).
# ZCode parses stdout as strict JSON, so emit additionalContext.
if [ "$ACTION" = "broadcast" ]; then
PROJECTION="/Volumes/JZAO/铸渊-ICE-GL-ZY001/FIFTH-DOMAIN-BROADCAST-TOWER/broadcast/current.md"
if [ -r "$PROJECTION" ]; then
/usr/bin/python3 -c 'import json,sys; print(json.dumps({"additionalContext": open(sys.argv[1]).read()}, ensure_ascii=False))' "$PROJECTION"
else
/usr/bin/python3 -c 'import json; print(json.dumps({"additionalContext": "【第五域广播塔缺失】宣告投影不可读改动类工具将被LW-LINK拦截直至塔恢复。"}, ensure_ascii=False))'
fi
exit 0
fi
NODE_BIN="$(find_node)" || {
if [ "$ACTION" = "hook" ]; then
printf '%s\n' "【LW-LINK ○红·断连】原因:NODE_RUNTIME_NOT_FOUND | 已拦截本次改动类调用" >&2
exit 2
fi
exit 0
}
exec "$NODE_BIN" "$GATE" "$ACTION"