@ycodium-ai/agent-acp 0.2.2588 → 0.2.2596

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 +26 -3
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -23741,6 +23741,10 @@ function createAcpConnection(options) {
23741
23741
  return;
23742
23742
  }
23743
23743
  pending.delete(key);
23744
+ try {
23745
+ options.onResponse?.(waiter.method);
23746
+ } catch {
23747
+ }
23744
23748
  if (Object.hasOwn(message, "error")) {
23745
23749
  const rpcError = readJsonRpcError(message["error"]);
23746
23750
  waiter.reject(
@@ -25363,6 +25367,8 @@ function createAcpExecutor(options) {
25363
25367
  let promptWaiters = [];
25364
25368
  let abortLocalPrompt;
25365
25369
  let connectionClosed = false;
25370
+ let sessionLoadInFlight = false;
25371
+ let droppedReplayUpdates = 0;
25366
25372
  const stamp = () => ({
25367
25373
  eventId: randomId(),
25368
25374
  createdAt: nowIso2()
@@ -25434,6 +25440,10 @@ function createAcpExecutor(options) {
25434
25440
  if (commands !== void 0) {
25435
25441
  availableCommands = commands;
25436
25442
  }
25443
+ if (sessionLoadInFlight) {
25444
+ droppedReplayUpdates += parsed.events.filter((event) => event._tag !== "ModeChanged").length;
25445
+ return;
25446
+ }
25437
25447
  for (const event of parsed.events) {
25438
25448
  if (event._tag === "ToolCallUpdated") {
25439
25449
  closeActiveAssistantSegment(activeTurnId);
@@ -25707,6 +25717,10 @@ function createAcpExecutor(options) {
25707
25717
  error: error62 instanceof Error ? error62.message : String(error62)
25708
25718
  });
25709
25719
  },
25720
+ // 窗口在应答帧到达的那一刻同步收掉:应答之后的通知是真输出,不能再丢。
25721
+ onResponse: (method) => {
25722
+ if (method === "session/load") sessionLoadInFlight = false;
25723
+ },
25710
25724
  onNotification: (notification) => {
25711
25725
  if (notification.method === "session/update") {
25712
25726
  handleSessionUpdate(notification.params);
@@ -25853,10 +25867,19 @@ function createAcpExecutor(options) {
25853
25867
  });
25854
25868
  nextSessionId = options.resumeSessionId;
25855
25869
  } else if (options.resumeSessionId) {
25856
- setup = await connection.request("session/load", {
25870
+ sessionLoadInFlight = true;
25871
+ try {
25872
+ setup = await connection.request("session/load", {
25873
+ sessionId: options.resumeSessionId,
25874
+ cwd: options.cwd,
25875
+ mcpServers
25876
+ });
25877
+ } finally {
25878
+ sessionLoadInFlight = false;
25879
+ }
25880
+ options.log?.info("acp session loaded; replayed history was not projected", {
25857
25881
  sessionId: options.resumeSessionId,
25858
- cwd: options.cwd,
25859
- mcpServers
25882
+ droppedReplayUpdates
25860
25883
  });
25861
25884
  nextSessionId = options.resumeSessionId;
25862
25885
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-acp",
3
- "version": "0.2.2588",
3
+ "version": "0.2.2596",
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.2588",
25
- "ycodium-acp-executor": "0.2.2588",
26
- "ycodium-executor-testing": "0.0.0"
24
+ "ycodium-acp-executor": "0.2.2596",
25
+ "ycodium-executor-testing": "0.0.0",
26
+ "@ycodium-ai/plugin-api": "0.2.2596"
27
27
  },
28
28
  "ycodium": {
29
29
  "plugin": "./dist/index.js",