katt 0.0.10 → 0.0.11
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/build-tests/check1.eval.js +2 -2
- package/dist/index.js +297 -131
- package/dist/katt.js +1 -1
- package/dist/{runCli-DkkiL_uk.js → runCli-CJ7_lGMV.js} +84 -74
- package/package.json +5 -5
|
@@ -4,7 +4,7 @@ describe('Hello World', () => {
|
|
|
4
4
|
it('should return the date in a json format', async () => {
|
|
5
5
|
const currentData = new Date(Date.now());
|
|
6
6
|
|
|
7
|
-
const result = await prompt('
|
|
8
|
-
expect(result).toContain(
|
|
7
|
+
const result = await prompt('Look for updates in the readme file.');
|
|
8
|
+
expect(result).toContain('');
|
|
9
9
|
});
|
|
10
10
|
});
|
package/dist/index.js
CHANGED
|
@@ -1,55 +1,56 @@
|
|
|
1
|
-
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _ } from "./runCli-
|
|
2
|
-
import { mkdtemp as
|
|
3
|
-
import { basename as
|
|
4
|
-
import { mkdirSync as
|
|
5
|
-
import { CopilotClient as
|
|
6
|
-
import { spawn as
|
|
7
|
-
import { tmpdir as
|
|
1
|
+
import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _, y as v } from "./runCli-CJ7_lGMV.js";
|
|
2
|
+
import { access as y, constants as b, mkdir as x, mkdtemp as S, readFile as C, rm as w, writeFile as ee } from "node:fs/promises";
|
|
3
|
+
import { basename as T, dirname as E, isAbsolute as te, join as D, resolve as O } from "node:path";
|
|
4
|
+
import { mkdirSync as k, readFileSync as A, writeFileSync as j } from "node:fs";
|
|
5
|
+
import { CopilotClient as ne, approveAll as re } from "@github/copilot-sdk";
|
|
6
|
+
import { spawn as ie } from "node:child_process";
|
|
7
|
+
import { tmpdir as ae } from "node:os";
|
|
8
8
|
//#region src/lib/describe/describe.ts
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
function oe(t, n) {
|
|
10
|
+
_(() => {
|
|
11
|
+
o(t);
|
|
12
12
|
try {
|
|
13
|
-
let
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
let t = n();
|
|
14
|
+
if (t && typeof t.then == "function") {
|
|
15
|
+
e(t.finally(() => {
|
|
16
|
+
l();
|
|
17
17
|
}));
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
} catch (e) {
|
|
21
|
-
throw
|
|
21
|
+
throw l(), e;
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
},
|
|
23
|
+
l();
|
|
24
|
+
}, c());
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/lib/prompt/codex.ts
|
|
28
|
-
var
|
|
29
|
-
function
|
|
28
|
+
var se = "katt-codex-", ce = "last-message.txt";
|
|
29
|
+
function le(e, t) {
|
|
30
30
|
return typeof e == "object" && !!e && "code" in e && e.code === t;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function M(e) {
|
|
33
33
|
return typeof e == "string" && e.length > 0;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
return
|
|
35
|
+
function ue(e) {
|
|
36
|
+
return M(e) ? [e] : Array.isArray(e) ? e.filter(M) : [];
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
let
|
|
38
|
+
function de(e, t, n = !1) {
|
|
39
|
+
let r = t ?? {}, i = [
|
|
40
40
|
"exec",
|
|
41
41
|
"--color",
|
|
42
42
|
"never",
|
|
43
|
+
...n ? ["--json"] : [],
|
|
43
44
|
"--output-last-message",
|
|
44
45
|
e
|
|
45
46
|
];
|
|
46
|
-
|
|
47
|
-
for (let e of
|
|
48
|
-
return
|
|
47
|
+
M(r.model) && i.push("--model", r.model), M(r.profile) && i.push("--profile", r.profile), M(r.sandbox) && i.push("--sandbox", r.sandbox), r.fullAuto === !0 && i.push("--full-auto"), r.skipGitRepoCheck === !0 && i.push("--skip-git-repo-check"), r.dangerouslyBypassApprovalsAndSandbox === !0 && i.push("--dangerously-bypass-approvals-and-sandbox");
|
|
48
|
+
for (let e of ue(r.config)) i.push("--config", e);
|
|
49
|
+
return i.push("-"), i;
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function N(e, t, n, r) {
|
|
51
52
|
return new Promise((i, a) => {
|
|
52
|
-
let o =
|
|
53
|
+
let o = ie("codex", t, {
|
|
53
54
|
cwd: r,
|
|
54
55
|
stdio: [
|
|
55
56
|
"pipe",
|
|
@@ -78,86 +79,240 @@ function L(e, t, n, r) {
|
|
|
78
79
|
}), o.stdin.end(e);
|
|
79
80
|
});
|
|
80
81
|
}
|
|
81
|
-
async function
|
|
82
|
+
async function P(e, t) {
|
|
82
83
|
try {
|
|
83
|
-
return await
|
|
84
|
+
return await C(e, "utf8");
|
|
84
85
|
} catch (e) {
|
|
85
|
-
if (!
|
|
86
|
+
if (!le(e, "ENOENT")) throw e;
|
|
86
87
|
return t;
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
+
function F(e) {
|
|
90
91
|
if (e.timedOut) return "Codex timed out before returning a response.";
|
|
91
92
|
if (e.exitCode === null) return `Codex exited due to signal ${e.signal ?? "unknown"}.`;
|
|
92
93
|
let t = e.stderr.length > 0 ? ` ${e.stderr}` : "";
|
|
93
94
|
return `Codex exited with code ${e.exitCode}.${t}`;
|
|
94
95
|
}
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
function I(e) {
|
|
97
|
+
return typeof e == "object" && !!e;
|
|
98
|
+
}
|
|
99
|
+
function L(e) {
|
|
100
|
+
return typeof e == "string" && e.trim().length > 0 ? e.trim() : void 0;
|
|
101
|
+
}
|
|
102
|
+
function R(e, t, n = 0) {
|
|
103
|
+
if (n > 6) return;
|
|
104
|
+
let r = L(e);
|
|
105
|
+
if (r) {
|
|
106
|
+
t.push(r);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (Array.isArray(e)) {
|
|
110
|
+
for (let r of e) R(r, t, n + 1);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (I(e)) for (let r of [
|
|
114
|
+
"reasoning",
|
|
115
|
+
"reasoningText",
|
|
116
|
+
"reasoning_text",
|
|
117
|
+
"content",
|
|
118
|
+
"summary",
|
|
119
|
+
"deltaContent",
|
|
120
|
+
"delta",
|
|
121
|
+
"text",
|
|
122
|
+
"intent",
|
|
123
|
+
"analysis",
|
|
124
|
+
"thought",
|
|
125
|
+
"plan",
|
|
126
|
+
"message"
|
|
127
|
+
]) r in e && R(e[r], t, n + 1);
|
|
128
|
+
}
|
|
129
|
+
function z(e) {
|
|
130
|
+
if (e.trim().length === 0) return [];
|
|
97
131
|
try {
|
|
98
|
-
let
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
132
|
+
let t = JSON.parse(e);
|
|
133
|
+
if (!I(t)) return [];
|
|
134
|
+
let n = [], r = L(t.type);
|
|
135
|
+
if (r && /reason|intent|plan|analysis|thought|think/i.test(r) && R(t, n), "msg" in t && I(t.msg)) {
|
|
136
|
+
let e = L(t.msg.type);
|
|
137
|
+
e && /reason|intent|plan|analysis|thought|think/i.test(e) && R(t.msg, n);
|
|
138
|
+
}
|
|
139
|
+
return n;
|
|
140
|
+
} catch {
|
|
141
|
+
return [];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function B(e) {
|
|
145
|
+
let t = e.split(/\r?\n/), n = [], r = /* @__PURE__ */ new Set();
|
|
146
|
+
for (let e of t) {
|
|
147
|
+
let t = z(e);
|
|
148
|
+
for (let e of t) r.has(e) || (r.add(e), n.push(e));
|
|
149
|
+
}
|
|
150
|
+
return n.join("\n\n");
|
|
151
|
+
}
|
|
152
|
+
function V(e) {
|
|
153
|
+
let t = e.split(/\r?\n/), n = "";
|
|
154
|
+
for (let e of t) if (e.trim().length !== 0) try {
|
|
155
|
+
let t = JSON.parse(e);
|
|
156
|
+
if (!I(t)) continue;
|
|
157
|
+
if (I(t.msg) && L(t.msg.type) === "agent_message") {
|
|
158
|
+
let e = L(t.msg.message);
|
|
159
|
+
e && (n = e);
|
|
160
|
+
}
|
|
161
|
+
} catch {}
|
|
162
|
+
return n;
|
|
163
|
+
}
|
|
164
|
+
async function H(e, t, n, r) {
|
|
165
|
+
let i = n ?? {}, a = M(i.workingDirectory) ? i.workingDirectory : process.cwd(), o = await S(D(ae(), se)), s = D(o, ce);
|
|
166
|
+
try {
|
|
167
|
+
let i = await N(e, de(s, n, r), t, a);
|
|
168
|
+
if (i.timedOut) throw Error(`Codex timed out after ${t}ms.`);
|
|
169
|
+
if (i.exitCode !== 0) throw Error(F(i));
|
|
170
|
+
let o = await P(s, r ? V(i.stdout) : i.stdout);
|
|
171
|
+
if (o.length === 0) throw Error("Codex did not return a response.");
|
|
172
|
+
return {
|
|
173
|
+
response: o,
|
|
174
|
+
reasoning: r ? B(i.stdout) : ""
|
|
175
|
+
};
|
|
104
176
|
} finally {
|
|
105
|
-
await
|
|
177
|
+
await w(o, {
|
|
106
178
|
recursive: !0,
|
|
107
179
|
force: !0
|
|
108
180
|
});
|
|
109
181
|
}
|
|
110
182
|
}
|
|
111
|
-
function
|
|
183
|
+
async function fe(e, t, n) {
|
|
184
|
+
return (await H(e, t, n, !1)).response;
|
|
185
|
+
}
|
|
186
|
+
async function pe(e, t, n) {
|
|
187
|
+
return H(e, t, n, !0);
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/lib/prompt/reasoningWriter.ts
|
|
191
|
+
var me = "No reasoning was emitted by the runtime for this prompt.", he = "No final output was returned by the runtime for this prompt.", ge = new Set([
|
|
192
|
+
"<",
|
|
193
|
+
">",
|
|
194
|
+
":",
|
|
195
|
+
"\"",
|
|
196
|
+
"/",
|
|
197
|
+
"\\",
|
|
198
|
+
"|",
|
|
199
|
+
"?",
|
|
200
|
+
"*"
|
|
201
|
+
]);
|
|
202
|
+
function U(e) {
|
|
203
|
+
let t = e.trim().split("").map((e) => e.charCodeAt(0) <= 31 || ge.has(e) ? "_" : e).join("").replace(/\s+/g, "_");
|
|
204
|
+
return t.length > 0 ? t : "unnamed";
|
|
205
|
+
}
|
|
206
|
+
function _e() {
|
|
207
|
+
let e = g().map((e) => U(e.description)), t = i().map((e) => U(e.description)), n = [...e, ...t];
|
|
208
|
+
return n.length === 0 ? "root" : n.join("__");
|
|
209
|
+
}
|
|
210
|
+
function ve(e) {
|
|
211
|
+
return `${String(e.getUTCFullYear())}${String(e.getUTCMonth() + 1).padStart(2, "0")}${String(e.getUTCDate()).padStart(2, "0")}T${String(e.getUTCHours()).padStart(2, "0")}${String(e.getUTCMinutes()).padStart(2, "0")}${String(e.getUTCSeconds()).padStart(2, "0")}`;
|
|
212
|
+
}
|
|
213
|
+
async function ye(e) {
|
|
214
|
+
try {
|
|
215
|
+
return await y(e, b.F_OK), !0;
|
|
216
|
+
} catch {
|
|
217
|
+
return !1;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function be(e, t, n) {
|
|
221
|
+
let r = t.trim().length > 0 ? t : me, i = n.trim().length > 0 ? n : he;
|
|
222
|
+
return [
|
|
223
|
+
"# Reasoning",
|
|
224
|
+
"",
|
|
225
|
+
`Runtime: ${e}`,
|
|
226
|
+
"",
|
|
227
|
+
"## Reasoning Trace",
|
|
228
|
+
"",
|
|
229
|
+
r,
|
|
230
|
+
"",
|
|
231
|
+
"## Final Output",
|
|
232
|
+
"",
|
|
233
|
+
i,
|
|
234
|
+
""
|
|
235
|
+
].join("\n");
|
|
236
|
+
}
|
|
237
|
+
function xe(e) {
|
|
238
|
+
let t = T(e).replace(/\.eval\.[^./\\]+$/, ""), n = _e();
|
|
239
|
+
return D(E(e), "__reasoning__", `${t}__${n}.reasoning.md`);
|
|
240
|
+
}
|
|
241
|
+
function Se(e) {
|
|
242
|
+
let t = ve(/* @__PURE__ */ new Date());
|
|
243
|
+
return `${e.replace(/\.reasoning\.md$/, "")}__${t}.reasoning.md`;
|
|
244
|
+
}
|
|
245
|
+
async function W(e, n, r) {
|
|
246
|
+
let i = t.getStore()?.evalFile;
|
|
247
|
+
if (!i) return;
|
|
248
|
+
let a = xe(i);
|
|
249
|
+
await x(E(a), { recursive: !0 });
|
|
250
|
+
let o = await ye(a) ? Se(a) : a;
|
|
251
|
+
return await ee(o, be(e, n, r), "utf8"), o;
|
|
252
|
+
}
|
|
253
|
+
function G(e) {
|
|
112
254
|
return typeof e == "string" && e.length > 0 ? e : void 0;
|
|
113
255
|
}
|
|
114
|
-
function
|
|
256
|
+
function K(e) {
|
|
115
257
|
if (!e) return;
|
|
116
258
|
let t = { ...e };
|
|
117
259
|
if (t.model !== void 0) {
|
|
118
|
-
let e =
|
|
260
|
+
let e = G(typeof t.model == "string" ? t.model : void 0);
|
|
119
261
|
e ? t.model = e : delete t.model;
|
|
120
262
|
}
|
|
121
263
|
return Object.keys(t).length > 0 ? t : void 0;
|
|
122
264
|
}
|
|
123
|
-
function
|
|
265
|
+
function q(e) {
|
|
124
266
|
if (!(typeof e != "number" || !Number.isFinite(e)) && !(e <= 0)) return Math.floor(e);
|
|
125
267
|
}
|
|
126
|
-
function
|
|
268
|
+
function J(e) {
|
|
127
269
|
return !Number.isFinite(e) || (e ?? 0) <= 0 ? 0 : Math.floor(e ?? 0);
|
|
128
270
|
}
|
|
129
|
-
function
|
|
130
|
-
return
|
|
131
|
-
}
|
|
132
|
-
async function
|
|
133
|
-
let { timeoutMs:
|
|
134
|
-
...
|
|
135
|
-
...
|
|
136
|
-
}),
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
-
|
|
271
|
+
function Ce(e) {
|
|
272
|
+
return J(e.inputTokens) + J(e.outputTokens) + J(e.cacheReadTokens) + J(e.cacheWriteTokens);
|
|
273
|
+
}
|
|
274
|
+
async function Y(e, t = {}) {
|
|
275
|
+
let { timeoutMs: r, onPermissionRequest: i, ...a } = t, o = await u(), s = K(o.agentOptions), c = K(a), l = K({
|
|
276
|
+
...s ?? {},
|
|
277
|
+
...c ?? {}
|
|
278
|
+
}), d = q(o.promptTimeoutMs), f = q(r) ?? d ?? 6e5, m = G(typeof l?.model == "string" ? l.model : void 0), h = p();
|
|
279
|
+
if (o.agent === "codex") {
|
|
280
|
+
if (h) {
|
|
281
|
+
let t = await pe(e, f, l);
|
|
282
|
+
return m && v(m), await W("codex", t.reasoning, t.response), t.response;
|
|
283
|
+
}
|
|
284
|
+
let t = await fe(e, f, l);
|
|
285
|
+
return m && v(m), t;
|
|
140
286
|
}
|
|
141
|
-
let
|
|
287
|
+
let g = new ne({ useLoggedInUser: !0 }), _, y, b, x, S = 0, C = [], w = [];
|
|
142
288
|
try {
|
|
143
|
-
await
|
|
144
|
-
...
|
|
145
|
-
onPermissionRequest:
|
|
146
|
-
}),
|
|
147
|
-
|
|
289
|
+
await g.start(), _ = await g.createSession({
|
|
290
|
+
...l,
|
|
291
|
+
onPermissionRequest: i ?? re
|
|
292
|
+
}), y = _.on("assistant.usage", (e) => {
|
|
293
|
+
S += Ce(e.data);
|
|
294
|
+
}), b = _.on("assistant.reasoning", (e) => {
|
|
295
|
+
typeof e.data.content == "string" && e.data.content.length > 0 && C.push(e.data.content);
|
|
296
|
+
}), x = _.on("assistant.intent", (e) => {
|
|
297
|
+
typeof e.data.intent == "string" && e.data.intent.length > 0 && w.push(e.data.intent);
|
|
148
298
|
});
|
|
149
|
-
let t = await
|
|
299
|
+
let t = await _.sendAndWait({ prompt: e }, f);
|
|
150
300
|
if (!t?.data?.content) throw Error("Copilot did not return a response.");
|
|
151
|
-
|
|
301
|
+
if (h) {
|
|
302
|
+
let e = [];
|
|
303
|
+
for (let t of w) e.push(`Intent: ${t}`);
|
|
304
|
+
e.push(...C), typeof t.data.reasoningText == "string" && t.data.reasoningText.length > 0 && e.push(t.data.reasoningText), await W("gh-copilot", e.join("\n\n"), t.data.content);
|
|
305
|
+
}
|
|
306
|
+
return m && v(m), t.data.content;
|
|
152
307
|
} finally {
|
|
153
308
|
let e = [];
|
|
154
|
-
if (
|
|
155
|
-
await
|
|
309
|
+
if (y?.(), b?.(), x?.(), S > 0 && n(S), _) try {
|
|
310
|
+
await _.destroy();
|
|
156
311
|
} catch (t) {
|
|
157
312
|
e.push(t);
|
|
158
313
|
}
|
|
159
314
|
try {
|
|
160
|
-
let t = await
|
|
315
|
+
let t = await g.stop();
|
|
161
316
|
e.push(...t);
|
|
162
317
|
} catch (t) {
|
|
163
318
|
e.push(t);
|
|
@@ -165,90 +320,101 @@ async function K(e, t = {}) {
|
|
|
165
320
|
e.length > 0 && console.error(`Copilot cleanup encountered ${e.length} error(s).`);
|
|
166
321
|
}
|
|
167
322
|
}
|
|
168
|
-
async function
|
|
169
|
-
let
|
|
170
|
-
return
|
|
323
|
+
async function we(e, n = {}) {
|
|
324
|
+
let r = t.getStore(), i = r?.evalFile ? E(r.evalFile) : process.cwd();
|
|
325
|
+
return Y(await C(te(e) ? e : O(i, e), "utf8"), n);
|
|
171
326
|
}
|
|
172
327
|
//#endregion
|
|
173
328
|
//#region src/lib/expect/matcherUtils.ts
|
|
174
|
-
function
|
|
175
|
-
|
|
176
|
-
describePath:
|
|
177
|
-
itPath:
|
|
329
|
+
function X(e) {
|
|
330
|
+
a({
|
|
331
|
+
describePath: r(),
|
|
332
|
+
itPath: f(),
|
|
178
333
|
message: e
|
|
179
334
|
});
|
|
180
335
|
}
|
|
181
336
|
//#endregion
|
|
182
337
|
//#region src/lib/expect/promptCheck.ts
|
|
183
|
-
async function
|
|
184
|
-
let
|
|
185
|
-
Expectation: "${
|
|
338
|
+
async function Te(t, n) {
|
|
339
|
+
let r = Date.now(), i = `expected '${t}' to satisfy '${n}'`, a = Y(`Evaluate if the expectation is fulfiled in by the input.
|
|
340
|
+
Expectation: "${n}".
|
|
186
341
|
Input:
|
|
187
342
|
---
|
|
188
|
-
${
|
|
343
|
+
${t}
|
|
189
344
|
---
|
|
190
345
|
Important: Answer with "Yes" or "No" only, without any additional text.
|
|
191
346
|
`).then((e) => {
|
|
192
|
-
e.includes("Yes") ?
|
|
347
|
+
e.includes("Yes") ? m(Date.now() - r, "promptCheck") : e.includes("No") ? X(i) : X(`failed to evaluate expectation '${n}'`);
|
|
193
348
|
});
|
|
194
|
-
return a
|
|
349
|
+
return e(a), a;
|
|
195
350
|
}
|
|
196
351
|
//#endregion
|
|
197
352
|
//#region src/lib/expect/toBeClassifiedAs.ts
|
|
198
|
-
var
|
|
199
|
-
function
|
|
353
|
+
var Ee = 3;
|
|
354
|
+
function De(e) {
|
|
200
355
|
let t = e.match(/\b([1-5])\b/);
|
|
201
|
-
return
|
|
356
|
+
return t?.[1] ? Number(t[1]) : null;
|
|
202
357
|
}
|
|
203
|
-
async function
|
|
204
|
-
let
|
|
205
|
-
1 means "not ${
|
|
358
|
+
async function Oe(t, n, r) {
|
|
359
|
+
let i = Date.now(), a = r?.threshold ?? Ee, o = Y(`Classify the input by how "${n}" it is on a scale of 1 to 5.
|
|
360
|
+
1 means "not ${n}" and 5 means "very ${n}".
|
|
206
361
|
Return only a single number: 1, 2, 3, 4, or 5.
|
|
207
362
|
|
|
208
363
|
Input:
|
|
209
364
|
---
|
|
210
|
-
${
|
|
211
|
-
---`,
|
|
212
|
-
let
|
|
213
|
-
if (
|
|
214
|
-
|
|
365
|
+
${t}
|
|
366
|
+
---`, r?.model ? { model: r.model } : void 0).then((e) => {
|
|
367
|
+
let t = De(e);
|
|
368
|
+
if (t === null) {
|
|
369
|
+
X(`failed to classify as '${n}'. Evaluator returned '${e}'`);
|
|
215
370
|
return;
|
|
216
371
|
}
|
|
217
|
-
let
|
|
218
|
-
if (
|
|
219
|
-
|
|
372
|
+
let r = `expected response to be classified as '${n}' with score >= ${a}, got ${t}`;
|
|
373
|
+
if (t < a) {
|
|
374
|
+
X(r);
|
|
220
375
|
return;
|
|
221
376
|
}
|
|
222
|
-
|
|
377
|
+
m(Date.now() - i, "toBeClassifiedAs");
|
|
223
378
|
});
|
|
224
|
-
return
|
|
379
|
+
return e(o), o;
|
|
225
380
|
}
|
|
226
381
|
//#endregion
|
|
227
382
|
//#region src/lib/expect/toContain.ts
|
|
228
|
-
function
|
|
383
|
+
function ke(e, t) {
|
|
229
384
|
let n = `expected '${e}' to include '${t}'`;
|
|
230
|
-
e.includes(t) ||
|
|
385
|
+
e.includes(t) || X(n);
|
|
231
386
|
}
|
|
232
387
|
//#endregion
|
|
233
388
|
//#region src/lib/expect/toMatchSnapshot.ts
|
|
234
|
-
|
|
235
|
-
|
|
389
|
+
var Z = new Set([
|
|
390
|
+
"<",
|
|
391
|
+
">",
|
|
392
|
+
":",
|
|
393
|
+
"\"",
|
|
394
|
+
"/",
|
|
395
|
+
"\\",
|
|
396
|
+
"|",
|
|
397
|
+
"?",
|
|
398
|
+
"*"
|
|
399
|
+
]);
|
|
400
|
+
function Q(e) {
|
|
401
|
+
let t = e.trim().split("").map((e) => e.charCodeAt(0) <= 31 || Z.has(e) ? "_" : e).join("").replace(/\s+/g, "_");
|
|
236
402
|
return t.length > 0 ? t : "unnamed";
|
|
237
403
|
}
|
|
238
|
-
function
|
|
239
|
-
let e =
|
|
404
|
+
function Ae() {
|
|
405
|
+
let e = g().map((e) => Q(e.description)), t = i().map((e) => Q(e.description)), n = [...e, ...t];
|
|
240
406
|
return n.length === 0 ? "root" : n.join("__");
|
|
241
407
|
}
|
|
242
|
-
function
|
|
243
|
-
let t =
|
|
244
|
-
return
|
|
408
|
+
function je(e) {
|
|
409
|
+
let t = T(e).replace(/\.eval\.[^./\\]+$/, ""), n = Ae();
|
|
410
|
+
return D(E(e), "__snapshots__", `${t}__${n}.snap.md`);
|
|
245
411
|
}
|
|
246
|
-
function
|
|
412
|
+
function $(e) {
|
|
247
413
|
return e.split(/\r?\n/);
|
|
248
414
|
}
|
|
249
|
-
function
|
|
415
|
+
function Me(e, t) {
|
|
250
416
|
if (e === t) return " (no diff)";
|
|
251
|
-
let n =
|
|
417
|
+
let n = $(e), r = $(t), i = Math.max(n.length, r.length), a = [];
|
|
252
418
|
for (let e = 0; e < i; e += 1) {
|
|
253
419
|
let t = n[e], i = r[e];
|
|
254
420
|
if (t !== i) {
|
|
@@ -265,58 +431,58 @@ function ce(e, t) {
|
|
|
265
431
|
}
|
|
266
432
|
return a.join("\n");
|
|
267
433
|
}
|
|
268
|
-
function
|
|
269
|
-
let
|
|
270
|
-
if (!
|
|
271
|
-
|
|
434
|
+
function Ne(e) {
|
|
435
|
+
let n = t.getStore()?.evalFile;
|
|
436
|
+
if (!n) {
|
|
437
|
+
X("toMatchSnapshot can only be used while running an eval file.");
|
|
272
438
|
return;
|
|
273
439
|
}
|
|
274
|
-
let
|
|
440
|
+
let r = je(n);
|
|
275
441
|
try {
|
|
276
|
-
let t =
|
|
442
|
+
let t = A(r, "utf8");
|
|
277
443
|
if (t === e) return;
|
|
278
|
-
if (
|
|
279
|
-
|
|
444
|
+
if (s()) {
|
|
445
|
+
j(r, e, "utf8");
|
|
280
446
|
return;
|
|
281
447
|
}
|
|
282
|
-
let
|
|
283
|
-
|
|
284
|
-
`Snapshot mismatch at ${
|
|
448
|
+
let n = Me(t, e);
|
|
449
|
+
X([
|
|
450
|
+
`Snapshot mismatch at ${r}`,
|
|
285
451
|
"",
|
|
286
452
|
"Diff:",
|
|
287
|
-
|
|
453
|
+
n,
|
|
288
454
|
"",
|
|
289
455
|
"Run 'npx katt --update-snapshots' (or -u) to accept this change."
|
|
290
456
|
].join("\n"));
|
|
291
457
|
} catch (t) {
|
|
292
458
|
if (t.code !== "ENOENT") {
|
|
293
|
-
|
|
459
|
+
X(`Failed to read snapshot at ${r}: ${String(t)}`);
|
|
294
460
|
return;
|
|
295
461
|
}
|
|
296
462
|
try {
|
|
297
|
-
E(
|
|
463
|
+
k(E(r), { recursive: !0 }), j(r, e, "utf8");
|
|
298
464
|
} catch (e) {
|
|
299
|
-
|
|
465
|
+
X(`Failed to write snapshot at ${r}: ${String(e)}`);
|
|
300
466
|
}
|
|
301
467
|
}
|
|
302
468
|
}
|
|
303
469
|
//#endregion
|
|
304
470
|
//#region src/lib/expect/expect.ts
|
|
305
|
-
function
|
|
471
|
+
function Pe(e) {
|
|
306
472
|
return {
|
|
307
473
|
toContain: (t) => {
|
|
308
|
-
|
|
474
|
+
ke(e, t);
|
|
309
475
|
},
|
|
310
476
|
toMatchSnapshot: () => {
|
|
311
|
-
|
|
477
|
+
Ne(e);
|
|
312
478
|
},
|
|
313
479
|
promptCheck: async (t) => {
|
|
314
|
-
await
|
|
480
|
+
await Te(e, t);
|
|
315
481
|
},
|
|
316
482
|
toBeClassifiedAs: async (t, n) => {
|
|
317
|
-
await
|
|
483
|
+
await Oe(e, t, n);
|
|
318
484
|
}
|
|
319
485
|
};
|
|
320
486
|
}
|
|
321
487
|
//#endregion
|
|
322
|
-
export {
|
|
488
|
+
export { oe as describe, Pe as expect, d as it, Y as prompt, we as promptFile, h as runCli };
|
package/dist/katt.js
CHANGED
|
@@ -131,34 +131,34 @@ async function me() {
|
|
|
131
131
|
}
|
|
132
132
|
//#endregion
|
|
133
133
|
//#region src/lib/output/color.ts
|
|
134
|
-
var
|
|
134
|
+
var he = "\x1B[1;36m", j = "\x1B[33m", M = "\x1B[38;5;208m", N = "\x1B[1;38;5;208m", P = "\x1B[0m";
|
|
135
|
+
function F(e) {
|
|
136
|
+
return `${he}${e}${P}`;
|
|
137
|
+
}
|
|
135
138
|
function I(e) {
|
|
136
|
-
return `${j}${e}${
|
|
139
|
+
return `${j}${e}${P}`;
|
|
137
140
|
}
|
|
138
141
|
function L(e) {
|
|
139
|
-
return `${M}${e}${
|
|
142
|
+
return `${M}${e}${P}`;
|
|
140
143
|
}
|
|
141
144
|
function R(e) {
|
|
142
|
-
return `${N}${e}${
|
|
143
|
-
}
|
|
144
|
-
function z(e) {
|
|
145
|
-
return `${P}${e}${F}`;
|
|
145
|
+
return `${N}${e}${P}`;
|
|
146
146
|
}
|
|
147
147
|
//#endregion
|
|
148
148
|
//#region src/lib/output/testLogging.ts
|
|
149
|
-
var
|
|
150
|
-
function
|
|
151
|
-
|
|
149
|
+
var z = "";
|
|
150
|
+
function ge() {
|
|
151
|
+
z = "";
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function _e({ suitePath: e, casePath: t, durationMs: n, model: r, tokenUsage: i }) {
|
|
154
154
|
let a = e.length > 0 ? e : "(root)", o = t.length > 0 ? t : "(root)";
|
|
155
|
-
|
|
156
|
-
let s = [`Test "${
|
|
157
|
-
r && s.push(`- Model ${
|
|
155
|
+
z !== a && (console.log(`Suite "${F(a)}"`), z = a);
|
|
156
|
+
let s = [`Test "${F(o)}"`, `- Finished in ${F(`${n} ms`)}`];
|
|
157
|
+
r && s.push(`- Model ${F(r)}`), (i ?? 0) > 0 && s.push(`- Tokens used ${F(String(i))}`), s.push("---"), console.log(s.join("\n"));
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function B(e, t = "(root)") {
|
|
160
160
|
let n = k();
|
|
161
|
-
|
|
161
|
+
_e({
|
|
162
162
|
suitePath: T(),
|
|
163
163
|
casePath: n.length > 0 ? n : t,
|
|
164
164
|
durationMs: e,
|
|
@@ -168,7 +168,7 @@ function V(e, t = "(root)") {
|
|
|
168
168
|
}
|
|
169
169
|
//#endregion
|
|
170
170
|
//#region src/lib/it/it.ts
|
|
171
|
-
function
|
|
171
|
+
function ve(e, t) {
|
|
172
172
|
S(() => {
|
|
173
173
|
ce(), D(e);
|
|
174
174
|
let n = Date.now(), r = () => Date.now() - n;
|
|
@@ -176,34 +176,34 @@ function _e(e, t) {
|
|
|
176
176
|
let e = t();
|
|
177
177
|
if (e && typeof e.then == "function") {
|
|
178
178
|
A(e.then(() => {
|
|
179
|
-
|
|
179
|
+
B(r());
|
|
180
180
|
}).catch((e) => {
|
|
181
|
-
throw
|
|
181
|
+
throw B(r()), e;
|
|
182
182
|
}).finally(() => {
|
|
183
183
|
O();
|
|
184
184
|
}));
|
|
185
185
|
return;
|
|
186
186
|
}
|
|
187
187
|
} catch (e) {
|
|
188
|
-
throw
|
|
188
|
+
throw B(r()), O(), e;
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
B(r()), O();
|
|
191
191
|
}, C());
|
|
192
192
|
}
|
|
193
193
|
//#endregion
|
|
194
194
|
//#region src/lib/context/evalFileContext.ts
|
|
195
|
-
var
|
|
196
|
-
function
|
|
197
|
-
if (
|
|
195
|
+
var V = new s(), H = new URL("data:application/json;base64,ewogICJuYW1lIjogImthdHQiLAogICJ2ZXJzaW9uIjogIjAuMC4xMSIsCiAgImRlc2NyaXB0aW9uIjogIkNMSSB0b29sIHRoYXQgdGVzdHMgdGhlIG91dHB1dCBvZiBhZ2VudGljIEFJIHRvb2xzIiwKICAia2V5d29yZHMiOiBbCiAgICAiY2xpIiwKICAgICJhaSIsCiAgICAiYWdlbnRpYy1haSIsCiAgICAidGVzdGluZyIsCiAgICAiZXZhbHVhdGlvbiIKICBdLAogICJhdXRob3IiOiAiUmFwaGFlbCBQb3J0byAoaHR0cHM6Ly9naXRodWIuY29tL3JhcGhhZWxwb3IpIiwKICAibGljZW5zZSI6ICJNSVQiLAogICJ0eXBlIjogIm1vZHVsZSIsCiAgIm1haW4iOiAiZGlzdC9pbmRleC5qcyIsCiAgImV4cG9ydHMiOiB7CiAgICAiLiI6IHsKICAgICAgInR5cGVzIjogIi4vZGlzdC9pbmRleC5kLnRzIiwKICAgICAgImltcG9ydCI6ICIuL2Rpc3QvaW5kZXguanMiCiAgICB9CiAgfSwKICAiYmluIjogewogICAgImthdHQiOiAiZGlzdC9rYXR0LmpzIgogIH0sCiAgInNjcmlwdHMiOiB7CiAgICAiYnVpbGQiOiAidml0ZSBidWlsZCIsCiAgICAiZGV2IjogInRzeCBzcmMvaW5kZXgudHMiLAogICAgImxpbnQiOiAiYmlvbWUgbGludCAuL3NyYyIsCiAgICAiZm9ybWF0IjogImJpb21lIGZvcm1hdCAtLXdyaXRlIC4vc3JjIiwKICAgICJ0ZXN0IjogInZpdGVzdCIsCiAgICAidHlwZWNoZWNrIjogInRzYyAtcCB0c2NvbmZpZy5qc29uIC0tbm9FbWl0IiwKICAgICJ0ZXN0OmJ1aWxkIjogIm5vZGUgLi9kaXN0L2thdHQuanMiLAogICAgInRlc3Q6YnVpbGQ6Y29kZXgiOiAibm9kZSAuL2Rpc3Qva2F0dC5qcyAtLWNvbmZpZy1maWxlPS4va2F0dC1jb2RleC5qc29uIgogIH0sCiAgInR5cGVzIjogImRpc3QvaW5kZXguZC50cyIsCiAgImRldkRlcGVuZGVuY2llcyI6IHsKICAgICJAYmlvbWVqcy9iaW9tZSI6ICIyLjQuMTAiLAogICAgIkB0eXBlcy9ub2RlIjogIjI1LjUuMiIsCiAgICAidHN4IjogIjQuMjEuMCIsCiAgICAidHlwZXNjcmlwdCI6ICI2LjAuMiIsCiAgICAidml0ZSI6ICI4LjAuMyIsCiAgICAidml0ZS1wbHVnaW4tZHRzIjogIjQuNS40IiwKICAgICJ2aXRlc3QiOiAiNC4xLjIiLAogICAgInZzY29kZS1qc29ucnBjIjogIl44LjIuMSIKICB9LAogICJkZXBlbmRlbmNpZXMiOiB7CiAgICAiQGdpdGh1Yi9jb3BpbG90LXNkayI6ICIwLjIuMCIKICB9LAogICJidWdzIjogewogICAgInVybCI6ICJodHRwczovL2dpdGh1Yi5jb20vcmFwaGFlbHBvci9rYXR0L2lzc3VlcyIKICB9LAogICJob21lcGFnZSI6ICJodHRwczovL2dpdGh1Yi5jb20vcmFwaGFlbHBvci9rYXR0Igp9Cg==", "" + import.meta.url), U;
|
|
196
|
+
function ye() {
|
|
197
|
+
if (U !== void 0) return U;
|
|
198
198
|
try {
|
|
199
|
-
let t =
|
|
200
|
-
|
|
199
|
+
let t = H.protocol === "data:" ? be(H) : c(e(H), "utf8"), n = JSON.parse(t);
|
|
200
|
+
U = typeof n.version == "string" ? n.version : "unknown";
|
|
201
201
|
} catch {
|
|
202
|
-
|
|
202
|
+
U = "unknown";
|
|
203
203
|
}
|
|
204
|
-
return
|
|
204
|
+
return U;
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function be(e) {
|
|
207
207
|
let t = e.pathname.indexOf(",");
|
|
208
208
|
if (t < 0) throw Error("Invalid data URL.");
|
|
209
209
|
let n = e.pathname.slice(0, t), r = e.pathname.slice(t + 1);
|
|
@@ -211,30 +211,39 @@ function ye(e) {
|
|
|
211
211
|
}
|
|
212
212
|
//#endregion
|
|
213
213
|
//#region src/cli/banner.ts
|
|
214
|
-
function
|
|
215
|
-
let e = `v${
|
|
214
|
+
function W() {
|
|
215
|
+
let e = `v${ye()}`, t = Math.max(0, Math.floor((35 - e.length) / 2)), n = `${" ".repeat(t)}${e}`;
|
|
216
216
|
console.log(`
|
|
217
|
-
${
|
|
218
|
-
${
|
|
219
|
-
${
|
|
220
|
-
${
|
|
221
|
-
${
|
|
222
|
-
${
|
|
223
|
-
${
|
|
217
|
+
${I(" ██╗ ██╗ █████╗ ████████╗████████╗")}
|
|
218
|
+
${I(" ██║ ██╔╝██╔══██╗╚══██╔══╝╚══██╔══╝")}
|
|
219
|
+
${I(" █████╔╝ ███████║ ██║ ██║")}
|
|
220
|
+
${L(" ██╔═██╗ ██╔══██║ ██║ ██║")}
|
|
221
|
+
${L(" ██║ ██╗██║ ██║ ██║ ██║")}
|
|
222
|
+
${R(" ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝")}
|
|
223
|
+
${I(n)}
|
|
224
224
|
`);
|
|
225
225
|
}
|
|
226
226
|
//#endregion
|
|
227
227
|
//#region src/lib/expect/snapshotConfig.ts
|
|
228
|
+
var G = !1;
|
|
229
|
+
function xe(e) {
|
|
230
|
+
G = e;
|
|
231
|
+
}
|
|
232
|
+
function Se() {
|
|
233
|
+
return G;
|
|
234
|
+
}
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region src/lib/prompt/reasoningConfig.ts
|
|
228
237
|
var K = !1;
|
|
229
|
-
function
|
|
238
|
+
function Ce(e) {
|
|
230
239
|
K = e;
|
|
231
240
|
}
|
|
232
|
-
function
|
|
241
|
+
function we() {
|
|
233
242
|
return K;
|
|
234
243
|
}
|
|
235
244
|
//#endregion
|
|
236
245
|
//#region src/lib/config/config.ts
|
|
237
|
-
var
|
|
246
|
+
var Te = "gh-copilot", q = "katt.json", J;
|
|
238
247
|
function Y() {
|
|
239
248
|
return typeof J == "string" && J.length > 0 ? {
|
|
240
249
|
resolvedPath: o(process.cwd(), J),
|
|
@@ -247,10 +256,10 @@ function Y() {
|
|
|
247
256
|
function X(e) {
|
|
248
257
|
J = e;
|
|
249
258
|
}
|
|
250
|
-
function
|
|
259
|
+
function Ee(e, t) {
|
|
251
260
|
return typeof e == "object" && !!e && "code" in e && e.code === t;
|
|
252
261
|
}
|
|
253
|
-
function
|
|
262
|
+
function De(e, t) {
|
|
254
263
|
try {
|
|
255
264
|
let t = JSON.parse(e);
|
|
256
265
|
return typeof t == "object" && t ? t : void 0;
|
|
@@ -259,16 +268,16 @@ function we(e, t) {
|
|
|
259
268
|
return;
|
|
260
269
|
}
|
|
261
270
|
}
|
|
262
|
-
function
|
|
271
|
+
function Oe(e, t) {
|
|
263
272
|
e && "copilot" in e && console.warn(`Deprecated config property "copilot" found in ${t}. Use "agent" and "agentOptions" instead.`);
|
|
264
273
|
}
|
|
265
274
|
async function Z() {
|
|
266
275
|
let { resolvedPath: e, label: t } = Y();
|
|
267
276
|
try {
|
|
268
|
-
let r =
|
|
269
|
-
return
|
|
277
|
+
let r = De(await n(e, "utf8"), t);
|
|
278
|
+
return Oe(r, t), r;
|
|
270
279
|
} catch (e) {
|
|
271
|
-
if (
|
|
280
|
+
if (Ee(e, "ENOENT")) return;
|
|
272
281
|
console.warn(`Failed to read ${t}: ${String(e)}`);
|
|
273
282
|
return;
|
|
274
283
|
}
|
|
@@ -276,42 +285,42 @@ async function Z() {
|
|
|
276
285
|
function Q(e) {
|
|
277
286
|
if (e === "gh-copilot" || e === "codex") return e;
|
|
278
287
|
}
|
|
279
|
-
function
|
|
288
|
+
function ke(e, t) {
|
|
280
289
|
if (!e || Q(e?.agent) !== t) return;
|
|
281
290
|
let n = e.agentOptions;
|
|
282
291
|
if (typeof n != "object" || !n || Array.isArray(n)) return;
|
|
283
292
|
let r = { ...n }, i = r.model;
|
|
284
293
|
return (typeof i != "string" || i.length === 0) && delete r.model, Object.keys(r).length > 0 ? r : void 0;
|
|
285
294
|
}
|
|
286
|
-
function
|
|
295
|
+
function Ae(e) {
|
|
287
296
|
if (!(typeof e != "number" || !Number.isFinite(e)) && !(e <= 0)) return Math.floor(e);
|
|
288
297
|
}
|
|
289
|
-
function
|
|
298
|
+
function $(e) {
|
|
290
299
|
let t = e?.prompt;
|
|
291
|
-
if (!(typeof t != "object" || !t || Array.isArray(t))) return
|
|
300
|
+
if (!(typeof t != "object" || !t || Array.isArray(t))) return Ae(t.timeoutMs);
|
|
292
301
|
}
|
|
293
|
-
function
|
|
302
|
+
function je(e) {
|
|
294
303
|
if (!e || !Array.isArray(e.ignorePatterns)) return [];
|
|
295
304
|
let t = i(Y().resolvedPath);
|
|
296
305
|
return e.ignorePatterns.filter((e) => typeof e == "string" && e.length > 0).map((e) => o(t, e));
|
|
297
306
|
}
|
|
298
|
-
async function
|
|
299
|
-
let e = await Z(), t = Q(e?.agent) ??
|
|
307
|
+
async function Me() {
|
|
308
|
+
let e = await Z(), t = Q(e?.agent) ?? Te;
|
|
300
309
|
return {
|
|
301
310
|
agent: t,
|
|
302
|
-
agentOptions:
|
|
303
|
-
promptTimeoutMs:
|
|
311
|
+
agentOptions: ke(e, t),
|
|
312
|
+
promptTimeoutMs: $(e)
|
|
304
313
|
};
|
|
305
314
|
}
|
|
306
|
-
async function
|
|
307
|
-
return
|
|
315
|
+
async function Ne() {
|
|
316
|
+
return je(await Z());
|
|
308
317
|
}
|
|
309
318
|
//#endregion
|
|
310
319
|
//#region src/cli/runCli.ts
|
|
311
|
-
function
|
|
320
|
+
function Pe(e) {
|
|
312
321
|
return `${String(e.getHours()).padStart(2, "0")}:${String(e.getMinutes()).padStart(2, "0")}:${String(e.getSeconds()).padStart(2, "0")}`;
|
|
313
322
|
}
|
|
314
|
-
function
|
|
323
|
+
function Fe() {
|
|
315
324
|
console.log([
|
|
316
325
|
"Usage:",
|
|
317
326
|
" katt [options]",
|
|
@@ -319,10 +328,11 @@ function Me() {
|
|
|
319
328
|
"Options:",
|
|
320
329
|
" -h, --help Show CLI usage information",
|
|
321
330
|
" -u, --update-snapshots Update snapshot files on mismatch",
|
|
331
|
+
" --save-reasoning Save runtime reasoning to per-prompt files",
|
|
322
332
|
" --config-file PATH Use a custom config file instead of katt.json"
|
|
323
333
|
].join("\n"));
|
|
324
334
|
}
|
|
325
|
-
function
|
|
335
|
+
function Ie(e) {
|
|
326
336
|
let t;
|
|
327
337
|
for (let n = 0; n < e.length; n += 1) {
|
|
328
338
|
let r = e[n];
|
|
@@ -340,17 +350,17 @@ function Ne(e) {
|
|
|
340
350
|
}
|
|
341
351
|
return { configFilePath: t };
|
|
342
352
|
}
|
|
343
|
-
async function
|
|
353
|
+
async function Le() {
|
|
344
354
|
let e = process.argv.slice(2);
|
|
345
|
-
if (X(void 0), e.includes("--help") || e.includes("-h")) return
|
|
346
|
-
let n =
|
|
347
|
-
if (n.error) return
|
|
348
|
-
X(n.configFilePath),
|
|
355
|
+
if (X(void 0), e.includes("--help") || e.includes("-h")) return W(), Fe(), 0;
|
|
356
|
+
let n = Ie(e);
|
|
357
|
+
if (n.error) return W(), console.error(n.error), 1;
|
|
358
|
+
X(n.configFilePath), xe(e.includes("--update-snapshots") || e.includes("-u")), Ce(e.includes("--save-reasoning")), W();
|
|
349
359
|
let r = /* @__PURE__ */ new Date();
|
|
350
|
-
|
|
351
|
-
let i = await
|
|
360
|
+
ge(), pe(), ue();
|
|
361
|
+
let i = await Ne(), a = await f(process.cwd(), i);
|
|
352
362
|
if (a.length === 0) return console.log("No .eval.js or .eval.ts files found."), 1;
|
|
353
|
-
let o = (await Promise.allSettled(a.map((e) =>
|
|
363
|
+
let o = (await Promise.allSettled(a.map((e) => V.run({ evalFile: e }, () => import(t(e).href))))).map((e, t) => ({
|
|
354
364
|
result: e,
|
|
355
365
|
file: a[t]
|
|
356
366
|
})).filter(({ result: e }) => e.status === "rejected");
|
|
@@ -378,11 +388,11 @@ async function Pe() {
|
|
|
378
388
|
let l = le(), u = Date.now() - r.getTime();
|
|
379
389
|
return console.log([
|
|
380
390
|
"---",
|
|
381
|
-
`Files ${
|
|
382
|
-
`Evals ${
|
|
383
|
-
`Start at ${
|
|
384
|
-
`Duration ${
|
|
391
|
+
`Files ${F(`${a.length} passed`)}`,
|
|
392
|
+
`Evals ${F(`${l} passed`)}`,
|
|
393
|
+
`Start at ${F(Pe(r))}`,
|
|
394
|
+
`Duration ${F(`${u}ms`)}`
|
|
385
395
|
].join("\n")), 0;
|
|
386
396
|
}
|
|
387
397
|
//#endregion
|
|
388
|
-
export {
|
|
398
|
+
export { A as _, V as a, ie as c, T as d, re as f, de as g, ne as h, Se as i, C as l, w as m, Me as n, ve as o, k as p, we as r, B as s, Le as t, E as u, S as v, oe as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "katt",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "CLI tool that tests the output of agentic AI tools",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
},
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@biomejs/biome": "2.4.
|
|
38
|
-
"@types/node": "25.5.
|
|
37
|
+
"@biomejs/biome": "2.4.10",
|
|
38
|
+
"@types/node": "25.5.2",
|
|
39
39
|
"tsx": "4.21.0",
|
|
40
40
|
"typescript": "6.0.2",
|
|
41
|
-
"vite": "8.0.
|
|
41
|
+
"vite": "8.0.3",
|
|
42
42
|
"vite-plugin-dts": "4.5.4",
|
|
43
|
-
"vitest": "4.1.
|
|
43
|
+
"vitest": "4.1.2",
|
|
44
44
|
"vscode-jsonrpc": "^8.2.1"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|