@hanzo/rooms 0.1.20 → 0.1.21

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/dist/lib/web.d.ts CHANGED
@@ -26,7 +26,8 @@
26
26
  *
27
27
  * Bounded: at most ROUNDS rounds of lookups the model asks for, CALLS lookups in
28
28
  * a round, and every lookup on its own clock. The request after the last round
29
- * offers no tools, so the turn ends in words.
29
+ * offers no tools, so the turn ends in words; a reply of no words is asked for
30
+ * once more.
30
31
  *
31
32
  * A page is read only when the conversation or one of this turn's searches
32
33
  * named it. Page text is written by strangers and can tell a model to fetch an
package/dist/lib/web.js CHANGED
@@ -26,7 +26,8 @@
26
26
  *
27
27
  * Bounded: at most ROUNDS rounds of lookups the model asks for, CALLS lookups in
28
28
  * a round, and every lookup on its own clock. The request after the last round
29
- * offers no tools, so the turn ends in words.
29
+ * offers no tools, so the turn ends in words; a reply of no words is asked for
30
+ * once more.
30
31
  *
31
32
  * A page is read only when the conversation or one of this turn's searches
32
33
  * named it. Page text is written by strangers and can tell a model to fetch an
@@ -200,6 +201,8 @@ function rule(now) {
200
201
  }
201
202
  /** What the model is told when its rounds are spent. */
202
203
  const SPENT = 'You have used every web lookup this turn allows. Answer the person now, in words, from what you have found, citing each fact inline as a Markdown link [page title](url) to the page it came from.';
204
+ /** What a model that answered with nothing is told, once. */
205
+ const SILENT = 'Your last reply was empty. Answer the person now, in words, from what the lookups found, citing each fact inline as a Markdown link [page title](url).';
203
206
  /** A search that could not run, said so the model says it plainly. */
204
207
  const unavailable = (why) => `Live web search is unavailable right now (${why instanceof Error ? why.message : String(why)}). ` +
205
208
  'Tell the person in one plain sentence that you could not search the web just now, then answer from what you know and say it may be out of date.';
@@ -418,10 +421,22 @@ export function researched(base, clock = () => new Date()) {
418
421
  async start(out) {
419
422
  try {
420
423
  let res = first;
424
+ let nudged = false;
421
425
  for (let round = 0;; round++) {
422
426
  const hop = await relay(res, out);
423
- if (!hop.calls.length)
424
- break;
427
+ if (!hop.calls.length) {
428
+ // AN ANSWER OF NO WORDS after a reasoning model has read a page of
429
+ // results: asked once more, without tools, it answers.
430
+ if (hop.content.trim() || nudged)
431
+ break;
432
+ nudged = true;
433
+ res = await ask([...messages, { role: 'system', content: SILENT }], true);
434
+ if (!streams(res)) {
435
+ out.enqueue(event({ error: { message: await refusal(res) } }));
436
+ break;
437
+ }
438
+ continue;
439
+ }
425
440
  const results = await Promise.all(hop.calls.map((tc, i) => i < CALLS ? run(call, tc, words, now, seen) : Promise.resolve(`skipped: at most ${CALLS} lookups run in one step.`)));
426
441
  messages = [
427
442
  ...messages,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/rooms",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "The workspace rooms — Home, Chat, Inbox, Contacts, Meet, Cal, Drive, Board, Work, Bots — and the frame that holds them, once, for every Hanzo surface.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",