opencode-usage-coach 0.6.1 → 0.6.2
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/index.js +1 -3
- package/dist/tui.js +136 -163
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -451,7 +451,6 @@ function coach(q, lighter) {
|
|
|
451
451
|
return { decision: "GO", advice: `Comfortable \u2014 weekly ${wk}% \xB7 5h ${h5}% \xB7 monthly ${mo}%. proceed. 5h window ${h5R}.`, weekly: wk, monthly: mo, fiveHour: h5 };
|
|
452
452
|
}
|
|
453
453
|
var agentCache = /* @__PURE__ */ new Map();
|
|
454
|
-
var lastResolvedAgent = "";
|
|
455
454
|
async function resolveAgent(client, sessionID) {
|
|
456
455
|
if (!sessionID) return "";
|
|
457
456
|
const hit = agentCache.get(sessionID);
|
|
@@ -460,7 +459,6 @@ async function resolveAgent(client, sessionID) {
|
|
|
460
459
|
const s = await client.session.get({ path: { id: sessionID } });
|
|
461
460
|
const agent = String(s?.data?.info?.agent ?? s?.data?.agent ?? s?.info?.agent ?? "");
|
|
462
461
|
agentCache.set(sessionID, { agent, ts: Date.now() });
|
|
463
|
-
lastResolvedAgent = agent;
|
|
464
462
|
return agent;
|
|
465
463
|
} catch (e) {
|
|
466
464
|
log(`resolveAgent err: ${String(e)}`);
|
|
@@ -500,7 +498,7 @@ async function UsageCoachPlugin(input) {
|
|
|
500
498
|
const p0 = providers[0];
|
|
501
499
|
last = { ...last, weekly: p0.weekly, fiveHour: p0.fiveHour, monthly: p0.weekly >= 0 ? 0 : -1, advice: p0.advice, decision: p0.weekly >= STOP_WK ? "STOP" : p0.weekly >= THR_WK ? "THROTTLE" : "GO" };
|
|
502
500
|
}
|
|
503
|
-
writeState({ ...last,
|
|
501
|
+
writeState({ ...last, providers, updatedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
504
502
|
log(`${last.decision} | weekly=${last.weekly}% 5h=${last.fiveHour}% | providers=${providers.length}`);
|
|
505
503
|
} catch (e) {
|
|
506
504
|
log(`refresh-in-then err: ${String(e)}`);
|
package/dist/tui.js
CHANGED
|
@@ -19,7 +19,6 @@ var STATE_DIR = join(homedir(), ".cache", "opencode-usage-coach");
|
|
|
19
19
|
var STATE_FILE = join(STATE_DIR, "state.json");
|
|
20
20
|
var HARNESS_FILE = join(STATE_DIR, "harness.json");
|
|
21
21
|
var MARKER = join(STATE_DIR, "tui-loaded.txt");
|
|
22
|
-
var HARNESS_AGENT_IDS = (process.env.UC_HARNESS_AGENT ?? "Usage-Coach-Harness").split(",").map((s) => s.trim().toLowerCase()).filter(Boolean);
|
|
23
22
|
function readState() {
|
|
24
23
|
try {
|
|
25
24
|
if (!existsSync(STATE_FILE)) return null;
|
|
@@ -189,16 +188,6 @@ function initializeTui(api, disposeRoot) {
|
|
|
189
188
|
} catch {
|
|
190
189
|
s = null;
|
|
191
190
|
}
|
|
192
|
-
const isHarness = s?.agent ? HARNESS_AGENT_IDS.includes(s.agent.toLowerCase()) : false;
|
|
193
|
-
if (s?.agent && !isHarness) {
|
|
194
|
-
return (() => {
|
|
195
|
-
var _el$4 = _$createElement("box"), _el$5 = _$createElement("text");
|
|
196
|
-
_$insertNode(_el$4, _el$5);
|
|
197
|
-
_$insertNode(_el$5, _$createTextNode(`usage-coach`));
|
|
198
|
-
_$effect((_$p) => _$setProp(_el$5, "style", st("textMuted"), _$p));
|
|
199
|
-
return _el$4;
|
|
200
|
-
})();
|
|
201
|
-
}
|
|
202
191
|
let h = null;
|
|
203
192
|
try {
|
|
204
193
|
const routeSid = api.route?.current?.params?.sessionID ?? "";
|
|
@@ -216,149 +205,149 @@ function initializeTui(api, disposeRoot) {
|
|
|
216
205
|
if (s) {
|
|
217
206
|
const dKey = s.decision === "GO" ? "success" : s.decision === "THROTTLE" ? "warning" : "error";
|
|
218
207
|
nodes.push((() => {
|
|
219
|
-
var _el$
|
|
220
|
-
_$insertNode(_el$
|
|
221
|
-
_$insertNode(_el$
|
|
222
|
-
_$insert(_el$
|
|
223
|
-
_$effect((_$p) => _$setProp(_el$
|
|
224
|
-
return _el$
|
|
208
|
+
var _el$4 = _$createElement("text"), _el$5 = _$createTextNode(`usage-coach [`), _el$6 = _$createTextNode(`]`);
|
|
209
|
+
_$insertNode(_el$4, _el$5);
|
|
210
|
+
_$insertNode(_el$4, _el$6);
|
|
211
|
+
_$insert(_el$4, () => TAG[s.decision], _el$6);
|
|
212
|
+
_$effect((_$p) => _$setProp(_el$4, "style", st(dKey), _$p));
|
|
213
|
+
return _el$4;
|
|
225
214
|
})());
|
|
226
215
|
if (s.providers && s.providers.length > 0) {
|
|
227
216
|
for (const p of s.providers) {
|
|
228
217
|
nodes.push((() => {
|
|
229
|
-
var _el$
|
|
230
|
-
_$insertNode(_el$
|
|
231
|
-
_$insert(_el$
|
|
232
|
-
_$effect((_$p) => _$setProp(_el$
|
|
233
|
-
return _el$
|
|
218
|
+
var _el$7 = _$createElement("text"), _el$8 = _$createTextNode(` `);
|
|
219
|
+
_$insertNode(_el$7, _el$8);
|
|
220
|
+
_$insert(_el$7, () => p.name, null);
|
|
221
|
+
_$effect((_$p) => _$setProp(_el$7, "style", st("textMuted"), _$p));
|
|
222
|
+
return _el$7;
|
|
234
223
|
})());
|
|
235
224
|
nodes.push((() => {
|
|
236
|
-
var _el$
|
|
237
|
-
_$insertNode(_el$
|
|
238
|
-
_$insertNode(_el$
|
|
239
|
-
_$insertNode(_el$
|
|
240
|
-
_$insertNode(_el$
|
|
241
|
-
_$setProp(_el$
|
|
242
|
-
_$insertNode(_el$
|
|
243
|
-
_$insert(_el$
|
|
244
|
-
_$insert(_el$
|
|
245
|
-
_$insertNode(_el$
|
|
246
|
-
_$insertNode(_el$
|
|
247
|
-
_$insert(_el$
|
|
248
|
-
_$insert(_el$
|
|
225
|
+
var _el$9 = _$createElement("box"), _el$0 = _$createElement("text"), _el$10 = _$createElement("text"), _el$11 = _$createElement("text"), _el$12 = _$createElement("text"), _el$13 = _$createTextNode(` `), _el$14 = _$createTextNode(`% `);
|
|
226
|
+
_$insertNode(_el$9, _el$0);
|
|
227
|
+
_$insertNode(_el$9, _el$10);
|
|
228
|
+
_$insertNode(_el$9, _el$11);
|
|
229
|
+
_$insertNode(_el$9, _el$12);
|
|
230
|
+
_$setProp(_el$9, "flexDirection", "row");
|
|
231
|
+
_$insertNode(_el$0, _$createTextNode(` 5h `));
|
|
232
|
+
_$insert(_el$10, () => barFill(p.fiveHour));
|
|
233
|
+
_$insert(_el$11, () => barEmpty(p.fiveHour));
|
|
234
|
+
_$insertNode(_el$12, _el$13);
|
|
235
|
+
_$insertNode(_el$12, _el$14);
|
|
236
|
+
_$insert(_el$12, () => p.fiveHour, _el$14);
|
|
237
|
+
_$insert(_el$12, () => p.fiveHourReset, null);
|
|
249
238
|
_$effect((_p$) => {
|
|
250
239
|
var _v$ = st("text"), _v$2 = st("text");
|
|
251
|
-
_v$ !== _p$.e && (_p$.e = _$setProp(_el$
|
|
252
|
-
_v$2 !== _p$.t && (_p$.t = _$setProp(_el$
|
|
240
|
+
_v$ !== _p$.e && (_p$.e = _$setProp(_el$10, "style", _v$, _p$.e));
|
|
241
|
+
_v$2 !== _p$.t && (_p$.t = _$setProp(_el$11, "style", _v$2, _p$.t));
|
|
253
242
|
return _p$;
|
|
254
243
|
}, {
|
|
255
244
|
e: void 0,
|
|
256
245
|
t: void 0
|
|
257
246
|
});
|
|
258
|
-
return _el$
|
|
247
|
+
return _el$9;
|
|
259
248
|
})());
|
|
260
249
|
nodes.push((() => {
|
|
261
|
-
var _el$
|
|
262
|
-
_$insertNode(_el$
|
|
263
|
-
_$insertNode(_el$
|
|
264
|
-
_$insertNode(_el$
|
|
265
|
-
_$insertNode(_el$
|
|
266
|
-
_$setProp(_el$
|
|
267
|
-
_$insertNode(_el$
|
|
268
|
-
_$insert(_el$
|
|
269
|
-
_$insert(_el$
|
|
270
|
-
_$insertNode(_el$
|
|
271
|
-
_$insertNode(_el$
|
|
272
|
-
_$insert(_el$
|
|
273
|
-
_$insert(_el$
|
|
250
|
+
var _el$15 = _$createElement("box"), _el$16 = _$createElement("text"), _el$18 = _$createElement("text"), _el$19 = _$createElement("text"), _el$20 = _$createElement("text"), _el$21 = _$createTextNode(` `), _el$22 = _$createTextNode(`% `);
|
|
251
|
+
_$insertNode(_el$15, _el$16);
|
|
252
|
+
_$insertNode(_el$15, _el$18);
|
|
253
|
+
_$insertNode(_el$15, _el$19);
|
|
254
|
+
_$insertNode(_el$15, _el$20);
|
|
255
|
+
_$setProp(_el$15, "flexDirection", "row");
|
|
256
|
+
_$insertNode(_el$16, _$createTextNode(` 1w `));
|
|
257
|
+
_$insert(_el$18, () => barFill(p.weekly));
|
|
258
|
+
_$insert(_el$19, () => barEmpty(p.weekly));
|
|
259
|
+
_$insertNode(_el$20, _el$21);
|
|
260
|
+
_$insertNode(_el$20, _el$22);
|
|
261
|
+
_$insert(_el$20, () => p.weekly, _el$22);
|
|
262
|
+
_$insert(_el$20, () => p.weeklyReset, null);
|
|
274
263
|
_$effect((_p$) => {
|
|
275
264
|
var _v$3 = st("text"), _v$4 = st("text");
|
|
276
|
-
_v$3 !== _p$.e && (_p$.e = _$setProp(_el$
|
|
277
|
-
_v$4 !== _p$.t && (_p$.t = _$setProp(_el$
|
|
265
|
+
_v$3 !== _p$.e && (_p$.e = _$setProp(_el$18, "style", _v$3, _p$.e));
|
|
266
|
+
_v$4 !== _p$.t && (_p$.t = _$setProp(_el$19, "style", _v$4, _p$.t));
|
|
278
267
|
return _p$;
|
|
279
268
|
}, {
|
|
280
269
|
e: void 0,
|
|
281
270
|
t: void 0
|
|
282
271
|
});
|
|
283
|
-
return _el$
|
|
272
|
+
return _el$15;
|
|
284
273
|
})());
|
|
285
274
|
nodes.push((() => {
|
|
286
|
-
var _el$
|
|
287
|
-
_$insertNode(_el$
|
|
288
|
-
_$insert(_el$
|
|
289
|
-
_$effect((_$p) => _$setProp(_el$
|
|
290
|
-
return _el$
|
|
275
|
+
var _el$23 = _$createElement("text"), _el$24 = _$createTextNode(` -> `);
|
|
276
|
+
_$insertNode(_el$23, _el$24);
|
|
277
|
+
_$insert(_el$23, () => p.advice, null);
|
|
278
|
+
_$effect((_$p) => _$setProp(_el$23, "style", st(dKey), _$p));
|
|
279
|
+
return _el$23;
|
|
291
280
|
})());
|
|
292
281
|
}
|
|
293
282
|
} else {
|
|
294
283
|
nodes.push((() => {
|
|
295
|
-
var _el$
|
|
296
|
-
_$insertNode(_el$
|
|
297
|
-
_$insertNode(_el$
|
|
298
|
-
_$insertNode(_el$
|
|
299
|
-
_$insertNode(_el$
|
|
300
|
-
_$setProp(_el$
|
|
301
|
-
_$insertNode(_el$
|
|
302
|
-
_$insert(_el$
|
|
303
|
-
_$insert(_el$
|
|
304
|
-
_$insertNode(_el$
|
|
284
|
+
var _el$27 = _$createElement("box"), _el$28 = _$createElement("text"), _el$30 = _$createElement("text"), _el$31 = _$createElement("text"), _el$32 = _$createElement("text");
|
|
285
|
+
_$insertNode(_el$27, _el$28);
|
|
286
|
+
_$insertNode(_el$27, _el$30);
|
|
287
|
+
_$insertNode(_el$27, _el$31);
|
|
288
|
+
_$insertNode(_el$27, _el$32);
|
|
289
|
+
_$setProp(_el$27, "flexDirection", "row");
|
|
290
|
+
_$insertNode(_el$28, _$createTextNode(` 5h `));
|
|
291
|
+
_$insert(_el$30, () => barFill(s.fiveHour));
|
|
292
|
+
_$insert(_el$31, () => barEmpty(s.fiveHour));
|
|
293
|
+
_$insertNode(_el$32, _$createTextNode(` 0%`));
|
|
305
294
|
_$effect((_p$) => {
|
|
306
295
|
var _v$5 = st("text"), _v$6 = st("text");
|
|
307
|
-
_v$5 !== _p$.e && (_p$.e = _$setProp(_el$
|
|
308
|
-
_v$6 !== _p$.t && (_p$.t = _$setProp(_el$
|
|
296
|
+
_v$5 !== _p$.e && (_p$.e = _$setProp(_el$30, "style", _v$5, _p$.e));
|
|
297
|
+
_v$6 !== _p$.t && (_p$.t = _$setProp(_el$31, "style", _v$6, _p$.t));
|
|
309
298
|
return _p$;
|
|
310
299
|
}, {
|
|
311
300
|
e: void 0,
|
|
312
301
|
t: void 0
|
|
313
302
|
});
|
|
314
|
-
return _el$
|
|
303
|
+
return _el$27;
|
|
315
304
|
})());
|
|
316
305
|
nodes.push((() => {
|
|
317
|
-
var _el$
|
|
318
|
-
_$insertNode(_el$
|
|
319
|
-
_$insertNode(_el$
|
|
320
|
-
_$insertNode(_el$
|
|
321
|
-
_$insertNode(_el$
|
|
322
|
-
_$setProp(_el$
|
|
323
|
-
_$insertNode(_el$
|
|
324
|
-
_$insert(_el$
|
|
325
|
-
_$insert(_el$
|
|
326
|
-
_$insertNode(_el$
|
|
306
|
+
var _el$34 = _$createElement("box"), _el$35 = _$createElement("text"), _el$37 = _$createElement("text"), _el$38 = _$createElement("text"), _el$39 = _$createElement("text");
|
|
307
|
+
_$insertNode(_el$34, _el$35);
|
|
308
|
+
_$insertNode(_el$34, _el$37);
|
|
309
|
+
_$insertNode(_el$34, _el$38);
|
|
310
|
+
_$insertNode(_el$34, _el$39);
|
|
311
|
+
_$setProp(_el$34, "flexDirection", "row");
|
|
312
|
+
_$insertNode(_el$35, _$createTextNode(` 1w `));
|
|
313
|
+
_$insert(_el$37, () => barFill(s.weekly));
|
|
314
|
+
_$insert(_el$38, () => barEmpty(s.weekly));
|
|
315
|
+
_$insertNode(_el$39, _$createTextNode(` 0%`));
|
|
327
316
|
_$effect((_p$) => {
|
|
328
317
|
var _v$7 = st("text"), _v$8 = st("text");
|
|
329
|
-
_v$7 !== _p$.e && (_p$.e = _$setProp(_el$
|
|
330
|
-
_v$8 !== _p$.t && (_p$.t = _$setProp(_el$
|
|
318
|
+
_v$7 !== _p$.e && (_p$.e = _$setProp(_el$37, "style", _v$7, _p$.e));
|
|
319
|
+
_v$8 !== _p$.t && (_p$.t = _$setProp(_el$38, "style", _v$8, _p$.t));
|
|
331
320
|
return _p$;
|
|
332
321
|
}, {
|
|
333
322
|
e: void 0,
|
|
334
323
|
t: void 0
|
|
335
324
|
});
|
|
336
|
-
return _el$
|
|
325
|
+
return _el$34;
|
|
337
326
|
})());
|
|
338
327
|
}
|
|
339
328
|
} else {
|
|
340
329
|
nodes.push((() => {
|
|
341
|
-
var _el$
|
|
342
|
-
_$insertNode(_el$
|
|
343
|
-
return _el$
|
|
330
|
+
var _el$41 = _$createElement("text");
|
|
331
|
+
_$insertNode(_el$41, _$createTextNode(`usage-coach: ...`));
|
|
332
|
+
return _el$41;
|
|
344
333
|
})());
|
|
345
334
|
}
|
|
346
335
|
if (h && h.active !== false && h.tasks.length > 0) {
|
|
347
336
|
nodes.push((() => {
|
|
348
|
-
var _el$
|
|
349
|
-
_$insertNode(_el$
|
|
350
|
-
return _el$
|
|
337
|
+
var _el$43 = _$createElement("text");
|
|
338
|
+
_$insertNode(_el$43, _$createTextNode(` `));
|
|
339
|
+
return _el$43;
|
|
351
340
|
})());
|
|
352
341
|
nodes.push((() => {
|
|
353
|
-
var _el$
|
|
354
|
-
_$insertNode(_el$
|
|
355
|
-
_$insertNode(_el$
|
|
356
|
-
_$insertNode(_el$
|
|
357
|
-
_$insert(_el$
|
|
358
|
-
_$insert(_el$
|
|
359
|
-
_$insert(_el$
|
|
360
|
-
_$effect((_$p) => _$setProp(_el$
|
|
361
|
-
return _el$
|
|
342
|
+
var _el$45 = _$createElement("text"), _el$46 = _$createTextNode(`harness: `), _el$47 = _$createTextNode(` `), _el$48 = _$createTextNode(`/`);
|
|
343
|
+
_$insertNode(_el$45, _el$46);
|
|
344
|
+
_$insertNode(_el$45, _el$47);
|
|
345
|
+
_$insertNode(_el$45, _el$48);
|
|
346
|
+
_$insert(_el$45, () => h.name, _el$47);
|
|
347
|
+
_$insert(_el$45, () => h.current, _el$48);
|
|
348
|
+
_$insert(_el$45, () => h.total, null);
|
|
349
|
+
_$effect((_$p) => _$setProp(_el$45, "style", st("textMuted"), _$p));
|
|
350
|
+
return _el$45;
|
|
362
351
|
})());
|
|
363
352
|
for (const t of h.tasks) {
|
|
364
353
|
const sKey = statusKey[t.status] ?? "text";
|
|
@@ -368,70 +357,54 @@ function initializeTui(api, disposeRoot) {
|
|
|
368
357
|
const elapsed = t.startedAt ? Math.max(0, Math.round((Date.now() - new Date(t.startedAt).getTime()) / 1e3)) : 0;
|
|
369
358
|
const elapsedStr = t.status === "completed" || t.status === "failed" ? "" : elapsed > 0 ? ` ${elapsed}s` : "";
|
|
370
359
|
nodes.push((() => {
|
|
371
|
-
var _el$
|
|
372
|
-
_$insertNode(_el$
|
|
373
|
-
_$insertNode(_el$
|
|
374
|
-
_$insertNode(_el$
|
|
375
|
-
_$insert(_el$
|
|
376
|
-
_$insert(_el$
|
|
377
|
-
_$insert(_el$
|
|
378
|
-
_$insert(_el$
|
|
379
|
-
_$insert(_el$
|
|
380
|
-
_$insert(_el$
|
|
381
|
-
_$effect((_$p) => _$setProp(_el$
|
|
382
|
-
return _el$
|
|
360
|
+
var _el$49 = _$createElement("text"), _el$50 = _$createTextNode(` \u25CF `), _el$51 = _$createTextNode(` `), _el$52 = _$createTextNode(` `);
|
|
361
|
+
_$insertNode(_el$49, _el$50);
|
|
362
|
+
_$insertNode(_el$49, _el$51);
|
|
363
|
+
_$insertNode(_el$49, _el$52);
|
|
364
|
+
_$insert(_el$49, () => t.id, _el$51);
|
|
365
|
+
_$insert(_el$49, mdl, _el$51);
|
|
366
|
+
_$insert(_el$49, lbl, _el$52);
|
|
367
|
+
_$insert(_el$49, rev, _el$52);
|
|
368
|
+
_$insert(_el$49, elapsedStr, _el$52);
|
|
369
|
+
_$insert(_el$49, () => t.title, null);
|
|
370
|
+
_$effect((_$p) => _$setProp(_el$49, "style", st(sKey), _$p));
|
|
371
|
+
return _el$49;
|
|
372
|
+
})());
|
|
373
|
+
const pv = t.model ? (t.model.split("/")[0] ?? "").split("-")[0] : "";
|
|
374
|
+
const provCoach = pv ? s?.providers?.find((p) => p.id === pv || pv && p.id.startsWith(pv) || pv && pv.startsWith(p.id)) : s?.providers?.[0];
|
|
375
|
+
const rawPct = provCoach?.fiveHour ?? s?.fiveHour ?? -1;
|
|
376
|
+
const pct = rawPct < 0 ? 0 : rawPct;
|
|
377
|
+
const pctLabel = rawPct < 0 ? "n/a" : `${rawPct}%`;
|
|
378
|
+
nodes.push((() => {
|
|
379
|
+
var _el$53 = _$createElement("box"), _el$54 = _$createElement("text"), _el$56 = _$createElement("text"), _el$57 = _$createElement("text"), _el$58 = _$createElement("text"), _el$59 = _$createTextNode(` `);
|
|
380
|
+
_$insertNode(_el$53, _el$54);
|
|
381
|
+
_$insertNode(_el$53, _el$56);
|
|
382
|
+
_$insertNode(_el$53, _el$57);
|
|
383
|
+
_$insertNode(_el$53, _el$58);
|
|
384
|
+
_$setProp(_el$53, "flexDirection", "row");
|
|
385
|
+
_$insertNode(_el$54, _$createTextNode(` 5h `));
|
|
386
|
+
_$insert(_el$56, () => barFill(pct));
|
|
387
|
+
_$insert(_el$57, () => barEmpty(pct));
|
|
388
|
+
_$insertNode(_el$58, _el$59);
|
|
389
|
+
_$insert(_el$58, pctLabel, null);
|
|
390
|
+
_$effect((_p$) => {
|
|
391
|
+
var _v$9 = st("text"), _v$0 = st("text");
|
|
392
|
+
_v$9 !== _p$.e && (_p$.e = _$setProp(_el$56, "style", _v$9, _p$.e));
|
|
393
|
+
_v$0 !== _p$.t && (_p$.t = _$setProp(_el$57, "style", _v$0, _p$.t));
|
|
394
|
+
return _p$;
|
|
395
|
+
}, {
|
|
396
|
+
e: void 0,
|
|
397
|
+
t: void 0
|
|
398
|
+
});
|
|
399
|
+
return _el$53;
|
|
383
400
|
})());
|
|
384
|
-
if (t.model) {
|
|
385
|
-
const prefix = t.model.split("/")[0] ?? "";
|
|
386
|
-
if (prefix === "opencode") {
|
|
387
|
-
nodes.push((() => {
|
|
388
|
-
var _el$56 = _$createElement("box"), _el$57 = _$createElement("text"), _el$59 = _$createElement("text");
|
|
389
|
-
_$insertNode(_el$56, _el$57);
|
|
390
|
-
_$insertNode(_el$56, _el$59);
|
|
391
|
-
_$setProp(_el$56, "flexDirection", "row");
|
|
392
|
-
_$insertNode(_el$57, _$createTextNode(` `));
|
|
393
|
-
_$insertNode(_el$59, _$createTextNode(`free`));
|
|
394
|
-
_$effect((_$p) => _$setProp(_el$59, "style", st("success"), _$p));
|
|
395
|
-
return _el$56;
|
|
396
|
-
})());
|
|
397
|
-
} else {
|
|
398
|
-
const provCoach = s?.providers?.find((p) => p.id === prefix || p.id.startsWith(prefix) || prefix.startsWith(p.id));
|
|
399
|
-
const rawPct = provCoach?.fiveHour ?? -1;
|
|
400
|
-
if (rawPct >= 0) {
|
|
401
|
-
nodes.push((() => {
|
|
402
|
-
var _el$61 = _$createElement("box"), _el$62 = _$createElement("text"), _el$64 = _$createElement("text"), _el$65 = _$createElement("text"), _el$66 = _$createElement("text"), _el$67 = _$createTextNode(` `), _el$68 = _$createTextNode(`%`);
|
|
403
|
-
_$insertNode(_el$61, _el$62);
|
|
404
|
-
_$insertNode(_el$61, _el$64);
|
|
405
|
-
_$insertNode(_el$61, _el$65);
|
|
406
|
-
_$insertNode(_el$61, _el$66);
|
|
407
|
-
_$setProp(_el$61, "flexDirection", "row");
|
|
408
|
-
_$insertNode(_el$62, _$createTextNode(` 5h `));
|
|
409
|
-
_$insert(_el$64, () => barFill(rawPct));
|
|
410
|
-
_$insert(_el$65, () => barEmpty(rawPct));
|
|
411
|
-
_$insertNode(_el$66, _el$67);
|
|
412
|
-
_$insertNode(_el$66, _el$68);
|
|
413
|
-
_$insert(_el$66, rawPct, _el$68);
|
|
414
|
-
_$effect((_p$) => {
|
|
415
|
-
var _v$9 = st("text"), _v$0 = st("text");
|
|
416
|
-
_v$9 !== _p$.e && (_p$.e = _$setProp(_el$64, "style", _v$9, _p$.e));
|
|
417
|
-
_v$0 !== _p$.t && (_p$.t = _$setProp(_el$65, "style", _v$0, _p$.t));
|
|
418
|
-
return _p$;
|
|
419
|
-
}, {
|
|
420
|
-
e: void 0,
|
|
421
|
-
t: void 0
|
|
422
|
-
});
|
|
423
|
-
return _el$61;
|
|
424
|
-
})());
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
401
|
}
|
|
429
402
|
}
|
|
430
403
|
return (() => {
|
|
431
|
-
var _el$
|
|
432
|
-
_$setProp(_el$
|
|
433
|
-
_$insert(_el$
|
|
434
|
-
return _el$
|
|
404
|
+
var _el$60 = _$createElement("box");
|
|
405
|
+
_$setProp(_el$60, "flexDirection", "column");
|
|
406
|
+
_$insert(_el$60, nodes);
|
|
407
|
+
return _el$60;
|
|
435
408
|
})();
|
|
436
409
|
};
|
|
437
410
|
tlog("registering slots");
|
|
@@ -446,9 +419,9 @@ function initializeTui(api, disposeRoot) {
|
|
|
446
419
|
} catch (e) {
|
|
447
420
|
tlog(`sidebar_footer err: ${String(e)}`);
|
|
448
421
|
result = (() => {
|
|
449
|
-
var _el$
|
|
450
|
-
_$insertNode(_el$
|
|
451
|
-
return _el$
|
|
422
|
+
var _el$61 = _$createElement("text");
|
|
423
|
+
_$insertNode(_el$61, _$createTextNode(`usage-coach`));
|
|
424
|
+
return _el$61;
|
|
452
425
|
})();
|
|
453
426
|
}
|
|
454
427
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-usage-coach",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "opencode closed-loop usage coach — quota SENSE -> coaching DECIDE -> loop ACT + TUI integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -65,4 +65,4 @@
|
|
|
65
65
|
"trustedDependencies": [
|
|
66
66
|
"@ladybugdb/core"
|
|
67
67
|
]
|
|
68
|
-
}
|
|
68
|
+
}
|