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.
- package/client.js +64 -29
- 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
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
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
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
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
|
}
|