@wwwfz/dsh-agent-bridge 0.0.0-stage → 0.8.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.
@@ -0,0 +1,25 @@
1
+ const currentStatus = /^(?:当前状态|最新交接|current[- _]state|latest[- _]handoff)(?:$|[\s:_-])/i
2
+
3
+ export function describeProjectContext({ memories, skills }) {
4
+ const entries = [...memories.map(asset => describe(asset, 'memory')), ...skills.map(asset => describe(asset, 'skill'))]
5
+ const candidates = entries.filter(item => !item.global && item.group === 'progress' && item.agent !== 'export')
6
+ const named = candidates.filter(item => currentStatus.test(item.name))
7
+ const preferred = named.length ? named : candidates
8
+ const suggestedIds = [
9
+ ...(preferred.length === 1 ? [preferred[0].id] : []),
10
+ ...entries.filter(item => item.group === 'used').slice(0, 3).map(item => item.id),
11
+ ]
12
+ return { entries, suggestedIds }
13
+ }
14
+
15
+ function describe(asset, kind) {
16
+ // The project registry has already verified WorkspaceHub notes against this working directory.
17
+ const hubNote = kind === 'memory' && asset.agent === 'workspacehub' && asset.scope === 'shared'
18
+ const global = asset.scope !== 'project' && !hubNote
19
+ let group
20
+ if (kind === 'skill') group = !global && asset.used ? 'used' : 'skills'
21
+ else if (!global && (asset.detail === '项目交接' || (hubNote && asset.detail?.endsWith(' · 交接')) || currentStatus.test(asset.name))) group = 'progress'
22
+ else if (['用户指引', '项目指引'].includes(asset.detail) && !/^memory$/i.test(asset.name)) group = 'guides'
23
+ else group = 'notes'
24
+ return { ...asset, kind, global, group }
25
+ }