@bian-womp/spark-remote 0.2.69 → 0.2.71

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
@@ -448,11 +448,9 @@ async function createRuntimeAdapter(createRegistry, send, extensions) {
448
448
  cancelNodeRuns: (nodeIds) => {
449
449
  graphRuntime?.cancelNodeRuns(nodeIds);
450
450
  },
451
- commit: async () => { },
451
+ commit: async (reason) => { },
452
452
  undo: async () => false,
453
453
  redo: async () => false,
454
- canUndo: async () => false,
455
- canRedo: async () => false,
456
454
  describeRegistry: () => {
457
455
  // types (include enum options when available)
458
456
  const types = Array.from(registry.types.entries()).map(([id, d]) => {
@@ -667,8 +665,6 @@ async function createRuntimeAdapter(createRegistry, send, extensions) {
667
665
  cancelNodeRuns: wrapMethod("cancelNodeRuns", originalApi.cancelNodeRuns),
668
666
  undo: wrapMethod("undo", originalApi.undo),
669
667
  redo: wrapMethod("redo", originalApi.redo),
670
- canUndo: wrapMethod("canUndo", originalApi.canUndo),
671
- canRedo: wrapMethod("canRedo", originalApi.canRedo),
672
668
  };
673
669
  return extendedApi;
674
670
  }
@@ -1181,11 +1177,13 @@ class RuntimeApiClient {
1181
1177
  message: { type: "SetExtData", payload: data },
1182
1178
  });
1183
1179
  }
1184
- async commit() {
1180
+ async commit(reason) {
1185
1181
  const transport = await this.ensureConnected();
1186
- await transport.request({
1187
- message: { type: "Commit" },
1182
+ const res = await transport.request({
1183
+ message: { type: "Commit", payload: { reason } },
1188
1184
  });
1185
+ const payload = res?.message || {};
1186
+ return payload.history;
1189
1187
  }
1190
1188
  async undo() {
1191
1189
  const transport = await this.ensureConnected();
@@ -1203,22 +1201,6 @@ class RuntimeApiClient {
1203
1201
  const payload = res?.message || {};
1204
1202
  return payload.success ?? false;
1205
1203
  }
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
- }
1222
1204
  /**
1223
1205
  * Dispose the client and close the transport connection.
1224
1206
  * Idempotent: safe to call multiple times.
@@ -1447,7 +1429,7 @@ class RuntimeApiServer {
1447
1429
  from: msg.payload.from,
1448
1430
  to: msg.payload.to,
1449
1431
  });
1450
- const value = await this.runtimeApi.coerce(msg.payload?.from, msg.payload?.to, msg.payload?.value);
1432
+ const value = await this.runtimeApi.coerce(msg.payload.from, msg.payload.to, msg.payload.value);
1451
1433
  ack({ value });
1452
1434
  break;
1453
1435
  }
@@ -1476,8 +1458,8 @@ class RuntimeApiServer {
1476
1458
  }
1477
1459
  case "Commit": {
1478
1460
  this.logCommand("Commit", env);
1479
- await this.runtimeApi.commit();
1480
- ack();
1461
+ const history = await this.runtimeApi.commit(msg.payload.reason);
1462
+ ack(history ? { history } : undefined);
1481
1463
  break;
1482
1464
  }
1483
1465
  case "Undo": {
@@ -1492,18 +1474,6 @@ class RuntimeApiServer {
1492
1474
  ack({ success });
1493
1475
  break;
1494
1476
  }
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
- }
1507
1477
  default: {
1508
1478
  this.logCommand("Unknown type", env);
1509
1479
  ack();