stratagem-x7 0.4.2 → 0.4.4

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/cli.mjs +112 -27
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -179156,7 +179156,7 @@ async function exchangeCodeForTokens2(code, verifier, redirectUri = ANTIGRAVITY_
179156
179156
  method: "POST",
179157
179157
  headers: {
179158
179158
  "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
179159
- "User-Agent": "google-api-nodejs-client/9.15.1"
179159
+ "User-Agent": ANTIGRAVITY_UA
179160
179160
  },
179161
179161
  body: new URLSearchParams({
179162
179162
  client_id: ANTIGRAVITY_CLIENT_ID,
@@ -179178,7 +179178,7 @@ async function refreshAccessToken(refreshToken) {
179178
179178
  method: "POST",
179179
179179
  headers: {
179180
179180
  "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
179181
- "User-Agent": "google-api-nodejs-client/9.15.1"
179181
+ "User-Agent": ANTIGRAVITY_UA
179182
179182
  },
179183
179183
  body: new URLSearchParams({
179184
179184
  client_id: ANTIGRAVITY_CLIENT_ID,
@@ -179195,7 +179195,10 @@ async function refreshAccessToken(refreshToken) {
179195
179195
  }
179196
179196
  async function fetchUserEmail(accessToken) {
179197
179197
  const resp = await fetch("https://openidconnect.googleapis.com/v1/userinfo", {
179198
- headers: { Authorization: `Bearer ${accessToken}` }
179198
+ headers: {
179199
+ Authorization: `Bearer ${accessToken}`,
179200
+ "User-Agent": ANTIGRAVITY_UA
179201
+ }
179199
179202
  });
179200
179203
  if (!resp.ok) {
179201
179204
  return `unknown-${Date.now()}@antigravity`;
@@ -179203,9 +179206,12 @@ async function fetchUserEmail(accessToken) {
179203
179206
  const data = await resp.json().catch(() => ({}));
179204
179207
  return data.email ?? `unknown-${Date.now()}@antigravity`;
179205
179208
  }
179206
- async function discoverProject(accessToken) {
179209
+ function detectPlatformLabel() {
179207
179210
  const p = platform2();
179208
- const platformLabel = p === "win32" ? "WINDOWS" : p === "darwin" ? "MACOS" : "LINUX";
179211
+ return p === "win32" ? "WINDOWS" : p === "darwin" ? "MACOS" : "LINUX";
179212
+ }
179213
+ async function discoverProject(accessToken) {
179214
+ const platformLabel = detectPlatformLabel();
179209
179215
  const body = JSON.stringify({
179210
179216
  metadata: {
179211
179217
  ideType: "ANTIGRAVITY",
@@ -179246,7 +179252,11 @@ function buildApiHeaders(accessToken) {
179246
179252
  "Content-Type": "application/json",
179247
179253
  "User-Agent": `antigravity/${ANTIGRAVITY_API_VERSION} google-cloud-sdk vscode_cloudshelleditor/0.1`,
179248
179254
  "X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
179249
- "Client-Metadata": '{"ideType":"ANTIGRAVITY","platform":"WINDOWS","pluginType":"GEMINI"}'
179255
+ "Client-Metadata": JSON.stringify({
179256
+ ideType: "ANTIGRAVITY",
179257
+ platform: detectPlatformLabel(),
179258
+ pluginType: "GEMINI"
179259
+ })
179250
179260
  };
179251
179261
  }
179252
179262
  function buildRequestUrl(baseEndpoint, action, streaming2 = true) {
@@ -179355,7 +179365,7 @@ async function ensureFreshAccessToken(email3, skewMs = 60000) {
179355
179365
  saveStore(store);
179356
179366
  return account.accessToken;
179357
179367
  }
179358
- var ANTIGRAVITY_API_VERSION = "1.23.2", ANTIGRAVITY_CLIENT_ID = "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com", ANTIGRAVITY_CLIENT_SECRET, ANTIGRAVITY_SCOPES, ENDPOINT_DAILY = "https://daily-cloudcode-pa.sandbox.googleapis.com", ENDPOINT_AUTOPUSH = "https://autopush-cloudcode-pa.sandbox.googleapis.com", ENDPOINT_PROD = "https://cloudcode-pa.googleapis.com", ANTIGRAVITY_DEFAULT_PROJECT_ID = "rising-fact-p41fc", ANTIGRAVITY_OAUTH_PORT = 51121, ANTIGRAVITY_REDIRECT_URI, REQUEST_ENDPOINTS_IN_ORDER, ANTIGRAVITY_TOS_DISCLOSURE;
179368
+ var ANTIGRAVITY_API_VERSION = "1.23.2", ANTIGRAVITY_CLIENT_ID = "1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com", ANTIGRAVITY_CLIENT_SECRET, ANTIGRAVITY_SCOPES, ENDPOINT_DAILY = "https://daily-cloudcode-pa.sandbox.googleapis.com", ENDPOINT_AUTOPUSH = "https://autopush-cloudcode-pa.sandbox.googleapis.com", ENDPOINT_PROD = "https://cloudcode-pa.googleapis.com", ANTIGRAVITY_DEFAULT_PROJECT_ID = "rising-fact-p41fc", ANTIGRAVITY_OAUTH_PORT = 51121, ANTIGRAVITY_REDIRECT_URI, ANTIGRAVITY_UA, REQUEST_ENDPOINTS_IN_ORDER, ANTIGRAVITY_TOS_DISCLOSURE;
179359
179369
  var init_antigravity = __esm(() => {
179360
179370
  init_envUtils();
179361
179371
  ANTIGRAVITY_CLIENT_SECRET = ["GOCS", "PX-", "K58FWR486", "LdLJ1mLB8sXC4z6qDAf"].join("");
@@ -179367,6 +179377,7 @@ var init_antigravity = __esm(() => {
179367
179377
  "https://www.googleapis.com/auth/experimentsandconfigs"
179368
179378
  ];
179369
179379
  ANTIGRAVITY_REDIRECT_URI = `http://localhost:${ANTIGRAVITY_OAUTH_PORT}/oauth-callback`;
179380
+ ANTIGRAVITY_UA = `antigravity/${ANTIGRAVITY_API_VERSION} google-cloud-sdk vscode_cloudshelleditor/0.1`;
179370
179381
  REQUEST_ENDPOINTS_IN_ORDER = [
179371
179382
  ENDPOINT_DAILY,
179372
179383
  ENDPOINT_AUTOPUSH,
@@ -179623,10 +179634,10 @@ class AntigravityRotation {
179623
179634
  return true;
179624
179635
  }
179625
179636
  pickForFamily(family) {
179626
- const eligibleIds = this.store.accounts.filter((a2) => a2.enabled).map(accountId);
179637
+ const eligibleIds = this.store.accounts.filter((a2) => a2.enabled && !a2.tosViolation).map(accountId);
179627
179638
  const preferredIdx = this.store.activeIndexByFamily[family] ?? this.store.activeIndex;
179628
179639
  const preferred = this.store.accounts[preferredIdx];
179629
- if (preferred && preferred.enabled) {
179640
+ if (preferred && preferred.enabled && !preferred.tosViolation) {
179630
179641
  const snap = this.tracker.snapshot(accountId(preferred));
179631
179642
  if (snap && !snap.disabled && snap.cooldownRemaining <= 0) {
179632
179643
  return preferred;
@@ -179652,7 +179663,7 @@ class AntigravityRotation {
179652
179663
  return this.pickForFamily(familyForAntigravityModel(model));
179653
179664
  }
179654
179665
  nextRecoveryAt() {
179655
- const ids = this.store.accounts.filter((a2) => a2.enabled).map(accountId);
179666
+ const ids = this.store.accounts.filter((a2) => a2.enabled && !a2.tosViolation).map(accountId);
179656
179667
  const rec = this.tracker.earliestRecovery(ids);
179657
179668
  return rec ? rec.at : null;
179658
179669
  }
@@ -179674,10 +179685,32 @@ class AntigravityRotation {
179674
179685
  }
179675
179686
  saveStore(this.store);
179676
179687
  }
179688
+ recordTosViolation(account, appealUrl, reason) {
179689
+ account.tosViolation = {
179690
+ detectedAt: Date.now(),
179691
+ appealUrl,
179692
+ reason
179693
+ };
179694
+ account.enabled = false;
179695
+ this.tracker.disable(accountId(account));
179696
+ saveStore(this.store);
179697
+ }
179677
179698
  reenable(email3) {
179678
179699
  const a2 = this.store.accounts.find((x3) => x3.email === email3);
179679
179700
  if (!a2)
179680
179701
  return false;
179702
+ if (a2.tosViolation)
179703
+ return false;
179704
+ a2.enabled = true;
179705
+ this.tracker.reenable(accountId(a2));
179706
+ saveStore(this.store);
179707
+ return true;
179708
+ }
179709
+ clearTosViolation(email3) {
179710
+ const a2 = this.store.accounts.find((x3) => x3.email === email3);
179711
+ if (!a2 || !a2.tosViolation)
179712
+ return false;
179713
+ delete a2.tosViolation;
179681
179714
  a2.enabled = true;
179682
179715
  this.tracker.reenable(accountId(a2));
179683
179716
  saveStore(this.store);
@@ -180622,8 +180655,48 @@ function parseRetryInfoFromBody(body) {
180622
180655
  function isRateLimitStatus(status) {
180623
180656
  return status === 429 || status === 503;
180624
180657
  }
180625
- function isAuthFailureStatus(status) {
180626
- return status === 401 || status === 403;
180658
+ function parseGoogleErrorBody(body) {
180659
+ try {
180660
+ const parsed = JSON.parse(body);
180661
+ const err2 = parsed.error;
180662
+ if (!err2)
180663
+ return { isPermissionDenied: false };
180664
+ let reason;
180665
+ let appealUrl;
180666
+ for (const d of err2.details ?? []) {
180667
+ const t = d["@type"];
180668
+ if (typeof t !== "string")
180669
+ continue;
180670
+ if (t.includes("ErrorInfo")) {
180671
+ const r = d.reason;
180672
+ if (typeof r === "string")
180673
+ reason = r;
180674
+ const meta = d.metadata;
180675
+ if (meta) {
180676
+ const url3 = meta.appeal_url ?? meta.appealUrl ?? meta.url;
180677
+ if (typeof url3 === "string")
180678
+ appealUrl ??= url3;
180679
+ }
180680
+ } else if (t.includes("Help")) {
180681
+ const links = d.links;
180682
+ if (Array.isArray(links)) {
180683
+ for (const l of links) {
180684
+ if (typeof l.url === "string")
180685
+ appealUrl ??= l.url;
180686
+ }
180687
+ }
180688
+ }
180689
+ }
180690
+ return {
180691
+ isPermissionDenied: err2.status === "PERMISSION_DENIED",
180692
+ status: err2.status,
180693
+ reason,
180694
+ appealUrl,
180695
+ message: err2.message
180696
+ };
180697
+ } catch {
180698
+ return { isPermissionDenied: false };
180699
+ }
180627
180700
  }
180628
180701
  async function dispatchToCodeAssist(opts) {
180629
180702
  const url3 = (base2) => opts.streaming ? streamGenerateContentUrl(base2) : generateContentUrl(base2);
@@ -180675,13 +180748,27 @@ async function readNonStreaming(response, model) {
180675
180748
  }
180676
180749
  async function buildApiErrorFromResponse(response, resolved) {
180677
180750
  const text = await response.text().catch(() => "");
180751
+ const rotation = getAntigravityRotation();
180678
180752
  if (isRateLimitStatus(response.status)) {
180679
180753
  const cooldownMs = parseRetryInfoFromBody(text) ?? parseRetryAfterMs(response.headers);
180680
- getAntigravityRotation().recordRateLimit(resolved.account, resolved.family, cooldownMs);
180681
- } else if (isAuthFailureStatus(response.status)) {
180682
- getAntigravityRotation().recordHardFailure(resolved.account);
180754
+ rotation.recordRateLimit(resolved.account, resolved.family, cooldownMs);
180755
+ } else if (response.status === 403) {
180756
+ const parsed = parseGoogleErrorBody(text);
180757
+ if (parsed.isPermissionDenied) {
180758
+ rotation.recordTosViolation(resolved.account, parsed.appealUrl, parsed.reason ?? parsed.message);
180759
+ const reasonLabel = parsed.reason ?? "PERMISSION_DENIED";
180760
+ const detail = parsed.message ?? text.slice(0, 300);
180761
+ const appealLine = parsed.appealUrl ? `
180762
+ Appeal: ${parsed.appealUrl}` : "";
180763
+ return APIError.generate(403, undefined, `Antigravity account "${resolved.account.email}" was disabled by Google (${reasonLabel}). ` + `Rotation will skip it on future requests; run /login and pick "Antigravity" to add a different Google account.${appealLine}
180764
+
180765
+ ${detail}`, response.headers);
180766
+ }
180767
+ rotation.recordHardFailure(resolved.account);
180768
+ } else if (response.status === 401) {
180769
+ rotation.recordHardFailure(resolved.account);
180683
180770
  } else if (response.status >= 500) {
180684
- getAntigravityRotation().recordHardFailure(resolved.account);
180771
+ rotation.recordHardFailure(resolved.account);
180685
180772
  }
180686
180773
  return APIError.generate(response.status, undefined, `Antigravity API error ${response.status}: ${text.slice(0, 500)}`, response.headers);
180687
180774
  }
@@ -353881,7 +353968,7 @@ function getAnthropicEnvMetadata() {
353881
353968
  function getBuildAgeMinutes() {
353882
353969
  if (false)
353883
353970
  ;
353884
- const buildTime = new Date("2026-05-12T05:11:04.056Z").getTime();
353971
+ const buildTime = new Date("2026-05-12T05:37:24.535Z").getTime();
353885
353972
  if (isNaN(buildTime))
353886
353973
  return;
353887
353974
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -421695,7 +421782,7 @@ function buildPrimarySection() {
421695
421782
  }, undefined, false, undefined, this);
421696
421783
  return [{
421697
421784
  label: "Version",
421698
- value: "0.4.2"
421785
+ value: "0.4.4"
421699
421786
  }, {
421700
421787
  label: "Session name",
421701
421788
  value: nameValue
@@ -461672,9 +461759,9 @@ function getStartupLines(termWidth) {
461672
461759
  out.push(centerAnsiLine(boxRow(sRow, W2, sLen), tw));
461673
461760
  out.push(centerAnsiLine(`${rgb3(...BORDER)}└${"─".repeat(W2 - 2)}┘${RESET2}`, tw));
461674
461761
  if (tw >= 50) {
461675
- out.push(centerAnsiLine(`${rgb3(...DIMCOL)}STRATAGEM X7${RESET2} ${rgb3(...ACCENT)}v${"0.4.2"}${RESET2} ${rgb3(...CYAN)}// breach link stable${RESET2}`, tw));
461762
+ out.push(centerAnsiLine(`${rgb3(...DIMCOL)}STRATAGEM X7${RESET2} ${rgb3(...ACCENT)}v${"0.4.4"}${RESET2} ${rgb3(...CYAN)}// breach link stable${RESET2}`, tw));
461676
461763
  } else {
461677
- out.push(centerAnsiLine(`${rgb3(...DIMCOL)}STX7${RESET2} ${rgb3(...ACCENT)}v${"0.4.2"}${RESET2}`, tw));
461764
+ out.push(centerAnsiLine(`${rgb3(...DIMCOL)}STX7${RESET2} ${rgb3(...ACCENT)}v${"0.4.4"}${RESET2}`, tw));
461678
461765
  }
461679
461766
  out.push("");
461680
461767
  return out;
@@ -490489,7 +490576,7 @@ var init_bridge_kick = __esm(() => {
490489
490576
  var call61 = async () => {
490490
490577
  return {
490491
490578
  type: "text",
490492
- value: `${"99.0.0"} (built ${"2026-05-12T05:11:04.056Z"})`
490579
+ value: `${"99.0.0"} (built ${"2026-05-12T05:37:24.535Z"})`
490493
490580
  };
490494
490581
  }, version2, version_default;
490495
490582
  var init_version = __esm(() => {
@@ -536500,8 +536587,6 @@ function ModeIndicator({
536500
536587
  color: getModeColor(currentMode),
536501
536588
  children: [
536502
536589
  "[",
536503
- permissionModeSymbol(currentMode),
536504
- " ",
536505
536590
  permissionModeTitle(currentMode).toUpperCase(),
536506
536591
  "]",
536507
536592
  shouldShowModeHint && /* @__PURE__ */ jsx_dev_runtime435.jsxDEV(ThemedText, {
@@ -559405,7 +559490,7 @@ function WelcomeV2() {
559405
559490
  dimColor: true,
559406
559491
  children: [
559407
559492
  "v",
559408
- "0.4.2",
559493
+ "0.4.4",
559409
559494
  " "
559410
559495
  ]
559411
559496
  }, undefined, true, undefined, this)
@@ -578863,7 +578948,7 @@ Usage: stx7 --remote "your task description"`, () => gracefulShutdown(1));
578863
578948
  pendingHookMessages
578864
578949
  }, renderAndRun);
578865
578950
  }
578866
- }).version("0.4.2 (STRATAGEM X7)", "-v, --version", "Output the version number");
578951
+ }).version("0.4.4 (STRATAGEM X7)", "-v, --version", "Output the version number");
578867
578952
  program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
578868
578953
  program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
578869
578954
  if (canUserConfigureAdvisor()) {
@@ -579324,7 +579409,7 @@ if (false) {}
579324
579409
  async function main2() {
579325
579410
  const args = process.argv.slice(2);
579326
579411
  if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
579327
- console.log(`${"0.4.2"} (STRATAGEM X7)`);
579412
+ console.log(`${"0.4.4"} (STRATAGEM X7)`);
579328
579413
  return;
579329
579414
  }
579330
579415
  if (args.includes("--provider")) {
@@ -579446,4 +579531,4 @@ async function main2() {
579446
579531
  }
579447
579532
  main2();
579448
579533
 
579449
- //# debugId=7EE9DC19B245A28E64756E2164756E21
579534
+ //# debugId=E2C6C84262986B4464756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stratagem-x7",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "STRATAGEM X7 is a cyberpunk coding-agent CLI for cloud and local model providers",
5
5
  "type": "module",
6
6
  "bin": {