dsh-skill-hub 0.3.7 → 0.3.8

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 (109) hide show
  1. package/README.md +40 -50
  2. package/README.zh.md +38 -48
  3. package/lib/client.js +2209 -1820
  4. package/lib/client.js.map +1 -1
  5. package/lib/index.js +653 -419
  6. package/lib/types/client/SkillHubSettingsCard.d.ts +1 -0
  7. package/lib/types/client/api.d.ts +12 -6
  8. package/lib/types/client/helpers.d.ts +0 -1
  9. package/lib/types/client/locales/common.d.ts +52 -0
  10. package/lib/types/client/locales/detail.d.ts +16 -0
  11. package/lib/types/client/locales/market.d.ts +73 -0
  12. package/lib/types/client/locales/settings.d.ts +41 -0
  13. package/lib/types/client/locales/skills.d.ts +65 -0
  14. package/lib/types/client/locales/sources.d.ts +35 -0
  15. package/lib/types/client/locales.d.ts +124 -118
  16. package/lib/types/client/panel/MarketSourceRow.d.ts +12 -0
  17. package/lib/types/client/panel/MarketView.d.ts +1 -0
  18. package/lib/types/client/panel/RepoScanCard.d.ts +10 -0
  19. package/lib/types/client/panel/hooks/shared.d.ts +72 -0
  20. package/lib/types/client/panel/hooks/useCatalogFlow.d.ts +62 -0
  21. package/lib/types/client/panel/hooks/useGroupFlow.d.ts +41 -0
  22. package/lib/types/client/panel/hooks/useMarketFlow.d.ts +73 -0
  23. package/lib/types/client/panel/hooks/useMetaFlow.d.ts +18 -0
  24. package/lib/types/client/panel/hooks/useSourceFlow.d.ts +44 -0
  25. package/lib/types/client/panel/market-format.d.ts +6 -0
  26. package/lib/types/client/panel/useSkillHub.d.ts +45 -73
  27. package/lib/types/client/settings-card.d.ts +20 -0
  28. package/lib/types/client/settings-form.d.ts +6 -0
  29. package/lib/types/protocol/api.d.ts +38 -0
  30. package/lib/types/protocol/catalog.d.ts +155 -0
  31. package/lib/types/protocol/config.d.ts +113 -0
  32. package/lib/types/protocol/groups.d.ts +95 -0
  33. package/lib/types/protocol/market.d.ts +94 -0
  34. package/lib/types/protocol/repo.d.ts +107 -0
  35. package/lib/types/protocol/sources.d.ts +139 -0
  36. package/lib/types/protocol/stats.d.ts +46 -0
  37. package/lib/types/protocol.d.ts +13 -743
  38. package/lib/types/repo/github-client.d.ts +42 -0
  39. package/lib/types/repo.d.ts +6 -17
  40. package/lib/types/routes/catalog.d.ts +7 -0
  41. package/lib/types/routes/config.d.ts +7 -0
  42. package/lib/types/routes/groups.d.ts +7 -0
  43. package/lib/types/routes/helpers.d.ts +145 -0
  44. package/lib/types/routes/market.d.ts +8 -0
  45. package/lib/types/routes/repo-import.d.ts +7 -0
  46. package/lib/types/routes/route-state.d.ts +55 -0
  47. package/lib/types/routes/sources.d.ts +8 -0
  48. package/lib/types/routes.d.ts +5 -34
  49. package/lib/types/stats.d.ts +3 -2
  50. package/lib/types/store/errors.d.ts +10 -0
  51. package/lib/types/store/migrate.d.ts +44 -0
  52. package/lib/types/store/paths.d.ts +32 -0
  53. package/lib/types/store/store.d.ts +133 -0
  54. package/lib/types/store.d.ts +7 -146
  55. package/package.json +28 -27
  56. package/src/client/SkillHubSettingsCard.tsx +17 -3
  57. package/src/client/api.ts +101 -195
  58. package/src/client/helpers.ts +10 -1
  59. package/src/client/locales/common.ts +102 -0
  60. package/src/client/locales/detail.ts +30 -0
  61. package/src/client/locales/market.ts +144 -0
  62. package/src/client/locales/settings.ts +80 -0
  63. package/src/client/locales/skills.ts +128 -0
  64. package/src/client/locales/sources.ts +68 -0
  65. package/src/client/locales.ts +26 -512
  66. package/src/client/panel/MarketSourceRow.tsx +108 -0
  67. package/src/client/panel/MarketView.tsx +12 -253
  68. package/src/client/panel/RepoScanCard.tsx +171 -0
  69. package/src/client/panel/hooks/shared.ts +81 -0
  70. package/src/client/panel/hooks/useCatalogFlow.ts +211 -0
  71. package/src/client/panel/hooks/useGroupFlow.ts +240 -0
  72. package/src/client/panel/hooks/useMarketFlow.ts +421 -0
  73. package/src/client/panel/hooks/useMetaFlow.ts +58 -0
  74. package/src/client/panel/hooks/useSourceFlow.ts +193 -0
  75. package/src/client/panel/market-format.ts +22 -0
  76. package/src/client/panel/useSkillHub.ts +141 -1032
  77. package/src/client/settings-card.tsx +51 -0
  78. package/src/client/settings-form.ts +18 -0
  79. package/src/index.ts +14 -4
  80. package/src/protocol/api.ts +38 -0
  81. package/src/protocol/catalog.ts +168 -0
  82. package/src/protocol/config.ts +145 -0
  83. package/src/protocol/groups.ts +106 -0
  84. package/src/protocol/market.ts +100 -0
  85. package/src/protocol/repo.ts +104 -0
  86. package/src/protocol/sources.ts +146 -0
  87. package/src/protocol/stats.ts +42 -0
  88. package/src/protocol.ts +83 -809
  89. package/src/repo/github-client.ts +131 -0
  90. package/src/repo.test.ts +24 -1
  91. package/src/repo.ts +50 -170
  92. package/src/routes/catalog.ts +309 -0
  93. package/src/routes/config.ts +119 -0
  94. package/src/routes/groups.ts +133 -0
  95. package/src/routes/helpers.ts +489 -0
  96. package/src/routes/market.ts +255 -0
  97. package/src/routes/repo-import.ts +267 -0
  98. package/src/routes/route-state.ts +89 -0
  99. package/src/routes/sources.ts +318 -0
  100. package/src/routes.test.ts +20 -0
  101. package/src/routes.ts +21 -1699
  102. package/src/stats.test.ts +58 -3
  103. package/src/stats.ts +45 -16
  104. package/src/store/errors.ts +14 -0
  105. package/src/store/migrate.ts +272 -0
  106. package/src/store/paths.ts +43 -0
  107. package/src/store/store.ts +532 -0
  108. package/src/store.test.ts +18 -0
  109. package/src/store.ts +7 -737
@@ -1,34 +1,90 @@
1
1
  /**
2
- * dsh-skill-hub surface copy (zh/en). The dictionary type is re-exported
3
- * so the LocaleNamespaceMap module augmentation in client/index.ts can
4
- * reference it without a value import.
2
+ * locales 按视图拆分后的聚合入口:各域字典在 ./locales/<domain>.ts,
3
+ * 这里合并为面板消费的 zh/en。老 `from './locales.ts'` 写法保持可用,
4
+ * HubKey 的完备性仍由 `en: Record<HubKey, string>` 在类型层兜底
5
+ * (缺键即编译报错)。
5
6
  */
6
7
  export declare const zh: {
7
- readonly 'entry.label': "技能";
8
- readonly 'entry.tooltip': "技能中枢:浏览、分组与同步管理本地技能";
9
- readonly 'view.sources': "来源";
10
- readonly 'view.scenes': "场景";
11
- readonly 'view.market': "市场";
12
- readonly 'view.flat': "平铺";
13
- readonly 'view.grouped': "分组";
14
- readonly 'panel.title': "技能中枢";
15
- readonly 'panel.count': "共 {count} 个技能";
16
- readonly 'panel.disabledCount': "已禁用 {count}";
17
- readonly 'panel.new': "新建技能";
18
- readonly 'panel.search': "搜索技能…";
19
- readonly 'legend.model': "模型可调 — Agent 可自动调用";
20
- readonly 'legend.user': "用户可调 — 仅显式点名时触发";
21
- readonly 'legend.hint': "每个技能最多一个圆点;无圆点 = 不可被调用。";
22
- readonly 'panel.enabled': "已启用";
23
- readonly 'panel.disabled': "已禁用";
24
- readonly 'panel.diagnostics': "发现诊断";
25
- readonly 'panel.empty': "没有匹配的技能。";
26
- readonly 'panel.emptyAll': "本地还没有技能。点击「新建技能」创建第一个。";
27
- readonly 'panel.loading': "读取中…";
28
- readonly 'panel.incomplete': "(目录可能不完整)";
29
- readonly 'panel.workspacePlaceholder': "工作区路径(回车应用)";
30
- readonly 'panel.workspaceHint': "填写项目路径后,面板同时显示该项目 .dsh/skills 与 .agents/skills 下的技能(只读);留空回车恢复用户级视图。";
31
- readonly 'panel.workspaceClear': "清除工作区";
8
+ readonly 'settings.title': "技能中枢";
9
+ readonly 'settings.description': "管理 dsh 本地技能目录:浏览、分组、来源同步与新建。";
10
+ readonly 'settings.enabled': "启用插件";
11
+ readonly 'settings.enabledHint': "关闭后技能中枢的路由、入口与公告全部下线。";
12
+ readonly 'settings.announceToAgent': "向 Agent 公告";
13
+ readonly 'settings.announceToAgentHint': "在系统提示中加入本插件说明,用户提到技能管理时 Agent 知道如何协作。";
14
+ readonly 'settings.dotModelColor': "模型可调圆点颜色";
15
+ readonly 'settings.dotModelColorHint': "技能行/聊天 / 菜单中「模型可调」蓝色圆点的颜色(#rrggbb)。";
16
+ readonly 'settings.dotUserColor': "用户可调圆点颜色";
17
+ readonly 'settings.dotUserColorHint': "技能行/聊天 / 菜单中「仅用户可调」绿色圆点的颜色(#rrggbb)。";
18
+ readonly 'settings.showUseCount': "显示调用次数";
19
+ readonly 'settings.showUseCountHint': "在技能名旁显示琥珀色调用次数。";
20
+ readonly 'settings.showUseTime': "显示最近调用时间";
21
+ readonly 'settings.showUseTimeHint': "在技能名行右侧显示相对时间(如「3 天前」)。";
22
+ readonly 'settings.showGroupSummary': "显示分组汇总";
23
+ readonly 'settings.showGroupSummaryHint': "在分组标题后汇总调用次数与最近调用时间。";
24
+ readonly 'settings.statsWindowDays': "统计窗口(天)";
25
+ readonly 'settings.statsWindowDaysHint': "只统计最近 N 天的使用次数,默认 14 天;0 = 全部历史。改动立即生效。";
26
+ readonly 'settings.statsScanMinutes': "自动统计间隔(分钟)";
27
+ readonly 'settings.statsScanMinutesHint': "后台扫描会话日志的间隔,最小 1 分钟;扫描耗时会自动拉长间隔。";
28
+ readonly 'settings.githubToken': "GitHub Token";
29
+ readonly 'settings.githubTokenHint': "市场/来源走 GitHub API,匿名每小时 60 次,填 token 后 5000 次。细粒度 token 无需任何权限。明文存本地设置,仅回环可读;留空即匿名(或跟随 GITHUB_TOKEN 环境变量)。";
30
+ readonly 'settings.githubTokenPlaceholder': "ghp_… / github_pat_…(留空为匿名)";
31
+ readonly 'settings.inherit': "继承";
32
+ readonly 'settings.on': "开";
33
+ readonly 'settings.off': "关";
34
+ readonly 'settings.overridden': "已覆盖";
35
+ readonly 'settings.reset': "恢复默认";
36
+ readonly 'settings.unsaved': "未保存";
37
+ readonly 'settings.save': "保存";
38
+ readonly 'settings.saving': "保存中…";
39
+ readonly 'settings.discard': "放弃修改";
40
+ readonly 'settings.saveFailed': "本部署没有接受这些值,已保留供你修改。";
41
+ readonly 'settings.readOnly': "本部署的设置为只读。";
42
+ readonly 'settings.notExposed': "本部署没有挂载该设置命名空间。";
43
+ readonly 'settings.collapse': "收起设置";
44
+ readonly 'settings.expand': "展开设置";
45
+ readonly 'detail.copyMention': "复制 $mention";
46
+ readonly 'detail.copyPath': "复制路径";
47
+ readonly 'detail.copied': "已复制";
48
+ readonly 'detail.back': "返回列表";
49
+ readonly 'detail.provider': "提供者";
50
+ readonly 'detail.addedAt': "添加时间";
51
+ readonly 'detail.updatedAt': "更新时间";
52
+ readonly 'detail.path': "路径";
53
+ readonly 'detail.whenToUse': "适用场景";
54
+ readonly 'detail.uses': "调用次数";
55
+ readonly 'detail.groups': "所属场景";
56
+ readonly 'detail.loading': "读取技能正文…";
57
+ readonly 'delete.confirmTitle': "移入回收站?";
58
+ readonly 'delete.confirmText': "确定把「{name}」移入回收站吗?可随时恢复。";
59
+ readonly 'delete.confirm': "移入回收站";
60
+ readonly 'source.private': "个人技能(未绑定上游,不检查更新)";
61
+ readonly 'source.commit': "已同步版本";
62
+ readonly 'source.unverified': "尚未核对上游";
63
+ readonly 'source.check': "检查更新";
64
+ readonly 'source.checkHint': "点击检查上游更新";
65
+ readonly 'source.checking': "检查中…";
66
+ readonly 'source.upToDate': "已是最新";
67
+ readonly 'source.updated': "有更新 {count} 个";
68
+ readonly 'source.deleted': "上游已删除 {count} 个";
69
+ readonly 'source.error': "检查失败";
70
+ readonly 'source.throttled': "刚刚检查过";
71
+ readonly 'source.sync': "同步";
72
+ readonly 'source.syncing': "同步中…";
73
+ readonly 'source.syncConfirmTitle': "同步技能?";
74
+ readonly 'source.syncConfirmText': "将用上游最新版本覆盖本地对以下技能的所有修改:";
75
+ readonly 'source.followDelete': "跟进删除";
76
+ readonly 'source.deleteConfirmTitle': "跟进上游删除?";
77
+ readonly 'source.deleteConfirmText': "以下技能已从上游仓库移除,本地目录将移入回收站(可恢复):";
78
+ readonly 'source.deleteGroup': "删除整组";
79
+ readonly 'source.deleteGroupHint': "删除该分组下的全部 {count} 个技能";
80
+ readonly 'source.deleteGroupTitle': "删除整组?";
81
+ readonly 'source.deleteGroupText': "将把分组“{name}”下的全部 {count} 个技能移入回收站(可恢复),只读技能会跳过:";
82
+ readonly 'source.trash': "回收站";
83
+ readonly 'source.restore': "恢复";
84
+ readonly 'source.clearTrash': "清空回收站";
85
+ readonly 'source.clearTrashConfirmTitle': "清空回收站?";
86
+ readonly 'source.clearTrashConfirmText': "回收站里的技能会被永久删除,无法恢复。此操作不可撤销。";
87
+ readonly 'source.clearTrashConfirm': "永久删除";
32
88
  readonly 'market.addPlaceholder': "owner/repo 或 https://github.com/…";
33
89
  readonly 'market.addSource': "添加源";
34
90
  readonly 'market.noSources': "还没有市场源。从下方内置市场添加,或输入一个 GitHub 仓库。";
@@ -73,6 +129,8 @@ export declare const zh: {
73
129
  readonly 'market.versionConfirm': "切换到 {ref}";
74
130
  readonly 'market.versionHint': "点击切换跟踪版本";
75
131
  readonly 'market.unpinned': "未定版";
132
+ readonly 'market.starsHint': "GitHub 星标 {count} 个";
133
+ readonly 'market.downloadsHint': "发布附件累计下载 {count} 次";
76
134
  readonly 'market.syncTitle': "同步本地技能";
77
135
  readonly 'market.syncText': "市场源已对齐到 {ref},要同步更新以下本地技能吗?";
78
136
  readonly 'market.syncNone': "该来源还没有导入本地技能。";
@@ -96,14 +154,6 @@ export declare const zh: {
96
154
  readonly 'repo.root.skills': "技能 skills";
97
155
  readonly 'repo.root.designTemplates': "模板 design-templates";
98
156
  readonly 'repo.root.generic': "{root}";
99
- readonly 'update.check': "检查更新";
100
- readonly 'update.checking': "检查中…";
101
- readonly 'update.upToDate': "已是最新版本 v{version}";
102
- readonly 'update.available': "发现新版本 v{version}(当前 v{current})";
103
- readonly 'update.newVersion': "新版本 v{version}";
104
- readonly 'update.viewRelease': "查看发布";
105
- readonly 'update.error': "检查更新失败:{error}";
106
- readonly 'update.unavailable': "暂无可用的发布版本";
107
157
  readonly 'group.project-dsh': "项目 .dsh/skills";
108
158
  readonly 'group.project-agents': "项目 .agents/skills";
109
159
  readonly 'group.custom': "自定义目录";
@@ -158,13 +208,6 @@ export declare const zh: {
158
208
  readonly 'row.copyMention': "复制 $mention";
159
209
  readonly 'row.copied': "已复制";
160
210
  readonly 'row.copyPath': "复制路径";
161
- readonly 'detail.copyMention': "复制 $mention";
162
- readonly 'detail.copyPath': "复制路径";
163
- readonly 'detail.copied': "已复制";
164
- readonly 'diag.fix': "修复";
165
- readonly 'diag.fixing': "修复中…";
166
- readonly 'diag.fixed': "已修复";
167
- readonly 'diag.fixConfirm': "用自动修复重写以下文件的 frontmatter?建议先备份:{path}";
168
211
  readonly 'filter.invocation': "调用";
169
212
  readonly 'filter.invocationAll': "全部调用";
170
213
  readonly 'filter.modelOnly': "模型可调";
@@ -172,46 +215,43 @@ export declare const zh: {
172
215
  readonly 'filter.showing': "显示 {shown}/{total}(已启用){filtered}";
173
216
  readonly 'filter.filteredSuffix': " · 已筛选";
174
217
  readonly 'filter.shortened': "短描述 {count} 条,悬浮看全文";
175
- readonly 'delete.confirmTitle': "移入回收站?";
176
- readonly 'delete.confirmText': "确定把「{name}」移入回收站吗?可随时恢复。";
177
- readonly 'delete.confirm': "移入回收站";
178
- readonly 'detail.back': "返回列表";
179
- readonly 'detail.provider': "提供者";
180
- readonly 'detail.addedAt': "添加时间";
181
- readonly 'detail.updatedAt': "更新时间";
182
- readonly 'detail.path': "路径";
183
- readonly 'detail.whenToUse': "适用场景";
184
- readonly 'detail.uses': "调用次数";
185
- readonly 'detail.groups': "所属场景";
186
- readonly 'detail.loading': "读取技能正文…";
187
- readonly 'source.private': "个人技能(未绑定上游,不检查更新)";
188
- readonly 'source.commit': "已同步版本";
189
- readonly 'source.unverified': "尚未核对上游";
190
- readonly 'source.check': "检查更新";
191
- readonly 'source.checkHint': "点击检查上游更新";
192
- readonly 'source.checking': "检查中…";
193
- readonly 'source.upToDate': "已是最新";
194
- readonly 'source.updated': "有更新 {count} 个";
195
- readonly 'source.deleted': "上游已删除 {count} 个";
196
- readonly 'source.error': "检查失败";
197
- readonly 'source.throttled': "刚刚检查过";
198
- readonly 'source.sync': "同步";
199
- readonly 'source.syncing': "同步中…";
200
- readonly 'source.syncConfirmTitle': "同步技能?";
201
- readonly 'source.syncConfirmText': "将用上游最新版本覆盖本地对以下技能的所有修改:";
202
- readonly 'source.followDelete': "跟进删除";
203
- readonly 'source.deleteConfirmTitle': "跟进上游删除?";
204
- readonly 'source.deleteConfirmText': "以下技能已从上游仓库移除,本地目录将移入回收站(可恢复):";
205
- readonly 'source.deleteGroup': "删除整组";
206
- readonly 'source.deleteGroupHint': "删除该分组下的全部 {count} 个技能";
207
- readonly 'source.deleteGroupTitle': "删除整组?";
208
- readonly 'source.deleteGroupText': "将把分组“{name}”下的全部 {count} 个技能移入回收站(可恢复),只读技能会跳过:";
209
- readonly 'source.trash': "回收站";
210
- readonly 'source.restore': "恢复";
211
- readonly 'source.clearTrash': "清空回收站";
212
- readonly 'source.clearTrashConfirmTitle': "清空回收站?";
213
- readonly 'source.clearTrashConfirmText': "回收站里的技能会被永久删除,无法恢复。此操作不可撤销。";
214
- readonly 'source.clearTrashConfirm': "永久删除";
218
+ readonly 'entry.label': "技能";
219
+ readonly 'entry.tooltip': "技能中枢:浏览、分组与同步管理本地技能";
220
+ readonly 'view.sources': "来源";
221
+ readonly 'view.scenes': "场景";
222
+ readonly 'view.market': "市场";
223
+ readonly 'view.flat': "平铺";
224
+ readonly 'view.grouped': "分组";
225
+ readonly 'panel.title': "技能中枢";
226
+ readonly 'panel.count': "共 {count} 个技能";
227
+ readonly 'panel.disabledCount': "已禁用 {count}";
228
+ readonly 'panel.new': "新建技能";
229
+ readonly 'panel.search': "搜索技能…";
230
+ readonly 'legend.model': "模型可调 — Agent 可自动调用";
231
+ readonly 'legend.user': "用户可调 — 仅显式点名时触发";
232
+ readonly 'legend.hint': "每个技能最多一个圆点;无圆点 = 不可被调用。";
233
+ readonly 'panel.enabled': "已启用";
234
+ readonly 'panel.disabled': "已禁用";
235
+ readonly 'panel.diagnostics': "发现诊断";
236
+ readonly 'panel.empty': "没有匹配的技能。";
237
+ readonly 'panel.emptyAll': "本地还没有技能。点击「新建技能」创建第一个。";
238
+ readonly 'panel.loading': "读取中…";
239
+ readonly 'panel.incomplete': "(目录可能不完整)";
240
+ readonly 'panel.workspacePlaceholder': "工作区路径(回车应用)";
241
+ readonly 'panel.workspaceHint': "填写项目路径后,面板同时显示该项目 .dsh/skills 与 .agents/skills 下的技能(只读);留空回车恢复用户级视图。";
242
+ readonly 'panel.workspaceClear': "清除工作区";
243
+ readonly 'update.check': "检查更新";
244
+ readonly 'update.checking': "检查中…";
245
+ readonly 'update.upToDate': "已是最新版本 v{version}";
246
+ readonly 'update.available': "发现新版本 v{version}(当前 v{current})";
247
+ readonly 'update.newVersion': "新版本 v{version}";
248
+ readonly 'update.viewRelease': "查看发布";
249
+ readonly 'update.error': "检查更新失败:{error}";
250
+ readonly 'update.unavailable': "暂无可用的发布版本";
251
+ readonly 'diag.fix': "修复";
252
+ readonly 'diag.fixing': "修复中…";
253
+ readonly 'diag.fixed': "已修复";
254
+ readonly 'diag.fixConfirm': "用自动修复重写以下文件的 frontmatter?建议先备份:{path}";
215
255
  readonly 'form.capabilityHint': "能力怎么选:重复方法 → 技能;外部系统 → MCP;长期资料 → 知识库。";
216
256
  readonly 'form.descPlaceholder': "一句话说明用途(含触发词),Agent 靠它自动激活技能";
217
257
  readonly 'form.name': "技能名(kebab-case,如 code-review)";
@@ -223,44 +263,10 @@ export declare const zh: {
223
263
  readonly 'form.success': "已创建:";
224
264
  readonly 'form.error': "创建失败:";
225
265
  readonly 'err.dismiss': "知道了";
226
- readonly 'settings.title': "技能中枢";
227
- readonly 'settings.description': "管理 dsh 本地技能目录:浏览、分组、来源同步与新建。";
228
- readonly 'settings.enabled': "启用插件";
229
- readonly 'settings.enabledHint': "关闭后技能中枢的路由、入口与公告全部下线。";
230
- readonly 'settings.announceToAgent': "向 Agent 公告";
231
- readonly 'settings.announceToAgentHint': "在系统提示中加入本插件说明,用户提到技能管理时 Agent 知道如何协作。";
232
- readonly 'settings.dotModelColor': "模型可调圆点颜色";
233
- readonly 'settings.dotModelColorHint': "技能行/聊天 / 菜单中「模型可调」蓝色圆点的颜色(#rrggbb)。";
234
- readonly 'settings.dotUserColor': "用户可调圆点颜色";
235
- readonly 'settings.dotUserColorHint': "技能行/聊天 / 菜单中「仅用户可调」绿色圆点的颜色(#rrggbb)。";
236
- readonly 'settings.showUseCount': "显示调用次数";
237
- readonly 'settings.showUseCountHint': "在技能名旁显示琥珀色调用次数。";
238
- readonly 'settings.showUseTime': "显示最近调用时间";
239
- readonly 'settings.showUseTimeHint': "在技能名行右侧显示相对时间(如「3 天前」)。";
240
- readonly 'settings.showGroupSummary': "显示分组汇总";
241
- readonly 'settings.showGroupSummaryHint': "在分组标题后汇总调用次数与最近调用时间。";
242
- readonly 'settings.statsWindowDays': "统计窗口(天)";
243
- readonly 'settings.statsWindowDaysHint': "只统计最近 N 天的使用次数,默认 14 天;0 = 全部历史。改动立即生效。";
244
- readonly 'settings.statsScanMinutes': "自动统计间隔(分钟)";
245
- readonly 'settings.statsScanMinutesHint': "后台扫描会话日志的间隔,最小 1 分钟;扫描耗时会自动拉长间隔。";
246
- readonly 'settings.inherit': "继承";
247
- readonly 'settings.on': "开";
248
- readonly 'settings.off': "关";
249
- readonly 'settings.overridden': "已覆盖";
250
- readonly 'settings.reset': "恢复默认";
251
- readonly 'settings.unsaved': "未保存";
252
- readonly 'settings.save': "保存";
253
- readonly 'settings.saving': "保存中…";
254
- readonly 'settings.discard': "放弃修改";
255
- readonly 'settings.saveFailed': "本部署没有接受这些值,已保留供你修改。";
256
- readonly 'settings.readOnly': "本部署的设置为只读。";
257
- readonly 'settings.notExposed': "本部署没有挂载该设置命名空间。";
258
- readonly 'settings.collapse': "收起设置";
259
- readonly 'settings.expand': "展开设置";
260
266
  };
261
- export declare const en: Record<HubKey, string>;
262
267
  /** Union of every translatable key (the namespace's registered dictionary type). */
263
268
  export type HubKey = keyof typeof zh;
269
+ export declare const en: Record<HubKey, string>;
264
270
  /** Template values accepted by the interpolator. */
265
271
  export type TranslateValues = Record<string, string | number>;
266
272
  /** Interpolate a {name} template with the given values. */
@@ -0,0 +1,12 @@
1
+ /**
2
+ * MarketSourceRow — 一个已添加来源的完整行:状态徽章 + 操作按钮。
3
+ * B 方案:扫描主按钮 + 智能更新按钮(检查/更新二合一)+ 溢出移除。
4
+ * 从 MarketView.ts 原样搬出,渲染逻辑不变。
5
+ */
6
+ import type { JSX } from 'react';
7
+ import type { MarketSourceRecord } from '../../protocol.ts';
8
+ import type { SkillHubState } from './useSkillHub.ts';
9
+ export declare function MarketSourceRow(props: {
10
+ hub: SkillHubState;
11
+ record: MarketSourceRecord;
12
+ }): JSX.Element;
@@ -3,6 +3,7 @@
3
3
  * button while not yet added) and the user's market sources (full state
4
4
  * badges + actions once added, plus custom sources), with check-all and
5
5
  * update-all actions and the repo scan result with the importable checklist.
6
+ * 行渲染在 MarketSourceRow,扫描卡片在 RepoScanCard,数字格式在 market-format。
6
7
  */
7
8
  import { type JSX } from 'react';
8
9
  import type { SkillHubState } from './useSkillHub.ts';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * RepoScanCard — 扫描结果归属卡片:扫描中/错误/就绪(搜索+过滤+分页+
3
+ * 勾选导入+进度+结果)都包在这里。搜索/过滤/分页是卡片级本地状态,
4
+ * 随卡片挂载而生、关闭而灭。从 MarketView.tsx 原样搬出,渲染逻辑不变。
5
+ */
6
+ import { type JSX } from 'react';
7
+ import type { SkillHubState } from './useSkillHub.ts';
8
+ export declare function RepoScanCard(props: {
9
+ hub: SkillHubState;
10
+ }): JSX.Element | null;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * hooks 共享层:域 hooks 之间传递的通知接口、状态机类型、轮询常量、
3
+ * 每日自动检查 helpers。从 useSkillHub.ts 原样搬出,行为不变。
4
+ */
5
+ import type { MarketCheckResponse, MarketSourceRecord, RepoDiscoverResponse, UpdateCheckResponse } from '../../../protocol.ts';
6
+ /**
7
+ * 跨域共享的通知原语:聚合根用稳定的 setState setter 实现一次,
8
+ * 各域 hooks 只调接口,不直接碰别人的 state。对象本身经 useMemo
9
+ * 常驻,域回调的 useCallback 依赖它不会失稳。
10
+ */
11
+ export interface FlowNotices {
12
+ /** 报错条幅(覆盖旧报错)。 */
13
+ fail: (message: string) => void;
14
+ /** 清掉报错条幅。 */
15
+ clearFail: () => void;
16
+ /** 成功条幅(null = 清掉)。 */
17
+ succeed: (message: string | null) => void;
18
+ /** tag 域忙碌开关(多域共用)。 */
19
+ setTagBusy: (busy: boolean) => void;
20
+ /** 整组操作忙碌开关(toggle-batch 与全部更新共用)。 */
21
+ setBatchBusy: (busy: boolean) => void;
22
+ }
23
+ /** Catalog poll interval while the panel is mounted (the provider watcher feeds this). */
24
+ export declare const POLL_MS = 5000;
25
+ /** Relaxed poll for slower-changing data (stats, groups, sources, config). */
26
+ export declare const SLOW_POLL_MS = 60000;
27
+ /** 空统计补捞上限:冷启动全量扫描(数十 MB 会话日志)可能超过 2 分钟,72 次约 6 分钟内保持 5 秒粒度,之后交回 60 秒慢轮询。 */
28
+ export declare const USES_CATCH_UP_MAX = 72;
29
+ /** localStorage key of the last daily auto-check timestamp (survives sessions). */
30
+ export declare const AUTO_CHECK_KEY = "skill-hub.last-auto-check";
31
+ /** Daily auto-check interval: at most one network round per day. */
32
+ export declare const AUTO_CHECK_INTERVAL_MS: number;
33
+ /** Whether the daily auto-check should run now (first visit or ≥24h since the last). */
34
+ export declare function shouldAutoCheck(): boolean;
35
+ /** Record that the daily auto-check ran. */
36
+ export declare function markAutoChecked(): void;
37
+ /** One-shot self-update check state. */
38
+ export type UpdateState = {
39
+ status: 'idle';
40
+ } | {
41
+ status: 'checking';
42
+ } | {
43
+ status: 'ready';
44
+ data: UpdateCheckResponse;
45
+ } | {
46
+ status: 'error';
47
+ message: string;
48
+ };
49
+ /** Repo scanner/import state (drives the market source preview). */
50
+ export type RepoDiscoverState = {
51
+ status: 'idle';
52
+ } | {
53
+ status: 'scanning';
54
+ } | {
55
+ status: 'ready';
56
+ data: RepoDiscoverResponse;
57
+ } | {
58
+ status: 'error';
59
+ message: string;
60
+ };
61
+ /** Market sources list state. */
62
+ export type MarketState = {
63
+ status: 'loading' | 'ready' | 'error';
64
+ repos: MarketSourceRecord[];
65
+ };
66
+ /** One market source's update-check outcome. */
67
+ export type MarketCheckResult = MarketCheckResponse['results'][number];
68
+ /** skillName → 调用次数/末次使用(统计域产出,目录排序消费)。 */
69
+ export type UsesMap = ReadonlyMap<string, {
70
+ count: number;
71
+ lastUsed?: number;
72
+ }>;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * useCatalogFlow — 目录域:catalog 加载、详情、开关(单个/禁用态/批量)、
3
+ * 新建、诊断修复,以及列表过滤/排序派生。跨域刷新只通过 shared 通知,
4
+ * 不直接碰其他域的 state。
5
+ */
6
+ import { type FormEvent } from 'react';
7
+ import type { CatalogResponse, CatalogSkill, DisabledSkill, SkillDetail, WritableRoot } from '../../../protocol.ts';
8
+ import type { SkillHubApi } from '../../api.ts';
9
+ import { type SortKey } from '../../grouping.ts';
10
+ import type { FlowNotices, UsesMap } from './shared.ts';
11
+ export declare function useCatalogFlow(api: SkillHubApi, uses: UsesMap, shared: FlowNotices,
12
+ /** 技能总数 >80 时折叠 personal 分组(聚合根实现,状态归它)。 */
13
+ collapsePersonal: () => void,
14
+ /** 清掉来源筛选(状态归聚合根,这里只在清空筛选项时调用)。 */
15
+ clearSourceFilter: () => void): {
16
+ catalog: CatalogResponse | null;
17
+ loading: boolean;
18
+ detail: SkillDetail | null;
19
+ detailLoading: boolean;
20
+ busyNames: ReadonlySet<string>;
21
+ search: string;
22
+ workspace: string;
23
+ showForm: boolean;
24
+ formName: string;
25
+ formDesc: string;
26
+ formRoot: WritableRoot;
27
+ formBusy: boolean;
28
+ formMessage: {
29
+ kind: "error" | "success";
30
+ text: string;
31
+ } | null;
32
+ fixingPaths: ReadonlySet<string>;
33
+ invocationFilter: "user" | "model" | "all";
34
+ sortKey: SortKey;
35
+ normalized: string;
36
+ actionNames: Set<string>;
37
+ viewNames: Set<string>;
38
+ filtered: CatalogSkill[];
39
+ sorted: CatalogSkill[];
40
+ shortenedCount: number;
41
+ setDetail: import("react").Dispatch<import("react").SetStateAction<SkillDetail | null>>;
42
+ setSearch: import("react").Dispatch<import("react").SetStateAction<string>>;
43
+ setWorkspace: import("react").Dispatch<import("react").SetStateAction<string>>;
44
+ setShowForm: import("react").Dispatch<import("react").SetStateAction<boolean>>;
45
+ setFormName: import("react").Dispatch<import("react").SetStateAction<string>>;
46
+ setFormDesc: import("react").Dispatch<import("react").SetStateAction<string>>;
47
+ setFormRoot: import("react").Dispatch<import("react").SetStateAction<WritableRoot>>;
48
+ setFormMessage: import("react").Dispatch<import("react").SetStateAction<{
49
+ kind: "error" | "success";
50
+ text: string;
51
+ } | null>>;
52
+ setInvocationFilter: import("react").Dispatch<import("react").SetStateAction<"user" | "model" | "all">>;
53
+ setSortKey: import("react").Dispatch<import("react").SetStateAction<SortKey>>;
54
+ load: () => Promise<void>;
55
+ openDetail: (name: string) => Promise<void>;
56
+ toggle: (skill: CatalogSkill, enabled: boolean) => Promise<void>;
57
+ enableDisabled: (record: DisabledSkill) => Promise<void>;
58
+ batchToggleNames: (names: string[], enabled: boolean) => Promise<void>;
59
+ fixDiagnostic: (path: string) => Promise<void>;
60
+ create: (event: FormEvent) => Promise<void>;
61
+ clearListFilters: () => void;
62
+ };
@@ -0,0 +1,41 @@
1
+ /**
2
+ * useGroupFlow — 分组域:groups 加载、tag 新建/删除/成员/重排、集合重排、
3
+ * 来源顶层重排、组开关与冲突解决。目录侧只消费 batchToggleNames +
4
+ * actionNames(聚合根传入),不碰目录 state。
5
+ */
6
+ import { type FormEvent } from 'react';
7
+ import type { GroupsResponse, SkillTag } from '../../../protocol.ts';
8
+ import type { SkillHubApi } from '../../api.ts';
9
+ import { type GroupSwitchState } from '../../grouping.ts';
10
+ import type { FlowNotices } from './shared.ts';
11
+ import type { ConflictDialogState } from '../dialogs.tsx';
12
+ export declare function useGroupFlow(api: SkillHubApi, shared: FlowNotices,
13
+ /** 整组开关的执行器(目录域提供,stable)。 */
14
+ batchToggleNames: (names: string[], enabled: boolean) => Promise<void>,
15
+ /** 当前启用且可写的技能名(目录域派生)。 */
16
+ actionNames: ReadonlySet<string>): {
17
+ groupsState: GroupsResponse | null;
18
+ conflictDialog: ConflictDialogState | null;
19
+ editingTag: SkillTag | null;
20
+ editName: string;
21
+ membersDraft: ReadonlySet<string>;
22
+ newTagName: string;
23
+ editSearch: string;
24
+ setConflictDialog: import("react").Dispatch<import("react").SetStateAction<ConflictDialogState | null>>;
25
+ setEditingTag: import("react").Dispatch<import("react").SetStateAction<SkillTag | null>>;
26
+ setEditName: import("react").Dispatch<import("react").SetStateAction<string>>;
27
+ setMembersDraft: import("react").Dispatch<import("react").SetStateAction<ReadonlySet<string>>>;
28
+ setNewTagName: import("react").Dispatch<import("react").SetStateAction<string>>;
29
+ setEditSearch: import("react").Dispatch<import("react").SetStateAction<string>>;
30
+ loadGroups: () => Promise<void>;
31
+ applyTags: (tags: SkillTag[]) => void;
32
+ groupMap: () => Map<string, string[]>;
33
+ toggleGroup: (key: string, name: string, view: GroupSwitchState) => void;
34
+ resolveConflict: (closeAll: boolean) => Promise<void>;
35
+ createTag: (event: FormEvent) => Promise<void>;
36
+ deleteTag: (id: string) => Promise<void>;
37
+ saveTag: (id: string, name: string, memberNames: string[] | null) => Promise<void>;
38
+ reorderTags: (orderedIds: string[]) => Promise<void>;
39
+ reorderCollections: (orderedNames: string[]) => Promise<void>;
40
+ reorderSourceGroups: (orderedKeys: string[]) => Promise<void>;
41
+ };
@@ -0,0 +1,73 @@
1
+ /**
2
+ * useMarketFlow — 市场域:市场源增删、仓库扫描、分支/版本选择、导入任务
3
+ * (轮询+取消)、更新检查、星标统计、版本同步、全部更新。目录/分组/来源
4
+ * 的刷新与来源检查经聚合根传入,不直接碰其他域的 state。
5
+ */
6
+ import type { RepoImportProgressResponse, SourceCheckResult } from '../../../protocol.ts';
7
+ import type { SkillHubApi } from '../../api.ts';
8
+ import type { FlowNotices, MarketState, RepoDiscoverState } from './shared.ts';
9
+ import type { BranchChoiceState, MarketSyncDialogState, VersionChoiceState } from '../dialogs.tsx';
10
+ export declare function useMarketFlow(api: SkillHubApi, shared: FlowNotices,
11
+ /** 目录重载(导入/同步后刷新列表,目录域提供)。 */
12
+ reloadCatalog: () => Promise<void>,
13
+ /** 分组重载(导入后刷新,分组域提供)。 */
14
+ reloadGroups: () => Promise<void>,
15
+ /** 来源重载(导入/同步后刷新,来源域提供)。 */
16
+ reloadSources: () => Promise<void>,
17
+ /** 来源更新检查(全部更新后重查,来源域提供)。 */
18
+ checkSources: (repo?: string) => Promise<void>,
19
+ /** 各来源的上游检查结果(全部更新遍历它,来源域提供)。 */
20
+ sourceCheck: Readonly<Record<string, SourceCheckResult>>): {
21
+ marketState: MarketState;
22
+ marketCheck: Readonly<Record<string, {
23
+ repo: string;
24
+ ref?: string;
25
+ latestTag?: string;
26
+ updateAvailable: boolean;
27
+ commitSha: string;
28
+ throttled?: boolean;
29
+ error?: string;
30
+ }>>;
31
+ branchChoice: BranchChoiceState | null;
32
+ branchBusy: boolean;
33
+ marketSyncDialog: MarketSyncDialogState | null;
34
+ syncingMarket: string | null;
35
+ syncBusy: boolean;
36
+ newSourceName: string;
37
+ repoDiscoverState: RepoDiscoverState;
38
+ scanningRepo: string | null;
39
+ repoSelected: ReadonlySet<string>;
40
+ repoImporting: boolean;
41
+ repoResult: RepoImportProgressResponse | null;
42
+ importJobId: string | null;
43
+ marketStats: Readonly<Record<string, {
44
+ stars: number;
45
+ downloads: number;
46
+ }>>;
47
+ versionDialog: VersionChoiceState | null;
48
+ versionBusy: boolean;
49
+ updateAllDialog: boolean;
50
+ setBranchChoice: import("react").Dispatch<import("react").SetStateAction<BranchChoiceState | null>>;
51
+ setMarketSyncDialog: import("react").Dispatch<import("react").SetStateAction<MarketSyncDialogState | null>>;
52
+ setNewSourceName: import("react").Dispatch<import("react").SetStateAction<string>>;
53
+ setRepoSelected: import("react").Dispatch<import("react").SetStateAction<ReadonlySet<string>>>;
54
+ setUpdateAllDialog: import("react").Dispatch<import("react").SetStateAction<boolean>>;
55
+ setVersionDialog: import("react").Dispatch<import("react").SetStateAction<VersionChoiceState | null>>;
56
+ loadMarket: () => Promise<void>;
57
+ addSource: (input: string) => Promise<void>;
58
+ addMarketSource: () => Promise<void>;
59
+ removeMarketSource: (repo: string) => Promise<void>;
60
+ scanRepo: (input: string) => Promise<void>;
61
+ confirmBranchChoice: () => Promise<void>;
62
+ openVersionDialog: (repo: string) => Promise<void>;
63
+ confirmVersionDialog: () => Promise<void>;
64
+ toggleRepoSelected: (path: string, checked: boolean) => void;
65
+ importRepo: () => Promise<void>;
66
+ cancelImport: () => Promise<void>;
67
+ clearScan: () => void;
68
+ checkMarket: () => Promise<void>;
69
+ loadMarketStats: () => Promise<void>;
70
+ syncMarketSource: (repo: string) => Promise<void>;
71
+ confirmMarketSync: () => Promise<void>;
72
+ updateAll: () => Promise<void>;
73
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * useMetaFlow — 自身更新检查 + 调用统计 + 配置:只依赖 api,
3
+ * 不碰其他域。补捞 effect 自包含(uses.size + loadUses)。
4
+ */
5
+ import type { HubConfig } from '../../../protocol.ts';
6
+ import type { SkillHubApi } from '../../api.ts';
7
+ import { type UpdateState } from './shared.ts';
8
+ export declare function useMetaFlow(api: SkillHubApi): {
9
+ updateState: UpdateState;
10
+ checkUpdate: () => Promise<void>;
11
+ uses: ReadonlyMap<string, {
12
+ count: number;
13
+ lastUsed?: number;
14
+ }>;
15
+ loadUses: () => Promise<void>;
16
+ hubConfig: HubConfig | null;
17
+ loadConfig: () => Promise<void>;
18
+ };