@far-world-labs/verblets 0.3.2 → 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 +45 -25
- package/dist/index.browser.js +222 -71
- package/dist/index.js +435 -282
- package/dist/shared-C2_d1bKV.js +10802 -0
- package/package.json +9 -7
- package/dist/shared-C6kPWghF.js +0 -7806
package/dist/index.js
CHANGED
|
@@ -1,149 +1,147 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import "
|
|
1
|
+
import P from "dotenv";
|
|
2
|
+
import p, { readFileSync as F } from "node:fs";
|
|
3
|
+
import { resolve as x } from "node:path";
|
|
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";
|
|
5
6
|
import "glob";
|
|
6
|
-
import
|
|
7
|
-
const
|
|
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 = {
|
|
8
10
|
INDIVIDUAL: "individual",
|
|
9
11
|
BULK: "bulk"
|
|
10
|
-
},
|
|
12
|
+
}, m = {
|
|
11
13
|
PROCESSING: "processing",
|
|
12
14
|
COMPLETED: "completed",
|
|
13
15
|
ERROR: "error"
|
|
14
16
|
};
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
for (let
|
|
18
|
-
|
|
19
|
-
items: e.slice(
|
|
20
|
-
index: Math.floor(
|
|
21
|
-
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
|
|
22
24
|
});
|
|
23
|
-
return
|
|
25
|
+
return t;
|
|
24
26
|
}
|
|
25
|
-
function
|
|
27
|
+
function S(e, s, t, a, r, i) {
|
|
26
28
|
return {
|
|
27
29
|
chunkIndex: e.index,
|
|
28
30
|
totalChunks: s,
|
|
29
31
|
itemsInChunk: e.items.length,
|
|
30
|
-
totalItems:
|
|
31
|
-
status:
|
|
32
|
-
bulkSize:
|
|
33
|
-
maxConcurrency:
|
|
34
|
-
processingMode:
|
|
32
|
+
totalItems: t,
|
|
33
|
+
status: a,
|
|
34
|
+
bulkSize: r.bulkSize,
|
|
35
|
+
maxConcurrency: r.maxConcurrency,
|
|
36
|
+
processingMode: i,
|
|
35
37
|
parallelMode: !0
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
|
-
async function
|
|
40
|
+
async function G(e, s, t, a, r) {
|
|
39
41
|
try {
|
|
40
|
-
const
|
|
42
|
+
const i = t.map((l) => v(l(e))).filter(Boolean).join(`
|
|
41
43
|
|
|
42
|
-
`), o = [s,
|
|
44
|
+
`), o = [s, i].filter(Boolean).join(`
|
|
43
45
|
|
|
44
|
-
`),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
schema: J
|
|
51
|
-
}
|
|
46
|
+
`), n = ee(o, e, a, r === "files"), c = await E(n, {
|
|
47
|
+
response_format: {
|
|
48
|
+
type: "json_schema",
|
|
49
|
+
json_schema: {
|
|
50
|
+
name: "arch_result",
|
|
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
|
|
62
|
-
let o =
|
|
63
|
-
for (const
|
|
64
|
-
if (
|
|
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
|
-
results:
|
|
68
|
-
errors:
|
|
67
|
+
results: r,
|
|
68
|
+
errors: i,
|
|
69
69
|
failures: o,
|
|
70
|
-
shouldStop: !s && o >=
|
|
70
|
+
shouldStop: !s && o >= t
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
e && e(s,
|
|
73
|
+
function h(e, s, t, a) {
|
|
74
|
+
e && e(s, t, a);
|
|
75
75
|
}
|
|
76
|
-
async function
|
|
77
|
-
|
|
78
|
-
...
|
|
79
|
-
status:
|
|
76
|
+
async function R(e, s, t, a, r) {
|
|
77
|
+
h(a, e, void 0, {
|
|
78
|
+
...r,
|
|
79
|
+
status: m.PROCESSING
|
|
80
80
|
});
|
|
81
81
|
try {
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
schema: G
|
|
89
|
-
}
|
|
82
|
+
const i = se(s, e, t), o = await A(e, i, {
|
|
83
|
+
responseFormat: {
|
|
84
|
+
type: "json_schema",
|
|
85
|
+
json_schema: {
|
|
86
|
+
name: "arch_bulk_result",
|
|
87
|
+
schema: Q
|
|
90
88
|
}
|
|
91
89
|
}
|
|
92
|
-
}),
|
|
90
|
+
}), n = o.results || o;
|
|
93
91
|
let c = [];
|
|
94
|
-
Array.isArray(
|
|
95
|
-
path:
|
|
92
|
+
Array.isArray(n) ? c = n : c = e.map((b) => ({
|
|
93
|
+
path: b,
|
|
96
94
|
passed: !1,
|
|
97
95
|
reason: "Invalid response format"
|
|
98
96
|
}));
|
|
99
|
-
const l = c.filter((
|
|
100
|
-
return
|
|
101
|
-
|
|
97
|
+
const l = c.filter((b) => !b.passed).length, u = c.length - l;
|
|
98
|
+
return h(
|
|
99
|
+
a,
|
|
102
100
|
e,
|
|
103
101
|
l > 0 ? new Error(`${l} items failed`) : void 0,
|
|
104
102
|
{
|
|
105
|
-
...
|
|
106
|
-
status:
|
|
103
|
+
...r,
|
|
104
|
+
status: m.COMPLETED,
|
|
107
105
|
passed: u,
|
|
108
106
|
failed: l
|
|
109
107
|
}
|
|
110
108
|
), c;
|
|
111
|
-
} catch (
|
|
112
|
-
const o = e.map((
|
|
113
|
-
path:
|
|
109
|
+
} catch (i) {
|
|
110
|
+
const o = e.map((n) => ({
|
|
111
|
+
path: n,
|
|
114
112
|
passed: !1,
|
|
115
|
-
reason: `Processing error: ${
|
|
113
|
+
reason: `Processing error: ${i.message}`
|
|
116
114
|
}));
|
|
117
|
-
return
|
|
118
|
-
...
|
|
119
|
-
status:
|
|
115
|
+
return h(a, e, i, {
|
|
116
|
+
...r,
|
|
117
|
+
status: m.ERROR
|
|
120
118
|
}), o;
|
|
121
119
|
}
|
|
122
120
|
}
|
|
123
|
-
function
|
|
124
|
-
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);
|
|
125
123
|
return {
|
|
126
|
-
passed:
|
|
127
|
-
failed:
|
|
128
|
-
allPassed:
|
|
129
|
-
stoppedEarly:
|
|
124
|
+
passed: t,
|
|
125
|
+
failed: a,
|
|
126
|
+
allPassed: r,
|
|
127
|
+
stoppedEarly: i,
|
|
130
128
|
failures: o,
|
|
131
129
|
total: e.length,
|
|
132
130
|
processed: s.length
|
|
133
131
|
};
|
|
134
132
|
}
|
|
135
|
-
function
|
|
133
|
+
function q(e, s, t) {
|
|
136
134
|
if (e.allPassed)
|
|
137
135
|
return `All ${e.processed}/${e.total} items satisfy: ${s}`;
|
|
138
|
-
const
|
|
139
|
-
`),
|
|
136
|
+
const a = e.failures.slice(0, g).map((i) => ` • ${i.item}: ${i.reason || "Failed"}`).join(`
|
|
137
|
+
`), r = e.failures.length > g ? `
|
|
140
138
|
... and ${e.failures.length - g} more failures` : "";
|
|
141
|
-
return `${e.failed}/${e.processed} items failed: ${s}${e.stoppedEarly &&
|
|
139
|
+
return `${e.failed}/${e.processed} items failed: ${s}${e.stoppedEarly && t !== T ? ` (stopped after ${t} failures)` : ""}
|
|
142
140
|
|
|
143
141
|
Failures:
|
|
144
|
-
${
|
|
142
|
+
${a}${r}`;
|
|
145
143
|
}
|
|
146
|
-
function
|
|
144
|
+
function W(e, s) {
|
|
147
145
|
return {
|
|
148
146
|
passed: e.allPassed,
|
|
149
147
|
message: s,
|
|
@@ -156,127 +154,127 @@ function M(e, s) {
|
|
|
156
154
|
}
|
|
157
155
|
};
|
|
158
156
|
}
|
|
159
|
-
function
|
|
160
|
-
const
|
|
157
|
+
function H(e, s, t, a) {
|
|
158
|
+
const r = s || t.length > 0 || a <= U;
|
|
161
159
|
return {
|
|
162
|
-
mode:
|
|
163
|
-
batchSize:
|
|
164
|
-
processor:
|
|
165
|
-
|
|
160
|
+
mode: r ? f.INDIVIDUAL : f.BULK,
|
|
161
|
+
batchSize: r ? e.maxConcurrency : e.bulkSize,
|
|
162
|
+
processor: r ? (i, o, n) => w(i, o, n) : (i, o, n) => R(
|
|
163
|
+
i.items,
|
|
166
164
|
o,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
165
|
+
n.description,
|
|
166
|
+
n.onProgress,
|
|
167
|
+
n.metadata
|
|
170
168
|
)
|
|
171
169
|
};
|
|
172
170
|
}
|
|
173
|
-
async function
|
|
174
|
-
const
|
|
175
|
-
(
|
|
176
|
-
|
|
171
|
+
async function w(e, s, t) {
|
|
172
|
+
const a = e.items.map(
|
|
173
|
+
(r) => G(
|
|
174
|
+
r,
|
|
177
175
|
s,
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
176
|
+
t.itemContextFns,
|
|
177
|
+
t.description,
|
|
178
|
+
t.targetType
|
|
181
179
|
)
|
|
182
180
|
);
|
|
183
|
-
return await Promise.all(
|
|
181
|
+
return await Promise.all(a);
|
|
184
182
|
}
|
|
185
|
-
function
|
|
183
|
+
function X(e, s, t) {
|
|
186
184
|
if (s === f.INDIVIDUAL) {
|
|
187
|
-
const { results:
|
|
185
|
+
const { results: a, errors: r, failures: i, shouldStop: o } = J(
|
|
188
186
|
e,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
187
|
+
t.isCoverageTest,
|
|
188
|
+
t.maxFailures,
|
|
189
|
+
t.currentFailures || 0
|
|
192
190
|
);
|
|
193
191
|
return {
|
|
194
|
-
results:
|
|
195
|
-
errors:
|
|
196
|
-
failures:
|
|
192
|
+
results: a,
|
|
193
|
+
errors: r,
|
|
194
|
+
failures: i,
|
|
197
195
|
shouldStop: o,
|
|
198
196
|
progressData: {
|
|
199
|
-
passed:
|
|
200
|
-
failed:
|
|
197
|
+
passed: a.filter((n) => n.passed).length,
|
|
198
|
+
failed: r.length
|
|
201
199
|
}
|
|
202
200
|
};
|
|
203
201
|
} else {
|
|
204
|
-
const
|
|
205
|
-
item:
|
|
206
|
-
passed:
|
|
207
|
-
reason:
|
|
202
|
+
const a = e.map((r) => ({
|
|
203
|
+
item: r.path,
|
|
204
|
+
passed: r.passed,
|
|
205
|
+
reason: r.reason
|
|
208
206
|
}));
|
|
209
207
|
return {
|
|
210
|
-
results:
|
|
208
|
+
results: a,
|
|
211
209
|
errors: [],
|
|
212
|
-
failures:
|
|
210
|
+
failures: t.currentFailures || 0,
|
|
213
211
|
shouldStop: !1,
|
|
214
212
|
progressData: {
|
|
215
|
-
passed:
|
|
216
|
-
failed:
|
|
213
|
+
passed: a.filter((r) => r.passed).length,
|
|
214
|
+
failed: a.filter((r) => !r.passed).length
|
|
217
215
|
}
|
|
218
216
|
};
|
|
219
217
|
}
|
|
220
218
|
}
|
|
221
|
-
async function
|
|
222
|
-
const
|
|
219
|
+
async function K(e, s, t, a) {
|
|
220
|
+
const r = z(e, t.batchSize), i = [];
|
|
223
221
|
let o = 0;
|
|
224
|
-
for (const
|
|
225
|
-
if (!
|
|
222
|
+
for (const n of r) {
|
|
223
|
+
if (!a.isCoverageTest && o >= a.maxFailures)
|
|
226
224
|
break;
|
|
227
|
-
const c =
|
|
228
|
-
|
|
229
|
-
|
|
225
|
+
const c = S(
|
|
226
|
+
n,
|
|
227
|
+
r.length,
|
|
230
228
|
e.length,
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
229
|
+
m.PROCESSING,
|
|
230
|
+
a,
|
|
231
|
+
t.mode
|
|
234
232
|
);
|
|
235
|
-
|
|
233
|
+
h(a.onChunkProcessed, n.items, void 0, c);
|
|
236
234
|
let l;
|
|
237
|
-
|
|
238
|
-
itemContextFns:
|
|
239
|
-
description:
|
|
240
|
-
targetType:
|
|
241
|
-
}) : l = await
|
|
242
|
-
|
|
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,
|
|
243
241
|
s,
|
|
244
|
-
|
|
245
|
-
|
|
242
|
+
a.description,
|
|
243
|
+
a.onChunkProcessed,
|
|
246
244
|
c
|
|
247
245
|
);
|
|
248
|
-
const u =
|
|
249
|
-
...
|
|
246
|
+
const u = X(l, t.mode, {
|
|
247
|
+
...a,
|
|
250
248
|
currentFailures: o
|
|
251
249
|
});
|
|
252
|
-
if (
|
|
253
|
-
|
|
254
|
-
|
|
250
|
+
if (i.push(...u.results), o = u.failures, h(
|
|
251
|
+
a.onChunkProcessed,
|
|
252
|
+
n.items,
|
|
255
253
|
u.errors.length > 0 ? u.errors[0] : void 0,
|
|
256
254
|
{
|
|
257
|
-
...
|
|
258
|
-
|
|
259
|
-
|
|
255
|
+
...S(
|
|
256
|
+
n,
|
|
257
|
+
r.length,
|
|
260
258
|
e.length,
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
259
|
+
m.COMPLETED,
|
|
260
|
+
a,
|
|
261
|
+
t.mode
|
|
264
262
|
),
|
|
265
263
|
...u.progressData
|
|
266
264
|
}
|
|
267
265
|
), u.shouldStop)
|
|
268
266
|
break;
|
|
269
267
|
}
|
|
270
|
-
return
|
|
268
|
+
return i;
|
|
271
269
|
}
|
|
272
|
-
const
|
|
270
|
+
const Y = {
|
|
273
271
|
type: "object",
|
|
274
272
|
properties: {
|
|
275
273
|
passed: { type: "boolean" },
|
|
276
274
|
reason: { type: "string" }
|
|
277
275
|
},
|
|
278
276
|
required: ["passed", "reason"]
|
|
279
|
-
},
|
|
277
|
+
}, Q = {
|
|
280
278
|
type: "object",
|
|
281
279
|
properties: {
|
|
282
280
|
results: {
|
|
@@ -294,7 +292,7 @@ const J = {
|
|
|
294
292
|
},
|
|
295
293
|
required: ["results"]
|
|
296
294
|
};
|
|
297
|
-
function
|
|
295
|
+
function v(e) {
|
|
298
296
|
switch (e.type) {
|
|
299
297
|
case "file":
|
|
300
298
|
return p.existsSync(e.filePath) ? `<${e.name}>
|
|
@@ -317,38 +315,38 @@ ${s}
|
|
|
317
315
|
return "";
|
|
318
316
|
}
|
|
319
317
|
}
|
|
320
|
-
function
|
|
318
|
+
function Z(e) {
|
|
321
319
|
if (!p.existsSync(e)) return "Item does not exist";
|
|
322
320
|
if (p.statSync(e).isDirectory())
|
|
323
321
|
return p.readdirSync(e).join(", ");
|
|
324
322
|
{
|
|
325
|
-
const
|
|
326
|
-
return
|
|
327
|
-
... (truncated)` :
|
|
323
|
+
const t = p.readFileSync(e, "utf8");
|
|
324
|
+
return t.length > y ? `${t.substring(0, y)}
|
|
325
|
+
... (truncated)` : t;
|
|
328
326
|
}
|
|
329
327
|
}
|
|
330
|
-
function
|
|
331
|
-
const
|
|
328
|
+
function ee(e, s, t, a) {
|
|
329
|
+
const r = Z(s);
|
|
332
330
|
return `${e}
|
|
333
|
-
Analyze this ${
|
|
331
|
+
Analyze this ${a ? "file" : "directory"}: ${s}
|
|
334
332
|
|
|
335
333
|
Content:
|
|
336
|
-
${
|
|
334
|
+
${r}
|
|
337
335
|
|
|
338
|
-
Does it satisfy: "${
|
|
336
|
+
Does it satisfy: "${t}"?
|
|
339
337
|
|
|
340
338
|
Return JSON with "passed" (boolean) and "reason" (string).`;
|
|
341
339
|
}
|
|
342
|
-
function
|
|
340
|
+
function se(e, s, t) {
|
|
343
341
|
return `${e}
|
|
344
|
-
Analyze each item and determine if it satisfies: "${
|
|
342
|
+
Analyze each item and determine if it satisfies: "${t}"
|
|
345
343
|
Items: ${s.join(", ")}
|
|
346
344
|
|
|
347
345
|
Return JSON with "results" array containing objects with "path", "passed" (boolean), and "reason" (string).`;
|
|
348
346
|
}
|
|
349
|
-
class
|
|
350
|
-
constructor(s,
|
|
351
|
-
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;
|
|
352
350
|
}
|
|
353
351
|
withContext(s) {
|
|
354
352
|
return this.contexts.push(s), this;
|
|
@@ -361,21 +359,21 @@ class X {
|
|
|
361
359
|
return this.description = s, this;
|
|
362
360
|
}
|
|
363
361
|
// Set up for a coverage test
|
|
364
|
-
coverage(s =
|
|
362
|
+
coverage(s = j) {
|
|
365
363
|
return this.threshold = s, this.isCoverageTest = !0, this;
|
|
366
364
|
}
|
|
367
365
|
// Start processing - this is the fluent terminator
|
|
368
366
|
async start() {
|
|
369
367
|
if (!this.description)
|
|
370
368
|
throw new Error("Must call satisfies() before start()");
|
|
371
|
-
const s = await this.target.resolve(),
|
|
369
|
+
const s = await this.target.resolve(), t = this.contexts.map(v).filter(Boolean).join(`
|
|
372
370
|
|
|
373
|
-
`),
|
|
371
|
+
`), a = H(
|
|
374
372
|
this,
|
|
375
373
|
this.onChunkProcessed,
|
|
376
374
|
this.itemContextFns,
|
|
377
375
|
s.length
|
|
378
|
-
),
|
|
376
|
+
), r = {
|
|
379
377
|
bulkSize: this.bulkSize,
|
|
380
378
|
maxConcurrency: this.maxConcurrency,
|
|
381
379
|
description: this.description,
|
|
@@ -384,29 +382,29 @@ class X {
|
|
|
384
382
|
targetType: this.target.type,
|
|
385
383
|
maxFailures: this.maxFailures,
|
|
386
384
|
isCoverageTest: this.isCoverageTest
|
|
387
|
-
},
|
|
385
|
+
}, i = await K(s, t, a, r);
|
|
388
386
|
if (this.isCoverageTest) {
|
|
389
|
-
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`;
|
|
390
388
|
if (!c)
|
|
391
389
|
throw new Error(l);
|
|
392
|
-
return { passed: c, coverage:
|
|
390
|
+
return { passed: c, coverage: n, message: l };
|
|
393
391
|
}
|
|
394
|
-
return this.summarize(s,
|
|
392
|
+
return this.summarize(s, i);
|
|
395
393
|
}
|
|
396
|
-
summarize(s,
|
|
397
|
-
const
|
|
398
|
-
if (!
|
|
399
|
-
throw new Error(
|
|
400
|
-
return
|
|
394
|
+
summarize(s, t) {
|
|
395
|
+
const a = V(s, t), r = q(a, this.description, this.maxFailures);
|
|
396
|
+
if (!a.allPassed)
|
|
397
|
+
throw new Error(r);
|
|
398
|
+
return W(a, r);
|
|
401
399
|
}
|
|
402
400
|
}
|
|
403
|
-
function
|
|
404
|
-
return new
|
|
401
|
+
function ge(e, s = {}) {
|
|
402
|
+
return new ae(e, s);
|
|
405
403
|
}
|
|
406
|
-
function
|
|
404
|
+
function ye() {
|
|
407
405
|
return console.warn("scanJS is not available in browser environment"), Promise.resolve({});
|
|
408
406
|
}
|
|
409
|
-
const
|
|
407
|
+
const I = {
|
|
410
408
|
name: "test_analysis_result",
|
|
411
409
|
schema: {
|
|
412
410
|
type: "object",
|
|
@@ -427,12 +425,14 @@ const W = {
|
|
|
427
425
|
required: ["hasIssues", "issues"],
|
|
428
426
|
additionalProperties: !1
|
|
429
427
|
}
|
|
430
|
-
};
|
|
431
|
-
async function d(e, s,
|
|
428
|
+
}, C = "test";
|
|
429
|
+
async function d(e, s, t = {}) {
|
|
430
|
+
const a = $(C, t), r = O(C, a.onProgress, a);
|
|
431
|
+
r.start();
|
|
432
432
|
try {
|
|
433
|
-
const
|
|
433
|
+
const i = await M.readFile(e, "utf-8"), o = `Analyze this code and ${s}:
|
|
434
434
|
|
|
435
|
-
${
|
|
435
|
+
${D(i, { tag: "code-to-analyze" })}
|
|
436
436
|
|
|
437
437
|
Return a JSON object with:
|
|
438
438
|
- "hasIssues": boolean indicating if any issues were found
|
|
@@ -443,106 +443,259 @@ GUIDELINES:
|
|
|
443
443
|
- Provide specific line numbers or code references when possible
|
|
444
444
|
- Suggest concrete fixes for each issue identified
|
|
445
445
|
- Be concise but clear in your feedback
|
|
446
|
-
- If no issues are found, return {"hasIssues": false, "issues": []}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
json_schema: W
|
|
455
|
-
}
|
|
446
|
+
- If no issues are found, return {"hasIssues": false, "issues": []}`, n = await N(
|
|
447
|
+
() => E(o, {
|
|
448
|
+
...a,
|
|
449
|
+
response_format: L(I.name, I.schema)
|
|
450
|
+
}),
|
|
451
|
+
{
|
|
452
|
+
label: "test chain",
|
|
453
|
+
config: a
|
|
456
454
|
}
|
|
457
|
-
|
|
458
|
-
return r.
|
|
459
|
-
} catch (
|
|
460
|
-
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}`];
|
|
461
459
|
}
|
|
462
460
|
}
|
|
463
|
-
const
|
|
464
|
-
...await d(e, K),
|
|
465
|
-
...await d(e, Y),
|
|
466
|
-
...await d(e, Z),
|
|
467
|
-
...await d(e, Q),
|
|
468
|
-
...await d(e, ee),
|
|
469
|
-
...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) => [
|
|
470
462
|
...await d(e, te),
|
|
471
|
-
...await d(e,
|
|
463
|
+
...await d(e, re),
|
|
464
|
+
...await d(e, ne),
|
|
465
|
+
...await d(e, ie),
|
|
466
|
+
...await d(e, oe),
|
|
467
|
+
...await d(e, ce),
|
|
468
|
+
...await d(e, le),
|
|
469
|
+
...await d(e, ue)
|
|
472
470
|
];
|
|
473
|
-
|
|
471
|
+
P.config();
|
|
472
|
+
try {
|
|
473
|
+
k(JSON.parse(F(x(process.cwd(), ".verblets.json"), "utf8")));
|
|
474
|
+
} catch {
|
|
475
|
+
}
|
|
474
476
|
export {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
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
|
-
|
|
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,
|
|
483
|
+
Fe as ENVIRONMENT,
|
|
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,
|
|
541
679
|
d as test,
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
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
|
|
548
701
|
};
|