aisubs 0.3.5 → 0.3.7

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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.7 - 2026-09-16
4
+
5
+ - Improve provider compatibility, proxy handling, and request normalization.
6
+ - Harden dashboard account flows, modal interactions, and stale-load handling.
7
+ - Add regression coverage for compatibility, proxy headers, authentication, and
8
+ dashboard behavior.
9
+
10
+ ## 0.3.6 - 2026-09-15
11
+
12
+ - Preserve provider cache controls and cache usage across OpenAI-compatible,
13
+ Anthropic, Responses, and subscription transports.
14
+ - Keep ChatGPT cache routing state scoped to account, session, and turn.
15
+ - Normalize cache reads/writes and reasoning usage without losing native fields.
16
+
3
17
  ## 0.3.5 - 2026-09-14
4
18
 
5
19
  - Move ChatGPT Responses instructions into the developer input prefix so
package/dist/auth.d.ts CHANGED
@@ -53,6 +53,7 @@ export declare class SubscriptionAuth {
53
53
  error: string | null;
54
54
  } | null;
55
55
  cancelLoginAttempt(id: string): boolean;
56
+ private cancelAttempt;
56
57
  status(provider: ProviderId, options?: {
57
58
  validate?: boolean;
58
59
  account?: string;
package/dist/auth.js CHANGED
@@ -162,14 +162,19 @@ export class SubscriptionAuth {
162
162
  }
163
163
  const epoch = this.advance(scope);
164
164
  for (const attempt of this.attempts.values()) {
165
- if (attempt.scope === scope && attempt.state === "pending")
166
- attempt.abort.abort();
165
+ if (attempt.scope === scope)
166
+ this.cancelAttempt(attempt);
167
167
  }
168
168
  const abort = new AbortController();
169
169
  const providerOptions = { ...options };
170
170
  delete providerOptions.account;
171
171
  delete providerOptions.replace;
172
172
  const login = await adapter.startLogin(abort.signal, providerOptions);
173
+ if (this.generation(scope) !== epoch) {
174
+ abort.abort();
175
+ void login.complete.catch(() => { });
176
+ throw new Error("Login cancelled");
177
+ }
173
178
  const id = crypto.randomUUID();
174
179
  let record;
175
180
  const promise = login.complete
@@ -199,6 +204,7 @@ export class SubscriptionAuth {
199
204
  provider,
200
205
  accountKey,
201
206
  scope,
207
+ generation: epoch,
202
208
  state: "pending",
203
209
  error: null,
204
210
  abort,
@@ -218,10 +224,7 @@ export class SubscriptionAuth {
218
224
  return record.error;
219
225
  },
220
226
  wait: () => record.promise,
221
- cancel: () => {
222
- this.advance(scope);
223
- abort.abort();
224
- },
227
+ cancel: () => this.cancelAttempt(record),
225
228
  };
226
229
  }
227
230
  expireLoginAttempt(id) {
@@ -243,10 +246,17 @@ export class SubscriptionAuth {
243
246
  const attempt = this.attempts.get(id);
244
247
  if (!attempt || attempt.state !== "pending")
245
248
  return false;
246
- this.advance(attempt.scope);
247
- attempt.abort.abort();
249
+ this.cancelAttempt(attempt);
248
250
  return true;
249
251
  }
252
+ cancelAttempt(attempt) {
253
+ if (attempt.state !== "pending")
254
+ return;
255
+ if (this.generation(attempt.scope) === attempt.generation)
256
+ this.advance(attempt.scope);
257
+ attempt.state = "cancelled";
258
+ attempt.abort.abort();
259
+ }
250
260
  async status(provider, options = {}) {
251
261
  const accountKey = normalizeAccountKey(options.account);
252
262
  if (options.validate)
@@ -277,8 +287,8 @@ export class SubscriptionAuth {
277
287
  for (const refresh of this.refreshes.get(scope) ?? [])
278
288
  refresh.abort();
279
289
  for (const attempt of this.attempts.values()) {
280
- if (attempt.scope === scope && attempt.state === "pending")
281
- attempt.abort.abort();
290
+ if (attempt.scope === scope)
291
+ this.cancelAttempt(attempt);
282
292
  }
283
293
  await this.store.delete(scope);
284
294
  }
package/dist/cli.js CHANGED
File without changes