@sebastiantuyu/agest 0.2.2 → 0.3.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.
@@ -20,7 +20,7 @@ export interface RemoteAdapterOptions {
20
20
  * When omitted the adapter tries common shapes:
21
21
  * - `{ text }` / `{ response }` / `{ output }` / `{ message }` / plain string
22
22
  */
23
- parseResponse?: (body: unknown) => AgentResponse;
23
+ parseResponse?: <TBody = unknown>(body: TBody) => AgentResponse;
24
24
  /**
25
25
  * Static metadata for this remote agent.
26
26
  * Because the remote endpoint is opaque, metadata like model name,
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from "child_process";
3
+ import { main as stats } from "./stats.js";
4
+ import { main as preview } from "./preview.js";
5
+ const command = process.argv[2];
6
+ async function run() {
7
+ const files = process.argv.slice(3);
8
+ if (files.length === 0) {
9
+ console.error(" Usage: agest run <file...>");
10
+ process.exit(1);
11
+ }
12
+ for (const file of files) {
13
+ const child = spawn("npx", ["tsx", file], {
14
+ stdio: "inherit",
15
+ shell: true,
16
+ });
17
+ const code = await new Promise((resolve) => child.on("close", (c) => resolve(c ?? 1)));
18
+ if (code !== 0)
19
+ process.exit(code);
20
+ }
21
+ }
22
+ const commands = {
23
+ stats,
24
+ preview,
25
+ run,
26
+ };
27
+ if (!command || !commands[command]) {
28
+ console.log(`
29
+ Usage: agest <command>
30
+
31
+ Commands:
32
+ run Run test file(s) agest run tests/*.test.ts
33
+ stats Show aggregated test statistics
34
+ preview Generate an HTML report preview
35
+ `);
36
+ process.exit(command ? 1 : 0);
37
+ }
38
+ // Forward remaining args so subcommands see them at process.argv[2+]
39
+ process.argv = [process.argv[0], process.argv[1], ...process.argv.slice(3)];
40
+ commands[command]().catch((err) => {
41
+ console.error("Error:", err.message);
42
+ process.exit(1);
43
+ });
package/dist/preview.d.ts CHANGED
@@ -1 +1,2 @@
1
- export {};
1
+ declare function main(): Promise<void>;
2
+ export { main };
package/dist/preview.js CHANGED
@@ -771,7 +771,4 @@ async function main() {
771
771
  console.log(`\n Preview: ${tmpPath}\n`);
772
772
  openBrowser(tmpPath);
773
773
  }
774
- main().catch((err) => {
775
- console.error("Error:", err.message);
776
- process.exit(1);
777
- });
774
+ export { main };
package/dist/stats.d.ts CHANGED
@@ -1 +1,2 @@
1
- export {};
1
+ declare function main(): Promise<void>;
2
+ export { main };
package/dist/stats.js CHANGED
@@ -311,7 +311,4 @@ async function main() {
311
311
  "━".repeat(W) +
312
312
  "\n");
313
313
  }
314
- main().catch((err) => {
315
- console.error("Error:", err.message);
316
- process.exit(1);
317
- });
314
+ export { main };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sebastiantuyu/agest",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "A testing library for agents",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,6 +10,9 @@
10
10
  "files": [
11
11
  "dist"
12
12
  ],
13
+ "bin": {
14
+ "agest": "dist/cli.js"
15
+ },
13
16
  "main": "dist/index.js",
14
17
  "types": "dist/index.d.ts",
15
18
  "exports": {
@@ -29,8 +32,8 @@
29
32
  "test:coverage": "vitest run --coverage",
30
33
  "dev": "tsx examples/basic.test.ts",
31
34
  "test:examples": "tsx examples/basic.test.ts && tsx examples/agent.test.ts",
32
- "stats": "tsx src/stats.ts",
33
- "preview": "tsx src/preview.ts",
35
+ "stats": "tsx src/cli.ts stats",
36
+ "preview": "tsx src/cli.ts preview",
34
37
  "site:preview": "npx serve site -p 3000",
35
38
  "release:patch": "npm version patch && git push && git push --tags",
36
39
  "release:minor": "npm version minor && git push && git push --tags",