bloby-bot 0.46.0 → 0.46.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli.js CHANGED
@@ -5,7 +5,7 @@ import fs from 'fs';
5
5
  import path from 'path';
6
6
  import os from 'os';
7
7
  import readline from 'readline';
8
- import { fileURLToPath } from 'url';
8
+ import { fileURLToPath, pathToFileURL } from 'url';
9
9
 
10
10
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
11
 
@@ -2010,6 +2010,40 @@ async function passwordReset() {
2010
2010
  // body to stdout (and the Payment-Receipt / X-PAYMENT-RESPONSE header to
2011
2011
  // stderr) so it composes with shell pipelines like curl.
2012
2012
 
2013
+ // x402-fetch pulls in ~520 MB of browser-wallet SDKs (WalletConnect, MetaMask,
2014
+ // Coinbase, Reown, Solana, etc.) that we never use. Installing it as a regular
2015
+ // dep OOMs t4g.small (2 GB) during npm install. So we lazy-install on first
2016
+ // `bloby x402` use into an isolated tools dir.
2017
+ async function ensureX402Module() {
2018
+ // Already installed in the main tree? (dev convenience)
2019
+ try { return await import('x402-fetch'); } catch {}
2020
+
2021
+ const toolsDir = path.join(DATA_DIR, '.x402-tools');
2022
+ const installed = path.join(toolsDir, 'node_modules', 'x402-fetch', 'dist', 'esm', 'index.mjs');
2023
+
2024
+ if (!fs.existsSync(installed)) {
2025
+ console.log(` ${c.dim}Installing x402-fetch (one-time, ~30s)…${c.reset}`);
2026
+ fs.mkdirSync(toolsDir, { recursive: true });
2027
+ const toolsPkg = path.join(toolsDir, 'package.json');
2028
+ if (!fs.existsSync(toolsPkg)) {
2029
+ fs.writeFileSync(toolsPkg, JSON.stringify({
2030
+ name: 'bloby-x402-tools', private: true, version: '0.0.0',
2031
+ }, null, 2));
2032
+ }
2033
+ try {
2034
+ execSync(
2035
+ 'npm install --omit=dev --no-audit --no-fund --no-progress --prefer-offline --loglevel=error x402-fetch@^1.2.0',
2036
+ { cwd: toolsDir, stdio: 'inherit' },
2037
+ );
2038
+ } catch {
2039
+ console.error(` ${c.red}✗${c.reset} Failed to install x402-fetch. Check network and retry.`);
2040
+ process.exit(1);
2041
+ }
2042
+ }
2043
+
2044
+ return import(pathToFileURL(installed).href);
2045
+ }
2046
+
2013
2047
  async function x402Pay(rest) {
2014
2048
  if (!rest.length || rest.includes('-h') || rest.includes('--help')) {
2015
2049
  console.log(`
@@ -2026,6 +2060,8 @@ async function x402Pay(rest) {
2026
2060
  Example:
2027
2061
  bloby x402 https://bloby.bot/api/marketplace/buy-base/<id> \\
2028
2062
  -X POST -H "X-Bloby-Token: $RELAY_TOKEN"
2063
+
2064
+ First-call note: installs x402-fetch on demand (~30s, one-time).
2029
2065
  `);
2030
2066
  process.exit(rest.length ? 0 : 1);
2031
2067
  }
@@ -2059,7 +2095,7 @@ async function x402Pay(rest) {
2059
2095
  const { createWalletClient, http } = await import('viem');
2060
2096
  const { privateKeyToAccount } = await import('viem/accounts');
2061
2097
  const { base } = await import('viem/chains');
2062
- const { wrapFetchWithPayment, decodeXPaymentResponse } = await import('x402-fetch');
2098
+ const { wrapFetchWithPayment, decodeXPaymentResponse } = await ensureX402Module();
2063
2099
 
2064
2100
  const pk = cfg.wallet.privateKey.startsWith('0x') ? cfg.wallet.privateKey : `0x${cfg.wallet.privateKey}`;
2065
2101
  const account = privateKeyToAccount(pk);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bloby-bot",
3
- "version": "0.46.0",
3
+ "version": "0.46.1",
4
4
  "releaseNotes": [
5
5
  "1. # voice note (PTT bubble)",
6
6
  "2. # audio file + caption",
@@ -52,9 +52,9 @@
52
52
  "dev:docs": "cd ./docs && npx fumapress"
53
53
  },
54
54
  "dependencies": {
55
- "@anthropic-ai/claude-agent-sdk": "^0.2.112",
55
+ "@anthropic-ai/claude-agent-sdk": "^0.2.138",
56
56
  "@clack/prompts": "^1.1.0",
57
- "@openai/codex": "^0.128.0",
57
+ "@openai/codex": "^0.130.0",
58
58
  "@streamdown/code": "^1.1.1",
59
59
  "@tailwindcss/vite": "^4.2.0",
60
60
  "@vitejs/plugin-react": "^6.0.1",
@@ -87,7 +87,6 @@
87
87
  "vite": "^8.0.3",
88
88
  "web-push": "^3.6.7",
89
89
  "ws": "^8.19.0",
90
- "x402-fetch": "^1.2.0",
91
90
  "zustand": "^5.0.11"
92
91
  },
93
92
  "devDependencies": {
@@ -422,10 +422,11 @@ export async function startConversation(
422
422
  summary: sysMsg.summary,
423
423
  usage: sysMsg.usage,
424
424
  });
425
- // Sub-agent completion may have written files
426
- if (sysMsg.status === 'completed') {
427
- onMessage('bot:turn-complete', { conversationId, usedFileTools: true });
428
- }
425
+ // Don't emit bot:turn-complete here. Sub-agent completion is a progress
426
+ // signal, not a turn boundary — the parent agent will continue, and its
427
+ // real `result` event (above) is the only true turn end. The parent's
428
+ // `usedTools` Set already captures sub-agent tool_use blocks, so file
429
+ // edits made inside a sub-agent are still reflected in usedFileTools.
429
430
  }
430
431
  break;
431
432
  }
@@ -46,29 +46,17 @@
46
46
  </script>
47
47
  <script type="module" src="/src/main.tsx"></script>
48
48
  <script>
49
+ // Register the SW but DO NOT auto-reload on controllerchange.
50
+ // The old pattern (skipWaiting + claim + controllerchange → location.reload)
51
+ // caused surprise reloads on mobile PWAs: iOS aggressively re-checks sw.js
52
+ // and any byte-level variation in the response (esp. via Vite dev) trips a
53
+ // new SW activation → controllerchange → unwanted reload. The new SW
54
+ // silently takes over for future fetches; the user gets the new build on
55
+ // their next natural refresh.
49
56
  if('serviceWorker' in navigator && location.port !== '5173'){
50
- var swRefreshing=false;
51
- navigator.serviceWorker.addEventListener('controllerchange',function(){
52
- if(swRefreshing)return;
53
- swRefreshing=true;
54
- var s=document.getElementById('splash');
55
- if(s){s.style.transition='none';s.style.display='block';s.style.opacity='1'}
56
- location.reload();
57
+ navigator.serviceWorker.register('/sw.js').catch(function(err){
58
+ console.error('[sw-reg] registration failed:', err);
57
59
  });
58
- navigator.serviceWorker.register('/sw.js').then(function(r){
59
- r.update();
60
- if(r.waiting){
61
- r.waiting.postMessage({type:'SKIP_WAITING'});
62
- }
63
- r.addEventListener('updatefound',function(){
64
- var w=r.installing;
65
- if(w)w.addEventListener('statechange',function(){
66
- if(w.state==='installed'&&navigator.serviceWorker.controller){
67
- w.postMessage({type:'SKIP_WAITING'});
68
- }
69
- });
70
- });
71
- }).catch(function(err){ console.error('[sw-reg] registration failed:', err); });
72
60
  }
73
61
  </script>
74
62
  <script src="/bloby/widget.js"></script>