Conversation
Check GitHub for newer versions on plugin registration. Since child_process is stubbed in the OpenClaw bundle, auto-update isn't possible — log a notice with the update command instead.
|
Claude finished @kaghni's task in 1m 11s —— View job Left 3 inline comments:
|
| } | ||
|
|
||
| const DEFAULT_API_URL = "https://api.deeplake.ai"; | ||
| const GITHUB_RAW_PKG = "https://raw.githubusercontent.com/activeloopai/hivemind/main/openclaw/package.json"; |
There was a problem hiding this comment.
Pointing at the main branch means any un-released commit will trigger a false "update available" notice for users on the current published version. The npm registry is the authoritative source for what's actually published.
| const GITHUB_RAW_PKG = "https://raw.githubusercontent.com/activeloopai/hivemind/main/openclaw/package.json"; | |
| const GITHUB_RAW_PKG = "https://registry.npmjs.org/hivemind/latest"; |
Then update checkForUpdate to use pkg.version directly (the latest dist-tag endpoint returns { version: "..." } at the top level, same as package.json).
openclaw/src/index.ts
Outdated
| } | ||
|
|
||
| function isNewer(latest: string, current: string): boolean { | ||
| const parse = (v: string) => v.split(".").map(Number); |
There was a problem hiding this comment.
Number() on a pre-release segment like "0-beta" returns NaN; all comparisons with NaN are false, so a user on 1.0.0 would never be told to upgrade to 1.0.1-beta (benign) but also a user on 1.0.0-beta would never be told to upgrade to 1.0.0 (wrong). Strip the pre-release suffix before comparing.
| const parse = (v: string) => v.split(".").map(Number); | |
| const parse = (v: string) => v.replace(/-.*$/, "").split(".").map(Number); |
openclaw/src/index.ts
Outdated
| const res = await fetch(GITHUB_RAW_PKG, { signal: AbortSignal.timeout(3000) }); | ||
| if (!res.ok) return; | ||
| const pkg = await res.json(); | ||
| const latest = pkg.version; |
There was a problem hiding this comment.
res.json() is untyped and pkg.version could be undefined, null, or a non-string, which would pass the truthiness check but cause isNewer to call undefined.split(…) or produce NaN — add a string guard.
| const latest = pkg.version; | |
| const latest = typeof pkg.version === "string" ? pkg.version : null; |
- Use npm registry instead of GitHub raw to avoid false update notices for unreleased versions on main - Strip pre-release suffix before version comparison - Add string type guard on pkg.version from registry response
auth.ts imports unlinkSync from node:fs but the OpenClaw esbuild fs-wrap didn't export it, breaking the build.
npm registry has a different package named hivemind (0.1.2). The OpenClaw plugin is published on ClawHub, not npm. GitHub raw is the correct source for the latest version.
Checks GitHub for newer version and tells the user what command to run. Cannot auto-update since child_process is stubbed in the OpenClaw bundle.
Summary
openclaw plugins update hivemindTest plan