dsh-plugin-subscription-oauth 0.8.16 → 0.8.18
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/lib/client/FastModeButton.d.ts +4 -3
- package/lib/client/FastModeButton.js +13 -11
- package/lib/client.js +12 -11
- package/lib/client.js.map +1 -1
- package/lib/protocol.d.ts +8 -0
- package/lib/providers/grok.js +44 -29
- package/lib/providers/kimi-provider.js +1 -1
- package/lib/providers/kimi.js +46 -32
- package/package.json +1 -1
|
@@ -30,14 +30,15 @@ export interface FastModeButtonInjected {
|
|
|
30
30
|
/**
|
|
31
31
|
* The session's model directory, when the host exposes one.
|
|
32
32
|
*
|
|
33
|
-
* Written when the button switches
|
|
34
|
-
*
|
|
33
|
+
* Written when the button switches the model's `fast` rung. Absent on a host without
|
|
34
|
+
* it, in which case the button renders nothing.
|
|
35
35
|
*/
|
|
36
36
|
modelDirectory?: {
|
|
37
|
-
/** Select one model; resolves when the picker
|
|
37
|
+
/** Select one model and its reasoning rung; resolves when the picker accepted it. */
|
|
38
38
|
select?: (selection: {
|
|
39
39
|
provider: string;
|
|
40
40
|
model: string;
|
|
41
|
+
reasoningEffort?: string;
|
|
41
42
|
}) => Promise<unknown>;
|
|
42
43
|
} | undefined;
|
|
43
44
|
}
|
|
@@ -47,9 +47,9 @@ export function FastModeButton({ call, isOwnProvider, modelDirectory, useProject
|
|
|
47
47
|
.then((result) => {
|
|
48
48
|
if (!live)
|
|
49
49
|
return;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
// The rung is the provider's own word (xAI `lightspeed`, Kimi `highspeed`), so
|
|
51
|
+
// the picker reads a name the model's own docs use, not a generic "Fast".
|
|
52
|
+
setPair(result?.fast === undefined ? undefined : { rung: result.fastRung ?? 'fast' });
|
|
53
53
|
})
|
|
54
54
|
.catch(() => { if (live)
|
|
55
55
|
setPair(undefined); });
|
|
@@ -57,16 +57,15 @@ export function FastModeButton({ call, isOwnProvider, modelDirectory, useProject
|
|
|
57
57
|
}, [provider, model, isOwnProvider, call]);
|
|
58
58
|
// A switch that landed clears the reason, so the marker follows the truth on screen.
|
|
59
59
|
useEffect(() => { setFailure(undefined); }, [model]);
|
|
60
|
-
if (pair === undefined || provider === undefined || modelDirectory?.select === undefined)
|
|
61
|
-
return null;
|
|
62
|
-
const active = pair.wireId === model;
|
|
63
|
-
const target = active ? pair.baseId : pair.wireId;
|
|
64
|
-
// Active without a base to return to would be a control that cannot switch anything off.
|
|
65
|
-
if (target === undefined || target === model)
|
|
60
|
+
if (pair === undefined || provider === undefined || model === undefined || modelDirectory?.select === undefined)
|
|
66
61
|
return null;
|
|
62
|
+
// Fast mode is the row's fast reasoning rung, so the model id never changes and the
|
|
63
|
+
// picker always shows the row the user can switch back to.
|
|
64
|
+
const active = (selection?.next ?? selection?.lastUsed)?.reasoningEffort === pair.rung;
|
|
65
|
+
const target = model;
|
|
67
66
|
const base = active
|
|
68
67
|
? 'Fast mode is on; press to go back to the standard model'
|
|
69
|
-
: 'Fast mode: switch to
|
|
68
|
+
: 'Fast mode: switch to this model’s fast variant';
|
|
70
69
|
const title = failure === undefined
|
|
71
70
|
? base
|
|
72
71
|
: `${base}\nThe switch was refused — ${`${failure.code ?? ''} ${failure.message}`.trim()}`;
|
|
@@ -74,7 +73,10 @@ export function FastModeButton({ call, isOwnProvider, modelDirectory, useProject
|
|
|
74
73
|
event.stopPropagation();
|
|
75
74
|
setPending(true);
|
|
76
75
|
setFailure(undefined);
|
|
77
|
-
|
|
76
|
+
// Turning it off drops the rung, which the host then reads as the model's own
|
|
77
|
+
// default. The model id is never swapped, so this cannot strand the selection.
|
|
78
|
+
const next = active ? { provider, model: target } : { provider, model: target, reasoningEffort: pair.rung };
|
|
79
|
+
void Promise.resolve(modelDirectory.select?.(next))
|
|
78
80
|
.then((result) => {
|
|
79
81
|
// The directory reports its own outcome: a refused selection carries why.
|
|
80
82
|
const outcome = result;
|
package/lib/client.js
CHANGED
|
@@ -2796,10 +2796,7 @@ function FastModeButton({ call, isOwnProvider, modelDirectory, useProjection })
|
|
|
2796
2796
|
id: model
|
|
2797
2797
|
}).then((result) => {
|
|
2798
2798
|
if (!live) return;
|
|
2799
|
-
setPair(result?.fast === void 0 ? void 0 : {
|
|
2800
|
-
wireId: result.fast,
|
|
2801
|
-
...result.fastBase === void 0 ? {} : { baseId: result.fastBase }
|
|
2802
|
-
});
|
|
2799
|
+
setPair(result?.fast === void 0 ? void 0 : { rung: result.fastRung ?? "fast" });
|
|
2803
2800
|
}).catch(() => {
|
|
2804
2801
|
if (live) setPair(void 0);
|
|
2805
2802
|
});
|
|
@@ -2815,11 +2812,10 @@ function FastModeButton({ call, isOwnProvider, modelDirectory, useProjection })
|
|
|
2815
2812
|
(0, react.useEffect)(() => {
|
|
2816
2813
|
setFailure(void 0);
|
|
2817
2814
|
}, [model]);
|
|
2818
|
-
if (pair === void 0 || provider === void 0 || modelDirectory?.select === void 0) return null;
|
|
2819
|
-
const active =
|
|
2820
|
-
const target =
|
|
2821
|
-
|
|
2822
|
-
const base = active ? "Fast mode is on; press to go back to the standard model" : "Fast mode: switch to the fast variant of this model";
|
|
2815
|
+
if (pair === void 0 || provider === void 0 || model === void 0 || modelDirectory?.select === void 0) return null;
|
|
2816
|
+
const active = (selection?.next ?? selection?.lastUsed)?.reasoningEffort === pair.rung;
|
|
2817
|
+
const target = model;
|
|
2818
|
+
const base = active ? "Fast mode is on; press to go back to the standard model" : "Fast mode: switch to this model’s fast variant";
|
|
2823
2819
|
const title = failure === void 0 ? base : `${base}\nThe switch was refused — ${`${failure.code ?? ""} ${failure.message}`.trim()}`;
|
|
2824
2820
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: fastModeCss }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
2825
2821
|
type: "button",
|
|
@@ -2835,10 +2831,15 @@ function FastModeButton({ call, isOwnProvider, modelDirectory, useProjection })
|
|
|
2835
2831
|
event.stopPropagation();
|
|
2836
2832
|
setPending(true);
|
|
2837
2833
|
setFailure(void 0);
|
|
2838
|
-
|
|
2834
|
+
const next = active ? {
|
|
2839
2835
|
provider,
|
|
2840
2836
|
model: target
|
|
2841
|
-
}
|
|
2837
|
+
} : {
|
|
2838
|
+
provider,
|
|
2839
|
+
model: target,
|
|
2840
|
+
reasoningEffort: pair.rung
|
|
2841
|
+
};
|
|
2842
|
+
Promise.resolve(modelDirectory.select?.(next)).then((result) => {
|
|
2842
2843
|
const outcome = result;
|
|
2843
2844
|
if (outcome?.ok !== false) return;
|
|
2844
2845
|
const code = outcome.error?.code;
|