openzoo 0.50.50 → 0.50.52
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/lib/cursorbackend.js +12 -4
- package/lib/grokbotAccount.js +25 -0
- package/lib/ozSpendChip.js +13 -8
- package/package.json +1 -1
package/lib/cursorbackend.js
CHANGED
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
accountPodPath, accountAgentsPath, rosterForAccount, rosterForEvent,
|
|
42
42
|
readHouseRoster, houseAgentsPath, shapeAgent, agentBrief, briefFromName,
|
|
43
43
|
readWakeups, writeWakeups, shapeWakeup, parseWakeupEvery, wantsWakeupCron,
|
|
44
|
-
DEFAULT_WAKEUP_PROMPT,
|
|
44
|
+
DEFAULT_WAKEUP_PROMPT, addDeletedIds, filterDeleted,
|
|
45
45
|
} from './grokbotAccount.js';
|
|
46
46
|
import { formatSpendFooter, mergeTurnProof } from './spendProof.js';
|
|
47
47
|
import { prefixVisitorRichText } from './grokbotweb.js';
|
|
@@ -363,7 +363,7 @@ function useHouseRoster() {
|
|
|
363
363
|
return Boolean(process.env.OZ_HIJACK_POD) && !sniffOn();
|
|
364
364
|
}
|
|
365
365
|
function loadAgents() {
|
|
366
|
-
const house = readHouseRoster(HOME, activeAccountId) || [];
|
|
366
|
+
const house = filterDeleted(readHouseRoster(HOME, activeAccountId) || [], HOME);
|
|
367
367
|
const shaped = house.map(shapeAgent);
|
|
368
368
|
const dirty = shaped.some((a, i) => a.brief && a.brief !== String(house[i]?.brief || house[i]?.description || ''));
|
|
369
369
|
if (dirty && shaped.length) {
|
|
@@ -1264,6 +1264,10 @@ async function fireAgentWakeup(agentId) {
|
|
|
1264
1264
|
wakeupLog(`cursor-backend: wakeup skip busy agent=${id}`);
|
|
1265
1265
|
return;
|
|
1266
1266
|
}
|
|
1267
|
+
if (focusedAgentId && String(focusedAgentId) === id) {
|
|
1268
|
+
wakeupLog(`cursor-backend: wakeup skip focused agent=${id}`);
|
|
1269
|
+
return;
|
|
1270
|
+
}
|
|
1267
1271
|
const nonce = `oz-wakeup-${id}-${rec.lastAt}`;
|
|
1268
1272
|
const prompt = rec.prompt || DEFAULT_WAKEUP_PROMPT;
|
|
1269
1273
|
const turn = zooTurns.begin(id, nonce);
|
|
@@ -1536,7 +1540,7 @@ function mergeAgentLists(remote) {
|
|
|
1536
1540
|
seen.add(a.id);
|
|
1537
1541
|
out.push(stampActivity(a));
|
|
1538
1542
|
}
|
|
1539
|
-
return sortAgentsByActivity(out);
|
|
1543
|
+
return sortAgentsByActivity(filterDeleted(out, HOME));
|
|
1540
1544
|
}
|
|
1541
1545
|
function gatewayEntry(e) {
|
|
1542
1546
|
const { seq, pulledRemote, promptRaw, ephemeral, ...rest } = e;
|
|
@@ -2908,8 +2912,12 @@ async function handleHijackedPodHttp(req, res, full, body, log) {
|
|
|
2908
2912
|
try { parsed = JSON.parse(String(body || '{}')); } catch { parsed = {}; }
|
|
2909
2913
|
const ids = new Set([].concat(parsed.ids || parsed.id || []).map(String));
|
|
2910
2914
|
const next = (cachedAgentList() || []).filter((a) => !ids.has(a.id));
|
|
2915
|
+
addDeletedIds(HOME, [...ids]);
|
|
2911
2916
|
saveAgents(next);
|
|
2912
|
-
for (const id of ids)
|
|
2917
|
+
for (const id of ids) {
|
|
2918
|
+
transcripts.delete(id);
|
|
2919
|
+
try { cancelAgentWakeup(id); } catch { /* */ }
|
|
2920
|
+
}
|
|
2913
2921
|
jsonSend(res, { ok: true, deleted: [...ids] });
|
|
2914
2922
|
log(`cursor-backend: deleteAgents n=${ids.size}`);
|
|
2915
2923
|
return true;
|
package/lib/grokbotAccount.js
CHANGED
|
@@ -244,6 +244,31 @@ export function readWakeups(home) {
|
|
|
244
244
|
return out;
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
+
export function deletedAgentsPath(home) {
|
|
248
|
+
return path.join(home, '.openzoo', 'grokbot-deleted.json');
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export function readDeletedIds(home) {
|
|
252
|
+
const raw = readJsonFile(deletedAgentsPath(home));
|
|
253
|
+
const ids = Array.isArray(raw) ? raw : (raw && Array.isArray(raw.ids) ? raw.ids : []);
|
|
254
|
+
return new Set(ids.map(String).filter(Boolean));
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export function addDeletedIds(home, ids) {
|
|
258
|
+
const s = readDeletedIds(home);
|
|
259
|
+
for (const id of ids) if (id) s.add(String(id));
|
|
260
|
+
const dir = path.dirname(deletedAgentsPath(home));
|
|
261
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
262
|
+
fs.writeFileSync(deletedAgentsPath(home), JSON.stringify([...s], null, 2));
|
|
263
|
+
return s;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export function filterDeleted(agents, home) {
|
|
267
|
+
const del = readDeletedIds(home);
|
|
268
|
+
if (!del.size || !Array.isArray(agents)) return agents || [];
|
|
269
|
+
return agents.filter((a) => a && !del.has(String(a.id)));
|
|
270
|
+
}
|
|
271
|
+
|
|
247
272
|
export function writeWakeups(home, map) {
|
|
248
273
|
const dir = path.dirname(wakeupsPath(home));
|
|
249
274
|
fs.mkdirSync(dir, { recursive: true });
|
package/lib/ozSpendChip.js
CHANGED
|
@@ -363,24 +363,29 @@ function ozPlaceFloat(el) {
|
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
function ozWatchSpend() {
|
|
366
|
-
|
|
366
|
+
let t = 0;
|
|
367
|
+
const run = () => {
|
|
368
|
+
const a = document.activeElement;
|
|
369
|
+
if (a && (a.tagName === 'TEXTAREA' || a.tagName === 'INPUT' || a.isContentEditable)) return;
|
|
370
|
+
try { ozCollapseSpend(); } catch (e) {}
|
|
371
|
+
};
|
|
372
|
+
const debounced = () => { clearTimeout(t); t = setTimeout(run, 600); };
|
|
367
373
|
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run);
|
|
368
374
|
else run();
|
|
369
375
|
try {
|
|
370
|
-
const mo = new MutationObserver(
|
|
371
|
-
const start = () => { if (document.body) mo.observe(document.body, { childList: true, subtree:
|
|
376
|
+
const mo = new MutationObserver(debounced);
|
|
377
|
+
const start = () => { if (document.body) mo.observe(document.body, { childList: true, subtree: false }); };
|
|
372
378
|
if (document.body) start();
|
|
373
379
|
else document.addEventListener('DOMContentLoaded', start);
|
|
374
|
-
} catch {
|
|
375
|
-
|
|
376
|
-
try { window.addEventListener('resize', run); } catch (e) {}
|
|
380
|
+
} catch (e) {}
|
|
381
|
+
try { window.addEventListener('resize', debounced); } catch (e) {}
|
|
377
382
|
}
|
|
378
383
|
|
|
379
384
|
export function spendChipSource() {
|
|
380
385
|
return [
|
|
381
386
|
'(function ozSpendChip(){',
|
|
382
387
|
"'use strict';",
|
|
383
|
-
'if (window.__OZ_SPEND_CHIP__ ===
|
|
388
|
+
'if (window.__OZ_SPEND_CHIP__ === 11) {',
|
|
384
389
|
' const el = document.getElementById("oz-spend-float");',
|
|
385
390
|
' const ta = document.querySelector("textarea, [contenteditable=\\"true\\"]");',
|
|
386
391
|
' const box = ta && ta.getBoundingClientRect();',
|
|
@@ -393,7 +398,7 @@ export function spendChipSource() {
|
|
|
393
398
|
' }',
|
|
394
399
|
' return;',
|
|
395
400
|
'}',
|
|
396
|
-
'window.__OZ_SPEND_CHIP__ =
|
|
401
|
+
'window.__OZ_SPEND_CHIP__ = 11;',
|
|
397
402
|
chipUsd.toString(),
|
|
398
403
|
labelFromSpendBody.toString(),
|
|
399
404
|
spendLinesOnly.toString(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openzoo",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.52",
|
|
4
4
|
"description": "Local x402-paying proxy + MCP server for openzoo.fun — point any OpenAI-compatible harness (Cursor, Claude Code, aider, SDKs) at localhost and it pays per call from a local burner wallet. Solana and Base rails live; Robinhood experimental.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|