@bian-womp/spark-remote 0.2.68 → 0.2.70

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
@@ -445,6 +445,14 @@ async function createRuntimeAdapter(createRegistry, send, extensions) {
445
445
  });
446
446
  originalApi.setExtData(payload.extData || {});
447
447
  },
448
+ cancelNodeRuns: (nodeIds) => {
449
+ graphRuntime?.cancelNodeRuns(nodeIds);
450
+ },
451
+ commit: async (reason) => { },
452
+ undo: async () => false,
453
+ redo: async () => false,
454
+ canUndo: async () => false,
455
+ canRedo: async () => false,
448
456
  describeRegistry: () => {
449
457
  // types (include enum options when available)
450
458
  const types = Array.from(registry.types.entries()).map(([id, d]) => {
@@ -655,6 +663,12 @@ async function createRuntimeAdapter(createRegistry, send, extensions) {
655
663
  launch: wrapMethod("launch", originalApi.launch),
656
664
  whenIdle: wrapMethod("whenIdle", originalApi.whenIdle),
657
665
  dispose: wrapMethod("dispose", originalApi.dispose),
666
+ commit: wrapMethod("commit", originalApi.commit),
667
+ cancelNodeRuns: wrapMethod("cancelNodeRuns", originalApi.cancelNodeRuns),
668
+ undo: wrapMethod("undo", originalApi.undo),
669
+ redo: wrapMethod("redo", originalApi.redo),
670
+ canUndo: wrapMethod("canUndo", originalApi.canUndo),
671
+ canRedo: wrapMethod("canRedo", originalApi.canRedo),
658
672
  };
659
673
  return extendedApi;
660
674
  }
@@ -1051,6 +1065,16 @@ class RuntimeApiClient {
1051
1065
  message: { type: "RegistryApply", payload: { deltas } },
1052
1066
  });
1053
1067
  }
1068
+ async setInputs(nodeId, inputs, options) {
1069
+ const transport = await this.ensureConnected();
1070
+ await transport.request({
1071
+ message: {
1072
+ type: "SetInputs",
1073
+ payload: { nodeId, inputs },
1074
+ dry: options?.dry,
1075
+ },
1076
+ });
1077
+ }
1054
1078
  async snapshot() {
1055
1079
  const transport = await this.ensureConnected();
1056
1080
  const res = await transport.request({
@@ -1157,6 +1181,44 @@ class RuntimeApiClient {
1157
1181
  message: { type: "SetExtData", payload: data },
1158
1182
  });
1159
1183
  }
1184
+ async commit(reason) {
1185
+ const transport = await this.ensureConnected();
1186
+ await transport.request({
1187
+ message: { type: "Commit", payload: { reason } },
1188
+ });
1189
+ }
1190
+ async undo() {
1191
+ const transport = await this.ensureConnected();
1192
+ const res = await transport.request({
1193
+ message: { type: "Undo" },
1194
+ });
1195
+ const payload = res?.message || {};
1196
+ return payload.success ?? false;
1197
+ }
1198
+ async redo() {
1199
+ const transport = await this.ensureConnected();
1200
+ const res = await transport.request({
1201
+ message: { type: "Redo" },
1202
+ });
1203
+ const payload = res?.message || {};
1204
+ return payload.success ?? false;
1205
+ }
1206
+ async canUndo() {
1207
+ const transport = await this.ensureConnected();
1208
+ const res = await transport.request({
1209
+ message: { type: "CanUndo" },
1210
+ });
1211
+ const payload = res?.message || {};
1212
+ return payload.canUndo ?? false;
1213
+ }
1214
+ async canRedo() {
1215
+ const transport = await this.ensureConnected();
1216
+ const res = await transport.request({
1217
+ message: { type: "CanRedo" },
1218
+ });
1219
+ const payload = res?.message || {};
1220
+ return payload.canRedo ?? false;
1221
+ }
1160
1222
  /**
1161
1223
  * Dispose the client and close the transport connection.
1162
1224
  * Idempotent: safe to call multiple times.
@@ -1385,7 +1447,7 @@ class RuntimeApiServer {
1385
1447
  from: msg.payload.from,
1386
1448
  to: msg.payload.to,
1387
1449
  });
1388
- const value = await this.runtimeApi.coerce(msg.payload?.from, msg.payload?.to, msg.payload?.value);
1450
+ const value = await this.runtimeApi.coerce(msg.payload.from, msg.payload.to, msg.payload.value);
1389
1451
  ack({ value });
1390
1452
  break;
1391
1453
  }
@@ -1412,6 +1474,36 @@ class RuntimeApiServer {
1412
1474
  ack();
1413
1475
  break;
1414
1476
  }
1477
+ case "Commit": {
1478
+ this.logCommand("Commit", env);
1479
+ await this.runtimeApi.commit(msg.payload.reason);
1480
+ ack();
1481
+ break;
1482
+ }
1483
+ case "Undo": {
1484
+ this.logCommand("Undo", env);
1485
+ const success = await this.runtimeApi.undo();
1486
+ ack({ success });
1487
+ break;
1488
+ }
1489
+ case "Redo": {
1490
+ this.logCommand("Redo", env);
1491
+ const success = await this.runtimeApi.redo();
1492
+ ack({ success });
1493
+ break;
1494
+ }
1495
+ case "CanUndo": {
1496
+ this.logCommand("CanUndo", env);
1497
+ const canUndo = await this.runtimeApi.canUndo();
1498
+ ack({ canUndo });
1499
+ break;
1500
+ }
1501
+ case "CanRedo": {
1502
+ this.logCommand("CanRedo", env);
1503
+ const canRedo = await this.runtimeApi.canRedo();
1504
+ ack({ canRedo });
1505
+ break;
1506
+ }
1415
1507
  default: {
1416
1508
  this.logCommand("Unknown type", env);
1417
1509
  ack();