@tjamescouch/gro 1.3.5 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/drivers/anthropic.js +256 -0
- package/dist/drivers/index.js +2 -0
- package/dist/drivers/streaming-openai.js +262 -0
- package/dist/drivers/types.js +1 -0
- package/dist/errors.js +79 -0
- package/dist/logger.js +30 -0
- package/dist/main.js +867 -0
- package/dist/mcp/client.js +130 -0
- package/dist/mcp/index.js +1 -0
- package/dist/memory/advanced-memory.js +210 -0
- package/dist/memory/agent-memory.js +52 -0
- package/dist/memory/agenthnsw.js +86 -0
- package/{src/memory/index.ts → dist/memory/index.js} +0 -1
- package/dist/memory/simple-memory.js +34 -0
- package/dist/memory/vector-index.js +7 -0
- package/dist/package.json +22 -0
- package/dist/session.js +110 -0
- package/dist/tools/agentpatch.js +91 -0
- package/dist/tools/bash.js +61 -0
- package/dist/tools/version.js +76 -0
- package/dist/utils/rate-limiter.js +46 -0
- package/{src/utils/retry.ts → dist/utils/retry.js} +8 -12
- package/dist/utils/timed-fetch.js +25 -0
- package/gro +0 -0
- package/package.json +13 -2
- package/.github/workflows/ci.yml +0 -20
- package/src/drivers/anthropic.ts +0 -281
- package/src/drivers/index.ts +0 -5
- package/src/drivers/streaming-openai.ts +0 -258
- package/src/drivers/types.ts +0 -39
- package/src/errors.ts +0 -97
- package/src/logger.ts +0 -28
- package/src/main.ts +0 -905
- package/src/mcp/client.ts +0 -163
- package/src/mcp/index.ts +0 -2
- package/src/memory/advanced-memory.ts +0 -263
- package/src/memory/agent-memory.ts +0 -61
- package/src/memory/agenthnsw.ts +0 -122
- package/src/memory/simple-memory.ts +0 -41
- package/src/memory/vector-index.ts +0 -30
- package/src/session.ts +0 -150
- package/src/tools/agentpatch.ts +0 -89
- package/src/tools/bash.ts +0 -61
- package/src/tools/version.ts +0 -98
- package/src/utils/rate-limiter.ts +0 -60
- package/src/utils/timed-fetch.ts +0 -29
- package/tests/errors.test.ts +0 -246
- package/tests/memory.test.ts +0 -186
- package/tests/rate-limiter.test.ts +0 -76
- package/tests/retry.test.ts +0 -138
- package/tests/timed-fetch.test.ts +0 -104
- package/tsconfig.json +0 -13
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for timedFetch.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { test, describe } from "node:test";
|
|
6
|
-
import assert from "node:assert";
|
|
7
|
-
import http from "http";
|
|
8
|
-
import { timedFetch } from "../src/utils/timed-fetch.js";
|
|
9
|
-
|
|
10
|
-
function startServer(handler: http.RequestListener): Promise<{ port: number; close: () => Promise<void> }> {
|
|
11
|
-
return new Promise((resolve) => {
|
|
12
|
-
const server = http.createServer(handler);
|
|
13
|
-
server.listen(0, () => {
|
|
14
|
-
const port = (server.address() as any).port;
|
|
15
|
-
resolve({
|
|
16
|
-
port,
|
|
17
|
-
close: () => new Promise<void>((r) => server.close(() => r())),
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
describe("timedFetch", () => {
|
|
24
|
-
test("successful GET", async () => {
|
|
25
|
-
const srv = await startServer((_req, res) => {
|
|
26
|
-
res.writeHead(200, { "content-type": "application/json" });
|
|
27
|
-
res.end(JSON.stringify({ ok: true }));
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
const res = await timedFetch(`http://localhost:${srv.port}/`, {
|
|
32
|
-
where: "test",
|
|
33
|
-
});
|
|
34
|
-
assert.strictEqual(res.status, 200);
|
|
35
|
-
const data = await res.json() as any;
|
|
36
|
-
assert.strictEqual(data.ok, true);
|
|
37
|
-
} finally {
|
|
38
|
-
await srv.close();
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test("successful POST with body", async () => {
|
|
43
|
-
const srv = await startServer((req, res) => {
|
|
44
|
-
let body = "";
|
|
45
|
-
req.on("data", (d: Buffer) => (body += d.toString()));
|
|
46
|
-
req.on("end", () => {
|
|
47
|
-
res.writeHead(200, { "content-type": "application/json" });
|
|
48
|
-
res.end(JSON.stringify({ echo: body }));
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
try {
|
|
53
|
-
const res = await timedFetch(`http://localhost:${srv.port}/`, {
|
|
54
|
-
method: "POST",
|
|
55
|
-
body: "hello",
|
|
56
|
-
where: "test-post",
|
|
57
|
-
});
|
|
58
|
-
assert.strictEqual(res.status, 200);
|
|
59
|
-
const data = await res.json() as any;
|
|
60
|
-
assert.strictEqual(data.echo, "hello");
|
|
61
|
-
} finally {
|
|
62
|
-
await srv.close();
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
test("timeout triggers abort", async () => {
|
|
67
|
-
const srv = await startServer((_req, _res) => {
|
|
68
|
-
// Never respond — simulate hang
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
try {
|
|
72
|
-
await assert.rejects(
|
|
73
|
-
() =>
|
|
74
|
-
timedFetch(`http://localhost:${srv.port}/`, {
|
|
75
|
-
timeoutMs: 100,
|
|
76
|
-
where: "test-timeout",
|
|
77
|
-
}),
|
|
78
|
-
(err: any) => {
|
|
79
|
-
assert.ok(err.message.includes("fetch timeout"), `Expected timeout error, got: ${err.message}`);
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
} finally {
|
|
84
|
-
await srv.close();
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
test("no timeout when timeoutMs is 0", async () => {
|
|
89
|
-
const srv = await startServer((_req, res) => {
|
|
90
|
-
res.writeHead(200);
|
|
91
|
-
res.end("ok");
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
try {
|
|
95
|
-
const res = await timedFetch(`http://localhost:${srv.port}/`, {
|
|
96
|
-
timeoutMs: 0,
|
|
97
|
-
where: "test-no-timeout",
|
|
98
|
-
});
|
|
99
|
-
assert.strictEqual(res.status, 200);
|
|
100
|
-
} finally {
|
|
101
|
-
await srv.close();
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2021",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "NodeNext",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"resolveJsonModule": true,
|
|
10
|
-
"outDir": "dist"
|
|
11
|
-
},
|
|
12
|
-
"include": ["src/**/*"]
|
|
13
|
-
}
|