agent-neckbeard 1.1.10 → 1.1.12
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/LICENSE +21 -0
- package/README.md +43 -8
- package/dist/chunk-AM2J5KBI.js +50 -0
- package/dist/index.cjs +557 -38
- package/dist/index.d.cts +66 -30
- package/dist/index.d.ts +66 -30
- package/dist/index.js +495 -24
- package/dist/{invoke-client-WYMFPR3F.js → invoke-client-XEH6FVRH.js} +18 -12
- package/package.json +9 -2
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isHarnessEvent
|
|
3
|
+
} from "./chunk-AM2J5KBI.js";
|
|
4
|
+
|
|
1
5
|
// src/sse-framing.ts
|
|
2
6
|
async function* decodeSseStream(chunks) {
|
|
3
7
|
let buffer = "";
|
|
@@ -32,18 +36,12 @@ function parseFrame(raw) {
|
|
|
32
36
|
if (dataLines.length === 0) return void 0;
|
|
33
37
|
try {
|
|
34
38
|
return JSON.parse(dataLines.join("\n"));
|
|
35
|
-
} catch {
|
|
36
|
-
|
|
39
|
+
} catch (error) {
|
|
40
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
41
|
+
throw new Error(`Malformed SSE data frame: ${message}`);
|
|
37
42
|
}
|
|
38
43
|
}
|
|
39
44
|
|
|
40
|
-
// src/runtime/protocol.ts
|
|
41
|
-
function isHarnessEvent(value) {
|
|
42
|
-
if (!value || typeof value !== "object") return false;
|
|
43
|
-
const candidate = value;
|
|
44
|
-
return typeof candidate.kind === "string" && typeof candidate.invocationId === "string" && ["started", "frame", "output", "done", "error"].includes(candidate.kind);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
45
|
// src/invoke-client.ts
|
|
48
46
|
function createInvocationId() {
|
|
49
47
|
return `invoke_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -69,6 +67,16 @@ function buildRequestHeaders(options) {
|
|
|
69
67
|
}
|
|
70
68
|
return headers;
|
|
71
69
|
}
|
|
70
|
+
function validateHarnessEvent(rawEvent, invocationId) {
|
|
71
|
+
if (!isHarnessEvent(rawEvent)) {
|
|
72
|
+
throw new Error("Server returned an invalid harness event");
|
|
73
|
+
}
|
|
74
|
+
if (rawEvent.invocationId !== invocationId) {
|
|
75
|
+
throw new Error(
|
|
76
|
+
`Server returned event for invocation ${rawEvent.invocationId}; expected ${invocationId}`
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
72
80
|
async function* invokeServer(input, options) {
|
|
73
81
|
const fetchImpl = options.fetch ?? fetch;
|
|
74
82
|
const invocationId = options.invocationId ?? createInvocationId();
|
|
@@ -104,9 +112,7 @@ async function* invokeServer(input, options) {
|
|
|
104
112
|
}
|
|
105
113
|
}
|
|
106
114
|
for await (const rawEvent of decodeSseStream(chunks())) {
|
|
107
|
-
|
|
108
|
-
throw new Error("Server returned an invalid harness event");
|
|
109
|
-
}
|
|
115
|
+
validateHarnessEvent(rawEvent, invocationId);
|
|
110
116
|
if (rawEvent.kind === "frame" && options.frameSchema) {
|
|
111
117
|
yield {
|
|
112
118
|
...rawEvent,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-neckbeard",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
4
4
|
"description": "Deploy AI agents to E2B and Daytona sandboxes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -25,15 +25,22 @@
|
|
|
25
25
|
"engines": {
|
|
26
26
|
"node": ">=20.0.0"
|
|
27
27
|
},
|
|
28
|
+
"packageManager": "npm@10.9.4",
|
|
28
29
|
"scripts": {
|
|
29
30
|
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && node scripts/generate-runtime-server-source.mjs && tsup",
|
|
31
|
+
"check": "npm run typecheck && npm run lint && npm run format:check && npm test && npm run check:generated && npm run test:cjs && npm run pack:dry-run",
|
|
32
|
+
"check:generated": "node scripts/verify-runtime-server-source.mjs",
|
|
30
33
|
"dev": "tsup --watch",
|
|
34
|
+
"format:check": "node scripts/check-format.mjs",
|
|
35
|
+
"lint": "node scripts/repo-lint.mjs",
|
|
36
|
+
"pack:dry-run": "npm pack --dry-run",
|
|
31
37
|
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --config jest.config.mjs",
|
|
32
38
|
"test:watch": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --config jest.config.mjs --watch",
|
|
33
39
|
"test:e2e": "npm run build && node --experimental-vm-modules ./node_modules/jest/bin/jest.js --config jest.e2e.config.mjs --runInBand",
|
|
34
40
|
"test:e2e:e2b": "npm run build && node --experimental-vm-modules ./node_modules/jest/bin/jest.js --config jest.e2e.config.mjs --runInBand --testNamePattern=\"live E2B smoke tests\"",
|
|
35
41
|
"test:e2e:daytona": "npm run build && node --experimental-vm-modules ./node_modules/jest/bin/jest.js --config jest.e2e.config.mjs --runInBand --testNamePattern=\"live Daytona smoke tests\"",
|
|
36
|
-
"test:
|
|
42
|
+
"test:compat:next": "npm run build && node scripts/run-next-compat-test.mjs",
|
|
43
|
+
"test:cjs": "npm run build && node --experimental-vm-modules ./node_modules/jest/bin/jest.js --config jest.build.config.mjs",
|
|
37
44
|
"typecheck": "tsc --noEmit -p tsconfig.test.json",
|
|
38
45
|
"prepare": "npm run build"
|
|
39
46
|
},
|