quotacap 0.0.29 → 0.0.30

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.
@@ -32,6 +32,11 @@ function parseWeeklyReset(raw, now) {
32
32
  return dt.toISOString();
33
33
  }
34
34
  function parseFiveReset(raw, now) {
35
+ // The 5h reset is bare ("19:38") when it falls today and date-qualified
36
+ // ("02:43 on 15 Sep", weekly shape) otherwise; accept both.
37
+ const qualified = parseWeeklyReset(raw, now);
38
+ if (qualified)
39
+ return qualified;
35
40
  const m = raw.trim().match(/^(\d{1,2}):(\d{2})$/);
36
41
  if (!m)
37
42
  return null;
@@ -171,6 +171,51 @@ function matchPrecedence(evidence, errorName, errorCode, text) {
171
171
  if (/\bparse error\b/i.test(text) || /\bsyntax error\b/i.test(text) || /\bfailed to parse\b/i.test(text)) {
172
172
  return { code: "parse_error", phrase: "parse error" };
173
173
  }
174
+ // QuotaCap-authored adapter parse vocabulary (`src/adapters/*.ts` throws).
175
+ // Fixed subjects only: a quoted provider value after "bad … reset" is never
176
+ // echoed, per the sanitization policy.
177
+ if (/\bweekly limit not found\b/i.test(text)) {
178
+ return { code: "parse_error", phrase: "weekly limit not found" };
179
+ }
180
+ if (/\b5h limit not found\b/i.test(text)) {
181
+ return { code: "parse_error", phrase: "5h limit not found" };
182
+ }
183
+ if (/\bweekly percent not found\b/i.test(text)) {
184
+ return { code: "parse_error", phrase: "weekly percent not found" };
185
+ }
186
+ if (/\bweekly usage not found\b/i.test(text)) {
187
+ return { code: "parse_error", phrase: "weekly usage not found" };
188
+ }
189
+ if (/\bcurrent-window usage not found\b/i.test(text)) {
190
+ return { code: "parse_error", phrase: "current-window usage not found" };
191
+ }
192
+ if (/\bbad weekly pct\b/i.test(text)) {
193
+ return { code: "parse_error", phrase: "bad weekly pct" };
194
+ }
195
+ if (/\bbad 5h pct\b/i.test(text)) {
196
+ return { code: "parse_error", phrase: "bad 5h pct" };
197
+ }
198
+ if (/\bbad current pct\b/i.test(text)) {
199
+ return { code: "parse_error", phrase: "bad current pct" };
200
+ }
201
+ if (/\bbad weekly reset\b/i.test(text)) {
202
+ return { code: "parse_error", phrase: "bad weekly reset" };
203
+ }
204
+ if (/\bbad 5h reset\b/i.test(text)) {
205
+ return { code: "parse_error", phrase: "bad 5h reset" };
206
+ }
207
+ if (/\bbad weekly reset_time\b/i.test(text)) {
208
+ return { code: "parse_error", phrase: "bad weekly reset_time" };
209
+ }
210
+ if (/\bstatus is not SUCCESS\b/i.test(text)) {
211
+ return { code: "parse_error", phrase: "status is not SUCCESS" };
212
+ }
213
+ if (/\bno usage groups\b/i.test(text)) {
214
+ return { code: "parse_error", phrase: "no usage groups" };
215
+ }
216
+ if (/\bno weekly bucket\b/i.test(text)) {
217
+ return { code: "parse_error", phrase: "no weekly bucket" };
218
+ }
174
219
  // Order 9: timeout — Remaining explicit timeout or timed out errors
175
220
  if (/\btimed out\b/i.test(text) || /\btimeout\b/i.test(text)) {
176
221
  return { code: "timeout", phrase: "timed out" };
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // generated by scripts/build-embed.mjs — do not edit
2
- export const VERSION = "0.0.29";
2
+ export const VERSION = "0.0.30";
@@ -22,6 +22,12 @@ export function repairFor(provider) {
22
22
  case "invalid":
23
23
  return { text: `Check the ${name} CLI output, then re-poll.` };
24
24
  case "provider-failed": {
25
+ const attempt = provider.lastAttempt;
26
+ if (attempt?.summary) {
27
+ const detail = attempt.errorDetail ? `: ${attempt.errorDetail}` : "";
28
+ const action = attempt.action ?? `Check the ${name} CLI, then re-poll.`;
29
+ return { text: `${attempt.summary}${detail}. ${action}` };
30
+ }
25
31
  const failure = failureWords(provider.lastAttempt?.failureCategory ?? null);
26
32
  return { text: `${failure ?? "Provider failed"} — check the ${name} CLI, then re-poll.` };
27
33
  }
@@ -47,6 +47,11 @@ export interface AttemptView {
47
47
  succeededAt: string | null;
48
48
  success: boolean;
49
49
  failureCategory: FailureCategory;
50
+ diagnosticCode?: string | null;
51
+ summary?: string | null;
52
+ action?: string | null;
53
+ errorDetail?: string | null;
54
+ error?: string | null;
50
55
  }
51
56
  export interface ProviderView {
52
57
  id: string;