@thesashadev/girl-agent 0.1.9 → 0.1.10

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,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.10
4
+
5
+ Дата: 2026-05-07
6
+
7
+ - Merge pull request #51 from TheSashaDev/devin/1778179420-proxy-wss-support
8
+ - refactor: remove proxy support, WSS enabled by default
9
+ - feat: add numeric identifiers to stages for convenience
10
+ - feat: add proxy/WSS support for Telegram (fixes #38, #32)
11
+
3
12
  ## 0.1.9
4
13
 
5
14
  Дата: 2026-05-07
package/dist/cli.js CHANGED
@@ -59,13 +59,15 @@ function makeUserbotAdapter(cfg) {
59
59
  const apiHash = cfg.telegram.apiHash;
60
60
  const session = cfg.telegram.sessionString ?? "";
61
61
  if (!apiId || !apiHash) throw new Error("API_ID/API_HASH missing for userbot");
62
- debug("[userbot] creating TelegramClient\u2026");
62
+ const useWSS = cfg.telegram.useWSS !== false;
63
+ debug(`[userbot] creating TelegramClient (useWSS=${useWSS})\u2026`);
63
64
  const client = new TelegramClient(new StringSession(session), apiId, apiHash, {
64
65
  connectionRetries: 5,
65
66
  requestRetries: 5,
66
67
  retryDelay: 3e3,
67
68
  autoReconnect: true,
68
- floodSleepThreshold: 120
69
+ floodSleepThreshold: 120,
70
+ useWSS
69
71
  });
70
72
  client.onError = async () => {
71
73
  };
@@ -214,7 +216,8 @@ function makeUserbotAdapter(cfg) {
214
216
  }
215
217
  async function userbotLogin(opts) {
216
218
  const client = new TelegramClient(new StringSession(""), opts.apiId, opts.apiHash, {
217
- connectionRetries: 5
219
+ connectionRetries: 5,
220
+ useWSS: true
218
221
  });
219
222
  await client.start({
220
223
  phoneNumber: async () => opts.phone,
@@ -590,6 +593,7 @@ init_esm_shims();
590
593
  var STAGE_PRESETS = [
591
594
  {
592
595
  id: "met-irl-got-tg",
596
+ num: 1,
593
597
  label: "\u0412\u0441\u0442\u0440\u0435\u0442\u0438\u043B\u0438\u0441\u044C \u0432 \u0440\u0435\u0430\u043B\u0435 \u2014 \u0434\u0430\u043B\u0430 \u0442\u0433",
594
598
  description: "\u0422\u043E\u043B\u044C\u043A\u043E \u0447\u0442\u043E \u043E\u0431\u043C\u0435\u043D\u044F\u043B\u0438\u0441\u044C \u0442\u0433. \u041F\u043E\u043C\u043D\u0438\u0442 \u043B\u0438\u0446\u043E, \u0433\u043E\u043B\u043E\u0441. \u041B\u0451\u0433\u043A\u0438\u0439 \u0438\u043D\u0442\u0435\u0440\u0435\u0441.",
595
599
  defaults: {
@@ -604,6 +608,7 @@ var STAGE_PRESETS = [
604
608
  },
605
609
  {
606
610
  id: "tg-given-cold",
611
+ num: 2,
607
612
  label: "\u0414\u0430\u043B\u0430 \u0442\u0433, \u043D\u043E \u043D\u0435 \u0443\u0431\u0435\u0434\u0438\u043B \u043E\u0442\u0432\u0435\u0447\u0430\u0442\u044C",
608
613
  description: "\u0421\u043E\u043C\u043D\u0435\u0432\u0430\u0435\u0442\u0441\u044F. \u0427\u0430\u0441\u0442\u043E \u0438\u0433\u043D\u043E\u0440\u0438\u0442, \u043E\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043E\u0434\u043D\u043E\u0441\u043B\u043E\u0436\u043D\u043E. \u041D\u0443\u0436\u043D\u043E \u0434\u043E\u0431\u0438\u0432\u0430\u0442\u044C\u0441\u044F.",
609
614
  defaults: {
@@ -618,6 +623,7 @@ var STAGE_PRESETS = [
618
623
  },
619
624
  {
620
625
  id: "tg-given-warming",
626
+ num: 3,
621
627
  label: "\u0414\u0430\u043B\u0430 \u0442\u0433, \u043E\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043E\u0441\u0442\u043E\u0440\u043E\u0436\u043D\u043E",
622
628
  description: "\u041E\u0442\u0442\u0430\u0438\u0432\u0430\u0435\u0442. \u041E\u0442\u0432\u0435\u0447\u0430\u0435\u0442, \u043D\u043E \u043A\u043E\u0440\u043E\u0442\u043A\u043E. \u0422\u0435\u0441\u0442\u0438\u0442 \u0442\u0435\u0431\u044F.",
623
629
  defaults: {
@@ -632,6 +638,7 @@ var STAGE_PRESETS = [
632
638
  },
633
639
  {
634
640
  id: "convinced",
641
+ num: 4,
635
642
  label: "\u0423\u0431\u0435\u0434\u0438\u043B \u043E\u0442\u0432\u0435\u0447\u0430\u0442\u044C \u0441\u0442\u0430\u0431\u0438\u043B\u044C\u043D\u043E",
636
643
  description: "\u041E\u0431\u0449\u0430\u0435\u0442\u0435\u0441\u044C \u0440\u0435\u0433\u0443\u043B\u044F\u0440\u043D\u043E, \u0444\u043B\u0438\u0440\u0442\u0443\u0435\u0442, \u0435\u0449\u0451 \u043D\u0435 \u0432\u0438\u0434\u0435\u043B\u0438\u0441\u044C \u043F\u043E\u0441\u043B\u0435 \u0437\u043D\u0430\u043A\u043E\u043C\u0441\u0442\u0432\u0430.",
637
644
  defaults: {
@@ -646,6 +653,7 @@ var STAGE_PRESETS = [
646
653
  },
647
654
  {
648
655
  id: "first-date-done",
656
+ num: 5,
649
657
  label: "\u0421\u0445\u043E\u0434\u0438\u043B\u0438 \u043E\u0434\u0438\u043D \u0440\u0430\u0437",
650
658
  description: "\u041F\u0435\u0440\u0432\u043E\u0435 \u0441\u0432\u0438\u0434\u0430\u043D\u0438\u0435 \u0431\u044B\u043B\u043E, \u0432 \u043F\u043E\u0434\u0432\u0435\u0448\u0435\u043D\u043D\u043E\u043C \u0441\u043E\u0441\u0442\u043E\u044F\u043D\u0438\u0438 \u2014 \u043D\u0440\u0430\u0432\u0438\u0442\u0441\u044F, \u043D\u043E \u043D\u0435 \u043F\u0430\u0440\u0430.",
651
659
  defaults: {
@@ -660,6 +668,7 @@ var STAGE_PRESETS = [
660
668
  },
661
669
  {
662
670
  id: "dating-early",
671
+ num: 6,
663
672
  label: "\u0422\u043E\u043B\u044C\u043A\u043E \u043D\u0430\u0447\u0430\u043B\u0438 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0442\u044C\u0441\u044F",
664
673
  description: "\u041E\u043A\u043E\u043B\u043E \u043C\u0435\u0441\u044F\u0446\u0430 \u0432\u043C\u0435\u0441\u0442\u0435. \u0411\u0430\u0431\u043E\u0447\u043A\u0438, \u0432\u0441\u0451 \u0432\u043D\u043E\u0432\u0435, \u043D\u043E \u0433\u0440\u0430\u043D\u0438\u0446\u044B \u0435\u0449\u0451 \u0445\u0440\u0443\u043F\u043A\u0438\u0435.",
665
674
  defaults: {
@@ -674,6 +683,7 @@ var STAGE_PRESETS = [
674
683
  },
675
684
  {
676
685
  id: "dating-stable",
686
+ num: 7,
677
687
  label: "\u041F\u0430\u0440\u0430, \u043E\u0431\u0449\u0430\u0435\u0442\u0435\u0441\u044C \u0441\u0432\u043E\u0431\u043E\u0434\u043D\u043E",
678
688
  description: "\u0421\u0442\u0430\u0431\u0438\u043B\u044C\u043D\u044B\u0435 \u043E\u0442\u043D\u043E\u0448\u0435\u043D\u0438\u044F, \u0448\u0443\u0442\u043A\u0438, \u0431\u044B\u0442\u043E\u0432\u0443\u0445\u0430, \u0434\u043E\u0432\u0435\u0440\u0438\u0435.",
679
689
  defaults: {
@@ -688,6 +698,7 @@ var STAGE_PRESETS = [
688
698
  },
689
699
  {
690
700
  id: "long-term",
701
+ num: 8,
691
702
  label: "\u0414\u0430\u0432\u043D\u043E \u0432\u043C\u0435\u0441\u0442\u0435",
692
703
  description: "\u0413\u043E\u0434+ \u0432\u043C\u0435\u0441\u0442\u0435. \u0418\u043D\u043E\u0433\u0434\u0430 \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0435\u043D\u0438\u0435, \u0440\u0443\u0442\u0438\u043D\u0430, \u0433\u043B\u0443\u0431\u043E\u043A\u043E\u0435 \u0434\u043E\u0432\u0435\u0440\u0438\u0435.",
693
704
  defaults: {
@@ -702,6 +713,7 @@ var STAGE_PRESETS = [
702
713
  },
703
714
  {
704
715
  id: "dumped",
716
+ num: 9,
705
717
  label: "\u041E\u0442\u0448\u0438\u043B\u0430 (\u0441\u043B\u0443\u0436\u0435\u0431\u043D\u043E\u0435)",
706
718
  description: "\u041D\u0435 \u043E\u0442\u0432\u0435\u0447\u0430\u0435\u0442. \u0421\u043D\u0438\u043C\u0430\u0435\u0442\u0441\u044F \u043A\u043E\u043C\u0430\u043D\u0434\u043E\u0439 :reset.",
707
719
  defaults: {
@@ -716,6 +728,10 @@ var STAGE_PRESETS = [
716
728
  }
717
729
  ];
718
730
  function findStage(id) {
731
+ if (typeof id === "number" || /^\d+$/.test(String(id))) {
732
+ const num = Number(id);
733
+ return STAGE_PRESETS.find((s) => s.num === num) ?? STAGE_PRESETS[1];
734
+ }
719
735
  return STAGE_PRESETS.find((s) => s.id === id) ?? STAGE_PRESETS[1];
720
736
  }
721
737
 
@@ -2434,7 +2450,7 @@ function Wizard({ initial, onDone }) {
2434
2450
  SelectInput,
2435
2451
  {
2436
2452
  limit: 10,
2437
- items: STAGE_PRESETS.filter((s) => s.id !== "dumped").map((s) => ({ label: `${s.label} \xB7 ${s.description}`, value: s.id })),
2453
+ items: STAGE_PRESETS.filter((s) => s.id !== "dumped").map((s) => ({ label: `${s.num}. ${s.label} \xB7 ${s.description}`, value: s.id })),
2438
2454
  onSelect: async (it) => {
2439
2455
  const nextStage = it.value;
2440
2456
  setStage(nextStage);
@@ -2679,7 +2695,7 @@ function Dashboard({ runtime }) {
2679
2695
  break;
2680
2696
  }
2681
2697
  case "help":
2682
- append(":status :why :amnesia <\u043C\u0438\u043D> [chatId] :reset :stage <id> :wake [chatId] :debug [chatId] :pause :resume :cringe :relationship :persona :log [YYYY-MM-DD] [chars] :block [chatId] :unblock [chatId] :read [chatId] :clear-chat [chatId] [--revoke] :report-spam [chatId] :delete-last [chatId] [--local] :edit-last <text> :sticker [chatId] :quit");
2698
+ append(":status :why :amnesia <\u043C\u0438\u043D> [chatId] :reset :stage <id|num> :wake [chatId] :debug [chatId] :pause :resume :cringe :relationship :persona :log [YYYY-MM-DD] [chars] :block [chatId] :unblock [chatId] :read [chatId] :clear-chat [chatId] [--revoke] :report-spam [chatId] :delete-last [chatId] [--local] :edit-last <text> :sticker [chatId] :quit");
2683
2699
  break;
2684
2700
  case "quit":
2685
2701
  case "exit":
@@ -2697,7 +2713,7 @@ function Dashboard({ runtime }) {
2697
2713
  const line = cmd.trim();
2698
2714
  setCmd("");
2699
2715
  if (line) await execute(line);
2700
- } })), /* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, "\u043A\u043E\u043C\u0430\u043D\u0434\u044B: :status :why :amnesia <\u043C\u0438\u043D> :reset :stage <id> :pause :resume :cringe :persona :log [day] :block :unblock :read :clear-chat :delete-last :edit-last :sticker :quit"));
2716
+ } })), /* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, "\u043A\u043E\u043C\u0430\u043D\u0434\u044B: :status :why :amnesia <\u043C\u0438\u043D> :reset :stage <id|num> :pause :resume :cringe :persona :log [day] :block :unblock :read :clear-chat :delete-last :edit-last :sticker :quit"));
2701
2717
  }
2702
2718
 
2703
2719
  // src/engine/runtime.ts
@@ -5389,10 +5405,11 @@ ${tick.intent === "short" ? "\u041E\u0442\u0432\u0435\u0447\u0430\u0439 \u043E\u
5389
5405
  }
5390
5406
  async cmdSetStage(stageId) {
5391
5407
  const prev = this.cfg.stage;
5392
- this.cfg.stage = stageId;
5408
+ const resolved = findStage(stageId);
5409
+ this.cfg.stage = resolved.id;
5393
5410
  await writeConfig(this.cfg);
5394
- await maybeAdvanceRelationshipTimeline(this.cfg, prev, stageId);
5395
- return `\u0441\u0442\u0430\u0434\u0438\u044F \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0430: ${stageId}`;
5411
+ await maybeAdvanceRelationshipTimeline(this.cfg, prev, resolved.id);
5412
+ return `\u0441\u0442\u0430\u0434\u0438\u044F \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0430: ${resolved.num}=${resolved.id}`;
5396
5413
  }
5397
5414
  async cmdWake(chatId) {
5398
5415
  const now = Date.now();
@@ -5852,7 +5869,7 @@ async function runHeadlessJsonEvents(rt) {
5852
5869
  t: Date.now(),
5853
5870
  paused,
5854
5871
  profile: profileSummary(rt.cfg),
5855
- stage: { id: r.stage, label: findStage(r.stage).label },
5872
+ stage: { id: r.stage, num: findStage(r.stage).num, label: findStage(r.stage).label },
5856
5873
  score: r.score
5857
5874
  });
5858
5875
  return;
@@ -5896,7 +5913,7 @@ function profileSummary(cfg) {
5896
5913
  mode: cfg.mode,
5897
5914
  nationality: cfg.nationality,
5898
5915
  tz: cfg.tz,
5899
- stage: { id: cfg.stage, label: stage.label }
5916
+ stage: { id: cfg.stage, num: stage.num, label: stage.label }
5900
5917
  };
5901
5918
  }
5902
5919
 
@@ -5925,7 +5942,7 @@ env-vars (\u0434\u043B\u044F CI / docker secrets / k8s):
5925
5942
  GIRL_AGENT_TOKEN telegram bot token
5926
5943
  GIRL_AGENT_API_PRESET openai|anthropic|claudehub|...
5927
5944
  GIRL_AGENT_API_KEY \u043A\u043B\u044E\u0447 \u043E\u0442 \u043F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440\u0430
5928
- GIRL_AGENT_MODEL, _NAME, _AGE, _NATIONALITY, _TZ, _STAGE, _COMM_PRESET
5945
+ GIRL_AGENT_MODEL, _NAME, _AGE, _NATIONALITY, _TZ, _STAGE (id \u0438\u043B\u0438 \u043D\u043E\u043C\u0435\u0440 1-8), _COMM_PRESET
5929
5946
 
5930
5947
  \u0434\u043B\u044F \u0438\u043D\u0442\u0435\u0440\u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0439 \u043F\u0435\u0440\u0432\u0438\u0447\u043D\u043E\u0439 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u0439 \u0431\u0435\u0437 \u0444\u043B\u0430\u0433\u043E\u0432 \u0432 \u043E\u0431\u044B\u0447\u043D\u043E\u043C \u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B\u0435 \u2014
5931
5948
  \u043E\u0442\u043A\u0440\u043E\u0435\u0442\u0441\u044F ink-\u0432\u0438\u0437\u0430\u0440\u0434.
@@ -6062,7 +6079,7 @@ function configFromEnv() {
6062
6079
  const name = e.GIRL_AGENT_NAME || pickRandomNames(nationality, 1)[0];
6063
6080
  const age = Number(e.GIRL_AGENT_AGE ?? 18);
6064
6081
  const tz = e.GIRL_AGENT_TZ ? parseTzFlag(e.GIRL_AGENT_TZ) ?? defaultTzForNationality(nationality) : defaultTzForNationality(nationality);
6065
- const stage = e.GIRL_AGENT_STAGE || "tg-given-cold";
6082
+ const stage = e.GIRL_AGENT_STAGE ? findStage(e.GIRL_AGENT_STAGE).id : "tg-given-cold";
6066
6083
  const commPreset = COMMUNICATION_PRESETS.find((c) => c.id === (e.GIRL_AGENT_COMM_PRESET ?? "normal")) ?? COMMUNICATION_PRESETS[0];
6067
6084
  return {
6068
6085
  slug: slugify(name),
@@ -6309,13 +6326,13 @@ required flags \u0434\u043B\u044F headless setup (--name --age --stage --api-pre
6309
6326
  --privacy=<mode> owner-only|allow-strangers (\u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E owner-only)
6310
6327
  --nationality=RU|UA (\u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E RU)
6311
6328
  --tz=<value> IANA "Europe/Moscow" / "GMT+3" / "+3" / "\u041A\u0438\u0435\u0432" \u2014 \u043F\u043E\u0438\u0441\u043A
6312
- --stage=<id> met-irl-got-tg|tg-given-cold|tg-given-warming|convinced|first-date-done|dating-early|dating-stable|long-term
6329
+ --stage=<id|num> 1=met-irl-got-tg 2=tg-given-cold 3=tg-given-warming 4=convinced 5=first-date-done 6=dating-early 7=dating-stable 8=long-term
6313
6330
  --mcp=exa:KEY \u043C\u043E\u0436\u043D\u043E \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0440\u0430\u0437
6314
6331
  --new \u043F\u0440\u0438\u043D\u0443\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E \u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0432\u0438\u0437\u0430\u0440\u0434 \u0434\u043B\u044F \u043D\u043E\u0432\u043E\u0433\u043E \u043F\u0440\u043E\u0444\u0438\u043B\u044F
6315
6332
  --list \u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u0440\u043E\u0444\u0438\u043B\u0438
6316
6333
  --help
6317
6334
 
6318
- \u043A\u043E\u043C\u0430\u043D\u0434\u044B \u0432 \u0440\u0430\u0431\u043E\u0442\u0430\u044E\u0449\u0435\u043C \u0434\u0430\u0448\u0431\u043E\u0440\u0434\u0435: :status :reset :stage <id> :pause :resume :cringe :persona :log :quit
6335
+ \u043A\u043E\u043C\u0430\u043D\u0434\u044B \u0432 \u0440\u0430\u0431\u043E\u0442\u0430\u044E\u0449\u0435\u043C \u0434\u0430\u0448\u0431\u043E\u0440\u0434\u0435: :status :reset :stage <id|num> :pause :resume :cringe :persona :log :quit
6319
6336
  `;
6320
6337
  async function main() {
6321
6338
  const argv = mri(process.argv.slice(2), {
@@ -6513,7 +6530,7 @@ async function buildConfigFromFlags(argv) {
6513
6530
  nationality,
6514
6531
  tz,
6515
6532
  mode,
6516
- stage: argv.stage,
6533
+ stage: findStage(argv.stage).id,
6517
6534
  llm: { presetId, proto, baseURL, apiKey: String(argv["api-key"] ?? preset?.defaultApiKey ?? ""), model },
6518
6535
  telegram: mode === "bot" ? { botToken: String(argv.token ?? "") } : {
6519
6536
  apiId: Number(argv["api-id"] ?? 0),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thesashadev/girl-agent",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Telegram AI persona engine with memory, schedule, relationship state and MTProto userbot mode.",
5
5
  "type": "module",
6
6
  "bin": {