@bian-womp/spark-workbench 0.3.0 → 0.3.2

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/cjs/index.cjs CHANGED
@@ -1002,9 +1002,8 @@ class LocalGraphRunner extends AbstractGraphRunner {
1002
1002
  this.setEnvironment = (env, opts) => {
1003
1003
  if (!this.runtime)
1004
1004
  return;
1005
- const wasPaused = this.runtime.isPaused();
1006
- if (opts?.dry && !wasPaused)
1007
- this.runtime.pause();
1005
+ // Use requestPause for dry mode to temporarily pause without affecting base run mode
1006
+ const releasePause = opts?.dry ? this.runtime.requestPause() : null;
1008
1007
  try {
1009
1008
  if (opts?.merge) {
1010
1009
  const current = this.runtime.getEnvironment();
@@ -1016,8 +1015,7 @@ class LocalGraphRunner extends AbstractGraphRunner {
1016
1015
  }
1017
1016
  }
1018
1017
  finally {
1019
- if (opts?.dry && !wasPaused)
1020
- this.runtime.resume();
1018
+ releasePause?.();
1021
1019
  }
1022
1020
  };
1023
1021
  this.getEnvironment = () => {
@@ -1038,20 +1036,14 @@ class LocalGraphRunner extends AbstractGraphRunner {
1038
1036
  update(def, options) {
1039
1037
  if (!this.runtime)
1040
1038
  return;
1041
- const wasPaused = this.runtime.isPaused();
1042
- // Pause runtime if dry option is set (to prevent execution) or if not paused already
1043
- if (options?.dry && !wasPaused) {
1044
- this.runtime.pause();
1045
- }
1039
+ // Use requestPause for dry mode to temporarily pause without affecting base run mode
1040
+ const releasePause = options?.dry ? this.runtime.requestPause() : null;
1046
1041
  try {
1047
1042
  this.runtime.update(def, this.registry);
1048
1043
  this.emit("invalidate", { reason: "graph-updated" });
1049
1044
  }
1050
1045
  finally {
1051
- // Resume only if we paused it due to dry option
1052
- if (options?.dry && !wasPaused) {
1053
- this.runtime.resume();
1054
- }
1046
+ releasePause?.();
1055
1047
  }
1056
1048
  }
1057
1049
  launch(def, opts) {
@@ -1074,7 +1066,7 @@ class LocalGraphRunner extends AbstractGraphRunner {
1074
1066
  if (!this.runtime)
1075
1067
  throw new Error("Runtime not built");
1076
1068
  // Use shared engine factory
1077
- this.engine = new sparkGraph.UnifiedEngine(this.runtime, opts?.runMode);
1069
+ this.engine = new sparkGraph.LocalEngine(this.runtime, opts?.runMode);
1078
1070
  if (!this.engine)
1079
1071
  throw new Error("Failed to create engine");
1080
1072
  this.engine.on("value", (e) => this.emit("value", e));
@@ -6225,8 +6217,11 @@ function WorkbenchStudioCanvas({ autoScroll, onAutoScrollChange, example, onExam
6225
6217
  const isConnecting = transportStatus.state === "connecting" ||
6226
6218
  transportStatus.state === "retrying";
6227
6219
  // Only allow Start/Stop when transport is connected or local
6220
+ // For local backend, always allow control (transport state is "local")
6221
+ // For remote backends, require connection
6228
6222
  const canControl = transportStatus.state === "connected" ||
6229
- transportStatus.state === "local";
6223
+ transportStatus.state === "local" ||
6224
+ backendKind === "local"; // Always allow control for local backend
6230
6225
  if (isConnecting) {
6231
6226
  return (jsxRuntime.jsxs("button", { className: "border rounded px-2 py-1.5 text-gray-500 border-gray-400 flex items-center gap-1 disabled:opacity-50", disabled: true, title: "Connecting to backend...", children: [jsxRuntime.jsx(react$1.ClockClockwiseIcon, { size: 16, className: "animate-spin" }), jsxRuntime.jsx("span", { className: "font-medium ml-1", children: "Connecting..." })] }));
6232
6227
  }
@@ -6249,7 +6244,7 @@ function WorkbenchStudioCanvas({ autoScroll, onAutoScrollChange, example, onExam
6249
6244
  }, disabled: !canControl, title: !canControl
6250
6245
  ? "Waiting for connection"
6251
6246
  : `Start ${runMode === "manual" ? "manual" : "auto"} mode`, children: [jsxRuntime.jsx(react$1.PlayIcon, { size: 16, weight: "fill" }), jsxRuntime.jsx("span", { className: "font-medium ml-1", children: "Start" })] }));
6252
- }, [transportStatus, isGraphRunning, runner, runMode, wb]);
6247
+ }, [transportStatus, isGraphRunning, runner, runMode, wb, backendKind]);
6253
6248
  const defaultExamples = React.useMemo(() => [
6254
6249
  {
6255
6250
  id: "simple",