@arandevcode/opencode-quota-extended 0.2.4 → 0.3.0
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 +24 -0
- package/README-es.md +4 -0
- package/README.md +4 -0
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +17 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +12 -0
- package/dist/server.js.map +1 -1
- package/dist/tui.d.ts +3 -0
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.tsx +14 -1
- package/dist/v2.d.ts +61 -0
- package/dist/v2.d.ts.map +1 -0
- package/dist/v2.js +67 -0
- package/dist/v2.js.map +1 -0
- package/package.json +10 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.3.0 — 2026-11-06
|
|
4
|
+
- OpenCode 2 support (early preview): the package now registers on both OpenCode 1.x and 2.x; tested on 2.1.2.
|
|
5
|
+
|
|
6
|
+
## 0.2.4 — 2026-10-21
|
|
7
|
+
- OpenCode Go quota, spend and balance read with a personal API key.
|
|
8
|
+
- More compact sidebar layout.
|
|
9
|
+
|
|
10
|
+
## 0.2.3 — 2026-10-19
|
|
11
|
+
- Credit balance and usage pace in the sidebar.
|
|
12
|
+
- Coalesced TUI refreshes to stop provider error storms.
|
|
13
|
+
|
|
14
|
+
## 0.2.2 — 2026-08-06
|
|
15
|
+
- Allow OpenTUI 0.5 peer dependencies.
|
|
16
|
+
|
|
17
|
+
## 0.2.1 — 2026-08-05
|
|
18
|
+
- Packaging cleanup: removed stray files from the published package.
|
|
19
|
+
|
|
20
|
+
## 0.2.0 — 2026-08-05
|
|
21
|
+
- Theme-aware colors, single-row gauge, error boundary and guarded event handlers.
|
|
22
|
+
|
|
23
|
+
## 0.1.x — 2026-06 / 2026-07
|
|
24
|
+
- First releases: per-window quota cards for OpenAI, GitHub Copilot and OpenCode Go, plus the `quota` CLI.
|
package/README-es.md
CHANGED
|
@@ -44,6 +44,10 @@ O instala desde GitHub para seguir el desarrollo más reciente:
|
|
|
44
44
|
}
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
+
### OpenCode 2 (versión preliminar)
|
|
48
|
+
|
|
49
|
+
El mismo paquete funciona en OpenCode 1.x y en OpenCode 2: trae una entrada para cada uno y carga la que toca. El soporte V2 es nuevo (probado en OpenCode 2.1.2); si ves algo raro, abre un issue.
|
|
50
|
+
|
|
47
51
|
## Desinstalación
|
|
48
52
|
|
|
49
53
|
Cuatro pasos, en orden:
|
package/README.md
CHANGED
|
@@ -45,6 +45,10 @@ Or install from GitHub source to follow latest development:
|
|
|
45
45
|
}
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
### OpenCode 2 (early preview)
|
|
49
|
+
|
|
50
|
+
The same package works on OpenCode 1.x and OpenCode 2: it ships one entry for each and loads the right one. V2 support is new (tested on OpenCode 2.1.2), so please report anything odd.
|
|
51
|
+
|
|
48
52
|
## Uninstall
|
|
49
53
|
|
|
50
54
|
Four steps, in order:
|
package/dist/index.d.ts
CHANGED
|
@@ -6,9 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
*/
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export default pluginModule;
|
|
13
|
-
export { quotaCardsServerPlugin };
|
|
9
|
+
import plugin from "./server.js";
|
|
10
|
+
export { quotaCardsServerPlugin } from "./server.js";
|
|
11
|
+
export default plugin;
|
|
14
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,eAAe,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode Quota Cards Plugin (server entry)
|
|
3
|
+
*
|
|
4
|
+
* Renders quota usage as progress-bar cards in the TUI sidebar for
|
|
5
|
+
* OpenAI, GitHub Copilot and OpenCode Go (5h / weekly / monthly).
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import plugin from "./server.js";
|
|
10
|
+
export { quotaCardsServerPlugin } from "./server.js";
|
|
11
|
+
export default plugin;
|
|
8
12
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,eAAe,MAAM,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OpenCode Quota Cards — server plugin (minimal).
|
|
2
|
+
* OpenCode Quota Cards — server plugin (minimal, dual V1/V2).
|
|
3
3
|
*
|
|
4
4
|
* This plugin is primarily a TUI sidebar plugin. The server module
|
|
5
5
|
* is kept registered for compatibility but provides no additional
|
|
6
6
|
* tools or commands.
|
|
7
|
+
*
|
|
8
|
+
* Both `index.ts` (root) and this `./server` entry export the same object.
|
|
9
|
+
* V1's `oc-plugin: ["server"]` loads it and calls `server`; V2 resolves the
|
|
10
|
+
* `./server` subpath first for dual packages and reads `id` + `setup`. Keeping
|
|
11
|
+
* both entries V2-shaped avoids the "Plugin must export a default definition"
|
|
12
|
+
* error when V2 discovers a directory that contains both files.
|
|
7
13
|
*/
|
|
8
14
|
import type { Plugin } from "@opencode-ai/plugin";
|
|
9
15
|
export declare const quotaCardsServerPlugin: Plugin;
|
|
16
|
+
type V2SetupContext = {
|
|
17
|
+
storage?: unknown;
|
|
18
|
+
location?: unknown;
|
|
19
|
+
};
|
|
20
|
+
declare const plugin: {
|
|
21
|
+
id: string;
|
|
22
|
+
server: Plugin;
|
|
23
|
+
setup(ctx?: V2SetupContext): Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
export default plugin;
|
|
10
26
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,MAAM,EAAS,MAAM,qBAAqB,CAAC;AAEzD,eAAO,MAAM,sBAAsB,EAAE,MAEpC,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,QAAA,MAAM,MAAM;;YAEwB,MAAM;gBACtB,cAAc;CAMjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
export const quotaCardsServerPlugin = async () => {
|
|
2
2
|
return {};
|
|
3
3
|
};
|
|
4
|
+
const plugin = {
|
|
5
|
+
id: "@local/opencode-quota-extended",
|
|
6
|
+
server: quotaCardsServerPlugin,
|
|
7
|
+
async setup(ctx) {
|
|
8
|
+
// OpenCode 1.19.x calls setup() too, but without the V2 context.
|
|
9
|
+
if (!ctx?.storage || !ctx?.location)
|
|
10
|
+
return;
|
|
11
|
+
// V2 has no server-side quota work. The TUI cards are still V1-only;
|
|
12
|
+
// this entry point exists so V2 can load the package without error.
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
export default plugin;
|
|
4
16
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,sBAAsB,GAAW,KAAK,IAAoB,EAAE;IACvE,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAOF,MAAM,MAAM,GAAG;IACb,EAAE,EAAE,gCAAgC;IACpC,MAAM,EAAE,sBAAgC;IACxC,KAAK,CAAC,KAAK,CAAC,GAAoB;QAC9B,iEAAiE;QACjE,IAAI,CAAC,GAAG,EAAE,OAAO,IAAI,CAAC,GAAG,EAAE,QAAQ;YAAE,OAAO;QAC5C,qEAAqE;QACrE,oEAAoE;IACtE,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/tui.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { TuiPlugin, TuiPluginModule } from "@opencode-ai/plugin/tui";
|
|
2
|
+
import { type V2Context } from "./v2.js";
|
|
2
3
|
export declare const quotaCardsTuiPlugin: TuiPlugin;
|
|
4
|
+
export declare function quotaCardsTuiV2(context: V2Context): Promise<() => void>;
|
|
3
5
|
declare const pluginModule: TuiPluginModule & {
|
|
4
6
|
id: string;
|
|
7
|
+
setup?: (context: V2Context) => Promise<() => void>;
|
|
5
8
|
};
|
|
6
9
|
export default pluginModule;
|
|
7
10
|
//# sourceMappingURL=tui.d.ts.map
|
package/dist/tui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../src/tui.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../src/tui.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAK1E,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAO3D,eAAO,MAAM,mBAAmB,EAAE,SAkFjC,CAAC;AAEF,wBAAsB,eAAe,CAAC,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAS7E;AAED,QAAA,MAAM,YAAY,EAAE,eAAe,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,KAAK,OAAO,CAAC,MAAM,IAAI,CAAC,CAAA;CAItG,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/dist/tui.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import { loadCardsConfig } from "./config/loader.js";
|
|
|
5
5
|
import { createRefreshScheduler } from "./lib/refresh-scheduler.js";
|
|
6
6
|
import { collectSnapshot } from "./providers/registry.js";
|
|
7
7
|
import { SidebarPanel } from "./ui/SidebarPanel.js";
|
|
8
|
+
import { createQuotaV2Api, type V2Context } from "./v2.js";
|
|
8
9
|
|
|
9
10
|
const REFRESH_INTERVAL_MS = 60_000;
|
|
10
11
|
const MOUNT_RECOVERY_DELAY_MS = 1_500;
|
|
@@ -95,9 +96,21 @@ export const quotaCardsTuiPlugin: TuiPlugin = async (api, _options, _meta) => {
|
|
|
95
96
|
}
|
|
96
97
|
};
|
|
97
98
|
|
|
98
|
-
|
|
99
|
+
export async function quotaCardsTuiV2(context: V2Context): Promise<() => void> {
|
|
100
|
+
const cleanups: Array<() => void> = [];
|
|
101
|
+
const api = createQuotaV2Api(context, cleanups);
|
|
102
|
+
await quotaCardsTuiPlugin(api, context.options ?? {}, {} as any);
|
|
103
|
+
return () => {
|
|
104
|
+
for (const cleanup of cleanups.reverse()) {
|
|
105
|
+
try { cleanup(); } catch {}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const pluginModule: TuiPluginModule & { id: string; setup?: (context: V2Context) => Promise<() => void> } = {
|
|
99
111
|
id: "@local/opencode-quota-extended",
|
|
100
112
|
tui: quotaCardsTuiPlugin,
|
|
113
|
+
setup: quotaCardsTuiV2,
|
|
101
114
|
};
|
|
102
115
|
|
|
103
116
|
export default pluginModule;
|
package/dist/v2.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type V2Theme = {
|
|
2
|
+
text?: {
|
|
3
|
+
base?: string;
|
|
4
|
+
muted?: string;
|
|
5
|
+
} | string;
|
|
6
|
+
accent?: {
|
|
7
|
+
base?: string;
|
|
8
|
+
} | string;
|
|
9
|
+
background?: {
|
|
10
|
+
panel?: string;
|
|
11
|
+
element?: string;
|
|
12
|
+
};
|
|
13
|
+
status?: {
|
|
14
|
+
success?: string;
|
|
15
|
+
warning?: string;
|
|
16
|
+
danger?: string;
|
|
17
|
+
error?: string;
|
|
18
|
+
};
|
|
19
|
+
primary?: string;
|
|
20
|
+
success?: string;
|
|
21
|
+
warning?: string;
|
|
22
|
+
error?: string;
|
|
23
|
+
textMuted?: string;
|
|
24
|
+
backgroundPanel?: string;
|
|
25
|
+
backgroundElement?: string;
|
|
26
|
+
};
|
|
27
|
+
export type V2Context = {
|
|
28
|
+
theme?: V2Theme;
|
|
29
|
+
options?: Record<string, unknown>;
|
|
30
|
+
data?: {
|
|
31
|
+
on?: (type: string, handler: (event: unknown) => void) => () => void;
|
|
32
|
+
listen?: (handler: (event: unknown) => void) => () => void;
|
|
33
|
+
};
|
|
34
|
+
ui?: {
|
|
35
|
+
slot?: (input: {
|
|
36
|
+
append?: string;
|
|
37
|
+
render: (props: {
|
|
38
|
+
sessionID?: string;
|
|
39
|
+
}) => unknown;
|
|
40
|
+
}) => () => void;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export declare function asColor(value: unknown, fallback: string): string;
|
|
44
|
+
export declare function v2Theme(theme?: V2Theme): {
|
|
45
|
+
text: string;
|
|
46
|
+
textMuted: string;
|
|
47
|
+
primary: string;
|
|
48
|
+
accent: string;
|
|
49
|
+
success: string;
|
|
50
|
+
warning: string;
|
|
51
|
+
error: string;
|
|
52
|
+
backgroundPanel: string;
|
|
53
|
+
backgroundElement: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Adapt a V2 CLI plugin context to the V1 TUI API the cards already use.
|
|
57
|
+
* The components only read `theme.current`; events and slots are bridged so
|
|
58
|
+
* the existing refresh scheduler and sidebar markup stay unchanged.
|
|
59
|
+
*/
|
|
60
|
+
export declare function createQuotaV2Api(context: V2Context, cleanups: Array<() => void>): any;
|
|
61
|
+
//# sourceMappingURL=v2.d.ts.map
|
package/dist/v2.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../src/v2.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC;IAClD,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC;IACpC,UAAU,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM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CAMhE;AAED,wBAAgB,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO;;;;;;;;;;EAatC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC,GAuCjC,GAAG,CACjD"}
|
package/dist/v2.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export function asColor(value, fallback) {
|
|
2
|
+
if (typeof value === "string")
|
|
3
|
+
return value;
|
|
4
|
+
if (value && typeof value === "object" && typeof value.base === "string") {
|
|
5
|
+
return value.base;
|
|
6
|
+
}
|
|
7
|
+
return fallback;
|
|
8
|
+
}
|
|
9
|
+
export function v2Theme(theme) {
|
|
10
|
+
const text = theme?.text;
|
|
11
|
+
return {
|
|
12
|
+
text: typeof text === "string" ? text : asColor(text?.base, "#ffffff"),
|
|
13
|
+
textMuted: typeof text === "object" ? asColor(text?.muted, "#888888") : asColor(theme?.textMuted, "#888888"),
|
|
14
|
+
primary: asColor(theme?.primary, "#4aa3ff"),
|
|
15
|
+
accent: asColor(theme?.accent, "#4aa3ff"),
|
|
16
|
+
success: asColor(theme?.status?.success ?? theme?.success, "#4cc46a"),
|
|
17
|
+
warning: asColor(theme?.status?.warning ?? theme?.warning, "#e6b450"),
|
|
18
|
+
error: asColor(theme?.status?.danger ?? theme?.status?.error ?? theme?.error, "#e5534b"),
|
|
19
|
+
backgroundPanel: asColor(theme?.background?.panel ?? theme?.backgroundPanel, "#111111"),
|
|
20
|
+
backgroundElement: asColor(theme?.background?.element ?? theme?.backgroundElement, "#222222"),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Adapt a V2 CLI plugin context to the V1 TUI API the cards already use.
|
|
25
|
+
* The components only read `theme.current`; events and slots are bridged so
|
|
26
|
+
* the existing refresh scheduler and sidebar markup stay unchanged.
|
|
27
|
+
*/
|
|
28
|
+
export function createQuotaV2Api(context, cleanups) {
|
|
29
|
+
const currentTheme = v2Theme(context.theme);
|
|
30
|
+
const theme = { current: currentTheme };
|
|
31
|
+
Object.defineProperty(theme, "current", { get: () => v2Theme(context.theme) });
|
|
32
|
+
const event = {
|
|
33
|
+
on(_type, handler) {
|
|
34
|
+
const unsubscribe = context.data?.on?.("session.execution.started", handler)
|
|
35
|
+
?? context.data?.on?.("session.updated", handler)
|
|
36
|
+
?? (() => { });
|
|
37
|
+
if (context.data?.listen) {
|
|
38
|
+
const stop = context.data.listen(handler);
|
|
39
|
+
cleanups.push(stop);
|
|
40
|
+
}
|
|
41
|
+
cleanups.push(unsubscribe);
|
|
42
|
+
return () => {
|
|
43
|
+
unsubscribe();
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
const lifecycle = {
|
|
48
|
+
onDispose(fn) {
|
|
49
|
+
cleanups.push(fn);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
const slots = {
|
|
53
|
+
register(input) {
|
|
54
|
+
const render = input.slots.sidebar_content;
|
|
55
|
+
if (!render || !context.ui?.slot)
|
|
56
|
+
return;
|
|
57
|
+
const dispose = context.ui.slot({
|
|
58
|
+
append: "sidebar.content",
|
|
59
|
+
render: (props) => render({}, { session_id: props.sessionID ?? "" }),
|
|
60
|
+
});
|
|
61
|
+
if (typeof dispose === "function")
|
|
62
|
+
cleanups.push(dispose);
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
return { theme, event, lifecycle, slots };
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=v2.js.map
|
package/dist/v2.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"v2.js","sourceRoot":"","sources":["../src/v2.ts"],"names":[],"mappings":"AA0BA,MAAM,UAAU,OAAO,CAAC,KAAc,EAAE,QAAgB;IACtD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,KAAK,IAAI,OAAO,KAAK,K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AC3C,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI;gBAAE,OAAO;YACzC,MAAM,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC;gBAC9B,MAAM,EAAE,iBAAiB;gBACzB,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;aACrE,CAAC,CAAC;YACH,IAAI,OAAO,OAAO,KAAK,UAAU;gBAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5D,CAAC;KACF,CAAC;IAEF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAS,CAAC;AACnD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arandevcode/opencode-quota-extended",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "OpenCode plugin: quota usage cards with theme-colored gauge progress bars (5h / weekly / monthly) for OpenAI, GitHub Copilot and OpenCode Go in the TUI sidebar.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
"scripts/setup.mjs",
|
|
36
36
|
"README.md",
|
|
37
37
|
"README-es.md",
|
|
38
|
-
"LICENSE"
|
|
38
|
+
"LICENSE",
|
|
39
|
+
"CHANGELOG.md"
|
|
39
40
|
],
|
|
40
41
|
"scripts": {
|
|
41
42
|
"clean": "node scripts/clean.mjs",
|
|
@@ -74,5 +75,11 @@
|
|
|
74
75
|
"access": "public"
|
|
75
76
|
},
|
|
76
77
|
"author": "arandevcode",
|
|
77
|
-
"license": "MIT"
|
|
78
|
+
"license": "MIT",
|
|
79
|
+
"repository": {
|
|
80
|
+
"type": "git",
|
|
81
|
+
"url": "git+https://github.com/arandevcode/opencode-plugins.git",
|
|
82
|
+
"directory": "opencode-quota-extended"
|
|
83
|
+
},
|
|
84
|
+
"homepage": "https://github.com/arandevcode/opencode-plugins/tree/main/opencode-quota-extended#readme"
|
|
78
85
|
}
|