@ycodium-ai/agent-antigravity 0.2.3681 → 0.2.3766

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.";
@@ -26868,23 +26872,31 @@ function createAcpConnection(options2) {
26868
26872
  function normalizeModelId(value) {
26869
26873
  return value?.trim() || void 0;
26870
26874
  }
26871
- function adoptReportedConfigOptions(state, configOptions) {
26875
+ function adoptReportedConfigOptions(state, configOptions, fromAgent = true) {
26872
26876
  const option = state.modelConfigId === void 0 ? void 0 : findConfigOptionEntry(configOptions, state.modelConfigId);
26873
26877
  const value = option?.["currentValue"];
26874
26878
  const reported = typeof value === "string" ? normalizeModelId(value) : void 0;
26875
26879
  if (reported === void 0) return { ...state, configOptions };
26876
26880
  const { modelUnconfirmed: _confirmed, ...known } = state;
26877
- return { ...known, configOptions, currentModelId: reported };
26881
+ const stillReported = fromAgent || state.currentModelReported === true && reported === state.currentModelId;
26882
+ const { currentModelReported: _stale, ...unreported } = known;
26883
+ return {
26884
+ ...stillReported ? known : unreported,
26885
+ configOptions,
26886
+ currentModelId: reported,
26887
+ ...stillReported ? { currentModelReported: true } : {}
26888
+ };
26878
26889
  }
26879
26890
  function forgetConfigOptionValue(state, configId) {
26880
26891
  const forgetsModel = configId === void 0 || configId === state.modelConfigId;
26892
+ const { currentModelReported: _forgottenReport, ...withoutReport } = state;
26881
26893
  const configOptions = configId !== void 0 && Array.isArray(state.configOptions) ? state.configOptions.map((option) => {
26882
26894
  if (!isRecord2(option) || option["id"] !== configId) return option;
26883
26895
  const { currentValue: _forgotten, ...rest } = option;
26884
26896
  return rest;
26885
26897
  }) : state.configOptions;
26886
26898
  return {
26887
- ...state,
26899
+ ...forgetsModel ? withoutReport : state,
26888
26900
  configOptions,
26889
26901
  ...forgetsModel ? { currentModelId: void 0, modelUnconfirmed: true } : {}
26890
26902
  };
@@ -26901,6 +26913,7 @@ function modelSelectionStateFromSetup(setup) {
26901
26913
  sessionModelsAdvertised: sessionModels !== void 0,
26902
26914
  modelConfigId,
26903
26915
  currentModelId,
26916
+ ...currentModelId === void 0 ? {} : { currentModelReported: true },
26904
26917
  advertisedModelValues: strategy === "config-option" ? modelConfigOption === void 0 ? [] : collectSessionConfigOptionValues(modelConfigOption) : collectSessionModelIds(sessionModels),
26905
26918
  configOptions: setup.configOptions,
26906
26919
  catalogSetup: setup
@@ -27688,14 +27701,28 @@ function createExecutorPrompt({
27688
27701
  }
27689
27702
  };
27690
27703
  const alignTurnOptions = async (input2, sessionId, generation, isStale, signal) => {
27704
+ const before = shared.modelSelectionState;
27691
27705
  const applied = await applyRequestedModel({
27692
- state: shared.modelSelectionState,
27706
+ state: before,
27693
27707
  acpSessionId: sessionId,
27694
27708
  requestedModelId: input2.requestedModelId,
27695
27709
  expectedGeneration: generation,
27696
27710
  signal
27697
27711
  });
27698
27712
  shared.modelSelectionState = applied;
27713
+ if (applied.currentModelId !== void 0 && (applied.currentModelId !== before.currentModelId || applied.currentModelReported !== before.currentModelReported)) {
27714
+ emit({
27715
+ type: "thread.metadata.updated",
27716
+ ...stamp(),
27717
+ provider: options2.provider,
27718
+ threadId: options2.threadId,
27719
+ ...shared.activeTurnId === void 0 ? {} : { turnId: shared.activeTurnId },
27720
+ payload: {
27721
+ model: applied.currentModelId,
27722
+ modelSource: applied.currentModelReported === true ? "reported" : "echo"
27723
+ }
27724
+ });
27725
+ }
27699
27726
  if (isStale()) return;
27700
27727
  const switched = applied.configOptions;
27701
27728
  let aligned;
@@ -27720,7 +27747,8 @@ function createExecutorPrompt({
27720
27747
  if (aligned.configOptions !== switched) {
27721
27748
  shared.modelSelectionState = adoptReportedConfigOptions(
27722
27749
  shared.modelSelectionState,
27723
- aligned.configOptions
27750
+ aligned.configOptions,
27751
+ false
27724
27752
  );
27725
27753
  }
27726
27754
  if (aligned.unsupportedEffort !== void 0) {
@@ -28694,18 +28722,20 @@ function createExecutorSession({
28694
28722
  const base = ours !== void 0 && ours.seq > issuedAt ? ours.configOptions : configOptions;
28695
28723
  return { configOptions: withConfigOptionValue(base, configId, value), reported: false };
28696
28724
  };
28697
- const writeConfigOption = async (...args) => (await writeConfigOptionReported(...args)).configOptions;
28698
28725
  const switchModel = async (input2) => {
28699
28726
  let configOptions = input2.state.configOptions;
28727
+ let fromAgent = true;
28700
28728
  const write = { option: "model", signal: input2.signal };
28701
28729
  if (input2.state.strategy === "config-option" && input2.state.modelConfigId !== void 0) {
28702
- configOptions = await writeConfigOption(
28730
+ const written = await writeConfigOptionReported(
28703
28731
  input2.sessionId,
28704
28732
  configOptions,
28705
28733
  input2.state.modelConfigId,
28706
28734
  input2.value,
28707
28735
  write
28708
28736
  );
28737
+ configOptions = written.configOptions;
28738
+ fromAgent = written.reported;
28709
28739
  } else {
28710
28740
  const before = shared.configOptionUpdates.get(input2.sessionId);
28711
28741
  const pending = connection.begin("session/set_model", {
@@ -28723,7 +28753,12 @@ function createExecutorSession({
28723
28753
  throw new AcpExecutorDisposedError();
28724
28754
  }
28725
28755
  const { modelUnconfirmed: _confirmed, ...known } = input2.state;
28726
- return adoptReportedConfigOptions({ ...known, currentModelId: input2.value }, configOptions);
28756
+ const { currentModelReported: _echoed, ...requested } = known;
28757
+ return adoptReportedConfigOptions(
28758
+ { ...requested, currentModelId: input2.value },
28759
+ configOptions,
28760
+ fromAgent
28761
+ );
28727
28762
  };
28728
28763
  const applyRequestedModel = async (input2) => {
28729
28764
  const requestedModelId = normalizeModelId(input2.requestedModelId) ?? "";
@@ -28867,7 +28902,8 @@ function createExecutorSession({
28867
28902
  });
28868
28903
  nextModelSelectionState = adoptReportedConfigOptions(
28869
28904
  nextModelSelectionState,
28870
- aligned.configOptions
28905
+ aligned.configOptions,
28906
+ false
28871
28907
  );
28872
28908
  if (aligned.unsupportedEffort !== void 0) {
28873
28909
  options2.log?.info("requested effort is not offered by this model; using its default", {
@@ -28900,7 +28936,8 @@ function createExecutorSession({
28900
28936
  initializeResult: initialized,
28901
28937
  sessionSetupResult: setup,
28902
28938
  modelConfigId: extractModelConfigId(setup),
28903
- modelId: nextModelSelectionState.currentModelId
28939
+ modelId: nextModelSelectionState.currentModelId,
28940
+ modelReported: nextModelSelectionState.currentModelReported === true
28904
28941
  };
28905
28942
  shared.startResult = result;
28906
28943
  shared.status = "ready";
@@ -29858,6 +29895,9 @@ function createAcpExecutor(options2) {
29858
29895
  get modelId() {
29859
29896
  return shared.modelSelectionState.currentModelId;
29860
29897
  },
29898
+ get modelReported() {
29899
+ return shared.modelSelectionState.currentModelReported === true;
29900
+ },
29861
29901
  get status() {
29862
29902
  return shared.status;
29863
29903
  },
@@ -30562,6 +30602,8 @@ var ANTIGRAVITY_CARD = {
30562
30602
  launchArgs: "",
30563
30603
  // 账户目录由插件按实例私有地建,GEMINI_HOME 由插件自己注入;宿主不替它投变量。
30564
30604
  homeEnvVar: "",
30605
+ // 设置表单里留空的格子此刻会用什么,见 index.ts 的同名命令。
30606
+ effectiveCommand: "effectiveConfig",
30565
30607
  environment: [],
30566
30608
  install: null,
30567
30609
  signIn: [],
@@ -34776,6 +34818,7 @@ var capturedDeps;
34776
34818
  var executors = [
34777
34819
  {
34778
34820
  card: ANTIGRAVITY_CARD,
34821
+ lifecycle: [{ kind: "detect", reversible: true }],
34779
34822
  createInstance: async (config2, host) => {
34780
34823
  host.log.info("createInstance");
34781
34824
  if (capturedDeps === void 0) {
@@ -34787,7 +34830,7 @@ var executors = [
34787
34830
  ];
34788
34831
  var index_default = definePlugin({
34789
34832
  id: "agent-antigravity",
34790
- apiVersion: 52,
34833
+ apiVersion: 56,
34791
34834
  executors,
34792
34835
  activate(ctx) {
34793
34836
  const runtime = createRuntimeManager({
@@ -34797,6 +34840,34 @@ var index_default = definePlugin({
34797
34840
  });
34798
34841
  capturedDeps = { dataDir: ctx.paths.dataDir, attachments: ctx.attachments, runtime };
34799
34842
  registerRuntimeCommands(ctx, runtime);
34843
+ ctx.command({
34844
+ name: "effectiveConfig",
34845
+ description: "Settings form: the program and account directory empty fields resolve to.",
34846
+ scope: "read",
34847
+ payloadSchema: EXECUTOR_EFFECTIVE_PAYLOAD_SCHEMA,
34848
+ handle: async (payload) => {
34849
+ const request2 = readExecutorEffectiveRequest(payload);
34850
+ const program = await runtime.resolve({ binaryPath: "", environment: request2.environment }).then(
34851
+ (found) => ({
34852
+ value: found.executablePath,
34853
+ detailKey: `form.binaryPath.${found.source === "managed" ? "managed" : "path"}`
34854
+ }),
34855
+ () => ({ detailKey: "form.binaryPath.notInstalled" })
34856
+ );
34857
+ return {
34858
+ binaryPath: program,
34859
+ // 私有目录按实例 id 起名,添加时还没有 id。
34860
+ homePath: request2.instanceId === void 0 ? { detailKey: "form.homePath.newInstance" } : {
34861
+ value: resolveAntigravityDirectories({
34862
+ dataDir: ctx.paths.dataDir,
34863
+ instanceId: request2.instanceId,
34864
+ homePath: ""
34865
+ }).profile,
34866
+ detailKey: "form.homePath.private"
34867
+ }
34868
+ };
34869
+ }
34870
+ });
34800
34871
  registerAntigravityAuthCommands(ctx);
34801
34872
  ctx.log.info("Antigravity executor ready");
34802
34873
  }
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.3681",
3
+ "version": "0.2.3766",
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-acp-executor": "0.2.3681",
35
- "@ycodium-ai/plugin-api": "0.2.3681",
36
- "ycodium-executor-testing": "0.0.0"
34
+ "@ycodium-ai/plugin-api": "0.2.3766",
35
+ "ycodium-executor-testing": "0.0.0",
36
+ "ycodium-acp-executor": "0.2.3766"
37
37
  },
38
38
  "ycodium": {
39
39
  "plugin": "./dist/index.js",