wkappbot-code 0.3.8 → 0.3.9
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/bin/wkappbot-code.js +6 -1
- package/lib/wk-bin-acquire.sh +17 -7
- package/package.json +1 -1
package/bin/wkappbot-code.js
CHANGED
|
@@ -189,6 +189,9 @@ function installBin(o) {
|
|
|
189
189
|
log("bin: bash " + script + " acquire --dest " + dest);
|
|
190
190
|
const r = spawnSync("bash", [shPath(script), "acquire", "--dest", shPath(dest)], { encoding: "utf8", env: shEnv() });
|
|
191
191
|
for (const line of ((r.stdout || "") + (r.stderr || "")).split("\n").filter(Boolean)) log(" " + line);
|
|
192
|
+
// rc 3 = the release host could not be reached (a package-registry-only VM): no core, but NOT a failed install --
|
|
193
|
+
// the hooks and the lite harness need no core and still refuse the risky classes. A sha256 mismatch stays rc 1.
|
|
194
|
+
if (r.status === 3) return { ok: false, degraded: true, dest, note: "core not fetched (release host unreachable); hooks + lite harness run without it -- rerun wkappbot-code install once github.com is reachable" };
|
|
192
195
|
if (r.status !== 0) return { ok: false, dest, note: "wk-bin-acquire rc " + r.status };
|
|
193
196
|
// Put `wkappbot` on PATH beside wkappbot-code itself, unless that name is already taken by someone else.
|
|
194
197
|
let link = "";
|
|
@@ -398,7 +401,8 @@ function install(o) {
|
|
|
398
401
|
}
|
|
399
402
|
const dest = binDest(o);
|
|
400
403
|
st.bin = o.bin ? installBin(o) : { skipped: true, dest };
|
|
401
|
-
if (o.bin &&
|
|
404
|
+
if (o.bin && st.bin.degraded) log("bin: WARN -- " + st.bin.note);
|
|
405
|
+
else if (o.bin && !st.bin.ok) { bad++; log("bin: FAILED -- " + st.bin.note); }
|
|
402
406
|
st.harness = o.harness ? installHarness(o) : { skipped: true };
|
|
403
407
|
if (o.harness && !st.harness.ok) { bad++; log("harness: FAILED -- " + st.harness.note); }
|
|
404
408
|
// The plugin entry names the harness the install just chose (a forced web harness wins over a checkout).
|
|
@@ -549,6 +553,7 @@ function doctor(o) {
|
|
|
549
553
|
const dest = o.binDest ? resolve(o.binDest) : (st.bin && st.bin.dest) || binDest(o);
|
|
550
554
|
let core = "";
|
|
551
555
|
if (st.bin && st.bin.skipped) add("bin", false, "skipped (--no-bin)", false, true);
|
|
556
|
+
else if (st.bin && st.bin.degraded && !existsSync(dest)) add("bin", false, dest + " absent -- " + st.bin.note, false);
|
|
552
557
|
else {
|
|
553
558
|
const r = spawnSync(dest, ["--version"], { encoding: "utf8", timeout: 60000 });
|
|
554
559
|
core = r.status === 0 ? (r.stdout || "").trim().split("\n")[0] : "";
|
package/lib/wk-bin-acquire.sh
CHANGED
|
@@ -100,18 +100,20 @@ default_dest_win() {
|
|
|
100
100
|
fi
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
# sdk_fetch PLAT DIR -- prints the verified asset path
|
|
103
|
+
# sdk_fetch PLAT DIR -- prints the verified asset path; else prints nothing and returns
|
|
104
|
+
# 3 when a download failed (host unreachable, no such asset) or 4 when the asset is UNVERIFIED
|
|
105
|
+
# (no SHA256SUMS line for it, or a sha256 mismatch). Only 3 may degrade an install to hooks-only.
|
|
104
106
|
sdk_fetch() {
|
|
105
107
|
command -v wk_stopwatch_lap >/dev/null 2>&1 && wk_stopwatch_lap "sdk_fetch" || true
|
|
106
108
|
local plat="$1" dir="$2" asset base want got
|
|
107
109
|
asset="wkappbot-$plat"
|
|
108
110
|
base="${WK_BIN_BASE:-https://github.com/kiexpert/wkappbot-sdk/releases/latest/download}"
|
|
109
|
-
curl -fsSL -m 120 "$base/$asset" -o "$dir/$asset" || return
|
|
110
|
-
curl -fsSL -m 120 "$base/SHA256SUMS" -o "$dir/SHA256SUMS" || return
|
|
111
|
+
curl -fsSL -m "${WK_BIN_TIMEOUT:-120}" "$base/$asset" -o "$dir/$asset" || return 3
|
|
112
|
+
curl -fsSL -m "${WK_BIN_TIMEOUT:-120}" "$base/SHA256SUMS" -o "$dir/SHA256SUMS" || return 3
|
|
111
113
|
want="$(awk -v f="$asset" '{ n = $2; sub(/^\*/, "", n); if (n == f) { print $1; exit } }' "$dir/SHA256SUMS")"
|
|
112
|
-
[ -n "$want" ] || return
|
|
114
|
+
[ -n "$want" ] || return 4
|
|
113
115
|
got="$(sha_of "$dir/$asset" || true)"
|
|
114
|
-
[ "$got" = "$want" ] || return
|
|
116
|
+
[ "$got" = "$want" ] || return 4
|
|
115
117
|
echo "$dir/$asset"
|
|
116
118
|
}
|
|
117
119
|
|
|
@@ -147,12 +149,20 @@ install_file() {
|
|
|
147
149
|
|
|
148
150
|
acquire_unix() {
|
|
149
151
|
command -v wk_stopwatch_lap >/dev/null 2>&1 && wk_stopwatch_lap "acquire_unix" || true
|
|
150
|
-
local dest="$1" plat="$2" offline="$3" src label
|
|
152
|
+
local dest="$1" plat="$2" offline="$3" src="" label frc=3
|
|
151
153
|
[ -n "$dest" ] || dest="$(default_dest_unix)"
|
|
152
|
-
if [ "$offline" = 0 ]
|
|
154
|
+
if [ "$offline" = 0 ]; then src="$(sdk_fetch "$plat" "$WK_TMP")" && frc=0 || frc=$?; fi
|
|
155
|
+
if [ "$frc" = 0 ]; then
|
|
153
156
|
label="SDK release wkappbot-$plat"
|
|
154
157
|
else
|
|
155
158
|
if [ "$offline" = 0 ]; then note "SDK asset unavailable or unverified, using repo bin/$plat"; fi
|
|
159
|
+
# EXIT 3 = NOTHING TO FETCH FROM, never a security refusal: the release host is unreachable (a
|
|
160
|
+
# package-registry-only VM) and no checkout holds a repo copy. The caller may then install hooks
|
|
161
|
+
# and the lite harness without the core. An UNVERIFIED asset (frc 4) still dies rc 1 below.
|
|
162
|
+
if [ -z "$REPO" ] && [ "$frc" = 3 ]; then
|
|
163
|
+
note "UNREACHABLE: no wkappbot-$plat could be downloaded from ${WK_BIN_BASE:-github.com/kiexpert/wkappbot-sdk releases} and no kih checkout holds bin/$plat; nothing installed"
|
|
164
|
+
exit 3
|
|
165
|
+
fi
|
|
156
166
|
src="$(repo_file "$plat/wkappbot")"
|
|
157
167
|
label="repo bin/$plat/wkappbot"
|
|
158
168
|
fi
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wkappbot-code",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
4
4
|
"description": "wkappbot-code -- Wisdom Kernel: the pinned OpenCode bridge plus the reflex harness plugin, the wkappbot core, the web harness and the latest public skills in one install",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|