@goodandready/dsh-usage-guard 0.1.12 → 0.1.14

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 +31 -7
  2. package/package.json +6 -2
package/lib/client.js CHANGED
@@ -460,8 +460,8 @@ window.__ModuleLoader__.load({
460
460
  React.useEffect(() => {
461
461
  let active = true;
462
462
  try {
463
- const scope = ctx?.settingsScope && typeof ctx.settingsScope.bind === 'function'
464
- ? ctx.settingsScope.bind({ namespace: NS })
463
+ const scope = ctx?.configForms && typeof ctx.configForms.get === 'function'
464
+ ? ctx.configForms.get(NS)
465
465
  : null;
466
466
  if (!scope) {
467
467
  setSnap({ status: 'unavailable', value: {} });
@@ -547,10 +547,10 @@ window.__ModuleLoader__.load({
547
547
  };
548
548
 
549
549
  const onSave = async () => {
550
- if (!ctx?.settingsScope || typeof ctx.settingsScope.bind !== 'function') return;
550
+ if (!ctx?.configForms || typeof ctx.configForms.get !== 'function') return;
551
551
  setSaving(true);
552
552
  try {
553
- const scope = ctx.settingsScope.bind({ namespace: NS });
553
+ const scope = ctx.configForms.get(NS);
554
554
  const errs = [];
555
555
  for (const k of ['repair', 'report', 'maxStepTokens']) {
556
556
  try {
@@ -790,7 +790,7 @@ window.__ModuleLoader__.load({
790
790
  function refreshMirrorUntilVisible(c) {
791
791
  const visible = () => {
792
792
  try {
793
- const s = (c?.get && c.get('lanSettings')) || c?.settingsScope;
793
+ const s = (c?.get && c.get('lanSettings')) || c?.configForms;
794
794
  const view = s?.describe?.()?.getSnapshot?.()?.view;
795
795
  return !!view && Array.isArray(view.namespaces) && view.namespaces.some((row) => row.ns === NS);
796
796
  } catch (_) {
@@ -806,7 +806,7 @@ window.__ModuleLoader__.load({
806
806
  }
807
807
  tries += 1;
808
808
  try {
809
- const s = (c?.get && c.get('lanSettings')) || c?.settingsScope;
809
+ const s = (c?.get && c.get('lanSettings')) || c?.configForms;
810
810
  s?.describe?.()?.load?.();
811
811
  } catch (err) {
812
812
  if (typeof console !== 'undefined' && console.warn) {
@@ -878,6 +878,30 @@ window.__ModuleLoader__.load({
878
878
  }
879
879
  }
880
880
 
881
+ // Plugin-list seat (plugins.item) first: the seat the current core
882
+ // (0.1.6-alpha.2) renders as the plugin's own page with its configuration. The
883
+ // label is a static string on purpose — it is resolved while the page renders,
884
+ // and a locale lookup there would take the whole client batch down with it.
885
+ registerSlotWhenReady('plugins.item', () =>
886
+ ctx.slots.register(
887
+ {
888
+ name: 'plugins.item',
889
+ id: ROW_ID,
890
+ order: 60,
891
+ label: () => 'Usage Guard',
892
+ locale: NS,
893
+ inject: () => ({ ctx }),
894
+ },
895
+ (props) =>
896
+ React.createElement(
897
+ ErrorBoundary,
898
+ null,
899
+ React.createElement(PluginCard, { ...props, ctx: (props && props.ctx) || ctx })
900
+ )
901
+ )
902
+ )
903
+
904
+ // Row seat and the legacy seat stay as fallbacks.
881
905
  registerSlotWhenReady('plugins.row.config', () =>
882
906
  ctx.slots.register(
883
907
  {
@@ -915,7 +939,7 @@ window.__ModuleLoader__.load({
915
939
 
916
940
  module.exports = {
917
941
  apply,
918
- inject: ['slots', 'locale', 'settingsScope'],
942
+ inject: ['slots', 'locale', 'configForms'],
919
943
  makeT,
920
944
  ensureCss,
921
945
  createErrorBoundary,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-usage-guard",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Keeps a malformed token-usage sample from taking a whole session history down with it: a missing or non-numeric counter becomes zero before the harness adds it up, so the fold never yields NaN and already-broken sessions open again.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -44,7 +44,11 @@
44
44
  },
45
45
  "client": {
46
46
  "platform": "web",
47
- "inject": []
47
+ "inject": [
48
+ "@deepseek-ai/dsh-client-ui-slots",
49
+ "@deepseek-ai/dsh-client-locale",
50
+ "@deepseek-ai/dsh-client-ui-settings"
51
+ ]
48
52
  }
49
53
  },
50
54
  "peerDependencies": {