wkappbot-code 0.3.13 → 0.3.16

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.
@@ -236,7 +236,7 @@ function isSymlink(p) { try { return lstatSync(p).isSymbolicLink(); } catch { re
236
236
 
237
237
  // ---- part: harness --------------------------------------------------------------------------------
238
238
  function curl(url, out) {
239
- const r = spawnSync("curl", ["-fsSL", "-m", "300", url, "-o", out], { encoding: "utf8" });
239
+ const r = spawnSync("curl", ["-fsSL", "--retry", "4", "-m", "300", url, "-o", out], { encoding: "utf8" });
240
240
  return r.status === 0 ? "" : ("curl " + url + " rc " + r.status + " " + (r.stderr || "").trim());
241
241
  }
242
242
  function installHarness(o) {
package/lib/update.js CHANGED
@@ -23,7 +23,7 @@ export function cmpVer(a, b) {
23
23
  }
24
24
 
25
25
  function curl(url, out, secs) {
26
- const r = spawnSync("curl", ["-fsSL", "-m", String(secs), url, "-o", out], { encoding: "utf8" });
26
+ const r = spawnSync("curl", ["-fsSL", "--retry", "4", "-m", String(secs), url, "-o", out], { encoding: "utf8" });
27
27
  return r.status === 0 ? "" : "curl " + url + " rc " + r.status + (r.stderr ? " " + r.stderr.trim() : "");
28
28
  }
29
29
  const rel = (base, p) => { try { return new URL(p, base).href; } catch { return p; } };
@@ -111,8 +111,8 @@ sdk_fetch_asset() {
111
111
  command -v wk_stopwatch_lap >/dev/null 2>&1 && wk_stopwatch_lap "sdk_fetch_asset" || true
112
112
  local asset="$1" dir="$2" base want got
113
113
  base="${WK_BIN_BASE:-https://github.com/kiexpert/wkappbot-sdk/releases/latest/download}"
114
- curl -fsSL -m "${WK_BIN_TIMEOUT:-120}" "$base/$asset" -o "$dir/$asset" || return 3
115
- curl -fsSL -m "${WK_BIN_TIMEOUT:-120}" "$base/SHA256SUMS" -o "$dir/SHA256SUMS" || return 3
114
+ curl -fsSL --retry 4 -m "${WK_BIN_TIMEOUT:-120}" "$base/$asset" -o "$dir/$asset" || return 3
115
+ curl -fsSL --retry 4 -m "${WK_BIN_TIMEOUT:-120}" "$base/SHA256SUMS" -o "$dir/SHA256SUMS" || return 3
116
116
  want="$(awk -v f="$asset" '{ n = $2; sub(/^\*/, "", n); if (n == f) { print $1; exit } }' "$dir/SHA256SUMS")"
117
117
  [ -n "$want" ] || return 4
118
118
  got="$(sha_of "$dir/$asset" || true)"
package/lib/wk-hook.js CHANGED
@@ -150,13 +150,19 @@ export function hasVerdict(r) {
150
150
  }
151
151
 
152
152
  // A stdout deny JSON names its own reason; stderr then may hold only warn lines (wkharness-run.sh wk_pre_emit).
153
+ // THE DOOR LINE RIDES EITHER STREAM (owner 2026-11-09: the emergency-edit door must open on every road): the lite floor
154
+ // prints "[emergency-edit] GRANTED: ..." on stderr, the JS hub run through wkharness-run.sh --js-only prints it on stdout,
155
+ // and a stdout JSON reason used to drop stderr's line. Every door line of either stream is kept beside the reason.
153
156
  export function refusalReason(r) {
157
+ const so = String(r.stdout || ""), se = String(r.stderr || "").trim();
158
+ const door = (so + "\n" + se).split(/\r?\n/).filter((l) => l.startsWith("[emergency-edit]"));
159
+ const withDoor = (why) => [why, ...door.filter((l) => !why.includes(l))].join("\n");
154
160
  try {
155
- const j = JSON.parse(r.stdout);
161
+ const j = JSON.parse(so);
156
162
  const why = (j.hookSpecificOutput && j.hookSpecificOutput.permissionDecisionReason) || j.reason;
157
- if (why) return why;
163
+ if (why) return withDoor(why);
158
164
  } catch {}
159
- return (r.stderr || "").trim() || (r.stdout || "").trim() || "refused by the kih harness";
165
+ return withDoor(se || so.trim() || "refused by the kih harness");
160
166
  }
161
167
 
162
168
  // ---- fail-closed risk classes ----------------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wkappbot-code",
3
- "version": "0.3.13",
3
+ "version": "0.3.16",
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": {