@agen-ai/provider-acp 0.4.5 → 0.4.6

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.
@@ -33,12 +33,23 @@ async function spawnAcpProcess(launch, context) {
33
33
  return false;
34
34
  }
35
35
  };
36
- const waitForShutdown = async () => {
36
+ const signalAndWait = async (initialSignal) => {
37
+ let nextSignal = initialSignal;
38
+ let pendingSignalError;
37
39
  const deadline = performance.now() + launch.shutdownTimeoutMs;
38
40
  for (; ; ) {
39
- if (!signalGroup(0) && closed) return true;
41
+ try {
42
+ if (!signalGroup(nextSignal) && closed) return true;
43
+ } catch (error) {
44
+ if (closed || !(error instanceof Error) || !("code" in error) || error.code !== "EPERM") throw error;
45
+ pendingSignalError = error;
46
+ }
40
47
  const remaining = deadline - performance.now();
41
- if (remaining <= 0) return false;
48
+ if (remaining <= 0) {
49
+ if (pendingSignalError) throw pendingSignalError;
50
+ return false;
51
+ }
52
+ nextSignal = 0;
42
53
  await delay(Math.min(10, remaining));
43
54
  }
44
55
  };
@@ -47,10 +58,8 @@ async function spawnAcpProcess(launch, context) {
47
58
  if (!releasePromise) releasePromise = Promise.resolve().then(async () => {
48
59
  try {
49
60
  if (!child.stdin.destroyed) child.stdin.end();
50
- signalGroup("SIGTERM");
51
- if (await waitForShutdown()) return;
52
- signalGroup("SIGKILL");
53
- if (!await waitForShutdown()) throw new AcpProviderConnectionError(
61
+ if (await signalAndWait("SIGTERM")) return;
62
+ if (!await signalAndWait("SIGKILL")) throw new AcpProviderConnectionError(
54
63
  "acp_provider_process_shutdown_timeout",
55
64
  "The owned ACP process group and streams did not close after termination."
56
65
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agen-ai/provider-acp",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "private": false,
5
5
  "description": "Optional Agent Client Protocol provider for the AgenAI coding-agent runtime.",
6
6
  "type": "module",
@@ -27,9 +27,9 @@
27
27
  "./package.json": "./package.json"
28
28
  },
29
29
  "dependencies": {
30
- "@agen-ai/acp-transport": "^0.4.5",
31
- "@agen-ai/agent-runtime": "^0.4.5",
32
- "@agen-ai/agent-protocol": "^0.4.5"
30
+ "@agen-ai/acp-transport": "^0.4.6",
31
+ "@agen-ai/agent-protocol": "^0.4.6",
32
+ "@agen-ai/agent-runtime": "^0.4.6"
33
33
  },
34
34
  "devDependencies": {
35
35
  "tsup": "^8.5.0"