openzoo 0.50.96 → 0.50.97

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/openzoo.js CHANGED
@@ -330,7 +330,7 @@ async function main() {
330
330
  }
331
331
  case 'ask': {
332
332
  const question = process.argv[3];
333
- if (!question) throw new Error('usage: openzoo ask "<question>" [--context <id>] [--model <id>] [--system <text>]');
333
+ if (!question) throw new Error('usage: openzoo ask "<question>" [--context <id>] [--model <id>] [--system <text>] [--web [--web-results N]]');
334
334
  const ci = process.argv.indexOf('--context');
335
335
  const mi = process.argv.indexOf('--model');
336
336
  // A BARE QUESTION IS A DIFFERENT PRODUCT FROM A BRIEFED ONE.
@@ -344,7 +344,20 @@ async function main() {
344
344
  // DHH, Hyprland and theming. Same gateway, same product, one had context.
345
345
  // A caller that knows where it is running can now say so.
346
346
  const si = process.argv.indexOf('--system');
347
- const system = si !== -1 ? process.argv[si + 1] : '';
347
+ let system = si !== -1 ? process.argv[si + 1] : '';
348
+ // --web: a keyless DuckDuckGo search, top results injected into THIS
349
+ // call's system prompt. The x402 rail strips OpenRouter's `plugins`
350
+ // field, so search-then-inject has to happen here, on the caller's
351
+ // side. EGRESS: the question text goes to duckduckgo.com. Also on with
352
+ // OPENZOO_ASK_WEB=1; --web-results N caps the count (default 5).
353
+ const wantWeb = process.argv.includes('--web') || process.env.OPENZOO_ASK_WEB === '1';
354
+ if (wantWeb) {
355
+ const wi = process.argv.indexOf('--web-results');
356
+ const n = wi !== -1 ? Number(process.argv[wi + 1]) || 5 : 5;
357
+ const { webSearch, formatWebResults } = await import('../lib/websearch.js');
358
+ const hits = await webSearch(question, n).catch((e) => { console.error(`web search failed: ${e.message}`); return []; });
359
+ if (hits.length) system = (system ? system + '\n\n' : '') + formatWebResults(question, hits);
360
+ }
348
361
  const { PayClient } = await import('../lib/pay.js');
349
362
  const { config } = await import('../lib/config.js');
350
363
  const client = new PayClient();
@@ -389,6 +402,17 @@ async function main() {
389
402
  case '-h':
390
403
  console.log(HELP);
391
404
  break;
405
+ case 'version':
406
+ case '--version':
407
+ case '-v':
408
+ case '-V': {
409
+ // Every installer, mise shim and shell script that probes a CLI asks
410
+ // this first; answering "unknown command" to it failed real installs.
411
+ const { readFileSync } = await import('fs');
412
+ const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
413
+ console.log(pkg.version);
414
+ break;
415
+ }
392
416
  default:
393
417
  console.error(`unknown command: ${cmd}\n`);
394
418
  console.log(HELP);
@@ -652,10 +652,10 @@ async function fetchEnsureSandBox(req, body, log) {
652
652
  try {
653
653
  const remote = await podJson('/api/listAgents', {}, log);
654
654
  if (Array.isArray(remote) && remote.length) {
655
- const merged = rosterForEvent(mergeAgentLists(remote), agentActivity);
655
+ const merged = rosterForEvent(mergeAgentLists(remote), agentActivity, { includeHidden: true }); // GROKROOM-HIDDEN-BOTS
656
656
  saveAgents(merged);
657
657
  const active = focusedAgentId || merged[0]?.id;
658
- ssePush('agents', { agents: merged, activeAgentId: active });
658
+ ssePush('agents', { agents: merged.filter((a) => !a.hidden), activeAgentId: active }); // GROKROOM-HIDDEN-BOTS
659
659
  log(`cursor-backend: discovered roster n=${merged.length} account=${realPod.accountId}`);
660
660
  }
661
661
  } catch (e) {
@@ -837,9 +837,9 @@ async function proxyPodHttp(req, res, full, body, log) {
837
837
  try {
838
838
  const parsed = JSON.parse(String(inflateBody(cap.buf, cap.respHeaders)));
839
839
  if (Array.isArray(parsed)) {
840
- const merged = rosterForEvent(mergeAgentLists(parsed), agentActivity);
840
+ const merged = rosterForEvent(mergeAgentLists(parsed), agentActivity, { includeHidden: true }); // GROKROOM-HIDDEN-BOTS
841
841
  saveAgents(merged);
842
- jsonSend(res, merged);
842
+ jsonSend(res, merged.filter((a) => !a.hidden)); // GROKROOM-HIDDEN-BOTS
843
843
  log(`cursor-backend: listAgents 200 merged n=${merged.length} account=${activeAccountId || '?'}`);
844
844
  return true;
845
845
  }
@@ -972,7 +972,7 @@ function pushCreatedAgent(agent, { select = true } = {}) {
972
972
  const active = focusedAgentId || agent.id;
973
973
  const list = rosterForEvent(cachedAgentList() || [], agentActivity);
974
974
  ssePush('agent-upserted', { agent, activeAgentId: active });
975
- ssePush('agents', { agents: list, activeAgentId: active });
975
+ ssePush('agents', { agents: list.filter((a) => !a.hidden), activeAgentId: active }); // GROKROOM-HIDDEN-BOTS
976
976
  }
977
977
 
978
978
  /** Grok Bot Helper daemon: GET /local-exec/requests is SSE, POST /local-exec/responses