@thesashadev/girl-agent 0.1.15 → 0.1.16

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.16
4
+
5
+ Дата: 2026-05-08
6
+
7
+ - Merge pull request #63 from TheSashaDev/devin/1778244236-serialize-llm-requests
8
+ - Serialize LLM provider requests
9
+
3
10
  ## 0.1.15
4
11
 
5
12
  Дата: 2026-05-08
package/dist/cli.js CHANGED
@@ -1229,6 +1229,31 @@ function openBrowser(url) {
1229
1229
  // src/llm/index.ts
1230
1230
  var LLM_TIMEOUT_MS = 12e4;
1231
1231
  var LLM_MAX_RETRIES = 1;
1232
+ var llmQueueTail = Promise.resolve();
1233
+ var SerializedLLMClient = class {
1234
+ constructor(inner) {
1235
+ this.inner = inner;
1236
+ }
1237
+ inner;
1238
+ chat(messages, opts = {}) {
1239
+ return runExclusiveLLM(() => this.inner.chat(messages, opts));
1240
+ }
1241
+ };
1242
+ async function runExclusiveLLM(task) {
1243
+ const previous = llmQueueTail.catch(() => void 0);
1244
+ let release = () => {
1245
+ };
1246
+ const current = new Promise((resolve) => {
1247
+ release = resolve;
1248
+ });
1249
+ llmQueueTail = previous.then(() => current);
1250
+ await previous;
1251
+ try {
1252
+ return await task();
1253
+ } finally {
1254
+ release();
1255
+ }
1256
+ }
1232
1257
  var OpenAILike = class {
1233
1258
  constructor(cfg) {
1234
1259
  this.cfg = cfg;
@@ -1533,7 +1558,8 @@ function errorMessage(error) {
1533
1558
  return error instanceof Error ? error.message : String(error ?? "");
1534
1559
  }
1535
1560
  function makeLLM(cfg) {
1536
- return cfg.proto === "anthropic" ? new AnthropicLike(cfg) : new OpenAILike(cfg);
1561
+ const inner = cfg.proto === "anthropic" ? new AnthropicLike(cfg) : new OpenAILike(cfg);
1562
+ return new SerializedLLMClient(inner);
1537
1563
  }
1538
1564
 
1539
1565
  // src/engine/persona-gen.ts
@@ -4959,9 +4985,19 @@ function isTechnicalError(e) {
4959
4985
  }
4960
4986
  function silentErrorLabel(e) {
4961
4987
  const msg = e instanceof Error ? e.message : String(e ?? "unknown");
4962
- if (isTechnicalError(e)) return "llm/provider unavailable";
4988
+ if (isTechnicalError(e)) return `llm/provider unavailable: ${technicalErrorKind(msg)}`;
4963
4989
  return msg.slice(0, 160);
4964
4990
  }
4991
+ function technicalErrorKind(message) {
4992
+ const msg = message.toLowerCase();
4993
+ if (/401|403|auth|unauthorized|forbidden|apikey|api key|token/.test(msg)) return "auth";
4994
+ if (/quota|balance|billing|insufficient_quota|credit|credits/.test(msg)) return "quota";
4995
+ if (/rate limit|429|too many requests/.test(msg)) return "rate-limit";
4996
+ if (/timeout|etimedout|abort/.test(msg)) return "timeout";
4997
+ if (/econn|enotfound|fetch failed|network/.test(msg)) return "network";
4998
+ if (/overloaded|500|502|503|504|unavailable/.test(msg)) return "provider";
4999
+ return "error";
5000
+ }
4965
5001
 
4966
5002
  // src/engine/stickers.ts
4967
5003
  init_esm_shims();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thesashadev/girl-agent",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "Telegram AI persona engine with memory, schedule, relationship state and MTProto userbot mode.",
5
5
  "type": "module",
6
6
  "bin": {