quotacap 0.0.40 → 0.0.41

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.
@@ -1,12 +1,20 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ageDuration } from "../state.js";
3
3
  import { failureWords } from "./ProviderDrawer.js";
4
+ /** Dashboard wording for a server auth action. The button on this page is Retry. */
5
+ export function authInstruction(name, attempt) {
6
+ const summary = attempt?.summary?.trim() || `${name} login required`;
7
+ const action = attempt?.action?.trim().replace(/select Refresh in the QuotaCap dashboard/, "select Retry");
8
+ if (action)
9
+ return `${summary}. ${action}`;
10
+ return `${summary}. Open ${name} and follow its sign-in instructions. Then select Retry.`;
11
+ }
4
12
  /**
5
- * Repair routing per excluded provider. Auth failures point at signing into
6
- * the provider CLI (by default QuotaCap never reads credentials; the only
7
- * exception is OpenCode Go, which the user enables explicitly); every other
8
- * exclusion points at a re-poll. Service start/install is covered by the
9
- * service-unavailable panel when the daemon itself is down.
13
+ * Repair routing per excluded provider. Auth failures use the server's
14
+ * summary and action, with Retry in place of the dashboard Refresh control.
15
+ * OpenCode Go names its own login command. Every other exclusion points at
16
+ * a re-poll. Service start/install is covered by the service-unavailable
17
+ * panel when the daemon itself is down.
10
18
  */
11
19
  export function repairFor(provider) {
12
20
  const name = provider.displayName;
@@ -16,9 +24,7 @@ export function repairFor(provider) {
16
24
  text: "Run `opencode auth login -p opencode-go`, then re-poll. QuotaCap reads that key only because you enabled OpenCode Go — `quotacap providers disable opencode-go` stops it.",
17
25
  };
18
26
  }
19
- return {
20
- text: `Sign in to the ${name} CLI, then re-poll. By default QuotaCap never reads credentials; the only exception is OpenCode Go, which you enable explicitly.`,
21
- };
27
+ return { text: authInstruction(name, provider.lastAttempt) };
22
28
  }
23
29
  switch (provider.exclusionReason) {
24
30
  case "stale":
@@ -74,6 +80,10 @@ export function FaultBanner({ providers, onRepoll, repolling, polling, }) {
74
80
  return (_jsx("div", { children: faulted.map((p) => {
75
81
  const age = ageDuration(p.ageMs);
76
82
  const repair = repairFor(p);
77
- return (_jsxs("div", { "data-testid": "fault-banner", role: "alert", className: "alert", children: [_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.3", strokeLinecap: "round", "aria-hidden": "true", children: [_jsx("path", { d: "M12 8v5" }), _jsx("path", { d: "M12 16.5v.01" }), _jsx("circle", { cx: "12", cy: "12", r: "9" })] }), _jsxs("span", { children: [_jsxs("strong", { children: [p.displayName, " ", bannerVerb(p), "."] }), " ", age ? `Last read ${age} ago; ` : "", "excluded from ranking. ", repair.text] }), _jsx("button", { type: "button", className: "linkbtn", onClick: onRepoll, disabled: repolling, style: { flex: "none", marginLeft: "auto" }, children: repolling ? "Polling…" : `Check ${p.displayName}` })] }, p.id));
83
+ return (_jsxs("div", { "data-testid": "fault-banner", role: "alert", className: "alert", children: [_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.3", strokeLinecap: "round", "aria-hidden": "true", children: [_jsx("path", { d: "M12 8v5" }), _jsx("path", { d: "M12 16.5v.01" }), _jsx("circle", { cx: "12", cy: "12", r: "9" })] }), _jsxs("span", { children: [_jsxs("strong", { children: [p.displayName, " ", bannerVerb(p), "."] }), " ", age ? `Last read ${age} ago; ` : "", "excluded from ranking. ", repair.text] }), _jsx("button", { type: "button", className: "linkbtn", onClick: onRepoll, disabled: repolling, style: { flex: "none", marginLeft: "auto" }, children: repolling
84
+ ? "Polling…"
85
+ : (p.lastAttempt?.failureCategory === "auth"
86
+ ? `Retry ${p.displayName}`
87
+ : `Check ${p.displayName}`) })] }, p.id));
78
88
  }) }));
79
89
  }
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { ageDuration } from "../state.js";
4
4
  import { failureWords } from "../components/ProviderDrawer.js";
5
+ import { authInstruction } from "../components/FaultBanner.js";
5
6
  /**
6
7
  * Provider readiness from server state only. The browser cannot probe local
7
8
  * paths, so this reports what the daemon reported — never a local scan.
@@ -27,7 +28,7 @@ export function readiness(provider) {
27
28
  if (provider.lastAttempt?.failureCategory === "auth") {
28
29
  return {
29
30
  status: "Sign in first",
30
- detail: `Sign in to the ${cli} CLI, then re-poll. ${credentialNote}`,
31
+ detail: authInstruction(cli, provider.lastAttempt),
31
32
  };
32
33
  }
33
34
  if (!provider.lastAttempt) {