@hanzo/build 0.2.120 → 0.2.121

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.
@@ -15,7 +15,12 @@ export interface Sketch {
15
15
  export declare const SYSTEM: string;
16
16
  /** A model's answer as a draft: the fields that are text, or null where it named no one to draft. */
17
17
  export declare function parse(said: string): Sketch | null;
18
- /** The line they typed, drafted. */
18
+ /**
19
+ * The tokens a draft is allowed: Enso reasons before it answers, and under 4,000 the answer
20
+ * is cut off with nothing said (measured: 1,200 came back empty, 4,000 in full).
21
+ */
22
+ export declare const ROOM = 4000;
23
+ /** The line they typed, drafted; asked a second time when the first answer was not one. */
19
24
  export declare function sketch(t: Target, line: string, signal?: AbortSignal): Promise<Sketch>;
20
25
  /** The instructions as saved: what the model wrote, then the first line it says. */
21
26
  export declare const saved: (s: Pick<Sketch, 'instructions' | 'opening'>) => string;
package/lib/api/draft.js CHANGED
@@ -30,13 +30,19 @@ export function parse(said) {
30
30
  return null;
31
31
  return { name, role: word(o.role), instructions, opening: word(o.opening), emoji: word(o.emoji).slice(0, 8), figure: word(o.figure) };
32
32
  }
33
- /** The line they typed, drafted. */
33
+ /**
34
+ * The tokens a draft is allowed: Enso reasons before it answers, and under 4,000 the answer
35
+ * is cut off with nothing said (measured: 1,200 came back empty, 4,000 in full).
36
+ */
37
+ export const ROOM = 4000;
38
+ /** The line they typed, drafted; asked a second time when the first answer was not one. */
34
39
  export async function sketch(t, line, signal) {
35
- const said = await ask(t, SYSTEM, line.trim(), signal, 1200, ENSO);
36
- const draft = parse(said);
37
- if (!draft)
38
- throw new Error('The draft did not come out. Try again.');
39
- return draft;
40
+ for (let tried = 0; tried < 2; tried++) {
41
+ const draft = parse(await ask(t, SYSTEM, line.trim(), signal, ROOM, ENSO));
42
+ if (draft)
43
+ return draft;
44
+ }
45
+ throw new Error('The draft did not come out. Try again.');
40
46
  }
41
47
  /** The instructions as saved: what the model wrote, then the first line it says. */
42
48
  export const saved = (s) => (s.opening ? `${s.instructions.trim()}\n\nBegin a new conversation with: ${s.opening}` : s.instructions.trim());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/build",
3
- "version": "0.2.120",
3
+ "version": "0.2.121",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "description": "Hanzo Build — say what you want, watch it built, deployed and running. The builder as a component, mounted by the Hanzo app at hanzo.ai.",