@goodandready/dsh-cost-meter 0.8.4 → 0.8.6

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.
Files changed (2) hide show
  1. package/lib/client.js +21 -6
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -459,7 +459,7 @@ window.__ModuleLoader__.load({
459
459
  const [updateState, setUpdateState] = React.useState({
460
460
  checking: false,
461
461
  updating: false,
462
- currentVersion: '0.8.3',
462
+ currentVersion: '',
463
463
  latestVersion: '',
464
464
  updateAvailable: false,
465
465
  canAutoUpdate: true,
@@ -686,7 +686,7 @@ window.__ModuleLoader__.load({
686
686
  ),
687
687
  React.createElement(Chevron, { open }),
688
688
  ),
689
- open ? React.createElement('div', { className: 'dcm-body' },
689
+ (page || open) ? React.createElement('div', { className: 'dcm-body' },
690
690
  status === 'loading'
691
691
  ? React.createElement('div', { className: 'dcm-hint', style: { padding: '12px 0' } }, t('settings.loading'))
692
692
  : status !== 'ready'
@@ -1014,11 +1014,15 @@ window.__ModuleLoader__.load({
1014
1014
  React.useEffect(() => { ensureStyles() }, [])
1015
1015
 
1016
1016
  const settingsScope = getSettingsScope(ctx)
1017
+ const scope = React.useMemo(
1018
+ () => (settingsScope && typeof settingsScope.bind === 'function' ? settingsScope.bind({ namespace: NS }) : undefined),
1019
+ [settingsScope],
1020
+ )
1017
1021
  const settingsSnap = React.useSyncExternalStore
1018
1022
  ? React.useSyncExternalStore(
1019
- (cb) => (settingsScope && typeof settingsScope.subscribe === 'function' ? settingsScope.subscribe(cb) : () => {}),
1020
- () => (settingsScope && typeof settingsScope.get === 'function' ? settingsScope.get(NS) : null),
1021
- () => null,
1023
+ React.useMemo(() => (cb) => (scope && typeof scope.subscribe === 'function' ? scope.subscribe(cb) : () => {}), [scope]),
1024
+ React.useCallback(() => (scope && typeof scope.getSnapshot === 'function' ? scope.getSnapshot() : (settingsScope && typeof settingsScope.get === 'function' ? settingsScope.get(NS) : null)), [scope, settingsScope]),
1025
+ React.useCallback(() => null, []),
1022
1026
  )
1023
1027
  : null
1024
1028
 
@@ -1407,7 +1411,18 @@ window.__ModuleLoader__.load({
1407
1411
  ),
1408
1412
  )
1409
1413
 
1410
- // Row seat first (the seat the current core renders), legacy seat kept below.
1414
+ // List seat (plugins.item): the seat the Plugins page renders as the plugin's
1415
+ // own page with its configuration. The label is a static string on purpose —
1416
+ // it is resolved while the page renders, and a locale lookup there would take
1417
+ // the whole client batch down with it.
1418
+ ctx.slots.inject('plugins.item', () =>
1419
+ ctx.slots.register(
1420
+ { name: 'plugins.item', id: ROW_ID, order: 20, label: () => 'Cost Meter', locale: NS, inject: () => ({ ctx }) },
1421
+ (p) => React.createElement(ErrorBoundary, null, React.createElement(CostMeterCard, { ...p, ctx: (p && p.ctx) || ctx })),
1422
+ ),
1423
+ )
1424
+
1425
+ // Row seat and the legacy seat kept as fallbacks.
1411
1426
  ctx.slots.inject('plugins.row.config', () =>
1412
1427
  ctx.slots.register(
1413
1428
  { name: 'plugins.row.config', key: ROW_CONFIG_KEY, 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.4",
3
+ "version": "0.8.6",
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",