@namzu/sdk 65.0.0 → 65.2.0

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/agents/explore.d.ts +1 -1
  3. package/dist/agents/explore.d.ts.map +1 -1
  4. package/dist/agents/explore.js +2 -1
  5. package/dist/agents/explore.js.map +1 -1
  6. package/dist/agents/plan.d.ts +1 -1
  7. package/dist/agents/plan.d.ts.map +1 -1
  8. package/dist/agents/plan.js +2 -1
  9. package/dist/agents/plan.js.map +1 -1
  10. package/dist/provider/errors.d.ts +10 -0
  11. package/dist/provider/errors.d.ts.map +1 -1
  12. package/dist/provider/errors.js +29 -1
  13. package/dist/provider/errors.js.map +1 -1
  14. package/dist/provider/token-budget.d.ts.map +1 -1
  15. package/dist/provider/token-budget.js +9 -1
  16. package/dist/provider/token-budget.js.map +1 -1
  17. package/dist/public-tools.d.ts +1 -1
  18. package/dist/public-tools.d.ts.map +1 -1
  19. package/dist/public-tools.js +1 -1
  20. package/dist/public-tools.js.map +1 -1
  21. package/dist/runtime/query/iteration/index.d.ts +2 -0
  22. package/dist/runtime/query/iteration/index.d.ts.map +1 -1
  23. package/dist/runtime/query/iteration/index.js +45 -6
  24. package/dist/runtime/query/iteration/index.js.map +1 -1
  25. package/dist/runtime/query/turn/stall-monitor.d.ts +5 -0
  26. package/dist/runtime/query/turn/stall-monitor.d.ts.map +1 -1
  27. package/dist/runtime/query/turn/stall-monitor.js +5 -0
  28. package/dist/runtime/query/turn/stall-monitor.js.map +1 -1
  29. package/dist/tools/builtins/browser-stall.d.ts +59 -0
  30. package/dist/tools/builtins/browser-stall.d.ts.map +1 -0
  31. package/dist/tools/builtins/browser-stall.js +141 -0
  32. package/dist/tools/builtins/browser-stall.js.map +1 -0
  33. package/dist/tools/builtins/browser.d.ts +33 -4
  34. package/dist/tools/builtins/browser.d.ts.map +1 -1
  35. package/dist/tools/builtins/browser.js +292 -24
  36. package/dist/tools/builtins/browser.js.map +1 -1
  37. package/dist/types/browser/index.d.ts +130 -8
  38. package/dist/types/browser/index.d.ts.map +1 -1
  39. package/dist/types/browser/index.js +2 -0
  40. package/dist/types/browser/index.js.map +1 -1
  41. package/dist/types/provider/error.d.ts +7 -1
  42. package/dist/types/provider/error.d.ts.map +1 -1
  43. package/dist/types/provider/errors.d.ts.map +1 -1
  44. package/dist/types/provider/errors.js +5 -0
  45. package/dist/types/provider/errors.js.map +1 -1
  46. package/dist/types/session/records.d.ts +6 -0
  47. package/dist/types/session/records.d.ts.map +1 -1
  48. package/dist/types/session/records.js +11 -1
  49. package/dist/types/session/records.js.map +1 -1
  50. package/package.json +1 -1
  51. package/src/agents/explore.ts +2 -1
  52. package/src/agents/plan.ts +2 -1
  53. package/src/provider/errors.ts +32 -1
  54. package/src/provider/token-budget.ts +9 -1
  55. package/src/public-tools.ts +1 -0
  56. package/src/runtime/query/iteration/index.ts +49 -5
  57. package/src/runtime/query/turn/stall-monitor.ts +7 -0
  58. package/src/tools/builtins/browser-stall.ts +172 -0
  59. package/src/tools/builtins/browser.ts +371 -33
  60. package/src/types/browser/index.ts +136 -3
  61. package/src/types/provider/error.ts +6 -0
  62. package/src/types/provider/errors.ts +5 -0
  63. package/src/types/session/records.ts +11 -1
@@ -0,0 +1,59 @@
1
+ import type { BrowserResult } from '../../types/browser/index.js';
2
+ import type { ToolResult } from '../../types/tool/index.js';
3
+ /**
4
+ * A repeated browser call that changes nothing is the commonest way a small
5
+ * model burns a turn: the same click on the same element, again and again,
6
+ * while the page stays as it was. The guard watches what the host returned
7
+ * for each call and speaks up in three steps:
8
+ *
9
+ * - the third identical call in a row with the page unchanged gets a note;
10
+ * - the fifth is refused, naming the last thing the page showed;
11
+ * - twelve page-changing calls with no new address, tree or tab get a note
12
+ * asking the model to say what blocks it.
13
+ *
14
+ * "Identical" is the tool, the action and every argument. "Unchanged" is the
15
+ * address, the tab set and the last whole-page snapshot, as the host reported
16
+ * them. Nothing here reads a clock, so nothing here depends on how fast the
17
+ * machine is.
18
+ */
19
+ /** The call number that earns a note. */
20
+ export declare const STALL_NOTE_AT = 3;
21
+ /** The call number that is refused. */
22
+ export declare const STALL_REFUSE_AT = 5;
23
+ /** Page-changing calls without any sign of progress before the second note. */
24
+ export declare const NO_PROGRESS_NOTE_AFTER = 12;
25
+ /** What a tool call looked like, for the guard. */
26
+ export interface StalledCall {
27
+ readonly tool: string;
28
+ readonly input: unknown;
29
+ /** Only an action that can change what the page shows takes part. */
30
+ readonly counts: boolean;
31
+ /** The call returned the whole page (no region, no cursor). */
32
+ readonly wholePage: boolean;
33
+ }
34
+ export declare class BrowserStallGuard {
35
+ private turn;
36
+ private readonly repeats;
37
+ private address;
38
+ private tree;
39
+ private tabs;
40
+ private idleActs;
41
+ private lastEffect;
42
+ /** One signature for what the page showed: address, tab set and whole-page tree. */
43
+ private signature;
44
+ private reset;
45
+ /** Record what the host returned. Call it for every result, counted or not. */
46
+ seen(result: BrowserResult, wholePage: boolean): void;
47
+ /** Before a call: the refusal to return instead of running it, if it is the fifth in a row. */
48
+ check(turnId: string, call: StalledCall): ToolResult | undefined;
49
+ /** A repeat continues only when the last identical call changed nothing and the page is still as it left it. */
50
+ private nextCount;
51
+ /**
52
+ * Before a call runs, the signature it starts from. Pass it to
53
+ * {@link finish}, which compares it with the one after.
54
+ */
55
+ begin(): string;
56
+ /** After a call: count it and add a note to the result when it has earned one. */
57
+ finish(turnId: string, call: StalledCall, before: string, result: ToolResult): ToolResult;
58
+ }
59
+ //# sourceMappingURL=browser-stall.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-stall.d.ts","sourceRoot":"","sources":["../../../src/tools/builtins/browser-stall.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAClF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAE3D;;;;;;;;;;;;;;;GAeG;AAEH,yCAAyC;AACzC,eAAO,MAAM,aAAa,IAAI,CAAA;AAC9B,uCAAuC;AACvC,eAAO,MAAM,eAAe,IAAI,CAAA;AAChC,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,KAAK,CAAA;AAExC,mDAAmD;AACnD,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,qEAAqE;IACrE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC3B;AAuCD,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,IAAI,CAAoB;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IACpD,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,QAAQ,CAAI;IACpB,OAAO,CAAC,UAAU,CAAK;IAEvB,oFAAoF;IACpF,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,KAAK;IAMb,+EAA+E;IAC/E,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI;IAgBrD,+FAA+F;IAC/F,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,SAAS;IAiBhE,gHAAgH;IAChH,OAAO,CAAC,SAAS;IAIjB;;;OAGG;IACH,KAAK,IAAI,MAAM;IAIf,kFAAkF;IAClF,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,UAAU;CA4BzF"}
@@ -0,0 +1,141 @@
1
+ /**
2
+ * A repeated browser call that changes nothing is the commonest way a small
3
+ * model burns a turn: the same click on the same element, again and again,
4
+ * while the page stays as it was. The guard watches what the host returned
5
+ * for each call and speaks up in three steps:
6
+ *
7
+ * - the third identical call in a row with the page unchanged gets a note;
8
+ * - the fifth is refused, naming the last thing the page showed;
9
+ * - twelve page-changing calls with no new address, tree or tab get a note
10
+ * asking the model to say what blocks it.
11
+ *
12
+ * "Identical" is the tool, the action and every argument. "Unchanged" is the
13
+ * address, the tab set and the last whole-page snapshot, as the host reported
14
+ * them. Nothing here reads a clock, so nothing here depends on how fast the
15
+ * machine is.
16
+ */
17
+ /** The call number that earns a note. */
18
+ export const STALL_NOTE_AT = 3;
19
+ /** The call number that is refused. */
20
+ export const STALL_REFUSE_AT = 5;
21
+ /** Page-changing calls without any sign of progress before the second note. */
22
+ export const NO_PROGRESS_NOTE_AFTER = 12;
23
+ function fnv1a(text) {
24
+ let hash = 0x811c9dc5;
25
+ for (let i = 0; i < text.length; i += 1) {
26
+ hash ^= text.charCodeAt(i);
27
+ hash = Math.imul(hash, 0x01000193);
28
+ }
29
+ return (hash >>> 0).toString(16);
30
+ }
31
+ /** Stable text for an input: keys sorted, so `{a,b}` and `{b,a}` are the same call. */
32
+ function canonical(value) {
33
+ if (Array.isArray(value))
34
+ return `[${value.map(canonical).join(',')}]`;
35
+ if (typeof value === 'object' && value !== null) {
36
+ const record = value;
37
+ return `{${Object.keys(record)
38
+ .sort()
39
+ .filter((key) => record[key] !== undefined)
40
+ .map((key) => `${JSON.stringify(key)}:${canonical(record[key])}`)
41
+ .join(',')}}`;
42
+ }
43
+ return JSON.stringify(value) ?? 'null';
44
+ }
45
+ function oneLine(text, max) {
46
+ const flat = text.replace(/\s+/g, ' ').trim();
47
+ return flat.length > max ? `${flat.slice(0, max - 1)}…` : flat;
48
+ }
49
+ export class BrowserStallGuard {
50
+ turn;
51
+ repeats = new Map();
52
+ address = '';
53
+ tree = '';
54
+ tabs = '';
55
+ idleActs = 0;
56
+ lastEffect = '';
57
+ /** One signature for what the page showed: address, tab set and whole-page tree. */
58
+ signature() {
59
+ return `${this.address}\n${this.tabs}\n${this.tree}`;
60
+ }
61
+ reset(turnId) {
62
+ this.turn = turnId;
63
+ this.repeats.clear();
64
+ this.idleActs = 0;
65
+ }
66
+ /** Record what the host returned. Call it for every result, counted or not. */
67
+ seen(result, wholePage) {
68
+ const page = result.snapshot?.page ?? result.screenshot?.page ?? result.page;
69
+ if (page)
70
+ this.address = `${page.url}|${page.tab}`;
71
+ if (result.tabs)
72
+ this.tabs = result.tabs.map((tab) => `${tab.tab}${tab.active ? '*' : ''}`).join(',');
73
+ if (result.snapshot && wholePage)
74
+ this.tree = fnv1a(result.snapshot.text);
75
+ this.lastEffect = oneLine(result.message ??
76
+ (page
77
+ ? `the page is at ${page.url} titled ${JSON.stringify(oneLine(page.title, 80))}`
78
+ : ''), 200);
79
+ }
80
+ /** Before a call: the refusal to return instead of running it, if it is the fifth in a row. */
81
+ check(turnId, call) {
82
+ if (this.turn !== turnId)
83
+ this.reset(turnId);
84
+ if (!call.counts)
85
+ return undefined;
86
+ const key = `${call.tool}:${canonical(call.input)}`;
87
+ const previous = this.repeats.get(key);
88
+ const count = this.nextCount(previous, this.signature());
89
+ if (count < STALL_REFUSE_AT)
90
+ return undefined;
91
+ if (previous)
92
+ previous.count = count;
93
+ const effect = previous?.last ? ` The last thing the page showed: ${previous.last}.` : '';
94
+ return {
95
+ success: false,
96
+ output: '',
97
+ error: `${call.tool}: refused. This same call has now been made ${count} times in a row and the page has not changed.${effect} Do something different: another element, a fresh snapshot to look for it, a scroll, a wait, or another page. If nothing works, tell the user what is blocking you.`,
98
+ data: { code: 'browser_repeated_no_change', repeats: count },
99
+ };
100
+ }
101
+ /** A repeat continues only when the last identical call changed nothing and the page is still as it left it. */
102
+ nextCount(previous, from) {
103
+ return previous?.unchanged && previous.after === from ? previous.count + 1 : 1;
104
+ }
105
+ /**
106
+ * Before a call runs, the signature it starts from. Pass it to
107
+ * {@link finish}, which compares it with the one after.
108
+ */
109
+ begin() {
110
+ return this.signature();
111
+ }
112
+ /** After a call: count it and add a note to the result when it has earned one. */
113
+ finish(turnId, call, before, result) {
114
+ if (this.turn !== turnId)
115
+ this.reset(turnId);
116
+ if (!call.counts)
117
+ return result;
118
+ const key = `${call.tool}:${canonical(call.input)}`;
119
+ const previous = this.repeats.get(key);
120
+ const count = this.nextCount(previous, before);
121
+ const after = this.signature();
122
+ // Nothing was known before the first call, so learning the page is not a change.
123
+ const unchanged = after === before || before.trim() === '';
124
+ this.repeats.set(key, { count, after, unchanged, last: this.lastEffect });
125
+ this.idleActs = unchanged ? this.idleActs + 1 : 0;
126
+ const notes = [];
127
+ if (count >= STALL_NOTE_AT) {
128
+ notes.push(`Note: this same call has now run ${count} times in a row and the page has not changed. Repeating it again will not help; try something different (another element, a fresh snapshot, a scroll, a wait) or tell the user what is blocking you.`);
129
+ }
130
+ if (this.idleActs > 0 && this.idleActs % NO_PROGRESS_NOTE_AFTER === 0) {
131
+ notes.push(`Note: ${this.idleActs} calls in a row have brought no new address, page content or tab. Say what is blocking you and ask the user before trying more.`);
132
+ }
133
+ if (notes.length === 0)
134
+ return result;
135
+ const text = notes.join(' ');
136
+ return result.success
137
+ ? { ...result, output: result.output ? `${text}\n${result.output}` : text }
138
+ : { ...result, error: `${result.error ?? ''} ${text}`.trim() };
139
+ }
140
+ }
141
+ //# sourceMappingURL=browser-stall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-stall.js","sourceRoot":"","sources":["../../../src/tools/builtins/browser-stall.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AAEH,yCAAyC;AACzC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAA;AAC9B,uCAAuC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAA;AAChC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAA;AAqBxC,SAAS,KAAK,CAAC,IAAY;IAC1B,IAAI,IAAI,GAAG,UAAU,CAAA;IACrB,KAAK,IAAI,CAAC,GAA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zE,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACjD,MAAM,KAAK,GAAa,EAAE,CAAA;QAC1B,IAAI,KAAK,IAAI,aAAa,EAAE,CAAC;YAC5B,KAAK,CAAC,IAAI,CACT,oCAAoC,KAAK,sMAAsM,CAC/O,CAAA;QACF,CAAC;QACD,IAAI,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,GAAG,sBAAsB,KAAK,CAAC,EAAE,CAAC;YACvE,KAAK,CAAC,IAAI,CACT,SAAS,IAAI,CAAC,QAAQ,iIAAiI,CACvJ,CAAA;QACF,CAAC;QACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,MAAM,CAAA;QACrC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC5B,OAAO,MAAM,CAAC,OAAO;YACpB,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE;YAC3E,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAA;IAChE,CAAC;CACD"}
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import type { BrowserHost, BrowserHostError, BrowserPageInfo } from '../../types/browser/index.js';
2
+ import type { BrowserEffect, BrowserHost, BrowserHostError, BrowserPageInfo } from '../../types/browser/index.js';
3
3
  import type { ToolDefinition } from '../../types/tool/index.js';
4
4
  export declare const BROWSER_TOOL_NAME: "browser";
5
5
  export declare const BROWSER_ACT_TOOL_NAME: "browser_act";
@@ -16,6 +16,14 @@ declare const observeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
16
16
  action: z.ZodLiteral<"snapshot">;
17
17
  ref: z.ZodOptional<z.ZodString>;
18
18
  cursor: z.ZodOptional<z.ZodString>;
19
+ view: z.ZodOptional<z.ZodEnum<{
20
+ full: "full";
21
+ delta: "delta";
22
+ interactive: "interactive";
23
+ reading: "reading";
24
+ }>>;
25
+ query: z.ZodOptional<z.ZodString>;
26
+ role: z.ZodOptional<z.ZodString>;
19
27
  }, z.core.$strip>, z.ZodObject<{
20
28
  action: z.ZodLiteral<"screenshot">;
21
29
  ref: z.ZodOptional<z.ZodString>;
@@ -35,6 +43,10 @@ declare const observeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
35
43
  text: z.ZodOptional<z.ZodString>;
36
44
  textGone: z.ZodOptional<z.ZodString>;
37
45
  timeMs: z.ZodOptional<z.ZodNumber>;
46
+ stable: z.ZodOptional<z.ZodBoolean>;
47
+ }, z.core.$strip>, z.ZodObject<{
48
+ action: z.ZodLiteral<"value">;
49
+ ref: z.ZodString;
38
50
  }, z.core.$strip>, z.ZodObject<{
39
51
  action: z.ZodLiteral<"tabs">;
40
52
  op: z.ZodEnum<{
@@ -49,9 +61,12 @@ declare const observeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
49
61
  declare const actSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
50
62
  origin: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
51
63
  snapshot: z.ZodOptional<z.ZodBoolean>;
52
- action: z.ZodLiteral<"click">;
53
- ref: z.ZodString;
54
64
  doubleClick: z.ZodOptional<z.ZodBoolean>;
65
+ ref: z.ZodOptional<z.ZodString>;
66
+ role: z.ZodOptional<z.ZodString>;
67
+ name: z.ZodOptional<z.ZodString>;
68
+ text: z.ZodOptional<z.ZodString>;
69
+ action: z.ZodLiteral<"click">;
55
70
  }, z.core.$strip>, z.ZodObject<{
56
71
  origin: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
57
72
  snapshot: z.ZodOptional<z.ZodBoolean>;
@@ -59,6 +74,9 @@ declare const actSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
59
74
  ref: z.ZodString;
60
75
  text: z.ZodString;
61
76
  submit: z.ZodOptional<z.ZodBoolean>;
77
+ keys: z.ZodOptional<z.ZodBoolean>;
78
+ clear: z.ZodOptional<z.ZodBoolean>;
79
+ append: z.ZodOptional<z.ZodBoolean>;
62
80
  }, z.core.$strip>, z.ZodObject<{
63
81
  origin: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
64
82
  snapshot: z.ZodOptional<z.ZodBoolean>;
@@ -82,8 +100,11 @@ declare const actSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
82
100
  }, z.core.$strip>, z.ZodObject<{
83
101
  origin: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
84
102
  snapshot: z.ZodOptional<z.ZodBoolean>;
103
+ ref: z.ZodOptional<z.ZodString>;
104
+ role: z.ZodOptional<z.ZodString>;
105
+ name: z.ZodOptional<z.ZodString>;
106
+ text: z.ZodOptional<z.ZodString>;
85
107
  action: z.ZodLiteral<"hover">;
86
- ref: z.ZodString;
87
108
  }, z.core.$strip>, z.ZodObject<{
88
109
  origin: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
89
110
  snapshot: z.ZodOptional<z.ZodBoolean>;
@@ -116,6 +137,14 @@ export declare function isBrowserCallReadOnly(input: BrowserToolInput): boolean;
116
137
  * and stripped of the envelope's delimiter.
117
138
  */
118
139
  export declare function formatBrowserPageHeader(page: BrowserPageInfo): string;
140
+ /**
141
+ * What an action did, in two parts: the host's sentence (counts, and whether
142
+ * the page had gone quiet), then the page's own lines that appeared or went,
143
+ * inside the untrusted envelope because they are the page's words. `no
144
+ * visible change` is the sentence a model most needs: a click that did nothing
145
+ * must not read like one that worked.
146
+ */
147
+ export declare function renderBrowserEffect(effect: BrowserEffect, page: BrowserPageInfo | undefined, withLines: boolean): string;
119
148
  /**
120
149
  * The structural error a browser host threw, or undefined. Recognised by
121
150
  * shape, so a separately installed host and SDK need not share a class.
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../src/tools/builtins/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAKX,WAAW,EACX,gBAAgB,EAIhB,eAAe,EAGf,MAAM,8BAA8B,CAAA;AAOrC,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,2BAA2B,CAAA;AAO3E,eAAO,MAAM,iBAAiB,EAAG,SAAkB,CAAA;AACnD,eAAO,MAAM,qBAAqB,EAAG,aAAsB,CAAA;AAmC3D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAqDhB,CAAA;AAOH,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BA+Cb,CAAA;AAEF,yDAAyD;AACzD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAC5D,6DAA6D;AAC7D,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAA;AAyB3D;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAetE;AA8KD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAIrE;AA6FD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,GAAG,SAAS,CAwB/E;AAsND;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CACjC,IAAI,EAAE,WAAW,GACf,CAAC,cAAc,CAAC,gBAAgB,CAAC,EAAE,cAAc,CAAC,mBAAmB,CA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