@bian-womp/spark-remote 0.2.70 → 0.2.72

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
@@ -386,11 +386,13 @@ async function createRuntimeAdapter(createRegistry, send, extensions) {
386
386
  },
387
387
  setExtData: (data) => {
388
388
  if (!data || typeof data !== "object") {
389
+ // Clear all extData when called with non-object (backward-compatible)
389
390
  extData = {};
390
391
  return;
391
392
  }
392
- // Replace to keep semantics deterministic
393
- extData = { ...data };
393
+ // Merge with existing extData so that callers can update a subset of fields
394
+ // (e.g., { ui } or { runtime }) without dropping the other ones.
395
+ extData = { ...extData, ...data };
394
396
  },
395
397
  getExtData: () => {
396
398
  return extData;
@@ -451,8 +453,6 @@ async function createRuntimeAdapter(createRegistry, send, extensions) {
451
453
  commit: async (reason) => { },
452
454
  undo: async () => false,
453
455
  redo: async () => false,
454
- canUndo: async () => false,
455
- canRedo: async () => false,
456
456
  describeRegistry: () => {
457
457
  // types (include enum options when available)
458
458
  const types = Array.from(registry.types.entries()).map(([id, d]) => {
@@ -667,8 +667,6 @@ async function createRuntimeAdapter(createRegistry, send, extensions) {
667
667
  cancelNodeRuns: wrapMethod("cancelNodeRuns", originalApi.cancelNodeRuns),
668
668
  undo: wrapMethod("undo", originalApi.undo),
669
669
  redo: wrapMethod("redo", originalApi.redo),
670
- canUndo: wrapMethod("canUndo", originalApi.canUndo),
671
- canRedo: wrapMethod("canRedo", originalApi.canRedo),
672
670
  };
673
671
  return extendedApi;
674
672
  }
@@ -1183,9 +1181,11 @@ class RuntimeApiClient {
1183
1181
  }
1184
1182
  async commit(reason) {
1185
1183
  const transport = await this.ensureConnected();
1186
- await transport.request({
1184
+ const res = await transport.request({
1187
1185
  message: { type: "Commit", payload: { reason } },
1188
1186
  });
1187
+ const payload = res?.message || {};
1188
+ return payload.history;
1189
1189
  }
1190
1190
  async undo() {
1191
1191
  const transport = await this.ensureConnected();
@@ -1203,22 +1203,6 @@ class RuntimeApiClient {
1203
1203
  const payload = res?.message || {};
1204
1204
  return payload.success ?? false;
1205
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
- }
1222
1206
  /**
1223
1207
  * Dispose the client and close the transport connection.
1224
1208
  * Idempotent: safe to call multiple times.
@@ -1476,8 +1460,8 @@ class RuntimeApiServer {
1476
1460
  }
1477
1461
  case "Commit": {
1478
1462
  this.logCommand("Commit", env);
1479
- await this.runtimeApi.commit(msg.payload.reason);
1480
- ack();
1463
+ const history = await this.runtimeApi.commit(msg.payload.reason);
1464
+ ack(history ? { history } : undefined);
1481
1465
  break;
1482
1466
  }
1483
1467
  case "Undo": {
@@ -1492,18 +1476,6 @@ class RuntimeApiServer {
1492
1476
  ack({ success });
1493
1477
  break;
1494
1478
  }
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
1479
  default: {
1508
1480
  this.logCommand("Unknown type", env);
1509
1481
  ack();