OverviewFilesCommitsIssuesDocsReleasesPeers

wirecore commits / ce1a574

Migrate OTA: pear-runtime (Hyperdrive) → pgh content-addressed updates (1.1.1)
Swap the initPearRuntime()/new PearRuntime block in pear-app/index.js for a backgrounded `pgh app update wirecore` subprocess (detached, best-effort, --no-updates gated), reusing a direct bare-subprocess import (bare-only app). Drops the unbounded append-only Hyperdrive blob corestore. Mirrors hyper-fleeky-dev #81. package.json (pear-app, 1.1.0 → 1.1.1): - remove pear-runtime + pear-appdrive deps + the top-level pear:// upgrade + the pear block; add a pgh block (bin wirecore, entrypoint index.js, runtime bare, pgh.upgrade=pgh://<registry>/wirecore). - declare bare-fs/bare-https/bare-path (imported but previously UNDECLARED — masked by the keet-cli node_modules rsync; would have broken under the new npm-install CI) + bare-subprocess for OTA. Audited every imported bare-* is now declared (the bare-process lesson). - pin keet-identity-key exact 3.1.0 (^range → 3.2.0 ce-v3 drift trap). - NOTE: hypercore stays ^10 / corestore ^6 (genuinely loaded — unlike hyper-wallet's dead ^10 manifest). A hypercore-11 bump here is a REAL corestore 6→7 storage migration, tracked separately, not bundled. .pear-git/ci.yaml (repo root; app is in pear-app/): - replace the whole-keet-cli node_modules rsync with `cd pear-app && npm install --production` + `pgh publish` (self-contained tree, no keet stack wirecore never uses). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ce1a5743d1ff0e3baac7df6a0ed95fa5bc142b98
by plankatron <fleeky@gmail.com> · 2026-06-20T23:54:47.000Z

Changed files (3) +53 -32

.pear-git/ci.yaml +10 -3
……@@ -1,4 +1,11 @@
11steps:
2 - name: copy-deps
3 run: cp -r /storage/projects/code/hypercore-kb/hyper-fleeky/keet-cli/node_modules . && cp -r node_modules pear-app/node_modules
4 timeout: 120
2 - name: install-deps
3 # The app lives in pear-app/. Its deps are all on npm now (keet-identity-key
4 # pinned to 3.1.0; the previously-undeclared bare-fs/bare-https/bare-path are
5 # now declared), so a clean production install replaces the whole-keet-cli
6 # node_modules rsync — a far smaller, self-contained tree.
7 run: cd pear-app && npm install --production --ignore-scripts
8 timeout: 180
9 - name: pgh-publish
10 run: cd pear-app && pgh publish . --accept-conflict "automated CI publish; dep version splits inherited from per-app lockfiles across the pgh ecosystem"
11 timeout: 300
pear-app/index.js +32 -19
……@@ -7,10 +7,9 @@
77// - Timeline = merge all followed feeds by timestamp
88// - Sparse replication = only followed users, not entire network
99//
10// pear-runtime provides P2P OTA updates when running from a deployed install.
10// pgh provides P2P OTA updates (content-addressed) when installed via pgh.
1111//
1212// Usage: bare index.js <command> [options]
13// pear run pear://KEY <command> [options]
1413
1514import Corestore from 'corestore'
1615import Hyperswarm from 'hyperswarm'
……@@ -27,6 +26,7 @@ import fs from 'bare-fs'
2726import path from 'bare-path'
2827import process from 'bare-process'
2928import os from 'bare-os'
29import subprocess from 'bare-subprocess'
3030import { ANProto } from './lib/anproto.js'
3131import { YAMLHelper } from './lib/yaml-helper.js'
3232
……@@ -2052,29 +2052,42 @@ async function main() {
20522052 }
20532053}
20542054
2055// Initialize pear-runtime for P2P OTA updates (non-blocking)
2056async function initPearRuntime () {
2055// Background OTA via pgh — content-addressed store, NO Hyperdrive/blobs.
2056// `pgh app update <name>` resolves the latest release from package.json's
2057// pgh.upgrade and ATOMICALLY materializes the new tree (next launch uses it).
2058// Replaces the former pear-runtime Hyperdrive updater, which kept an unbounded
2059// append-only blob corestore under the app storage dir.
2060function startBackgroundUpdate () {
20572061 try {
20582062 const pkg = JSON.parse(fs.readFileSync(path.join(getAppDir(), 'package.json'), 'utf-8'))
2059 if (!pkg.upgrade) return null
2060
2061 const { default: PearRuntime } = await import('pear-runtime')
2062 const dir = getStorageDir()
2063
2064 const runtime = new PearRuntime({ dir, app: getAppDir(), version: pkg.version, upgrade: pkg.upgrade })
2065 runtime.on('updated', () => {
2066 runtime.applyUpdate().catch(() => {})
2063 const upgrade = pkg.pgh && pkg.pgh.upgrade
2064 if (!upgrade) return
2065 const appName = (pkg.pgh && pkg.pgh.bin) || pkg.name || 'wirecore'
2066 // Resolve the pgh CLI: prefer ~/.local/bin/pgh, else the store bare+entry.
2067 let argv = null
2068 const launcher = path.join(os.homedir(), '.local', 'bin', 'pgh')
2069 if (fs.existsSync(launcher)) argv = [launcher]
2070 else {
2071 const storeRoot = process.env.PGH_STORE_ROOT || path.join(os.homedir(), '.local', 'share', 'store')
2072 const bareBin = path.join(storeRoot, 'apps', 'pgh', 'runtime', 'bare')
2073 const entry = path.join(storeRoot, 'apps', 'pgh', 'bin', 'pgh.bare.js')
2074 if (fs.existsSync(bareBin) && fs.existsSync(entry)) argv = [bareBin, entry]
2075 }
2076 if (!argv) return
2077 // Detached + best-effort: never blocks the command.
2078 const proc = subprocess.spawn(argv[0], [...argv.slice(1), 'app', 'update', appName], {
2079 stdio: 'ignore',
2080 detached: true
20672081 })
2068 return runtime
2069 } catch {
2070 return null
2071 }
2082 proc.on('error', () => {})
2083 if (proc.unref) proc.unref()
2084 } catch {}
20722085}
20732086
20742087// Run main
2075let runtimeRef = null
2076if (!isPear) {
2077 runtimeRef = initPearRuntime()
2088const _argv = typeof Bare !== 'undefined' ? Bare.argv : process.argv
2089if (!isPear && !_argv.includes('--no-updates')) {
2090 startBackgroundUpdate()
20782091}
20792092
20802093main().catch(err => {
pear-app/package.json +11 -10
……@@ -1,17 +1,16 @@
11{
22 "name": "wirecore-pear",
3 "version": "1.1.0",
3 "version": "1.1.1",
44 "description": "Wirecore P2P social network",
55 "type": "module",
66 "main": "index.js",
77 "private": true,
8 "upgrade": "pear://zupx3qzpwj61hdt1bxanabctcyxqqu3arogctwim4qt3wfbzn4bo",
9 "pear": {
10 "name": "wirecore-pear",
8 "pgh": {
9 "bin": "wirecore",
10 "entrypoint": "index.js",
1111 "type": "terminal",
12 "gui": {
13 "backgroundColor": "#1e1e1e"
14 }
12 "runtime": "bare",
13 "upgrade": "pgh://1dd36bdfa9cb7f7d84adbd07f017e7200f7f90a3a546cd0761fac2a1f8a13e86/wirecore"
1514 },
1615 "scripts": {
1716 "dev": "bare index.js",
……@@ -20,9 +19,13 @@
2019 },
2120 "dependencies": {
2221 "b4a": "^1.6.6",
22 "bare-fs": "^4.5.2",
2323 "bare-http1": "^4.0.2",
24 "bare-https": "^2.1.2",
2425 "bare-os": "^3.0.0",
26 "bare-path": "^3.0.0",
2527 "bare-process": "^2.2.0",
28 "bare-subprocess": "^5.2.2",
2629 "bare-ws": "^2.0.0",
2730 "compact-encoding": "^2.15.0",
2831 "corestore": "^6.18.4",
……@@ -32,9 +35,7 @@
3235 "hypercore-crypto": "^3.4.1",
3336 "hyperdrive": "^11.7.1",
3437 "hyperswarm": "^4.8.2",
35 "keet-identity-key": "^3.1.0",
36 "pear-appdrive": "^1.1.2",
37 "pear-runtime": "^0.4.2",
38 "keet-identity-key": "3.1.0",
3839 "sodium-universal": "^4.0.0"
3940 },
4041 "devDependencies": {