opencode-minimax-quota 0.1.6 → 0.1.7
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/tui.js +30 -25
- package/package.json +1 -1
package/dist/tui.js
CHANGED
|
@@ -74,8 +74,23 @@ function fmtResetTime(ms) {
|
|
|
74
74
|
function Badge(props) {
|
|
75
75
|
const theme = () => props.theme;
|
|
76
76
|
const q = () => props.quota();
|
|
77
|
-
const
|
|
78
|
-
const
|
|
77
|
+
const cur = q();
|
|
78
|
+
const curTheme = theme();
|
|
79
|
+
log("Badge render, quota:", cur?.intervalPct, "weekly:", cur?.weeklyPct);
|
|
80
|
+
if (!cur) {
|
|
81
|
+
const el = createComponent("text", {
|
|
82
|
+
get fg() {
|
|
83
|
+
return curTheme?.textMuted || "gray";
|
|
84
|
+
},
|
|
85
|
+
get children() {
|
|
86
|
+
return "MiniMax loading...";
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
log("Badge returning loading element");
|
|
90
|
+
return el;
|
|
91
|
+
}
|
|
92
|
+
const iColor = (cur.intervalPct ?? 0) > 20 ? curTheme?.success || "green" : curTheme?.error || "red";
|
|
93
|
+
const wColor = (cur.weeklyPct ?? 0) > 20 ? curTheme?.success || "green" : curTheme?.error || "red";
|
|
79
94
|
const root = createComponent("box", {
|
|
80
95
|
get flexDirection() {
|
|
81
96
|
return "row";
|
|
@@ -87,24 +102,11 @@ function Badge(props) {
|
|
|
87
102
|
return "center";
|
|
88
103
|
},
|
|
89
104
|
get children() {
|
|
90
|
-
|
|
91
|
-
const curTheme = theme();
|
|
92
|
-
if (!cur) {
|
|
93
|
-
return [createComponent("text", {
|
|
94
|
-
get fg() {
|
|
95
|
-
return curTheme.textMuted;
|
|
96
|
-
},
|
|
97
|
-
get children() {
|
|
98
|
-
return "MiniMax loading...";
|
|
99
|
-
}
|
|
100
|
-
})];
|
|
101
|
-
}
|
|
102
|
-
const iColorVal = iColor();
|
|
103
|
-
const wColorVal = wColor();
|
|
105
|
+
log("Badge children render");
|
|
104
106
|
return [
|
|
105
107
|
createComponent("text", {
|
|
106
108
|
get fg() {
|
|
107
|
-
return curTheme
|
|
109
|
+
return curTheme?.textMuted || "gray";
|
|
108
110
|
},
|
|
109
111
|
get children() {
|
|
110
112
|
return "MiniMax";
|
|
@@ -112,14 +114,14 @@ function Badge(props) {
|
|
|
112
114
|
}),
|
|
113
115
|
createComponent("text", {
|
|
114
116
|
get fg() {
|
|
115
|
-
return curTheme
|
|
117
|
+
return curTheme?.text || "white";
|
|
116
118
|
},
|
|
117
119
|
get children() {
|
|
118
120
|
return [
|
|
119
121
|
"5h:",
|
|
120
122
|
createComponent("span", {
|
|
121
123
|
get style() {
|
|
122
|
-
return { fg:
|
|
124
|
+
return { fg: iColor };
|
|
123
125
|
},
|
|
124
126
|
get children() {
|
|
125
127
|
return `${cur.intervalPct}%`;
|
|
@@ -130,7 +132,7 @@ function Badge(props) {
|
|
|
130
132
|
}),
|
|
131
133
|
createComponent("text", {
|
|
132
134
|
get fg() {
|
|
133
|
-
return curTheme
|
|
135
|
+
return curTheme?.textMuted || "gray";
|
|
134
136
|
},
|
|
135
137
|
get children() {
|
|
136
138
|
return fmtResetTime(cur.intervalResetMs);
|
|
@@ -138,7 +140,7 @@ function Badge(props) {
|
|
|
138
140
|
}),
|
|
139
141
|
createComponent("text", {
|
|
140
142
|
get fg() {
|
|
141
|
-
return curTheme
|
|
143
|
+
return curTheme?.textMuted || "gray";
|
|
142
144
|
},
|
|
143
145
|
get children() {
|
|
144
146
|
return "\xB7";
|
|
@@ -146,14 +148,14 @@ function Badge(props) {
|
|
|
146
148
|
}),
|
|
147
149
|
createComponent("text", {
|
|
148
150
|
get fg() {
|
|
149
|
-
return curTheme
|
|
151
|
+
return curTheme?.text || "white";
|
|
150
152
|
},
|
|
151
153
|
get children() {
|
|
152
154
|
return [
|
|
153
155
|
"\u5468:",
|
|
154
156
|
createComponent("span", {
|
|
155
157
|
get style() {
|
|
156
|
-
return { fg:
|
|
158
|
+
return { fg: wColor };
|
|
157
159
|
},
|
|
158
160
|
get children() {
|
|
159
161
|
return `${cur.weeklyPct}%`;
|
|
@@ -164,7 +166,7 @@ function Badge(props) {
|
|
|
164
166
|
}),
|
|
165
167
|
createComponent("text", {
|
|
166
168
|
get fg() {
|
|
167
|
-
return curTheme
|
|
169
|
+
return curTheme?.textMuted || "gray";
|
|
168
170
|
},
|
|
169
171
|
get children() {
|
|
170
172
|
return fmtResetTime(cur.weeklyResetMs);
|
|
@@ -173,6 +175,7 @@ function Badge(props) {
|
|
|
173
175
|
];
|
|
174
176
|
}
|
|
175
177
|
});
|
|
178
|
+
log("Badge returning root component");
|
|
176
179
|
return root;
|
|
177
180
|
}
|
|
178
181
|
var tui = async (api) => {
|
|
@@ -185,7 +188,9 @@ var tui = async (api) => {
|
|
|
185
188
|
slots: {
|
|
186
189
|
session_prompt_right() {
|
|
187
190
|
log("renderer called, quota:", quota()?.intervalPct);
|
|
188
|
-
|
|
191
|
+
const result = Badge({ quota, theme: () => api.theme.current });
|
|
192
|
+
log("renderer returned:", typeof result, result?.constructor?.name);
|
|
193
|
+
return result;
|
|
189
194
|
}
|
|
190
195
|
}
|
|
191
196
|
});
|