openzoo 0.50.43 → 0.50.45

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.
@@ -39,7 +39,7 @@ import { randomUUID } from 'node:crypto';
39
39
  import { encodeAvailableModels, encodeForMethod, encodeEnsureSandBox, encodeGetGrokBotSendStatus, decodeProtoFields, unwrapConnect } from './cursorapi.js';
40
40
  import {
41
41
  accountPodPath, accountAgentsPath, rosterForAccount, rosterForEvent,
42
- readHouseRoster, houseAgentsPath, shapeAgent, agentBrief,
42
+ readHouseRoster, houseAgentsPath, shapeAgent, agentBrief, briefFromName,
43
43
  } from './grokbotAccount.js';
44
44
  import { formatSpendFooter, mergeTurnProof } from './spendProof.js';
45
45
  import { prefixVisitorRichText } from './grokbotweb.js';
@@ -361,8 +361,18 @@ function useHouseRoster() {
361
361
  return Boolean(process.env.OZ_HIJACK_POD) && !sniffOn();
362
362
  }
363
363
  function loadAgents() {
364
- const house = readHouseRoster(HOME, activeAccountId);
365
- return house.length ? house : [];
364
+ const house = readHouseRoster(HOME, activeAccountId) || [];
365
+ const shaped = house.map(shapeAgent);
366
+ const dirty = shaped.some((a, i) => a.brief && a.brief !== String(house[i]?.brief || house[i]?.description || ''));
367
+ if (dirty && shaped.length) {
368
+ writeJsonFile(houseAgentsPath(HOME), shaped);
369
+ if (activeAccountId) {
370
+ const p = accountAgentsPath(HOME, activeAccountId);
371
+ if (p) writeJsonFile(p, shaped);
372
+ }
373
+ }
374
+ for (const a of shaped) seedBriefOnCanvas(a);
375
+ return shaped;
366
376
  }
367
377
  function saveAgents(a) {
368
378
  if (!Array.isArray(a)) return;
@@ -1251,8 +1261,18 @@ function mintLocalAgent(parsed = {}) {
1251
1261
  }
1252
1262
  saveAgents(list.map(shapeAgent));
1253
1263
  agentTranscript(id);
1264
+ seedBriefOnCanvas(agent);
1254
1265
  return agent;
1255
1266
  }
1267
+ function seedBriefOnCanvas(agent) {
1268
+ if (!agent?.id || !String(agent.brief || '').trim()) return false;
1269
+ const t = agentTranscript(agent.id);
1270
+ if ((t.entries || []).length) return false;
1271
+ const nonce = `oz-brief-${agent.id}`;
1272
+ fanoutLine(agent.id, 'user', `[brief]\n${agent.brief}`, { clientNonce: nonce, requestId: nonce });
1273
+ fanoutLine(agent.id, 'assistant', `Understood. I am ${agent.name}. Working from this brief.`, { clientNonce: nonce, requestId: nonce });
1274
+ return true;
1275
+ }
1256
1276
  function groupMemberIds(agentId) {
1257
1277
  const a = (cachedAgentList() || []).find((x) => x.id === agentId);
1258
1278
  if (!a?.isGroup) return [];
@@ -1624,7 +1644,7 @@ function resolveModelId(raw) {
1624
1644
  function currentModel(agentId) {
1625
1645
  return agentModels.get(agentId)
1626
1646
  || process.env.OPENZOO_DEFAULT_MODEL
1627
- || 'zai-org/glm-5.3-flash';
1647
+ || 'x-ai/grok-4.6';
1628
1648
  }
1629
1649
 
1630
1650
  const execFileAsync = promisify(execFile);
@@ -2078,12 +2098,12 @@ async function runLocalTool(name, args, log, ctx = {}) {
2078
2098
  return JSON.stringify(got);
2079
2099
  }
2080
2100
  if (name === 'create_agent') {
2081
- const agent = mintLocalAgent({
2082
- name: String(args.name || args.title || 'New Bot').slice(0, 80),
2083
- brief: String(args.brief || args.instructions || ''),
2084
- });
2101
+ const name = String(args.name || args.title || 'New Bot').slice(0, 80);
2102
+ const brief = String(args.brief || args.instructions || '').trim() || briefFromName(name);
2103
+ const agent = mintLocalAgent({ name, brief });
2085
2104
  pushCreatedAgent(agent, { select: args.select !== false });
2086
- log(`cursor-backend: create_agent tool id=${agent.id} name=${JSON.stringify(agent.name)}`);
2105
+ seedBriefOnCanvas(agent);
2106
+ log(`cursor-backend: create_agent tool id=${agent.id} name=${JSON.stringify(agent.name)} brief=${brief ? brief.length : 0}c`);
2087
2107
  return JSON.stringify({ ok: true, id: agent.id, name: agent.name, brief: agent.brief || '' });
2088
2108
  }
2089
2109
  if (name === 'set_brief') {
@@ -111,6 +111,15 @@ function activityTs(agent, activity) {
111
111
  * nulls, then clears the whole persisted tray. That is how a group vanished
112
112
  * after the first send: bumpAgent wrote a partial row, restore returned null.
113
113
  */
114
+ /** Standing job from a sidebar name like "6 · Content Studio" or "Bot 1 — Marketing (X)". */
115
+ export function briefFromName(name) {
116
+ const n = String(name || '').trim();
117
+ if (!n || /^(new bot|chat|group)$/i.test(n)) return '';
118
+ const role = n.replace(/^\d+\s*[·.•.\-—–]+\s*/, '').trim() || n;
119
+ if (role.length < 2) return '';
120
+ return `You are ${n}. Your job is ${role}. Do that job. Do not ask the human to re-brief you. Coordinate with list_agents and message_agent.`;
121
+ }
122
+
114
123
  /** Standing job text. shapeAgent used to drop this, so every restart was amnesia. */
115
124
  export function agentBrief(raw = {}) {
116
125
  const a = raw && typeof raw === 'object' ? raw : {};
@@ -119,7 +128,8 @@ export function agentBrief(raw = {}) {
119
128
  if (typeof v === 'string' && v.trim()) return v.trim().slice(0, 8000);
120
129
  }
121
130
  const d = String(a.description || '').trim();
122
- return d.slice(0, 8000);
131
+ if (d) return d.slice(0, 8000);
132
+ return briefFromName(a.name || a.title).slice(0, 8000);
123
133
  }
124
134
 
125
135
  export function shapeAgent(raw = {}) {
@@ -143,7 +143,7 @@
143
143
  autoUpdateWhenIdleOptIn: false,
144
144
  autoUpdateWhenIdleGateEnabled: false,
145
145
  };
146
- const DEFAULT_MODEL = { modelId: 'zai-org/glm-5.3-flash', maxMode: true, parameters: [] };
146
+ const DEFAULT_MODEL = { modelId: 'x-ai/grok-4.6', maxMode: true, parameters: [] };
147
147
  let defaultModel = DEFAULT_MODEL;
148
148
  try {
149
149
  const raw = localStorage.getItem('sand.p.default-model');
@@ -300,7 +300,7 @@
300
300
  setComputerUseModel: async () => null,
301
301
  getAvailableModels: async () => ({
302
302
  models: [
303
- { modelId: 'zai-org/glm-5.3-flash', maxMode: true, parameters: [] },
303
+ { modelId: 'x-ai/grok-4.6', maxMode: true, parameters: [] },
304
304
  { modelId: 'x-ai/grok-4.5', maxMode: true, parameters: [] },
305
305
  ],
306
306
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openzoo",
3
- "version": "0.50.43",
3
+ "version": "0.50.45",
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",