dsh-waifu-agents 0.2.0 → 0.2.1

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/client.js +35 -2
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -307,6 +307,7 @@ window.__ModuleLoader__.load({
307
307
  gone, so the strings are gone: a key left behind is a key a future
308
308
  reader will wire up again. */
309
309
  teamUnitPerson: '人',
310
+ teamUnresolved: '解析失败',
310
311
  teamUnitGroup: '组',
311
312
  teamGone: '已经不存在了',
312
313
  teamClipped: '超出上限被截断',
@@ -546,6 +547,7 @@ window.__ModuleLoader__.load({
546
547
  teamAddPersona: 'add persona',
547
548
  teamAddGroup: 'add group',
548
549
  teamUnitPerson: 'members',
550
+ teamUnresolved: 'unresolved',
549
551
  teamUnitGroup: 'group',
550
552
  teamGone: 'no longer exists',
551
553
  teamClipped: 'clipped by the cap',
@@ -2118,6 +2120,25 @@ window.__ModuleLoader__.load({
2118
2120
  (one.kind === 'group' && groups.includes(one.ref))
2119
2121
  ),
2120
2122
  );
2123
+ /*
2124
+ * The header counts PEOPLE, not picked rows: one group entry can carry
2125
+ * three wives, so `selection.length` printed 「1 人」 for a trio — the
2126
+ * exact number the user then corrected by hand. Resolved the same way
2127
+ * the Host expands: `group:` equality for group entries, the id for
2128
+ * persona entries (the picker only ever stores ids). A stale entry
2129
+ * resolves to nothing here, which is consistent with the grey block
2130
+ * below that says it is gone.
2131
+ */
2132
+ const picked = new Set();
2133
+ for (const one of draft.selection) {
2134
+ if (one.kind === 'group') {
2135
+ for (const row of rows) {
2136
+ if (one.ref !== '' && groupOf(row) === one.ref) picked.add(row.id);
2137
+ }
2138
+ } else if (rows.some((row) => row.id === one.ref)) {
2139
+ picked.add(one.ref);
2140
+ }
2141
+ }
2121
2142
  const named = String(draft.name ?? '') !== '';
2122
2143
  return h(
2123
2144
  'div',
@@ -2174,7 +2195,7 @@ window.__ModuleLoader__.load({
2174
2195
  'div',
2175
2196
  { style: L.sectionHead },
2176
2197
  h('span', { style: L.rowTitle }, t('teamSelection')),
2177
- h('span', { style: L.meta }, `${draft.selection.length} ${t('teamUnitPerson')}`),
2198
+ h('span', { style: L.meta }, `${picked.size} ${t('teamUnitPerson')}`),
2178
2199
  h('span', { style: L.hint }, t('teamSelectionHint')),
2179
2200
  ),
2180
2201
  draft.selection.length === 0
@@ -2326,7 +2347,19 @@ window.__ModuleLoader__.load({
2326
2347
  'div',
2327
2348
  { style: L.head },
2328
2349
  h('span', { style: L.name }, entry.name),
2329
- h('span', { style: L.meta }, `${entry.selection.length} ${t('teamUnitPerson')}`),
2350
+ /*
2351
+ * Resolved headcount, not selection entries: a team picked as one
2352
+ * group of three is 「3 人」, and a drifted group reports the
2353
+ * failure instead of a wrong number — the full error renders
2354
+ * right below in TeamPreview.
2355
+ */
2356
+ h(
2357
+ 'span',
2358
+ { style: L.meta },
2359
+ entry.preview?.ok === true
2360
+ ? `${entry.preview.members.length} ${t('teamUnitPerson')}`
2361
+ : t('teamUnresolved'),
2362
+ ),
2330
2363
  // No preset, no switch: a default has to name something the
2331
2364
  // registry holds, and this team is not registered yet (the sync
2332
2365
  // is in flight, or it failed). Saying which is `teamNoPreset`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-waifu-agents",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "Registers every *.md in a persona directory as an agent preset, and manages them from the Plugins settings page.",
6
6
  "license": "MIT",