opencode-visual-cache 1.6.3 → 1.6.4
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/dist/_version.d.ts +1 -1
- package/dist/_version.js +1 -1
- package/dist/balance-providers.js +27 -1
- package/dist/tui.js +23 -2
- package/package.json +1 -1
- package/src/_version.ts +1 -1
- package/src/balance-providers.ts +25 -1
package/dist/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PLUGIN_VERSION = "1.6.
|
|
1
|
+
export declare const PLUGIN_VERSION = "1.6.4";
|
package/dist/_version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// auto-generated
|
|
2
|
-
export const PLUGIN_VERSION = "1.6.
|
|
2
|
+
export const PLUGIN_VERSION = "1.6.4";
|
|
@@ -103,8 +103,34 @@ const moonshotProvider = {
|
|
|
103
103
|
return [{ currency: "CNY", total: String(balance) }];
|
|
104
104
|
},
|
|
105
105
|
};
|
|
106
|
+
const hyperProvider = {
|
|
107
|
+
id: "hyper",
|
|
108
|
+
name: "Charm Hyper",
|
|
109
|
+
keyPlaceholder: "sk-hyper-...",
|
|
110
|
+
async fetchBalance(apiKey, signal) {
|
|
111
|
+
// 官方接口:GET /v1/credits → {"balance": 98}(积分余额)
|
|
112
|
+
const res = await fetch("https://hyper.charm.land/v1/credits", {
|
|
113
|
+
headers: { Authorization: `Bearer ${apiKey}`, Accept: "application/json" },
|
|
114
|
+
signal,
|
|
115
|
+
});
|
|
116
|
+
if (!res.ok) {
|
|
117
|
+
if (res.status === 401)
|
|
118
|
+
throw new BalanceError("401");
|
|
119
|
+
if (res.status === 403)
|
|
120
|
+
throw new BalanceError("403");
|
|
121
|
+
throw new BalanceError(String(res.status));
|
|
122
|
+
}
|
|
123
|
+
const json = await res.json();
|
|
124
|
+
const balance = json.balance;
|
|
125
|
+
if (typeof balance === "undefined" || balance === null)
|
|
126
|
+
throw new BalanceError("EMPTY");
|
|
127
|
+
// hyper 积分换算:100 积分 = $5,即 1 积分 = $0.05
|
|
128
|
+
const usd = (Number(balance) * 0.05).toFixed(2);
|
|
129
|
+
return [{ currency: "USD", total: usd }];
|
|
130
|
+
},
|
|
131
|
+
};
|
|
106
132
|
/** 已注册的 provider 列表(按需追加新适配器)。 */
|
|
107
|
-
export const balanceProviders = [deepseekProvider, siliconflowProvider, openrouterProvider, moonshotProvider];
|
|
133
|
+
export const balanceProviders = [deepseekProvider, siliconflowProvider, openrouterProvider, moonshotProvider, hyperProvider];
|
|
108
134
|
/** 按 id 取 provider;未知 id 回退到第一个。 */
|
|
109
135
|
export function getBalanceProvider(id) {
|
|
110
136
|
return balanceProviders.find((p) => p.id === id) ?? balanceProviders[0] ?? deepseekProvider;
|
package/dist/tui.js
CHANGED
|
@@ -13,7 +13,7 @@ import { createElement as _$createElement } from "@opentui/solid";
|
|
|
13
13
|
import { createMemo, createSignal, createEffect, onMount, onCleanup, Show, For, untrack } from "solid-js";
|
|
14
14
|
|
|
15
15
|
// src/_version.ts
|
|
16
|
-
var PLUGIN_VERSION = "1.6.
|
|
16
|
+
var PLUGIN_VERSION = "1.6.4";
|
|
17
17
|
|
|
18
18
|
// src/balance-providers.ts
|
|
19
19
|
var BalanceError = class extends Error {
|
|
@@ -101,7 +101,28 @@ var moonshotProvider = {
|
|
|
101
101
|
return [{ currency: "CNY", total: String(balance) }];
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
-
var
|
|
104
|
+
var hyperProvider = {
|
|
105
|
+
id: "hyper",
|
|
106
|
+
name: "Charm Hyper",
|
|
107
|
+
keyPlaceholder: "sk-hyper-...",
|
|
108
|
+
async fetchBalance(apiKey, signal) {
|
|
109
|
+
const res = await fetch("https://hyper.charm.land/v1/credits", {
|
|
110
|
+
headers: { Authorization: `Bearer ${apiKey}`, Accept: "application/json" },
|
|
111
|
+
signal
|
|
112
|
+
});
|
|
113
|
+
if (!res.ok) {
|
|
114
|
+
if (res.status === 401) throw new BalanceError("401");
|
|
115
|
+
if (res.status === 403) throw new BalanceError("403");
|
|
116
|
+
throw new BalanceError(String(res.status));
|
|
117
|
+
}
|
|
118
|
+
const json = await res.json();
|
|
119
|
+
const balance = json.balance;
|
|
120
|
+
if (typeof balance === "undefined" || balance === null) throw new BalanceError("EMPTY");
|
|
121
|
+
const usd = (Number(balance) * 0.05).toFixed(2);
|
|
122
|
+
return [{ currency: "USD", total: usd }];
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
var balanceProviders = [deepseekProvider, siliconflowProvider, openrouterProvider, moonshotProvider, hyperProvider];
|
|
105
126
|
function getBalanceProvider(id) {
|
|
106
127
|
return balanceProviders.find((p) => p.id === id) ?? balanceProviders[0] ?? deepseekProvider;
|
|
107
128
|
}
|
package/package.json
CHANGED
package/src/_version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// auto-generated
|
|
2
|
-
export const PLUGIN_VERSION="1.6.
|
|
2
|
+
export const PLUGIN_VERSION="1.6.4";
|
package/src/balance-providers.ts
CHANGED
|
@@ -125,8 +125,32 @@ const moonshotProvider: BalanceProvider = {
|
|
|
125
125
|
},
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
const hyperProvider: BalanceProvider = {
|
|
129
|
+
id: "hyper",
|
|
130
|
+
name: "Charm Hyper",
|
|
131
|
+
keyPlaceholder: "sk-hyper-...",
|
|
132
|
+
async fetchBalance(apiKey, signal) {
|
|
133
|
+
// 官方接口:GET /v1/credits → {"balance": 98}(积分余额)
|
|
134
|
+
const res = await fetch("https://hyper.charm.land/v1/credits", {
|
|
135
|
+
headers: { Authorization: `Bearer ${apiKey}`, Accept: "application/json" },
|
|
136
|
+
signal,
|
|
137
|
+
})
|
|
138
|
+
if (!res.ok) {
|
|
139
|
+
if (res.status === 401) throw new BalanceError("401")
|
|
140
|
+
if (res.status === 403) throw new BalanceError("403")
|
|
141
|
+
throw new BalanceError(String(res.status))
|
|
142
|
+
}
|
|
143
|
+
const json = await res.json() as { balance?: string | number }
|
|
144
|
+
const balance = json.balance
|
|
145
|
+
if (typeof balance === "undefined" || balance === null) throw new BalanceError("EMPTY")
|
|
146
|
+
// hyper 积分换算:100 积分 = $5,即 1 积分 = $0.05
|
|
147
|
+
const usd = (Number(balance) * 0.05).toFixed(2)
|
|
148
|
+
return [{ currency: "USD", total: usd }]
|
|
149
|
+
},
|
|
150
|
+
}
|
|
151
|
+
|
|
128
152
|
/** 已注册的 provider 列表(按需追加新适配器)。 */
|
|
129
|
-
export const balanceProviders: BalanceProvider[] = [deepseekProvider, siliconflowProvider, openrouterProvider, moonshotProvider]
|
|
153
|
+
export const balanceProviders: BalanceProvider[] = [deepseekProvider, siliconflowProvider, openrouterProvider, moonshotProvider, hyperProvider]
|
|
130
154
|
|
|
131
155
|
/** 按 id 取 provider;未知 id 回退到第一个。 */
|
|
132
156
|
export function getBalanceProvider(id: string): BalanceProvider {
|