@far-world-labs/verblets 0.6.3 → 0.6.4

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/index.js CHANGED
@@ -1,34 +1,33 @@
1
1
  import ne from "dotenv";
2
- import I, { readFileSync as re } from "node:fs";
3
- import { resolve as ie } from "node:path";
4
- import { i as oe, n as $, c as L, g as K, a as ce, w as B, r as U, b as le, j as Y, O as k, s as Q, d as ue, e as pe, f as de } from "./shared-BSAzZOFX.js";
5
- import { cJ as Tt, P as Et, L as Dt, R as $t, aY as Lt, N as Ft, M as Nt, aw as Mt, Q as _t, bo as Bt, br as Ut, cc as Ot, bI as jt, bD as zt, bE as qt, cb as Vt, a7 as Wt, J as Gt, ag as Ht, a6 as Jt, be as Xt, z as Kt, aC as Yt, aM as Qt, bG as Zt, p as es, aV as ts, bF as ss, ad as as, H as ns, I as rs, aU as is, bB as os, a9 as cs, aa as ls, cr as us, c5 as ps, t as ds, h as ms, aW as hs, c3 as gs, aX as fs, cs as bs, bt as ys, cL as ws, m as Ss, aZ as xs, ct as vs, c7 as Is, K as Cs, S as ks, ah as As, bf as Ps, A as Rs, aN as Ts, aO as Es, Z as Ds, q as $s, c6 as Ls, X as Fs, ab as Ns, ac as Ms, ax as _s, a_ as Bs, b0 as Us, b2 as Os, b3 as js, bO as zs, c1 as qs, bP as Vs, b$ as Ws, bQ as Gs, c0 as Hs, bV as Js, b_ as Xs, bZ as Ks, bU as Ys, bY as Qs, bT as Zs, c2 as ea, bW as ta, bX as sa, bR as aa, ae as na, aj as ra, al as ia, am as oa, ai as ca, ak as la, af as ua, a4 as pa, a5 as da, _ as ma, bH as ha, an as ga, ci as fa, b4 as ba, ao as ya, b5 as wa, ap as Sa, au as xa, cI as va, a$ as Ia, V as Ca, W as ka, aq as Aa, ar as Pa, cK as Ra, bJ as Ta, as as Ea, b6 as Da, cu as $a, at as La, av as Fa, ay as Na, bK as Ma, bL as _a, az as Ba, b7 as Ua, b8 as Oa, c8 as ja, u as za, v as qa, T as Va, U as Wa, cv as Ga, c9 as Ha, ca as Ja, cq as Xa, bg as Ka, bh as Ya, b9 as Qa, bL as Za, cw as en, cC as tn, ba as sn, G as an, cF as nn, cG as rn, cD as on, bb as cn, c4 as ln, bd as un, bc as pn, bj as dn, bl as mn, bm as hn, bi as gn, bk as fn, cH as bn, k as yn, ce as wn, x as Sn, C as xn, E as vn, F as In, B as Cn, D as kn, y as An, bn as Pn, cE as Rn, bA as Tn, aA as En, aF as Dn, aH as $n, aI as Ln, aD as Fn, aE as Nn, aG as Mn, aB as _n, bM as Bn, o as Un, bS as On, l as jn, bN as zn, cB as qn, b1 as Vn, bp as Wn, bC as Gn, aJ as Hn, cx as Jn, bq as Xn, ck as Kn, cj as Yn, a8 as Qn, aL as Zn, bs as er, aK as tr, aQ as sr, aS as ar, aT as nr, aP as rr, aR as ir, a0 as or, a1 as cr, $ as lr, a3 as ur, cd as pr, bu as dr, bv as mr, cl as hr, cn as gr, co as fr, cm as br, cp as yr, bw as wr, bx as Sr, cy as xr, a2 as vr, Y as Ir, cz as Cr, bz as kr, by as Ar, cf as Pr, cg as Rr, ch as Tr, cA as Er } from "./shared-BSAzZOFX.js";
6
- import * as z from "playwright-core";
2
+ import { i as re, n as $, c as L, g as X, a as oe, w as B, r as U, j as Y, b as ie, O as k, s as Q, d as ce, e as le, f as ue } from "./shared-CsrVgt_K.js";
3
+ import { cR as At, N as Pt, K as Et, P as Rt, cg as Tt, aX as Dt, M as $t, cf as Lt, L as Ft, ci as Mt, cj as Nt, av as _t, c7 as Bt, cQ as Ut, cl as Ot, cm as zt, Q as jt, bn as qt, ck as Vt, bq as Wt, ch as Gt, cc as Ht, bH as Jt, bC as Kt, bD as Xt, cb as Yt, a6 as Qt, I as Zt, af as es, a5 as ts, bd as ss, y as as, aB as ns, aL as rs, bF as os, o as is, aU as cs, bE as ls, ac as us, G as ps, H as ds, aT as ms, bA as hs, a8 as gs, a9 as fs, cz as bs, c4 as ys, q as ws, h as Ss, aV as xs, c2 as vs, aW as Is, cA as Cs, bs as ks, cT as As, m as Ps, aY as Es, cB as Rs, c6 as Ts, J as Ds, R as $s, ag as Ls, be as Fs, z as Ms, aM as Ns, aN as _s, Y as Bs, p as Us, c5 as Os, W as zs, aa as js, ab as qs, aw as Vs, aZ as Ws, a$ as Gs, b1 as Hs, b2 as Js, bN as Ks, c0 as Xs, bO as Ys, b_ as Qs, bP as Zs, b$ as ea, bU as ta, bZ as sa, bY as aa, bT as na, bX as ra, bS as oa, c1 as ia, bV as ca, bW as la, bQ as ua, ad as pa, ai as da, ak as ma, al as ha, ah as ga, aj as fa, ae as ba, a3 as ya, a4 as wa, Z as Sa, bG as xa, am as va, cq as Ia, b3 as Ca, an as ka, b4 as Aa, ao as Pa, at as Ea, a_ as Ra, U as Ta, V as Da, ap as $a, aq as La, cS as Fa, bI as Ma, ar as Na, b5 as _a, cC as Ba, as as Ua, au as Oa, ax as za, bJ as ja, bK as qa, ay as Va, b6 as Wa, b7 as Ga, c8 as Ha, t as Ja, u as Ka, S as Xa, T as Ya, cD as Qa, c9 as Za, ca as en, cy as tn, bf as sn, bg as an, b8 as nn, bK as rn, cE as on, cK as cn, b9 as ln, F as un, cN as pn, cO as dn, cL as mn, ba as hn, c3 as gn, bc as fn, bb as bn, bi as yn, bk as wn, bl as Sn, bh as xn, bj as vn, cP as In, k as Cn, ce as kn, v as An, B as Pn, D as En, E as Rn, A as Tn, C as Dn, x as $n, bm as Ln, cM as Fn, bz as Mn, az as Nn, aE as _n, aG as Bn, aH as Un, aC as On, aD as zn, aF as jn, aA as qn, bL as Vn, bR as Wn, l as Gn, bM as Hn, cJ as Jn, b0 as Kn, bo as Xn, bB as Yn, aI as Qn, cF as Zn, bp as er, cs as tr, cr as sr, a7 as ar, aK as nr, br as rr, aJ as or, aP as ir, aR as cr, aS as lr, aO as ur, aQ as pr, $ as dr, a0 as mr, _ as hr, a2 as gr, cd as fr, bt as br, bu as yr, ct as wr, cv as Sr, cw as xr, cu as vr, cx as Ir, bv as Cr, bw as kr, cG as Ar, a1 as Pr, X as Er, cH as Rr, by as Tr, bx as Dr, cn as $r, co as Lr, cp as Fr, cI as Mr } from "./shared-CsrVgt_K.js";
4
+ import * as j from "playwright-core";
5
+ import I from "node:fs";
6
+ import "node:path";
7
7
  import "glob";
8
- import me from "node:fs/promises";
9
- const he = (t) => {
10
- }, M = 60, ge = (t) => ({
11
- low: { width: 300, quality: M, format: "jpeg" },
12
- med: { width: 100, quality: M, format: "jpeg" },
13
- high: { width: 50, quality: M, format: "jpeg" }
8
+ import pe from "node:fs/promises";
9
+ const N = 60, de = (t) => ({
10
+ low: { width: 300, quality: N, format: "jpeg" },
11
+ med: { width: 100, quality: N, format: "jpeg" },
12
+ high: { width: 50, quality: N, format: "jpeg" }
14
13
  })[t], O = (t) => () => {
15
14
  throw new Error(`${t} is not available in browser environment`);
16
- }, wt = O("resizeImage"), St = O("tileImages"), xt = O("imageToBase64"), vt = () => {
15
+ }, ft = O("resizeImage"), bt = O("tileImages"), yt = O("imageToBase64"), wt = () => {
17
16
  throw new Error("webScrape is not available in browser environment");
18
- }, fe = async (t, a) => (await t.evaluate(() => {
17
+ }, me = async (t, a) => (await t.evaluate(() => {
19
18
  const s = /* @__PURE__ */ new Set();
20
19
  return [...document.querySelectorAll("a[href]")].map((n) => {
21
- const i = n.href;
22
- if (s.has(i)) return;
23
- s.add(i);
24
- const o = n.getBoundingClientRect();
20
+ const o = n.href;
21
+ if (s.has(o)) return;
22
+ s.add(o);
23
+ const i = n.getBoundingClientRect();
25
24
  return {
26
- href: i,
25
+ href: o,
27
26
  text: n.textContent?.trim()?.slice(0, 120) || "",
28
27
  ariaLabel: n.getAttribute("aria-label") || "",
29
28
  rel: n.getAttribute("rel") || "",
30
29
  target: n.getAttribute("target") || "",
31
- isVisible: o.width > 0 && o.height > 0,
30
+ isVisible: i.width > 0 && i.height > 0,
32
31
  classes: n.className?.slice?.(0, 120) || "",
33
32
  dataAttrs: Object.fromEntries(
34
33
  [...n.attributes].filter((r) => r.name.startsWith("data-")).map((r) => [r.name, r.value?.slice(0, 80)])
@@ -43,7 +42,7 @@ const he = (t) => {
43
42
  isExternal: !s.href.startsWith(a),
44
43
  isSameDomain: s.href.startsWith(a),
45
44
  isAnchor: s.href.includes("#") && new URL(s.href).pathname === new URL(t.url()).pathname
46
- })), be = (t) => t.evaluate(
45
+ })), he = (t) => t.evaluate(
47
46
  () => [...document.querySelectorAll("form")].map((a) => ({
48
47
  action: a.action || "",
49
48
  method: (a.method || "GET").toUpperCase(),
@@ -68,7 +67,7 @@ const he = (t) => {
68
67
  })) : void 0
69
68
  }))
70
69
  }))
71
- ), ye = (t) => t.evaluate(() => {
70
+ ), ge = (t) => t.evaluate(() => {
72
71
  const a = [
73
72
  ...document.querySelectorAll(
74
73
  'button, [role="button"], input[type="button"], input[type="submit"]'
@@ -77,7 +76,7 @@ const he = (t) => {
77
76
  ...document.querySelectorAll("[onclick], [data-action], [data-toggle], [data-target]")
78
77
  ];
79
78
  return [.../* @__PURE__ */ new Set([...a, ...e])].map((n) => {
80
- const i = n.getBoundingClientRect();
79
+ const o = n.getBoundingClientRect();
81
80
  return {
82
81
  tag: n.tagName.toLowerCase(),
83
82
  type: n.type || "",
@@ -85,16 +84,16 @@ const he = (t) => {
85
84
  id: n.id || "",
86
85
  classes: (typeof n.className == "string" ? n.className : n.className?.baseVal || "").slice(0, 120),
87
86
  ariaLabel: n.getAttribute("aria-label") || "",
88
- isVisible: i.width > 0 && i.height > 0,
87
+ isVisible: o.width > 0 && o.height > 0,
89
88
  disabled: n.disabled || n.getAttribute("aria-disabled") === "true",
90
89
  hasOnclick: !!n.getAttribute("onclick"),
91
90
  onclick: n.getAttribute("onclick")?.slice(0, 120) || "",
92
91
  dataAttrs: Object.fromEntries(
93
- [...n.attributes].filter((o) => o.name.startsWith("data-")).map((o) => [o.name, o.value?.slice(0, 80)])
92
+ [...n.attributes].filter((i) => i.name.startsWith("data-")).map((i) => [i.name, i.value?.slice(0, 80)])
94
93
  )
95
94
  };
96
95
  });
97
- }), we = (t) => t.evaluate(() => [...document.querySelectorAll("script")].map((e) => ({
96
+ }), fe = (t) => t.evaluate(() => [...document.querySelectorAll("script")].map((e) => ({
98
97
  src: e.src || "",
99
98
  type: e.type || "",
100
99
  isModule: e.type === "module",
@@ -102,7 +101,7 @@ const he = (t) => {
102
101
  size: e.textContent?.length || 0,
103
102
  // First 200 chars of inline scripts to identify patterns
104
103
  preview: e.src ? "" : e.textContent?.trim()?.slice(0, 200)
105
- }))), Se = (t) => t.evaluate(() => {
104
+ }))), be = (t) => t.evaluate(() => {
106
105
  const a = (e) => document.querySelector(`meta[name="${e}"], meta[property="${e}"]`)?.content || "";
107
106
  return {
108
107
  title: document.title || "",
@@ -129,7 +128,7 @@ const he = (t) => {
129
128
  content: e.content?.slice(0, 120)
130
129
  }))
131
130
  };
132
- }), xe = (t) => t.evaluate(() => {
131
+ }), ye = (t) => t.evaluate(() => {
133
132
  const a = [...document.querySelectorAll("h1, h2, h3, h4, h5, h6")].slice(0, 30).map((l) => ({
134
133
  level: parseInt(l.tagName[1], 10),
135
134
  text: l.textContent?.trim()?.slice(0, 100)
@@ -146,16 +145,16 @@ const he = (t) => {
146
145
  document.querySelectorAll("*").forEach((l) => {
147
146
  [...l.attributes].filter((d) => d.name.startsWith("data-")).forEach((d) => s.add(d.name));
148
147
  });
149
- const n = [...document.querySelectorAll('link[rel="stylesheet"]')].map((l) => l.href), i = /* @__PURE__ */ new Set(), o = (l) => {
148
+ const n = [...document.querySelectorAll('link[rel="stylesheet"]')].map((l) => l.href), o = /* @__PURE__ */ new Set(), i = (l) => {
150
149
  const d = l.className;
151
150
  return typeof d == "string" ? d : d?.baseVal || "";
152
151
  };
153
152
  document.querySelectorAll("[class]").forEach((l) => {
154
- o(l).split(/\s+/).slice(0, 5).forEach((d) => {
155
- d && i.add(d);
153
+ i(l).split(/\s+/).slice(0, 5).forEach((d) => {
154
+ d && o.add(d);
156
155
  });
157
156
  });
158
- const r = [...i].slice(0, 200), c = {}, u = [
157
+ const r = [...o].slice(0, 200), c = {}, u = [
159
158
  "jQuery",
160
159
  "$",
161
160
  "React",
@@ -212,30 +211,30 @@ const he = (t) => {
212
211
  iframeCount: document.querySelectorAll("iframe").length,
213
212
  shadowRootCount: [...document.querySelectorAll("*")].filter((l) => l.shadowRoot).length
214
213
  };
215
- }), ve = async (t) => {
216
- const a = t.url(), e = new URL(a).origin, [s, n, i, o, r, c] = await Promise.all([
217
- fe(t, e),
214
+ }), we = async (t) => {
215
+ const a = t.url(), e = new URL(a).origin, [s, n, o, i, r, c] = await Promise.all([
216
+ me(t, e),
217
+ he(t),
218
+ ge(t),
219
+ fe(t),
218
220
  be(t),
219
- ye(t),
220
- we(t),
221
- Se(t),
222
- xe(t)
221
+ ye(t)
223
222
  ]);
224
- return { url: a, links: s, forms: n, buttons: i, scripts: o, meta: r, structure: c };
225
- }, R = (t) => {
223
+ return { url: a, links: s, forms: n, buttons: o, scripts: i, meta: r, structure: c };
224
+ }, E = (t) => {
226
225
  const a = new URL(t);
227
226
  a.hash = "";
228
- const e = [...a.searchParams.entries()].sort(([n], [i]) => n.localeCompare(i));
227
+ const e = [...a.searchParams.entries()].sort(([n], [o]) => n.localeCompare(o));
229
228
  a.search = new URLSearchParams(e).toString();
230
229
  const s = a.toString();
231
230
  return s.endsWith("/") && a.pathname !== "/" ? s.slice(0, -1) : s;
232
- }, Ie = (t, a = 2) => `/${new URL(t).pathname.split("/").filter(Boolean).slice(0, a).join("/")}`, Ce = (t, a = {}) => {
233
- const e = new URL(t).origin, s = a.sameDomain !== !1, n = a.maxDepth ?? 10, i = [], o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), u = R(t);
234
- return i.push({ url: t, normalized: u, depth: 0, source: "(start)" }), c.add(u), {
231
+ }, Se = (t, a = 2) => `/${new URL(t).pathname.split("/").filter(Boolean).slice(0, a).join("/")}`, xe = (t, a = {}) => {
232
+ const e = new URL(t).origin, s = a.sameDomain !== !1, n = a.maxDepth ?? 10, o = [], i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), u = E(t);
233
+ return o.push({ url: t, normalized: u, depth: 0, source: "(start)" }), c.add(u), {
235
234
  addLinks: (b, p, y) => {
236
235
  let f = 0;
237
236
  for (const S of b) {
238
- const x = S.href || S, w = R(x);
237
+ const x = S.href || S, w = E(x);
239
238
  if (c.has(w)) continue;
240
239
  if (c.add(w), s && !x.startsWith(e)) {
241
240
  r.set(w, "external");
@@ -245,8 +244,8 @@ const he = (t) => {
245
244
  r.set(w, "max-depth");
246
245
  continue;
247
246
  }
248
- const N = new URL(x).pathname;
249
- if (/\.(png|jpg|jpeg|gif|svg|ico|css|js|woff2?|ttf|eot|pdf|zip|mp[34])$/i.test(N)) {
247
+ const M = new URL(x).pathname;
248
+ if (/\.(png|jpg|jpeg|gif|svg|ico|css|js|woff2?|ttf|eot|pdf|zip|mp[34])$/i.test(M)) {
250
249
  r.set(w, "resource");
251
250
  continue;
252
251
  }
@@ -254,13 +253,13 @@ const he = (t) => {
254
253
  r.set(w, "scheme");
255
254
  continue;
256
255
  }
257
- i.push({ url: x, normalized: w, depth: p + 1, source: y }), f++;
256
+ o.push({ url: x, normalized: w, depth: p + 1, source: y }), f++;
258
257
  }
259
258
  return f;
260
259
  },
261
260
  next: () => {
262
- const b = i.shift();
263
- return b && o.set(b.normalized, {
261
+ const b = o.shift();
262
+ return b && i.set(b.normalized, {
264
263
  url: b.url,
265
264
  depth: b.depth,
266
265
  source: b.source
@@ -268,30 +267,30 @@ const he = (t) => {
268
267
  },
269
268
  skip: (b, p) => {
270
269
  for (const x of b) {
271
- const w = R(x);
270
+ const w = E(x);
272
271
  r.set(w, p);
273
272
  }
274
- const y = new Set(b.map(R)), f = i.length, S = i.filter((x) => !y.has(x.normalized));
275
- return i.length = 0, i.push(...S), f - S.length;
273
+ const y = new Set(b.map(E)), f = o.length, S = o.filter((x) => !y.has(x.normalized));
274
+ return o.length = 0, o.push(...S), f - S.length;
276
275
  },
277
276
  pendingByPrefix: (b = 2) => {
278
277
  const p = /* @__PURE__ */ new Map();
279
- for (const y of i) {
280
- const f = Ie(y.url, b), S = p.get(f) || [];
278
+ for (const y of o) {
279
+ const f = Se(y.url, b), S = p.get(f) || [];
281
280
  S.push(y), p.set(f, S);
282
281
  }
283
282
  return p;
284
283
  },
285
- size: () => i.length,
286
- visitedCount: () => o.size,
287
- isEmpty: () => i.length === 0,
284
+ size: () => o.length,
285
+ visitedCount: () => i.size,
286
+ isEmpty: () => o.length === 0,
288
287
  summary: () => ({
289
- pending: i.length,
290
- visited: o.size,
288
+ pending: o.length,
289
+ visited: i.size,
291
290
  skipped: r.size,
292
291
  seen: c.size
293
292
  }),
294
- visitedUrls: () => [...o.entries()].map(([b, p]) => ({
293
+ visitedUrls: () => [...i.entries()].map(([b, p]) => ({
295
294
  normalized: b,
296
295
  ...p
297
296
  })),
@@ -312,37 +311,37 @@ const he = (t) => {
312
311
  // up to 6 retries (~5m20s total at 2x backoff from 5s)
313
312
  jitter: 0.2
314
313
  // ±20% randomization to avoid thundering herd
315
- }, ke = async (t) => {
314
+ }, ve = async (t) => {
316
315
  const a = t.url(), e = await t.evaluate(() => document.body?.innerText?.slice(0, 500)).catch(() => "");
317
316
  if (e.includes("Access Denied")) return "access-denied";
318
317
  if (e.includes("Rate limit") || e.includes("Too many requests")) return "rate-limit";
319
318
  if (e.includes("Please verify you are a human")) return "captcha";
320
319
  if (e.includes("Checking your browser")) return "challenge";
321
320
  if (a.includes("errors.edgesuite.net")) return "akamai-block";
322
- }, Ae = (t, a) => {
321
+ }, Ie = (t, a) => {
323
322
  const e = t * a;
324
323
  return t + (Math.random() * 2 - 1) * e;
325
- }, Pe = (t, a) => {
324
+ }, Ce = (t, a) => {
326
325
  const e = a.baseDelay * Math.pow(a.backoffFactor, t), s = Math.min(e, a.maxDelay);
327
- return Math.round(Ae(s, a.jitter));
328
- }, Re = async (t, a, e, s) => {
329
- const n = Date.now(), i = n + t;
330
- let o = 0;
331
- for (; o < t; ) {
332
- const r = t - o, c = Math.min(e, r);
333
- await new Promise((u) => setTimeout(u, c)), o = Date.now() - n, a.emit({
326
+ return Math.round(Ie(s, a.jitter));
327
+ }, ke = async (t, a, e, s) => {
328
+ const n = Date.now(), o = n + t;
329
+ let i = 0;
330
+ for (; i < t; ) {
331
+ const r = t - i, c = Math.min(e, r);
332
+ await new Promise((u) => setTimeout(u, c)), i = Date.now() - n, a.emit({
334
333
  event: "cooldown:tick",
335
- elapsedMs: o,
336
- remainingMs: Math.max(0, i - Date.now()),
334
+ elapsedMs: i,
335
+ remainingMs: Math.max(0, o - Date.now()),
337
336
  totalMs: t,
338
337
  ...s
339
338
  });
340
339
  }
341
- }, Te = async (t, a, e, s, n, i, o) => {
340
+ }, Ae = async (t, a, e, s, n, o, i) => {
342
341
  const r = { ...Z, ...n };
343
342
  let c = 0;
344
343
  for (let u = 0; u <= r.maxRetries; u++) {
345
- const m = await t(a, e), h = await i(a);
344
+ const m = await t(a, e), h = await o(a);
346
345
  if (!h)
347
346
  return { pageData: m, retries: u, totalCooldownMs: c };
348
347
  if (u >= r.maxRetries)
@@ -353,7 +352,7 @@ const he = (t) => {
353
352
  attempts: u + 1,
354
353
  totalCooldownMs: c
355
354
  }), { pageData: m, retries: u, totalCooldownMs: c, blocked: h };
356
- const l = Pe(u, r);
355
+ const l = Ce(u, r);
357
356
  c += l, s.emit({
358
357
  event: "cooldown:start",
359
358
  url: e,
@@ -362,7 +361,7 @@ const he = (t) => {
362
361
  maxRetries: r.maxRetries,
363
362
  delayMs: l,
364
363
  totalCooldownMs: c
365
- }), await Re(l, s, o, {
364
+ }), await ke(l, s, i, {
366
365
  url: e,
367
366
  reason: h,
368
367
  attempt: u + 1
@@ -372,7 +371,7 @@ const he = (t) => {
372
371
  attempt: u + 1
373
372
  });
374
373
  }
375
- }, Ee = (t, a, e) => {
374
+ }, Pe = (t, a, e) => {
376
375
  const s = setInterval(() => {
377
376
  t.emit({
378
377
  event: "heartbeat",
@@ -382,7 +381,7 @@ const he = (t) => {
382
381
  return {
383
382
  stop: () => clearInterval(s)
384
383
  };
385
- }, q = "site-crawl", De = "Browser support is disabled. Call init({ browser: true }) to enable.", $e = (t, a) => {
384
+ }, q = "site-crawl", Ee = "Browser support is disabled. Call init({ browser: true }) to enable.", Re = (t, a) => {
386
385
  const e = a.summary(), s = t.map((n) => `${new URL(n.url).pathname} — ${n.meta.title || "(no title)"} [${n.links.length} links, ${n.forms.length} forms, ${n.buttons.length} buttons]`);
387
386
  return [
388
387
  `Crawled ${e.visited} pages, ${e.pending} pending, ${e.skipped} skipped.`,
@@ -391,11 +390,11 @@ const he = (t) => {
391
390
  ...s.map((n) => ` ${n}`)
392
391
  ].join(`
393
392
  `);
394
- }, Le = (t, a, e) => {
393
+ }, Te = (t, a, e) => {
395
394
  const s = [];
396
- for (const [n, i] of t) {
397
- const o = i.slice(0, 5).map((c) => ` ${c.url}`), r = i.length > 5 ? ` ... and ${i.length - 5} more` : "";
398
- s.push(` ${n} (${i.length} URLs):`), s.push(...o), r && s.push(r);
395
+ for (const [n, o] of t) {
396
+ const i = o.slice(0, 5).map((c) => ` ${c.url}`), r = o.length > 5 ? ` ... and ${o.length - 5} more` : "";
397
+ s.push(` ${n} (${o.length} URLs):`), s.push(...i), r && s.push(r);
399
398
  }
400
399
  return [
401
400
  "You are a site crawler deciding which URL branches to explore next.",
@@ -413,7 +412,7 @@ const he = (t) => {
413
412
  "Skip groups that are clearly non-functional (help/support, legal, marketing pages)."
414
413
  ].join(`
415
414
  `);
416
- }, Fe = Y("crawl_gate", {
415
+ }, De = Y("crawl_gate", {
417
416
  type: "object",
418
417
  properties: {
419
418
  decisions: {
@@ -440,12 +439,12 @@ const he = (t) => {
440
439
  },
441
440
  required: ["decisions"],
442
441
  additionalProperties: !1
443
- }), Ne = async (t, a, e, s) => {
442
+ }), $e = async (t, a, e, s) => {
444
443
  const n = t.pendingByPrefix(2);
445
444
  if (n.size === 0) return { explore: [], skip: [], decisions: [] };
446
- const i = $e(a, t), o = Le(n, i, e), c = (await U(o, {
445
+ const o = Re(a, t), i = Te(n, o, e), c = (await U(i, {
447
446
  ...s,
448
- response_format: Fe,
447
+ response_format: De,
449
448
  temperature: 0.2
450
449
  }))?.decisions || [], u = [], m = [];
451
450
  for (const h of c) {
@@ -461,37 +460,37 @@ const he = (t) => {
461
460
  for (const [h, l] of n)
462
461
  c.some((g) => g.prefix === h) || (u.push(l[0].url), l.length > 1 && m.push(...l.slice(1).map((g) => g.url)));
463
462
  return { explore: u, skip: m, decisions: c };
464
- }, Me = async (t, a, e, s, n, i) => {
463
+ }, Le = async (t, a, e, s, n, o) => {
465
464
  await t.goto(a, { waitUntil: "domcontentloaded", timeout: 3e4 }), await t.waitForTimeout(1500);
466
- const o = await ve(t);
465
+ const i = await we(t);
467
466
  if (n.screenshots) {
468
467
  const c = `${s.dir}/crawl-${Date.now()}.png`;
469
468
  if (await t.screenshot({ path: c, fullPage: !1 }), s.track(c), n.imageShrink) {
470
- const u = await le(c, {
469
+ const u = await ie(c, {
471
470
  ...n.imageShrink,
472
471
  outputDir: s.dir
473
472
  });
474
- s.track(u.path), o.screenshot = u.path;
473
+ s.track(u.path), i.screenshot = u.path;
475
474
  } else
476
- o.screenshot = c;
475
+ i.screenshot = c;
477
476
  }
478
477
  const r = e.responses();
479
- return o.apis = r.filter((c) => {
478
+ return i.apis = r.filter((c) => {
480
479
  const u = c.url();
481
480
  return u.includes("/api/") || u.includes("/v1/") || u.includes("/v2/") || u.includes("/graphql");
482
481
  }).map((c) => ({
483
482
  url: c.url(),
484
483
  status: c.status(),
485
484
  method: c.request().method()
486
- })), e.clear(), o;
487
- }, _e = (t) => {
485
+ })), e.clear(), i;
486
+ }, Fe = (t) => {
488
487
  const a = {};
489
488
  for (const e of t) {
490
489
  const s = e.links.filter((n) => n.isSameDomain && !n.isAnchor).map((n) => n.href);
491
490
  a[e.url] = [...new Set(s)];
492
491
  }
493
492
  return a;
494
- }, Be = (t) => {
493
+ }, Me = (t) => {
495
494
  const a = /* @__PURE__ */ new Map();
496
495
  for (const e of t)
497
496
  for (const s of e.apis || []) {
@@ -499,11 +498,11 @@ const he = (t) => {
499
498
  a.has(n) ? a.get(n).seenOn.push(e.url) : a.set(n, { ...s, seenOn: [e.url] });
500
499
  }
501
500
  return [...a.values()];
502
- }, It = async (t, a = {}) => {
503
- if (!oe()) throw new Error(De);
501
+ }, St = async (t, a = {}) => {
502
+ if (!re()) throw new Error(Ee);
504
503
  const e = $(q, a), s = L(q, e.onProgress, e);
505
504
  s.start();
506
- const n = await K(e, {
505
+ const n = await X(e, {
507
506
  maxPages: 20,
508
507
  maxDepth: 5,
509
508
  sameDomain: !0,
@@ -511,12 +510,12 @@ const he = (t) => {
511
510
  headless: !0,
512
511
  screenshots: !1,
513
512
  errorPosture: "resilient",
514
- imageShrink: B(ge),
513
+ imageShrink: B(de),
515
514
  heartbeatInterval: 1e3
516
- }), i = { ...Z, ...e.cooldown }, o = e.isBlocked || ke, r = Ce(t, {
515
+ }), o = { ...Z, ...e.cooldown }, i = e.isBlocked || ve, r = xe(t, {
517
516
  sameDomain: n.sameDomain,
518
517
  maxDepth: n.maxDepth
519
- }), c = await ce("site-crawl", e.outputDir), m = await (e.browserEngine ? z[e.browserEngine] : z.chromium).launch({
518
+ }), c = await oe("site-crawl", e.outputDir), m = await (e.browserEngine ? j[e.browserEngine] : j.chromium).launch({
520
519
  headless: n.headless,
521
520
  ...e.launchOptions
522
521
  });
@@ -537,7 +536,7 @@ const he = (t) => {
537
536
  };
538
537
  })(), g = [];
539
538
  let v = 0, C = t;
540
- const P = Ee(s, n.heartbeatInterval, () => ({
539
+ const P = Pe(s, n.heartbeatInterval, () => ({
541
540
  pagesVisited: g.length,
542
541
  maxPages: n.maxPages,
543
542
  pending: r.size(),
@@ -549,7 +548,7 @@ const he = (t) => {
549
548
  if (g.length > 0 && g.length % n.gateInterval === 0 && r.size() > 0) {
550
549
  const y = n.maxPages - g.length;
551
550
  s.emit({ event: "gate:start", pending: r.size(), budget: y });
552
- const f = await Ne(r, g, y, e);
551
+ const f = await $e(r, g, y, e);
553
552
  v++, f.skip.length > 0 && r.skip(f.skip, "llm-gate"), s.emit({
554
553
  event: "gate:complete",
555
554
  explored: f.explore.length,
@@ -567,13 +566,13 @@ const he = (t) => {
567
566
  maxPages: n.maxPages
568
567
  });
569
568
  try {
570
- const y = (w, N) => Me(w, N, d, c, n, s), { pageData: f, blocked: S } = await Te(
569
+ const y = (w, M) => Le(w, M, d, c, n, s), { pageData: f, blocked: S } = await Ae(
571
570
  y,
572
571
  l,
573
572
  p.url,
574
573
  s,
575
- i,
576
574
  o,
575
+ i,
577
576
  n.heartbeatInterval
578
577
  );
579
578
  f.depth = p.depth, f.source = p.source, S && (f.blocked = S), g.push(f);
@@ -607,9 +606,9 @@ const he = (t) => {
607
606
  s.emit({ event: "teardown" });
608
607
  }
609
608
  await h.close();
610
- const j = _e(g), F = Be(g), b = {
609
+ const z = Fe(g), F = Me(g), b = {
611
610
  pages: g,
612
- graph: j,
611
+ graph: z,
613
612
  apis: F,
614
613
  frontier: r.summary(),
615
614
  skipped: r.skippedUrls(),
@@ -628,11 +627,11 @@ const he = (t) => {
628
627
  } finally {
629
628
  await m.close();
630
629
  }
631
- }, ee = 1, T = 20, E = 5, Ue = 0.5, Oe = 5, V = 8e3, _ = 5, D = {
630
+ }, ee = 1, R = 20, T = 5, Ne = 0.5, _e = 5, V = 8e3, _ = 5, D = {
632
631
  INDIVIDUAL: "individual",
633
632
  BULK: "bulk"
634
- }, je = (t) => t === void 0 ? T : typeof t == "number" ? t : { small: 10, med: T, large: 40 }[t] ?? T, ze = (t) => t === void 0 ? E : typeof t == "number" ? t : { low: 2, med: E, high: 10 }[t] ?? E;
635
- function qe(t, a) {
633
+ }, Be = (t) => t === void 0 ? R : typeof t == "number" ? t : { small: 10, med: R, large: 40 }[t] ?? R, Ue = (t) => t === void 0 ? T : typeof t == "number" ? t : { low: 2, med: T, high: 10 }[t] ?? T;
634
+ function Oe(t, a) {
636
635
  const e = [];
637
636
  for (let s = 0; s < t.length; s += a)
638
637
  e.push({
@@ -642,7 +641,7 @@ function qe(t, a) {
642
641
  });
643
642
  return e;
644
643
  }
645
- function W(t, a, e, s, n, i) {
644
+ function W(t, a, e, s, n, o) {
646
645
  return {
647
646
  chunkIndex: t.index,
648
647
  totalChunks: a,
@@ -651,64 +650,64 @@ function W(t, a, e, s, n, i) {
651
650
  status: s,
652
651
  bulkSize: n.bulkSize,
653
652
  maxConcurrency: n.maxConcurrency,
654
- processingMode: i,
653
+ processingMode: o,
655
654
  parallelMode: !0
656
655
  };
657
656
  }
658
- async function Ve(t, a, e, s, n, i = {}) {
657
+ async function ze(t, a, e, s, n, o = {}) {
659
658
  try {
660
- const o = e.map((m) => ae(m(t))).filter(Boolean).join(`
659
+ const i = e.map((m) => ae(m(t))).filter(Boolean).join(`
661
660
 
662
- `), r = [a, o].filter(Boolean).join(`
661
+ `), r = [a, i].filter(Boolean).join(`
663
662
 
664
- `), c = tt(r, t, s, n === "files"), u = await U(c, {
665
- ...i,
663
+ `), c = Qe(r, t, s, n === "files"), u = await U(c, {
664
+ ...o,
666
665
  response_format: {
667
666
  type: "json_schema",
668
667
  json_schema: {
669
668
  name: "arch_result",
670
- schema: Qe
669
+ schema: Ke
671
670
  }
672
671
  }
673
672
  });
674
673
  return { item: t, ...u, error: void 0 };
675
- } catch (o) {
676
- return { item: t, passed: !1, reason: `Analysis failed: ${o.message}`, error: o };
674
+ } catch (i) {
675
+ return { item: t, passed: !1, reason: `Analysis failed: ${i.message}`, error: i };
677
676
  }
678
677
  }
679
- function We(t, a, e, s) {
680
- const n = [], i = [];
681
- let o = s;
678
+ function je(t, a, e, s) {
679
+ const n = [], o = [];
680
+ let i = s;
682
681
  for (const r of t)
683
- if (n.push(r), r.passed || (o++, i.push(r.error || new Error(r.reason))), !a && o >= e)
682
+ if (n.push(r), r.passed || (i++, o.push(r.error || new Error(r.reason))), !a && i >= e)
684
683
  break;
685
684
  return {
686
685
  results: n,
687
- errors: i,
688
- failures: o,
689
- shouldStop: !a && o >= e
686
+ errors: o,
687
+ failures: i,
688
+ shouldStop: !a && i >= e
690
689
  };
691
690
  }
692
691
  function A(t, a, e, s) {
693
692
  t && t(a, e, s);
694
693
  }
695
- async function te(t, a, e, s, n, i = {}) {
694
+ async function te(t, a, e, s, n, o = {}) {
696
695
  A(s, t, void 0, {
697
696
  ...n,
698
697
  status: k.start
699
698
  });
700
699
  try {
701
- const o = st(a, t, e), r = {
702
- ...i,
700
+ const i = Ze(a, t, e), r = {
701
+ ...o,
703
702
  responseFormat: {
704
703
  type: "json_schema",
705
704
  json_schema: {
706
705
  name: "arch_bulk_result",
707
- schema: Ze
706
+ schema: Xe
708
707
  }
709
708
  },
710
- onProgress: Q(i.onProgress, "reduce")
711
- }, c = await ue(t, o, r), u = c.results || c;
709
+ onProgress: Q(o.onProgress, "reduce")
710
+ }, c = await ce(t, i, r), u = c.results || c;
712
711
  let m = [];
713
712
  Array.isArray(u) ? m = u : m = t.map((d) => ({
714
713
  path: d,
@@ -727,34 +726,34 @@ async function te(t, a, e, s, n, i = {}) {
727
726
  failed: h
728
727
  }
729
728
  ), m;
730
- } catch (o) {
729
+ } catch (i) {
731
730
  const r = t.map((c) => ({
732
731
  path: c,
733
732
  passed: !1,
734
- reason: `Processing error: ${o.message}`
733
+ reason: `Processing error: ${i.message}`
735
734
  }));
736
- return A(s, t, o, {
735
+ return A(s, t, i, {
737
736
  ...n,
738
737
  status: k.error
739
738
  }), r;
740
739
  }
741
740
  }
742
- function Ge(t, a) {
743
- const e = a.filter((r) => r.passed).length, s = a.length - e, n = s === 0, i = a.length < t.length, o = a.filter((r) => !r.passed);
741
+ function qe(t, a) {
742
+ const e = a.filter((r) => r.passed).length, s = a.length - e, n = s === 0, o = a.length < t.length, i = a.filter((r) => !r.passed);
744
743
  return {
745
744
  passed: e,
746
745
  failed: s,
747
746
  allPassed: n,
748
- stoppedEarly: i,
749
- failures: o,
747
+ stoppedEarly: o,
748
+ failures: i,
750
749
  total: t.length,
751
750
  processed: a.length
752
751
  };
753
752
  }
754
- function He(t, a, e) {
753
+ function Ve(t, a, e) {
755
754
  if (t.allPassed)
756
755
  return `All ${t.processed}/${t.total} items satisfy: ${a}`;
757
- const s = t.failures.slice(0, _).map((i) => ` • ${i.item}: ${i.reason || "Failed"}`).join(`
756
+ const s = t.failures.slice(0, _).map((o) => ` • ${o.item}: ${o.reason || "Failed"}`).join(`
758
757
  `), n = t.failures.length > _ ? `
759
758
  ... and ${t.failures.length - _} more failures` : "";
760
759
  return `${t.failed}/${t.processed} items failed: ${a}${t.stoppedEarly && e !== ee ? ` (stopped after ${e} failures)` : ""}
@@ -762,7 +761,7 @@ function He(t, a, e) {
762
761
  Failures:
763
762
  ${s}${n}`;
764
763
  }
765
- function Je(t, a) {
764
+ function We(t, a) {
766
765
  return {
767
766
  passed: t.allPassed,
768
767
  message: a,
@@ -775,14 +774,14 @@ function Je(t, a) {
775
774
  }
776
775
  };
777
776
  }
778
- function Xe(t, a, e, s) {
779
- const n = a || e.length > 0 || s <= Oe;
777
+ function Ge(t, a, e, s) {
778
+ const n = a || e.length > 0 || s <= _e;
780
779
  return {
781
780
  mode: n ? D.INDIVIDUAL : D.BULK,
782
781
  batchSize: n ? t.maxConcurrency : t.bulkSize,
783
- processor: n ? (i, o, r) => se(i, o, r) : (i, o, r) => te(
784
- i.items,
785
- o,
782
+ processor: n ? (o, i, r) => se(o, i, r) : (o, i, r) => te(
783
+ o.items,
784
+ i,
786
785
  r.description,
787
786
  r.onProgress,
788
787
  r.metadata
@@ -791,7 +790,7 @@ function Xe(t, a, e, s) {
791
790
  }
792
791
  async function se(t, a, e) {
793
792
  const s = t.items.map(
794
- (n) => Ve(
793
+ (n) => ze(
795
794
  n,
796
795
  a,
797
796
  e.itemContextFns,
@@ -802,9 +801,9 @@ async function se(t, a, e) {
802
801
  );
803
802
  return await Promise.all(s);
804
803
  }
805
- function Ke(t, a, e) {
804
+ function He(t, a, e) {
806
805
  if (a === D.INDIVIDUAL) {
807
- const { results: s, errors: n, failures: i, shouldStop: o } = We(
806
+ const { results: s, errors: n, failures: o, shouldStop: i } = je(
808
807
  t,
809
808
  e.isCoverageTest,
810
809
  e.maxFailures,
@@ -813,8 +812,8 @@ function Ke(t, a, e) {
813
812
  return {
814
813
  results: s,
815
814
  errors: n,
816
- failures: i,
817
- shouldStop: o,
815
+ failures: o,
816
+ shouldStop: i,
818
817
  progressData: {
819
818
  passed: s.filter((r) => r.passed).length,
820
819
  failed: n.length
@@ -838,11 +837,11 @@ function Ke(t, a, e) {
838
837
  };
839
838
  }
840
839
  }
841
- async function Ye(t, a, e, s) {
842
- const n = qe(t, e.batchSize), i = [];
843
- let o = 0;
840
+ async function Je(t, a, e, s) {
841
+ const n = Oe(t, e.batchSize), o = [];
842
+ let i = 0;
844
843
  for (const r of n) {
845
- if (!s.isCoverageTest && o >= s.maxFailures)
844
+ if (!s.isCoverageTest && i >= s.maxFailures)
846
845
  break;
847
846
  const c = W(
848
847
  r,
@@ -866,11 +865,11 @@ async function Ye(t, a, e, s) {
866
865
  c,
867
866
  s.runConfig
868
867
  );
869
- const m = Ke(u, e.mode, {
868
+ const m = He(u, e.mode, {
870
869
  ...s,
871
- currentFailures: o
870
+ currentFailures: i
872
871
  });
873
- if (i.push(...m.results), o = m.failures, A(
872
+ if (o.push(...m.results), i = m.failures, A(
874
873
  s.onChunkProcessed,
875
874
  r.items,
876
875
  m.errors.length > 0 ? m.errors[0] : void 0,
@@ -888,16 +887,16 @@ async function Ye(t, a, e, s) {
888
887
  ), m.shouldStop)
889
888
  break;
890
889
  }
891
- return i;
890
+ return o;
892
891
  }
893
- const Qe = {
892
+ const Ke = {
894
893
  type: "object",
895
894
  properties: {
896
895
  passed: { type: "boolean" },
897
896
  reason: { type: "string" }
898
897
  },
899
898
  required: ["passed", "reason"]
900
- }, Ze = {
899
+ }, Xe = {
901
900
  type: "object",
902
901
  properties: {
903
902
  results: {
@@ -938,7 +937,7 @@ ${a}
938
937
  return "";
939
938
  }
940
939
  }
941
- function et(t) {
940
+ function Ye(t) {
942
941
  if (!I.existsSync(t)) return "Item does not exist";
943
942
  if (I.statSync(t).isDirectory())
944
943
  return I.readdirSync(t).join(", ");
@@ -948,8 +947,8 @@ function et(t) {
948
947
  ... (truncated)` : e;
949
948
  }
950
949
  }
951
- function tt(t, a, e, s) {
952
- const n = et(a);
950
+ function Qe(t, a, e, s) {
951
+ const n = Ye(a);
953
952
  return `${t}
954
953
  Analyze this ${s ? "file" : "directory"}: ${a}
955
954
 
@@ -960,16 +959,16 @@ Does it satisfy: "${e}"?
960
959
 
961
960
  Return JSON with "passed" (boolean) and "reason" (string).`;
962
961
  }
963
- function st(t, a, e) {
962
+ function Ze(t, a, e) {
964
963
  return `${t}
965
964
  Analyze each item and determine if it satisfies: "${e}"
966
965
  Items: ${a.join(", ")}
967
966
 
968
967
  Return JSON with "results" array containing objects with "path", "passed" (boolean), and "reason" (string).`;
969
968
  }
970
- class at {
969
+ class et {
971
970
  constructor(a, e = {}) {
972
- this.target = a, this.options = e, this.contexts = [], this.itemContextFns = [], this.maxFailures = e.maxFailures || ee, this.bulkSize = e.bulkSize || T, this.maxConcurrency = e.maxConcurrency || E, this.onChunkProcessed = void 0, this.description = void 0, this.threshold = void 0, this.isCoverageTest = !1;
971
+ this.target = a, this.options = e, this.contexts = [], this.itemContextFns = [], this.maxFailures = e.maxFailures || ee, this.bulkSize = e.bulkSize || R, this.maxConcurrency = e.maxConcurrency || T, this.onChunkProcessed = void 0, this.description = void 0, this.threshold = void 0, this.isCoverageTest = !1;
973
972
  }
974
973
  withContext(a) {
975
974
  return this.contexts.push(a), this;
@@ -982,7 +981,7 @@ class at {
982
981
  return this.description = a, this;
983
982
  }
984
983
  // Set up for a coverage test
985
- coverage(a = Ue) {
984
+ coverage(a = Ne) {
986
985
  return this.threshold = a, this.isCoverageTest = !0, this;
987
986
  }
988
987
  // Start processing - this is the fluent terminator
@@ -994,17 +993,17 @@ class at {
994
993
  throw new Error("Must call satisfies() before start()");
995
994
  const s = await this.target.resolve(), n = this.contexts.map(ae).filter(Boolean).join(`
996
995
 
997
- `), i = Xe(
996
+ `), o = Ge(
998
997
  this,
999
998
  this.onChunkProcessed,
1000
999
  this.itemContextFns,
1001
1000
  s.length
1002
- ), { bulkSize: o, maxConcurrency: r, maxFailures: c } = await K(a, {
1003
- bulkSize: B(je),
1004
- maxConcurrency: B(ze),
1001
+ ), { bulkSize: i, maxConcurrency: r, maxFailures: c } = await X(a, {
1002
+ bulkSize: B(Be),
1003
+ maxConcurrency: B(Ue),
1005
1004
  maxFailures: this.maxFailures
1006
1005
  }), u = {
1007
- bulkSize: o,
1006
+ bulkSize: i,
1008
1007
  maxConcurrency: r,
1009
1008
  description: this.description,
1010
1009
  onChunkProcessed: this.onChunkProcessed,
@@ -1013,7 +1012,7 @@ class at {
1013
1012
  maxFailures: c,
1014
1013
  isCoverageTest: this.isCoverageTest,
1015
1014
  runConfig: a
1016
- }, m = e.batch(s.length), h = await Ye(s, n, i, u);
1015
+ }, m = e.batch(s.length), h = await Je(s, n, o, u);
1017
1016
  if (m(h.length), this.isCoverageTest) {
1018
1017
  const d = h.filter((P) => P.passed).length, g = s.length > 0 ? d / s.length : 0, v = g >= this.threshold, C = `Coverage: ${d}/${s.length} (${(g * 100).toFixed(1)}%) - ${v ? "meets" : "below"} ${(this.threshold * 100).toFixed(1)}% threshold`;
1019
1018
  if (!v)
@@ -1027,16 +1026,16 @@ class at {
1027
1026
  }
1028
1027
  }
1029
1028
  summarize(a, e) {
1030
- const s = Ge(a, e), n = He(s, this.description, this.maxFailures);
1029
+ const s = qe(a, e), n = Ve(s, this.description, this.maxFailures);
1031
1030
  if (!s.allPassed)
1032
1031
  throw new Error(n);
1033
- return Je(s, n);
1032
+ return We(s, n);
1034
1033
  }
1035
1034
  }
1036
- function Ct(t, a = {}) {
1037
- return new at(t, a);
1035
+ function xt(t, a = {}) {
1036
+ return new et(t, a);
1038
1037
  }
1039
- function kt() {
1038
+ function vt() {
1040
1039
  return console.warn("scanJS is not available in browser environment"), Promise.resolve({});
1041
1040
  }
1042
1041
  const G = {
@@ -1061,13 +1060,13 @@ const G = {
1061
1060
  additionalProperties: !1
1062
1061
  }
1063
1062
  }, H = "test";
1064
- async function nt(t, a, e = {}) {
1063
+ async function tt(t, a, e = {}) {
1065
1064
  const s = $(H, e), n = L(H, s.onProgress, s);
1066
1065
  n.start();
1067
1066
  try {
1068
- const i = await me.readFile(t, "utf-8"), o = `Analyze this code and ${a}:
1067
+ const o = await pe.readFile(t, "utf-8"), i = `Analyze this code and ${a}:
1069
1068
 
1070
- ${pe(i, { tag: "code-to-analyze" })}
1069
+ ${le(o, { tag: "code-to-analyze" })}
1071
1070
 
1072
1071
  Return a JSON object with:
1073
1072
  - "hasIssues": boolean indicating if any issues were found
@@ -1078,8 +1077,8 @@ GUIDELINES:
1078
1077
  - Provide specific line numbers or code references when possible
1079
1078
  - Suggest concrete fixes for each issue identified
1080
1079
  - Be concise but clear in your feedback
1081
- - If no issues are found, return {"hasIssues": false, "issues": []}`, r = await de(
1082
- () => U(o, {
1080
+ - If no issues are found, return {"hasIssues": false, "issues": []}`, r = await ue(
1081
+ () => U(i, {
1083
1082
  ...s,
1084
1083
  response_format: Y(G.name, G.schema)
1085
1084
  }),
@@ -1089,285 +1088,291 @@ GUIDELINES:
1089
1088
  }
1090
1089
  ), c = r.hasIssues ? r.issues : [];
1091
1090
  return n.complete({ outcome: "success" }), c;
1092
- } catch (i) {
1093
- throw n.error(i), i;
1091
+ } catch (o) {
1092
+ throw n.error(o), o;
1094
1093
  }
1095
1094
  }
1096
- const J = "test-advice", rt = "Run the code with 5 boundary value test cases and report any that fail", it = "Identify 5 passing scenarios and significant boundary conditions in this code. Provide minimal input examples for each scenario to demonstrate correctness.", ot = "Identify 5 failing scenarios and significant boundary conditions in this code. Provide minimal input examples for each scenario to demonstrate the failure. Assume DBC, and don't complain when types are specified in jsDoc.", ct = "Identify 5 defects in this code. Provide minimal input examples to demonstrate each defect.", lt = "Suggest 5 best practices improvements for this code.", ut = 'Suggest 5 "clean code" improvements for this code.', pt = "Identify 5 specific issues related to code quality, readability, and maintainability.", dt = "Suggest 5 refactors that would most improve the composibility of this code.", X = [
1095
+ const J = "test-advice", st = "Run the code with 5 boundary value test cases and report any that fail", at = "Identify 5 passing scenarios and significant boundary conditions in this code. Provide minimal input examples for each scenario to demonstrate correctness.", nt = "Identify 5 failing scenarios and significant boundary conditions in this code. Provide minimal input examples for each scenario to demonstrate the failure. Assume DBC, and don't complain when types are specified in jsDoc.", rt = "Identify 5 defects in this code. Provide minimal input examples to demonstrate each defect.", ot = "Suggest 5 best practices improvements for this code.", it = 'Suggest 5 "clean code" improvements for this code.', ct = "Identify 5 specific issues related to code quality, readability, and maintainability.", lt = "Suggest 5 refactors that would most improve the composibility of this code.", K = [
1096
+ st,
1097
+ at,
1098
+ nt,
1097
1099
  rt,
1098
- it,
1099
1100
  ot,
1101
+ it,
1100
1102
  ct,
1101
- lt,
1102
- ut,
1103
- pt,
1104
- dt
1103
+ lt
1105
1104
  ];
1106
- async function At(t, a = {}) {
1105
+ async function It(t, a = {}) {
1107
1106
  const e = $(J, a), s = L(J, e.onProgress, e);
1108
1107
  s.start();
1109
1108
  try {
1110
- const n = s.batch(X.length), i = [];
1111
- for (const o of X) {
1112
- const r = await nt(t, o, {
1109
+ const n = s.batch(K.length), o = [];
1110
+ for (const i of K) {
1111
+ const r = await tt(t, i, {
1113
1112
  ...e,
1114
1113
  onProgress: Q(e.onProgress, "test-advice:test")
1115
1114
  });
1116
- i.push(...r), n(1);
1115
+ o.push(...r), n(1);
1117
1116
  }
1118
- return s.complete({ outcome: "success", totalIssues: i.length }), i;
1117
+ return s.complete({ outcome: "success", totalIssues: o.length }), o;
1119
1118
  } catch (n) {
1120
1119
  throw s.error(n), n;
1121
1120
  }
1122
1121
  }
1123
1122
  ne.config();
1124
- try {
1125
- he(JSON.parse(re(ie(process.cwd(), ".verblets.json"), "utf8")));
1126
- } catch {
1127
- }
1128
1123
  export {
1129
- Tt as CAPABILITY_KEYS,
1130
- Et as COMPLIANCE,
1131
- Dt as CONTEXT_KINDS,
1132
- $t as COST_POSTURE,
1133
- Lt as Conversation,
1134
- Ft as DOMAIN,
1135
- Nt as ENVIRONMENT,
1136
- Mt as ListStyle,
1137
- _t as QUALITY_INTENT,
1138
- Bt as SocraticMethod,
1139
- Ut as SummaryMap,
1140
- Ot as TimedAbortController,
1141
- Ct as aiArchExpect,
1142
- jt as aiExpect,
1143
- zt as analyzeImage,
1144
- qt as analyzeImageMapDetail,
1145
- Vt as anySignal,
1146
- Wt as applyAllTargetingRules,
1147
- Gt as applyCalibrate,
1148
- Ht as applyEntities,
1149
- Jt as applyFirstTargetingRule,
1150
- Xt as applyRelations,
1151
- Kt as applyScale,
1152
- Yt as applyScore,
1153
- Qt as applyTags,
1154
- Zt as auto,
1155
- es as bool,
1156
- ts as buildSeedGenerationPrompt,
1157
- ss as buildVisionPrompt,
1158
- as as calculateStatistics,
1159
- ns as calibrate,
1160
- rs as calibrateSpec,
1161
- is as categorySamples,
1162
- os as causalFramePrompt,
1163
- cs as centralTendency,
1164
- ls as centralTendencyLines,
1165
- us as chunk,
1166
- ps as chunkSentences,
1167
- ds as classify,
1168
- ms as cleanupPaths,
1169
- hs as collectTerms,
1170
- gs as combinations,
1171
- fs as commonalities,
1172
- bs as compact,
1173
- ys as computeTagStatistics,
1174
- ws as config,
1175
- Ss as constants,
1176
- xs as conversationTurnReduce,
1177
- vs as cosineSimilarity,
1178
- Is as createBatches,
1179
- Cs as createCalibratedClassifier,
1180
- ks as createContextBuilder,
1181
- As as createEntityExtractor,
1124
+ At as CAPABILITY_KEYS,
1125
+ Pt as COMPLIANCE,
1126
+ Et as CONTEXT_KINDS,
1127
+ Rt as COST_POSTURE,
1128
+ Tt as ChainEvent,
1129
+ Dt as Conversation,
1130
+ $t as DOMAIN,
1131
+ Lt as DomainEvent,
1132
+ Ft as ENVIRONMENT,
1133
+ Mt as Kind,
1134
+ Nt as Level,
1135
+ _t as ListStyle,
1136
+ Bt as MODEL_KEYS,
1137
+ Ut as ModelService,
1138
+ Ot as ModelSource,
1139
+ k as OpEvent,
1140
+ zt as OptionSource,
1141
+ jt as QUALITY_INTENT,
1142
+ qt as SocraticMethod,
1143
+ Vt as StatusCode,
1144
+ Wt as SummaryMap,
1145
+ Gt as TelemetryEvent,
1146
+ Ht as TimedAbortController,
1147
+ xt as aiArchExpect,
1148
+ Jt as aiExpect,
1149
+ Kt as analyzeImage,
1150
+ Xt as analyzeImageMapDetail,
1151
+ Yt as anySignal,
1152
+ Qt as applyAllTargetingRules,
1153
+ Zt as applyCalibrate,
1154
+ es as applyEntities,
1155
+ ts as applyFirstTargetingRule,
1156
+ ss as applyRelations,
1157
+ as as applyScale,
1158
+ ns as applyScore,
1159
+ rs as applyTags,
1160
+ os as auto,
1161
+ is as bool,
1162
+ cs as buildSeedGenerationPrompt,
1163
+ ls as buildVisionPrompt,
1164
+ us as calculateStatistics,
1165
+ ps as calibrate,
1166
+ ds as calibrateSpec,
1167
+ ms as categorySamples,
1168
+ hs as causalFramePrompt,
1169
+ gs as centralTendency,
1170
+ fs as centralTendencyLines,
1171
+ bs as chunk,
1172
+ ys as chunkSentences,
1173
+ ws as classify,
1174
+ Ss as cleanupPaths,
1175
+ xs as collectTerms,
1176
+ vs as combinations,
1177
+ Is as commonalities,
1178
+ Cs as compact,
1179
+ ks as computeTagStatistics,
1180
+ As as config,
1181
+ Ps as constants,
1182
+ Es as conversationTurnReduce,
1183
+ Rs as cosineSimilarity,
1184
+ Ts as createBatches,
1185
+ Ds as createCalibratedClassifier,
1186
+ $s as createContextBuilder,
1187
+ Ls as createEntityExtractor,
1182
1188
  L as createProgressEmitter,
1183
- Ps as createRelationExtractor,
1184
- Rs as createScale,
1185
- Ts as createTagExtractor,
1186
- Es as createTagger,
1187
- ce as createTempDir,
1188
- Ds as createTraceCollector,
1189
- $s as date,
1190
- Ls as debug,
1189
+ Fs as createRelationExtractor,
1190
+ Ms as createScale,
1191
+ Ns as createTagExtractor,
1192
+ _s as createTagger,
1193
+ oe as createTempDir,
1194
+ Bs as createTraceCollector,
1195
+ Us as date,
1196
+ Os as debug,
1191
1197
  U as default,
1192
- Fs as descriptorToSchema,
1193
- Ns as detectPatterns,
1194
- Ms as detectThreshold,
1195
- _s as determineStyle,
1196
- Bs as disambiguate,
1197
- Us as dismantle,
1198
- Os as dismantleFactory,
1199
- js as documentShrink,
1200
- zs as embed,
1201
- qs as embedAssembleSpan,
1202
- Vs as embedBatch,
1203
- Ws as embedBuildIndex,
1204
- Gs as embedChunked,
1205
- Hs as embedMergeRanges,
1206
- Js as embedMultiQuery,
1207
- Xs as embedNeighborChunks,
1208
- Ks as embedNormalizeText,
1209
- Ys as embedRewriteQuery,
1210
- Qs as embedRewriteToOutputDoc,
1211
- Zs as embedScore,
1212
- ea as embedStandaloneSpan,
1213
- ta as embedStepBack,
1214
- sa as embedSubquestions,
1215
- aa as embedWarmup,
1216
- na as entities,
1217
- ra as entitiesFilterInstructions,
1218
- ia as entitiesFindInstructions,
1219
- oa as entitiesGroupInstructions,
1220
- ca as entitiesMapInstructions,
1221
- la as entitiesReduceInstructions,
1222
- ua as entitySpec,
1223
- pa as evaluateTargetingClause,
1224
- da as evaluateTargetingRule,
1225
- ma as eventToTrace,
1226
- ha as expect,
1227
- ga as extractBlocks,
1228
- ye as extractButtons,
1229
- be as extractForms,
1230
- fa as extractJson,
1231
- fe as extractLinks,
1232
- Se as extractMeta,
1233
- ve as extractPage,
1234
- we as extractScripts,
1235
- xe as extractStructure,
1236
- ba as fillMissing,
1237
- ya as filter,
1238
- wa as filterAmbiguous,
1239
- Sa as find,
1240
- xa as generateList,
1241
- va as getCapabilities,
1242
- Ia as getMeanings,
1243
- Ca as getOption,
1244
- ka as getOptionDetail,
1245
- K as getOptions,
1246
- Aa as glossary,
1247
- Pa as group,
1248
- xt as imageToBase64,
1249
- Ra as init,
1250
- Ta as intent,
1251
- Ea as intersections,
1252
- Da as join,
1253
- $a as last,
1254
- La as list,
1255
- Fa as listBatch,
1256
- Na as listExpand,
1198
+ zs as descriptorToSchema,
1199
+ js as detectPatterns,
1200
+ qs as detectThreshold,
1201
+ Vs as determineStyle,
1202
+ Ws as disambiguate,
1203
+ Gs as dismantle,
1204
+ Hs as dismantleFactory,
1205
+ Js as documentShrink,
1206
+ Ks as embed,
1207
+ Xs as embedAssembleSpan,
1208
+ Ys as embedBatch,
1209
+ Qs as embedBuildIndex,
1210
+ Zs as embedChunked,
1211
+ ea as embedMergeRanges,
1212
+ ta as embedMultiQuery,
1213
+ sa as embedNeighborChunks,
1214
+ aa as embedNormalizeText,
1215
+ na as embedRewriteQuery,
1216
+ ra as embedRewriteToOutputDoc,
1217
+ oa as embedScore,
1218
+ ia as embedStandaloneSpan,
1219
+ ca as embedStepBack,
1220
+ la as embedSubquestions,
1221
+ ua as embedWarmup,
1222
+ pa as entities,
1223
+ da as entitiesFilterInstructions,
1224
+ ma as entitiesFindInstructions,
1225
+ ha as entitiesGroupInstructions,
1226
+ ga as entitiesMapInstructions,
1227
+ fa as entitiesReduceInstructions,
1228
+ ba as entitySpec,
1229
+ ya as evaluateTargetingClause,
1230
+ wa as evaluateTargetingRule,
1231
+ Sa as eventToTrace,
1232
+ xa as expect,
1233
+ va as extractBlocks,
1234
+ ge as extractButtons,
1235
+ he as extractForms,
1236
+ Ia as extractJson,
1237
+ me as extractLinks,
1238
+ be as extractMeta,
1239
+ we as extractPage,
1240
+ fe as extractScripts,
1241
+ ye as extractStructure,
1242
+ Ca as fillMissing,
1243
+ ka as filter,
1244
+ Aa as filterAmbiguous,
1245
+ Pa as find,
1246
+ Ea as generateList,
1247
+ Ra as getMeanings,
1248
+ Ta as getOption,
1249
+ Da as getOptionDetail,
1250
+ X as getOptions,
1251
+ $a as glossary,
1252
+ La as group,
1253
+ yt as imageToBase64,
1254
+ Fa as init,
1255
+ Ma as intent,
1256
+ Na as intersections,
1257
+ _a as join,
1258
+ Y as jsonSchema,
1259
+ Ba as last,
1260
+ Ua as list,
1261
+ Oa as listBatch,
1262
+ za as listExpand,
1257
1263
  U as llm,
1258
- Ma as llmLogger,
1259
- _a as makePrompt,
1260
- Ba as map,
1261
- ge as mapImageShrink,
1262
- Ua as name,
1263
- Oa as nameSimilarTo,
1264
+ ja as llmLogger,
1265
+ qa as makePrompt,
1266
+ Va as map,
1267
+ de as mapImageShrink,
1268
+ Wa as name,
1269
+ Ga as nameSimilarTo,
1264
1270
  $ as nameStep,
1265
- ja as normalizeLlm,
1266
- za as number,
1267
- qa as numberWithUnits,
1268
- Va as observeApplication,
1269
- Wa as observeProviders,
1270
- Ga as omit,
1271
- Ha as parallel,
1272
- Ja as parallelMap,
1273
- Xa as parseLLMList,
1274
- Ka as parseRDFLiteral,
1275
- Ya as parseRelations,
1276
- Qa as people,
1277
- Za as phailForge,
1278
- en as pick,
1279
- tn as pipe,
1280
- sn as popReference,
1281
- an as probeScan,
1282
- nn as promptCache,
1283
- rn as promptPiece,
1284
- on as prompts,
1285
- cn as questions,
1286
- ln as rangeCombinations,
1287
- ue as reduce,
1288
- un as relationSpec,
1289
- pn as relations,
1290
- dn as relationsFilterInstructions,
1291
- mn as relationsFindInstructions,
1292
- hn as relationsGroupInstructions,
1293
- gn as relationsMapInstructions,
1294
- fn as relationsReduceInstructions,
1295
- wt as resizeImage,
1296
- bn as resolveModel,
1297
- yn as resolveOutputDir,
1298
- de as retry,
1299
- wn as ringBuffer,
1300
- Sn as scale,
1301
- xn as scaleFilterInstructions,
1302
- vn as scaleFindInstructions,
1303
- In as scaleGroupInstructions,
1304
- Cn as scaleMapInstructions,
1305
- kn as scaleReduceInstructions,
1306
- An as scaleSpec,
1307
- kt as scanJS,
1308
- Pn as schemaOrg,
1309
- Rn as schemas,
1310
- Tn as scientificFramingPrompt,
1271
+ Ha as normalizeLlm,
1272
+ Ja as number,
1273
+ Ka as numberWithUnits,
1274
+ Xa as observeApplication,
1275
+ Ya as observeProviders,
1276
+ Qa as omit,
1277
+ Za as parallel,
1278
+ en as parallelMap,
1279
+ tn as parseLLMList,
1280
+ sn as parseRDFLiteral,
1281
+ an as parseRelations,
1282
+ nn as people,
1283
+ rn as phailForge,
1284
+ on as pick,
1285
+ cn as pipe,
1286
+ ln as popReference,
1287
+ un as probeScan,
1288
+ pn as promptCache,
1289
+ dn as promptPiece,
1290
+ mn as prompts,
1291
+ hn as questions,
1292
+ gn as rangeCombinations,
1293
+ ce as reduce,
1294
+ fn as relationSpec,
1295
+ bn as relations,
1296
+ yn as relationsFilterInstructions,
1297
+ wn as relationsFindInstructions,
1298
+ Sn as relationsGroupInstructions,
1299
+ xn as relationsMapInstructions,
1300
+ vn as relationsReduceInstructions,
1301
+ ft as resizeImage,
1302
+ In as resolveModel,
1303
+ Cn as resolveOutputDir,
1304
+ ue as retry,
1305
+ kn as ringBuffer,
1306
+ An as scale,
1307
+ Pn as scaleFilterInstructions,
1308
+ En as scaleFindInstructions,
1309
+ Rn as scaleGroupInstructions,
1310
+ Tn as scaleMapInstructions,
1311
+ Dn as scaleReduceInstructions,
1312
+ $n as scaleSpec,
1313
+ vt as scanJS,
1314
+ Ln as schemaOrg,
1315
+ Fn as schemas,
1316
+ Mn as scientificFramingPrompt,
1311
1317
  Q as scopePhase,
1312
- En as score,
1313
- Dn as scoreFilterInstructions,
1314
- $n as scoreFindInstructions,
1315
- Ln as scoreGroupInstructions,
1316
- Fn as scoreItem,
1317
- Nn as scoreMapInstructions,
1318
- Mn as scoreReduceInstructions,
1319
- _n as scoreSpec,
1320
- Bn as sentiment,
1321
- Un as services,
1322
- On as setEmbedEnabled,
1323
- jn as setImageProcessingEnabled,
1324
- zn as setInterval,
1325
- qn as shuffle,
1326
- Vn as simplifyTree,
1327
- It as siteCrawl,
1328
- Wn as socratic,
1329
- Gn as softCoverPrompt,
1330
- Hn as sort,
1331
- Jn as sortBy,
1332
- Xn as split,
1333
- Kn as stripNumeric,
1334
- Yn as stripResponse,
1335
- Qn as suggestTargetingRules,
1336
- Zn as tagSpec,
1337
- er as tagVocabulary,
1338
- tr as tags,
1339
- sr as tagsFilterInstructions,
1340
- ar as tagsFindInstructions,
1341
- nr as tagsGroupInstructions,
1342
- rr as tagsMapInstructions,
1343
- ir as tagsReduceInstructions,
1344
- or as targetingClause,
1345
- cr as targetingRule,
1346
- lr as targetingRuleOps,
1347
- ur as targetingRuleSchema,
1348
- pr as templateReplace,
1349
- nt as test,
1350
- At as testAdvice,
1351
- dr as themes,
1352
- St as tileImages,
1353
- mr as timeline,
1354
- hr as toBool,
1355
- gr as toDate,
1356
- fr as toEnum,
1357
- br as toNumber,
1358
- yr as toNumberWithUnits,
1359
- wr as toObject,
1360
- Sr as truncate,
1361
- xr as unionBy,
1362
- vr as validateTargetingRules,
1363
- Ir as valueArbitrate,
1364
- Cr as vectorSearch,
1365
- kr as veiledVariantStrategies,
1366
- Ar as veiledVariants,
1367
- Pr as version,
1368
- vt as webScrape,
1369
- Rr as windowFor,
1370
- Tr as withInactivityTimeout,
1318
+ Nn as score,
1319
+ _n as scoreFilterInstructions,
1320
+ Bn as scoreFindInstructions,
1321
+ Un as scoreGroupInstructions,
1322
+ On as scoreItem,
1323
+ zn as scoreMapInstructions,
1324
+ jn as scoreReduceInstructions,
1325
+ qn as scoreSpec,
1326
+ Vn as sentiment,
1327
+ Wn as setEmbedEnabled,
1328
+ Gn as setImageProcessingEnabled,
1329
+ Hn as setInterval,
1330
+ Jn as shuffle,
1331
+ Kn as simplifyTree,
1332
+ St as siteCrawl,
1333
+ Xn as socratic,
1334
+ Yn as softCoverPrompt,
1335
+ Qn as sort,
1336
+ Zn as sortBy,
1337
+ er as split,
1338
+ tr as stripNumeric,
1339
+ sr as stripResponse,
1340
+ ar as suggestTargetingRules,
1341
+ nr as tagSpec,
1342
+ rr as tagVocabulary,
1343
+ or as tags,
1344
+ ir as tagsFilterInstructions,
1345
+ cr as tagsFindInstructions,
1346
+ lr as tagsGroupInstructions,
1347
+ ur as tagsMapInstructions,
1348
+ pr as tagsReduceInstructions,
1349
+ dr as targetingClause,
1350
+ mr as targetingRule,
1351
+ hr as targetingRuleOps,
1352
+ gr as targetingRuleSchema,
1353
+ fr as templateReplace,
1354
+ tt as test,
1355
+ It as testAdvice,
1356
+ br as themes,
1357
+ bt as tileImages,
1358
+ yr as timeline,
1359
+ wr as toBool,
1360
+ Sr as toDate,
1361
+ xr as toEnum,
1362
+ vr as toNumber,
1363
+ Ir as toNumberWithUnits,
1364
+ Cr as toObject,
1365
+ kr as truncate,
1366
+ Ar as unionBy,
1367
+ Pr as validateTargetingRules,
1368
+ Er as valueArbitrate,
1369
+ Rr as vectorSearch,
1370
+ Tr as veiledVariantStrategies,
1371
+ Dr as veiledVariants,
1372
+ $r as version,
1373
+ wt as webScrape,
1374
+ Lr as windowFor,
1375
+ Fr as withInactivityTimeout,
1371
1376
  B as withPolicy,
1372
- Er as zipWith
1377
+ Mr as zipWith
1373
1378
  };