@ycodium-ai/agent-antigravity 0.2.3024 → 0.2.3028

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 +91 -39
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -26873,6 +26873,62 @@ function acpModelChoicesFromSessionModels(models) {
26873
26873
  return out;
26874
26874
  }
26875
26875
 
26876
+ // ../../packages/ycodium-acp-executor/src/apply-effort.ts
26877
+ var applyRequestedEffort = async (input2) => {
26878
+ const requested = input2.requestedEffort?.trim();
26879
+ if (!requested) return;
26880
+ const effort = findAcpEffortConfig(input2.configOptions);
26881
+ if (effort === void 0) return;
26882
+ const matched = effort.choices.find((choice) => choice.value === requested);
26883
+ if (matched === void 0) {
26884
+ input2.log?.info("requested effort is not in the agent catalog; keeping its own", {
26885
+ requestedEffort: requested,
26886
+ advertised: effort.choices.map((choice) => choice.value)
26887
+ });
26888
+ return;
26889
+ }
26890
+ if (matched.isDefault === true) return;
26891
+ if (!input2.isLive(input2.expectedGeneration)) return;
26892
+ try {
26893
+ await input2.connection.request("session/set_config_option", {
26894
+ sessionId: input2.acpSessionId,
26895
+ configId: effort.configId,
26896
+ value: requested
26897
+ });
26898
+ } catch (error62) {
26899
+ input2.log?.info("setting the effort level failed; the session keeps its own", {
26900
+ requestedEffort: requested,
26901
+ configId: effort.configId,
26902
+ error: error62 instanceof Error ? error62.message : String(error62)
26903
+ });
26904
+ }
26905
+ };
26906
+
26907
+ // ../../packages/ycodium-acp-executor/src/failureCategory.ts
26908
+ var ACP_FAILURE_CATEGORIES = [
26909
+ "quota",
26910
+ "rate-limit",
26911
+ "context-limit",
26912
+ "auth",
26913
+ "model-unavailable",
26914
+ "transport",
26915
+ "unknown"
26916
+ ];
26917
+ var isAcpFailureCategory = (value) => ACP_FAILURE_CATEGORIES.some((category) => category === value);
26918
+ var readAcpFailureCategory = (error62) => {
26919
+ if (typeof error62 !== "object" || error62 === null) return void 0;
26920
+ const value = error62.failureCategory;
26921
+ return isAcpFailureCategory(value) ? value : void 0;
26922
+ };
26923
+ var withFailureCategory = (error62, category) => category === void 0 ? error62 : Object.assign(error62, { failureCategory: category });
26924
+ var failureCategoryField = (category) => category === void 0 ? {} : { failureCategory: category };
26925
+ var acpTransportIfEstablished = (sessionEstablished, disposed) => sessionEstablished && !disposed ? "transport" : void 0;
26926
+ var acpPromptFailureCategory = (error62, input2) => {
26927
+ const signaled = readAcpFailureCategory(error62);
26928
+ if (signaled !== void 0) return signaled;
26929
+ return error62 instanceof AcpConnectionClosedError ? acpTransportIfEstablished(input2.sessionEstablished, input2.disposed) : void 0;
26930
+ };
26931
+
26876
26932
  // ../../packages/ycodium-acp-executor/src/runtime-mode.ts
26877
26933
  function isRecord5(value) {
26878
26934
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -26975,7 +27031,7 @@ var ACP_CONFIG_CATEGORY_HANDLING = {
26975
27031
  },
26976
27032
  thought_level: {
26977
27033
  consumed: true,
26978
- via: "config-options.ts:findAcpEffortConfig \u2192 executor.ts:applyRequestedEffort"
27034
+ via: "config-options.ts:findAcpEffortConfig \u2192 apply-effort.ts:applyRequestedEffort"
26979
27035
  },
26980
27036
  model_option: {
26981
27037
  consumed: true,
@@ -27463,11 +27519,16 @@ function createAcpExecutor(options2) {
27463
27519
  payload: { answers }
27464
27520
  });
27465
27521
  };
27466
- const abortPendingSettlement = (reason) => {
27522
+ const abortPendingSettlement = (reason, failureCategory) => {
27467
27523
  const waiting = pendingSettlement;
27468
27524
  if (waiting === void 0) return;
27469
27525
  pendingSettlement = void 0;
27470
- waiting.settle({ error: new AcpExecutorRequestError("session/prompt", reason) });
27526
+ waiting.settle({
27527
+ error: withFailureCategory(
27528
+ new AcpExecutorRequestError("session/prompt", reason),
27529
+ failureCategory
27530
+ )
27531
+ });
27471
27532
  };
27472
27533
  const settleAllUserInputs = () => {
27473
27534
  for (const pending of pendingUserInputs.values()) {
@@ -27491,9 +27552,12 @@ function createAcpExecutor(options2) {
27491
27552
  rememberSettledPromptKey(waiting.promptKey);
27492
27553
  if (signal.outcome === "error") {
27493
27554
  waiting.settle({
27494
- error: new AcpExecutorRequestError(
27495
- "session/prompt",
27496
- signal.detail ?? "prompt failed without an error detail"
27555
+ error: withFailureCategory(
27556
+ new AcpExecutorRequestError(
27557
+ "session/prompt",
27558
+ signal.detail ?? "prompt failed without an error detail"
27559
+ ),
27560
+ signal.failureCategory
27497
27561
  )
27498
27562
  });
27499
27563
  } else {
@@ -27648,7 +27712,10 @@ function createAcpExecutor(options2) {
27648
27712
  }
27649
27713
  settleAllApprovals("cancel");
27650
27714
  settleAllUserInputs();
27651
- abortPendingSettlement("connection closed");
27715
+ abortPendingSettlement(
27716
+ "connection closed",
27717
+ acpTransportIfEstablished(startResult !== void 0, disposed)
27718
+ );
27652
27719
  promptWaiters.splice(0).forEach((wake) => wake());
27653
27720
  },
27654
27721
  () => {
@@ -27703,35 +27770,6 @@ function createAcpExecutor(options2) {
27703
27770
  }
27704
27771
  return { ...input2.state, currentModelId: value, configOptions };
27705
27772
  };
27706
- const applyRequestedEffort = async (input2) => {
27707
- const requested = input2.requestedEffort?.trim();
27708
- if (!requested) return;
27709
- const effort = findAcpEffortConfig(input2.configOptions);
27710
- if (effort === void 0) return;
27711
- const matched = effort.choices.find((choice) => choice.value === requested);
27712
- if (matched === void 0) {
27713
- options2.log?.info("requested effort is not in the agent catalog; keeping its own", {
27714
- requestedEffort: requested,
27715
- advertised: effort.choices.map((choice) => choice.value)
27716
- });
27717
- return;
27718
- }
27719
- if (matched.isDefault === true) return;
27720
- if (!isLive(input2.expectedGeneration)) return;
27721
- try {
27722
- await connection.request("session/set_config_option", {
27723
- sessionId: input2.acpSessionId,
27724
- configId: effort.configId,
27725
- value: requested
27726
- });
27727
- } catch (error62) {
27728
- options2.log?.info("setting the effort level failed; the session keeps its own", {
27729
- requestedEffort: requested,
27730
- configId: effort.configId,
27731
- error: error62 instanceof Error ? error62.message : String(error62)
27732
- });
27733
- }
27734
- };
27735
27773
  const startOnce = async (expectedGeneration) => {
27736
27774
  const initializePayload = acpInitializePayload(options2.clientInfo, options2.clientCapabilities);
27737
27775
  const initialized = await connection.request(
@@ -27806,6 +27844,9 @@ function createAcpExecutor(options2) {
27806
27844
  expectedGeneration
27807
27845
  });
27808
27846
  await applyRequestedEffort({
27847
+ connection,
27848
+ log: options2.log,
27849
+ isLive,
27809
27850
  configOptions: nextModelSelectionState.configOptions,
27810
27851
  acpSessionId: nextSessionId,
27811
27852
  requestedEffort: options2.requestedEffort,
@@ -27928,7 +27969,8 @@ function createAcpExecutor(options2) {
27928
27969
  payload: {
27929
27970
  state: input2.state,
27930
27971
  stopReason: input2.stopReason,
27931
- ...input2.errorMessage === void 0 ? {} : { errorMessage: input2.errorMessage }
27972
+ ...input2.errorMessage === void 0 ? {} : { errorMessage: input2.errorMessage },
27973
+ ...input2.state === "failed" ? failureCategoryField(input2.failureCategory) : {}
27932
27974
  }
27933
27975
  });
27934
27976
  interruptedTurnIds.delete(input2.turnId);
@@ -28025,15 +28067,25 @@ function createAcpExecutor(options2) {
28025
28067
  if (disposed) {
28026
28068
  throw new AcpExecutorDisposedError();
28027
28069
  }
28070
+ const failureCategory = acpPromptFailureCategory(error62, {
28071
+ sessionEstablished: startResult !== void 0,
28072
+ disposed
28073
+ });
28028
28074
  if (written && input2.onDispatched !== void 0 && !interruptedTurnIds.has(turnId)) {
28029
28075
  const errorMessage2 = error62 instanceof Error && error62.message.trim() || "ACP prompt failed";
28030
- if (settle2({ turnId, stopReason: "error", state: "failed", errorMessage: errorMessage2 }))
28076
+ if (settle2({
28077
+ turnId,
28078
+ stopReason: "error",
28079
+ state: "failed",
28080
+ errorMessage: errorMessage2,
28081
+ ...failureCategory === void 0 ? {} : { failureCategory }
28082
+ }))
28031
28083
  options2.log?.warn?.("turn failed after dispatch", {
28032
28084
  threadId: options2.threadId,
28033
28085
  failure: errorMessage2
28034
28086
  });
28035
28087
  }
28036
- throw error62;
28088
+ throw error62 instanceof Error ? withFailureCategory(error62, failureCategory) : error62;
28037
28089
  }
28038
28090
  await connection.awaitInboundIdle();
28039
28091
  if (options2.beforeApplyResult) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-antigravity",
3
- "version": "0.2.3024",
3
+ "version": "0.2.3028",
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.3024",
35
- "ycodium-executor-testing": "0.0.0",
36
- "ycodium-acp-executor": "0.2.0"
34
+ "@ycodium-ai/plugin-api": "0.2.3028",
35
+ "ycodium-acp-executor": "0.2.3028",
36
+ "ycodium-executor-testing": "0.0.0"
37
37
  },
38
38
  "ycodium": {
39
39
  "plugin": "./dist/index.js",