dsh-agency-agents 0.3.4 → 0.3.5

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 +64 -29
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -140,6 +140,7 @@ window.__ModuleLoader__.load({
140
140
  'legacy.parked': '已停用 {count} 个旧技能(保存在 {target})',
141
141
  'legacy.restore': '恢复旧技能',
142
142
  'legacy.restored': '已恢复 {count} 个旧技能',
143
+ 'config.nav': 'Agency Agents 专家库',
143
144
  'config.summary': '每 {interval} 分钟检查 · 团队上限 {cap} · 自动关闭:{auto}',
144
145
  'config.summaryPending': '正在读取配置…',
145
146
  'config.on': '开',
@@ -282,6 +283,7 @@ window.__ModuleLoader__.load({
282
283
  'legacy.parked': '{count} legacy skill(s) parked in {target}',
283
284
  'legacy.restore': 'Restore legacy skills',
284
285
  'legacy.restored': 'Restored {count} legacy skill(s)',
286
+ 'config.nav': 'Agency Agents roster',
285
287
  'config.summary': 'Checks every {interval} min · team cap {cap} · auto-off: {auto}',
286
288
  'config.summaryPending': 'Loading configuration…',
287
289
  'config.on': 'on',
@@ -533,36 +535,63 @@ animation:aag-spin .8s linear infinite}
533
535
  */
534
536
  function AgencyConfigPage(props) {
535
537
  const t = typeof props.t === 'function' ? props.t : key => key
536
- const provided = props.form
537
- // The row page passes a Host-owned form; the bundle page does not, so fall
538
- // back to the shared client ConfigForms service for the same namespace.
539
- const fetchForm = React.useCallback(() => {
540
- const service = ctx0.get('configForms')
541
- return service?.get?.('agency-agents')
542
- }, [])
543
- const [form] = React.useState(() => provided ?? fetchForm())
544
- const [fallback, setFallback] = React.useState(undefined)
545
- React.useEffect(() => {
546
- if (provided !== undefined || form === undefined) return undefined
547
- setFallback(form.getSnapshot())
548
- return form.subscribe(() => setFallback(form.getSnapshot()))
549
- }, [provided, form])
550
- const snapshot = provided?.state ?? fallback
551
- const values = snapshot?.value
552
- const [draft, setDraft] = React.useState(undefined)
553
- const [busy, setBusy] = React.useState(false)
554
- const [notice, setNotice] = React.useState(undefined)
538
+ // The row page passes a Host-owned form; the bundle and settings pages do not,
539
+ // so fall back to the shared client ConfigForms service. The namespace is
540
+ // found by name, then by the schema field only this plugin declares, and no
541
+ // failure here may take the containing page down.
542
+ const fetchForm = React.useCallback(() => {
543
+ try {
544
+ const service = ctx0.get('configForms')
545
+ if (service === undefined || typeof service.get !== 'function') return undefined
546
+ const names = ['agency-agents']
547
+ if (typeof service.describe === 'function') {
548
+ for (const entry of service.describe() ?? []) {
549
+ const ns = entry?.ns
550
+ if (typeof ns !== 'string') continue
551
+ if (JSON.stringify(entry?.schema ?? {}).includes('githubToken')) names.push(ns)
552
+ }
553
+ }
554
+ for (const ns of names) {
555
+ try {
556
+ const candidate = service.get(ns)
557
+ if (candidate !== undefined && typeof candidate.getSnapshot === 'function') return candidate
558
+ } catch {
559
+ /* try the next namespace */
560
+ }
561
+ }
562
+ } catch {
563
+ /* a host without configForms simply has no form to show */
564
+ }
565
+ return undefined
566
+ }, [])
567
+ const [form] = React.useState(() => provided ?? fetchForm())
568
+ const [fallback, setFallback] = React.useState(undefined)
569
+ React.useEffect(() => {
570
+ if (provided !== undefined || form === undefined) return undefined
571
+ try {
572
+ setFallback(form.getSnapshot())
573
+ return form.subscribe(() => setFallback(form.getSnapshot()))
574
+ } catch {
575
+ return undefined
576
+ }
577
+ }, [provided, form])
578
+ const snapshot = provided?.state ?? fallback
579
+ const values = snapshot?.value
555
580
 
556
- React.useEffect(() => {
557
- if (values === undefined) return
558
- setDraft({
559
- intervalMinutes: values.intervalMinutes,
560
- maxTeamMembers: values.maxTeamMembers,
561
- strictValidation: values.strictValidation === true,
562
- autoTeamMode: values.autoTeamMode !== false,
563
- proxy: values.proxy ?? '',
564
- githubToken: '',
565
- })
581
+ const [draft, setDraft] = React.useState(undefined)
582
+ const [busy, setBusy] = React.useState(false)
583
+ const [notice, setNotice] = React.useState(undefined)
584
+
585
+ React.useEffect(() => {
586
+ if (values === undefined) return
587
+ setDraft({
588
+ intervalMinutes: values.intervalMinutes,
589
+ maxTeamMembers: values.maxTeamMembers,
590
+ strictValidation: values.strictValidation === true,
591
+ autoTeamMode: values.autoTeamMode !== false,
592
+ proxy: values.proxy ?? '',
593
+ githubToken: '',
594
+ })
566
595
  }, [values])
567
596
 
568
597
  if (props.view === 'summary') {
@@ -1654,6 +1683,12 @@ animation:aag-spin .8s linear infinite}
1654
1683
  )
1655
1684
  ctx.slots.inject('plugins.bundle.config', () =>
1656
1685
  ctx.slots.register({ name: 'plugins.bundle.config', key: 'dsh-agency-agents', locale: NS }, AgencyConfigPage),
1686
+ )
1687
+ ctx.slots.inject('settings.section', () =>
1688
+ ctx.slots.register({ name: 'settings.section', id: 'agency-agents', order: 40, label: () => t('config.nav'), locale: NS }, AgencyConfigPage),
1689
+ )
1690
+ ctx.slots.inject('settings.section.icon', () =>
1691
+ ctx.slots.register({ name: 'settings.section.icon', id: 'agency-agents', locale: NS }, AgencyIcon),
1657
1692
  )
1658
1693
  },
1659
1694
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agency-agents",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
 
5
5
  "type": "module",
6
6
  "main": "index.js",