@rimori/client 2.5.17-next.1 → 2.5.17

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.
@@ -67,11 +67,6 @@ export declare class AIModule {
67
67
  setSessionToken(id: string): void;
68
68
  /** Clears the stored session token (called after macro accomplishment). */
69
69
  clearSessionToken(): void;
70
- /**
71
- * Ensures a session token exists, requesting one from the backend if needed.
72
- * Mirrors the lazy-issuance pattern used by the AI/LLM endpoint.
73
- */
74
- private ensureSessionToken;
75
70
  /** Registers a callback invoked whenever a 429 rate-limit response is received. */
76
71
  setOnRateLimited(cb: (exercisesRemaining: number) => void): void;
77
72
  /**
@@ -29,32 +29,6 @@ export class AIModule {
29
29
  clearSessionToken() {
30
30
  this.sessionTokenId = null;
31
31
  }
32
- /**
33
- * Ensures a session token exists, requesting one from the backend if needed.
34
- * Mirrors the lazy-issuance pattern used by the AI/LLM endpoint.
35
- */
36
- ensureSessionToken() {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- var _a, _b, _c;
39
- if (this.sessionTokenId)
40
- return;
41
- const response = yield fetch(`${this.backendUrl}/ai/session`, {
42
- method: 'POST',
43
- headers: { Authorization: `Bearer ${this.getToken()}` },
44
- });
45
- if (!response.ok) {
46
- if (response.status === 429) {
47
- const body = yield response.json().catch(() => ({}));
48
- const remaining = (_a = body.exercises_remaining) !== null && _a !== void 0 ? _a : 0;
49
- (_b = this.onRateLimitedCb) === null || _b === void 0 ? void 0 : _b.call(this, remaining);
50
- throw new Error(`Rate limit exceeded: ${(_c = body.error) !== null && _c !== void 0 ? _c : 'Daily exercise limit reached'}. exercises_remaining: ${remaining}`);
51
- }
52
- throw new Error(`Failed to create session: ${response.status} ${response.statusText}`);
53
- }
54
- const { session_token_id } = yield response.json();
55
- this.sessionTokenId = session_token_id;
56
- });
57
- }
58
32
  /** Registers a callback invoked whenever a 429 rate-limit response is received. */
59
33
  setOnRateLimited(cb) {
60
34
  this.onRateLimitedCb = cb;
@@ -122,7 +96,6 @@ export class AIModule {
122
96
  getVoice(text_1) {
123
97
  return __awaiter(this, arguments, void 0, function* (text, voice = 'alloy', speed = 1, language, cache = false) {
124
98
  var _a;
125
- yield this.ensureSessionToken();
126
99
  return yield fetch(`${this.backendUrl}/voice/tts`, {
127
100
  method: 'POST',
128
101
  headers: {
@@ -141,7 +114,6 @@ export class AIModule {
141
114
  */
142
115
  getTextFromVoice(file, language) {
143
116
  return __awaiter(this, void 0, void 0, function* () {
144
- yield this.ensureSessionToken();
145
117
  const formData = new FormData();
146
118
  formData.append('file', file);
147
119
  if (language) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/client",
3
- "version": "2.5.17-next.1",
3
+ "version": "2.5.17",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {