@ycodium-ai/agent-antigravity 0.2.3766 → 0.2.3851

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 +43 -30
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -27612,6 +27612,7 @@ function createExecutorPrompt({
27612
27612
  promptResults,
27613
27613
  settleToolSubagents
27614
27614
  }) {
27615
+ const ownOutcomes = /* @__PURE__ */ new Map();
27615
27616
  const settleTurn = (input2) => {
27616
27617
  if (!isLive(input2.expectedGeneration) || input2.record.finished) {
27617
27618
  return false;
@@ -27628,14 +27629,22 @@ function createExecutorPrompt({
27628
27629
  }
27629
27630
  closeActiveAssistantSegment(input2.turnId);
27630
27631
  shared.promptsInFlight = Math.max(0, shared.promptsInFlight - 1);
27631
- if (shared.promptsInFlight !== 0 || shared.activeTurnId !== input2.turnId) return false;
27632
+ if (shared.promptsInFlight !== 0 || shared.activeTurnId !== input2.turnId) {
27633
+ if (input2.foldedIn !== true) ownOutcomes.set(input2.turnId, input2);
27634
+ return false;
27635
+ }
27636
+ const outcome = (input2.foldedIn === true ? ownOutcomes.get(input2.turnId) : void 0) ?? input2;
27637
+ ownOutcomes.delete(input2.turnId);
27632
27638
  shared.activeTurnId = void 0;
27633
27639
  if (shared.status !== "disposed") {
27634
27640
  shared.status = "ready";
27635
27641
  }
27636
27642
  const interrupted = promptResults.hasInterrupted(input2.turnId);
27637
27643
  settleToolSubagents(
27638
- toolSubagentSettlementOfTurn(interrupted ? "cancelled" : input2.state, input2.failureCategory),
27644
+ toolSubagentSettlementOfTurn(
27645
+ interrupted ? "cancelled" : outcome.state,
27646
+ outcome.failureCategory
27647
+ ),
27639
27648
  input2.turnId
27640
27649
  );
27641
27650
  emit({
@@ -27645,10 +27654,10 @@ function createExecutorPrompt({
27645
27654
  threadId: options2.threadId,
27646
27655
  turnId: input2.turnId,
27647
27656
  payload: {
27648
- state: interrupted ? "cancelled" : input2.state,
27649
- stopReason: interrupted ? "cancelled" : input2.stopReason,
27650
- ...input2.errorMessage === void 0 ? {} : { errorMessage: input2.errorMessage },
27651
- ...input2.state === "failed" ? failureCategoryField(input2.failureCategory) : {}
27657
+ state: interrupted ? "cancelled" : outcome.state,
27658
+ stopReason: interrupted ? "cancelled" : outcome.stopReason,
27659
+ ...outcome.errorMessage === void 0 ? {} : { errorMessage: outcome.errorMessage },
27660
+ ...outcome.state === "failed" ? failureCategoryField(outcome.failureCategory) : {}
27652
27661
  }
27653
27662
  });
27654
27663
  interruptedTurnIds.delete(input2.turnId);
@@ -27673,7 +27682,7 @@ function createExecutorPrompt({
27673
27682
  return await promptRpc;
27674
27683
  } else {
27675
27684
  const { promise: early, resolve: settleEarly } = Promise.withResolvers();
27676
- shared.pendingSettlement = {
27685
+ shared.pendingSettlements.set(promptKey, {
27677
27686
  promptKey,
27678
27687
  sessionId,
27679
27688
  settle: settleEarly,
@@ -27682,7 +27691,7 @@ function createExecutorPrompt({
27682
27691
  onError: () => promptResults.reject(record2.promptId),
27683
27692
  hasResult: () => record2.response !== void 0
27684
27693
  }
27685
- };
27694
+ });
27686
27695
  try {
27687
27696
  const outcome = await Promise.race([
27688
27697
  promptRpc.then((value) => {
@@ -27695,7 +27704,7 @@ function createExecutorPrompt({
27695
27704
  if (outcome.error !== void 0) throw outcome.error;
27696
27705
  return outcome.response;
27697
27706
  } finally {
27698
- shared.pendingSettlement = void 0;
27707
+ shared.pendingSettlements.delete(promptKey);
27699
27708
  void promptRpc.catch(() => void 0);
27700
27709
  }
27701
27710
  }
@@ -27845,7 +27854,9 @@ function createExecutorPrompt({
27845
27854
  settle2({
27846
27855
  turnId,
27847
27856
  stopReason,
27848
- state: response2.stopReason === "cancelled" ? "cancelled" : "completed"
27857
+ state: response2.stopReason === "cancelled" ? "cancelled" : "completed",
27858
+ // 立刻写出的插话没被打断却应答 cancelled:agent 把它并进了这一轮(grok 的 removedFromQueue)。
27859
+ foldedIn: response2.stopReason === "cancelled" && input2.expectedActiveTurnId !== void 0 && hooks.queuesPromptsWhileRunning === true
27849
27860
  });
27850
27861
  return {
27851
27862
  threadId: options2.threadId,
@@ -27854,7 +27865,8 @@ function createExecutorPrompt({
27854
27865
  ...response2.usage !== void 0 && response2.usage !== null ? { usage: response2.usage } : {}
27855
27866
  };
27856
27867
  };
27857
- await promptMutex.acquire();
27868
+ const writesWhileRunning = input2.expectedActiveTurnId !== void 0 && hooks.queuesPromptsWhileRunning === true;
27869
+ if (!writesWhileRunning) await promptMutex.acquire();
27858
27870
  let response;
27859
27871
  try {
27860
27872
  failIfDisposed();
@@ -27936,7 +27948,7 @@ function createExecutorPrompt({
27936
27948
  await options2.beforeApplyResult();
27937
27949
  }
27938
27950
  } finally {
27939
- promptMutex.release();
27951
+ if (!writesWhileRunning) promptMutex.release();
27940
27952
  notifyPromptSettled();
27941
27953
  }
27942
27954
  if (!isLive(started.generation)) {
@@ -29032,28 +29044,29 @@ function createExecutorSettlement({
29032
29044
  if (settledPromptKeys.length > SETTLED_PROMPT_KEY_LIMIT) settledPromptKeys.shift();
29033
29045
  };
29034
29046
  const abortPendingSettlement = (reason, failureCategory) => {
29035
- const waiting = shared.pendingSettlement;
29036
- if (waiting === void 0) return;
29037
- if (waiting.hasResult?.()) return;
29038
- shared.pendingSettlement = void 0;
29039
- waiting.settle({
29040
- error: withFailureCategory(
29041
- new AcpExecutorRequestError("session/prompt", reason),
29042
- failureCategory
29043
- )
29044
- });
29047
+ for (const [key, waiting] of shared.pendingSettlements) {
29048
+ if (waiting.hasResult?.()) continue;
29049
+ shared.pendingSettlements.delete(key);
29050
+ waiting.settle({
29051
+ error: withFailureCategory(
29052
+ new AcpExecutorRequestError("session/prompt", reason),
29053
+ failureCategory
29054
+ )
29055
+ });
29056
+ }
29045
29057
  };
29046
29058
  const settleFromNotification = (method, params) => {
29047
29059
  const hook = hooks.promptSettlement;
29048
- if (hook === void 0 || shared.pendingSettlement === void 0) return false;
29060
+ if (hook === void 0 || shared.pendingSettlements.size === 0) return false;
29049
29061
  const signal = hook.fromNotification(method, params);
29050
29062
  if (signal === void 0) return false;
29051
- const waiting = shared.pendingSettlement;
29052
- if (signal.sessionId !== waiting.sessionId) return false;
29053
- if (signal.promptKey !== void 0 && signal.promptKey !== waiting.promptKey) {
29054
- return settledPromptKeys.includes(signal.promptKey);
29063
+ const waiting = signal.promptKey === void 0 ? [...shared.pendingSettlements.values()].find(
29064
+ (candidate) => candidate.sessionId === signal.sessionId
29065
+ ) : shared.pendingSettlements.get(signal.promptKey);
29066
+ if (waiting === void 0 || waiting.sessionId !== signal.sessionId) {
29067
+ return signal.promptKey !== void 0 && settledPromptKeys.includes(signal.promptKey);
29055
29068
  }
29056
- shared.pendingSettlement = void 0;
29069
+ shared.pendingSettlements.delete(waiting.promptKey);
29057
29070
  rememberSettledPromptKey(waiting.promptKey);
29058
29071
  if (signal.outcome === "error") {
29059
29072
  waiting.onError?.();
@@ -29647,7 +29660,7 @@ function createAcpExecutor(options2) {
29647
29660
  startInFlight: void 0,
29648
29661
  activeTurnId: void 0,
29649
29662
  promptsInFlight: 0,
29650
- pendingSettlement: void 0,
29663
+ pendingSettlements: /* @__PURE__ */ new Map(),
29651
29664
  manualCompaction: void 0,
29652
29665
  assistantSegment: { nextSegmentIndex: 0 },
29653
29666
  modeState: void 0,
@@ -34830,7 +34843,7 @@ var executors = [
34830
34843
  ];
34831
34844
  var index_default = definePlugin({
34832
34845
  id: "agent-antigravity",
34833
- apiVersion: 56,
34846
+ apiVersion: 63,
34834
34847
  executors,
34835
34848
  activate(ctx) {
34836
34849
  const runtime = createRuntimeManager({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-antigravity",
3
- "version": "0.2.3766",
3
+ "version": "0.2.3851",
4
4
  "description": "Google Antigravity executor: runs the Antigravity agent over Agent Client Protocol stdio.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -31,9 +31,9 @@
31
31
  "typescript": "~6.0.3",
32
32
  "vite-plus": "0.2.2",
33
33
  "yauzl": "^3.4.0",
34
- "@ycodium-ai/plugin-api": "0.2.3766",
34
+ "@ycodium-ai/plugin-api": "0.2.3851",
35
35
  "ycodium-executor-testing": "0.0.0",
36
- "ycodium-acp-executor": "0.2.3766"
36
+ "ycodium-acp-executor": "0.2.3851"
37
37
  },
38
38
  "ycodium": {
39
39
  "plugin": "./dist/index.js",