Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat(desktop): run agents locally with keychain-held keys, native payload-hash approvals, a tray menu and a mascot that shows agent state
nirholas4ac829a86a5c
diff --git a/STRUCTURE.md b/STRUCTURE.mdindex dc148a0d6..512bb8385 100644--- a/STRUCTURE.md+++ b/STRUCTURE.md@@ -315,6 +315,7 @@ bottom.| Checkout companion browser extension | [extensions/checkout-companion/](extensions/checkout-companion) (MV3: [extract.js](extensions/checkout-companion/extract.js), [content.js](extensions/checkout-companion/content.js), [panel.js](extensions/checkout-companion/panel.js), [background.js](extensions/checkout-companion/background.js)), analysis [api/_lib/companion/checkout.js](api/_lib/companion/checkout.js), endpoint [api/companion/checkout.js](api/companion/checkout.js) | In-repo | The companion at the moment money moves: on a checkout page it reports the total against the price you were shown, money the page did not itemise, fees named and summed, whether the charge repeats, and the cancellation terms. **Arithmetic is never the model's job** (integer minor units, computed server-side) and **no finding is ever a legal verdict** (`sanitizeModelFindings()` drops any that claims an amount or calls something illegal). With no model reachable the arithmetic findings still stand. The extension **never reads an input**: `collectText`/`collectAmounts` refuse form fields, iframes and editable regions structurally, and redaction runs in the browser before anything is sent; only the hostname travels and nothing about the page is stored. Docs: [docs/checkout-companion.md](docs/checkout-companion.md). Tests: [tests/companion-checkout.test.js](tests/companion-checkout.test.js), [tests/checkout-extract.test.js](tests/checkout-extract.test.js) || Desktop companion app | [apps/desktop/](apps/desktop). Electron main [src/main.js](apps/desktop/src/main.js), preload [src/preload.cjs](apps/desktop/src/preload.cjs), stage [src/renderer/](apps/desktop/src/renderer) | In-repo · packaged with electron-builder (`npm run dist`), not yet published | A transparent, click-through, always-on-top character that strolls across the bottom of the desktop and walks over to deliver what cleared the user's bar. Subscribes to `/api/companion/stream` with the same bridge token the CLI stores, and drives the published [walk embed](pages/walk-embed.html) over its postMessage contract, so it carries no 3D code of its own. Not an npm workspace: it installs and builds on its own (see [apps/desktop/README.md](apps/desktop/README.md)). || DCC tool integrations (Blender, ComfyUI, Modly) | [integrations/](integrations): [integrations/blender/](integrations/blender), [integrations/comfyui/](integrations/comfyui), Modly extensions [integrations/modly/](integrations/modly) (`three-ws/` cloud nodes, `three-ws-publish/` publish node), shared Python client [integrations/_pyclient/](integrations/_pyclient) | In-repo; Modly extensions install by linking the folder, one-click GitHub install is owner-gated ([SUBMITTING.md](integrations/modly/SUBMITTING.md)) | First-party plugins that drive the public Forge pipeline (`/api/forge`, rig, remesh, publish) from inside the tools artists already use, so a model is generated without leaving the DCC. Docs: [integrations/README.md](integrations/README.md), [integrations/modly/README.md](integrations/modly/README.md) |+| Desktop local agent runtime | [apps/desktop/src/runtime/](apps/desktop/src/runtime) (runtime, keystore, feed, live executor), [src/main/local-runtime.js](apps/desktop/src/main/local-runtime.js), console view [src/console/views/local.js](apps/desktop/src/console/views/local.js), smoke [scripts/smoke-runtime.mjs](apps/desktop/scripts/smoke-runtime.mjs) | In-repo; Linux AppImage and deb built, Mac and Windows builds and signing are owner actions | Runs agents, paper and live strategies, limit orders and automations on the user's machine with keys in the OS keychain, native payload-hash approvals, a tray menu, and a mascot that shows agent state. Docs: [docs/desktop-local-runtime.md](docs/desktop-local-runtime.md). Tests: tests/desktop-runtime.test.js || Base58 difficulty model (the honest math) | [src/solana/vanity/base58-distribution.js](src/solana/vanity/base58-distribution.js), dispatch in [src/solana/vanity/validation.js](src/solana/vanity/validation.js); ported copies in [solana-agent-sdk/src/vanity/verify.ts](solana-agent-sdk/src/vanity/verify.ts) and [mcp-server/src/lib/base58-distribution.js](mcp-server/src/lib/base58-distribution.js), held in agreement by [tests/vanity-model-parity.test.js](tests/vanity-model-parity.test.js) | In-repo | The exact probability that a random Solana address matches a vanity pattern, and the single source of truth behind every quote, price, rarity tier, bounty payout and signed receipt. Base58 is a positional encoding of a 256-bit integer, so the *leading* character is not uniform: the 40 symbols `K`-`z` are 17.2x harder to lead with than `5`-`H`, a 58x spread the old flat 58ⁿ model erased. Models are versioned (`base58-exact/v2`, superseding `58^effectiveLength`) and receipts name theirs, so attestations issued before the correction still verify. Spec: [docs/PROTOCOL-vanity.md](docs/PROTOCOL-vanity.md#41-difficulty-model-versioning) || Vanity address grinder (Rust → WASM) | [crates/vanity-grinder/](crates/vanity-grinder) → compiled to [src/solana/vanity/wasm/](src/solana/vanity/wasm); consumed by [src/agent-vanity-grinder.js](src/agent-vanity-grinder.js), [src/agent-eth-vanity-card.js](src/agent-eth-vanity-card.js) | In-repo | The Rust source behind in-browser Solana/EVM vanity-address mining. Compiled to WebAssembly so grinding runs on the visitor's machine, never the server. Surfaced as the `vanity_grinder` MCP tool and the premium pre-ground inventory (`vanity_premium`). || x402 payment modal (drop-in UI) | [x402-payment-modal/](x402-payment-modal) | Published as `@three-ws/x402-payment-modal` | A drop-in payment modal for any x402 paid endpoint — one ES import turns a 402 challenge into a wallet-connect + pay flow. Has a build step, so it sits outside the zero-dependency `packages/*` SDK family. |diff --git a/apps/desktop/README.md b/apps/desktop/README.mdindex cb631fe3a..991f44ac8 100644--- a/apps/desktop/README.md+++ b/apps/desktop/README.md@@ -61,6 +61,18 @@ once signs in everything on that machine. Get the token from[three.ws/companion](https://three.ws/companion); rotating it there disconnectsevery device at once.+### Local agents++The app also runs agents on your machine, with keys in the OS keychain and+paper strategies that work offline from the account. Open **Local agents** in+the console (or the tray). Try the runtime headless:++```bash+npm run smoke:runtime+```++Full guide: [docs/desktop-local-runtime.md](../../docs/desktop-local-runtime.md).+### Build an installer```bashdiff --git a/apps/desktop/package-lock.json b/apps/desktop/package-lock.jsonindex 12307af71..138fa9dfe 100644--- a/apps/desktop/package-lock.json+++ b/apps/desktop/package-lock.json@@ -9,6 +9,7 @@"version": "0.1.0","license": "Apache-2.0","dependencies": {+ "@solana/web3.js": "^1.99.0","@three-ws/companion": "file:../../packages/companion-sdk","dompurify": "^3.4.15","electron-updater": "^6.8.9",@@ -43,6 +44,15 @@}}},+ "node_modules/@babel/runtime": {+ "version": "7.29.10",+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.10.tgz",+ "integrity": "sha512-NpugTzbKgGrNe45Ui32cN8vCFFMxVtP/9rtfwv0nP5FRDAjvYBxJcLVpYA9mr1jxP6cnIT7x9LUzuDTbWYYNRA==",+ "license": "MIT",+ "engines": {+ "node": ">=6.9.0"+ }+ },"node_modules/@develar/schema-utils": {"version": "2.6.5","resolved": "https://registry.npmjs.org/@develar/schema-utils/-/schema-utils-2.6.5.tgz",@@ -617,6 +627,33 @@"node": ">= 10.0.0"}},+ "node_modules/@noble/curves": {+ "version": "1.9.7",+ "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.7.tgz",+ "integrity": "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==",+ "license": "MIT",+ "dependencies": {+ "@noble/hashes": "1.8.0"+ },+ "engines": {+ "node": "^14.21.3 || >=16"+ },+ "funding": {+ "url": "https://paulmillr.com/funding/"+ }+ },+ "node_modules/@noble/hashes": {+ "version": "1.8.0",+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz",+ "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==",+ "license": "MIT",+ "engines": {+ "node": "^14.21.3 || >=16"+ },+ "funding": {+ "url": "https://paulmillr.com/funding/"+ }+ },"node_modules/@npmcli/fs": {"version": "2.1.2","resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-2.1.2.tgz",@@ -683,6 +720,184 @@"url": "https://github.com/sindresorhus/is?sponsor=1"}},+ "node_modules/@solana/buffer-layout": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz",+ "integrity": "sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==",+ "license": "MIT",+ "dependencies": {+ "buffer": "~6.0.3"+ },+ "engines": {+ "node": ">=5.10"+ }+ },+ "node_modules/@solana/buffer-layout/node_modules/buffer": {+ "version": "6.0.3",+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",+ "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "base64-js": "^1.3.1",+ "ieee754": "^1.2.1"+ }+ },+ "node_modules/@solana/codecs-core": {+ "version": "5.5.1",+ "resolved": "https://registry.npmjs.org/@solana/codecs-core/-/codecs-core-5.5.1.tgz",+ "integrity": "sha512-TgBt//bbKBct0t6/MpA8ElaOA3sa8eYVvR7LGslCZ84WiAwwjCY0lW/lOYsFHJQzwREMdUyuEyy5YWBKtdh8Rw==",+ "license": "MIT",+ "dependencies": {+ "@solana/errors": "5.5.1"+ },+ "engines": {+ "node": ">=20.18.0"+ },+ "peerDependencies": {+ "typescript": "^5.0.0"+ },+ "peerDependenciesMeta": {+ "typescript": {+ "optional": true+ }+ }+ },+ "node_modules/@solana/codecs-numbers": {+ "version": "5.5.1",+ "resolved": "https://registry.npmjs.org/@solana/codecs-numbers/-/codecs-numbers-5.5.1.tgz",+ "integrity": "sha512-rllMIZAHqmtvC0HO/dc/21wDuWaD0B8Ryv8o+YtsICQBuiL/0U4AGwH7Pi5GNFySYk0/crSuwfIqQFtmxNSPFw==",+ "license": "MIT",+ "dependencies": {+ "@solana/codecs-core": "5.5.1",+ "@solana/errors": "5.5.1"+ },+ "engines": {+ "node": ">=20.18.0"+ },+ "peerDependencies": {+ "typescript": "^5.0.0"+ },+ "peerDependenciesMeta": {+ "typescript": {+ "optional": true+ }+ }+ },+ "node_modules/@solana/errors": {+ "version": "5.5.1",+ "resolved": "https://registry.npmjs.org/@solana/errors/-/errors-5.5.1.tgz",+ "integrity": "sha512-vFO3p+S7HoyyrcAectnXbdsMfwUzY2zYFUc2DEe5BwpiE9J1IAxPBGjOWO6hL1bbYdBrlmjNx8DXCslqS+Kcmg==",+ "license": "MIT",+ "dependencies": {+ "chalk": "5.6.2",+ "commander": "14.0.2"+ },+ "bin": {+ "errors": "bin/cli.mjs"+ },+ "engines": {+ "node": ">=20.18.0"+ },+ "peerDependencies": {+ "typescript": "^5.0.0"+ },+ "peerDependenciesMeta": {+ "typescript": {+ "optional": true+ }+ }+ },+ "node_modules/@solana/errors/node_modules/chalk": {+ "version": "5.6.2",+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz",+ "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==",+ "license": "MIT",+ "engines": {+ "node": "^12.17.0 || ^14.13 || >=16.0.0"+ },+ "funding": {+ "url": "https://github.com/chalk/chalk?sponsor=1"+ }+ },+ "node_modules/@solana/errors/node_modules/commander": {+ "version": "14.0.2",+ "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.2.tgz",+ "integrity": "sha512-TywoWNNRbhoD0BXs1P3ZEScW8W5iKrnbithIl0YH+uCmBd0QpPOA8yc82DS3BIE5Ma6FnBVUsJ7wVUDz4dvOWQ==",+ "license": "MIT",+ "engines": {+ "node": ">=20"+ }+ },+ "node_modules/@solana/web3.js": {+ "version": "1.99.0",+ "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.99.0.tgz",+ "integrity": "sha512-QZYQ2T1z6xWisoyALPq25i/QZTsRlM02BABtAsfaQ1p8wX4SdTfxrKTRue/ZZqrhNVh5oL7T/DUFiTS9DRgxow==",+ "license": "MIT",+ "dependencies": {+ "@babel/runtime": "^7.29.7",+ "@noble/curves": "^1.9.7",+ "@noble/hashes": "^1.8.0",+ "@solana/buffer-layout": "^4.0.1",+ "@solana/codecs-numbers": "^5.5.1",+ "agentkeepalive": "^4.6.0",+ "bn.js": "^5.2.5",+ "borsh": "^0.7.0",+ "bs58": "^4.0.1",+ "buffer": "6.0.3",+ "fast-stable-stringify": "^1.0.0",+ "jayson": "^4.3.0",+ "node-fetch": "^2.7.0",+ "rpc-websockets": "^9.0.2",+ "superstruct": "^2.0.2"+ }+ },+ "node_modules/@solana/web3.js/node_modules/buffer": {+ "version": "6.0.3",+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",+ "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "base64-js": "^1.3.1",+ "ieee754": "^1.2.1"+ }+ },+ "node_modules/@swc/helpers": {+ "version": "0.5.23",+ "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.23.tgz",+ "integrity": "sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw==",+ "license": "Apache-2.0",+ "dependencies": {+ "tslib": "^2.8.0"+ }+ },"node_modules/@szmarczak/http-timer": {"version": "4.0.6","resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz",@@ -723,6 +938,15 @@"@types/responselike": "^1.0.0"}},+ "node_modules/@types/connect": {+ "version": "3.4.38",+ "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz",+ "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==",+ "license": "MIT",+ "dependencies": {+ "@types/node": "*"+ }+ },"node_modules/@types/debug": {"version": "4.1.13","resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz",@@ -771,7 +995,6 @@"version": "20.19.43","resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.43.tgz","integrity": "sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA==",- "dev": true,"license": "MIT","dependencies": {"undici-types": "~6.21.0"@@ -806,6 +1029,12 @@"license": "MIT","optional": true},+ "node_modules/@types/uuid": {+ "version": "10.0.0",+ "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz",+ "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==",+ "license": "MIT"+ },"node_modules/@types/verror": {"version": "1.10.11","resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.11.tgz",@@ -814,6 +1043,15 @@"license": "MIT","optional": true},+ "node_modules/@types/ws": {+ "version": "7.4.7",+ "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz",+ "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==",+ "license": "MIT",+ "dependencies": {+ "@types/node": "*"+ }+ },"node_modules/@types/yauzl": {"version": "2.10.3","resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz",@@ -863,7 +1101,6 @@"version": "4.6.0","resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.6.0.tgz","integrity": "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==",- "dev": true,"license": "MIT","dependencies": {"humanize-ms": "^1.2.1"@@ -1218,11 +1455,19 @@"node": "18 || 20 || >=22"}},+ "node_modules/base-x": {+ "version": "3.0.11",+ "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.11.tgz",+ "integrity": "sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA==",+ "license": "MIT",+ "dependencies": {+ "safe-buffer": "^5.0.1"+ }+ },"node_modules/base64-js": {"version": "1.5.1","resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz","integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",- "dev": true,"funding": [{"type": "github",@@ -1268,6 +1513,12 @@"bluebird": "^3.5.5"}},+ "node_modules/bn.js": {+ "version": "5.2.5",+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.5.tgz",+ "integrity": "sha512-Vq886eXykuP5E6HcKSSStP3bJgrE6In5WKxVUvJ8XGpWWYs2xZHWqUwzCtGgEtBcxyd57KBFDPFoUfNzdaHCNg==",+ "license": "MIT"+ },"node_modules/boolean": {"version": "3.2.0","resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz",@@ -1277,6 +1528,17 @@"license": "MIT","optional": true},+ "node_modules/borsh": {+ "version": "0.7.0",+ "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.7.0.tgz",+ "integrity": "sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==",+ "license": "Apache-2.0",+ "dependencies": {+ "bn.js": "^5.2.0",+ "bs58": "^4.0.0",+ "text-encoding-utf-8": "^1.0.2"+ }+ },"node_modules/brace-expansion": {"version": "5.0.12","resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz",@@ -1290,6 +1552,15 @@"node": "20 || >=22"}},+ "node_modules/bs58": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz",+ "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==",+ "license": "MIT",+ "dependencies": {+ "base-x": "^3.0.2"+ }+ },"node_modules/buffer": {"version": "5.7.1","resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",@@ -1332,6 +1603,20 @@"dev": true,"license": "MIT"},+ "node_modules/bufferutil": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.1.0.tgz",+ "integrity": "sha512-ZMANVnAixE6AWWnPzlW2KpUrxhm9woycYvPOo67jWHyFowASTEd9s+QN1EIMsSDtwhIxN4sWE1jotpuDUIgyIw==",+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "node-gyp-build": "^4.3.0"+ },+ "engines": {+ "node": ">=6.14.2"+ }+ },"node_modules/builder-util": {"version": "25.1.7","resolved": "https://registry.npmjs.org/builder-util/-/builder-util-25.1.7.tgz",@@ -2024,6 +2309,18 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/delay": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz",+ "integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==",+ "license": "MIT",+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },"node_modules/delayed-stream": {"version": "1.0.0","resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",@@ -2539,7 +2836,6 @@"version": "0.1.13","resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz","integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",- "dev": true,"license": "MIT","optional": true,"dependencies": {@@ -2630,6 +2926,21 @@"license": "MIT","optional": true},+ "node_modules/es6-promise": {+ "version": "4.2.8",+ "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",+ "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==",+ "license": "MIT"+ },+ "node_modules/es6-promisify": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",+ "integrity": "sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==",+ "license": "MIT",+ "dependencies": {+ "es6-promise": "^4.0.3"+ }+ },"node_modules/escalade": {"version": "3.2.0","resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",@@ -2654,6 +2965,12 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/eventemitter3": {+ "version": "5.0.4",+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz",+ "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==",+ "license": "MIT"+ },"node_modules/exponential-backoff": {"version": "3.1.3","resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.3.tgz",@@ -2693,6 +3010,14 @@"license": "MIT","optional": true},+ "node_modules/eyes": {+ "version": "0.1.8",+ "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz",+ "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==",+ "engines": {+ "node": "> 0.1.90"+ }+ },"node_modules/fast-deep-equal": {"version": "3.1.3","resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",@@ -2707,6 +3032,12 @@"dev": true,"license": "MIT"},+ "node_modules/fast-stable-stringify": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz",+ "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==",+ "license": "MIT"+ },"node_modules/fd-slicer": {"version": "1.1.0","resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",@@ -3231,7 +3562,6 @@"version": "1.2.1","resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz","integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==",- "dev": true,"license": "MIT","dependencies": {"ms": "^2.0.0"@@ -3259,7 +3589,7 @@"version": "0.6.3","resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz","integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",- "dev": true,+ "devOptional": true,"license": "MIT","dependencies": {"safer-buffer": ">= 2.1.2 < 3.0.0"@@ -3272,7 +3602,6 @@"version": "1.2.1","resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz","integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",- "dev": true,"funding": [{"type": "github",@@ -3426,6 +3755,15 @@"dev": true,"license": "ISC"},+ "node_modules/isomorphic-ws": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz",+ "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==",+ "license": "MIT",+ "peerDependencies": {+ "ws": "*"+ }+ },"node_modules/jackspeak": {"version": "3.4.3","resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",@@ -3460,6 +3798,44 @@"node": ">=10"}},+ "node_modules/jayson": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/jayson/-/jayson-4.3.0.tgz",+ "integrity": "sha512-AauzHcUcqs8OBnCHOkJY280VaTiCm57AbuO7lqzcw7JapGj50BisE3xhksye4zlTSR1+1tAz67wLTl8tEH1obQ==",+ "license": "MIT",+ "dependencies": {+ "@types/connect": "^3.4.33",+ "@types/node": "^12.12.54",+ "@types/ws": "^7.4.4",+ "commander": "^2.20.3",+ "delay": "^5.0.0",+ "es6-promisify": "^5.0.0",+ "eyes": "^0.1.8",+ "isomorphic-ws": "^4.0.1",+ "json-stringify-safe": "^5.0.1",+ "stream-json": "^1.9.1",+ "uuid": "^8.3.2",+ "ws": "^7.5.10"+ },+ "bin": {+ "jayson": "bin/jayson.js"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/jayson/node_modules/@types/node": {+ "version": "12.20.55",+ "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz",+ "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==",+ "license": "MIT"+ },+ "node_modules/jayson/node_modules/commander": {+ "version": "2.20.3",+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",+ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",+ "license": "MIT"+ },"node_modules/js-yaml": {"version": "4.3.2","resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz",@@ -3500,9 +3876,7 @@"version": "5.0.1","resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz","integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",- "dev": true,- "license": "ISC",- "optional": true+ "license": "ISC"},"node_modules/json5": {"version": "2.2.3",@@ -4074,6 +4448,26 @@"node": ">=10"}},+ "node_modules/node-fetch": {+ "version": "2.7.0",+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",+ "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",+ "license": "MIT",+ "dependencies": {+ "whatwg-url": "^5.0.0"+ },+ "engines": {+ "node": "4.x || >=6.0.0"+ },+ "peerDependencies": {+ "encoding": "^0.1.0"+ },+ "peerDependenciesMeta": {+ "encoding": {+ "optional": true+ }+ }+ },"node_modules/node-gyp": {"version": "9.4.1","resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.4.1.tgz",@@ -4100,6 +4494,18 @@"node": "^12.13 || ^14.13 || >=16"}},+ "node_modules/node-gyp-build": {+ "version": "4.8.4",+ "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz",+ "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==",+ "license": "MIT",+ "optional": true,+ "bin": {+ "node-gyp-build": "bin.js",+ "node-gyp-build-optional": "optional.js",+ "node-gyp-build-test": "build-test.js"+ }+ },"node_modules/node-gyp/node_modules/semver": {"version": "7.8.5","resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",@@ -4631,11 +5037,114 @@"node": ">=8.0"}},+ "node_modules/rpc-websockets": {+ "version": "9.3.9",+ "resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-9.3.9.tgz",+ "integrity": "sha512-2iQDaTB4g5fDB2ihrTFSJSibCEuxaRi1q7qTW7ZO9/M5/TC+ToHA4D9/ffNLEbAoHNNrcdeP05oATNk44SKZXA==",+ "license": "LGPL-3.0-only",+ "dependencies": {+ "@swc/helpers": "^0.5.11",+ "@types/uuid": "^10.0.0",+ "@types/ws": "^8.2.2",+ "buffer": "^6.0.3",+ "eventemitter3": "^5.0.1",+ "uuid": "^14.0.0",+ "ws": "^8.5.0"+ },+ "funding": {+ "type": "paypal",+ "url": "https://paypal.me/kozjak"+ },+ "optionalDependencies": {+ "bufferutil": "^4.0.1",+ "utf-8-validate": "^6.0.0"+ }+ },+ "node_modules/rpc-websockets/node_modules/@types/ws": {+ "version": "8.18.2",+ "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.2.tgz",+ "integrity": "sha512-67MQl+fpWKVTT1NYdnmo3U4sc/xPo/zQBncVnI74qmQa0z/b+1g6iYqNmGCPbxO+zz2aklb08a0oHfegiVd0/w==",+ "license": "MIT",+ "dependencies": {+ "@types/node": "*"+ }+ },+ "node_modules/rpc-websockets/node_modules/buffer": {+ "version": "6.0.3",+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",+ "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "base64-js": "^1.3.1",+ "ieee754": "^1.2.1"+ }+ },+ "node_modules/rpc-websockets/node_modules/utf-8-validate": {+ "version": "6.0.6",+ "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-6.0.6.tgz",+ "integrity": "sha512-q3l3P9UtEEiAHcsgsqTgf9PPjctrDWoIXW3NpOHFdRDbLvu4DLIcxHangJ4RLrWkBcKjmcs/6NkerI8T/rE4LA==",+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "node-gyp-build": "^4.3.0"+ },+ "engines": {+ "node": ">=6.14.2"+ }+ },+ "node_modules/rpc-websockets/node_modules/uuid": {+ "version": "14.0.3",+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-14.0.3.tgz",+ "integrity": "sha512-Sc5u1VVln93y1Xnz4R+CunOZc7R9LUcTmhj7Rc7Eg3HVcf7rVn2FOoa812fe0W8p3jD7xeoGSYbfqCGGH2B6xw==",+ "funding": [+ "https://github.com/sponsors/broofa",+ "https://github.com/sponsors/ctavan"+ ],+ "license": "MIT",+ "bin": {+ "uuid": "dist-node/bin/uuid"+ }+ },+ "node_modules/rpc-websockets/node_modules/ws": {+ "version": "8.22.0",+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.22.0.tgz",+ "integrity": "sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg==",+ "license": "MIT",+ "engines": {+ "node": ">=10.0.0"+ },+ "peerDependencies": {+ "bufferutil": "^4.0.1",+ "utf-8-validate": ">=5.0.2"+ },+ "peerDependenciesMeta": {+ "bufferutil": {+ "optional": true+ },+ "utf-8-validate": {+ "optional": true+ }+ }+ },"node_modules/safe-buffer": {"version": "5.2.1","resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz","integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",- "dev": true,"funding": [{"type": "github",@@ -4656,7 +5165,7 @@"version": "2.1.2","resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz","integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",- "dev": true,+ "devOptional": true,"license": "MIT"},"node_modules/sanitize-filename": {@@ -4910,6 +5419,21 @@"node": ">= 6"}},+ "node_modules/stream-chain": {+ "version": "2.2.5",+ "resolved": "https://registry.npmjs.org/stream-chain/-/stream-chain-2.2.5.tgz",+ "integrity": "sha512-1TJmBx6aSWqZ4tx7aTpBDXK0/e2hhcNSTV8+CbFJtDjbb+I1mZ8lHit0Grw9GRT+6JbIrrDd8esncgBi8aBXGA==",+ "license": "BSD-3-Clause"+ },+ "node_modules/stream-json": {+ "version": "1.9.1",+ "resolved": "https://registry.npmjs.org/stream-json/-/stream-json-1.9.1.tgz",+ "integrity": "sha512-uWkjJ+2Nt/LO9Z/JyKZbMusL8Dkh97uUBTv3AJQ74y07lVahLY4eEFsPsE97pxYBwr8nnjMAIch5eqI0gPShyw==",+ "license": "BSD-3-Clause",+ "dependencies": {+ "stream-chain": "^2.2.5"+ }+ },"node_modules/string_decoder": {"version": "1.3.0","resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",@@ -4991,6 +5515,15 @@"node": ">= 8.0"}},+ "node_modules/superstruct": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-2.0.2.tgz",+ "integrity": "sha512-uV+TFRZdXsqXTL2pRvujROjdZQ4RAlBUS5BTh9IGm+jTqQntYThciG/qu57Gs69yjnVUSqdxF9YLmSnpupBW9A==",+ "license": "MIT",+ "engines": {+ "node": ">=14.0.0"+ }+ },"node_modules/supports-color": {"version": "7.2.0","resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",@@ -5100,6 +5633,11 @@"node": ">= 10.0.0"}},+ "node_modules/text-encoding-utf-8": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz",+ "integrity": "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg=="+ },"node_modules/tiny-typed-emitter": {"version": "2.1.0","resolved": "https://registry.npmjs.org/tiny-typed-emitter/-/tiny-typed-emitter-2.1.0.tgz",@@ -5126,6 +5664,12 @@"tmp": "^0.2.0"}},+ "node_modules/tr46": {+ "version": "0.0.3",+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",+ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",+ "license": "MIT"+ },"node_modules/truncate-utf8-bytes": {"version": "1.0.2","resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz",@@ -5136,6 +5680,12 @@"utf8-byte-length": "^1.0.1"}},+ "node_modules/tslib": {+ "version": "2.8.1",+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",+ "license": "0BSD"+ },"node_modules/type-fest": {"version": "0.13.1","resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",@@ -5154,7 +5704,7 @@"version": "5.9.3","resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz","integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",- "dev": true,+ "devOptional": true,"license": "Apache-2.0","bin": {"tsc": "bin/tsc",@@ -5168,7 +5718,6 @@"version": "6.21.0","resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz","integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",- "dev": true,"license": "MIT"},"node_modules/unique-filename": {@@ -5231,6 +5780,16 @@"dev": true,"license": "MIT"},+ "node_modules/uuid": {+ "version": "8.3.2",+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",+ "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",+ "deprecated": "uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).",+ "license": "MIT",+ "bin": {+ "uuid": "dist/bin/uuid"+ }+ },"node_modules/verror": {"version": "1.10.1","resolved": "https://registry.npmjs.org/verror/-/verror-1.10.1.tgz",@@ -5257,6 +5816,22 @@"defaults": "^1.0.3"}},+ "node_modules/webidl-conversions": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",+ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",+ "license": "BSD-2-Clause"+ },+ "node_modules/whatwg-url": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",+ "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",+ "license": "MIT",+ "dependencies": {+ "tr46": "~0.0.3",+ "webidl-conversions": "^3.0.0"+ }+ },"node_modules/which": {"version": "2.0.2","resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",@@ -5327,6 +5902,27 @@"dev": true,"license": "ISC"},+ "node_modules/ws": {+ "version": "7.5.13",+ "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.13.tgz",+ "integrity": "sha512-rsKI6xDBFVf4r/x8XyChGK04QR/XHroxs/jUcoWvtEZM8TPU/X/uIY9B1CsSzYws9ZJb/6bbBu7dPhFW00CAoA==",+ "license": "MIT",+ "engines": {+ "node": ">=8.3.0"+ },+ "peerDependencies": {+ "bufferutil": "^4.0.1",+ "utf-8-validate": "^5.0.2"+ },+ "peerDependenciesMeta": {+ "bufferutil": {+ "optional": true+ },+ "utf-8-validate": {+ "optional": true+ }+ }+ },"node_modules/xmlbuilder": {"version": "15.1.1","resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz",diff --git a/apps/desktop/package.json b/apps/desktop/package.jsonindex cf15bdf77..166cf66f4 100644--- a/apps/desktop/package.json+++ b/apps/desktop/package.json@@ -17,6 +17,7 @@"scripts": {"start": "electron .","dev": "electron . --dev",+ "smoke:runtime": "node scripts/smoke-runtime.mjs","icons": "node scripts/make-icons.mjs","bump": "node scripts/bump-version.mjs","dist": "electron-builder --config electron-builder.config.cjs --publish never",@@ -28,6 +29,7 @@"release:github": "node scripts/github-release.mjs"},"dependencies": {+ "@solana/web3.js": "^1.99.0","@three-ws/companion": "file:../../packages/companion-sdk","dompurify": "^3.4.15","electron-updater": "^6.8.9",diff --git a/apps/desktop/scripts/smoke-runtime.mjs b/apps/desktop/scripts/smoke-runtime.mjsnew file mode 100644index 000000000..ed1883632--- /dev/null+++ b/apps/desktop/scripts/smoke-runtime.mjs@@ -0,0 +1,61 @@+// Headless smoke test for the local agent runtime. Starts the real runtime in a+// temp directory (no Electron), points a paper-mode strategy at the live+// pump.fun launch feed, runs one scheduler pass and prints what it did.+// Nothing is signed and no funds move. Exit 0 on pass, 1 on fail.+//+// npm run smoke:runtime++import { mkdtempSync, readFileSync, rmSync, existsSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { createLocalRuntime } from '../src/runtime/index.js';++const dir = mkdtempSync(join(tmpdir(), 'three-ws-runtime-smoke-'));+const events = [];+const { runtime, keystore, log } = createLocalRuntime({ dir, safeStorage: null, onEvent: (e) => events.push(e.type) });+const failures = [];+const check = (name, ok, detail = '') => {+ console.log(`${ok ? 'PASS' : 'FAIL'} ${name}${detail ? `: ${detail}` : ''}`);+ if (!ok) failures.push(name);+};++try {+ const agent = runtime.createAgent({+ name: 'smoke-paper',+ mode: 'paper',+ strategy: { mode: 'auto', entry: { max_age_minutes: 10080, require_socials: false }, sizing: { amount_sol: 0.05, max_slippage_bps: 1500 }, exits: { take_profit_pct: 50, stop_loss_pct: 30 }, risk: { max_concurrent_positions: 2, cooldown_minutes: 0 } },+ });+ check('agent created with a keychain-store address', Boolean(agent.address) && keystore.address(agent.id) === agent.address, agent.address);++ await runtime.tick();++ const after = runtime.getAgent(agent.id);+ const receipts = runtime.receipts({ agentId: agent.id });+ const positions = runtime.positions({ agentId: agent.id });+ check('scheduler pass finished without error', after.status === 'idle', after.status + (after.detail ? ` (${after.detail})` : ''));+ check('paper buy filled from live feed data', receipts.some((r) => r.kind === 'buy' && r.mode === 'paper' && r.tokens > 0 && r.signature === null), `${receipts.length} receipt(s)`);+ check('position opened', positions.some((p) => p.status === 'open'), `${positions.length} position(s)`);+ check('status events emitted', events.includes('status') && events.includes('receipt'));++ runtime.pause(agent.id);+ check('pause holds the agent', runtime.getAgent(agent.id).status === 'paused');+ runtime.kill(agent.id);+ check('kill is final', runtime.getAgent(agent.id).status === 'killed');++ const logText = existsSync(join(dir, 'runtime.log')) ? readFileSync(join(dir, 'runtime.log'), 'utf8') : '';+ const secret = JSON.stringify(Array.from({ length: 64 }, () => 1));+ log.info('probe', { secretKey: [...Array(64).keys()], note: secret });+ const logAfter = readFileSync(join(dir, 'runtime.log'), 'utf8');+ check('log carries no key material', !/"secretKey":\[/.test(logAfter) && !logAfter.includes('[0,1,2,3,4,5'), `${logText.length} bytes before probe`);+} catch (err) {+ console.log(`FAIL smoke threw: ${err.stack || err}`);+ failures.push('threw');+} finally {+ rmSync(dir, { recursive: true, force: true });+}++if (failures.length) {+ console.log(`\nsmoke failed: ${failures.join(', ')}`);+ process.exit(1);+}+console.log('\nsmoke passed');diff --git a/apps/desktop/src/console-preload.cjs b/apps/desktop/src/console-preload.cjsindex 86ff90856..379e8ae53 100644--- a/apps/desktop/src/console-preload.cjs+++ b/apps/desktop/src/console-preload.cjs@@ -32,6 +32,24 @@ contextBridge.exposeInMainWorld('threews', {refreshUser: () => call('session:refreshUser'),onChange: (fn) => on('session:changed', fn),},+ runtime: {+ list: () => call('runtime:list'),+ create: (input) => call('runtime:create', input),+ pause: (id) => call('runtime:pause', id),+ resume: (id) => call('runtime:resume', id),+ kill: (id) => call('runtime:kill', id),+ remove: (id) => call('runtime:remove', id),+ addOrder: (id, order) => call('runtime:addOrder', id, order),+ removeOrder: (id, orderId) => call('runtime:removeOrder', id, orderId),+ addAutomation: (id, auto) => call('runtime:addAutomation', id, auto),+ approvals: (filter) => call('runtime:approvals', filter),+ review: (approvalId) => call('runtime:review', approvalId),+ deny: (approvalId) => call('runtime:deny', approvalId),+ receipts: (filter) => call('runtime:receipts', filter),+ positions: (filter) => call('runtime:positions', filter),+ tick: () => call('runtime:tick'),+ onEvent: (fn) => on('runtime:event', fn),+ },capabilities: () => call('capabilities'),agents: {list: () => call('agents:list'),diff --git a/apps/desktop/src/console/app.js b/apps/desktop/src/console/app.jsindex 1fb93dcad..4f9296687 100644--- a/apps/desktop/src/console/app.js+++ b/apps/desktop/src/console/app.js@@ -12,6 +12,7 @@ import { mountRuns } from './views/runs.js';import { mountWallet } from './views/wallet.js';import { mountNotifications } from './views/notifications.js';import { mountEditors } from './views/editors.js';+import { mountLocal } from './views/local.js';import { mountSettings } from './views/settings.js';const bridge = window.threews;@@ -22,6 +23,7 @@ const VIEWS = {wallet: mountWallet,notifications: mountNotifications,editors: mountEditors,+ local: mountLocal,settings: mountSettings,};const ORDER = Object.keys(VIEWS);@@ -57,6 +59,7 @@ const ctx = {markdown,toast,navigate,+ openLocal,session: () => session,// Views that start a flow in another view (chat proposing a send) leave// their hand-off here; the receiving view consumes it once.@@ -75,9 +78,15 @@ function navigate(view, params = {}) {else location.hash = target;}+// Local agents need no account: keys, strategies and paper fills live on this+// machine. Signed out, the console offers only that view.+let localOnly = false;+function route() {- if (!session?.signedIn) return;- const { view, params } = parseHash();+ if (!session?.signedIn && !localOnly) return;+ const parsed = parseHash();+ const { params } = parsed;+ const view = session?.signedIn ? parsed.view : 'local';current.cleanup?.();for (const a of els.nav.querySelectorAll('.nav-item')) {if (a.dataset.view === view) a.setAttribute('aria-current', 'page');@@ -124,6 +133,14 @@ function showSignedOut() {signInCleanup = mountSignIn(els.signin, ctx);}+function openLocal() {+ localOnly = true;+ els.signin.hidden = true;+ els.app.hidden = false;+ for (const a of els.nav.querySelectorAll('.nav-item')) a.hidden = a.dataset.view !== 'local';+ navigate('local');+}+function applySession(next) {const was = session?.signedIn;session = next;@@ -131,6 +148,8 @@ function applySession(next) {if (session.signedIn) {signInCleanup?.();signInCleanup = null;+ for (const a of els.nav.querySelectorAll('.nav-item')) a.hidden = false;+ localOnly = false;if (!was || els.app.hidden) showSignedIn();else renderAccount();} else if (was !== false) {@@ -138,11 +157,11 @@ function applySession(next) {}}-// Cmd/Ctrl + 1..7 jumps between views, in sidebar order.+// Cmd/Ctrl + 1..8 jumps between views, in sidebar order.document.addEventListener('keydown', (event) => {- if (!session?.signedIn) return;+ if (!session?.signedIn && !localOnly) return;const mod = event.metaKey || event.ctrlKey;- if (mod && /^[1-7]$/.test(event.key)) {+ if (mod && /^[1-8]$/.test(event.key)) {event.preventDefault();navigate(ORDER[Number(event.key) - 1]);}diff --git a/apps/desktop/src/console/index.html b/apps/desktop/src/console/index.htmlindex 811d23f04..34c147ecf 100644--- a/apps/desktop/src/console/index.html+++ b/apps/desktop/src/console/index.html@@ -30,7 +30,8 @@<a class="nav-item" href="#wallet" data-view="wallet"><span class="ico ico-wallet" aria-hidden="true"></span>Wallet<kbd>4</kbd></a><a class="nav-item" href="#notifications" data-view="notifications"><span class="ico ico-bell" aria-hidden="true"></span>Notifications<span class="badge" id="unread" hidden></span><kbd>5</kbd></a><a class="nav-item" href="#editors" data-view="editors"><span class="ico ico-code" aria-hidden="true"></span>Editors<kbd>6</kbd></a>- <a class="nav-item" href="#settings" data-view="settings"><span class="ico ico-gear" aria-hidden="true"></span>Settings<kbd>7</kbd></a>+ <a class="nav-item" href="#local" data-view="local"><span class="ico ico-agents" aria-hidden="true"></span>Local agents<kbd>7</kbd></a>+ <a class="nav-item" href="#settings" data-view="settings"><span class="ico ico-gear" aria-hidden="true"></span>Settings<kbd>8</kbd></a></nav><div class="update-pill" id="update-pill" hidden></div><button type="button" class="account" id="account" aria-label="Account settings"></button>diff --git a/apps/desktop/src/console/views/local.js b/apps/desktop/src/console/views/local.jsnew file mode 100644index 000000000..e4ecbf399--- /dev/null+++ b/apps/desktop/src/console/views/local.js@@ -0,0 +1,185 @@+// Local agents: agents that run on this machine, with signing keys in the OS+// keychain. Paper agents trade real launch data with simulated fills. Live+// agents sign with the local key, and every live action waits in the approval+// list until the owner reviews it in a native dialog that shows recipient,+// amount, asset, chain and the payload hash.+//+// This view can create, pause, resume, kill and deny. It cannot approve: the+// Review button asks the main process to open the native dialog, which is built+// from the stored approval and never from anything this window sends.++import { html, raw, mount, onAction, emptyState, errorState, skeletonLines } from '../lib/dom.js';+import { relativeTime, shortAddress } from '../../shared/normalize.js';++const STATUS = {+ idle: ['chip', 'Idle'],+ working: ['chip chip-info', 'Working'],+ waiting_approval: ['chip chip-warn', 'Needs approval'],+ paused: ['chip', 'Paused'],+ error: ['chip chip-bad', 'Error'],+ killed: ['chip', 'Killed'],+};++const chip = (status) => {+ const [cls, label] = STATUS[status] || STATUS.idle;+ return html`<span class="${cls}">${label}</span>`;+};++export function mountLocal(root, ctx) {+ const { bridge, toast } = ctx;+ let phase = 'loading';+ let error = null;+ let data = { agents: [], face: null, keychain: false };+ let approvals = [];+ let receipts = [];+ let busy = null;++ async function load() {+ try {+ [data, approvals, receipts] = await Promise.all([bridge.runtime.list(), bridge.runtime.approvals({ status: 'pending' }), bridge.runtime.receipts({})]);+ phase = 'ready';+ } catch (err) {+ error = err;+ phase = 'error';+ }+ render();+ }++ function createForm() {+ return html`<form class="card" id="new-local" style="margin-bottom:16px">+ <div class="row">+ <div class="field"><label for="l-name">Name</label><input class="input" id="l-name" maxlength="60" placeholder="Launch scout" required /></div>+ <div class="field"><label for="l-mode">Mode</label>+ <select class="input" id="l-mode"><option value="paper">Paper (simulated fills)</option><option value="live" ${data.keychain ? '' : raw('disabled')}>Live (signs with this machine)</option></select></div>+ <div class="field"><label for="l-net">Network</label>+ <select class="input" id="l-net"><option value="mainnet">Mainnet</option><option value="devnet">Devnet</option></select></div>+ </div>+ <div class="row" style="margin-top:10px">+ <div class="field"><label for="l-size">Buy size (SOL)</label><input class="input" id="l-size" type="number" min="0.0001" step="0.01" value="0.05" /></div>+ <div class="field"><label for="l-tp">Take profit (%)</label><input class="input" id="l-tp" type="number" min="1" value="100" /></div>+ <div class="field"><label for="l-sl">Stop loss (%)</label><input class="input" id="l-sl" type="number" min="1" max="99" value="40" /></div>+ <div class="field"><label for="l-age">Max launch age (min)</label><input class="input" id="l-age" type="number" min="1" value="60" /></div>+ </div>+ <div class="row" style="margin-top:10px">+ <div class="field"><label for="l-ask">Live buys</label>+ <select class="input" id="l-ask"><option value="ask">Ask me first (recommended)</option><option value="auto">Buy within caps automatically</option></select></div>+ <button type="submit" class="btn btn-primary" ${busy === 'create' ? raw('disabled') : ''}>${busy === 'create' ? raw('<span class="spin" aria-hidden="true"></span>Creating') : 'Create local agent'}</button>+ </div>+ </form>`;+ }++ function agentCard(a) {+ const pending = approvals.filter((ap) => ap.agent_id === a.id);+ return html`<article class="card agent-card" data-agent="${a.id}">+ <div class="agent-top">+ <div class="meta">+ <h3 title="${a.name}">${a.name}</h3>+ <div class="sub">${chip(a.status)}<span class="chip">${a.mode === 'paper' ? 'Paper' : 'Live'}</span><span class="mono" title="${a.address}">${shortAddress(a.address)}</span></div>+ </div>+ </div>+ <p class="agent-desc">${a.detail || `${a.open_positions} open position${a.open_positions === 1 ? '' : 's'} on ${a.network}. Buys ${a.strategy.sizing.amount_sol} SOL per launch, take profit ${a.strategy.exits.take_profit_pct ?? 'off'}%, stop loss ${a.strategy.exits.stop_loss_pct}%.`}</p>+ ${pending.map((ap) => html`<div class="banner" style="margin:8px 0"><div>${ap.text.split('\n').map((l) => html`<div>${l}</div>`)}<div class="mono" style="font-size:11px;color:var(--dim)">hash ${ap.hash.slice(0, 16)}...</div></div>+ <button type="button" class="btn btn-sm btn-primary" data-action="review" data-id="${ap.id}">Review</button>+ <button type="button" class="btn btn-sm" data-action="deny" data-id="${ap.id}">Deny</button></div>`)}+ <div class="agent-actions">+ ${a.status === 'paused'+ ? html`<button type="button" class="btn btn-sm btn-primary" data-action="resume" data-id="${a.id}">Resume</button>`+ : html`<button type="button" class="btn btn-sm" data-action="pause" data-id="${a.id}" ${a.status === 'killed' ? raw('disabled') : ''}>Pause</button>`}+ <button type="button" class="btn btn-sm btn-danger" data-action="kill" data-id="${a.id}" ${a.status === 'killed' ? raw('disabled') : ''}>Kill</button>+ ${a.status === 'killed' ? html`<button type="button" class="btn btn-sm btn-ghost" data-action="remove" data-id="${a.id}">Remove</button>` : ''}+ </div>+ <div class="sub" style="font-size:11.5px;color:var(--dim)">${a.last_sweep_at ? `Last checked ${relativeTime(new Date(a.last_sweep_at).toISOString())}` : 'Not checked yet'}</div>+ </article>`;+ }++ function receiptTable() {+ if (!receipts.length) return emptyState({ icon: 'runs', title: 'No receipts yet', message: 'Every fill, simulated or signed, is recorded here with the approval hash it ran under.' });+ return html`<div class="card"><table class="table"><thead><tr><th>When</th><th>Action</th><th>Coin</th><th>SOL</th><th>Mode</th><th>Proof</th></tr></thead><tbody>+ ${receipts.slice(0, 50).map((r) => html`<tr>+ <td>${relativeTime(new Date(r.at).toISOString())}</td>+ <td>${r.kind}${r.reason ? ` (${r.reason})` : ''}</td>+ <td>${r.symbol ? `$${r.symbol}` : shortAddress(r.mint)}</td>+ <td>${Number(r.sol).toFixed(4)}</td>+ <td>${r.mode}</td>+ <td class="mono">${r.signature ? shortAddress(r.signature) : r.payload_hash ? r.payload_hash.slice(0, 10) : 'paper'}</td>+ </tr>`)}</tbody></table></div>`;+ }++ function body() {+ if (phase === 'loading') return html`<div class="split"><div>${skeletonLines(5)}</div><div class="sk sk-block"></div></div>`;+ if (phase === 'error') return errorState(error, { title: 'Local agents could not load' });+ return html`+ ${data.keychain ? '' : html`<div class="banner bad"><span class="ico ico-alert" aria-hidden="true"></span><div>The OS keychain is not available on this machine, so live agents are disabled and new keys would sit in a file readable only by you. Paper agents work normally. On Linux, install a keyring (gnome-keyring or kwallet) and restart.</div></div>`}+ ${createForm()}+ ${data.agents.length+ ? html`<div class="grid">${data.agents.map(agentCard)}</div>`+ : emptyState({ icon: 'agents', title: 'No local agents yet', message: 'Create a paper agent above to watch a strategy trade real launches with simulated fills. Nothing is signed and no funds move.' })}+ <h2 style="margin-top:20px">Receipts</h2>+ ${receiptTable()}`;+ }++ function render() {+ mount(root, html`<div class="view">+ <header class="head">+ <div><h1>Local agents</h1><p>Run agents on this machine. Keys stay in your keychain and nothing is signed without your yes.</p></div>+ <div class="head-actions"><button type="button" class="btn" data-action="tick" ${busy === 'tick' ? raw('disabled') : ''}>Check launches now</button></div>+ </header>+ ${body()}+ </div>`);+ }++ async function run(key, fn, success) {+ busy = key;+ render();+ try {+ await fn();+ if (success) toast(success);+ } catch (err) {+ toast(err.message, 'bad');+ }+ busy = null;+ await load();+ }++ const off = onAction(root, {+ retry: load,+ tick: () => run('tick', () => bridge.runtime.tick()),+ pause: (el) => run('pause', () => bridge.runtime.pause(el.dataset.id)),+ resume: (el) => run('resume', () => bridge.runtime.resume(el.dataset.id)),+ kill: (el) => run('kill', () => bridge.runtime.kill(el.dataset.id), 'Agent killed'),+ remove: (el) => run('remove', () => bridge.runtime.remove(el.dataset.id), 'Agent removed'),+ deny: (el) => run('deny', () => bridge.runtime.deny(el.dataset.id), 'Denied'),+ review: (el) => run('review', async () => {+ const res = await bridge.runtime.review(el.dataset.id);+ if (res.status === 'executed') toast('Approved and executed');+ else if (res.status === 'denied') toast('Denied');+ }),+ });++ const onSubmit = (event) => {+ if (event.target.id !== 'new-local') return;+ event.preventDefault();+ const num = (id) => Number(root.querySelector(id).value);+ const input = {+ name: root.querySelector('#l-name').value,+ mode: root.querySelector('#l-mode').value,+ network: root.querySelector('#l-net').value,+ strategy: {+ mode: root.querySelector('#l-ask').value,+ entry: { max_age_minutes: num('#l-age') },+ sizing: { amount_sol: num('#l-size') },+ exits: { take_profit_pct: num('#l-tp'), stop_loss_pct: num('#l-sl') },+ },+ };+ run('create', () => bridge.runtime.create(input), 'Local agent created');+ };+ root.addEventListener('submit', onSubmit);+ const offEvents = bridge.runtime.onEvent(() => load());++ load();+ return () => {+ off();+ offEvents();+ root.removeEventListener('submit', onSubmit);+ };+}diff --git a/apps/desktop/src/console/views/signin.js b/apps/desktop/src/console/views/signin.jsindex 8e26e024a..a40f7e990 100644--- a/apps/desktop/src/console/views/signin.js+++ b/apps/desktop/src/console/views/signin.js@@ -23,6 +23,7 @@ export function mountSignIn(root, ctx) {? html`<button type="button" class="btn" data-action="cancel">Cancel sign-in</button><div class="signin-wait"><span class="spin" aria-hidden="true"></span>Finish signing in in your browser.</div>`: html`<button type="button" class="btn btn-primary" data-action="signin" autofocus>Sign in with three.ws</button>`}+ ${waiting ? '' : html`<button type="button" class="btn btn-ghost" data-action="local">Run local agents without signing in</button>`}${error ? html`<div class="signin-error" role="alert">${error}</div>` : ''}<ul class="signin-list"><li><span class="ico ico-check" aria-hidden="true"></span>You approve the app by name on three.ws, and can revoke it any time.</li>@@ -55,6 +56,7 @@ export function mountSignIn(root, ctx) {const off = onAction(root, {signin: signIn,+ local: () => ctx.openLocal(),cancel: () => bridge.session.cancelSignIn(),});diff --git a/apps/desktop/src/main.js b/apps/desktop/src/main.jsindex 5bbb86019..306005d02 100644--- a/apps/desktop/src/main.js+++ b/apps/desktop/src/main.js@@ -18,7 +18,7 @@// Anything that moves money goes through src/main/previews.js: a single-use// preview id, then a native confirmation built from the stored request.-import { app, BrowserWindow, Tray, Menu, ipcMain, shell, Notification, nativeImage, dialog, safeStorage } from 'electron';+import { app, BrowserWindow, Tray, Menu, ipcMain, shell, Notification, nativeImage, dialog, safeStorage, crashReporter } from 'electron';import { fileURLToPath } from 'node:url';import { dirname, join } from 'node:path';import { homedir } from 'node:os';@@ -32,6 +32,7 @@ import { createPreviewRegistry, isGuardedPath } from './main/previews.js';import { createNotifier } from './main/notifier.js';import { createUpdater } from './main/updater.js';import { createCompanion } from './main/companion.js';+import { createLocalRuntimeService } from './main/local-runtime.js';import { detectEditors, connectEditor, disconnectEditor, mcpServers } from './main/editors.js';const SRC = dirname(fileURLToPath(import.meta.url));@@ -72,6 +73,7 @@ let previews;let notifier;let updater;let companion;+let localRuntime;let store;function sendToConsole(channel, payload) {@@ -166,6 +168,9 @@ function refreshTray() {{ label: 'Sign in…', click: () => openConsole() },]),{ type: 'separator' },+ ...(localRuntime ? localRuntime.trayItems() : []),+ { label: 'Local agents…', click: () => openConsole('local') },+ { type: 'separator' },{ label: 'Companion mode', type: 'checkbox', checked: c.enabled, click: (item) => setCompanionMode(item.checked) },...(c.enabled ? [{ label: c.paused ? 'Resume deliveries' : 'Pause deliveries', click: () => companion.togglePause() },@@ -274,6 +279,14 @@ function appInfo() {};}+// Copies only the named keys of a renderer-supplied object, so an unexpected+// field can never reach the runtime.+function pickObject(value, keys) {+ const out = {};+ if (value && typeof value === 'object') for (const k of keys) if (value[k] !== undefined) out[k] = value[k];+ return out;+}+function registerIpc() {handle('session:status', () => session.status());handle('session:signIn', (opts) => session.signIn(opts || {}));@@ -285,6 +298,29 @@ function registerIpc() {});handle('session:refreshUser', () => session.refreshUser());+ // Local agent runtime. The renderer can read, create, pause, resume, kill and+ // deny. It has no approve channel: approving goes through runtime:review, which+ // opens a native dialog built in this process from the stored approval, so what+ // is approved is what was shown and the hash never comes from the renderer.+ handle('runtime:list', () => ({ agents: localRuntime.runtime.listAgents(), face: localRuntime.runtime.face(), keychain: localRuntime.keysEncrypted() }));+ handle('runtime:create', (input) => localRuntime.runtime.createAgent(pickObject(input, ['name', 'mode', 'network', 'strategy'])));+ handle('runtime:pause', (id) => localRuntime.runtime.pause(String(id)));+ handle('runtime:resume', (id) => localRuntime.runtime.resume(String(id)));+ handle('runtime:kill', (id) => localRuntime.runtime.kill(String(id)));+ handle('runtime:remove', (id) => localRuntime.runtime.remove(String(id)));+ handle('runtime:addOrder', (id, order) => localRuntime.runtime.addOrder(String(id), pickObject(order, ['mint', 'side', 'amount_sol', 'trigger'])));+ handle('runtime:removeOrder', (id, orderId) => localRuntime.runtime.removeOrder(String(id), String(orderId)));+ handle('runtime:addAutomation', (id, auto) => localRuntime.runtime.addAutomation(String(id), pickObject(auto, ['action', 'every_minutes'])));+ handle('runtime:approvals', (filter) => localRuntime.runtime.listApprovals({ status: filter?.status || null, agentId: filter?.agentId || null }));+ handle('runtime:review', (approvalId) => localRuntime.decideThroughDialog(String(approvalId)));+ handle('runtime:deny', (approvalId) => {+ const ap = localRuntime.runtime.listApprovals().find((a) => a.id === String(approvalId));+ return localRuntime.runtime.decide(String(approvalId), { decision: 'deny', hash: ap?.hash, via: 'desktop' });+ });+ handle('runtime:receipts', (filter) => localRuntime.runtime.receipts({ agentId: filter?.agentId || null, limit: 200 }));+ handle('runtime:positions', (filter) => localRuntime.runtime.positions({ agentId: filter?.agentId || null }));+ handle('runtime:tick', () => localRuntime.runtime.tick().then(() => localRuntime.runtime.listAgents()));+handle('capabilities', () => api.capabilities());handle('agents:list', () => api.listAgents());handle('agents:setStatus', (agentId, running) => api.setAgentStatus(agentId, running));@@ -423,6 +459,14 @@ function boot() {},});companion = createCompanion({ srcDir: SRC, onChange: (s) => { sendToConsole('app:companion', s); refreshTray(); } });+ localRuntime = createLocalRuntimeService({+ app,+ safeStorage,+ session,+ getConsole: () => state.console,+ onChange: refreshTray,+ onFace: (face) => companion.setFace(face),+ });registerIpc();@@ -433,12 +477,19 @@ function boot() {if (readSettings().companionMode) companion.enable();if (session.status().signedIn) notifier.start();updater.start();+ localRuntime.runtime.start();+ companion.setFace(localRuntime.runtime.face());// Launched at login stays in the tray; launched by hand opens the console.const hidden = app.getLoginItemSettings().wasOpenedAsHidden || process.argv.includes('--hidden');if (!hidden) openConsole();}+// Crash dumps stay on this machine. They can hold process memory, and the+// signing keys are decrypted in memory while the runtime signs, so nothing is+// ever uploaded and nothing is sent to a collection server.+crashReporter.start({ uploadToServer: false, compress: true, submitURL: '' });+// One instance only: two consoles would double every notification.if (!app.requestSingleInstanceLock()) {app.quit();@@ -453,5 +504,6 @@ if (!app.requestSingleInstanceLock()) {app.on('before-quit', () => {companion?.stop();notifier?.stop();+ localRuntime?.runtime.stop();});}diff --git a/apps/desktop/src/main/companion.js b/apps/desktop/src/main/companion.jsindex ceacced22..aa1bf8668 100644--- a/apps/desktop/src/main/companion.js+++ b/apps/desktop/src/main/companion.js@@ -184,6 +184,7 @@ export function createCompanion({ srcDir, onChange }) {if (state.enabled) return status();state.enabled = true;state.window = createStageWindow();+ state.window.webContents.once('did-finish-load', () => send('companion:face', state.face || { state: 'none', agents: 0 }));screen.on('display-metrics-changed', reposition);screen.on('display-added', reposition);screen.on('display-removed', reposition);@@ -268,5 +269,13 @@ export function createCompanion({ srcDir, onChange }) {ipcMain.on('companion:notify-native', (_event, delivery) => notifyNatively(delivery || {}));- return { enable, disable, status, togglePause, replayLast, openSignIn, stop: () => state.stopStream?.() };+ // The mascot is the local agents' face: the most urgent agent state across+ // the runtime (error, waiting for approval, working, idle) is pushed to the+ // renderer, which shows it as a ring and a gesture.+ function setFace(face) {+ state.face = face;+ send('companion:face', face);+ }++ return { enable, disable, status, togglePause, replayLast, openSignIn, setFace, stop: () => state.stopStream?.() };}diff --git a/apps/desktop/src/main/local-runtime.js b/apps/desktop/src/main/local-runtime.jsnew file mode 100644index 000000000..24ae86a6e--- /dev/null+++ b/apps/desktop/src/main/local-runtime.js@@ -0,0 +1,112 @@+// Electron glue for the local agent runtime: where the headless runtime in+// src/runtime meets the tray, native notifications, native confirmation+// dialogs and the companion mascot. Nothing here signs or moves funds. It+// shows the owner the exact action, and passes their answer, with the hash+// they were shown, back to the runtime, which re-checks it.++import { dialog, Notification } from 'electron';+import { join } from 'node:path';+import { createLocalRuntime } from '../runtime/index.js';+import { payloadHash } from '../runtime/hash.js';++const STATE_LABEL = { idle: 'Idle', working: 'Working', waiting_approval: 'Waiting for approval', paused: 'Paused', error: 'Error', killed: 'Killed' };++export function createLocalRuntimeService({ app, safeStorage, session, getConsole, onChange, onFace }) {+ const dir = join(app.getPath('userData'), 'runtime');+ const shown = new Set();++ const instance = createLocalRuntime({+ dir,+ safeStorage,+ apiBase: session.apiBase(),+ token: () => session.accessToken(),+ onEvent: (evt) => {+ if (evt.type === 'status') onFace(evt.face);+ if (evt.type === 'approval' && evt.notify) announce(evt.approval);+ const win = getConsole();+ if (win && !win.isDestroyed()) win.webContents.send('runtime:event', { type: evt.type, approval: evt.approval || null, receipt: evt.receipt || null, agent: evt.agent || null });+ onChange();+ },+ });+ const { runtime, log } = instance;++ /** The owner's last gate. Built from the stored approval, never from renderer input. */+ async function confirm(approval) {+ if (payloadHash(approval.payload) !== approval.hash) {+ return { error: 'The stored action does not match its hash. Nothing was run.' };+ }+ const parent = getConsole();+ const { response } = await dialog.showMessageBox(parent && !parent.isDestroyed() ? parent : undefined, {+ type: 'warning',+ buttons: ['Deny', 'Cancel', 'Approve'],+ defaultId: 1,+ cancelId: 1,+ noLink: true,+ title: 'Approval request',+ message: `${approval.payload.side === 'sell' ? 'Sell' : 'Buy'} ${approval.table.find((r) => r.key === 'amount')?.value}?`,+ detail: `${approval.text}\n\nApproval hash: ${approval.hash}\n\nApproving signs this exact action with the key on this machine. It cannot be undone.`,+ });+ return { decision: response === 2 ? 'approve' : response === 0 ? 'deny' : null };+ }++ async function decideThroughDialog(approvalId) {+ const approval = runtime.listApprovals().find((a) => a.id === approvalId);+ if (!approval || approval.status !== 'pending') return { status: approval?.status || 'not_found' };+ const answer = await confirm(approval);+ if (answer.error) throw Object.assign(new Error(answer.error), { code: 'payload_changed' });+ if (!answer.decision) return { status: 'pending' };+ return runtime.decide(approvalId, { decision: answer.decision, hash: approval.hash, via: 'desktop' });+ }++ function announce(approval) {+ if (shown.has(approval.id) || !Notification.isSupported()) return;+ shown.add(approval.id);+ const toast = new Notification({+ title: 'Approval needed',+ body: `${approval.text}\nHash ${approval.hash.slice(0, 12)}`,+ actions: [{ type: 'button', text: 'Review' }],+ silent: false,+ });+ const review = () => decideThroughDialog(approval.id).catch((err) => log.warn('approval_dialog_failed', { err }));+ toast.on('click', review);+ toast.on('action', review);+ toast.show();+ }++ /** Tray rows: one submenu per agent with status, pause or resume, kill, and its pending approvals. */+ function trayItems() {+ const agents = runtime.listAgents();+ if (!agents.length) return [{ label: 'Local agents: none yet', enabled: false }];+ return [+ { label: 'Local agents', enabled: false },+ ...agents.map((a) => ({+ label: `${a.name} · ${STATE_LABEL[a.status]}${a.pending_approvals ? ` (${a.pending_approvals})` : ''}`,+ submenu: [+ { label: `${a.mode === 'paper' ? 'Paper' : 'Live'} on ${a.network}`, enabled: false },+ ...(a.detail ? [{ label: a.detail.slice(0, 80), enabled: false }] : []),+ { type: 'separator' },+ ...runtime.listApprovals({ agentId: a.id, status: 'pending' }).map((ap) => ({+ label: `Review approval ${ap.text.split('\n')[1] || ''}`.trim(),+ click: () => void decideThroughDialog(ap.id).catch((err) => log.warn('approval_dialog_failed', { err })),+ })),+ a.status === 'paused'+ ? { label: 'Resume', click: () => runtime.resume(a.id) }+ : { label: 'Pause', enabled: !['killed'].includes(a.status), click: () => runtime.pause(a.id) },+ { label: 'Kill', enabled: a.status !== 'killed', click: () => void confirmKill(a) },+ ],+ })),+ ];+ }++ async function confirmKill(agent) {+ const parent = getConsole();+ const { response } = await dialog.showMessageBox(parent && !parent.isDestroyed() ? parent : undefined, {+ type: 'warning', buttons: ['Cancel', 'Kill agent'], defaultId: 0, cancelId: 0, noLink: true,+ message: `Kill ${agent.name}?`,+ detail: 'It stops for good: pending approvals are denied and its orders and automations are removed. Receipts and open positions stay on record.',+ });+ if (response === 1) runtime.kill(agent.id);+ }++ return { runtime, keystore: instance.keystore, log, trayItems, decideThroughDialog, keysEncrypted: instance.keysEncrypted, dir };+}diff --git a/apps/desktop/src/main/session.js b/apps/desktop/src/main/session.jsindex dc6586522..83abb22a3 100644--- a/apps/desktop/src/main/session.js+++ b/apps/desktop/src/main/session.js@@ -213,5 +213,7 @@ export function createSession({ store, version, openBrowser, fetchImpl = fetch,return status();}- return { status, signIn, cancelSignIn, signOut, request, authorizedFetch, refreshUser, apiBase };+ const accessToken = () => state.accessToken || null;++ return { status, signIn, cancelSignIn, signOut, request, authorizedFetch, refreshUser, apiBase, accessToken };}diff --git a/apps/desktop/src/preload.cjs b/apps/desktop/src/preload.cjsindex b61f8ca50..55f3e9fbd 100644--- a/apps/desktop/src/preload.cjs+++ b/apps/desktop/src/preload.cjs@@ -27,6 +27,12 @@ contextBridge.exposeInMainWorld('companion', {};},+ onFace: (handler) => {+ const listener = (_event, face) => handler(face);+ ipcRenderer.on('companion:face', listener);+ return () => ipcRenderer.removeListener('companion:face', listener);+ },+// ActionssetInteractive: (interactive) => ipcRenderer.send('companion:set-interactive', Boolean(interactive)),sayNative: (text) => ipcRenderer.send('companion:say-native', String(text || '')),diff --git a/apps/desktop/src/renderer/companion.js b/apps/desktop/src/renderer/companion.jsindex 6a98337a4..a1a94cd11 100644--- a/apps/desktop/src/renderer/companion.js+++ b/apps/desktop/src/renderer/companion.js@@ -234,6 +234,32 @@ function hits(element, event) {// Clicking the character opens the control room: the one gesture people try.body.addEventListener('click', () => window.companion?.openExternal(`${apiBase}/companion`));+// ── The agents' face ────────────────────────────────────────────────────────++const FACE_TITLE = {+ working: 'Your agents are working',+ waiting_approval: 'An agent is waiting for your approval',+ error: 'An agent hit an error',+ idle: 'Your agents are idle',+};+let attentionTimer = null;++// The ring tracks the most urgent local-agent state. Waiting for approval waves+// at you until you act; an error jumps once. Both are the embed's own gestures.+function showFace(face) {+ const name = face?.state || 'none';+ stage.dataset.face = name;+ body.title = FACE_TITLE[name] || 'Your companion';+ clearInterval(attentionTimer);+ attentionTimer = null;+ if (name === 'waiting_approval') {+ toEmbed('walk:gesture', { gesture: 'wave' });+ attentionTimer = setInterval(() => toEmbed('walk:gesture', { gesture: 'wave' }), 20_000);+ } else if (name === 'error') {+ toEmbed('walk:gesture', { gesture: 'jump' });+ }+}+// ── Wiring ───────────────────────────────────────────────────────────────────async function boot() {@@ -261,6 +287,7 @@ async function boot() {if (paused) clearBubble();});+ window.companion.onFace(showFace);window.companion.onDelivery(deliver);window.addEventListener('resize', () => walkTo(Math.min(position, maxX())));}diff --git a/apps/desktop/src/renderer/index.html b/apps/desktop/src/renderer/index.htmlindex 73538615a..f3f1933a5 100644--- a/apps/desktop/src/renderer/index.html+++ b/apps/desktop/src/renderer/index.html@@ -42,6 +42,26 @@#stage[data-facing="left"] #body { transform: scaleX(-1); }#stage[data-hidden="1"] { opacity: 0; pointer-events: none; }+ /* The agents' face: a ring under the character shows what the local+ runtime is doing. Compositor-only (opacity and transform). */+ #face {+ position: absolute;+ left: 50%;+ bottom: 4px;+ width: 120px;+ height: 14px;+ margin-left: -60px;+ border-radius: 50%;+ opacity: 0;+ transform: scale(0.8);+ transition: opacity .4s ease, transform .4s ease, background-color .4s ease;+ pointer-events: none;+ }+ #stage[data-face="working"] #face { opacity: .9; background: radial-gradient(closest-side, rgba(88,166,255,.75), transparent); animation: face-pulse 1.4s ease-in-out infinite; }+ #stage[data-face="waiting_approval"] #face { opacity: 1; background: radial-gradient(closest-side, rgba(255,193,7,.9), transparent); animation: face-pulse .9s ease-in-out infinite; }+ #stage[data-face="error"] #face { opacity: 1; background: radial-gradient(closest-side, rgba(255,82,82,.9), transparent); transform: scale(1); }+ @keyframes face-pulse { 0%, 100% { transform: scale(.8); } 50% { transform: scale(1.15); } }+#body {width: 100%;height: 260px;@@ -113,6 +133,7 @@@media (prefers-reduced-motion: reduce) {#stage { transition: none; }+ #face { animation: none !important; transition: none; }#bubble { transition: none; }}</style>@@ -128,6 +149,7 @@<!-- The body itself: the three.ws walking-avatar embed, transparent,driven over the documented postMessage contract(https://three.ws/docs/walk-embed-api). -->+ <div id="face" aria-hidden="true"></div><iframeid="body"title="Your companion"diff --git a/apps/desktop/src/runtime/feed.js b/apps/desktop/src/runtime/feed.jsindex df6dc946c..5c3874a0a 100644--- a/apps/desktop/src/runtime/feed.js+++ b/apps/desktop/src/runtime/feed.js@@ -3,6 +3,31 @@// no public devnet feed, so devnet agents see no entries (open positions still// exit). Mirrors api/_lib/pump-launch-feed.js normalizeLaunch.+import { PublicKey } from '@solana/web3.js';++const PUMP_PROGRAM = new PublicKey('6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P');+const DEFAULT_RPC = 'https://api.mainnet-beta.solana.com';++// The venue's per-coin HTTP route is not reliable, so live reserves are read+// from the coin's bonding-curve account on chain (the source of truth the+// frontend itself mirrors): discriminator, then u64 virtual token reserves,+// virtual SOL reserves, real token reserves, real SOL reserves, total supply,+// and a complete flag.+export function parseBondingCurve(data) {+ if (!data || data.length < 49) return null;+ const buf = Buffer.from(data);+ return {+ virtual_token_reserves: Number(buf.readBigUInt64LE(8)),+ virtual_sol_reserves: Number(buf.readBigUInt64LE(16)),+ real_token_reserves: Number(buf.readBigUInt64LE(24)),+ real_sol_reserves: Number(buf.readBigUInt64LE(32)),+ complete: buf[48] === 1,+ };+}++export const bondingCurveAddress = (mint) =>+ PublicKey.findProgramAddressSync([Buffer.from('bonding-curve'), new PublicKey(mint).toBuffer()], PUMP_PROGRAM)[0].toBase58();+const BASE = process.env.PUMP_FRONTEND_BASE || 'https://frontend-api-v3.pump.fun';const UA = 'three.ws-desktop-runtime/1';@@ -34,7 +59,7 @@ export function normalizeLaunch(c, solUsd = 0) {};}-export function createPumpFeed({ fetchImpl = fetch, base = BASE, now = Date.now } = {}) {+export function createPumpFeed({ fetchImpl = fetch, base = BASE, rpcUrl = DEFAULT_RPC, now = Date.now } = {}) {let sol = { at: 0, usd: 0 };// SOL/USD from Coinbase's public spot endpoint, cached a minute, so the// launch market cap (reported in SOL) can be gated in dollars.@@ -53,8 +78,26 @@ export function createPumpFeed({ fetchImpl = fetch, base = BASE, now = Date.nowconst usd = await solUsd();return list.map((c) => normalizeLaunch(c, usd)).filter((l) => l && !l.graduated);},- async coin(mint) {- return getJson(fetchImpl, `${base}/coins/${encodeURIComponent(mint)}`);+ async coin(mint, { symbol = null } = {}) {+ let address;+ try {+ address = bondingCurveAddress(mint);+ } catch {+ return null;+ }+ try {+ const r = await fetchImpl(rpcUrl, {+ method: 'POST', headers: { 'content-type': 'application/json' },+ body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'getAccountInfo', params: [address, { encoding: 'base64', commitment: 'confirmed' }] }),+ signal: AbortSignal.timeout(8000),+ });+ const body = await r.json();+ const b64 = body?.result?.value?.data?.[0];+ const curve = b64 ? parseBondingCurve(Buffer.from(b64, 'base64')) : null;+ return curve ? { mint, symbol, ...curve } : null;+ } catch {+ return null;+ }},};}diff --git a/apps/desktop/src/runtime/runtime.js b/apps/desktop/src/runtime/runtime.jsindex 5f4112b24..f7f08e479 100644--- a/apps/desktop/src/runtime/runtime.js+++ b/apps/desktop/src/runtime/runtime.js@@ -58,6 +58,9 @@ export function createRuntime({ stateStore, keystore, log, feed = createPumpFeedif (!cleanName) throw new RuntimeError('invalid_name', 'An agent needs a name.');if (!['paper', 'live'].includes(mode)) throw new RuntimeError('invalid_mode', 'Mode must be paper or live.');if (!['mainnet', 'devnet'].includes(network)) throw new RuntimeError('invalid_network', 'Network must be mainnet or devnet.');+ if (mode === 'live' && !keystore.encrypted()) {+ throw new RuntimeError('keychain_unavailable', 'Live agents need the OS keychain to protect their signing key, and it is not available on this machine. Paper mode works without it.', 409);+ }const v = validateStrategyConfig({ ...strategy, network });if (!v.valid) throw new RuntimeError('invalid_strategy', v.errors.map((e) => `${e.field}: ${e.message}`).join(' '));const id = `ag_${randomUUID().slice(0, 12)}`;@@ -175,7 +178,7 @@ export function createRuntime({ stateStore, keystore, log, feed = createPumpFeedfunction publicApproval(ap) {return {id: ap.id, agent_id: ap.agent_id, status: effectiveStatus(ap), hash: ap.hash, payload: ap.payload,- table: confirmationTable(ap.row), text: confirmationText(ap.row), created_at: ap.created_at, expires_at: ap.expires_at, decided_at: ap.decided_at || null,+ row: ap.row, table: confirmationTable(ap.row), text: confirmationText(ap.row), created_at: ap.created_at, expires_at: ap.expires_at, decided_at: ap.decided_at || null,};}@@ -259,7 +262,7 @@ export function createRuntime({ stateStore, keystore, log, feed = createPumpFeed}async function executeBuy(agent, p, approval) {- const coin = await feed.coin(p.mint);+ const coin = await feed.coin(p.mint, { symbol: p.symbol });if (!coin) throw new RuntimeError('quote_unavailable', 'The launch feed has no data for this coin right now.', 502);const q = quoteBuy(coin, p.amount_sol);if (p.max_price_impact_pct != null && q.impact_pct > p.max_price_impact_pct) {@@ -282,7 +285,7 @@ export function createRuntime({ stateStore, keystore, log, feed = createPumpFeedasync function executeSell(agent, p, approval) {const pos = state.positions.find((x) => x.id === p.position_id && x.status === 'open');if (!pos) throw new RuntimeError('position_not_found', 'That position is not open.', 404);- const coin = await feed.coin(pos.mint);+ const coin = await feed.coin(pos.mint, { symbol: pos.symbol });if (!coin) throw new RuntimeError('quote_unavailable', 'The launch feed has no data for this coin right now.', 502);const q = quoteSell(coin, pos.tokens);let signature = null;@@ -310,10 +313,10 @@ export function createRuntime({ stateStore, keystore, log, feed = createPumpFeed});// ── scheduler ────────────────────────────────────────────────────────────- function buyPayload(agent, mint) {+ function buyPayload(agent, mint, symbol = null) {const c = agent.strategy;return {- kind: 'local_strategy_buy', agent_id: agent.id, strategy: c.name || 'local', network: agent.network, mint, side: 'buy',+ kind: 'local_strategy_buy', agent_id: agent.id, symbol, strategy: c.name || 'local', network: agent.network, mint, side: 'buy',amount_sol: c.sizing.amount_sol, slippage_bps: c.sizing.max_slippage_bps,max_price_impact_pct: effectivePriceImpactPct(c, null), idempotency_key: `${agent.id}:${mint}`,};@@ -332,15 +335,17 @@ export function createRuntime({ stateStore, keystore, log, feed = createPumpFeedif (seen.has(launch.mint)) continue;if (c.risk.cooldown_minutes > 0 && now() - agent.last_cooldown_at < c.risk.cooldown_minutes * 60000) break;const verdict = matchesEntry(c, launch, now());- seen.add(launch.mint);+ if (!verdict.pass) seen.add(launch.mint);decisions.push({ mint: launch.mint, pass: verdict.pass, reasons: verdict.reasons });if (!verdict.pass) continue;- const payload = buyPayload(agent, launch.mint);+ const payload = buyPayload(agent, launch.mint, launch.symbol);try {await act(agent, payload, buyRow(agent, payload, launch.symbol));+ seen.add(launch.mint);slots -= 1;} catch (err) {log.warn('entry_failed', { agent: agent.id, mint: launch.mint, err });+ if (err.code === 'quote_unavailable') break;}}state.seen[agent.id] = [...seen].slice(-500);@@ -350,7 +355,7 @@ export function createRuntime({ stateStore, keystore, log, feed = createPumpFeedasync function sweepExits(agent) {const open = state.positions.filter((p) => p.agent_id === agent.id && p.status === 'open');for (const pos of open) {- const coin = await feed.coin(pos.mint);+ const coin = await feed.coin(pos.mint, { symbol: pos.symbol });if (!coin) continue;const q = quoteSell(coin, pos.tokens);pos.peak_value_lamports = Math.max(pos.peak_value_lamports, q.lamports);@@ -376,7 +381,7 @@ export function createRuntime({ stateStore, keystore, log, feed = createPumpFeedagent.orders = agent.orders.filter((o) => o.id !== order.id);persist();if (order.side === 'buy') {- const payload = { ...buyPayload(agent, order.mint), amount_sol: order.amount_sol, kind: 'local_order_buy', idempotency_key: `${agent.id}:${order.id}` };+ const payload = { ...buyPayload(agent, order.mint, null), amount_sol: order.amount_sol, kind: 'local_order_buy', idempotency_key: `${agent.id}:${order.id}` };await act(agent, payload, buyRow(agent, payload, coin.symbol));} else {const pos = state.positions.find((x) => x.agent_id === agent.id && x.mint === order.mint && x.status === 'open');@@ -425,18 +430,19 @@ export function createRuntime({ stateStore, keystore, log, feed = createPumpFeed}let timer = null;- let ticking = false;- async function tick() {- if (ticking) return;- ticking = true;- try {+ let inflight = null;+ /** One pass over every agent. A pass already running is awaited, never doubled. */+ function tick() {+ if (inflight) return inflight;+ inflight = (async () => {for (const agent of Object.values(state.agents)) {if (agent.status === 'error') setStatus(agent, 'idle');await tickAgent(agent);}- } finally {- ticking = false;- }+ })().finally(() => {+ inflight = null;+ });+ return inflight;}function start({ intervalMs = 30_000 } = {}) {diff --git a/data/changelog.json b/data/changelog.jsonindex f5f9ae729..15879c7cc 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -29445,3 +29445,12 @@}]}+ },+ {+ "date": "2026-10-10",+ "title": "Run your agents on your own desktop",+ "summary": "The three.ws desktop app can now run agents, strategies, limit orders and automations on your machine. Signing keys stay in your operating system keychain, paper strategies keep working with no account or cloud connection, and every live trade waits for your approval in a native window that shows the exact recipient, amount, asset and chain. A tray menu lists each agent with pause, kill and review, and the mascot shows when an agent is working, waiting for you or in trouble.",+ "tags": [+ "feature"+ ],+ "link": "/docs/desktop-local-runtime"diff --git a/data/pages.json b/data/pages.jsonindex e39c14051..b448d236b 100644--- a/data/pages.json+++ b/data/pages.json@@ -3504,6 +3504,14 @@"changefreq": "monthly","added": "2026-09-02"},+ {+ "path": "/docs/desktop-local-runtime",+ "title": "Docs · Local agent runtime for the desktop app",+ "description": "Run agents, paper and live strategies, limit orders and automations on your own machine: keys in the OS keychain, native approvals with the same payload hash as the web flow, a tray menu, and a mascot that shows agent state.",+ "priority": 0.6,+ "changefreq": "monthly",+ "added": "2026-10-10"+ },{"path": "/docs/how-forge-works","title": "Docs · How the Forge works, in plain language",diff --git a/docs/desktop-local-runtime.md b/docs/desktop-local-runtime.mdnew file mode 100644index 000000000..3f89c629d--- /dev/null+++ b/docs/desktop-local-runtime.md@@ -0,0 +1,85 @@+# Local agent runtime (three.ws desktop app)++The desktop app can run your trading agents on your own machine. Signing keys+live in the operating system keychain and never leave it. Paper-mode strategies+keep running with no account and no cloud connection at all.++## What runs locally++- **Agents.** Each agent has a name, a mode (`paper` or `live`) and a strategy+ validated by the same schema the cloud uses (`apps/desktop/src/runtime/strategy-schema.js`).+- **Strategies.** The scheduler scans the pump.fun launch feed every minute,+ applies the entry rules, and manages exits (take profit, stop loss).+- **Orders.** Limit orders fire when a coin's price crosses `price_sol_below` or+ `price_sol_above`.+- **Automations.** Interval jobs (`sweep`, `expire_sweep`).+- **Receipts.** Every fill is recorded with the approval hash it ran under.++Prices come from the coin's bonding-curve account read over Solana RPC, so a+paper fill reflects real on-chain reserves (constant product, 1% fee). Nothing+in paper mode signs or sends.++## Keys and custody++Live agents get a keypair generated on your machine and stored in+`userData/runtime/keys.bin`, encrypted with Electron `safeStorage` (macOS+Keychain, Windows DPAPI, Linux Secret Service). If the OS reports that no+keychain is available, live agents are refused (`keychain_unavailable`); paper+agents still work. Keys are never logged: `runtime.log` is redacted (secret+fields, byte arrays, base58 keys, bearer tokens) and crash dumps stay on disk+(`crashReporter` has uploading off).++## Approvals++A live agent in `ask` mode files an approval instead of signing. The approval+shows the same four-row table as the web flow (Recipient, Amount, Asset, Chain)+and carries a sha256 of the canonical JSON of the action, byte-identical to+`api/_lib/approvals.js` (a test compares both implementations).++- The decision happens in a **native dialog** opened by the main process, from+ the tray or from the notification's Review action. The hash is held by the+ runtime and checked again at decide time, so what you approve is exactly what+ was shown. If the stored action changed, nothing runs (`payload_changed`).+- The renderer window can review or deny but has **no approve channel**.+- An approval expires after 15 minutes and runs nothing.+- Killing an agent denies its pending approvals.++## The tray and the mascot++The tray lists each agent with its status (idle, working, waiting for approval,+paused, error, killed) and offers Pause or Resume, Kill (with a confirmation)+and Review for pending approvals. The mascot is the agent's face: a ring around+it shows working, waiting (with a periodic wave) and error (with a jump). The+most urgent state across all agents wins.++## Security model++Context isolation is on, the renderer has no Node access, and every IPC channel+is an explicit allowlist in `src/console-preload.cjs`. Updates come from the+signed release feed configured in `electron-builder.config.cjs` (see+[the desktop release runbook](./ops/forge-desktop-release.md) for the signing+pattern; Companion signing certificates are an owner action).++## Run it headless++```bash+cd apps/desktop+npm install+npm run smoke:runtime+```++The smoke test starts the runtime in a temporary directory, creates a paper+agent, runs the scheduler against the live launch feed and Solana RPC, and+checks the fill, position, receipts, pause, kill and log redaction. It prints+`smoke passed` on success. Unit tests: `npx vitest run tests/desktop-runtime.test.js`.++## Live trades without the cloud++A live buy or sell needs an unsigned transaction. The runtime asks+`/api/pump/buy-prep` (or `sell-prep`) with your session token, signs locally,+sends through RPC, then reports `buy-confirm` or `sell-confirm`. So live mode+needs the cloud reachable for preparation; paper mode needs neither the cloud+nor an account. Syncing configuration and receipts to the cloud account is not+part of this release.++Related: [Companion](./companion.md), [approvals](./api-reference.md), `apps/desktop/README.md`.diff --git a/docs/start-here.md b/docs/start-here.mdindex 6954bb1d4..77d2f11b1 100644--- a/docs/start-here.md+++ b/docs/start-here.md@@ -84,6 +84,7 @@ Want the model in your hands rather than on a screen? [Materialize](./materializ- **Want your agent to perform, not just react?** → [Choreography](./choreography.md): compose gestures into a named routine on a real timeline at [/choreograph](https://three.ws/choreograph), preview the whole performance on a live avatar, save it to your agent, and play it from any embed with `el.playRoutine('welcome')`. A routine is also just a link, so you can share one with someone who has no account- **Want to drive it with your hands?** → [Sonar](./sonar.md): your speakers play a tone too high to hear and your microphone listens for how your hand bends it on the way back, so a sweep, a push or a lift moves a real 3D agent at [/sonar](https://three.ws/sonar) with the camera switched off. The sensing is two small modules you can point at anything- **Want your avatar to sign in ASL?** → Start with the 15-minute walkthrough, [Make your avatar sign](https://three.ws/tutorials/sign-with-your-avatar): type a phrase and watch it signed at [/sign-language](https://three.ws/sign-language), share it as a link (`?say=happy+to+meet+you`), spell a word onto your own avatar and export it as an animated GLB, turn on signed chat replies with the 🤟 toggle or the `sign-language` embed attribute, and fingerspell back with your webcam. The full reference is [Sign language](./sign-language.md)+- **Want agents that run on your own machine, with keys in the OS keychain?** → [Local agent runtime](./desktop-local-runtime.md): the desktop app runs paper and live strategies, limit orders and automations locally, with native approvals and a tray menu- **Want that character to tell you what actually matters?** → [The Companion](./companion.md): connect your own Telegram bot, calendar, inbox, or phone at [/companion](https://three.ws/companion), set the bar for what is worth interrupting you for, and a 3D character delivers it in person, wearing the avatar of whoever sent it. Also a desktop app, an SDK, a CLI, and an MCP server so your agents can reach you the same way- **Wondering who the little character in the corner is?** → [The agent shell](./agent-shell.md) — every visitor gets a named agent in the first five seconds (claim it to make it real), the ⌘K palette runs real commands (`forge …`, `digest`, `price btc`, `ask …`), and shell pages navigate without ever unloading your agent- **Want to drive your agent's computer yourself?** → [Take the wheel](./agent-screen-control.md), every agent has a live screen you can watch on [/agent-screen](https://three.ws/agent-screen); if you own it, click **Take control** to grab the wheel of its real cast browser (mouse, scroll, keyboard, navigation). The agent stands aside while you drive, and the browser holds no wallet, so control can never move fundsdiff --git a/tests/desktop-runtime.test.js b/tests/desktop-runtime.test.jsnew file mode 100644index 000000000..291eb6af6--- /dev/null+++ b/tests/desktop-runtime.test.js@@ -0,0 +1,238 @@+// Desktop local agent runtime: approval-hash parity with the cloud, the+// approval gate, key custody, log redaction and the paper scheduler.+// Fixtures are captured-shape pump.fun coin objects (reserves in base units).+// FakeSafeStorage stands in for Electron's safeStorage, which only exists+// inside the Electron process; its scrambling is enough to prove the key file+// is not stored in the clear.++import { describe, it, expect, beforeEach } from 'vitest';+import { mkdtempSync, readFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { Keypair } from '@solana/web3.js';+import * as cloud from '../api/_lib/approvals.js';+import { canonicalJson, payloadHash, confirmationTable, confirmationText } from '../apps/desktop/src/runtime/hash.js';+import { redact, createLogger } from '../apps/desktop/src/runtime/log.js';+import { createSecureStore } from '../apps/desktop/src/main/secure-store.js';+import { createKeystore } from '../apps/desktop/src/runtime/keystore.js';+import { createRuntime, RuntimeError } from '../apps/desktop/src/runtime/runtime.js';+import { quoteBuy, quoteSell } from '../apps/desktop/src/runtime/curve.js';+import { bondingCurveAddress, parseBondingCurve } from '../apps/desktop/src/runtime/feed.js';++const MINT = '5a4w3tawg8y595D8pXzLrZqTnUZ5xT7e2m1q8VhJpump';+const FIXTURE_COIN = { mint: MINT, symbol: 'FIX', virtual_sol_reserves: 30_000_000_000, virtual_token_reserves: 1_073_000_000_000_000 };+const NOW = 1_800_000_000_000;++const fakeSafeStorage = {+ isEncryptionAvailable: () => true,+ encryptString: (s) => Buffer.from([...Buffer.from(s)].map((b) => b ^ 0x5a)),+ decryptString: (buf) => Buffer.from([...buf].map((b) => b ^ 0x5a)).toString(),+};++describe('approval hash parity with the cloud', () => {+ const corpus = [+ { b: 1, a: [3, { z: null, y: undefined, x: 'é' }], c: { d: 0.1, e: false } },+ { kind: 'strategy_buy', amount_sol: 0.05, max_price_impact_pct: null, mint: MINT },+ [], {}, 'str', 7, null,+ ];+ it('canonicalJson and payloadHash match api/_lib/approvals.js', () => {+ for (const v of corpus) {+ expect(canonicalJson(v)).toBe(cloud.canonicalJson(v));+ expect(payloadHash(v)).toBe(cloud.payloadHash(v));+ }+ });+ it('the confirmation table matches the cloud table', () => {+ const row = { recipient: MINT, recipient_label: '$FIX', amount: 0.05, asset: 'SOL', chain: 'solana', network: 'devnet' };+ expect(confirmationTable(row)).toEqual(cloud.confirmationTable(row));+ expect(confirmationText(row)).toBe(cloud.confirmationText(row));+ });+ it('the vendored strategy schema matches the cloud copy apart from dash punctuation', () => {+ const squash = (u) => readFileSync(new URL(u, import.meta.url), 'utf8').replace(/[\s\u2014:\-]/g, '');+ expect(squash('../apps/desktop/src/runtime/strategy-schema.js')).toBe(squash('../api/_lib/strategy-schema.js'));+ });+});++describe('log redaction', () => {+ it('masks secret fields, key bytes, base58 keys and bearer tokens', () => {+ const kp = Keypair.generate();+ const out = JSON.stringify(redact({+ secret: 'x', privateKey: 'y', note: 'Bearer abcdefghijklmnop1234', keyBytes: Array.from(kp.secretKey),+ nested: { token: 't', ok: 'fine' }, err: new Error('failed with Bearer abcdefghijklmnop1234'),+ }));+ expect(out).not.toContain('abcdefghijklmnop1234');+ expect(out).not.toContain(String(kp.secretKey[0]) + ',' + String(kp.secretKey[1]) + ',');+ expect(out).toContain('fine');+ });+ it('never writes a key to the log file', () => {+ const dir = mkdtempSync(join(tmpdir(), 'rt-log-'));+ const log = createLogger({ file: join(dir, 'l.log') });+ const kp = Keypair.generate();+ log.error('boom', { secretKey: Array.from(kp.secretKey), err: new Error('x') });+ const text = readFileSync(join(dir, 'l.log'), 'utf8');+ expect(text).toContain('[redacted]');+ expect(text).not.toContain(`${kp.secretKey[0]},${kp.secretKey[1]},${kp.secretKey[2]}`);+ });+});++describe('keystore custody', () => {+ it('keeps the key only in the encrypted key file and signs without exposing it', () => {+ const dir = mkdtempSync(join(tmpdir(), 'rt-keys-'));+ const store = createSecureStore({ file: join(dir, 'keys.bin'), safeStorage: fakeSafeStorage });+ const ks = createKeystore({ store });+ const { address, created } = ks.create('ag_1');+ expect(created).toBe(true);+ expect(ks.create('ag_1')).toEqual({ address, created: false });+ const raw = readFileSync(join(dir, 'keys.bin'), 'utf8');+ expect(raw.startsWith('tws1:')).toBe(true);+ expect(raw).not.toContain('secret');+ expect(ks.list()).toEqual([{ agentId: 'ag_1', address }]);+ expect(() => ks.signTransaction('missing', 'AA==')).toThrow(/no signing key/);+ expect(ks.remove('ag_1')).toBe(true);+ expect(ks.address('ag_1')).toBeNull();+ });+});++describe('bonding curve maths and parsing', () => {+ it('prices a buy with impact and a sell below the buy cost', () => {+ const q = quoteBuy(FIXTURE_COIN, 1);+ expect(q.tokens).toBeGreaterThan(0);+ expect(q.impact_pct).toBeGreaterThan(0);+ const back = quoteSell(FIXTURE_COIN, q.tokens);+ expect(back.lamports).toBeLessThan(1e9);+ });+ it('reads a bonding curve account and derives its address', () => {+ const buf = Buffer.alloc(49);+ buf.writeBigUInt64LE(1073000000000000n, 8);+ buf.writeBigUInt64LE(30000000000n, 16);+ buf.writeBigUInt64LE(793100000000000n, 24);+ buf.writeBigUInt64LE(0n, 32);+ const c = parseBondingCurve(buf);+ expect(c.virtual_sol_reserves).toBe(30000000000);+ expect(c.complete).toBe(false);+ expect(bondingCurveAddress(MINT)).toMatch(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/);+ });+});++function build({ mode = 'live', strategy = {}, coin = FIXTURE_COIN, launches } = {}) {+ const dir = mkdtempSync(join(tmpdir(), 'rt-run-'));+ let clock = NOW;+ const calls = { buy: [], sell: [] };+ const events = [];+ const keystore = createKeystore({ store: createSecureStore({ file: join(dir, 'keys.bin'), safeStorage: fakeSafeStorage }) });+ const feed = {+ launches: async () => launches ?? [{ mint: MINT, symbol: 'FIX', created_at: clock - 60_000, market_cap_usd: 9000, liquidity_sol: 3, twitter: 'x', is_usdc_pair: false, graduated: false }],+ coin: async () => coin,+ };+ const live = { buy: async (a) => { calls.buy.push(a); return 'sig-buy'; }, sell: async (a) => { calls.sell.push(a); return 'sig-sell'; } };+ const stateStore = createSecureStore({ file: join(dir, 'state.bin'), safeStorage: null });+ const runtime = createRuntime({ stateStore, keystore, log: createLogger({}), feed, live, onEvent: (e) => events.push(e), now: () => clock });+ const agent = runtime.createAgent({ name: 'a', mode, strategy: { entry: { max_age_minutes: 120 }, exits: { take_profit_pct: 50, stop_loss_pct: 30 }, ...strategy } });+ return { runtime, agent, calls, events, dir, advance: (ms) => { clock += ms; }, setCoin: (c) => { coin = c; } };+}++describe('approval gate (live agent, ask mode)', () => {+ let ctx;+ beforeEach(async () => {+ ctx = build();+ await ctx.runtime.tick();+ });++ it('files an approval and signs nothing until approved', () => {+ const [ap] = ctx.runtime.listApprovals({ status: 'pending' });+ expect(ap).toBeTruthy();+ expect(ctx.calls.buy).toHaveLength(0);+ expect(ctx.runtime.getAgent(ctx.agent.id).status).toBe('waiting_approval');+ expect(ap.hash).toBe(cloud.payloadHash(ap.payload));+ expect(ap.table.map((r) => r.key)).toEqual(['recipient', 'amount', 'asset', 'chain']);+ expect(ctx.events.some((e) => e.type === 'approval' && e.notify)).toBe(true);+ });++ it('rejects a wrong or missing hash and runs nothing', async () => {+ const [ap] = ctx.runtime.listApprovals({ status: 'pending' });+ await expect(ctx.runtime.decide(ap.id, { decision: 'approve', hash: 'f'.repeat(64) })).rejects.toMatchObject({ code: 'hash_mismatch', status: 409 });+ await expect(ctx.runtime.decide(ap.id, { decision: 'approve' })).rejects.toMatchObject({ code: 'hash_mismatch' });+ expect(ctx.calls.buy).toHaveLength(0);+ });++ it('rejects an approval whose stored action changed after it was shown', async () => {+ const [ap] = ctx.runtime.listApprovals({ status: 'pending' });+ const shownHash = ap.hash;+ ap.payload.amount_sol = 99;+ await expect(ctx.runtime.decide(ap.id, { decision: 'approve', hash: shownHash })).rejects.toMatchObject({ code: 'payload_changed', status: 409 });+ expect(ctx.calls.buy).toHaveLength(0);+ });++ it('executes exactly once with the right hash and records the hash on the receipt', async () => {+ const [ap] = ctx.runtime.listApprovals({ status: 'pending' });+ const done = await ctx.runtime.decide(ap.id, { decision: 'approve', hash: ap.hash.toUpperCase() });+ expect(done.status).toBe('executed');+ expect(ctx.calls.buy).toHaveLength(1);+ const [receipt] = ctx.runtime.receipts({ agentId: ctx.agent.id });+ expect(receipt).toMatchObject({ kind: 'buy', mode: 'live', signature: 'sig-buy', payload_hash: ap.hash });+ await expect(ctx.runtime.decide(ap.id, { decision: 'approve', hash: ap.hash })).rejects.toMatchObject({ code: 'approval_not_pending' });+ expect(ctx.calls.buy).toHaveLength(1);+ });++ it('expires after fifteen minutes and runs nothing', async () => {+ const [ap] = ctx.runtime.listApprovals({ status: 'pending' });+ ctx.advance(16 * 60_000);+ await expect(ctx.runtime.decide(ap.id, { decision: 'approve', hash: ap.hash })).rejects.toMatchObject({ code: 'approval_expired' });+ expect(ctx.calls.buy).toHaveLength(0);+ });++ it('deny and kill both leave nothing signed', async () => {+ const [ap] = ctx.runtime.listApprovals({ status: 'pending' });+ const denied = await ctx.runtime.decide(ap.id, { decision: 'deny', hash: ap.hash });+ expect(denied.status).toBe('denied');+ ctx.runtime.kill(ctx.agent.id);+ expect(ctx.runtime.getAgent(ctx.agent.id).status).toBe('killed');+ expect(ctx.calls.buy).toHaveLength(0);+ await expect(ctx.runtime.tick()).resolves.toBeUndefined();+ expect(ctx.runtime.getAgent(ctx.agent.id).status).toBe('killed');+ });+});++describe('paper agent and scheduler', () => {+ it('fills from reserves with no approval, then exits on take profit', async () => {+ const ctx = build({ mode: 'paper' });+ await ctx.runtime.tick();+ expect(ctx.runtime.listApprovals()).toHaveLength(0);+ const open = ctx.runtime.positions({ agentId: ctx.agent.id });+ expect(open).toHaveLength(1);+ expect(ctx.calls.buy).toHaveLength(0);+ ctx.setCoin({ ...FIXTURE_COIN, virtual_sol_reserves: FIXTURE_COIN.virtual_sol_reserves * 3 });+ await ctx.runtime.tick();+ expect(ctx.runtime.positions({ agentId: ctx.agent.id })[0].status).toBe('closed');+ const kinds = ctx.runtime.receipts({ agentId: ctx.agent.id }).map((r) => r.kind);+ expect(kinds).toEqual(['sell', 'buy']);+ });++ it('pause holds the agent and the mascot face reports the most urgent state', async () => {+ const ctx = build({ mode: 'paper' });+ ctx.runtime.pause(ctx.agent.id);+ expect(ctx.runtime.face().state).toBe('paused');+ await ctx.runtime.tick();+ expect(ctx.runtime.positions()).toHaveLength(0);+ ctx.runtime.resume(ctx.agent.id);+ expect(ctx.runtime.face().state).toBe('idle');+ const live = build();+ await live.runtime.tick();+ expect(live.runtime.face().state).toBe('waiting_approval');+ });++ it('limit orders fire on price and validate input', async () => {+ const ctx = build({ mode: 'paper', launches: [] });+ expect(() => ctx.runtime.addOrder(ctx.agent.id, { mint: MINT, side: 'buy', amount_sol: 0.05, trigger: {} })).toThrow(RuntimeError);+ ctx.runtime.addOrder(ctx.agent.id, { mint: MINT, side: 'buy', amount_sol: 0.05, trigger: { price_sol_above: 1e-9 } });+ await ctx.runtime.tick();+ expect(ctx.runtime.getAgent(ctx.agent.id).orders).toHaveLength(0);+ expect(ctx.runtime.positions()).toHaveLength(1);+ });++ it('refuses a live agent when the keychain is unavailable', () => {+ const dir = mkdtempSync(join(tmpdir(), 'rt-nokc-'));+ const keystore = createKeystore({ store: createSecureStore({ file: join(dir, 'keys.bin'), safeStorage: null }) });+ const runtime = createRuntime({ stateStore: createSecureStore({ file: join(dir, 's.bin'), safeStorage: null }), keystore, log: createLogger({}), feed: { launches: async () => [], coin: async () => null } });+ expect(() => runtime.createAgent({ name: 'x', mode: 'live', strategy: { exits: { take_profit_pct: 50, stop_loss_pct: 30 } } })).toThrow(/keychain/i);+ });+});