@slkiser/opencode-quota 3.8.7 → 3.8.8
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/README.md +84 -16
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/alibaba-auth.d.ts.map +1 -1
- package/dist/lib/alibaba-auth.js +43 -23
- package/dist/lib/alibaba-auth.js.map +1 -1
- package/dist/lib/chutes-config.d.ts +1 -0
- package/dist/lib/chutes-config.d.ts.map +1 -1
- package/dist/lib/chutes-config.js +5 -2
- package/dist/lib/chutes-config.js.map +1 -1
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +32 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/crof-config.d.ts +2 -1
- package/dist/lib/crof-config.d.ts.map +1 -1
- package/dist/lib/crof-config.js +9 -1
- package/dist/lib/crof-config.js.map +1 -1
- package/dist/lib/deepseek-auth.d.ts +15 -0
- package/dist/lib/deepseek-auth.d.ts.map +1 -0
- package/dist/lib/deepseek-auth.js +32 -0
- package/dist/lib/deepseek-auth.js.map +1 -0
- package/dist/lib/deepseek.d.ts +40 -0
- package/dist/lib/deepseek.d.ts.map +1 -0
- package/dist/lib/deepseek.js +109 -0
- package/dist/lib/deepseek.js.map +1 -0
- package/dist/lib/init-installer.d.ts +1 -0
- package/dist/lib/init-installer.d.ts.map +1 -1
- package/dist/lib/init-installer.js +39 -0
- package/dist/lib/init-installer.js.map +1 -1
- package/dist/lib/maintainer-announcements.d.ts +43 -0
- package/dist/lib/maintainer-announcements.d.ts.map +1 -0
- package/dist/lib/maintainer-announcements.js +131 -0
- package/dist/lib/maintainer-announcements.js.map +1 -0
- package/dist/lib/minimax-auth.d.ts.map +1 -1
- package/dist/lib/minimax-auth.js +2 -4
- package/dist/lib/minimax-auth.js.map +1 -1
- package/dist/lib/provider-metadata.d.ts +1 -1
- package/dist/lib/provider-metadata.d.ts.map +1 -1
- package/dist/lib/provider-metadata.js +18 -7
- package/dist/lib/provider-metadata.js.map +1 -1
- package/dist/lib/quota-render-data.d.ts +7 -0
- package/dist/lib/quota-render-data.d.ts.map +1 -1
- package/dist/lib/quota-render-data.js +17 -0
- package/dist/lib/quota-render-data.js.map +1 -1
- package/dist/lib/quota-status.d.ts +6 -1
- package/dist/lib/quota-status.d.ts.map +1 -1
- package/dist/lib/quota-status.js +34 -4
- package/dist/lib/quota-status.js.map +1 -1
- package/dist/lib/synthetic-config.d.ts +1 -0
- package/dist/lib/synthetic-config.d.ts.map +1 -1
- package/dist/lib/synthetic-config.js +5 -2
- package/dist/lib/synthetic-config.js.map +1 -1
- package/dist/lib/tui-panel-state.d.ts +18 -0
- package/dist/lib/tui-panel-state.d.ts.map +1 -1
- package/dist/lib/tui-panel-state.js +11 -0
- package/dist/lib/tui-panel-state.js.map +1 -1
- package/dist/lib/tui-runtime.d.ts +12 -1
- package/dist/lib/tui-runtime.d.ts.map +1 -1
- package/dist/lib/tui-runtime.js +91 -14
- package/dist/lib/tui-runtime.js.map +1 -1
- package/dist/lib/types.d.ts +11 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js +4 -0
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/zhipu-auth.d.ts.map +1 -1
- package/dist/lib/zhipu-auth.js +7 -2
- package/dist/lib/zhipu-auth.js.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +130 -12
- package/dist/plugin.js.map +1 -1
- package/dist/providers/deepseek.d.ts +9 -0
- package/dist/providers/deepseek.d.ts.map +1 -0
- package/dist/providers/deepseek.js +61 -0
- package/dist/providers/deepseek.js.map +1 -0
- package/dist/providers/registry.d.ts.map +1 -1
- package/dist/providers/registry.js +2 -0
- package/dist/providers/registry.js.map +1 -1
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.tsx +76 -34
- package/package.json +2 -2
package/dist/tui.tsx
CHANGED
|
@@ -8,17 +8,20 @@ import type {
|
|
|
8
8
|
} from "@opencode-ai/plugin/tui";
|
|
9
9
|
import { Show, createEffect, createSignal, onCleanup } from "solid-js";
|
|
10
10
|
|
|
11
|
-
import type { CompactStatusState, SidebarPanelState } from "./lib/tui-panel-state.js";
|
|
11
|
+
import type { CompactStatusState, HomeBottomState, SidebarPanelState } from "./lib/tui-panel-state.js";
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
14
|
getCompactStatusText,
|
|
15
|
+
getHomeBottomAnnouncementText,
|
|
15
16
|
getSidebarPanelLines,
|
|
17
|
+
getSidebarPanelLinesExpanded,
|
|
16
18
|
shouldRenderCompactStatus,
|
|
19
|
+
shouldRenderHomeBottom,
|
|
17
20
|
shouldRenderSidebarPanel,
|
|
18
21
|
} from "./lib/tui-panel-state.js";
|
|
19
22
|
import { getSidebarBodyLineColor } from "./lib/tui-line-style.js";
|
|
20
23
|
import {
|
|
21
|
-
|
|
24
|
+
loadTuiHomeBottomStatus,
|
|
22
25
|
loadTuiSessionQuotaSurfaces,
|
|
23
26
|
resolveTuiSurfaceRegistration,
|
|
24
27
|
} from "./lib/tui-runtime.js";
|
|
@@ -42,14 +45,14 @@ type SessionQuotaResource = {
|
|
|
42
45
|
release: () => void;
|
|
43
46
|
};
|
|
44
47
|
|
|
45
|
-
type
|
|
46
|
-
|
|
47
|
-
retain: () =>
|
|
48
|
+
type HomeBottomResource = {
|
|
49
|
+
bottom: () => HomeBottomState;
|
|
50
|
+
retain: () => HomeBottomResource;
|
|
48
51
|
release: () => void;
|
|
49
52
|
};
|
|
50
53
|
|
|
51
54
|
const sessionResources = new WeakMap<TuiPluginApi, Map<string, SessionQuotaResource>>();
|
|
52
|
-
const homeResources = new WeakMap<TuiPluginApi,
|
|
55
|
+
const homeResources = new WeakMap<TuiPluginApi, HomeBottomResource>();
|
|
53
56
|
|
|
54
57
|
function getSessionResourceMap(api: TuiPluginApi): Map<string, SessionQuotaResource> {
|
|
55
58
|
const existing = sessionResources.get(api);
|
|
@@ -190,8 +193,11 @@ function acquireSessionQuotaResource(api: TuiPluginApi, sessionID: string): Sess
|
|
|
190
193
|
return next;
|
|
191
194
|
}
|
|
192
195
|
|
|
193
|
-
function
|
|
194
|
-
const [
|
|
196
|
+
function createHomeBottomResource(api: TuiPluginApi): HomeBottomResource {
|
|
197
|
+
const [bottom, setBottom] = createSignal<HomeBottomState>({
|
|
198
|
+
status: "loading",
|
|
199
|
+
compact: { status: "loading" },
|
|
200
|
+
});
|
|
195
201
|
|
|
196
202
|
let refCount = 0;
|
|
197
203
|
let disposed = false;
|
|
@@ -212,10 +218,10 @@ function createHomeCompactResource(api: TuiPluginApi): HomeCompactResource {
|
|
|
212
218
|
inFlight = true;
|
|
213
219
|
const currentVersion = ++loadVersion;
|
|
214
220
|
|
|
215
|
-
void
|
|
221
|
+
void loadTuiHomeBottomStatus({ api })
|
|
216
222
|
.then((next) => {
|
|
217
223
|
if (disposed || currentVersion !== loadVersion) return;
|
|
218
|
-
|
|
224
|
+
setBottom(next);
|
|
219
225
|
})
|
|
220
226
|
.catch(() => {
|
|
221
227
|
if (disposed || currentVersion !== loadVersion) return;
|
|
@@ -263,8 +269,8 @@ function createHomeCompactResource(api: TuiPluginApi): HomeCompactResource {
|
|
|
263
269
|
homeResources.delete(api);
|
|
264
270
|
};
|
|
265
271
|
|
|
266
|
-
const resource:
|
|
267
|
-
|
|
272
|
+
const resource: HomeBottomResource = {
|
|
273
|
+
bottom,
|
|
268
274
|
retain: () => {
|
|
269
275
|
refCount += 1;
|
|
270
276
|
return resource;
|
|
@@ -280,16 +286,19 @@ function createHomeCompactResource(api: TuiPluginApi): HomeCompactResource {
|
|
|
280
286
|
return resource;
|
|
281
287
|
}
|
|
282
288
|
|
|
283
|
-
function
|
|
289
|
+
function acquireHomeBottomResource(api: TuiPluginApi): HomeBottomResource {
|
|
284
290
|
const existing = homeResources.get(api);
|
|
285
291
|
if (existing) return existing.retain();
|
|
286
292
|
|
|
287
|
-
const next =
|
|
293
|
+
const next = createHomeBottomResource(api).retain();
|
|
288
294
|
homeResources.set(api, next);
|
|
289
295
|
return next;
|
|
290
296
|
}
|
|
291
297
|
|
|
292
|
-
function useSessionQuotaResource(
|
|
298
|
+
function useSessionQuotaResource(
|
|
299
|
+
api: TuiPluginApi,
|
|
300
|
+
sessionID: () => string,
|
|
301
|
+
): () => SessionQuotaResource {
|
|
293
302
|
let current = acquireSessionQuotaResource(api, sessionID());
|
|
294
303
|
const [resource, setResource] = createSignal(current);
|
|
295
304
|
|
|
@@ -310,23 +319,46 @@ function useSessionQuotaResource(api: TuiPluginApi, sessionID: () => string): ()
|
|
|
310
319
|
return resource;
|
|
311
320
|
}
|
|
312
321
|
|
|
313
|
-
function SidebarContentView(props: {
|
|
314
|
-
api: TuiPluginApi;
|
|
315
|
-
sessionID: string;
|
|
316
|
-
}) {
|
|
322
|
+
function SidebarContentView(props: { api: TuiPluginApi; sessionID: string }) {
|
|
317
323
|
const resource = useSessionQuotaResource(props.api, () => props.sessionID);
|
|
318
324
|
const panel = () => resource().sidebar();
|
|
319
325
|
|
|
320
326
|
const lines = () => getSidebarPanelLines(panel());
|
|
327
|
+
const hasDetailLines = () => Boolean(panel().linesExpanded?.length);
|
|
328
|
+
|
|
329
|
+
const [collapsed, setCollapsed] = createSignal(
|
|
330
|
+
props.api.kv?.get("quota-sidebar-collapsed", true) ?? true,
|
|
331
|
+
);
|
|
332
|
+
|
|
333
|
+
const toggleCollapsed = () => {
|
|
334
|
+
if (!hasDetailLines()) return;
|
|
335
|
+
|
|
336
|
+
const next = !collapsed();
|
|
337
|
+
setCollapsed(next);
|
|
338
|
+
props.api.kv?.set("quota-sidebar-collapsed", next);
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
const displayLines = () => {
|
|
342
|
+
if (collapsed() || !hasDetailLines()) return lines();
|
|
343
|
+
return getSidebarPanelLinesExpanded(panel());
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
const toggleIcon = () => (collapsed() ? "▶" : "▼");
|
|
347
|
+
const providerCount = () => panel().providerCount ?? 0;
|
|
321
348
|
|
|
322
349
|
return (
|
|
323
350
|
<Show when={shouldRenderSidebarPanel(panel())}>
|
|
324
351
|
<box gap={0}>
|
|
325
|
-
<
|
|
326
|
-
<
|
|
327
|
-
|
|
352
|
+
<box flexDirection="row">
|
|
353
|
+
<text fg={props.api.theme.current.text} onMouseDown={toggleCollapsed}>
|
|
354
|
+
<b>{hasDetailLines() ? `${toggleIcon()} Quota` : "Quota"}</b>
|
|
355
|
+
</text>
|
|
356
|
+
<Show when={collapsed() && providerCount() > 0}>
|
|
357
|
+
<text fg={props.api.theme.current.textMuted}> ({providerCount()} providers)</text>
|
|
358
|
+
</Show>
|
|
359
|
+
</box>
|
|
328
360
|
<box gap={0}>
|
|
329
|
-
{
|
|
361
|
+
{displayLines().map((line) => (
|
|
330
362
|
<text fg={getSidebarBodyLineColor(line, props.api.theme.current)} wrapMode="none">
|
|
331
363
|
{line || " "}
|
|
332
364
|
</text>
|
|
@@ -394,17 +426,27 @@ function SessionPromptWithCompactStatus(props: {
|
|
|
394
426
|
);
|
|
395
427
|
}
|
|
396
428
|
|
|
397
|
-
function
|
|
398
|
-
const resource =
|
|
429
|
+
function HomeBottomView(props: { api: TuiPluginApi }) {
|
|
430
|
+
const resource = acquireHomeBottomResource(props.api);
|
|
399
431
|
onCleanup(() => resource.release());
|
|
400
432
|
|
|
433
|
+
const announcement = () => getHomeBottomAnnouncementText(resource.bottom());
|
|
434
|
+
const compact = () => resource.bottom().compact;
|
|
435
|
+
|
|
401
436
|
return (
|
|
402
|
-
<
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
437
|
+
<Show when={shouldRenderHomeBottom(resource.bottom())}>
|
|
438
|
+
<box gap={0}>
|
|
439
|
+
<text> </text>
|
|
440
|
+
<Show when={announcement()}>
|
|
441
|
+
<box flexDirection="row" justifyContent="center">
|
|
442
|
+
<text fg={props.api.theme.current.textMuted} wrapMode="none">
|
|
443
|
+
{announcement()}
|
|
444
|
+
</text>
|
|
445
|
+
</box>
|
|
446
|
+
</Show>
|
|
447
|
+
<CompactStatusLine api={props.api} panel={compact} justifyContent="center" />
|
|
448
|
+
</box>
|
|
449
|
+
</Show>
|
|
408
450
|
);
|
|
409
451
|
}
|
|
410
452
|
|
|
@@ -433,7 +475,7 @@ const tui: TuiPlugin = async (api) => {
|
|
|
433
475
|
}
|
|
434
476
|
|
|
435
477
|
const compactRegistration = surfaceRegistration.compact;
|
|
436
|
-
if (!compactRegistration.enabled) return;
|
|
478
|
+
if (!compactRegistration.enabled && !surfaceRegistration.homeBottom) return;
|
|
437
479
|
|
|
438
480
|
const compactSlots: Record<string, (ctx: any, props: any) => JSX.Element | null> = {};
|
|
439
481
|
|
|
@@ -459,8 +501,8 @@ const tui: TuiPlugin = async (api) => {
|
|
|
459
501
|
);
|
|
460
502
|
}
|
|
461
503
|
|
|
462
|
-
if (
|
|
463
|
-
compactSlots.home_bottom = () => <
|
|
504
|
+
if (surfaceRegistration.homeBottom) {
|
|
505
|
+
compactSlots.home_bottom = () => <HomeBottomView api={api} />;
|
|
464
506
|
}
|
|
465
507
|
|
|
466
508
|
if (Object.keys(compactSlots).length > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slkiser/opencode-quota",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.8",
|
|
4
4
|
"packageManager": "pnpm@11.0.0",
|
|
5
5
|
"description": "OpenCode quota & tokens usage with zero context window pollution. Supports GitHub Copilot, OpenAI (Plus/Pro), Qwen Code, Chutes AI, Synthetic, Google Antigravity, Z.ai coding plan and more.",
|
|
6
6
|
"type": "module",
|
|
@@ -90,6 +90,6 @@
|
|
|
90
90
|
"@opencode-ai/plugin": "^1.4.3"
|
|
91
91
|
},
|
|
92
92
|
"engines": {
|
|
93
|
-
"node": ">=
|
|
93
|
+
"node": ">=20.0.0"
|
|
94
94
|
}
|
|
95
95
|
}
|