@goodandready/dsh-cost-meter 0.8.3 → 0.8.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/lib/client.js +22 -3
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -11,6 +11,10 @@ window.__ModuleLoader__.load({
|
|
|
11
11
|
const h = React.createElement
|
|
12
12
|
|
|
13
13
|
const NS = 'dsh-cost-meter'
|
|
14
|
+
// Plugins page row seat (DSH 0.1.6-alpha.2): key = '<package name>#<row id>'.
|
|
15
|
+
const PKG = '@goodandready/dsh-cost-meter'
|
|
16
|
+
const ROW_ID = 'dsh-cost-meter'
|
|
17
|
+
const ROW_CONFIG_KEY = PKG + '#' + ROW_ID
|
|
14
18
|
const STATE_PATH = '/dsh-cost-meter/state'
|
|
15
19
|
const REFRESH_PATH = '/dsh-cost-meter/refresh'
|
|
16
20
|
const UPDATE_PATH = '/dsh-cost-meter/update'
|
|
@@ -439,7 +443,8 @@ window.__ModuleLoader__.load({
|
|
|
439
443
|
const ctx = props.ctx
|
|
440
444
|
const locale = useActiveLocale(ctx)
|
|
441
445
|
const t = props.t || makeT(locale === 'zh' ? zh : en, en)
|
|
442
|
-
const
|
|
446
|
+
const page = !!(props && props.view === 'page')
|
|
447
|
+
const [open, setOpen] = React.useState(!!page)
|
|
443
448
|
const [draft, setDraft] = React.useState(null)
|
|
444
449
|
const [saving, setSaving] = React.useState(false)
|
|
445
450
|
const [err, setErr] = React.useState('')
|
|
@@ -650,9 +655,15 @@ window.__ModuleLoader__.load({
|
|
|
650
655
|
const catalogHasErr = diagState && Boolean(diagState.catalogError)
|
|
651
656
|
const openRouterEnabled = draft ? Boolean(draft.useOpenRouter) : true
|
|
652
657
|
|
|
653
|
-
|
|
658
|
+
// Row seat (plugins.row.config): the host page draws title/icon/crumb and the
|
|
659
|
+
// padding, so the summary is a one-liner and the page drops our card chrome.
|
|
660
|
+
if (props && props.view === 'summary') {
|
|
661
|
+
return React.createElement('span', { className: 'dcm-sub' }, t('header.sub'))
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
return React.createElement(page ? 'div' : 'li', { className: page ? 'dcm-page' : 'dcm-card' },
|
|
654
665
|
React.createElement('button', {
|
|
655
|
-
type: 'button', className: 'dcm-head', 'aria-expanded': open,
|
|
666
|
+
type: 'button', className: 'dcm-head', style: page ? { display: 'none' } : undefined, 'aria-expanded': page ? true : open,
|
|
656
667
|
onClick: () => setOpen((v) => !v),
|
|
657
668
|
},
|
|
658
669
|
React.createElement('div', { style: { flex: 1, display: 'flex', flexDirection: 'column', gap: 2 } },
|
|
@@ -1396,6 +1407,14 @@ window.__ModuleLoader__.load({
|
|
|
1396
1407
|
),
|
|
1397
1408
|
)
|
|
1398
1409
|
|
|
1410
|
+
// Row seat first (the seat the current core renders), legacy seat kept below.
|
|
1411
|
+
ctx.slots.inject('plugins.row.config', () =>
|
|
1412
|
+
ctx.slots.register(
|
|
1413
|
+
{ name: 'plugins.row.config', key: ROW_CONFIG_KEY, locale: NS, order: 20, inject: () => ({ ctx }) },
|
|
1414
|
+
(p) => React.createElement(ErrorBoundary, null, React.createElement(CostMeterCard, { ...p, ctx: (p && p.ctx) || ctx })),
|
|
1415
|
+
),
|
|
1416
|
+
)
|
|
1417
|
+
|
|
1399
1418
|
ctx.slots.inject('settings.plugin.item', () =>
|
|
1400
1419
|
ctx.slots.register(
|
|
1401
1420
|
{ name: 'settings.plugin.item', key: NS, locale: NS, order: 20, inject: () => ({ ctx }) },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodandready/dsh-cost-meter",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "DeepSeek Harness plugin: a session cost chip in the conversation header - live token usage by bucket, peak/off-peak tariff, and a countdown to the next tariff switch.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|