dsh-skill-hub 0.3.13 → 0.3.14
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/README.md +1 -1
- package/README.zh.md +1 -1
- package/lib/client.js +23 -47
- package/lib/client.js.map +1 -1
- package/lib/index.js +4 -5
- package/lib/types/client/SkillHubSettingsCard.d.ts +5 -3
- package/lib/types/client/icons.d.ts +4 -5
- package/lib/types/client/index.d.ts +4 -4
- package/lib/types/client/slash-dots.d.ts +17 -8
- package/lib/types/index.d.ts +4 -5
- package/package.json +29 -40
- package/src/client/SkillHubSettingsCard.tsx +5 -3
- package/src/client/icons.tsx +4 -5
- package/src/client/index.tsx +18 -16
- package/src/client/slash-dots.test.ts +16 -33
- package/src/client/slash-dots.tsx +27 -57
- package/src/index.ts +9 -11
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ dsh plugin --profile web add dsh-skill-hub
|
|
|
24
24
|
# restart dsh web → Settings → 技能 → Market → scan → import
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
Requires `Node ^22.19 || >=24` + dsh web
|
|
27
|
+
Requires `Node ^22.19 || >=24` + dsh web `>=0.1.6-alpha.2 <0.2`.
|
|
28
28
|
|
|
29
29
|
## Features
|
|
30
30
|
|
package/README.zh.md
CHANGED
package/lib/client.js
CHANGED
|
@@ -1164,36 +1164,11 @@ window.__ModuleLoader__.load({
|
|
|
1164
1164
|
}
|
|
1165
1165
|
}
|
|
1166
1166
|
/**
|
|
1167
|
-
*
|
|
1168
|
-
*
|
|
1169
|
-
* @param
|
|
1170
|
-
* @
|
|
1171
|
-
|
|
1172
|
-
function dotIcon(color) {
|
|
1173
|
-
return (0, react.createElement)("span", {
|
|
1174
|
-
"aria-hidden": true,
|
|
1175
|
-
style: {
|
|
1176
|
-
display: "inline-block",
|
|
1177
|
-
width: 6,
|
|
1178
|
-
height: 6,
|
|
1179
|
-
borderRadius: 3,
|
|
1180
|
-
background: color,
|
|
1181
|
-
flex: "none"
|
|
1182
|
-
}
|
|
1183
|
-
});
|
|
1184
|
-
}
|
|
1185
|
-
/**
|
|
1186
|
-
* Wrap the core skill source so every menu row carries the invocation dot.
|
|
1187
|
-
* Exported for unit tests; production wiring goes through setupSkillSlashDots.
|
|
1188
|
-
* @param source - the registered `/skill` source.
|
|
1189
|
-
* @param api - hub browser API for the modelInvocable lookup.
|
|
1190
|
-
* @param scope - hub settings scope for the dot colors.
|
|
1191
|
-
* @returns a disposer restoring the original candidates.
|
|
1192
|
-
*/
|
|
1193
|
-
/**
|
|
1194
|
-
* DOM 兜底:在 alpha.2 新版 MenuView(icon 仅枚举)下通过直接操作
|
|
1195
|
-
* 已渲染的 `[role="option"]` 列表注入彩色点,绕过 `icon` 限制。
|
|
1196
|
-
* 旧版仍走 `icon` 注入,此处仅为新版。
|
|
1167
|
+
* 通过直接操作已渲染的 `[role="option"]` 列表注入彩色点,
|
|
1168
|
+
* 绕过 MenuView 对 `icon` 的枚举限制。
|
|
1169
|
+
* @param modelByName - 技能名 → 模型可调用性;不在表内的候选不注点。
|
|
1170
|
+
* @param modelColor - 模型可调用技能的点色。
|
|
1171
|
+
* @param userColor - 仅用户可调用技能的点色。
|
|
1197
1172
|
*/
|
|
1198
1173
|
function injectDotsViaDOM(modelByName, modelColor, userColor) {
|
|
1199
1174
|
if (typeof document === "undefined" || typeof requestAnimationFrame === "undefined") return;
|
|
@@ -1231,25 +1206,24 @@ window.__ModuleLoader__.load({
|
|
|
1231
1206
|
};
|
|
1232
1207
|
requestAnimationFrame(() => setTimeout(run, 0));
|
|
1233
1208
|
}
|
|
1209
|
+
/**
|
|
1210
|
+
* Wrap the core skill source so every menu row carries the invocation dot.
|
|
1211
|
+
* Exported for unit tests; production wiring goes through setupSkillSlashDots.
|
|
1212
|
+
* @param source - the registered `/skill` source.
|
|
1213
|
+
* @param api - hub browser API for the modelInvocable lookup.
|
|
1214
|
+
* @param scope - hub settings scope for the dot colors.
|
|
1215
|
+
* @returns a disposer restoring the original candidates.
|
|
1216
|
+
*/
|
|
1234
1217
|
function wrapSkillSource(source, api, scope) {
|
|
1235
1218
|
const original = source.candidates;
|
|
1236
1219
|
source.candidates = async (session, req) => {
|
|
1237
1220
|
const items = await original(session, req);
|
|
1238
1221
|
if (req.signal.aborted) return items;
|
|
1239
|
-
const isNewHost = req !== null && typeof req === "object" && "drilled" in req;
|
|
1240
1222
|
const modelByName = await modelInvocableMap(api);
|
|
1241
1223
|
if (req.signal.aborted) return items;
|
|
1242
1224
|
const snapshot = scope.getSnapshot();
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
if (isNewHost) {
|
|
1246
|
-
injectDotsViaDOM(modelByName, modelColor, userColor);
|
|
1247
|
-
return items;
|
|
1248
|
-
}
|
|
1249
|
-
return items.map((item) => ({
|
|
1250
|
-
...item,
|
|
1251
|
-
icon: dotIcon(modelByName.get(item.name) ?? true ? modelColor : userColor)
|
|
1252
|
-
}));
|
|
1225
|
+
injectDotsViaDOM(modelByName, snapshot.value?.dotModelColor ?? "#2f81f7", snapshot.value?.dotUserColor ?? "#3fb950");
|
|
1226
|
+
return items;
|
|
1253
1227
|
};
|
|
1254
1228
|
return () => {
|
|
1255
1229
|
source.candidates = original;
|
|
@@ -2585,8 +2559,10 @@ window.__ModuleLoader__.load({
|
|
|
2585
2559
|
* The dsh-skill-hub plugin settings card: bridges the hub's settings
|
|
2586
2560
|
* namespace (bound through the official settings transport) onto the
|
|
2587
2561
|
* family-style staged card form (enabled master switch + agent announcement).
|
|
2588
|
-
* Registered into
|
|
2589
|
-
*
|
|
2562
|
+
* Registered into `plugins.bundle.config` under the bundle's package name, so
|
|
2563
|
+
* the Plugins manager renders it on dsh-skill-hub's own page. That slot is
|
|
2564
|
+
* dispatched with `view: 'page'` only, so the card always renders its full
|
|
2565
|
+
* form (no `summary` one-liner variant).
|
|
2590
2566
|
*/
|
|
2591
2567
|
/** Bridges the hub's config scope onto the card's staged form. */
|
|
2592
2568
|
var SkillHubSettingsCardController = class {
|
|
@@ -7614,12 +7590,12 @@ window.__ModuleLoader__.load({
|
|
|
7614
7590
|
const scope = ctx.settingsScope.bind({ namespace: NS });
|
|
7615
7591
|
const settingsCard = new SkillHubSettingsCardController(scope);
|
|
7616
7592
|
ctx.effect(() => setupSkillSlashDots(ctx, api, scope), "dsh-skill-hub: slash dots");
|
|
7617
|
-
ctx.effect(() => ctx.slots.inject("
|
|
7618
|
-
name: "
|
|
7619
|
-
key:
|
|
7593
|
+
ctx.effect(() => ctx.slots.inject("plugins.bundle.config", () => ctx.slots.register({
|
|
7594
|
+
name: "plugins.bundle.config",
|
|
7595
|
+
key: "dsh-skill-hub",
|
|
7620
7596
|
locale: NS,
|
|
7621
7597
|
inject: () => settingsCard.inject()
|
|
7622
|
-
}, SkillHubSettingsCard)), "dsh-skill-hub:
|
|
7598
|
+
}, SkillHubSettingsCard)), "dsh-skill-hub: plugin config");
|
|
7623
7599
|
ctx.effect(() => ctx.slots.inject("settings.section", () => ctx.slots.register({
|
|
7624
7600
|
name: "settings.section",
|
|
7625
7601
|
id: "skill-hub",
|