@lace-cloud/canvas 0.27.0 → 0.28.0

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/README.md CHANGED
@@ -147,10 +147,10 @@ const { ports, close } = await openEngineSession(caller, { root: '/path/to/autho
147
147
  cancelling the command's remote effects. An `Invoke` stream that stops
148
148
  before the command's exit, by an end or an error, rejects `events` with
149
149
  `CommandDetachedError` when the consumer's `signal` aborted; otherwise
150
- with `CommandUnobservedError` once the engine sent `started` (it
151
- accepted the request and runs the command, so the command ran and its
152
- outcome never arrived), and with the call's own error before it (the
153
- command never ran).
150
+ with `CommandUnobservedError`, which names the command's `path`, once
151
+ the engine sent `started` (it accepted the request and runs the
152
+ command, so the command ran and its outcome never arrived), and with the
153
+ call's own error before it (the command never ran).
154
154
  - `openEngineCommands(caller, { cwd })` is the commands mapping:
155
155
  `Initialize` once, `Invoke` per command, no session and no Subscribe.
156
156
  - Both mappings name the protocol version this package speaks
@@ -10500,10 +10500,9 @@ var CommandDetachedError = class extends Error {
10500
10500
  }
10501
10501
  };
10502
10502
  var CommandUnobservedError = class extends Error {
10503
- constructor() {
10504
- super(
10505
- "the engine's stream ended before the command exited: the command ran and may have made changes, but its outcome is unknown"
10506
- );
10503
+ constructor(path) {
10504
+ super(`the engine's stream ended before \`lace ${path}\` exited`);
10505
+ this.path = path;
10507
10506
  }
10508
10507
  };
10509
10508
 
@@ -10948,6 +10947,7 @@ var COMMANDS = {
10948
10947
  "type": "string"
10949
10948
  }
10950
10949
  },
10950
+ "effect": "write",
10951
10951
  "hidden": false,
10952
10952
  "yes": false
10953
10953
  },
@@ -10974,6 +10974,7 @@ var COMMANDS = {
10974
10974
  "type": "string"
10975
10975
  }
10976
10976
  },
10977
+ "effect": "read",
10977
10978
  "hidden": false,
10978
10979
  "yes": false
10979
10980
  },
@@ -10998,6 +10999,7 @@ var COMMANDS = {
10998
10999
  "type": "string"
10999
11000
  }
11000
11001
  },
11002
+ "effect": "read",
11001
11003
  "hidden": false,
11002
11004
  "yes": false
11003
11005
  },
@@ -11012,6 +11014,7 @@ var COMMANDS = {
11012
11014
  "type": "string"
11013
11015
  }
11014
11016
  },
11017
+ "effect": "write",
11015
11018
  "hidden": false,
11016
11019
  "yes": false
11017
11020
  },
@@ -11023,6 +11026,7 @@ var COMMANDS = {
11023
11026
  "type": "string"
11024
11027
  }
11025
11028
  },
11029
+ "effect": "write",
11026
11030
  "hidden": false,
11027
11031
  "yes": false
11028
11032
  },
@@ -11034,6 +11038,7 @@ var COMMANDS = {
11034
11038
  "type": "bool"
11035
11039
  }
11036
11040
  },
11041
+ "effect": "read",
11037
11042
  "hidden": false,
11038
11043
  "yes": false
11039
11044
  },
@@ -11061,6 +11066,7 @@ var COMMANDS = {
11061
11066
  "type": "string"
11062
11067
  }
11063
11068
  },
11069
+ "effect": "write",
11064
11070
  "hidden": false,
11065
11071
  "yes": false
11066
11072
  },
@@ -11076,6 +11082,7 @@ var COMMANDS = {
11076
11082
  ]
11077
11083
  }
11078
11084
  },
11085
+ "effect": "write",
11079
11086
  "hidden": false,
11080
11087
  "yes": false
11081
11088
  },
@@ -11094,6 +11101,7 @@ var COMMANDS = {
11094
11101
  "type": "string"
11095
11102
  }
11096
11103
  },
11104
+ "effect": "rewrite",
11097
11105
  "hidden": false,
11098
11106
  "yes": false
11099
11107
  },
@@ -11117,6 +11125,7 @@ var COMMANDS = {
11117
11125
  "type": "string"
11118
11126
  }
11119
11127
  },
11128
+ "effect": "write",
11120
11129
  "hidden": false,
11121
11130
  "yes": false
11122
11131
  },
@@ -11144,6 +11153,7 @@ var COMMANDS = {
11144
11153
  "type": "bool"
11145
11154
  }
11146
11155
  },
11156
+ "effect": "rewrite",
11147
11157
  "hidden": false,
11148
11158
  "yes": false
11149
11159
  },
@@ -11178,6 +11188,7 @@ var COMMANDS = {
11178
11188
  "type": "bool"
11179
11189
  }
11180
11190
  },
11191
+ "effect": "read",
11181
11192
  "hidden": false,
11182
11193
  "yes": false
11183
11194
  },
@@ -11206,6 +11217,7 @@ var COMMANDS = {
11206
11217
  ]
11207
11218
  }
11208
11219
  },
11220
+ "effect": "write",
11209
11221
  "hidden": false,
11210
11222
  "yes": false
11211
11223
  },
@@ -11221,6 +11233,7 @@ var COMMANDS = {
11221
11233
  ]
11222
11234
  }
11223
11235
  },
11236
+ "effect": "read",
11224
11237
  "hidden": false,
11225
11238
  "yes": false
11226
11239
  },
@@ -11236,6 +11249,7 @@ var COMMANDS = {
11236
11249
  ]
11237
11250
  }
11238
11251
  },
11252
+ "effect": "read",
11239
11253
  "hidden": false,
11240
11254
  "yes": false
11241
11255
  },
@@ -11256,6 +11270,7 @@ var COMMANDS = {
11256
11270
  ]
11257
11271
  }
11258
11272
  },
11273
+ "effect": "write",
11259
11274
  "hidden": false,
11260
11275
  "yes": false
11261
11276
  },
@@ -11282,6 +11297,7 @@ var COMMANDS = {
11282
11297
  "type": "string"
11283
11298
  }
11284
11299
  },
11300
+ "effect": "read",
11285
11301
  "hidden": false,
11286
11302
  "yes": false
11287
11303
  },
@@ -11306,6 +11322,7 @@ var COMMANDS = {
11306
11322
  "type": "string"
11307
11323
  }
11308
11324
  },
11325
+ "effect": "read",
11309
11326
  "hidden": false,
11310
11327
  "yes": false
11311
11328
  },
@@ -11332,6 +11349,7 @@ var COMMANDS = {
11332
11349
  "type": "string"
11333
11350
  }
11334
11351
  },
11352
+ "effect": "read",
11335
11353
  "hidden": false,
11336
11354
  "yes": false
11337
11355
  },
@@ -11361,6 +11379,7 @@ var COMMANDS = {
11361
11379
  ]
11362
11380
  }
11363
11381
  },
11382
+ "effect": "read",
11364
11383
  "hidden": false,
11365
11384
  "yes": false
11366
11385
  },
@@ -11403,6 +11422,7 @@ var COMMANDS = {
11403
11422
  "type": "string"
11404
11423
  }
11405
11424
  },
11425
+ "effect": "read",
11406
11426
  "hidden": false,
11407
11427
  "yes": false
11408
11428
  },
@@ -11435,6 +11455,7 @@ var COMMANDS = {
11435
11455
  "type": "string"
11436
11456
  }
11437
11457
  },
11458
+ "effect": "read",
11438
11459
  "hidden": false,
11439
11460
  "yes": false
11440
11461
  },
@@ -11460,6 +11481,7 @@ var COMMANDS = {
11460
11481
  "type": "string"
11461
11482
  }
11462
11483
  },
11484
+ "effect": "read",
11463
11485
  "hidden": false,
11464
11486
  "yes": false
11465
11487
  },
@@ -11489,6 +11511,7 @@ var COMMANDS = {
11489
11511
  "type": "string"
11490
11512
  }
11491
11513
  },
11514
+ "effect": "write",
11492
11515
  "hidden": false,
11493
11516
  "yes": false
11494
11517
  },
@@ -11518,6 +11541,7 @@ var COMMANDS = {
11518
11541
  "type": "string"
11519
11542
  }
11520
11543
  },
11544
+ "effect": "read",
11521
11545
  "hidden": false,
11522
11546
  "yes": false
11523
11547
  },
@@ -11560,6 +11584,7 @@ var COMMANDS = {
11560
11584
  "type": "string"
11561
11585
  }
11562
11586
  },
11587
+ "effect": "read",
11563
11588
  "hidden": false,
11564
11589
  "yes": false
11565
11590
  },
@@ -11589,6 +11614,7 @@ var COMMANDS = {
11589
11614
  "type": "string"
11590
11615
  }
11591
11616
  },
11617
+ "effect": "read",
11592
11618
  "hidden": false,
11593
11619
  "yes": false
11594
11620
  },
@@ -11615,6 +11641,7 @@ var COMMANDS = {
11615
11641
  "type": "string"
11616
11642
  }
11617
11643
  },
11644
+ "effect": "read",
11618
11645
  "hidden": false,
11619
11646
  "yes": false
11620
11647
  },
@@ -11661,6 +11688,7 @@ var COMMANDS = {
11661
11688
  "repeated": true
11662
11689
  }
11663
11690
  },
11691
+ "effect": "write",
11664
11692
  "hidden": false,
11665
11693
  "yes": false
11666
11694
  },
@@ -11709,6 +11737,7 @@ var COMMANDS = {
11709
11737
  "type": "string"
11710
11738
  }
11711
11739
  },
11740
+ "effect": "write",
11712
11741
  "hidden": false,
11713
11742
  "yes": false
11714
11743
  },
@@ -11738,6 +11767,7 @@ var COMMANDS = {
11738
11767
  "type": "bool"
11739
11768
  }
11740
11769
  },
11770
+ "effect": "write",
11741
11771
  "hidden": false,
11742
11772
  "yes": true
11743
11773
  },
@@ -11770,6 +11800,7 @@ var COMMANDS = {
11770
11800
  "type": "string"
11771
11801
  }
11772
11802
  },
11803
+ "effect": "read",
11773
11804
  "hidden": false,
11774
11805
  "yes": false
11775
11806
  },
@@ -11822,6 +11853,7 @@ var COMMANDS = {
11822
11853
  "type": "bool"
11823
11854
  }
11824
11855
  },
11856
+ "effect": "write",
11825
11857
  "hidden": false,
11826
11858
  "yes": true
11827
11859
  },
@@ -11851,6 +11883,7 @@ var COMMANDS = {
11851
11883
  "type": "string"
11852
11884
  }
11853
11885
  },
11886
+ "effect": "read",
11854
11887
  "hidden": false,
11855
11888
  "yes": false
11856
11889
  },
@@ -11887,6 +11920,7 @@ var COMMANDS = {
11887
11920
  "type": "string"
11888
11921
  }
11889
11922
  },
11923
+ "effect": "rewrite",
11890
11924
  "hidden": false,
11891
11925
  "yes": false
11892
11926
  },
@@ -11920,6 +11954,7 @@ var COMMANDS = {
11920
11954
  "type": "string"
11921
11955
  }
11922
11956
  },
11957
+ "effect": "read",
11923
11958
  "hidden": false,
11924
11959
  "yes": false
11925
11960
  },
@@ -11954,6 +11989,7 @@ var COMMANDS = {
11954
11989
  "repeated": true
11955
11990
  }
11956
11991
  },
11992
+ "effect": "write",
11957
11993
  "hidden": false,
11958
11994
  "yes": false
11959
11995
  },
@@ -11989,6 +12025,7 @@ var COMMANDS = {
11989
12025
  "type": "duration"
11990
12026
  }
11991
12027
  },
12028
+ "effect": "write",
11992
12029
  "hidden": false,
11993
12030
  "yes": false
11994
12031
  },
@@ -12030,6 +12067,7 @@ var COMMANDS = {
12030
12067
  "type": "string"
12031
12068
  }
12032
12069
  },
12070
+ "effect": "write",
12033
12071
  "hidden": false,
12034
12072
  "yes": false
12035
12073
  },
@@ -12048,6 +12086,7 @@ var COMMANDS = {
12048
12086
  ]
12049
12087
  }
12050
12088
  },
12089
+ "effect": "read",
12051
12090
  "hidden": false,
12052
12091
  "yes": false
12053
12092
  },
@@ -12072,6 +12111,7 @@ var COMMANDS = {
12072
12111
  ]
12073
12112
  }
12074
12113
  },
12114
+ "effect": "read",
12075
12115
  "hidden": false,
12076
12116
  "yes": false
12077
12117
  },
@@ -12095,6 +12135,7 @@ var COMMANDS = {
12095
12135
  ]
12096
12136
  }
12097
12137
  },
12138
+ "effect": "write",
12098
12139
  "hidden": false,
12099
12140
  "yes": false
12100
12141
  },
@@ -12110,6 +12151,7 @@ var COMMANDS = {
12110
12151
  ]
12111
12152
  }
12112
12153
  },
12154
+ "effect": "read",
12113
12155
  "hidden": false,
12114
12156
  "yes": false
12115
12157
  },
@@ -12125,6 +12167,7 @@ var COMMANDS = {
12125
12167
  ]
12126
12168
  }
12127
12169
  },
12170
+ "effect": "read",
12128
12171
  "hidden": false,
12129
12172
  "yes": false
12130
12173
  }
@@ -13059,7 +13102,7 @@ function commandsPort(caller, commandPaths, ownCwd) {
13059
13102
  let started = false;
13060
13103
  const stopped = (error) => {
13061
13104
  if (signal.aborted) return new CommandDetachedError();
13062
- if (started) return new CommandUnobservedError();
13105
+ if (started) return new CommandUnobservedError(path);
13063
13106
  return error;
13064
13107
  };
13065
13108
  try {
@@ -13277,6 +13320,13 @@ function liveSlots(slots, current) {
13277
13320
  report: liveReport(report, current)
13278
13321
  };
13279
13322
  }
13323
+ function commandUnderWay({
13324
+ run,
13325
+ preview: preview2,
13326
+ running
13327
+ }) {
13328
+ return run?.outcome.kind === "running" || preview2?.outcome.kind === "running" || running.size > 0;
13329
+ }
13280
13330
  function withPhase(phases, name) {
13281
13331
  return [...phases.map((p) => ({ ...p, status: "done" })), { name, status: "current" }];
13282
13332
  }
@@ -13322,18 +13372,19 @@ function runningFor(slot, token) {
13322
13372
  if (slot?.token !== token) return false;
13323
13373
  return "done" in slot ? !slot.done : slot.outcome.kind === "running";
13324
13374
  }
13325
- function failureSays(error, command) {
13375
+ function failureSays(error) {
13326
13376
  if (error instanceof CommandExitError) {
13327
13377
  if (error.failure) return { message: error.failure.message, failure: error.failure };
13328
13378
  const stderr = error.stderrTail.trim();
13329
13379
  return { message: stderr || `the command exited with code ${error.code} and wrote nothing` };
13330
13380
  }
13331
- if (error instanceof CommandUnobservedError && command.kind === "read") {
13332
- return { message: `the stream ended before \`lace ${command.path}\` finished; run it again` };
13381
+ if (error instanceof CommandUnobservedError) {
13382
+ return {
13383
+ message: COMMANDS[error.path].effect === "read" ? `${error.message}; run it again` : `${error.message}: it ran and may have made changes, but its outcome is unknown`
13384
+ };
13333
13385
  }
13334
13386
  return { message: error instanceof Error ? error.message : String(error) };
13335
13387
  }
13336
- var RUN = { kind: "write" };
13337
13388
  function settleRun(prev, token, error) {
13338
13389
  const carried = prev && prev.token === token ? prev : null;
13339
13390
  const lastLog = carried?.lastLog ?? null;
@@ -13349,7 +13400,7 @@ function settleRun(prev, token, error) {
13349
13400
  if (error.code === 7)
13350
13401
  return {
13351
13402
  token,
13352
- outcome: { kind: "blocked", ...failureSays(error, RUN) },
13403
+ outcome: { kind: "blocked", ...failureSays(error) },
13353
13404
  lastLog,
13354
13405
  submitted,
13355
13406
  phases
@@ -13357,7 +13408,7 @@ function settleRun(prev, token, error) {
13357
13408
  }
13358
13409
  return {
13359
13410
  token,
13360
- outcome: { kind: "failed", ...failureSays(error, RUN) },
13411
+ outcome: { kind: "failed", ...failureSays(error) },
13361
13412
  lastLog,
13362
13413
  submitted,
13363
13414
  phases
@@ -13526,10 +13577,7 @@ function defineCommand(binding) {
13526
13577
  } catch (err) {
13527
13578
  const settledByDocument = rendered && binding.result.kind === "notify" && (err instanceof CommandExitError || err instanceof CommandUnobservedError);
13528
13579
  if (!rt.fail(err) && !(err instanceof CommandDetachedError) && !settledByDocument) {
13529
- const { message, failure } = failureSays(
13530
- err,
13531
- binding.result.kind === "preview" || binding.result.kind === "follow" ? { kind: "read", path: binding.path } : { kind: "write" }
13532
- );
13580
+ const { message, failure } = failureSays(err);
13533
13581
  rt.ports.presenter.notify("error", message, ...failure ? [failure] : []);
13534
13582
  }
13535
13583
  if (binding.invalidates) rt.tick();
@@ -14428,6 +14476,7 @@ export {
14428
14476
  diagnosticsOfDocument,
14429
14477
  reportDiagnostics,
14430
14478
  liveSlots,
14479
+ commandUnderWay,
14431
14480
  reduceRun,
14432
14481
  failureSays,
14433
14482
  settleRun,
@@ -14447,4 +14496,4 @@ export {
14447
14496
  AutosaveEndedError,
14448
14497
  autosave
14449
14498
  };
14450
- //# sourceMappingURL=chunk-F3X6TTZ6.mjs.map
14499
+ //# sourceMappingURL=chunk-DYTLLFEM.mjs.map