@far-world-labs/verblets 0.4.0 → 0.5.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.
- package/README.md +33 -25
- package/dist/index.browser.js +212 -208
- package/dist/index.js +386 -381
- package/dist/{shared-CMgpfDG4.js → shared-C2_d1bKV.js} +4825 -4737
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import p, { readFileSync as
|
|
1
|
+
import P from "dotenv";
|
|
2
|
+
import p, { readFileSync as F } from "node:fs";
|
|
3
3
|
import { resolve as x } from "node:path";
|
|
4
|
-
import { r as
|
|
5
|
-
import {
|
|
4
|
+
import { r as A, a as E, n as $, c as O, b as D, d as N, j as L } from "./shared-C2_d1bKV.js";
|
|
5
|
+
import { cz as Ee, F as Te, C as Re, G as we, aQ as ve, D as Pe, E as Fe, ao as xe, Q as Ae, bg as $e, bj as Oe, c1 as De, bx as Ne, c0 as Le, $ as Me, A as ke, a8 as _e, _ as Be, b6 as je, o as Ue, au as ze, aE as Ge, bv as Je, f as Ve, aN as qe, a5 as We, y as He, z as Xe, aM as Ke, bt as Ye, a1 as Qe, a2 as Ze, ch as es, bW as ss, i as as, aO as ts, bU as rs, aP as ns, ci as is, bl as os, cB as cs, e as ls, aR as us, cj as ds, bY as ps, B as ms, H as hs, a9 as fs, b7 as bs, p as gs, aF as ys, aG as Ss, R as Is, g as Cs, bX as Es, O as Ts, a3 as Rs, a4 as ws, ap as vs, aS as Ps, aU as Fs, aW as xs, aX as As, bD as $s, bS as Os, bE as Ds, bQ as Ns, bF as Ls, bR as Ms, bK as ks, bP as _s, bO as Bs, bJ as js, bN as Us, bI as zs, bT as Gs, bL as Js, bM as Vs, bG as qs, a6 as Ws, ab as Hs, ad as Xs, ae as Ks, aa as Ys, ac as Qs, a7 as Zs, Y as ea, Z as sa, S as aa, bw as ta, af as ra, c8 as na, aY as ia, ag as oa, aZ as ca, ah as la, am as ua, cy as da, aT as pa, K as ma, L as ha, M as fa, ai as ba, aj as ga, cA as ya, by as Sa, ak as Ia, a_ as Ca, ck as Ea, al as Ta, an as Ra, aq as wa, bz as va, bA as Pa, ar as Fa, a$ as xa, b0 as Aa, bZ as $a, h as Oa, k as Da, I as Na, J as La, cl as Ma, b_ as ka, b$ as _a, cg as Ba, b8 as ja, b9 as Ua, b1 as za, bA as Ga, cm as Ja, cs as Va, b2 as qa, x as Wa, cv as Ha, cw as Xa, ct as Ka, b3 as Ya, bV as Qa, b5 as Za, b4 as et, bb as st, bd as at, be as tt, ba as rt, bc as nt, cx as it, c3 as ot, l as ct, t as lt, v as ut, w as dt, q as pt, u as mt, m as ht, bf as ft, cu as bt, bs as gt, c4 as yt, as as St, ax as It, az as Ct, aA as Et, av as Tt, aw as Rt, ay as wt, at as vt, bB as Pt, s as Ft, bH as xt, bC as At, cr as $t, aV as Ot, bh as Dt, bu as Nt, aB as Lt, cn as Mt, bi as kt, ca as _t, c9 as Bt, a0 as jt, aD as Ut, bk as zt, aC as Gt, aI as Jt, aK as Vt, aL as qt, aH as Wt, aJ as Ht, U as Xt, V as Kt, T as Yt, X as Qt, c2 as Zt, bm as er, bn as sr, cb as ar, cd as tr, ce as rr, cc as nr, cf as ir, bo as or, bp as cr, co as lr, W as ur, P as dr, cp as pr, br as mr, bq as hr, c5 as fr, c6 as br, c7 as gr, N as yr, cq as Sr } from "./shared-C2_d1bKV.js";
|
|
6
6
|
import "glob";
|
|
7
|
-
import
|
|
8
|
-
const
|
|
9
|
-
},
|
|
7
|
+
import M from "node:fs/promises";
|
|
8
|
+
const k = (e) => {
|
|
9
|
+
}, T = 1, _ = 20, B = 5, j = 0.5, U = 5, y = 8e3, g = 5, f = {
|
|
10
10
|
INDIVIDUAL: "individual",
|
|
11
11
|
BULK: "bulk"
|
|
12
12
|
}, m = {
|
|
@@ -14,89 +14,89 @@ const D = (e) => {
|
|
|
14
14
|
COMPLETED: "completed",
|
|
15
15
|
ERROR: "error"
|
|
16
16
|
};
|
|
17
|
-
function
|
|
18
|
-
const
|
|
19
|
-
for (let
|
|
20
|
-
|
|
21
|
-
items: e.slice(
|
|
22
|
-
index: Math.floor(
|
|
23
|
-
startIndex:
|
|
17
|
+
function z(e, s) {
|
|
18
|
+
const t = [];
|
|
19
|
+
for (let a = 0; a < e.length; a += s)
|
|
20
|
+
t.push({
|
|
21
|
+
items: e.slice(a, a + s),
|
|
22
|
+
index: Math.floor(a / s) + 1,
|
|
23
|
+
startIndex: a
|
|
24
24
|
});
|
|
25
|
-
return
|
|
25
|
+
return t;
|
|
26
26
|
}
|
|
27
|
-
function S(e, s,
|
|
27
|
+
function S(e, s, t, a, r, i) {
|
|
28
28
|
return {
|
|
29
29
|
chunkIndex: e.index,
|
|
30
30
|
totalChunks: s,
|
|
31
31
|
itemsInChunk: e.items.length,
|
|
32
|
-
totalItems:
|
|
33
|
-
status:
|
|
32
|
+
totalItems: t,
|
|
33
|
+
status: a,
|
|
34
34
|
bulkSize: r.bulkSize,
|
|
35
35
|
maxConcurrency: r.maxConcurrency,
|
|
36
|
-
processingMode:
|
|
36
|
+
processingMode: i,
|
|
37
37
|
parallelMode: !0
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
async function
|
|
40
|
+
async function G(e, s, t, a, r) {
|
|
41
41
|
try {
|
|
42
|
-
const
|
|
42
|
+
const i = t.map((l) => v(l(e))).filter(Boolean).join(`
|
|
43
43
|
|
|
44
|
-
`), o = [s,
|
|
44
|
+
`), o = [s, i].filter(Boolean).join(`
|
|
45
45
|
|
|
46
|
-
`),
|
|
46
|
+
`), n = ee(o, e, a, r === "files"), c = await E(n, {
|
|
47
47
|
response_format: {
|
|
48
48
|
type: "json_schema",
|
|
49
49
|
json_schema: {
|
|
50
50
|
name: "arch_result",
|
|
51
|
-
schema:
|
|
51
|
+
schema: Y
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
return { item: e, ...c, error: void 0 };
|
|
56
|
-
} catch (
|
|
57
|
-
return { item: e, passed: !1, reason: `Analysis failed: ${
|
|
56
|
+
} catch (i) {
|
|
57
|
+
return { item: e, passed: !1, reason: `Analysis failed: ${i.message}`, error: i };
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
const r = [],
|
|
62
|
-
let o =
|
|
63
|
-
for (const
|
|
64
|
-
if (r.push(
|
|
60
|
+
function J(e, s, t, a) {
|
|
61
|
+
const r = [], i = [];
|
|
62
|
+
let o = a;
|
|
63
|
+
for (const n of e)
|
|
64
|
+
if (r.push(n), n.passed || (o++, i.push(n.error || new Error(n.reason))), !s && o >= t)
|
|
65
65
|
break;
|
|
66
66
|
return {
|
|
67
67
|
results: r,
|
|
68
|
-
errors:
|
|
68
|
+
errors: i,
|
|
69
69
|
failures: o,
|
|
70
|
-
shouldStop: !s && o >=
|
|
70
|
+
shouldStop: !s && o >= t
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
function h(e, s,
|
|
74
|
-
e && e(s,
|
|
73
|
+
function h(e, s, t, a) {
|
|
74
|
+
e && e(s, t, a);
|
|
75
75
|
}
|
|
76
|
-
async function
|
|
77
|
-
h(
|
|
76
|
+
async function R(e, s, t, a, r) {
|
|
77
|
+
h(a, e, void 0, {
|
|
78
78
|
...r,
|
|
79
79
|
status: m.PROCESSING
|
|
80
80
|
});
|
|
81
81
|
try {
|
|
82
|
-
const
|
|
82
|
+
const i = se(s, e, t), o = await A(e, i, {
|
|
83
83
|
responseFormat: {
|
|
84
84
|
type: "json_schema",
|
|
85
85
|
json_schema: {
|
|
86
86
|
name: "arch_bulk_result",
|
|
87
|
-
schema:
|
|
87
|
+
schema: Q
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
}),
|
|
90
|
+
}), n = o.results || o;
|
|
91
91
|
let c = [];
|
|
92
|
-
Array.isArray(
|
|
93
|
-
path:
|
|
92
|
+
Array.isArray(n) ? c = n : c = e.map((b) => ({
|
|
93
|
+
path: b,
|
|
94
94
|
passed: !1,
|
|
95
95
|
reason: "Invalid response format"
|
|
96
96
|
}));
|
|
97
|
-
const l = c.filter((
|
|
97
|
+
const l = c.filter((b) => !b.passed).length, u = c.length - l;
|
|
98
98
|
return h(
|
|
99
|
-
|
|
99
|
+
a,
|
|
100
100
|
e,
|
|
101
101
|
l > 0 ? new Error(`${l} items failed`) : void 0,
|
|
102
102
|
{
|
|
@@ -106,42 +106,42 @@ async function P(e, s, a, t, r) {
|
|
|
106
106
|
failed: l
|
|
107
107
|
}
|
|
108
108
|
), c;
|
|
109
|
-
} catch (
|
|
110
|
-
const o = e.map((
|
|
111
|
-
path:
|
|
109
|
+
} catch (i) {
|
|
110
|
+
const o = e.map((n) => ({
|
|
111
|
+
path: n,
|
|
112
112
|
passed: !1,
|
|
113
|
-
reason: `Processing error: ${
|
|
113
|
+
reason: `Processing error: ${i.message}`
|
|
114
114
|
}));
|
|
115
|
-
return h(
|
|
115
|
+
return h(a, e, i, {
|
|
116
116
|
...r,
|
|
117
117
|
status: m.ERROR
|
|
118
118
|
}), o;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
const
|
|
121
|
+
function V(e, s) {
|
|
122
|
+
const t = s.filter((n) => n.passed).length, a = s.length - t, r = a === 0, i = s.length < e.length, o = s.filter((n) => !n.passed);
|
|
123
123
|
return {
|
|
124
|
-
passed:
|
|
125
|
-
failed:
|
|
124
|
+
passed: t,
|
|
125
|
+
failed: a,
|
|
126
126
|
allPassed: r,
|
|
127
|
-
stoppedEarly:
|
|
127
|
+
stoppedEarly: i,
|
|
128
128
|
failures: o,
|
|
129
129
|
total: e.length,
|
|
130
130
|
processed: s.length
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function q(e, s, t) {
|
|
134
134
|
if (e.allPassed)
|
|
135
135
|
return `All ${e.processed}/${e.total} items satisfy: ${s}`;
|
|
136
|
-
const
|
|
137
|
-
`), r = e.failures.length >
|
|
138
|
-
... and ${e.failures.length -
|
|
139
|
-
return `${e.failed}/${e.processed} items failed: ${s}${e.stoppedEarly &&
|
|
136
|
+
const a = e.failures.slice(0, g).map((i) => ` • ${i.item}: ${i.reason || "Failed"}`).join(`
|
|
137
|
+
`), r = e.failures.length > g ? `
|
|
138
|
+
... and ${e.failures.length - g} more failures` : "";
|
|
139
|
+
return `${e.failed}/${e.processed} items failed: ${s}${e.stoppedEarly && t !== T ? ` (stopped after ${t} failures)` : ""}
|
|
140
140
|
|
|
141
141
|
Failures:
|
|
142
|
-
${
|
|
142
|
+
${a}${r}`;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function W(e, s) {
|
|
145
145
|
return {
|
|
146
146
|
passed: e.allPassed,
|
|
147
147
|
message: s,
|
|
@@ -154,127 +154,127 @@ function V(e, s) {
|
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
const r = s ||
|
|
157
|
+
function H(e, s, t, a) {
|
|
158
|
+
const r = s || t.length > 0 || a <= U;
|
|
159
159
|
return {
|
|
160
|
-
mode: r ?
|
|
160
|
+
mode: r ? f.INDIVIDUAL : f.BULK,
|
|
161
161
|
batchSize: r ? e.maxConcurrency : e.bulkSize,
|
|
162
|
-
processor: r ? (
|
|
163
|
-
|
|
162
|
+
processor: r ? (i, o, n) => w(i, o, n) : (i, o, n) => R(
|
|
163
|
+
i.items,
|
|
164
164
|
o,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
n.description,
|
|
166
|
+
n.onProgress,
|
|
167
|
+
n.metadata
|
|
168
168
|
)
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
async function w(e, s,
|
|
172
|
-
const
|
|
173
|
-
(r) =>
|
|
171
|
+
async function w(e, s, t) {
|
|
172
|
+
const a = e.items.map(
|
|
173
|
+
(r) => G(
|
|
174
174
|
r,
|
|
175
175
|
s,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
t.itemContextFns,
|
|
177
|
+
t.description,
|
|
178
|
+
t.targetType
|
|
179
179
|
)
|
|
180
180
|
);
|
|
181
|
-
return await Promise.all(
|
|
181
|
+
return await Promise.all(a);
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
if (s ===
|
|
185
|
-
const { results:
|
|
183
|
+
function X(e, s, t) {
|
|
184
|
+
if (s === f.INDIVIDUAL) {
|
|
185
|
+
const { results: a, errors: r, failures: i, shouldStop: o } = J(
|
|
186
186
|
e,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
t.isCoverageTest,
|
|
188
|
+
t.maxFailures,
|
|
189
|
+
t.currentFailures || 0
|
|
190
190
|
);
|
|
191
191
|
return {
|
|
192
|
-
results:
|
|
192
|
+
results: a,
|
|
193
193
|
errors: r,
|
|
194
|
-
failures:
|
|
194
|
+
failures: i,
|
|
195
195
|
shouldStop: o,
|
|
196
196
|
progressData: {
|
|
197
|
-
passed:
|
|
197
|
+
passed: a.filter((n) => n.passed).length,
|
|
198
198
|
failed: r.length
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
201
|
} else {
|
|
202
|
-
const
|
|
202
|
+
const a = e.map((r) => ({
|
|
203
203
|
item: r.path,
|
|
204
204
|
passed: r.passed,
|
|
205
205
|
reason: r.reason
|
|
206
206
|
}));
|
|
207
207
|
return {
|
|
208
|
-
results:
|
|
208
|
+
results: a,
|
|
209
209
|
errors: [],
|
|
210
|
-
failures:
|
|
210
|
+
failures: t.currentFailures || 0,
|
|
211
211
|
shouldStop: !1,
|
|
212
212
|
progressData: {
|
|
213
|
-
passed:
|
|
214
|
-
failed:
|
|
213
|
+
passed: a.filter((r) => r.passed).length,
|
|
214
|
+
failed: a.filter((r) => !r.passed).length
|
|
215
215
|
}
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
async function
|
|
220
|
-
const r =
|
|
219
|
+
async function K(e, s, t, a) {
|
|
220
|
+
const r = z(e, t.batchSize), i = [];
|
|
221
221
|
let o = 0;
|
|
222
|
-
for (const
|
|
223
|
-
if (!
|
|
222
|
+
for (const n of r) {
|
|
223
|
+
if (!a.isCoverageTest && o >= a.maxFailures)
|
|
224
224
|
break;
|
|
225
225
|
const c = S(
|
|
226
|
-
|
|
226
|
+
n,
|
|
227
227
|
r.length,
|
|
228
228
|
e.length,
|
|
229
229
|
m.PROCESSING,
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
a,
|
|
231
|
+
t.mode
|
|
232
232
|
);
|
|
233
|
-
h(
|
|
233
|
+
h(a.onChunkProcessed, n.items, void 0, c);
|
|
234
234
|
let l;
|
|
235
|
-
|
|
236
|
-
itemContextFns:
|
|
237
|
-
description:
|
|
238
|
-
targetType:
|
|
239
|
-
}) : l = await
|
|
240
|
-
|
|
235
|
+
t.mode === f.INDIVIDUAL ? l = await w(n, s, {
|
|
236
|
+
itemContextFns: a.itemContextFns,
|
|
237
|
+
description: a.description,
|
|
238
|
+
targetType: a.targetType
|
|
239
|
+
}) : l = await R(
|
|
240
|
+
n.items,
|
|
241
241
|
s,
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
a.description,
|
|
243
|
+
a.onChunkProcessed,
|
|
244
244
|
c
|
|
245
245
|
);
|
|
246
|
-
const u =
|
|
247
|
-
...
|
|
246
|
+
const u = X(l, t.mode, {
|
|
247
|
+
...a,
|
|
248
248
|
currentFailures: o
|
|
249
249
|
});
|
|
250
|
-
if (
|
|
251
|
-
|
|
252
|
-
|
|
250
|
+
if (i.push(...u.results), o = u.failures, h(
|
|
251
|
+
a.onChunkProcessed,
|
|
252
|
+
n.items,
|
|
253
253
|
u.errors.length > 0 ? u.errors[0] : void 0,
|
|
254
254
|
{
|
|
255
255
|
...S(
|
|
256
|
-
|
|
256
|
+
n,
|
|
257
257
|
r.length,
|
|
258
258
|
e.length,
|
|
259
259
|
m.COMPLETED,
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
a,
|
|
261
|
+
t.mode
|
|
262
262
|
),
|
|
263
263
|
...u.progressData
|
|
264
264
|
}
|
|
265
265
|
), u.shouldStop)
|
|
266
266
|
break;
|
|
267
267
|
}
|
|
268
|
-
return
|
|
268
|
+
return i;
|
|
269
269
|
}
|
|
270
|
-
const
|
|
270
|
+
const Y = {
|
|
271
271
|
type: "object",
|
|
272
272
|
properties: {
|
|
273
273
|
passed: { type: "boolean" },
|
|
274
274
|
reason: { type: "string" }
|
|
275
275
|
},
|
|
276
276
|
required: ["passed", "reason"]
|
|
277
|
-
},
|
|
277
|
+
}, Q = {
|
|
278
278
|
type: "object",
|
|
279
279
|
properties: {
|
|
280
280
|
results: {
|
|
@@ -292,7 +292,7 @@ const X = {
|
|
|
292
292
|
},
|
|
293
293
|
required: ["results"]
|
|
294
294
|
};
|
|
295
|
-
function
|
|
295
|
+
function v(e) {
|
|
296
296
|
switch (e.type) {
|
|
297
297
|
case "file":
|
|
298
298
|
return p.existsSync(e.filePath) ? `<${e.name}>
|
|
@@ -315,38 +315,38 @@ ${s}
|
|
|
315
315
|
return "";
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function Z(e) {
|
|
319
319
|
if (!p.existsSync(e)) return "Item does not exist";
|
|
320
320
|
if (p.statSync(e).isDirectory())
|
|
321
321
|
return p.readdirSync(e).join(", ");
|
|
322
322
|
{
|
|
323
|
-
const
|
|
324
|
-
return
|
|
325
|
-
... (truncated)` :
|
|
323
|
+
const t = p.readFileSync(e, "utf8");
|
|
324
|
+
return t.length > y ? `${t.substring(0, y)}
|
|
325
|
+
... (truncated)` : t;
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
function
|
|
329
|
-
const r =
|
|
328
|
+
function ee(e, s, t, a) {
|
|
329
|
+
const r = Z(s);
|
|
330
330
|
return `${e}
|
|
331
|
-
Analyze this ${
|
|
331
|
+
Analyze this ${a ? "file" : "directory"}: ${s}
|
|
332
332
|
|
|
333
333
|
Content:
|
|
334
334
|
${r}
|
|
335
335
|
|
|
336
|
-
Does it satisfy: "${
|
|
336
|
+
Does it satisfy: "${t}"?
|
|
337
337
|
|
|
338
338
|
Return JSON with "passed" (boolean) and "reason" (string).`;
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function se(e, s, t) {
|
|
341
341
|
return `${e}
|
|
342
|
-
Analyze each item and determine if it satisfies: "${
|
|
342
|
+
Analyze each item and determine if it satisfies: "${t}"
|
|
343
343
|
Items: ${s.join(", ")}
|
|
344
344
|
|
|
345
345
|
Return JSON with "results" array containing objects with "path", "passed" (boolean), and "reason" (string).`;
|
|
346
346
|
}
|
|
347
|
-
class
|
|
348
|
-
constructor(s,
|
|
349
|
-
this.target = s, this.contexts = [], this.itemContextFns = [], this.maxFailures =
|
|
347
|
+
class ae {
|
|
348
|
+
constructor(s, t = {}) {
|
|
349
|
+
this.target = s, this.contexts = [], this.itemContextFns = [], this.maxFailures = t.maxFailures || T, this.bulkSize = t.bulkSize || _, this.maxConcurrency = t.maxConcurrency || B, this.onChunkProcessed = void 0, this.description = void 0, this.threshold = void 0, this.isCoverageTest = !1;
|
|
350
350
|
}
|
|
351
351
|
withContext(s) {
|
|
352
352
|
return this.contexts.push(s), this;
|
|
@@ -359,16 +359,16 @@ class ee {
|
|
|
359
359
|
return this.description = s, this;
|
|
360
360
|
}
|
|
361
361
|
// Set up for a coverage test
|
|
362
|
-
coverage(s =
|
|
362
|
+
coverage(s = j) {
|
|
363
363
|
return this.threshold = s, this.isCoverageTest = !0, this;
|
|
364
364
|
}
|
|
365
365
|
// Start processing - this is the fluent terminator
|
|
366
366
|
async start() {
|
|
367
367
|
if (!this.description)
|
|
368
368
|
throw new Error("Must call satisfies() before start()");
|
|
369
|
-
const s = await this.target.resolve(),
|
|
369
|
+
const s = await this.target.resolve(), t = this.contexts.map(v).filter(Boolean).join(`
|
|
370
370
|
|
|
371
|
-
`),
|
|
371
|
+
`), a = H(
|
|
372
372
|
this,
|
|
373
373
|
this.onChunkProcessed,
|
|
374
374
|
this.itemContextFns,
|
|
@@ -382,26 +382,26 @@ class ee {
|
|
|
382
382
|
targetType: this.target.type,
|
|
383
383
|
maxFailures: this.maxFailures,
|
|
384
384
|
isCoverageTest: this.isCoverageTest
|
|
385
|
-
},
|
|
385
|
+
}, i = await K(s, t, a, r);
|
|
386
386
|
if (this.isCoverageTest) {
|
|
387
|
-
const o =
|
|
387
|
+
const o = i.filter((u) => u.passed).length, n = s.length > 0 ? o / s.length : 0, c = n >= this.threshold, l = `Coverage: ${o}/${s.length} (${(n * 100).toFixed(1)}%) - ${c ? "meets" : "below"} ${(this.threshold * 100).toFixed(1)}% threshold`;
|
|
388
388
|
if (!c)
|
|
389
389
|
throw new Error(l);
|
|
390
|
-
return { passed: c, coverage:
|
|
390
|
+
return { passed: c, coverage: n, message: l };
|
|
391
391
|
}
|
|
392
|
-
return this.summarize(s,
|
|
392
|
+
return this.summarize(s, i);
|
|
393
393
|
}
|
|
394
|
-
summarize(s,
|
|
395
|
-
const
|
|
396
|
-
if (!
|
|
394
|
+
summarize(s, t) {
|
|
395
|
+
const a = V(s, t), r = q(a, this.description, this.maxFailures);
|
|
396
|
+
if (!a.allPassed)
|
|
397
397
|
throw new Error(r);
|
|
398
|
-
return
|
|
398
|
+
return W(a, r);
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
|
-
function
|
|
402
|
-
return new
|
|
401
|
+
function ge(e, s = {}) {
|
|
402
|
+
return new ae(e, s);
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function ye() {
|
|
405
405
|
return console.warn("scanJS is not available in browser environment"), Promise.resolve({});
|
|
406
406
|
}
|
|
407
407
|
const I = {
|
|
@@ -425,13 +425,14 @@ const I = {
|
|
|
425
425
|
required: ["hasIssues", "issues"],
|
|
426
426
|
additionalProperties: !1
|
|
427
427
|
}
|
|
428
|
-
};
|
|
429
|
-
async function d(e, s,
|
|
430
|
-
a = $(
|
|
428
|
+
}, C = "test";
|
|
429
|
+
async function d(e, s, t = {}) {
|
|
430
|
+
const a = $(C, t), r = O(C, a.onProgress, a);
|
|
431
|
+
r.start();
|
|
431
432
|
try {
|
|
432
|
-
const
|
|
433
|
+
const i = await M.readFile(e, "utf-8"), o = `Analyze this code and ${s}:
|
|
433
434
|
|
|
434
|
-
${
|
|
435
|
+
${D(i, { tag: "code-to-analyze" })}
|
|
435
436
|
|
|
436
437
|
Return a JSON object with:
|
|
437
438
|
- "hasIssues": boolean indicating if any issues were found
|
|
@@ -442,255 +443,259 @@ GUIDELINES:
|
|
|
442
443
|
- Provide specific line numbers or code references when possible
|
|
443
444
|
- Suggest concrete fixes for each issue identified
|
|
444
445
|
- Be concise but clear in your feedback
|
|
445
|
-
- If no issues are found, return {"hasIssues": false, "issues": []}`, n = await
|
|
446
|
-
() =>
|
|
446
|
+
- If no issues are found, return {"hasIssues": false, "issues": []}`, n = await N(
|
|
447
|
+
() => E(o, {
|
|
447
448
|
...a,
|
|
448
|
-
response_format:
|
|
449
|
+
response_format: L(I.name, I.schema)
|
|
449
450
|
}),
|
|
450
451
|
{
|
|
451
452
|
label: "test chain",
|
|
452
453
|
config: a
|
|
453
454
|
}
|
|
454
|
-
);
|
|
455
|
-
return
|
|
456
|
-
} catch (
|
|
457
|
-
return [`Error analyzing ${e}: ${
|
|
455
|
+
), c = n.hasIssues ? n.issues : [];
|
|
456
|
+
return r.complete(), c;
|
|
457
|
+
} catch (i) {
|
|
458
|
+
return [`Error analyzing ${e}: ${i.message}`];
|
|
458
459
|
}
|
|
459
460
|
}
|
|
460
|
-
const
|
|
461
|
-
...await d(e, se),
|
|
461
|
+
const te = "Run the code with 5 boundary value test cases and report any that fail", re = "Identify 5 passing scenarios and significant boundary conditions in this code. Provide minimal input examples for each scenario to demonstrate correctness.", ne = "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.", ie = "Identify 5 defects in this code. Provide minimal input examples to demonstrate each defect.", oe = "Suggest 5 best practices improvements for this code.", ce = 'Suggest 5 "clean code" improvements for this code.', le = "Identify 5 specific issues related to code quality, readability, and maintainability.", ue = "Suggest 5 refactors that would most improve the composibility of this code.", Se = async (e) => [
|
|
462
462
|
...await d(e, te),
|
|
463
|
-
...await d(e, ae),
|
|
464
463
|
...await d(e, re),
|
|
465
464
|
...await d(e, ne),
|
|
466
465
|
...await d(e, ie),
|
|
467
466
|
...await d(e, oe),
|
|
468
|
-
...await d(e, ce)
|
|
467
|
+
...await d(e, ce),
|
|
468
|
+
...await d(e, le),
|
|
469
|
+
...await d(e, ue)
|
|
469
470
|
];
|
|
470
|
-
|
|
471
|
+
P.config();
|
|
471
472
|
try {
|
|
472
|
-
|
|
473
|
+
k(JSON.parse(F(x(process.cwd(), ".verblets.json"), "utf8")));
|
|
473
474
|
} catch {
|
|
474
475
|
}
|
|
475
476
|
export {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
477
|
+
Ee as CAPABILITY_KEYS,
|
|
478
|
+
Te as COMPLIANCE,
|
|
479
|
+
Re as CONTEXT_KINDS,
|
|
480
|
+
we as COST_POSTURE,
|
|
481
|
+
ve as Conversation,
|
|
482
|
+
Pe as DOMAIN,
|
|
481
483
|
Fe as ENVIRONMENT,
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
ke as
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
$
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
484
|
+
xe as ListStyle,
|
|
485
|
+
Ae as QUALITY_INTENT,
|
|
486
|
+
$e as SocraticMethod,
|
|
487
|
+
Oe as SummaryMap,
|
|
488
|
+
De as TimedAbortController,
|
|
489
|
+
ge as aiArchExpect,
|
|
490
|
+
Ne as aiExpect,
|
|
491
|
+
Le as anySignal,
|
|
492
|
+
Me as applyAllTargetingRules,
|
|
493
|
+
ke as applyCalibrate,
|
|
494
|
+
_e as applyEntities,
|
|
495
|
+
Be as applyFirstTargetingRule,
|
|
496
|
+
je as applyRelations,
|
|
497
|
+
Ue as applyScale,
|
|
498
|
+
ze as applyScore,
|
|
499
|
+
Ge as applyTags,
|
|
500
|
+
Je as auto,
|
|
501
|
+
Ve as bool,
|
|
502
|
+
qe as buildSeedGenerationPrompt,
|
|
503
|
+
We as calculateStatistics,
|
|
504
|
+
He as calibrate,
|
|
505
|
+
Xe as calibrateSpec,
|
|
506
|
+
Ke as categorySamples,
|
|
507
|
+
Ye as causalFramePrompt,
|
|
508
|
+
Qe as centralTendency,
|
|
509
|
+
Ze as centralTendencyLines,
|
|
510
|
+
es as chunk,
|
|
511
|
+
ss as chunkSentences,
|
|
512
|
+
as as classify,
|
|
513
|
+
ts as collectTerms,
|
|
514
|
+
rs as combinations,
|
|
515
|
+
ns as commonalities,
|
|
516
|
+
is as compact,
|
|
517
|
+
os as computeTagStatistics,
|
|
518
|
+
cs as config,
|
|
519
|
+
ls as constants,
|
|
520
|
+
us as conversationTurnReduce,
|
|
521
|
+
ds as cosineSimilarity,
|
|
522
|
+
ps as createBatches,
|
|
523
|
+
ms as createCalibratedClassifier,
|
|
524
|
+
hs as createContextBuilder,
|
|
525
|
+
fs as createEntityExtractor,
|
|
526
|
+
O as createProgressEmitter,
|
|
527
|
+
bs as createRelationExtractor,
|
|
528
|
+
gs as createScale,
|
|
529
|
+
ys as createTagExtractor,
|
|
530
|
+
Ss as createTagger,
|
|
531
|
+
Is as createTraceCollector,
|
|
532
|
+
Cs as date,
|
|
533
|
+
Es as debug,
|
|
534
|
+
E as default,
|
|
535
|
+
Ts as descriptorToSchema,
|
|
536
|
+
Rs as detectPatterns,
|
|
537
|
+
ws as detectThreshold,
|
|
538
|
+
vs as determineStyle,
|
|
539
|
+
Ps as disambiguate,
|
|
540
|
+
Fs as dismantle,
|
|
541
|
+
xs as dismantleFactory,
|
|
542
|
+
As as documentShrink,
|
|
543
|
+
$s as embed,
|
|
544
|
+
Os as embedAssembleSpan,
|
|
545
|
+
Ds as embedBatch,
|
|
546
|
+
Ns as embedBuildIndex,
|
|
547
|
+
Ls as embedChunked,
|
|
548
|
+
Ms as embedMergeRanges,
|
|
549
|
+
ks as embedMultiQuery,
|
|
550
|
+
_s as embedNeighborChunks,
|
|
551
|
+
Bs as embedNormalizeText,
|
|
552
|
+
js as embedRewriteQuery,
|
|
553
|
+
Us as embedRewriteToOutputDoc,
|
|
554
|
+
zs as embedScore,
|
|
555
|
+
Gs as embedStandaloneSpan,
|
|
556
|
+
Js as embedStepBack,
|
|
557
|
+
Vs as embedSubquestions,
|
|
558
|
+
qs as embedWarmup,
|
|
559
|
+
Ws as entities,
|
|
560
|
+
Hs as entitiesFilterInstructions,
|
|
561
|
+
Xs as entitiesFindInstructions,
|
|
562
|
+
Ks as entitiesGroupInstructions,
|
|
563
|
+
Ys as entitiesMapInstructions,
|
|
564
|
+
Qs as entitiesReduceInstructions,
|
|
565
|
+
Zs as entitySpec,
|
|
566
|
+
ea as evaluateTargetingClause,
|
|
567
|
+
sa as evaluateTargetingRule,
|
|
568
|
+
aa as eventToTrace,
|
|
569
|
+
ta as expect,
|
|
570
|
+
ra as extractBlocks,
|
|
571
|
+
na as extractJson,
|
|
572
|
+
ia as fillMissing,
|
|
573
|
+
oa as filter,
|
|
574
|
+
ca as filterAmbiguous,
|
|
575
|
+
la as find,
|
|
576
|
+
ua as generateList,
|
|
577
|
+
da as getCapabilities,
|
|
578
|
+
pa as getMeanings,
|
|
579
|
+
ma as getOption,
|
|
580
|
+
ha as getOptionDetail,
|
|
581
|
+
fa as getOptions,
|
|
582
|
+
ba as glossary,
|
|
583
|
+
ga as group,
|
|
584
|
+
ya as init,
|
|
585
|
+
Sa as intent,
|
|
586
|
+
Ia as intersections,
|
|
587
|
+
Ca as join,
|
|
588
|
+
Ea as last,
|
|
589
|
+
Ta as list,
|
|
590
|
+
Ra as listBatch,
|
|
591
|
+
wa as listExpand,
|
|
592
|
+
E as llm,
|
|
593
|
+
va as llmLogger,
|
|
594
|
+
Pa as makePrompt,
|
|
595
|
+
Fa as map,
|
|
596
|
+
xa as name,
|
|
597
|
+
Aa as nameSimilarTo,
|
|
598
|
+
$ as nameStep,
|
|
599
|
+
$a as normalizeLlm,
|
|
600
|
+
Oa as number,
|
|
601
|
+
Da as numberWithUnits,
|
|
602
|
+
Na as observeApplication,
|
|
603
|
+
La as observeProviders,
|
|
604
|
+
Ma as omit,
|
|
605
|
+
ka as parallel,
|
|
606
|
+
_a as parallelMap,
|
|
607
|
+
Ba as parseLLMList,
|
|
608
|
+
ja as parseRDFLiteral,
|
|
609
|
+
Ua as parseRelations,
|
|
610
|
+
za as people,
|
|
611
|
+
Ga as phailForge,
|
|
612
|
+
Ja as pick,
|
|
613
|
+
Va as pipe,
|
|
614
|
+
qa as popReference,
|
|
615
|
+
Wa as probeScan,
|
|
616
|
+
Ha as promptCache,
|
|
617
|
+
Xa as promptPiece,
|
|
618
|
+
Ka as prompts,
|
|
619
|
+
Ya as questions,
|
|
620
|
+
Qa as rangeCombinations,
|
|
621
|
+
A as reduce,
|
|
622
|
+
Za as relationSpec,
|
|
623
|
+
et as relations,
|
|
624
|
+
st as relationsFilterInstructions,
|
|
625
|
+
at as relationsFindInstructions,
|
|
626
|
+
tt as relationsGroupInstructions,
|
|
627
|
+
rt as relationsMapInstructions,
|
|
628
|
+
nt as relationsReduceInstructions,
|
|
629
|
+
it as resolveModel,
|
|
630
|
+
N as retry,
|
|
631
|
+
ot as ringBuffer,
|
|
632
|
+
ct as scale,
|
|
633
|
+
lt as scaleFilterInstructions,
|
|
634
|
+
ut as scaleFindInstructions,
|
|
635
|
+
dt as scaleGroupInstructions,
|
|
636
|
+
pt as scaleMapInstructions,
|
|
637
|
+
mt as scaleReduceInstructions,
|
|
638
|
+
ht as scaleSpec,
|
|
639
|
+
ye as scanJS,
|
|
640
|
+
ft as schemaOrg,
|
|
641
|
+
bt as schemas,
|
|
642
|
+
gt as scientificFramingPrompt,
|
|
643
|
+
yt as scopePhase,
|
|
644
|
+
St as score,
|
|
645
|
+
It as scoreFilterInstructions,
|
|
646
|
+
Ct as scoreFindInstructions,
|
|
647
|
+
Et as scoreGroupInstructions,
|
|
648
|
+
Tt as scoreItem,
|
|
649
|
+
Rt as scoreMapInstructions,
|
|
650
|
+
wt as scoreReduceInstructions,
|
|
651
|
+
vt as scoreSpec,
|
|
652
|
+
Pt as sentiment,
|
|
653
|
+
Ft as services,
|
|
654
|
+
xt as setEmbedEnabled,
|
|
655
|
+
At as setInterval,
|
|
656
|
+
$t as shuffle,
|
|
657
|
+
Ot as simplifyTree,
|
|
658
|
+
Dt as socratic,
|
|
659
|
+
Nt as softCoverPrompt,
|
|
660
|
+
Lt as sort,
|
|
661
|
+
Mt as sortBy,
|
|
662
|
+
kt as split,
|
|
663
|
+
_t as stripNumeric,
|
|
664
|
+
Bt as stripResponse,
|
|
665
|
+
jt as suggestTargetingRules,
|
|
666
|
+
Ut as tagSpec,
|
|
667
|
+
zt as tagVocabulary,
|
|
668
|
+
Gt as tags,
|
|
669
|
+
Jt as tagsFilterInstructions,
|
|
670
|
+
Vt as tagsFindInstructions,
|
|
671
|
+
qt as tagsGroupInstructions,
|
|
672
|
+
Wt as tagsMapInstructions,
|
|
673
|
+
Ht as tagsReduceInstructions,
|
|
674
|
+
Xt as targetingClause,
|
|
675
|
+
Kt as targetingRule,
|
|
676
|
+
Yt as targetingRuleOps,
|
|
677
|
+
Qt as targetingRuleSchema,
|
|
678
|
+
Zt as templateReplace,
|
|
676
679
|
d as test,
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
680
|
+
Se as testAdvice,
|
|
681
|
+
er as themes,
|
|
682
|
+
sr as timeline,
|
|
683
|
+
ar as toBool,
|
|
684
|
+
tr as toDate,
|
|
685
|
+
rr as toEnum,
|
|
686
|
+
nr as toNumber,
|
|
687
|
+
ir as toNumberWithUnits,
|
|
688
|
+
or as toObject,
|
|
689
|
+
cr as truncate,
|
|
690
|
+
lr as unionBy,
|
|
691
|
+
ur as validateTargetingRules,
|
|
692
|
+
dr as valueArbitrate,
|
|
693
|
+
pr as vectorSearch,
|
|
694
|
+
mr as veiledVariantStrategies,
|
|
695
|
+
hr as veiledVariants,
|
|
696
|
+
fr as version,
|
|
697
|
+
br as windowFor,
|
|
698
|
+
gr as withInactivityTimeout,
|
|
699
|
+
yr as withPolicy,
|
|
700
|
+
Sr as zipWith
|
|
696
701
|
};
|