@anthonyhaussman/opencode-agy-auth 1.4.0 → 1.4.2-alpha.0

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
@@ -268,7 +268,7 @@ function createAgyActivityRequestId() {
268
268
  import os from "os";
269
269
 
270
270
  // src/sdk/agy-cli-version.ts
271
- var AGY_CLI_VERSION = "1.4.0";
271
+ var AGY_CLI_VERSION = "1.4.2";
272
272
 
273
273
  // src/sdk/user-agent.ts
274
274
  var cachedUserAgent = null;
@@ -592,17 +592,34 @@ var DEFAULT_INITIAL_DELAY_MS = 5e3;
592
592
  var DEFAULT_MAX_DELAY_MS = 3e4;
593
593
  var RETRYABLE_NETWORK_CODES = /* @__PURE__ */ new Set([
594
594
  "ECONNRESET",
595
+ "ECONNABORTED",
595
596
  "ETIMEDOUT",
596
597
  "EPIPE",
598
+ "ENETDOWN",
599
+ "ENETUNREACH",
600
+ "EHOSTUNREACH",
597
601
  "ENOTFOUND",
598
602
  "EAI_AGAIN",
599
603
  "ECONNREFUSED",
604
+ "UND_ERR_SOCKET",
605
+ "ERR_HTTP2_SESSION_ERROR",
606
+ "ERR_HTTP2_STREAM_CANCEL",
607
+ "ERR_HTTP2_GOAWAY_SESSION",
600
608
  "ERR_SSL_SSLV3_ALERT_BAD_RECORD_MAC",
601
609
  "ERR_SSL_WRONG_VERSION_NUMBER",
602
610
  "ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC",
603
611
  "ERR_SSL_BAD_RECORD_MAC",
604
612
  "EPROTO"
605
613
  ]);
614
+ var RETRYABLE_NETWORK_MESSAGES = [
615
+ "fetch failed",
616
+ "broken pipe",
617
+ "software caused connection abort",
618
+ "network is down",
619
+ "client connection lost",
620
+ "socket hang up",
621
+ "other side closed"
622
+ ];
606
623
  function canRetryRequest(init) {
607
624
  if (!init?.body) {
608
625
  return true;
@@ -633,7 +650,7 @@ function isRetryableNetworkError(error45) {
633
650
  if (code && RETRYABLE_NETWORK_CODES.has(code)) {
634
651
  return true;
635
652
  }
636
- return error45 instanceof Error && error45.message.toLowerCase().includes("fetch failed");
653
+ return hasRetryableNetworkMessage(error45);
637
654
  }
638
655
  async function resolveRetryDelayMs(response, attempt, quotaDelayMs) {
639
656
  const retryAfterMsHeader = parseRetryAfterMs(response.headers.get("retry-after-ms"));
@@ -690,6 +707,33 @@ function getNetworkErrorCode(error45) {
690
707
  }
691
708
  return void 0;
692
709
  }
710
+ function hasRetryableNetworkMessage(error45) {
711
+ const matchesMessage = (value) => {
712
+ if (!value || typeof value !== "object" || !("message" in value)) {
713
+ return false;
714
+ }
715
+ const msg = value.message;
716
+ if (typeof msg !== "string") {
717
+ return false;
718
+ }
719
+ const lower = msg.toLowerCase();
720
+ return RETRYABLE_NETWORK_MESSAGES.some((phrase) => lower.includes(phrase));
721
+ };
722
+ if (matchesMessage(error45)) {
723
+ return true;
724
+ }
725
+ let cursor = error45;
726
+ for (let depth = 0; depth < 5; depth += 1) {
727
+ if (!cursor || typeof cursor !== "object" || !("cause" in cursor)) {
728
+ break;
729
+ }
730
+ cursor = cursor.cause;
731
+ if (matchesMessage(cursor)) {
732
+ return true;
733
+ }
734
+ }
735
+ return false;
736
+ }
693
737
  function parseRetryAfterMs(value) {
694
738
  if (!value) {
695
739
  return null;
@@ -16215,7 +16259,7 @@ var models_default = {
16215
16259
  modelProvider: "MODEL_PROVIDER_ANTHROPIC",
16216
16260
  quotaInfo: {
16217
16261
  remainingFraction: 1,
16218
- resetTime: "2026-10-16T11:39:51Z"
16262
+ resetTime: "2026-10-18T13:33:10Z"
16219
16263
  },
16220
16264
  recommended: true,
16221
16265
  supportedMimeTypes: {
@@ -16256,7 +16300,7 @@ var models_default = {
16256
16300
  modelProvider: "MODEL_PROVIDER_ANTHROPIC",
16257
16301
  quotaInfo: {
16258
16302
  remainingFraction: 1,
16259
- resetTime: "2026-10-16T11:39:51Z"
16303
+ resetTime: "2026-10-18T13:33:10Z"
16260
16304
  },
16261
16305
  recommended: true,
16262
16306
  supportedMimeTypes: {
@@ -16297,7 +16341,7 @@ var models_default = {
16297
16341
  modelProvider: "MODEL_PROVIDER_ANTHROPIC",
16298
16342
  quotaInfo: {
16299
16343
  remainingFraction: 1,
16300
- resetTime: "2026-10-16T11:39:51Z"
16344
+ resetTime: "2026-10-18T13:33:10Z"
16301
16345
  },
16302
16346
  recommended: true,
16303
16347
  supportedMimeTypes: {
@@ -16338,7 +16382,7 @@ var models_default = {
16338
16382
  modelProvider: "MODEL_PROVIDER_ANTHROPIC",
16339
16383
  quotaInfo: {
16340
16384
  remainingFraction: 1,
16341
- resetTime: "2026-10-16T11:39:51Z"
16385
+ resetTime: "2026-10-18T13:33:10Z"
16342
16386
  },
16343
16387
  recommended: true,
16344
16388
  supportedMimeTypes: {
@@ -16379,7 +16423,7 @@ var models_default = {
16379
16423
  modelProvider: "MODEL_PROVIDER_ANTHROPIC",
16380
16424
  quotaInfo: {
16381
16425
  remainingFraction: 1,
16382
- resetTime: "2026-10-16T11:39:51Z"
16426
+ resetTime: "2026-10-18T13:33:10Z"
16383
16427
  },
16384
16428
  recommended: true,
16385
16429
  supportedMimeTypes: {
@@ -16420,7 +16464,7 @@ var models_default = {
16420
16464
  modelProvider: "MODEL_PROVIDER_ANTHROPIC",
16421
16465
  quotaInfo: {
16422
16466
  remainingFraction: 1,
16423
- resetTime: "2026-10-16T11:39:51Z"
16467
+ resetTime: "2026-10-18T13:33:10Z"
16424
16468
  },
16425
16469
  recommended: true,
16426
16470
  supportedMimeTypes: {
@@ -16458,8 +16502,8 @@ var models_default = {
16458
16502
  },
16459
16503
  modelProvider: "MODEL_PROVIDER_GOOGLE",
16460
16504
  quotaInfo: {
16461
- remainingFraction: 0.9439063,
16462
- resetTime: "2026-10-16T09:53:27Z"
16505
+ remainingFraction: 0.9709832,
16506
+ resetTime: "2026-10-18T12:59:56Z"
16463
16507
  },
16464
16508
  recommended: true,
16465
16509
  supportedMimeTypes: {
@@ -16518,8 +16562,6 @@ var models_default = {
16518
16562
  supportsImages: true,
16519
16563
  supportsThinking: true,
16520
16564
  supportsVideo: true,
16521
- tagDescription: "gemini-3.5-flash-lite",
16522
- thinkingBudget: -1,
16523
16565
  thinkingLevel: 1
16524
16566
  },
16525
16567
  "gemini-2.5-flash-lite": {
@@ -16541,8 +16583,8 @@ var models_default = {
16541
16583
  },
16542
16584
  modelProvider: "MODEL_PROVIDER_GOOGLE",
16543
16585
  quotaInfo: {
16544
- remainingFraction: 0.9439063,
16545
- resetTime: "2026-10-16T09:53:27Z"
16586
+ remainingFraction: 0.9709832,
16587
+ resetTime: "2026-10-18T12:59:56Z"
16546
16588
  },
16547
16589
  recommended: true,
16548
16590
  supportedMimeTypes: {
@@ -16601,8 +16643,6 @@ var models_default = {
16601
16643
  supportsImages: true,
16602
16644
  supportsThinking: true,
16603
16645
  supportsVideo: true,
16604
- tagDescription: "gemini-3.5-flash-lite",
16605
- thinkingBudget: -1,
16606
16646
  thinkingLevel: 1
16607
16647
  },
16608
16648
  "gemini-2.5-flash-thinking": {
@@ -16624,8 +16664,8 @@ var models_default = {
16624
16664
  },
16625
16665
  modelProvider: "MODEL_PROVIDER_GOOGLE",
16626
16666
  quotaInfo: {
16627
- remainingFraction: 0.9439063,
16628
- resetTime: "2026-10-16T09:53:27Z"
16667
+ remainingFraction: 0.9709832,
16668
+ resetTime: "2026-10-18T12:59:56Z"
16629
16669
  },
16630
16670
  recommended: true,
16631
16671
  supportedMimeTypes: {
@@ -16684,8 +16724,6 @@ var models_default = {
16684
16724
  supportsImages: true,
16685
16725
  supportsThinking: true,
16686
16726
  supportsVideo: true,
16687
- tagDescription: "gemini-3.5-flash-lite",
16688
- thinkingBudget: -1,
16689
16727
  thinkingLevel: 1
16690
16728
  },
16691
16729
  "gemini-2.5-pro": {
@@ -16704,8 +16742,8 @@ var models_default = {
16704
16742
  },
16705
16743
  modelProvider: "MODEL_PROVIDER_GOOGLE",
16706
16744
  quotaInfo: {
16707
- remainingFraction: 0.9439063,
16708
- resetTime: "2026-10-16T09:53:27Z"
16745
+ remainingFraction: 0.9709832,
16746
+ resetTime: "2026-10-18T12:59:56Z"
16709
16747
  },
16710
16748
  recommended: true,
16711
16749
  requiresImageOutputOutsideFunctionResponses: true,
@@ -16771,7 +16809,7 @@ var models_default = {
16771
16809
  displayName: "Gemini 3 Flash",
16772
16810
  maxOutputTokens: 65536,
16773
16811
  maxTokens: 1048576,
16774
- minThinkingBudget: 32,
16812
+ minThinkingBudget: 128,
16775
16813
  model: "MODEL_PLACEHOLDER_M18",
16776
16814
  modelExperiments: {
16777
16815
  experiments: {
@@ -16782,8 +16820,8 @@ var models_default = {
16782
16820
  },
16783
16821
  modelProvider: "MODEL_PROVIDER_GOOGLE",
16784
16822
  quotaInfo: {
16785
- remainingFraction: 0.9439063,
16786
- resetTime: "2026-10-16T09:53:27Z"
16823
+ remainingFraction: 0.9709832,
16824
+ resetTime: "2026-10-18T12:59:56Z"
16787
16825
  },
16788
16826
  recommended: true,
16789
16827
  supportedMimeTypes: {
@@ -16888,8 +16926,8 @@ var models_default = {
16888
16926
  },
16889
16927
  modelProvider: "MODEL_PROVIDER_GOOGLE",
16890
16928
  quotaInfo: {
16891
- remainingFraction: 0.9439063,
16892
- resetTime: "2026-10-16T09:53:27Z"
16929
+ remainingFraction: 0.9709832,
16930
+ resetTime: "2026-10-18T12:59:56Z"
16893
16931
  },
16894
16932
  recommended: true,
16895
16933
  supportedMimeTypes: {
@@ -16953,16 +16991,46 @@ var models_default = {
16953
16991
  "gemini-3.1-flash-image": {
16954
16992
  apiProvider: "API_PROVIDER_GOOGLE_GEMINI",
16955
16993
  displayName: "Gemini 3.1 Flash Image",
16994
+ maxOutputTokens: 65536,
16995
+ maxTokens: 65536,
16956
16996
  model: "MODEL_PLACEHOLDER_M21",
16957
16997
  modelProvider: "MODEL_PROVIDER_GOOGLE",
16958
16998
  quotaInfo: {
16959
- remainingFraction: 0.9439063,
16960
- resetTime: "2026-10-16T09:53:27Z"
16961
- }
16999
+ remainingFraction: 0.9709832,
17000
+ resetTime: "2026-10-18T12:59:56Z"
17001
+ },
17002
+ supportedMimeTypes: {
17003
+ "application/json": true,
17004
+ "application/rtf": true,
17005
+ "application/x-ipynb+json": true,
17006
+ "application/x-javascript": true,
17007
+ "application/x-python-code": true,
17008
+ "application/x-typescript": true,
17009
+ "image/heic": true,
17010
+ "image/heif": true,
17011
+ "image/jpeg": true,
17012
+ "image/png": true,
17013
+ "image/webp": true,
17014
+ "text/css": true,
17015
+ "text/csv": true,
17016
+ "text/html": true,
17017
+ "text/javascript": true,
17018
+ "text/markdown": true,
17019
+ "text/plain": true,
17020
+ "text/rtf": true,
17021
+ "text/x-python": true,
17022
+ "text/x-python-script": true,
17023
+ "text/x-typescript": true,
17024
+ "text/xml": true,
17025
+ "video/jpeg2000": true,
17026
+ "video/text/timestamp": true,
17027
+ "video/videoframe/jpeg2000": true
17028
+ },
17029
+ supportsImages: true
16962
17030
  },
16963
17031
  "gemini-3.1-flash-lite": {
16964
17032
  apiProvider: "API_PROVIDER_GOOGLE_GEMINI",
16965
- displayName: "Gemini 3.5 Flash Lite",
17033
+ displayName: "Gemini 3.1 Flash Lite",
16966
17034
  maxOutputTokens: 65535,
16967
17035
  maxTokens: 1048576,
16968
17036
  minThinkingBudget: 128,
@@ -16979,8 +17047,8 @@ var models_default = {
16979
17047
  },
16980
17048
  modelProvider: "MODEL_PROVIDER_GOOGLE",
16981
17049
  quotaInfo: {
16982
- remainingFraction: 0.9439063,
16983
- resetTime: "2026-10-16T09:53:27Z"
17050
+ remainingFraction: 0.9709832,
17051
+ resetTime: "2026-10-18T12:59:56Z"
16984
17052
  },
16985
17053
  recommended: true,
16986
17054
  supportedMimeTypes: {
@@ -17039,8 +17107,6 @@ var models_default = {
17039
17107
  supportsImages: true,
17040
17108
  supportsThinking: true,
17041
17109
  supportsVideo: true,
17042
- tagDescription: "gemini-3.5-flash-lite",
17043
- thinkingBudget: -1,
17044
17110
  thinkingLevel: 1
17045
17111
  },
17046
17112
  "gemini-3.5-flash-extra-low": {
@@ -17087,8 +17153,8 @@ var models_default = {
17087
17153
  },
17088
17154
  modelProvider: "MODEL_PROVIDER_GOOGLE",
17089
17155
  quotaInfo: {
17090
- remainingFraction: 0.9439063,
17091
- resetTime: "2026-10-16T09:53:27Z"
17156
+ remainingFraction: 0.9709832,
17157
+ resetTime: "2026-10-18T12:59:56Z"
17092
17158
  },
17093
17159
  recommended: true,
17094
17160
  supportedMimeTypes: {
@@ -17168,8 +17234,8 @@ var models_default = {
17168
17234
  },
17169
17235
  modelProvider: "MODEL_PROVIDER_GOOGLE",
17170
17236
  quotaInfo: {
17171
- remainingFraction: 0.9439063,
17172
- resetTime: "2026-10-16T09:53:27Z"
17237
+ remainingFraction: 0.9709832,
17238
+ resetTime: "2026-10-18T12:59:56Z"
17173
17239
  },
17174
17240
  recommended: true,
17175
17241
  supportedMimeTypes: {
@@ -17228,8 +17294,6 @@ var models_default = {
17228
17294
  supportsImages: true,
17229
17295
  supportsThinking: true,
17230
17296
  supportsVideo: true,
17231
- tagDescription: "gemini-3.5-flash-lite",
17232
- thinkingBudget: -1,
17233
17297
  thinkingLevel: 1
17234
17298
  },
17235
17299
  "gemini-3.5-flash-low": {
@@ -17276,8 +17340,8 @@ var models_default = {
17276
17340
  },
17277
17341
  modelProvider: "MODEL_PROVIDER_GOOGLE",
17278
17342
  quotaInfo: {
17279
- remainingFraction: 0.9439063,
17280
- resetTime: "2026-10-16T09:53:27Z"
17343
+ remainingFraction: 0.9709832,
17344
+ resetTime: "2026-10-18T12:59:56Z"
17281
17345
  },
17282
17346
  recommended: true,
17283
17347
  supportedMimeTypes: {
@@ -17388,8 +17452,8 @@ var models_default = {
17388
17452
  },
17389
17453
  modelProvider: "MODEL_PROVIDER_GOOGLE",
17390
17454
  quotaInfo: {
17391
- remainingFraction: 0.9439063,
17392
- resetTime: "2026-10-16T09:53:27Z"
17455
+ remainingFraction: 0.9709832,
17456
+ resetTime: "2026-10-18T12:59:56Z"
17393
17457
  },
17394
17458
  recommended: true,
17395
17459
  supportedMimeTypes: {
@@ -17500,8 +17564,8 @@ var models_default = {
17500
17564
  },
17501
17565
  modelProvider: "MODEL_PROVIDER_GOOGLE",
17502
17566
  quotaInfo: {
17503
- remainingFraction: 0.9439063,
17504
- resetTime: "2026-10-16T09:53:27Z"
17567
+ remainingFraction: 0.9709832,
17568
+ resetTime: "2026-10-18T12:59:56Z"
17505
17569
  },
17506
17570
  recommended: true,
17507
17571
  supportedMimeTypes: {
@@ -17612,8 +17676,8 @@ var models_default = {
17612
17676
  },
17613
17677
  modelProvider: "MODEL_PROVIDER_GOOGLE",
17614
17678
  quotaInfo: {
17615
- remainingFraction: 0.9439063,
17616
- resetTime: "2026-10-16T09:53:27Z"
17679
+ remainingFraction: 0.9709832,
17680
+ resetTime: "2026-10-18T12:59:56Z"
17617
17681
  },
17618
17682
  recommended: true,
17619
17683
  supportedMimeTypes: {
@@ -17723,8 +17787,8 @@ var models_default = {
17723
17787
  },
17724
17788
  modelProvider: "MODEL_PROVIDER_GOOGLE",
17725
17789
  quotaInfo: {
17726
- remainingFraction: 0.9439063,
17727
- resetTime: "2026-10-16T09:53:27Z"
17790
+ remainingFraction: 0.9709832,
17791
+ resetTime: "2026-10-18T12:59:56Z"
17728
17792
  },
17729
17793
  recommended: true,
17730
17794
  supportedMimeTypes: {
@@ -18054,8 +18118,8 @@ monitors {
18054
18118
  },
18055
18119
  modelProvider: "MODEL_PROVIDER_GOOGLE",
18056
18120
  quotaInfo: {
18057
- remainingFraction: 0.199572,
18058
- resetTime: "2026-10-23T05:24:42Z"
18121
+ remainingFraction: 0.7963,
18122
+ resetTime: "2026-10-24T16:42:08Z"
18059
18123
  },
18060
18124
  recommended: true,
18061
18125
  supportedMimeTypes: {
@@ -18387,8 +18451,8 @@ monitors {
18387
18451
  },
18388
18452
  modelProvider: "MODEL_PROVIDER_GOOGLE",
18389
18453
  quotaInfo: {
18390
- remainingFraction: 0.199572,
18391
- resetTime: "2026-10-23T05:24:42Z"
18454
+ remainingFraction: 0.7963,
18455
+ resetTime: "2026-10-24T16:42:08Z"
18392
18456
  },
18393
18457
  recommended: true,
18394
18458
  supportedMimeTypes: {
@@ -18720,8 +18784,8 @@ monitors {
18720
18784
  },
18721
18785
  modelProvider: "MODEL_PROVIDER_GOOGLE",
18722
18786
  quotaInfo: {
18723
- remainingFraction: 0.199572,
18724
- resetTime: "2026-10-23T05:24:42Z"
18787
+ remainingFraction: 0.7963,
18788
+ resetTime: "2026-10-24T16:42:08Z"
18725
18789
  },
18726
18790
  recommended: true,
18727
18791
  supportedMimeTypes: {
@@ -18800,7 +18864,7 @@ monitors {
18800
18864
  modelProvider: "MODEL_PROVIDER_OPENAI",
18801
18865
  quotaInfo: {
18802
18866
  remainingFraction: 1,
18803
- resetTime: "2026-10-16T11:39:51Z"
18867
+ resetTime: "2026-10-18T13:33:10Z"
18804
18868
  },
18805
18869
  recommended: true,
18806
18870
  supportsThinking: true,
@@ -21453,6 +21517,8 @@ function createV2RetryHook() {
21453
21517
  event.retryDelayMs = delayMs;
21454
21518
  }
21455
21519
  }
21520
+ } else if (event.error && isRetryableNetworkError(event.error)) {
21521
+ event.retryDelayMs = getExponentialDelayWithJitter(event.attempt || 1);
21456
21522
  }
21457
21523
  };
21458
21524
  }