dsh-comfyui-canvas 0.1.7 → 0.1.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.
package/lib/client.js CHANGED
@@ -952,10 +952,16 @@ function ComfyUISettingsRow(props) {
952
952
  );
953
953
  }
954
954
 
955
- var inject = ["slots", "settingsScope"];
955
+ var inject = ["slots"];
956
956
 
957
957
  function apply(ctx) {
958
- var scope = ctx.settingsScope.bind({ namespace: NAMESPACE });
958
+ // 2026-09-24: 核心 #4587 移除了客户端 settingsScope 服务,且 cordis ctx 代理对
959
+ // 未注入服务的属性访问(ctx.settingsScope)会直接抛 "cannot get property...
960
+ // without inject",导致客户端 apply 失败。改用 ctx.get()(缺失返回 undefined)。
961
+ var settingsScopeService = typeof ctx.get === "function" ? ctx.get("settingsScope") : undefined;
962
+ var scope = settingsScopeService && typeof settingsScopeService.bind === "function"
963
+ ? settingsScopeService.bind({ namespace: NAMESPACE })
964
+ : undefined;
959
965
  // 画布顶栏「重启 / 关闭 ComfyUI」按钮 → 写 settings.comfyControl,
960
966
  // host watcher 执行 kill / restart(结果由可达性探测反映到状态圆点)。
961
967
  document.addEventListener("dsh-comfyui-control", function (e) {
@@ -966,7 +972,7 @@ function apply(ctx) {
966
972
  });
967
973
  // 让画布 iframe 使用设置里的地址(并跟随变更)。
968
974
  var syncConfig = function () {
969
- var snap = scope.getSnapshot();
975
+ var snap = scope ? scope.getSnapshot() : undefined;
970
976
  var v = snap && snap.value;
971
977
  var base = v && typeof v.baseUrl === "string" && v.baseUrl
972
978
  ? v.baseUrl : DEFAULT_BASE;
@@ -984,7 +990,7 @@ function apply(ctx) {
984
990
  // 实时应用右侧面板宽度(发布 CSS 变量,分屏挤压样式引用)。
985
991
  applyRailWidth(v?.railWidth != null ? v.railWidth : DEFAULT_RAIL);
986
992
  };
987
- scope.subscribe(syncConfig);
993
+ if (scope) scope.subscribe(syncConfig);
988
994
 
989
995
  // 全局看门狗:保证分屏标记与真实分屏态一致,杜绝 data-dsh-split-on 残留。
990
996
  // 挤压规则只在 html[data-dsh-split-on="1"] 时生效;一旦残留打上该属性,
@@ -998,7 +1004,7 @@ function apply(ctx) {
998
1004
  return tab ? (tab.textContent || "").trim() : "";
999
1005
  };
1000
1006
  var enforceSplitMarker = function () {
1001
- var snap = scope.getSnapshot();
1007
+ var snap = scope ? scope.getSnapshot() : undefined;
1002
1008
  var v = snap && snap.value ? snap.value : {};
1003
1009
  var map = v.splitEnabledBySession || {};
1004
1010
  var anyEnabled = Object.keys(map).some(function (k) { return map[k] === true; });
@@ -1026,7 +1032,7 @@ function apply(ctx) {
1026
1032
  }
1027
1033
  };
1028
1034
  var splitWatchdog = null;
1029
- scope.subscribe(enforceSplitMarker);
1035
+ if (scope) scope.subscribe(enforceSplitMarker);
1030
1036
  if (typeof MutationObserver === "function") {
1031
1037
  splitWatchdog = new MutationObserver(enforceSplitMarker);
1032
1038
  splitWatchdog.observe(
@@ -1051,14 +1057,16 @@ function apply(ctx) {
1051
1057
  var onNarrow = function () {
1052
1058
  var now = narrowQuery ? narrowQuery.matches : (window.innerWidth < 1200);
1053
1059
  if (now && !narrowWas) {
1054
- var snap = scope.getSnapshot();
1060
+ var snap = scope ? scope.getSnapshot() : undefined;
1055
1061
  var v = snap && snap.value ? snap.value : {};
1056
1062
  var map = v.splitEnabledBySession || {};
1057
1063
  var anyEnabled = Object.keys(map).some(function (k) { return map[k] === true; });
1058
1064
  if (anyEnabled) {
1059
1065
  var cleared = {};
1060
1066
  for (var k in map) cleared[k] = false;
1061
- scope.set("splitEnabledBySession", cleared).catch(function () { /* recover handled by scope */ });
1067
+ if (scope && typeof scope.set === "function") {
1068
+ scope.set("splitEnabledBySession", cleared).catch(function () { /* recover handled by scope */ });
1069
+ }
1062
1070
  // 同步清理 DOM,避免 settings 异步落地前挤压样式/画布残留。
1063
1071
  document.documentElement.removeAttribute("data-dsh-split-on");
1064
1072
  document.documentElement.removeAttribute("data-dsh-rail-closed");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-comfyui-canvas",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Give DeepSeek Harness agents live control of your ComfyUI canvas (local or cloud): embed it as a split-screen tab, then read/edit/run workflows, debug errors, fetch output images, and batch-sweep parameters straight from the chat. Ships the ComfyUI-side bridge node.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -49,8 +49,7 @@
49
49
  "client": {
50
50
  "platform": "web",
51
51
  "inject": [
52
- "@deepseek-ai/dsh-client-ui-settings",
53
- "@deepseek-ai/dsh-client-runtime"
52
+ "@deepseek-ai/dsh-client-ui-settings"
54
53
  ]
55
54
  },
56
55
  "bundle": { "patch": "./cordis.patch.yml" }