@ycodium-ai/agent-antigravity 0.2.3710 → 0.2.3799

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/dist/index.js CHANGED
@@ -1385,6 +1385,10 @@ var require_yauzl = __commonJS({
1385
1385
 
1386
1386
  // src/index.ts
1387
1387
  import { definePlugin } from "@ycodium-ai/plugin-api";
1388
+ import {
1389
+ EXECUTOR_EFFECTIVE_PAYLOAD_SCHEMA,
1390
+ readExecutorEffectiveRequest
1391
+ } from "@ycodium-ai/plugin-api/executor";
1388
1392
 
1389
1393
  // src/signIn.ts
1390
1394
  var ANTIGRAVITY_SIGN_IN_REQUIRED_MESSAGE = "Antigravity is not signed in. Sign in with your Google account, then try again.";
@@ -27608,6 +27612,7 @@ function createExecutorPrompt({
27608
27612
  promptResults,
27609
27613
  settleToolSubagents
27610
27614
  }) {
27615
+ const ownOutcomes = /* @__PURE__ */ new Map();
27611
27616
  const settleTurn = (input2) => {
27612
27617
  if (!isLive(input2.expectedGeneration) || input2.record.finished) {
27613
27618
  return false;
@@ -27624,14 +27629,22 @@ function createExecutorPrompt({
27624
27629
  }
27625
27630
  closeActiveAssistantSegment(input2.turnId);
27626
27631
  shared.promptsInFlight = Math.max(0, shared.promptsInFlight - 1);
27627
- 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);
27628
27638
  shared.activeTurnId = void 0;
27629
27639
  if (shared.status !== "disposed") {
27630
27640
  shared.status = "ready";
27631
27641
  }
27632
27642
  const interrupted = promptResults.hasInterrupted(input2.turnId);
27633
27643
  settleToolSubagents(
27634
- toolSubagentSettlementOfTurn(interrupted ? "cancelled" : input2.state, input2.failureCategory),
27644
+ toolSubagentSettlementOfTurn(
27645
+ interrupted ? "cancelled" : outcome.state,
27646
+ outcome.failureCategory
27647
+ ),
27635
27648
  input2.turnId
27636
27649
  );
27637
27650
  emit({
@@ -27641,10 +27654,10 @@ function createExecutorPrompt({
27641
27654
  threadId: options2.threadId,
27642
27655
  turnId: input2.turnId,
27643
27656
  payload: {
27644
- state: interrupted ? "cancelled" : input2.state,
27645
- stopReason: interrupted ? "cancelled" : input2.stopReason,
27646
- ...input2.errorMessage === void 0 ? {} : { errorMessage: input2.errorMessage },
27647
- ...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) : {}
27648
27661
  }
27649
27662
  });
27650
27663
  interruptedTurnIds.delete(input2.turnId);
@@ -27669,7 +27682,7 @@ function createExecutorPrompt({
27669
27682
  return await promptRpc;
27670
27683
  } else {
27671
27684
  const { promise: early, resolve: settleEarly } = Promise.withResolvers();
27672
- shared.pendingSettlement = {
27685
+ shared.pendingSettlements.set(promptKey, {
27673
27686
  promptKey,
27674
27687
  sessionId,
27675
27688
  settle: settleEarly,
@@ -27678,7 +27691,7 @@ function createExecutorPrompt({
27678
27691
  onError: () => promptResults.reject(record2.promptId),
27679
27692
  hasResult: () => record2.response !== void 0
27680
27693
  }
27681
- };
27694
+ });
27682
27695
  try {
27683
27696
  const outcome = await Promise.race([
27684
27697
  promptRpc.then((value) => {
@@ -27691,7 +27704,7 @@ function createExecutorPrompt({
27691
27704
  if (outcome.error !== void 0) throw outcome.error;
27692
27705
  return outcome.response;
27693
27706
  } finally {
27694
- shared.pendingSettlement = void 0;
27707
+ shared.pendingSettlements.delete(promptKey);
27695
27708
  void promptRpc.catch(() => void 0);
27696
27709
  }
27697
27710
  }
@@ -27841,7 +27854,9 @@ function createExecutorPrompt({
27841
27854
  settle2({
27842
27855
  turnId,
27843
27856
  stopReason,
27844
- 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
27845
27860
  });
27846
27861
  return {
27847
27862
  threadId: options2.threadId,
@@ -27850,7 +27865,8 @@ function createExecutorPrompt({
27850
27865
  ...response2.usage !== void 0 && response2.usage !== null ? { usage: response2.usage } : {}
27851
27866
  };
27852
27867
  };
27853
- await promptMutex.acquire();
27868
+ const writesWhileRunning = input2.expectedActiveTurnId !== void 0 && hooks.queuesPromptsWhileRunning === true;
27869
+ if (!writesWhileRunning) await promptMutex.acquire();
27854
27870
  let response;
27855
27871
  try {
27856
27872
  failIfDisposed();
@@ -27932,7 +27948,7 @@ function createExecutorPrompt({
27932
27948
  await options2.beforeApplyResult();
27933
27949
  }
27934
27950
  } finally {
27935
- promptMutex.release();
27951
+ if (!writesWhileRunning) promptMutex.release();
27936
27952
  notifyPromptSettled();
27937
27953
  }
27938
27954
  if (!isLive(started.generation)) {
@@ -29028,28 +29044,29 @@ function createExecutorSettlement({
29028
29044
  if (settledPromptKeys.length > SETTLED_PROMPT_KEY_LIMIT) settledPromptKeys.shift();
29029
29045
  };
29030
29046
  const abortPendingSettlement = (reason, failureCategory) => {
29031
- const waiting = shared.pendingSettlement;
29032
- if (waiting === void 0) return;
29033
- if (waiting.hasResult?.()) return;
29034
- shared.pendingSettlement = void 0;
29035
- waiting.settle({
29036
- error: withFailureCategory(
29037
- new AcpExecutorRequestError("session/prompt", reason),
29038
- failureCategory
29039
- )
29040
- });
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
+ }
29041
29057
  };
29042
29058
  const settleFromNotification = (method, params) => {
29043
29059
  const hook = hooks.promptSettlement;
29044
- if (hook === void 0 || shared.pendingSettlement === void 0) return false;
29060
+ if (hook === void 0 || shared.pendingSettlements.size === 0) return false;
29045
29061
  const signal = hook.fromNotification(method, params);
29046
29062
  if (signal === void 0) return false;
29047
- const waiting = shared.pendingSettlement;
29048
- if (signal.sessionId !== waiting.sessionId) return false;
29049
- if (signal.promptKey !== void 0 && signal.promptKey !== waiting.promptKey) {
29050
- 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);
29051
29068
  }
29052
- shared.pendingSettlement = void 0;
29069
+ shared.pendingSettlements.delete(waiting.promptKey);
29053
29070
  rememberSettledPromptKey(waiting.promptKey);
29054
29071
  if (signal.outcome === "error") {
29055
29072
  waiting.onError?.();
@@ -29643,7 +29660,7 @@ function createAcpExecutor(options2) {
29643
29660
  startInFlight: void 0,
29644
29661
  activeTurnId: void 0,
29645
29662
  promptsInFlight: 0,
29646
- pendingSettlement: void 0,
29663
+ pendingSettlements: /* @__PURE__ */ new Map(),
29647
29664
  manualCompaction: void 0,
29648
29665
  assistantSegment: { nextSegmentIndex: 0 },
29649
29666
  modeState: void 0,
@@ -30598,6 +30615,8 @@ var ANTIGRAVITY_CARD = {
30598
30615
  launchArgs: "",
30599
30616
  // 账户目录由插件按实例私有地建,GEMINI_HOME 由插件自己注入;宿主不替它投变量。
30600
30617
  homeEnvVar: "",
30618
+ // 设置表单里留空的格子此刻会用什么,见 index.ts 的同名命令。
30619
+ effectiveCommand: "effectiveConfig",
30601
30620
  environment: [],
30602
30621
  install: null,
30603
30622
  signIn: [],
@@ -34812,6 +34831,7 @@ var capturedDeps;
34812
34831
  var executors = [
34813
34832
  {
34814
34833
  card: ANTIGRAVITY_CARD,
34834
+ lifecycle: [{ kind: "detect", reversible: true }],
34815
34835
  createInstance: async (config2, host) => {
34816
34836
  host.log.info("createInstance");
34817
34837
  if (capturedDeps === void 0) {
@@ -34823,7 +34843,7 @@ var executors = [
34823
34843
  ];
34824
34844
  var index_default = definePlugin({
34825
34845
  id: "agent-antigravity",
34826
- apiVersion: 53,
34846
+ apiVersion: 60,
34827
34847
  executors,
34828
34848
  activate(ctx) {
34829
34849
  const runtime = createRuntimeManager({
@@ -34833,6 +34853,34 @@ var index_default = definePlugin({
34833
34853
  });
34834
34854
  capturedDeps = { dataDir: ctx.paths.dataDir, attachments: ctx.attachments, runtime };
34835
34855
  registerRuntimeCommands(ctx, runtime);
34856
+ ctx.command({
34857
+ name: "effectiveConfig",
34858
+ description: "Settings form: the program and account directory empty fields resolve to.",
34859
+ scope: "read",
34860
+ payloadSchema: EXECUTOR_EFFECTIVE_PAYLOAD_SCHEMA,
34861
+ handle: async (payload) => {
34862
+ const request2 = readExecutorEffectiveRequest(payload);
34863
+ const program = await runtime.resolve({ binaryPath: "", environment: request2.environment }).then(
34864
+ (found) => ({
34865
+ value: found.executablePath,
34866
+ detailKey: `form.binaryPath.${found.source === "managed" ? "managed" : "path"}`
34867
+ }),
34868
+ () => ({ detailKey: "form.binaryPath.notInstalled" })
34869
+ );
34870
+ return {
34871
+ binaryPath: program,
34872
+ // 私有目录按实例 id 起名,添加时还没有 id。
34873
+ homePath: request2.instanceId === void 0 ? { detailKey: "form.homePath.newInstance" } : {
34874
+ value: resolveAntigravityDirectories({
34875
+ dataDir: ctx.paths.dataDir,
34876
+ instanceId: request2.instanceId,
34877
+ homePath: ""
34878
+ }).profile,
34879
+ detailKey: "form.homePath.private"
34880
+ }
34881
+ };
34882
+ }
34883
+ });
34836
34884
  registerAntigravityAuthCommands(ctx);
34837
34885
  ctx.log.info("Antigravity executor ready");
34838
34886
  }
package/locales/en.json CHANGED
@@ -3,12 +3,17 @@
3
3
  "binaryPath": {
4
4
  "title": "Program path",
5
5
  "description": "Leave empty to use the runtime you download in this provider’s settings after adding it, or the `agy_acp_server` program on PATH. To use your own copy, enter its absolute path; its `localharness_external` companion file must sit in the same folder.",
6
- "placeholder": "Use the downloaded runtime"
6
+ "placeholder": "Use the downloaded runtime",
7
+ "managed": "downloaded runtime",
8
+ "path": "agy_acp_server on PATH",
9
+ "notInstalled": "Not installed: download the runtime in this provider's settings"
7
10
  },
8
11
  "homePath": {
9
12
  "title": "Account directory",
10
13
  "description": "The Google sign-in and conversation history live here, so providers sharing this directory share one sign-in and can pick up each other's threads. Leave empty to give this provider its own private directory.",
11
- "placeholder": "e.g. ~/.antigravity-work"
14
+ "placeholder": "e.g. ~/.antigravity-work",
15
+ "private": "private to this provider",
16
+ "newInstance": "A private directory for this provider, created when you add it"
12
17
  }
13
18
  },
14
19
  "common": {
@@ -3,12 +3,17 @@
3
3
  "binaryPath": {
4
4
  "title": "程序路径",
5
5
  "description": "留空即可:添加之后在此 provider 的设置里下载运行时,或者使用 PATH 上的 `agy_acp_server`。要用自己的那一份就填它的绝对路径,它的配套文件 `localharness_external` 必须放在同一个文件夹里。",
6
- "placeholder": "使用下载的运行时"
6
+ "placeholder": "使用下载的运行时",
7
+ "managed": "下载的运行时",
8
+ "path": "PATH 上的 agy_acp_server",
9
+ "notInstalled": "未安装:在这个 provider 的设置里下载运行时"
7
10
  },
8
11
  "homePath": {
9
12
  "title": "账号目录",
10
13
  "description": "Google 登录状态和会话历史都保存在这里,因此共用同一目录的 provider 共享一次登录,并可以接手彼此的会话。留空则这个 provider 使用自己独立的私有目录。",
11
- "placeholder": "例如 ~/.antigravity-work"
14
+ "placeholder": "例如 ~/.antigravity-work",
15
+ "private": "这个 provider 私有",
16
+ "newInstance": "添加后为这个 provider 建一个私有目录"
12
17
  }
13
18
  },
14
19
  "common": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-antigravity",
3
- "version": "0.2.3710",
3
+ "version": "0.2.3799",
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.3710",
35
- "ycodium-executor-testing": "0.0.0",
36
- "ycodium-acp-executor": "0.2.3710"
34
+ "@ycodium-ai/plugin-api": "0.2.3799",
35
+ "ycodium-acp-executor": "0.2.3799",
36
+ "ycodium-executor-testing": "0.0.0"
37
37
  },
38
38
  "ycodium": {
39
39
  "plugin": "./dist/index.js",