@dsh-workbench/core 0.3.1 → 0.3.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.
Files changed (39) hide show
  1. package/client.js +177 -107
  2. package/dist/client/client.body.js +177 -107
  3. package/dist/client/index.js +177 -107
  4. package/dist/host/index.js +832 -1461
  5. package/dist/types/app/client.d.ts +15 -3
  6. package/dist/types/app/layouts/panel-hint.d.ts +3 -0
  7. package/dist/types/app/layouts/rightbar/market-hint.d.ts +16 -0
  8. package/dist/types/app/layouts/rightbar/market-rows.d.ts +2 -3
  9. package/dist/types/modules/panels/model/diy-browser-act.d.ts +2 -39
  10. package/dist/types/modules/panels/model/diy-browser-tools.d.ts +39 -0
  11. package/dist/types/modules/panels/model/diy-browser.d.ts +1 -14
  12. package/dist/types/modules/panels/model/diy-observers.d.ts +11 -0
  13. package/dist/types/modules/panels/model/diy-observers.test.d.ts +1 -0
  14. package/dist/types/modules/panels/model/diy-page.d.ts +1 -0
  15. package/dist/types/modules/panels/model/diy-scripts.d.ts +0 -63
  16. package/dist/types/modules/panels/model/diy-spec.d.ts +5 -0
  17. package/dist/types/modules/panels/model/diy-spec.test.d.ts +1 -0
  18. package/dist/types/modules/panels/unit.d.ts +13 -11
  19. package/dist/types/shared/api/host/diy-recon.d.ts +10 -0
  20. package/package.json +5 -5
  21. package/scripts/seed-workshop.sh +3 -1
  22. package/skills/workbench-module-diy/BUILD.md +37 -16
  23. package/skills/workbench-module-diy/DATASOURCE.md +11 -2
  24. package/skills/workbench-module-diy/DESIGN.md +15 -8
  25. package/skills/workbench-module-diy/KIT.md +2 -0
  26. package/skills/workbench-module-diy/PANEL.md +3 -2
  27. package/skills/workbench-module-diy/REVIEW.md +115 -48
  28. package/skills/workbench-module-diy/SKILL.md +33 -9
  29. package/skills/workbench-module-diy/STEPS.md +1 -1
  30. package/skills/workbench-module-diy/TOOLING.md +6 -3
  31. package/skills/workbench-module-diy/TOOLS.md +90 -204
  32. package/skills/workbench-module-diy/WIRING.md +7 -5
  33. package/skills/workbench-module-diy/WRITES.md +90 -0
  34. package/dist/types/modules/panels/model/diy-act.d.ts +0 -4
  35. package/dist/types/modules/panels/model/diy-look.d.ts +0 -15
  36. package/dist/types/modules/panels/model/diy-net.d.ts +0 -3
  37. /package/dist/types/modules/panels/model/{diy-act.test.d.ts → diy-browser-act.test.d.ts} +0 -0
  38. /package/dist/types/modules/panels/model/{diy-look.test.d.ts → diy-browser-tools-shot.test.d.ts} +0 -0
  39. /package/dist/types/modules/panels/model/{diy-net.test.d.ts → diy-browser-tools.test.d.ts} +0 -0
package/client.js CHANGED
@@ -1816,6 +1816,7 @@ window.__ModuleLoader__.load({
1816
1816
  "panels.dragHint": "Drag to reorder",
1817
1817
  "panels.unknownStep": "No suite provides this view",
1818
1818
  "panels.labelWithHint": "{label} ({hint})",
1819
+ "panels.hintJoin": "; ",
1819
1820
  "panels.dep.failed": "⚠ failed to start",
1820
1821
  "panels.dep.missingPlugin": "⚠ not ready yet",
1821
1822
  "panels.dep.missingCommands": "⚠ needs an update",
@@ -1830,6 +1831,7 @@ window.__ModuleLoader__.load({
1830
1831
  "panels.market.notUsable": "unusable",
1831
1832
  "panels.market.broken": "broken",
1832
1833
  "panels.market.hasNew": "New version",
1834
+ "panels.market.hasProblem": "Module problem",
1833
1835
  "panels.market.missing": "not installed",
1834
1836
  "panels.market.unchecked": "unknown",
1835
1837
  "panels.market.checking": "checking",
@@ -2241,6 +2243,7 @@ window.__ModuleLoader__.load({
2241
2243
  "panels.dragHint": "拖动调整顺序",
2242
2244
  "panels.unknownStep": "这一层没有套件提供",
2243
2245
  "panels.labelWithHint": "{label}({hint})",
2246
+ "panels.hintJoin": ";",
2244
2247
  "panels.dep.failed": "⚠ 起不来",
2245
2248
  "panels.dep.missingPlugin": "⚠ 还没装好",
2246
2249
  "panels.dep.missingCommands": "⚠ 需要更新",
@@ -2255,6 +2258,7 @@ window.__ModuleLoader__.load({
2255
2258
  "panels.market.notUsable": "不可用",
2256
2259
  "panels.market.broken": "装坏了",
2257
2260
  "panels.market.hasNew": "有新版本",
2261
+ "panels.market.hasProblem": "模块异常",
2258
2262
  "panels.market.missing": "未装",
2259
2263
  "panels.market.unchecked": "状态未知",
2260
2264
  "panels.market.checking": "检测中",
@@ -3520,8 +3524,15 @@ window.__ModuleLoader__.load({
3520
3524
  //#region src/app/layouts/panel-hint.ts
3521
3525
  var hints = /* @__PURE__ */ new Map();
3522
3526
  var listeners$3 = /* @__PURE__ */ new Set();
3527
+ function sameHint(left, right) {
3528
+ if (left === null || right === null) return left === right;
3529
+ if (left.labelKey !== right.labelKey || left.tone !== right.tone) return false;
3530
+ const leftMore = left.moreKeys ?? [];
3531
+ const rightMore = right.moreKeys ?? [];
3532
+ return leftMore.length === rightMore.length && leftMore.every((key, index) => key === rightMore[index]);
3533
+ }
3523
3534
  function publishPanelHint(id, hint) {
3524
- if ((hints.get(id)?.labelKey ?? null) === (hint?.labelKey ?? null)) return;
3535
+ if (sameHint(hints.get(id) ?? null, hint)) return;
3525
3536
  if (hint === null) hints.delete(id);
3526
3537
  else hints.set(id, hint);
3527
3538
  for (const listener of [...listeners$3]) listener();
@@ -3542,7 +3553,7 @@ window.__ModuleLoader__.load({
3542
3553
  if (hint === null) return label;
3543
3554
  return t("panels.labelWithHint", {
3544
3555
  label,
3545
- hint: t(hint.labelKey)
3556
+ hint: [hint.labelKey, ...hint.moreKeys ?? []].map((key) => t(key)).join(t("panels.hintJoin"))
3546
3557
  });
3547
3558
  }
3548
3559
  //#endregion
@@ -3693,39 +3704,6 @@ window.__ModuleLoader__.load({
3693
3704
  return rows;
3694
3705
  }
3695
3706
  //#endregion
3696
- //#region src/app/layouts/rightbar/market-workbench-row.ts
3697
- var WORKBENCH_ROW_ID = "workbench:self";
3698
- var WORKBENCH_TITLE_KEY = "panels.market.workbenchName";
3699
- function workbenchRow(version) {
3700
- if (version === null || version === void 0 || version.installed === "") return void 0;
3701
- const local = version.local === true;
3702
- const latest = local ? void 0 : version.latest;
3703
- const update = latest !== void 0 && latest !== version.installed ? {
3704
- installed: version.installed,
3705
- latest
3706
- } : void 0;
3707
- const note = local ? {
3708
- key: "panels.market.workbenchLocal",
3709
- params: {}
3710
- } : void 0;
3711
- return {
3712
- id: WORKBENCH_ROW_ID,
3713
- titleKey: WORKBENCH_TITLE_KEY,
3714
- workbench: true,
3715
- state: !local && version.running !== void 0 && version.running !== version.installed ? "pending-restart" : update === void 0 ? "installed" : "outdated",
3716
- canInstall: false,
3717
- canUpdate: update !== void 0,
3718
- canUninstall: false,
3719
- ...note === void 0 ? {} : { note },
3720
- version: {
3721
- installed: version.installed,
3722
- ...latest === void 0 ? {} : { latest }
3723
- },
3724
- ...update === void 0 ? {} : { moduleUpdate: update },
3725
- pkg: version.pkg
3726
- };
3727
- }
3728
- //#endregion
3729
3707
  //#region src/app/layouts/rightbar/market-rows.ts
3730
3708
  var MARKET_STATE_KEY = {
3731
3709
  checking: "panels.market.checking",
@@ -3907,10 +3885,6 @@ window.__ModuleLoader__.load({
3907
3885
  }
3908
3886
  return next;
3909
3887
  }
3910
- function marketHintVisible(manifests, capabilities, modules, workbench) {
3911
- const self = workbenchRow(workbench);
3912
- return marketHasUpdates([...marketRows(manifests, capabilities, marketUpdatesOf(modules)), ...self === void 0 ? [] : [self]], sharedRows(manifests, capabilities));
3913
- }
3914
3888
  function marketOrder(rows, titleOf) {
3915
3889
  return [...rows].sort((left, right) => {
3916
3890
  const byTitle = titleOf(left).localeCompare(titleOf(right), "zh-Hans-CN");
@@ -3966,6 +3940,152 @@ window.__ModuleLoader__.load({
3966
3940
  return rows;
3967
3941
  }
3968
3942
  //#endregion
3943
+ //#region src/app/layouts/rightbar/market-plugin-rows.ts
3944
+ function installedPluginKept(value) {
3945
+ if (typeof value !== "object" || value === null) return void 0;
3946
+ const kept = value.kept;
3947
+ if (typeof kept !== "object" || kept === null) return void 0;
3948
+ const kind = kept.kind;
3949
+ if (kind === "held") return { key: "panels.market.pluginKeptHeld" };
3950
+ if (kind === "unnamed") return { key: "panels.market.pluginKeptUnnamed" };
3951
+ if (kind === "unsure") return { key: "panels.market.pluginKeptUnsure" };
3952
+ if (kind !== "claimed") return void 0;
3953
+ const raw = kept.by;
3954
+ const names = Array.isArray(raw) ? raw.filter((item) => typeof item === "string") : [];
3955
+ return names.length === 0 ? { key: "panels.market.pluginKeptUnsure" } : {
3956
+ key: "panels.market.pluginKeptInUse",
3957
+ names
3958
+ };
3959
+ }
3960
+ function installedPluginNotice(value, t) {
3961
+ const kept = installedPluginKept(value);
3962
+ if (kept === void 0) return null;
3963
+ return t(kept.key, kept.names === void 0 ? {} : { names: kept.names.join(t("panels.market.listSeparator")) });
3964
+ }
3965
+ function noteOf(plugin) {
3966
+ if (plugin.broken === true) return {
3967
+ key: "panels.market.pluginBroken",
3968
+ params: {},
3969
+ tone: "alert"
3970
+ };
3971
+ if (plugin.local === true) return void 0;
3972
+ }
3973
+ function installedPluginRows(plugins, defaults = /* @__PURE__ */ new Set(), changed = {}) {
3974
+ return plugins.map((plugin) => {
3975
+ const id = `plugin:${plugin.pkg}`;
3976
+ const name = plugin.name ?? plugin.pkg;
3977
+ const outdated = plugin.installed !== void 0 && plugin.latest !== void 0 && plugin.latest !== plugin.installed;
3978
+ const note = noteOf(plugin);
3979
+ return {
3980
+ id,
3981
+ titleKey: plugin.pkg,
3982
+ label: name,
3983
+ plugin: true,
3984
+ state: outdated ? "outdated" : plugin.broken === true ? "broken" : "installed",
3985
+ canInstall: false,
3986
+ canUpdate: outdated,
3987
+ canUninstall: true,
3988
+ ...plugin.local === true ? { local: true } : {},
3989
+ ...plugin.broken === true ? { broken: true } : {},
3990
+ defaultShown: defaults.has(id),
3991
+ defaultChanged: changed[id] ?? 0,
3992
+ ...note === void 0 ? {} : { note },
3993
+ ...plugin.installed === void 0 ? {} : { versionLabel: `${plugin.pkg}@${plugin.installed}` },
3994
+ pkg: plugin.pkg,
3995
+ ...plugin.installed === void 0 ? {} : { version: {
3996
+ installed: plugin.installed,
3997
+ ...plugin.latest === void 0 ? {} : { latest: plugin.latest }
3998
+ } }
3999
+ };
4000
+ });
4001
+ }
4002
+ //#endregion
4003
+ //#region src/app/layouts/rightbar/market-workbench-row.ts
4004
+ var WORKBENCH_ROW_ID = "workbench:self";
4005
+ var WORKBENCH_TITLE_KEY = "panels.market.workbenchName";
4006
+ function workbenchRow(version) {
4007
+ if (version === null || version === void 0 || version.installed === "") return void 0;
4008
+ const local = version.local === true;
4009
+ const latest = local ? void 0 : version.latest;
4010
+ const update = latest !== void 0 && latest !== version.installed ? {
4011
+ installed: version.installed,
4012
+ latest
4013
+ } : void 0;
4014
+ const note = local ? {
4015
+ key: "panels.market.workbenchLocal",
4016
+ params: {}
4017
+ } : void 0;
4018
+ return {
4019
+ id: WORKBENCH_ROW_ID,
4020
+ titleKey: WORKBENCH_TITLE_KEY,
4021
+ workbench: true,
4022
+ state: !local && version.running !== void 0 && version.running !== version.installed ? "pending-restart" : update === void 0 ? "installed" : "outdated",
4023
+ canInstall: false,
4024
+ canUpdate: update !== void 0,
4025
+ canUninstall: false,
4026
+ ...note === void 0 ? {} : { note },
4027
+ version: {
4028
+ installed: version.installed,
4029
+ ...latest === void 0 ? {} : { latest }
4030
+ },
4031
+ ...update === void 0 ? {} : { moduleUpdate: update },
4032
+ pkg: version.pkg
4033
+ };
4034
+ }
4035
+ //#endregion
4036
+ //#region src/app/layouts/rightbar/market-hint.ts
4037
+ var PROBLEM_KEY = "panels.market.hasProblem";
4038
+ var RESTART_KEY = "panels.market.pendingRestart";
4039
+ var UPDATES_KEY = "panels.market.hasNew";
4040
+ function isProblem(row) {
4041
+ return row.broken === true || row.state === "broken" || row.state === "unusable" || row.note?.key === "panels.market.moduleRefused";
4042
+ }
4043
+ function isRestart(row) {
4044
+ return row.state === "inactive" || row.state === "pending-restart";
4045
+ }
4046
+ function awaitsRestart(input) {
4047
+ const loaded = new Set(input.manifests.map((manifest) => manifest.id));
4048
+ return (input.installed ?? []).some((module) => !loaded.has(module.unit) && refusalReasons(module.refused, module.clientRefused).length === 0);
4049
+ }
4050
+ function marketHintOf(input) {
4051
+ const marketable = marketCatalog(input.manifests, input.installable);
4052
+ const catalog = marketRows(marketable, input.capabilities, marketUpdatesOf(input.modules));
4053
+ const listed = new Set(catalog.map((row) => row.id));
4054
+ const self = workbenchRow(input.workbench);
4055
+ const rows = [
4056
+ ...catalog,
4057
+ ...installedRows(input.installed ?? [], input.manifests, listed),
4058
+ ...installedPluginRows(input.plugins ?? []),
4059
+ ...self === void 0 ? [] : [self]
4060
+ ];
4061
+ const problem = rows.some(isProblem);
4062
+ const restart = rows.some(isRestart) || awaitsRestart(input);
4063
+ const updates = marketHasUpdates(rows, sharedRows(marketable, input.capabilities));
4064
+ const more = [];
4065
+ if (problem) {
4066
+ if (restart) more.push(RESTART_KEY);
4067
+ if (updates) more.push(UPDATES_KEY);
4068
+ return {
4069
+ labelKey: PROBLEM_KEY,
4070
+ tone: "danger",
4071
+ ...more.length === 0 ? {} : { moreKeys: more }
4072
+ };
4073
+ }
4074
+ if (restart) {
4075
+ if (updates) more.push(UPDATES_KEY);
4076
+ return {
4077
+ labelKey: RESTART_KEY,
4078
+ tone: "warning",
4079
+ ...more.length === 0 ? {} : { moreKeys: more }
4080
+ };
4081
+ }
4082
+ if (updates) return {
4083
+ labelKey: UPDATES_KEY,
4084
+ tone: "warning"
4085
+ };
4086
+ return null;
4087
+ }
4088
+ //#endregion
3969
4089
  //#region src/shared/hooks/use-host-write.ts
3970
4090
  var use_host_write_exports = /* @__PURE__ */ __exportAll({ useHostWrite: () => useHostWrite });
3971
4091
  function useHostWrite(options) {
@@ -4121,66 +4241,6 @@ window.__ModuleLoader__.load({
4121
4241
  setNotice
4122
4242
  };
4123
4243
  }
4124
- //#endregion
4125
- //#region src/app/layouts/rightbar/market-plugin-rows.ts
4126
- function installedPluginKept(value) {
4127
- if (typeof value !== "object" || value === null) return void 0;
4128
- const kept = value.kept;
4129
- if (typeof kept !== "object" || kept === null) return void 0;
4130
- const kind = kept.kind;
4131
- if (kind === "held") return { key: "panels.market.pluginKeptHeld" };
4132
- if (kind === "unnamed") return { key: "panels.market.pluginKeptUnnamed" };
4133
- if (kind === "unsure") return { key: "panels.market.pluginKeptUnsure" };
4134
- if (kind !== "claimed") return void 0;
4135
- const raw = kept.by;
4136
- const names = Array.isArray(raw) ? raw.filter((item) => typeof item === "string") : [];
4137
- return names.length === 0 ? { key: "panels.market.pluginKeptUnsure" } : {
4138
- key: "panels.market.pluginKeptInUse",
4139
- names
4140
- };
4141
- }
4142
- function installedPluginNotice(value, t) {
4143
- const kept = installedPluginKept(value);
4144
- if (kept === void 0) return null;
4145
- return t(kept.key, kept.names === void 0 ? {} : { names: kept.names.join(t("panels.market.listSeparator")) });
4146
- }
4147
- function noteOf(plugin) {
4148
- if (plugin.broken === true) return {
4149
- key: "panels.market.pluginBroken",
4150
- params: {},
4151
- tone: "alert"
4152
- };
4153
- if (plugin.local === true) return void 0;
4154
- }
4155
- function installedPluginRows(plugins, defaults = /* @__PURE__ */ new Set(), changed = {}) {
4156
- return plugins.map((plugin) => {
4157
- const id = `plugin:${plugin.pkg}`;
4158
- const name = plugin.name ?? plugin.pkg;
4159
- const outdated = plugin.installed !== void 0 && plugin.latest !== void 0 && plugin.latest !== plugin.installed;
4160
- const note = noteOf(plugin);
4161
- return {
4162
- id,
4163
- titleKey: plugin.pkg,
4164
- label: name,
4165
- plugin: true,
4166
- state: outdated ? "outdated" : plugin.broken === true ? "broken" : "installed",
4167
- canInstall: false,
4168
- canUpdate: outdated,
4169
- canUninstall: true,
4170
- ...plugin.local === true ? { local: true } : {},
4171
- ...plugin.broken === true ? { broken: true } : {},
4172
- defaultShown: defaults.has(id),
4173
- defaultChanged: changed[id] ?? 0,
4174
- ...note === void 0 ? {} : { note },
4175
- ...plugin.installed === void 0 ? {} : { versionLabel: `${plugin.pkg}@${plugin.installed}` },
4176
- pkg: plugin.pkg,
4177
- ...plugin.installed === void 0 ? {} : { version: {
4178
- installed: plugin.installed,
4179
- ...plugin.latest === void 0 ? {} : { latest: plugin.latest }
4180
- } }
4181
- };
4182
- });
4183
- }
4184
4244
  var MarketPage_module_default = {
4185
4245
  marketList: "_marketList_csyus_1",
4186
4246
  marketRow: "_marketRow_csyus_10",
@@ -5178,7 +5238,7 @@ window.__ModuleLoader__.load({
5178
5238
  let bestRank = -1;
5179
5239
  for (const summary of sessionRows(workspace.sessionIds, input.sessions, input.archivedIds)) {
5180
5240
  const ofSession = attentionOfSession(summary, input.statusById, input.sessions);
5181
- if (ofSession === void 0 || ofSession === "ongoing") continue;
5241
+ if (ofSession === void 0) continue;
5182
5242
  const rank = RANK[ofSession];
5183
5243
  if (best === void 0 || rank > bestRank || rank === bestRank && isLater(summary, best)) {
5184
5244
  best = summary;
@@ -5979,12 +6039,22 @@ window.__ModuleLoader__.load({
5979
6039
  const manifests = useLiveManifests(units);
5980
6040
  const installable = useInstallableUnits(units);
5981
6041
  const { capabilities } = useCapabilityMap(0);
5982
- const { modules, workbench } = useModuleVersions();
5983
- const hasUpdates = marketHintVisible(marketCatalog(manifests, installable), capabilities, modules, workbench);
6042
+ const { modules, plugins, workbench } = useModuleVersions();
6043
+ const hint = marketHintOf({
6044
+ manifests,
6045
+ installable,
6046
+ capabilities,
6047
+ modules,
6048
+ installed: modules === null ? void 0 : withClientRefusals(modules, units.refusals()),
6049
+ plugins,
6050
+ workbench
6051
+ });
5984
6052
  useEffect(() => {
5985
- publishPanelHint(MARKET_PANEL_ID, hasUpdates ? { labelKey: "panels.market.hasNew" } : null);
5986
- return () => publishPanelHint(MARKET_PANEL_ID, null);
5987
- }, [hasUpdates]);
6053
+ publishPanelHint(MARKET_PANEL_ID, hint);
6054
+ }, [hint]);
6055
+ useEffect(() => () => {
6056
+ publishPanelHint(MARKET_PANEL_ID, null);
6057
+ }, []);
5988
6058
  return /* @__PURE__ */ h(IconModules, { size });
5989
6059
  };
5990
6060
  }
@@ -9048,10 +9118,10 @@ window.__ModuleLoader__.load({
9048
9118
  className: "wb-panelGlyph",
9049
9119
  "aria-hidden": "true"
9050
9120
  }, glyph, hint !== null && !wide ? /* @__PURE__ */ h("span", { className: "wb-panelDot" }, /* @__PURE__ */ h(_deepseek_ai_dsh_client_ui_primitives.StateDot, {
9051
- state: "warning",
9121
+ state: hint.tone === "danger" ? "error" : "warning",
9052
9122
  size: 9
9053
9123
  })) : null), wide ? /* @__PURE__ */ h("span", { className: "wb-panelTitle" }, label) : null, hint === null || !wide ? null : /* @__PURE__ */ h(_deepseek_ai_dsh_client_ui_primitives.Tag, {
9054
- tone: "warning",
9124
+ tone: hint.tone,
9055
9125
  className: "wb-panelTag"
9056
9126
  }, t(hint.labelKey))));
9057
9127
  }