@engineeros/connector 0.13.1 → 0.13.2
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/package.json +1 -1
- package/src/acp-client.mjs +22 -20
- package/src/runner.mjs +7 -4
package/package.json
CHANGED
package/src/acp-client.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import * as acp from "@agentclientprotocol/sdk";
|
|
|
5
5
|
const RUNTIME_IDLE_MS = 30 * 60 * 1_000;
|
|
6
6
|
const runtimes = new Map();
|
|
7
7
|
|
|
8
|
-
export function permissionOutcome(options = [], allow = false) {
|
|
8
|
+
export function permissionOutcome(options = [], allow = false) {
|
|
9
9
|
if (!allow) return { outcome: { outcome: "cancelled" } };
|
|
10
10
|
const selected =
|
|
11
11
|
options.find((option) => option.kind === "allow_once") ??
|
|
@@ -13,9 +13,9 @@ export function permissionOutcome(options = [], allow = false) {
|
|
|
13
13
|
return selected
|
|
14
14
|
? { outcome: { outcome: "selected", optionId: selected.optionId } }
|
|
15
15
|
: { outcome: { outcome: "cancelled" } };
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function launchAcpAgent(
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function launchAcpAgent(
|
|
19
19
|
workspace,
|
|
20
20
|
prompt,
|
|
21
21
|
config,
|
|
@@ -39,7 +39,7 @@ export function launchAcpAgent(
|
|
|
39
39
|
if (runtimeKey) runtimes.set(runtimeKey, runtime);
|
|
40
40
|
}
|
|
41
41
|
const sessionKey = options.sessionKey || `isolated-${crypto.randomUUID()}`;
|
|
42
|
-
const completed = runtime
|
|
42
|
+
const completed = runtime
|
|
43
43
|
.prompt({
|
|
44
44
|
sessionKey,
|
|
45
45
|
prompt,
|
|
@@ -49,9 +49,10 @@ export function launchAcpAgent(
|
|
|
49
49
|
callbacks,
|
|
50
50
|
})
|
|
51
51
|
.finally(async () => {
|
|
52
|
-
if (!persistent) await runtime.dispose();
|
|
53
|
-
});
|
|
54
|
-
|
|
52
|
+
if (!persistent) await runtime.dispose();
|
|
53
|
+
});
|
|
54
|
+
runtime.child.engineerOsCancel = () => runtime.dispose();
|
|
55
|
+
return {
|
|
55
56
|
child: runtime.child,
|
|
56
57
|
completed,
|
|
57
58
|
cancel: () => runtime.cancel(sessionKey),
|
|
@@ -117,18 +118,19 @@ class AcpRuntime {
|
|
|
117
118
|
this.stderr = "";
|
|
118
119
|
this.disposed = false;
|
|
119
120
|
this.idleTimer = null;
|
|
120
|
-
this.child = spawn(
|
|
121
|
-
config.agent_command,
|
|
122
|
-
Array.isArray(config.agent_args) ? config.agent_args : [],
|
|
123
|
-
{
|
|
124
|
-
cwd: workspace,
|
|
125
|
-
env: { ...process.env, ...(config.agent_env || {}) },
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
121
|
+
this.child = spawn(
|
|
122
|
+
config.agent_command,
|
|
123
|
+
Array.isArray(config.agent_args) ? config.agent_args : [],
|
|
124
|
+
{
|
|
125
|
+
cwd: workspace,
|
|
126
|
+
env: { ...process.env, ...(config.agent_env || {}) },
|
|
127
|
+
windowsHide: true,
|
|
128
|
+
shell:
|
|
129
|
+
process.platform === "win32" &&
|
|
130
|
+
/\.(cmd|bat)$/i.test(config.agent_command),
|
|
131
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
132
|
+
},
|
|
133
|
+
);
|
|
132
134
|
this.child.stderr.setEncoding("utf8");
|
|
133
135
|
this.child.stderr.on("data", (chunk) => {
|
|
134
136
|
this.stderr = `${this.stderr}${chunk}`.slice(-4_000);
|
package/src/runner.mjs
CHANGED
|
@@ -1007,10 +1007,13 @@ export function connectorExecution(assignment, options = {}) {
|
|
|
1007
1007
|
};
|
|
1008
1008
|
}
|
|
1009
1009
|
|
|
1010
|
-
export async function stopProcess(child) {
|
|
1011
|
-
if (!child || child.exitCode !== null) return;
|
|
1012
|
-
|
|
1013
|
-
|
|
1010
|
+
export async function stopProcess(child) {
|
|
1011
|
+
if (!child || child.exitCode !== null) return;
|
|
1012
|
+
if (typeof child.engineerOsCancel === "function") {
|
|
1013
|
+
await child.engineerOsCancel();
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
if (process.platform === "win32") {
|
|
1014
1017
|
await run(
|
|
1015
1018
|
"taskkill",
|
|
1016
1019
|
["/pid", String(child.pid), "/t", "/f"],
|