@engineeros/connector 0.15.2 → 0.16.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 +105 -111
- package/bin/engineeros-connector.mjs +1021 -982
- package/package.json +41 -41
- package/src/acp-client.mjs +69 -68
- package/src/assessment-spool.mjs +282 -227
- package/src/codex-app-server.mjs +3 -2
- package/src/connection.mjs +8 -2
- package/src/runner.mjs +2097 -2094
package/package.json
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@engineeros/connector",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Connect a local coding agent to EngineerOS, using ACP when supported.",
|
|
5
|
-
"private": false,
|
|
6
|
-
"type": "module",
|
|
7
|
-
"license": "UNLICENSED",
|
|
8
|
-
"files": [
|
|
9
|
-
"bin",
|
|
10
|
-
"src",
|
|
11
|
-
"README.md"
|
|
12
|
-
],
|
|
13
|
-
"bin": {
|
|
14
|
-
"engineeros-connector": "bin/engineeros-connector.mjs"
|
|
15
|
-
},
|
|
16
|
-
"scripts": {
|
|
17
|
-
"start": "node ./bin/engineeros-connector.mjs",
|
|
18
|
-
"prepublishOnly": "node ./scripts/release.mjs check",
|
|
19
|
-
"release:patch": "node ./scripts/release.mjs patch",
|
|
20
|
-
"test": "node --test --test-concurrency=1",
|
|
21
|
-
"type-check": "node --check ./bin/engineeros-connector.mjs && node --check ./scripts/release.mjs && node --check ./src/acp-client.mjs && node --check ./src/agent-harness.mjs && node --check ./src/agent-registry.mjs && node --check ./src/assessment-spool.mjs && node --check ./src/capabilities.mjs && node --check ./src/cli-args.mjs && node --check ./src/codex-app-server.mjs && node --check ./src/config.mjs && node --check ./src/connection.mjs && node --check ./src/mcp-server.mjs && node --check ./src/runner.mjs"
|
|
22
|
-
},
|
|
23
|
-
"engines": {
|
|
24
|
-
"node": ">=22"
|
|
25
|
-
},
|
|
26
|
-
"repository": {
|
|
27
|
-
"type": "git",
|
|
28
|
-
"url": "git+https://github.com/vinpuli/engineerosv2.git",
|
|
29
|
-
"directory": "packages/engineeros-connector"
|
|
30
|
-
},
|
|
31
|
-
"bugs": {
|
|
32
|
-
"url": "https://github.com/vinpuli/engineerosv2/issues"
|
|
33
|
-
},
|
|
34
|
-
"publishConfig": {
|
|
35
|
-
"access": "public"
|
|
36
|
-
},
|
|
37
|
-
"dependencies": {
|
|
38
|
-
"@agentclientprotocol/sdk": "1.3.0",
|
|
39
|
-
"zod": "3.25.76"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@engineeros/connector",
|
|
3
|
+
"version": "0.16.0",
|
|
4
|
+
"description": "Connect a local coding agent to EngineerOS, using ACP when supported.",
|
|
5
|
+
"private": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "UNLICENSED",
|
|
8
|
+
"files": [
|
|
9
|
+
"bin",
|
|
10
|
+
"src",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"bin": {
|
|
14
|
+
"engineeros-connector": "bin/engineeros-connector.mjs"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"start": "node ./bin/engineeros-connector.mjs",
|
|
18
|
+
"prepublishOnly": "node ./scripts/release.mjs check",
|
|
19
|
+
"release:patch": "node ./scripts/release.mjs patch",
|
|
20
|
+
"test": "node --test --test-concurrency=1",
|
|
21
|
+
"type-check": "node --check ./bin/engineeros-connector.mjs && node --check ./scripts/release.mjs && node --check ./src/acp-client.mjs && node --check ./src/agent-harness.mjs && node --check ./src/agent-registry.mjs && node --check ./src/assessment-spool.mjs && node --check ./src/capabilities.mjs && node --check ./src/cli-args.mjs && node --check ./src/codex-app-server.mjs && node --check ./src/config.mjs && node --check ./src/connection.mjs && node --check ./src/mcp-server.mjs && node --check ./src/runner.mjs"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=22"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/vinpuli/engineerosv2.git",
|
|
29
|
+
"directory": "packages/engineeros-connector"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/vinpuli/engineerosv2/issues"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@agentclientprotocol/sdk": "1.3.0",
|
|
39
|
+
"zod": "3.25.76"
|
|
40
|
+
}
|
|
41
|
+
}
|
package/src/acp-client.mjs
CHANGED
|
@@ -115,10 +115,10 @@ class AcpRuntime {
|
|
|
115
115
|
this.onClose = onClose;
|
|
116
116
|
this.sessions = new Map();
|
|
117
117
|
this.turns = new Map();
|
|
118
|
-
this.stderr = "";
|
|
119
|
-
this.disposed = false;
|
|
120
|
-
this.disposePromise = null;
|
|
121
|
-
this.idleTimer = null;
|
|
118
|
+
this.stderr = "";
|
|
119
|
+
this.disposed = false;
|
|
120
|
+
this.disposePromise = null;
|
|
121
|
+
this.idleTimer = null;
|
|
122
122
|
this.child = spawn(
|
|
123
123
|
config.agent_command,
|
|
124
124
|
Array.isArray(config.agent_args) ? config.agent_args : [],
|
|
@@ -159,13 +159,13 @@ class AcpRuntime {
|
|
|
159
159
|
)
|
|
160
160
|
.connect(stream);
|
|
161
161
|
this.context = this.connection.agent;
|
|
162
|
-
this.ready = this.initialize();
|
|
163
|
-
void this.ready.catch(() => {
|
|
164
|
-
void this.dispose();
|
|
165
|
-
});
|
|
166
|
-
this.child.stdout.once("end", () => this.closed());
|
|
167
|
-
this.child.stdout.once("close", () => this.closed());
|
|
168
|
-
this.child.once("exit", () => this.closed());
|
|
162
|
+
this.ready = this.initialize();
|
|
163
|
+
void this.ready.catch(() => {
|
|
164
|
+
void this.dispose();
|
|
165
|
+
});
|
|
166
|
+
this.child.stdout.once("end", () => this.closed());
|
|
167
|
+
this.child.stdout.once("close", () => this.closed());
|
|
168
|
+
this.child.once("exit", () => this.closed());
|
|
169
169
|
void this.connection.closed.then(
|
|
170
170
|
() => this.closed(),
|
|
171
171
|
() => this.closed(),
|
|
@@ -201,19 +201,20 @@ class AcpRuntime {
|
|
|
201
201
|
this.clearIdleTimer();
|
|
202
202
|
const initialized = await this.ready;
|
|
203
203
|
let session = this.sessions.get(sessionKey);
|
|
204
|
-
if (!session) {
|
|
205
|
-
session = await this.openSession(
|
|
204
|
+
if (!session) {
|
|
205
|
+
session = await this.openSession(
|
|
206
206
|
sessionKey,
|
|
207
207
|
previousSessionId,
|
|
208
208
|
sandbox,
|
|
209
209
|
profile,
|
|
210
210
|
);
|
|
211
|
-
callbacks.onEvent?.({
|
|
212
|
-
type: "agent.connected",
|
|
213
|
-
message: `Agent connected with protocol ${initialized.protocolVersion}`,
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
|
|
211
|
+
callbacks.onEvent?.({
|
|
212
|
+
type: "agent.connected",
|
|
213
|
+
message: `Agent connected with protocol ${initialized.protocolVersion}`,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
await callbacks.onSession?.(session.sessionId);
|
|
217
|
+
if (this.turns.has(session.sessionId)) {
|
|
217
218
|
throw new Error(
|
|
218
219
|
"The agent is already answering another prompt in this session.",
|
|
219
220
|
);
|
|
@@ -361,17 +362,17 @@ class AcpRuntime {
|
|
|
361
362
|
});
|
|
362
363
|
}
|
|
363
364
|
|
|
364
|
-
isRunning() {
|
|
365
|
-
return (
|
|
366
|
-
!this.disposed &&
|
|
367
|
-
this.childIsRunning() &&
|
|
368
|
-
!this.connection.signal.aborted
|
|
369
|
-
);
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
childIsRunning() {
|
|
373
|
-
return this.child.exitCode === null && this.child.signalCode === null;
|
|
374
|
-
}
|
|
365
|
+
isRunning() {
|
|
366
|
+
return (
|
|
367
|
+
!this.disposed &&
|
|
368
|
+
this.childIsRunning() &&
|
|
369
|
+
!this.connection.signal.aborted
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
childIsRunning() {
|
|
374
|
+
return this.child.exitCode === null && this.child.signalCode === null;
|
|
375
|
+
}
|
|
375
376
|
|
|
376
377
|
scheduleIdleDisposal() {
|
|
377
378
|
if (this.turns.size || this.disposed) return;
|
|
@@ -393,44 +394,44 @@ class AcpRuntime {
|
|
|
393
394
|
);
|
|
394
395
|
}
|
|
395
396
|
|
|
396
|
-
closed() {
|
|
397
|
-
void this.dispose();
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
async dispose() {
|
|
401
|
-
if (this.disposePromise) return this.disposePromise;
|
|
402
|
-
this.disposed = true;
|
|
403
|
-
this.clearIdleTimer();
|
|
404
|
-
this.onClose?.();
|
|
405
|
-
this.disposePromise = this.releaseResources();
|
|
406
|
-
return this.disposePromise;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
async releaseResources() {
|
|
410
|
-
try {
|
|
411
|
-
this.connection.close();
|
|
412
|
-
} catch {
|
|
413
|
-
// The ACP transport may already be closed.
|
|
414
|
-
}
|
|
415
|
-
if (this.childIsRunning()) {
|
|
416
|
-
this.child.kill("SIGTERM");
|
|
417
|
-
await Promise.race([
|
|
418
|
-
new Promise((resolve) => this.child.once("exit", resolve)),
|
|
419
|
-
new Promise((resolve) => setTimeout(resolve, 500)),
|
|
420
|
-
]);
|
|
421
|
-
}
|
|
422
|
-
if (this.childIsRunning()) {
|
|
423
|
-
this.child.kill("SIGKILL");
|
|
424
|
-
await Promise.race([
|
|
425
|
-
new Promise((resolve) => this.child.once("exit", resolve)),
|
|
426
|
-
new Promise((resolve) => setTimeout(resolve, 500)),
|
|
427
|
-
]);
|
|
428
|
-
}
|
|
429
|
-
this.child.stdin.destroy();
|
|
430
|
-
this.child.stdout.destroy();
|
|
431
|
-
this.child.stderr.destroy();
|
|
432
|
-
}
|
|
433
|
-
}
|
|
397
|
+
closed() {
|
|
398
|
+
void this.dispose();
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
async dispose() {
|
|
402
|
+
if (this.disposePromise) return this.disposePromise;
|
|
403
|
+
this.disposed = true;
|
|
404
|
+
this.clearIdleTimer();
|
|
405
|
+
this.onClose?.();
|
|
406
|
+
this.disposePromise = this.releaseResources();
|
|
407
|
+
return this.disposePromise;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
async releaseResources() {
|
|
411
|
+
try {
|
|
412
|
+
this.connection.close();
|
|
413
|
+
} catch {
|
|
414
|
+
// The ACP transport may already be closed.
|
|
415
|
+
}
|
|
416
|
+
if (this.childIsRunning()) {
|
|
417
|
+
this.child.kill("SIGTERM");
|
|
418
|
+
await Promise.race([
|
|
419
|
+
new Promise((resolve) => this.child.once("exit", resolve)),
|
|
420
|
+
new Promise((resolve) => setTimeout(resolve, 500)),
|
|
421
|
+
]);
|
|
422
|
+
}
|
|
423
|
+
if (this.childIsRunning()) {
|
|
424
|
+
this.child.kill("SIGKILL");
|
|
425
|
+
await Promise.race([
|
|
426
|
+
new Promise((resolve) => this.child.once("exit", resolve)),
|
|
427
|
+
new Promise((resolve) => setTimeout(resolve, 500)),
|
|
428
|
+
]);
|
|
429
|
+
}
|
|
430
|
+
this.child.stdin.destroy();
|
|
431
|
+
this.child.stdout.destroy();
|
|
432
|
+
this.child.stderr.destroy();
|
|
433
|
+
}
|
|
434
|
+
}
|
|
434
435
|
|
|
435
436
|
export function normalizeTokenUsage(value) {
|
|
436
437
|
if (!value || typeof value !== "object") return null;
|