@ycodium-ai/agent-acp 0.2.3096 → 0.2.3102

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.
Files changed (2) hide show
  1. package/dist/index.js +24 -3
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -27058,6 +27058,24 @@ var dispatchAcpPrompt = (executor, input2) => {
27058
27058
  ]);
27059
27059
  };
27060
27060
 
27061
+ // ../../packages/ycodium-acp-executor/src/start-abort.ts
27062
+ function throwIfStartAborted(signal) {
27063
+ if (signal?.aborted) throw new Error("aborted");
27064
+ }
27065
+ async function raceStartAbort(promise2, signal) {
27066
+ void promise2.catch(() => void 0);
27067
+ throwIfStartAborted(signal);
27068
+ if (signal === void 0) return promise2;
27069
+ const aborted2 = Promise.withResolvers();
27070
+ const onAbort = () => aborted2.reject(new Error("aborted"));
27071
+ signal.addEventListener("abort", onAbort, { once: true });
27072
+ try {
27073
+ return await Promise.race([promise2, aborted2.promise]);
27074
+ } finally {
27075
+ signal.removeEventListener("abort", onAbort);
27076
+ }
27077
+ }
27078
+
27061
27079
  // ../../packages/ycodium-acp-executor/src/mcp-servers.ts
27062
27080
  function toAcpMcpServers(entries) {
27063
27081
  return (entries ?? []).map(
@@ -27608,7 +27626,7 @@ var createAcpInstance = (config2, host) => {
27608
27626
  // 还没用真机确认这家 CLI 对 cwd 之外的读怎么处理、要不要放行。确认之后再接这一栏。
27609
27627
  startSession: async (input2, signal) => {
27610
27628
  if (disposed) throw new Error("instance disposed");
27611
- if (signal?.aborted) throw new Error("aborted");
27629
+ throwIfStartAborted(signal);
27612
27630
  if (recipe.binaryPath.length === 0) {
27613
27631
  throw new Error("ACP program path is not configured");
27614
27632
  }
@@ -27618,6 +27636,7 @@ var createAcpInstance = (config2, host) => {
27618
27636
  if (existing !== void 0) {
27619
27637
  await stopBooked(existing);
27620
27638
  threads.delete(input2.threadId);
27639
+ throwIfStartAborted(signal);
27621
27640
  }
27622
27641
  const env = buildSpawnEnv(recipe, recipe.homePath);
27623
27642
  const handle = await host.process.spawn({
@@ -27668,15 +27687,17 @@ var createAcpInstance = (config2, host) => {
27668
27687
  }
27669
27688
  })();
27670
27689
  try {
27671
- const started = await executor.start();
27690
+ throwIfStartAborted(signal);
27691
+ const started = await raceStartAbort(executor.start(), signal);
27672
27692
  const modeToApply = acpSessionModeToApply(
27673
27693
  input2.nativeModeId,
27674
27694
  acpCurrentModeId(started.sessionSetupResult)
27675
27695
  );
27676
27696
  if (modeToApply !== void 0) {
27677
- await executor.setNativeMode(modeToApply);
27697
+ await raceStartAbort(executor.setNativeMode(modeToApply), signal);
27678
27698
  }
27679
27699
  await yieldTick();
27700
+ throwIfStartAborted(signal);
27680
27701
  const createdAt = nowIso();
27681
27702
  const resumeCursor = {
27682
27703
  schemaVersion: RESUME_SCHEMA_VERSION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-acp",
3
- "version": "0.2.3096",
3
+ "version": "0.2.3102",
4
4
  "description": "Generic ACP executor: user-supplied CLI over Agent Client Protocol stdio.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -21,9 +21,9 @@
21
21
  "@types/node": "24.12.4",
22
22
  "esbuild": "0.28.1",
23
23
  "vite-plus": "0.2.2",
24
- "@ycodium-ai/plugin-api": "0.2.3096",
25
- "ycodium-acp-executor": "0.2.3096",
26
- "ycodium-executor-testing": "0.0.0"
24
+ "@ycodium-ai/plugin-api": "0.2.3102",
25
+ "ycodium-executor-testing": "0.0.0",
26
+ "ycodium-acp-executor": "0.2.3102"
27
27
  },
28
28
  "ycodium": {
29
29
  "plugin": "./dist/index.js",