@goodandready/dsh-model-sync 0.4.1 → 0.4.3

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 +22 -5
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -386,6 +386,10 @@ window.__ModuleLoader__.load({
386
386
  }
387
387
 
388
388
  const NS = 'dsh-model-sync'
389
+ // Plugins page row seat (DSH 0.1.6-alpha.2): key = '<package name>#<row id>'.
390
+ const PKG = '@goodandready/dsh-model-sync'
391
+ const ROW_ID = 'dsh-model-sync'
392
+ const ROW_CONFIG_KEY = PKG + '#' + ROW_ID
389
393
 
390
394
  function useLocale(ctx) {
391
395
  return React.useSyncExternalStore(
@@ -1227,10 +1231,11 @@ window.__ModuleLoader__.load({
1227
1231
  )
1228
1232
  }
1229
1233
 
1230
- function ModelSyncCard({ ctx }) {
1234
+ function ModelSyncCard({ ctx, view }) {
1231
1235
  const locale = useLocale(ctx)
1232
1236
  const t = locale === 'zh' ? zh : en
1233
- const [open, setOpen] = React.useState(false)
1237
+ const page = view === 'page'
1238
+ const [open, setOpen] = React.useState(!!page)
1234
1239
  const [cardStatus, setCardStatus] = React.useState(null)
1235
1240
  React.useEffect(() => {
1236
1241
  ensureStyles()
@@ -1244,8 +1249,13 @@ window.__ModuleLoader__.load({
1244
1249
  return () => clearInterval(id)
1245
1250
  }, [open])
1246
1251
  const cardBadge = (cardStatus?.lastRun?.results?.reduce((s, r) => s + (r.diff?.added?.length || 0), 0) || 0)
1247
- return React.createElement('li', { className: 'dms-card' + (open ? ' dms-card-open' : '') },
1248
- React.createElement('button', { type: 'button', className: 'dms-card-header', 'aria-expanded': open, 'aria-label': `${t[open ? 'hideSettings' : 'showSettings']}: ${t.title}`, onClick: () => setOpen((value) => !value) },
1252
+ // Row seat (plugins.row.config): the host page draws title/icon/crumb and the
1253
+ // padding, so the summary is a one-liner and the page drops our card chrome.
1254
+ if (view === 'summary') {
1255
+ return React.createElement('span', { className: 'dms-card-description' }, t.desc)
1256
+ }
1257
+ return React.createElement(page ? 'div' : 'li', { className: page ? 'dms-page' : 'dms-card' + (open ? ' dms-card-open' : '') },
1258
+ React.createElement('button', { type: 'button', className: 'dms-card-header', style: page ? { display: 'none' } : undefined, 'aria-expanded': page ? true : open, 'aria-label': `${t[open ? 'hideSettings' : 'showSettings']}: ${t.title}`, onClick: () => setOpen((value) => !value) },
1249
1259
  React.createElement('span', { className: 'dms-card-head-text' },
1250
1260
  React.createElement('span', { className: 'dms-card-name' }, t.title),
1251
1261
  React.createElement('span', { className: 'dms-card-description' }, t.desc)
@@ -1255,7 +1265,7 @@ window.__ModuleLoader__.load({
1255
1265
  React.createElement('path', { d: 'M11.8486 5.5L11.4238 5.92383L8.69727 8.65137C8.44157 8.90706 8.21562 9.13382 8.01172 9.29785C7.79912 9.46883 7.55595 9.61756 7.25 9.66602C7.08435 9.69222 6.91565 9.69222 6.75 9.66602C6.44405 9.61756 6.20088 9.46883 5.98828 9.29785C5.78438 9.13382 5.55843 8.90706 5.30273 8.65137L2.57617 5.92383L2.15137 5.5L3 4.65137L3.42383 5.07617L6.15137 7.80273C6.42595 8.07732 6.59876 8.24849 6.74023 8.3623C6.87291 8.46904 6.92272 8.47813 6.9375 8.48047C6.97895 8.48703 7.02105 8.48703 7.0625 8.48047C7.07728 8.47813 7.12709 8.46904 7.25977 8.3623C7.40124 8.24849 7.57405 8.07732 7.84863 7.80273L10.5762 5.07617L11 4.65137L11.8486 5.5', fill: 'currentColor' })
1256
1266
  )
1257
1267
  ),
1258
- open ? React.createElement('div', { className: 'dms-card-body' }, React.createElement(ErrorBoundary, null, React.createElement(ModelSyncSection, { ctx, includeIntro: false }))) : null
1268
+ (page || open) ? React.createElement('div', { className: 'dms-card-body' }, React.createElement(ErrorBoundary, null, React.createElement(ModelSyncSection, { ctx, includeIntro: false }))) : null
1259
1269
  )
1260
1270
  }
1261
1271
 
@@ -1267,6 +1277,13 @@ window.__ModuleLoader__.load({
1267
1277
  return () => {}
1268
1278
  }, 'dsh-model-sync: dictionaries')
1269
1279
  try {
1280
+ // Plugin-list seat (plugins.item) first: it is the seat the current core
1281
+ // (0.1.6-alpha.2) renders as the plugin's own page with its configuration. The
1282
+ // label is a static string on purpose — it is resolved while the page renders,
1283
+ // and a locale lookup there would take the whole client batch down with it.
1284
+ ctx.slots.inject('plugins.item', () => ctx.slots.register({ name: 'plugins.item', id: ROW_ID, order: 60, label: () => 'Model synchronization', locale: NS, inject: () => ({ ctx }) }, (props) => React.createElement(ErrorBoundary, null, React.createElement(ModelSyncCard, { ...props, ctx }))))
1285
+ // Row seat and the legacy seat stay as fallbacks.
1286
+ ctx.slots.inject('plugins.row.config', () => ctx.slots.register({ name: 'plugins.row.config', key: ROW_CONFIG_KEY, locale: NS, inject: () => ({ ctx }) }, (props) => React.createElement(ErrorBoundary, null, React.createElement(ModelSyncCard, { ...props, ctx }))))
1270
1287
  ctx.slots.inject('settings.plugin.item', () => ctx.slots.register({ name: 'settings.plugin.item', key: NS, locale: NS, inject: () => ({ ctx }) }, (props) => React.createElement(ErrorBoundary, null, React.createElement(ModelSyncCard, { ...props, ctx }))))
1271
1288
  } catch (err) {
1272
1289
  try { console.debug('[dsh-model-sync] slots inject best-effort:', err) } catch { /* console unavailable */ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-model-sync",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "Automatic model catalog synchronization for API-key DeepSeek Harness providers.",
5
5
  "keywords": [
6
6
  "deepseek-harness",