@lace-cloud/canvas 0.29.0 → 0.31.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.
@@ -3384,6 +3384,7 @@ var Reason = /* @__PURE__ */ ((Reason2) => {
3384
3384
  Reason2[Reason2["REASON_NO_ORIGIN_REMOTE"] = 19] = "REASON_NO_ORIGIN_REMOTE";
3385
3385
  Reason2[Reason2["REASON_IMPORT_UNDECLARED"] = 20] = "REASON_IMPORT_UNDECLARED";
3386
3386
  Reason2[Reason2["REASON_ALREADY_IMPORTED"] = 21] = "REASON_ALREADY_IMPORTED";
3387
+ Reason2[Reason2["REASON_NO_LOCKFILE"] = 22] = "REASON_NO_LOCKFILE";
3387
3388
  Reason2[Reason2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
3388
3389
  return Reason2;
3389
3390
  })(Reason || {});
@@ -3455,6 +3456,9 @@ function reasonFromJSON(object) {
3455
3456
  case 21:
3456
3457
  case "REASON_ALREADY_IMPORTED":
3457
3458
  return 21 /* REASON_ALREADY_IMPORTED */;
3459
+ case 22:
3460
+ case "REASON_NO_LOCKFILE":
3461
+ return 22 /* REASON_NO_LOCKFILE */;
3458
3462
  case -1:
3459
3463
  case "UNRECOGNIZED":
3460
3464
  default:
@@ -3507,6 +3511,8 @@ function reasonToJSON(object) {
3507
3511
  return "REASON_IMPORT_UNDECLARED";
3508
3512
  case 21 /* REASON_ALREADY_IMPORTED */:
3509
3513
  return "REASON_ALREADY_IMPORTED";
3514
+ case 22 /* REASON_NO_LOCKFILE */:
3515
+ return "REASON_NO_LOCKFILE";
3510
3516
  case -1 /* UNRECOGNIZED */:
3511
3517
  default:
3512
3518
  return "UNRECOGNIZED";
@@ -4426,13 +4432,19 @@ var SessionGenerateRequest = {
4426
4432
  }
4427
4433
  };
4428
4434
  function createBaseSessionGenerateResponse() {
4429
- return { files_written: [], validate_json: "", revision: 0 };
4435
+ return { files_written: [], files_changed: [], files_removed: [], validate_json: "", revision: 0 };
4430
4436
  }
4431
4437
  var SessionGenerateResponse = {
4432
4438
  encode(message, writer = new BinaryWriter4()) {
4433
4439
  for (const v of message.files_written) {
4434
4440
  writer.uint32(10).string(v);
4435
4441
  }
4442
+ for (const v of message.files_changed) {
4443
+ writer.uint32(50).string(v);
4444
+ }
4445
+ for (const v of message.files_removed) {
4446
+ writer.uint32(58).string(v);
4447
+ }
4436
4448
  if (message.validate_json !== "") {
4437
4449
  writer.uint32(34).string(message.validate_json);
4438
4450
  }
@@ -4455,6 +4467,20 @@ var SessionGenerateResponse = {
4455
4467
  message.files_written.push(reader.string());
4456
4468
  continue;
4457
4469
  }
4470
+ case 6: {
4471
+ if (tag !== 50) {
4472
+ break;
4473
+ }
4474
+ message.files_changed.push(reader.string());
4475
+ continue;
4476
+ }
4477
+ case 7: {
4478
+ if (tag !== 58) {
4479
+ break;
4480
+ }
4481
+ message.files_removed.push(reader.string());
4482
+ continue;
4483
+ }
4458
4484
  case 4: {
4459
4485
  if (tag !== 34) {
4460
4486
  break;
@@ -4480,6 +4506,8 @@ var SessionGenerateResponse = {
4480
4506
  fromJSON(object) {
4481
4507
  return {
4482
4508
  files_written: globalThis.Array.isArray(object?.filesWritten) ? object.filesWritten.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.files_written) ? object.files_written.map((e) => globalThis.String(e)) : [],
4509
+ files_changed: globalThis.Array.isArray(object?.filesChanged) ? object.filesChanged.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.files_changed) ? object.files_changed.map((e) => globalThis.String(e)) : [],
4510
+ files_removed: globalThis.Array.isArray(object?.filesRemoved) ? object.filesRemoved.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.files_removed) ? object.files_removed.map((e) => globalThis.String(e)) : [],
4483
4511
  validate_json: isSet3(object.validateJson) ? globalThis.String(object.validateJson) : isSet3(object.validate_json) ? globalThis.String(object.validate_json) : "",
4484
4512
  revision: isSet3(object.revision) ? globalThis.Number(object.revision) : 0
4485
4513
  };
@@ -4489,6 +4517,12 @@ var SessionGenerateResponse = {
4489
4517
  if (message.files_written?.length) {
4490
4518
  obj.filesWritten = message.files_written;
4491
4519
  }
4520
+ if (message.files_changed?.length) {
4521
+ obj.filesChanged = message.files_changed;
4522
+ }
4523
+ if (message.files_removed?.length) {
4524
+ obj.filesRemoved = message.files_removed;
4525
+ }
4492
4526
  if (message.validate_json !== "") {
4493
4527
  obj.validateJson = message.validate_json;
4494
4528
  }
@@ -4503,6 +4537,8 @@ var SessionGenerateResponse = {
4503
4537
  fromPartial(object) {
4504
4538
  const message = createBaseSessionGenerateResponse();
4505
4539
  message.files_written = object.files_written?.map((e) => e) || [];
4540
+ message.files_changed = object.files_changed?.map((e) => e) || [];
4541
+ message.files_removed = object.files_removed?.map((e) => e) || [];
4506
4542
  message.validate_json = object.validate_json ?? "";
4507
4543
  message.revision = object.revision ?? 0;
4508
4544
  return message;
@@ -8423,13 +8459,19 @@ var GenerateProgress = {
8423
8459
  }
8424
8460
  };
8425
8461
  function createBaseGenerateSuccess() {
8426
- return { files_written: [], validate_json: "", generate_id: "" };
8462
+ return { files_written: [], files_changed: [], files_removed: [], validate_json: "", generate_id: "" };
8427
8463
  }
8428
8464
  var GenerateSuccess = {
8429
8465
  encode(message, writer = new BinaryWriter4()) {
8430
8466
  for (const v of message.files_written) {
8431
8467
  writer.uint32(10).string(v);
8432
8468
  }
8469
+ for (const v of message.files_changed) {
8470
+ writer.uint32(42).string(v);
8471
+ }
8472
+ for (const v of message.files_removed) {
8473
+ writer.uint32(50).string(v);
8474
+ }
8433
8475
  if (message.validate_json !== "") {
8434
8476
  writer.uint32(26).string(message.validate_json);
8435
8477
  }
@@ -8452,6 +8494,20 @@ var GenerateSuccess = {
8452
8494
  message.files_written.push(reader.string());
8453
8495
  continue;
8454
8496
  }
8497
+ case 5: {
8498
+ if (tag !== 42) {
8499
+ break;
8500
+ }
8501
+ message.files_changed.push(reader.string());
8502
+ continue;
8503
+ }
8504
+ case 6: {
8505
+ if (tag !== 50) {
8506
+ break;
8507
+ }
8508
+ message.files_removed.push(reader.string());
8509
+ continue;
8510
+ }
8455
8511
  case 3: {
8456
8512
  if (tag !== 26) {
8457
8513
  break;
@@ -8477,6 +8533,8 @@ var GenerateSuccess = {
8477
8533
  fromJSON(object) {
8478
8534
  return {
8479
8535
  files_written: globalThis.Array.isArray(object?.filesWritten) ? object.filesWritten.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.files_written) ? object.files_written.map((e) => globalThis.String(e)) : [],
8536
+ files_changed: globalThis.Array.isArray(object?.filesChanged) ? object.filesChanged.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.files_changed) ? object.files_changed.map((e) => globalThis.String(e)) : [],
8537
+ files_removed: globalThis.Array.isArray(object?.filesRemoved) ? object.filesRemoved.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.files_removed) ? object.files_removed.map((e) => globalThis.String(e)) : [],
8480
8538
  validate_json: isSet3(object.validateJson) ? globalThis.String(object.validateJson) : isSet3(object.validate_json) ? globalThis.String(object.validate_json) : "",
8481
8539
  generate_id: isSet3(object.generateId) ? globalThis.String(object.generateId) : isSet3(object.generate_id) ? globalThis.String(object.generate_id) : ""
8482
8540
  };
@@ -8486,6 +8544,12 @@ var GenerateSuccess = {
8486
8544
  if (message.files_written?.length) {
8487
8545
  obj.filesWritten = message.files_written;
8488
8546
  }
8547
+ if (message.files_changed?.length) {
8548
+ obj.filesChanged = message.files_changed;
8549
+ }
8550
+ if (message.files_removed?.length) {
8551
+ obj.filesRemoved = message.files_removed;
8552
+ }
8489
8553
  if (message.validate_json !== "") {
8490
8554
  obj.validateJson = message.validate_json;
8491
8555
  }
@@ -8500,6 +8564,8 @@ var GenerateSuccess = {
8500
8564
  fromPartial(object) {
8501
8565
  const message = createBaseGenerateSuccess();
8502
8566
  message.files_written = object.files_written?.map((e) => e) || [];
8567
+ message.files_changed = object.files_changed?.map((e) => e) || [];
8568
+ message.files_removed = object.files_removed?.map((e) => e) || [];
8503
8569
  message.validate_json = object.validate_json ?? "";
8504
8570
  message.generate_id = object.generate_id ?? "";
8505
8571
  return message;
@@ -10466,6 +10532,22 @@ function currentFrame(source) {
10466
10532
  if (settled) unsubscribe();
10467
10533
  });
10468
10534
  }
10535
+ var GENERATE_STAGES = ["generating", "validating"];
10536
+ function isGenerateStage(stage) {
10537
+ return GENERATE_STAGES.some((known) => known === stage);
10538
+ }
10539
+ function generatedTree({
10540
+ written,
10541
+ changed,
10542
+ removed
10543
+ }) {
10544
+ return {
10545
+ changed,
10546
+ removed,
10547
+ unchanged: written.length - changed.length,
10548
+ treeChanged: changed.length > 0 || removed.length > 0
10549
+ };
10550
+ }
10469
10551
  var ApplyUnobservedError = class extends Error {
10470
10552
  constructor(end) {
10471
10553
  super(`unobserved: the source stopped (${end.kind}) before the frame that carries the write`);
@@ -10868,6 +10950,30 @@ import {
10868
10950
  ENGINE_PROTOCOL_VERSION
10869
10951
  } from "@lace-cloud/proto";
10870
10952
 
10953
+ // scripts/command-tree.mjs
10954
+ var EFFECTS = /* @__PURE__ */ new Map([
10955
+ ["writes", "write"],
10956
+ ["rewrites", "rewrite"]
10957
+ ]);
10958
+ var RESERVED = /* @__PURE__ */ new Set(["hidden", ...EFFECTS.keys()]);
10959
+ function commandWordsAt(words, { isNode: isNode2, rootFlags }) {
10960
+ const standsAlone = new Set(
10961
+ rootFlags.filter((f) => f.type === "bool").flatMap((f) => [`--${f.name}`, ...f.short ? [`-${f.short}`] : []])
10962
+ );
10963
+ const at = [];
10964
+ for (let i = 0; i < words.length; i++) {
10965
+ const word = words[i];
10966
+ if (word === "--") return { at, stop: i };
10967
+ if (word !== "" && !word.startsWith("-")) {
10968
+ if (!isNode2([...at.map((j) => words[j]), word].join(" "))) return { at, stop: i };
10969
+ at.push(i);
10970
+ } else if (!word.includes("=") && (word.startsWith("--") || word.length === 2) && !standsAlone.has(word)) {
10971
+ i++;
10972
+ }
10973
+ }
10974
+ return { at, stop: words.length };
10975
+ }
10976
+
10871
10977
  // src/contracts/commands.gen.ts
10872
10978
  var COMMANDS = {
10873
10979
  "chaos run": {
@@ -10913,7 +11019,8 @@ var COMMANDS = {
10913
11019
  "values": [
10914
11020
  "table",
10915
11021
  "json"
10916
- ]
11022
+ ],
11023
+ "short": "o"
10917
11024
  },
10918
11025
  "prUrl": {
10919
11026
  "type": "string"
@@ -10968,7 +11075,8 @@ var COMMANDS = {
10968
11075
  "values": [
10969
11076
  "table",
10970
11077
  "json"
10971
- ]
11078
+ ],
11079
+ "short": "o"
10972
11080
  },
10973
11081
  "team": {
10974
11082
  "type": "string"
@@ -10990,7 +11098,8 @@ var COMMANDS = {
10990
11098
  "values": [
10991
11099
  "table",
10992
11100
  "json"
10993
- ]
11101
+ ],
11102
+ "short": "o"
10994
11103
  },
10995
11104
  "provider": {
10996
11105
  "type": "string"
@@ -11011,7 +11120,8 @@ var COMMANDS = {
11011
11120
  "type": "bool"
11012
11121
  },
11013
11122
  "path": {
11014
- "type": "string"
11123
+ "type": "string",
11124
+ "short": "p"
11015
11125
  }
11016
11126
  },
11017
11127
  "effect": "write",
@@ -11023,7 +11133,8 @@ var COMMANDS = {
11023
11133
  "positionals": [],
11024
11134
  "flags": {
11025
11135
  "path": {
11026
- "type": "string"
11136
+ "type": "string",
11137
+ "short": "p"
11027
11138
  }
11028
11139
  },
11029
11140
  "effect": "write",
@@ -11057,7 +11168,8 @@ var COMMANDS = {
11057
11168
  "values": [
11058
11169
  "table",
11059
11170
  "json"
11060
- ]
11171
+ ],
11172
+ "short": "o"
11061
11173
  },
11062
11174
  "provider": {
11063
11175
  "type": "string"
@@ -11079,7 +11191,8 @@ var COMMANDS = {
11079
11191
  "values": [
11080
11192
  "table",
11081
11193
  "json"
11082
- ]
11194
+ ],
11195
+ "short": "o"
11083
11196
  }
11084
11197
  },
11085
11198
  "effect": "write",
@@ -11095,10 +11208,12 @@ var COMMANDS = {
11095
11208
  "values": [
11096
11209
  "table",
11097
11210
  "json"
11098
- ]
11211
+ ],
11212
+ "short": "o"
11099
11213
  },
11100
11214
  "path": {
11101
- "type": "string"
11215
+ "type": "string",
11216
+ "short": "p"
11102
11217
  }
11103
11218
  },
11104
11219
  "effect": "rewrite",
@@ -11119,10 +11234,12 @@ var COMMANDS = {
11119
11234
  "json",
11120
11235
  "terraform-docs-json",
11121
11236
  "terraform-docs-yaml"
11122
- ]
11237
+ ],
11238
+ "short": "o"
11123
11239
  },
11124
11240
  "path": {
11125
- "type": "string"
11241
+ "type": "string",
11242
+ "short": "p"
11126
11243
  }
11127
11244
  },
11128
11245
  "effect": "write",
@@ -11144,10 +11261,12 @@ var COMMANDS = {
11144
11261
  "values": [
11145
11262
  "table",
11146
11263
  "json"
11147
- ]
11264
+ ],
11265
+ "short": "o"
11148
11266
  },
11149
11267
  "path": {
11150
- "type": "string"
11268
+ "type": "string",
11269
+ "short": "p"
11151
11270
  },
11152
11271
  "recursive": {
11153
11272
  "type": "bool"
@@ -11169,10 +11288,12 @@ var COMMANDS = {
11169
11288
  "values": [
11170
11289
  "table",
11171
11290
  "json"
11172
- ]
11291
+ ],
11292
+ "short": "o"
11173
11293
  },
11174
11294
  "path": {
11175
- "type": "string"
11295
+ "type": "string",
11296
+ "short": "p"
11176
11297
  },
11177
11298
  "upgrade": {
11178
11299
  "type": "stringArray",
@@ -11196,10 +11317,12 @@ var COMMANDS = {
11196
11317
  "sarif",
11197
11318
  "junit",
11198
11319
  "checkstyle"
11199
- ]
11320
+ ],
11321
+ "short": "o"
11200
11322
  },
11201
11323
  "path": {
11202
- "type": "string"
11324
+ "type": "string",
11325
+ "short": "p"
11203
11326
  },
11204
11327
  "severity": {
11205
11328
  "type": "string",
@@ -11230,10 +11353,12 @@ var COMMANDS = {
11230
11353
  "values": [
11231
11354
  "table",
11232
11355
  "json"
11233
- ]
11356
+ ],
11357
+ "short": "o"
11234
11358
  },
11235
11359
  "path": {
11236
- "type": "string"
11360
+ "type": "string",
11361
+ "short": "p"
11237
11362
  },
11238
11363
  "view": {
11239
11364
  "type": "string",
@@ -11256,7 +11381,8 @@ var COMMANDS = {
11256
11381
  "values": [
11257
11382
  "table",
11258
11383
  "json"
11259
- ]
11384
+ ],
11385
+ "short": "o"
11260
11386
  }
11261
11387
  },
11262
11388
  "effect": "read",
@@ -11272,7 +11398,8 @@ var COMMANDS = {
11272
11398
  "values": [
11273
11399
  "table",
11274
11400
  "json"
11275
- ]
11401
+ ],
11402
+ "short": "o"
11276
11403
  }
11277
11404
  },
11278
11405
  "effect": "read",
@@ -11293,7 +11420,8 @@ var COMMANDS = {
11293
11420
  "values": [
11294
11421
  "table",
11295
11422
  "json"
11296
- ]
11423
+ ],
11424
+ "short": "o"
11297
11425
  }
11298
11426
  },
11299
11427
  "effect": "write",
@@ -11317,7 +11445,8 @@ var COMMANDS = {
11317
11445
  "values": [
11318
11446
  "table",
11319
11447
  "json"
11320
- ]
11448
+ ],
11449
+ "short": "o"
11321
11450
  },
11322
11451
  "team": {
11323
11452
  "type": "string"
@@ -11339,7 +11468,8 @@ var COMMANDS = {
11339
11468
  "values": [
11340
11469
  "table",
11341
11470
  "json"
11342
- ]
11471
+ ],
11472
+ "short": "o"
11343
11473
  },
11344
11474
  "stack": {
11345
11475
  "type": "string"
@@ -11369,7 +11499,8 @@ var COMMANDS = {
11369
11499
  "values": [
11370
11500
  "table",
11371
11501
  "json"
11372
- ]
11502
+ ],
11503
+ "short": "o"
11373
11504
  },
11374
11505
  "version": {
11375
11506
  "type": "string"
@@ -11396,7 +11527,8 @@ var COMMANDS = {
11396
11527
  "values": [
11397
11528
  "table",
11398
11529
  "json"
11399
- ]
11530
+ ],
11531
+ "short": "o"
11400
11532
  },
11401
11533
  "view": {
11402
11534
  "type": "string",
@@ -11439,7 +11571,8 @@ var COMMANDS = {
11439
11571
  "values": [
11440
11572
  "table",
11441
11573
  "json"
11442
- ]
11574
+ ],
11575
+ "short": "o"
11443
11576
  },
11444
11577
  "query": {
11445
11578
  "type": "string"
@@ -11475,7 +11608,8 @@ var COMMANDS = {
11475
11608
  "values": [
11476
11609
  "table",
11477
11610
  "json"
11478
- ]
11611
+ ],
11612
+ "short": "o"
11479
11613
  },
11480
11614
  "readme": {
11481
11615
  "type": "string"
@@ -11501,7 +11635,8 @@ var COMMANDS = {
11501
11635
  "type": "string",
11502
11636
  "values": [
11503
11637
  "json"
11504
- ]
11638
+ ],
11639
+ "short": "o"
11505
11640
  },
11506
11641
  "team": {
11507
11642
  "type": "string"
@@ -11528,7 +11663,8 @@ var COMMANDS = {
11528
11663
  "values": [
11529
11664
  "table",
11530
11665
  "json"
11531
- ]
11666
+ ],
11667
+ "short": "o"
11532
11668
  },
11533
11669
  "reason": {
11534
11670
  "type": "string"
@@ -11561,7 +11697,8 @@ var COMMANDS = {
11561
11697
  "values": [
11562
11698
  "table",
11563
11699
  "json"
11564
- ]
11700
+ ],
11701
+ "short": "o"
11565
11702
  },
11566
11703
  "team": {
11567
11704
  "type": "string"
@@ -11595,7 +11732,8 @@ var COMMANDS = {
11595
11732
  "values": [
11596
11733
  "table",
11597
11734
  "json"
11598
- ]
11735
+ ],
11736
+ "short": "o"
11599
11737
  },
11600
11738
  "stack": {
11601
11739
  "type": "string"
@@ -11634,7 +11772,8 @@ var COMMANDS = {
11634
11772
  "values": [
11635
11773
  "table",
11636
11774
  "json"
11637
- ]
11775
+ ],
11776
+ "short": "o"
11638
11777
  },
11639
11778
  "team": {
11640
11779
  "type": "string"
@@ -11661,7 +11800,8 @@ var COMMANDS = {
11661
11800
  "values": [
11662
11801
  "table",
11663
11802
  "json"
11664
- ]
11803
+ ],
11804
+ "short": "o"
11665
11805
  },
11666
11806
  "team": {
11667
11807
  "type": "string"
@@ -11694,7 +11834,8 @@ var COMMANDS = {
11694
11834
  "values": [
11695
11835
  "table",
11696
11836
  "json"
11697
- ]
11837
+ ],
11838
+ "short": "o"
11698
11839
  },
11699
11840
  "prUrl": {
11700
11841
  "type": "string"
@@ -11745,7 +11886,8 @@ var COMMANDS = {
11745
11886
  "values": [
11746
11887
  "table",
11747
11888
  "json"
11748
- ]
11889
+ ],
11890
+ "short": "o"
11749
11891
  },
11750
11892
  "source": {
11751
11893
  "type": "string"
@@ -11784,7 +11926,8 @@ var COMMANDS = {
11784
11926
  "values": [
11785
11927
  "table",
11786
11928
  "json"
11787
- ]
11929
+ ],
11930
+ "short": "o"
11788
11931
  },
11789
11932
  "team": {
11790
11933
  "type": "string"
@@ -11820,7 +11963,8 @@ var COMMANDS = {
11820
11963
  "values": [
11821
11964
  "table",
11822
11965
  "json"
11823
- ]
11966
+ ],
11967
+ "short": "o"
11824
11968
  },
11825
11969
  "team": {
11826
11970
  "type": "string"
@@ -11856,7 +12000,8 @@ var COMMANDS = {
11856
12000
  "values": [
11857
12001
  "table",
11858
12002
  "json"
11859
- ]
12003
+ ],
12004
+ "short": "o"
11860
12005
  },
11861
12006
  "prUrl": {
11862
12007
  "type": "string"
@@ -11903,7 +12048,8 @@ var COMMANDS = {
11903
12048
  "values": [
11904
12049
  "table",
11905
12050
  "json"
11906
- ]
12051
+ ],
12052
+ "short": "o"
11907
12053
  },
11908
12054
  "team": {
11909
12055
  "type": "string"
@@ -11933,10 +12079,12 @@ var COMMANDS = {
11933
12079
  "values": [
11934
12080
  "table",
11935
12081
  "json"
11936
- ]
12082
+ ],
12083
+ "short": "o"
11937
12084
  },
11938
12085
  "path": {
11939
- "type": "string"
12086
+ "type": "string",
12087
+ "short": "p"
11940
12088
  },
11941
12089
  "state": {
11942
12090
  "type": "string",
@@ -11971,7 +12119,8 @@ var COMMANDS = {
11971
12119
  "values": [
11972
12120
  "table",
11973
12121
  "json"
11974
- ]
12122
+ ],
12123
+ "short": "o"
11975
12124
  },
11976
12125
  "source": {
11977
12126
  "type": "string"
@@ -12001,7 +12150,8 @@ var COMMANDS = {
12001
12150
  "values": [
12002
12151
  "table",
12003
12152
  "json"
12004
- ]
12153
+ ],
12154
+ "short": "o"
12005
12155
  },
12006
12156
  "team": {
12007
12157
  "type": "string"
@@ -12039,7 +12189,8 @@ var COMMANDS = {
12039
12189
  "values": [
12040
12190
  "table",
12041
12191
  "json"
12042
- ]
12192
+ ],
12193
+ "short": "o"
12043
12194
  },
12044
12195
  "team": {
12045
12196
  "type": "string"
@@ -12078,7 +12229,8 @@ var COMMANDS = {
12078
12229
  "values": [
12079
12230
  "table",
12080
12231
  "json"
12081
- ]
12232
+ ],
12233
+ "short": "o"
12082
12234
  },
12083
12235
  "sourcePath": {
12084
12236
  "type": "string"
@@ -12109,7 +12261,8 @@ var COMMANDS = {
12109
12261
  "values": [
12110
12262
  "table",
12111
12263
  "json"
12112
- ]
12264
+ ],
12265
+ "short": "o"
12113
12266
  }
12114
12267
  },
12115
12268
  "effect": "read",
@@ -12134,7 +12287,8 @@ var COMMANDS = {
12134
12287
  "values": [
12135
12288
  "table",
12136
12289
  "json"
12137
- ]
12290
+ ],
12291
+ "short": "o"
12138
12292
  }
12139
12293
  },
12140
12294
  "effect": "read",
@@ -12158,7 +12312,8 @@ var COMMANDS = {
12158
12312
  "values": [
12159
12313
  "table",
12160
12314
  "json"
12161
- ]
12315
+ ],
12316
+ "short": "o"
12162
12317
  }
12163
12318
  },
12164
12319
  "effect": "write",
@@ -12174,7 +12329,8 @@ var COMMANDS = {
12174
12329
  "values": [
12175
12330
  "table",
12176
12331
  "json"
12177
- ]
12332
+ ],
12333
+ "short": "o"
12178
12334
  }
12179
12335
  },
12180
12336
  "effect": "read",
@@ -12190,7 +12346,8 @@ var COMMANDS = {
12190
12346
  "values": [
12191
12347
  "table",
12192
12348
  "json"
12193
- ]
12349
+ ],
12350
+ "short": "o"
12194
12351
  }
12195
12352
  },
12196
12353
  "effect": "read",
@@ -12198,6 +12355,21 @@ var COMMANDS = {
12198
12355
  "yes": false
12199
12356
  }
12200
12357
  };
12358
+ function isCommandPath(path) {
12359
+ return Object.prototype.hasOwnProperty.call(COMMANDS, path);
12360
+ }
12361
+ var ROOT_FLAGS = [
12362
+ {
12363
+ "name": "auth-url",
12364
+ "type": "string",
12365
+ "short": null
12366
+ },
12367
+ {
12368
+ "name": "timeout",
12369
+ "type": "duration",
12370
+ "short": null
12371
+ }
12372
+ ];
12201
12373
  function dashed(name) {
12202
12374
  return name.replace(/([A-Z])/g, (m) => `-${m.toLowerCase()}`);
12203
12375
  }
@@ -12228,6 +12400,12 @@ function toArgv(path, args) {
12228
12400
  }
12229
12401
  return argv;
12230
12402
  }
12403
+ var isNode = (path) => Object.keys(COMMANDS).some((p) => p === path || p.startsWith(`${path} `));
12404
+ function commandPathOf(words) {
12405
+ const { at } = commandWordsAt(words, { isNode, rootFlags: ROOT_FLAGS });
12406
+ const path = at.map((i) => words[i]).join(" ");
12407
+ return isCommandPath(path) ? path : void 0;
12408
+ }
12231
12409
 
12232
12410
  // src/contracts/complete-args.ts
12233
12411
  function requiredArgKeys(path) {
@@ -12716,7 +12894,7 @@ var gateChangeRequestSchema = z.object({
12716
12894
  });
12717
12895
  var runEventSchema = z.discriminatedUnion("type", [
12718
12896
  z.object({ type: z.literal("log"), text: z.string() }),
12719
- z.object({ type: z.literal("phase"), name: z.string() }),
12897
+ z.object({ type: z.literal("stage"), name: z.string() }),
12720
12898
  z.object({
12721
12899
  type: z.literal("gate"),
12722
12900
  resolution: z.object({ mode: z.string(), reason: z.string().optional() }),
@@ -12729,7 +12907,6 @@ var runEventSchema = z.discriminatedUnion("type", [
12729
12907
  type: z.literal("result"),
12730
12908
  run: runSchema,
12731
12909
  summary: planSummarySchema,
12732
- workspaceDir: z.string(),
12733
12910
  error: z.string().nullable()
12734
12911
  })
12735
12912
  ]);
@@ -12743,7 +12920,6 @@ var stackScanSchema = z.object({
12743
12920
  scannedAt: z.string(),
12744
12921
  undeterminedReason: z.string().nullable(),
12745
12922
  undeterminedMessage: z.string().nullable(),
12746
- standingDriftFindings: z.number(),
12747
12923
  footprintDestroyed: z.boolean(),
12748
12924
  drift: driftSchema
12749
12925
  }).nullable()
@@ -12940,6 +13116,7 @@ async function openEngineSession(caller, target, options = {}) {
12940
13116
  const progressListeners = /* @__PURE__ */ new Set();
12941
13117
  const ownGenerates = /* @__PURE__ */ new Set();
12942
13118
  let sessionGenerating = initialState.generating;
13119
+ let stage = "generating";
12943
13120
  let currentSource = null;
12944
13121
  let ended = null;
12945
13122
  let deliveredRevision = initialState.revision;
@@ -12949,6 +13126,7 @@ async function openEngineSession(caller, target, options = {}) {
12949
13126
  const published = state.bundle ?? EMPTY_BUNDLE;
12950
13127
  const bundle = currentSource && deepEqual(currentSource.bundle, published) ? currentSource.bundle : published;
12951
13128
  sessionGenerating = state.generating;
13129
+ if (!running()) stage = "generating";
12952
13130
  currentSource = {
12953
13131
  bundle,
12954
13132
  canUndo: state.can_undo,
@@ -12970,16 +13148,27 @@ async function openEngineSession(caller, target, options = {}) {
12970
13148
  }
12971
13149
  }
12972
13150
  adopt(initialState);
12973
- function generating() {
13151
+ function running() {
12974
13152
  return sessionGenerating || ownGenerates.size > 0;
12975
13153
  }
13154
+ function generating() {
13155
+ return running() && stage;
13156
+ }
13157
+ function republishGenerating() {
13158
+ if (!currentSource || currentSource.generating === generating()) return;
13159
+ currentSource = { ...currentSource, generating: generating() };
13160
+ for (const listener of sourceListeners) deliver(listener, currentSource);
13161
+ }
12976
13162
  function track(id, on) {
12977
- const was = generating();
12978
13163
  if (on) ownGenerates.add(id);
12979
13164
  else ownGenerates.delete(id);
12980
- if (!currentSource || generating() === was) return;
12981
- currentSource = { ...currentSource, generating: generating() };
12982
- for (const listener of sourceListeners) deliver(listener, currentSource);
13165
+ if (!running()) stage = "generating";
13166
+ republishGenerating();
13167
+ }
13168
+ function reached(next) {
13169
+ if (!running() || !isGenerateStage(next)) return;
13170
+ stage = next;
13171
+ republishGenerating();
12983
13172
  }
12984
13173
  function observed(revision) {
12985
13174
  if (deliveredRevision >= revision) return Promise.resolve();
@@ -13025,6 +13214,7 @@ async function openEngineSession(caller, target, options = {}) {
13025
13214
  continue;
13026
13215
  }
13027
13216
  if (event.generate_progress) {
13217
+ reached(event.generate_progress.stage);
13028
13218
  for (const listener of progressListeners) listener(event.generate_progress);
13029
13219
  }
13030
13220
  }
@@ -13093,9 +13283,8 @@ async function openEngineSession(caller, target, options = {}) {
13093
13283
  track(generateId, true);
13094
13284
  const onProgress = (progress) => {
13095
13285
  if (progress.generate_id !== generateId) return;
13096
- const stage = progress.stage;
13097
- if (stage === "generating" || stage === "validating") {
13098
- queue.push({ type: "progress", stage });
13286
+ if (isGenerateStage(progress.stage)) {
13287
+ queue.push({ type: "progress", stage: progress.stage });
13099
13288
  }
13100
13289
  };
13101
13290
  progressListeners.add(onProgress);
@@ -13214,6 +13403,8 @@ function generated(response) {
13214
13403
  return {
13215
13404
  type: "success",
13216
13405
  written: response.files_written,
13406
+ changed: response.files_changed,
13407
+ removed: response.files_removed,
13217
13408
  validate: parseBound("module validate", JSON.parse(response.validate_json))
13218
13409
  };
13219
13410
  }
@@ -13254,6 +13445,11 @@ function convertCreatedRef(r) {
13254
13445
  return { scope: r.scope, id: r.id, moduleKey: r.module_key, sourceId: r.source_id };
13255
13446
  }
13256
13447
 
13448
+ // src/utils/counted.ts
13449
+ function counted(n, noun) {
13450
+ return `${n} ${noun}${n === 1 ? "" : "s"}`;
13451
+ }
13452
+
13257
13453
  // src/core/diagnostics.ts
13258
13454
  var NOT_LACE_SHAPE = "not_lace_shape";
13259
13455
  function holdsLaceShapeRefusal(diagnostics) {
@@ -13389,46 +13585,50 @@ function commandUnderWay({
13389
13585
  }) {
13390
13586
  return run?.outcome.kind === "running" || preview2?.outcome.kind === "running" || running.size > 0;
13391
13587
  }
13392
- function withPhase(phases, name) {
13393
- return [...phases.map((p) => ({ ...p, status: "done" })), { name, status: "current" }];
13588
+ function withStage(stages, name) {
13589
+ return [...stages.map((s) => ({ ...s, status: "done" })), { name, status: "current" }];
13394
13590
  }
13395
- function closePhases(phases) {
13396
- return phases.map((p) => p.status === "done" ? p : { ...p, status: "done" });
13591
+ function closeStages(stages) {
13592
+ return stages.map((s) => s.status === "done" ? s : { ...s, status: "done" });
13397
13593
  }
13398
13594
  function reduceRun(prev, token, event) {
13399
13595
  const carried = prev && prev.token === token ? prev : null;
13596
+ const run = event.type === "result" ? event.run : carried?.run ?? null;
13400
13597
  const lastLog = event.type === "log" ? event.text : carried?.lastLog ?? null;
13401
- const phases = event.type === "phase" ? withPhase(carried?.phases ?? [], event.name) : carried?.phases ?? [];
13402
- const submitted = carried?.submitted || event.type === "phase" && event.name === "submit";
13598
+ const stages = event.type === "stage" ? withStage(carried?.stages ?? [], event.name) : carried?.stages ?? [];
13599
+ const submitted = carried?.submitted || event.type === "stage" && event.name === "submit";
13403
13600
  if (event.type === "gate" && event.changeRequest !== null) {
13404
13601
  return {
13405
13602
  token,
13406
- outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest, runUrl: null },
13603
+ outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest },
13604
+ run,
13407
13605
  lastLog,
13408
13606
  submitted,
13409
- phases: closePhases(phases)
13607
+ stages: closeStages(stages)
13410
13608
  };
13411
13609
  }
13412
13610
  if (event.type === "result") {
13413
13611
  if (carried?.outcome.kind === "awaiting-approval") {
13414
13612
  return {
13415
13613
  token,
13416
- outcome: { ...carried.outcome, runUrl: event.run.url ?? null },
13614
+ outcome: carried.outcome,
13615
+ run,
13417
13616
  lastLog,
13418
13617
  submitted,
13419
- phases
13618
+ stages
13420
13619
  };
13421
13620
  }
13422
13621
  if (!event.error)
13423
13622
  return {
13424
13623
  token,
13425
13624
  outcome: { kind: "succeeded" },
13625
+ run,
13426
13626
  lastLog,
13427
13627
  submitted,
13428
- phases: closePhases(phases)
13628
+ stages: closeStages(stages)
13429
13629
  };
13430
13630
  }
13431
- return { token, outcome: { kind: "running" }, lastLog, submitted, phases };
13631
+ return { token, outcome: { kind: "running" }, run, lastLog, submitted, stages };
13432
13632
  }
13433
13633
  function runningFor(slot, token) {
13434
13634
  if (slot?.token !== token) return false;
@@ -13449,31 +13649,34 @@ function failureSays(error) {
13449
13649
  }
13450
13650
  function settleRun(prev, token, error) {
13451
13651
  const carried = prev && prev.token === token ? prev : null;
13652
+ const run = carried?.run ?? null;
13452
13653
  const lastLog = carried?.lastLog ?? null;
13453
13654
  const submitted = carried?.submitted ?? false;
13454
- const phases = closePhases(carried?.phases ?? []);
13655
+ const stages = closeStages(carried?.stages ?? []);
13455
13656
  if (error instanceof CommandDetachedError || error instanceof CommandUnobservedError)
13456
- return { token, outcome: { kind: "detached", submitted }, lastLog, submitted, phases };
13657
+ return { token, outcome: { kind: "detached", submitted }, run, lastLog, submitted, stages };
13457
13658
  if (error instanceof CommandExitError) {
13458
13659
  if (error.code === 130)
13459
- return { token, outcome: { kind: "cancelled" }, lastLog, submitted, phases };
13660
+ return { token, outcome: { kind: "cancelled" }, run, lastLog, submitted, stages };
13460
13661
  if (error.code === 143)
13461
- return { token, outcome: { kind: "detached", submitted }, lastLog, submitted, phases };
13662
+ return { token, outcome: { kind: "detached", submitted }, run, lastLog, submitted, stages };
13462
13663
  if (error.code === 7)
13463
13664
  return {
13464
13665
  token,
13465
13666
  outcome: { kind: "blocked", ...failureSays(error) },
13667
+ run,
13466
13668
  lastLog,
13467
13669
  submitted,
13468
- phases
13670
+ stages
13469
13671
  };
13470
13672
  }
13471
13673
  return {
13472
13674
  token,
13473
13675
  outcome: { kind: "failed", ...failureSays(error) },
13676
+ run,
13474
13677
  lastLog,
13475
13678
  submitted,
13476
- phases
13679
+ stages
13477
13680
  };
13478
13681
  }
13479
13682
  function reducePreview(_prev, token, event) {
@@ -13546,9 +13749,10 @@ function createResultStore() {
13546
13749
  run: {
13547
13750
  token,
13548
13751
  outcome: { kind: "running" },
13752
+ run: null,
13549
13753
  lastLog: null,
13550
13754
  submitted: false,
13551
- phases: [],
13755
+ stages: [],
13552
13756
  readOver
13553
13757
  }
13554
13758
  };
@@ -13657,12 +13861,26 @@ function whyNotValid(v) {
13657
13861
  if (v.failure) return v.failure.message;
13658
13862
  const errors = v.diagnostics.filter((d) => d.severity === "error");
13659
13863
  if (errors.length === 0) return void 0;
13660
- return `${errors[0].message} (${errors.length} ${errors.length === 1 ? "error" : "errors"})`;
13864
+ return `${errors[0].message} (${counted(errors.length, "error")})`;
13661
13865
  }
13662
13866
  function didNotValidate(v) {
13663
13867
  const why = whyNotValid(v);
13664
13868
  return why === void 0 ? "The tree did not validate: fix it before you commit it." : `The tree did not validate: ${why}. Fix it before you commit it.`;
13665
13869
  }
13870
+ function lockFailed(e) {
13871
+ return e.changed && e.lock === null;
13872
+ }
13873
+ var DID_NOT_LOCK = "The tree's providers did not lock: run `lace module lock` once the cause is fixed, before you commit it.";
13874
+ function lockfileOf(lock2) {
13875
+ const root = lock2.path.endsWith("/") ? lock2.path : `${lock2.path}/`;
13876
+ return lock2.lockfile.startsWith(root) ? lock2.lockfile.slice(root.length) : lock2.lockfile;
13877
+ }
13878
+ function lockedIn(lock2) {
13879
+ return `${counted(lock2.providers.length, "provider")} in ${lockfileOf(lock2)}`;
13880
+ }
13881
+ function listed(parts) {
13882
+ return parts.length < 2 ? parts.join("") : `${parts.slice(0, -1).join(", ")} and ${parts.at(-1)}`;
13883
+ }
13666
13884
  function beside(v) {
13667
13885
  return v.failure ? [v.failure] : [];
13668
13886
  }
@@ -13710,12 +13928,6 @@ function scanNotice(e) {
13710
13928
  `Drift scan complete for stack ${slug}: IN_SYNC (0 drifted) \u2014 its resources were destroyed, so there was nothing to compare.`
13711
13929
  ];
13712
13930
  }
13713
- if (settled.standingDriftFindings > 0) {
13714
- return [
13715
- "info",
13716
- `Drift scan complete for stack ${slug}: the scan observed no drift, but ${settled.standingDriftFindings} drift finding(s) from earlier scans still stand \u2014 the stack remains DRIFTED.`
13717
- ];
13718
- }
13719
13931
  return [
13720
13932
  "info",
13721
13933
  `Drift scan complete for stack ${slug}: ${settled.driftStatus} (${settled.driftCount} drifted).`
@@ -13747,22 +13959,27 @@ function residualAddresses(residuals) {
13747
13959
  function treeChanges(e) {
13748
13960
  return [
13749
13961
  ...e.written.length === 0 ? [] : [`rewriting ${e.written.join(", ")} in place`],
13750
- ...e.removed.length === 0 ? [] : [`removing ${e.removed.join(", ")}`]
13962
+ ...e.removed.length === 0 ? [] : [`removing ${e.removed.join(", ")}`],
13963
+ ...e.lock === null ? [] : [`locking ${lockedIn(e.lock)}`]
13751
13964
  ];
13752
13965
  }
13753
13966
  function importNotice(e) {
13754
13967
  const { slug } = e.stack;
13755
13968
  const changes = treeChanges(e);
13756
- const files = changes.length > 0 ? `, ${changes.join(" and ")}` : "";
13969
+ const files = changes.length > 0 ? `, ${listed(changes)}` : "";
13757
13970
  const imported = `Imported ${e.importBlocks} resource(s) into ${slug}${files}.`;
13758
13971
  if (e.validate.exitClass !== "ok") {
13759
13972
  return ["warn", `${imported} ${didNotValidate(e.validate)}`, ...beside(e.validate)];
13760
13973
  }
13761
- const adopt = e.changed ? ` Review the change in git, commit it, then apply ${slug} to adopt them.` : "";
13762
- if (e.importResiduals.length === 0) return ["info", `${imported}${adopt}`];
13974
+ if (lockFailed(e)) return ["warn", `${imported} ${DID_NOT_LOCK}`];
13975
+ const adopts = e.importBlocks > 0;
13976
+ const next = adopts ? `, commit it, then apply ${slug} to adopt them` : " and commit it";
13977
+ const review = e.changed ? ` Review the change in git${next}.` : "";
13978
+ if (e.importResiduals.length === 0) return ["info", `${imported}${review}`];
13979
+ const unadopted = adopts ? "Not adopted" : "No resource was adopted";
13763
13980
  return [
13764
13981
  "warn",
13765
- `${imported}${adopt} Not adopted: ${residualAddresses(e.importResiduals)}; supply their import ids before applying, or the apply creates them anew.`
13982
+ `${imported}${review} ${unadopted}: ${residualAddresses(e.importResiduals)}; supply their import ids before applying, or the apply creates them anew.`
13766
13983
  ];
13767
13984
  }
13768
13985
  var importResult = {
@@ -13793,9 +14010,13 @@ function validateNotice(v) {
13793
14010
  return ["warn", why === void 0 ? "Not valid for Lace" : `Not valid: ${why}`];
13794
14011
  }
13795
14012
  function convertNotice(e) {
13796
- const converted = e.changed ? `Converted \u2014 ${e.written.length} file(s) written` : "Already lace-style \u2014 nothing to write";
13797
- if (e.validate.exitClass === "ok") return ["info", converted];
13798
- return ["warn", `${converted}. ${didNotValidate(e.validate)}`, ...beside(e.validate)];
14013
+ const locked = e.lock === null ? "" : `, locking ${lockedIn(e.lock)}`;
14014
+ const converted = e.changed ? `Converted \u2014 ${e.written.length} file(s) written${locked}` : "Already lace-style \u2014 nothing to write";
14015
+ if (e.validate.exitClass !== "ok") {
14016
+ return ["warn", `${converted}. ${didNotValidate(e.validate)}`, ...beside(e.validate)];
14017
+ }
14018
+ if (lockFailed(e)) return ["warn", `${converted}. ${DID_NOT_LOCK}`];
14019
+ return ["info", converted];
13799
14020
  }
13800
14021
  var validate = defineCommand({
13801
14022
  kind: "command",
@@ -13815,6 +14036,18 @@ var convert = defineCommand({
13815
14036
  consume: (rt, e) => rt.ports.presenter.notify(...convertNotice(e))
13816
14037
  }
13817
14038
  });
14039
+ var lock = defineCommand({
14040
+ kind: "command",
14041
+ path: "module lock",
14042
+ args: () => ({}),
14043
+ result: {
14044
+ kind: "notify",
14045
+ consume: (rt, e) => rt.ports.presenter.notify(
14046
+ "info",
14047
+ `Locked ${lockedIn(e)}. Commit it beside the tree, then run the command again.`
14048
+ )
14049
+ }
14050
+ });
13818
14051
  var preview = defineCommand({
13819
14052
  kind: "command",
13820
14053
  path: "stack preview",
@@ -13932,6 +14165,18 @@ var STACK_COMMAND_ACTIONS = [
13932
14165
  answers: ["import_residual"],
13933
14166
  binding: importPartial
13934
14167
  },
14168
+ // `stack apply`, `stack destroy` and `stack preview` refuse a root that
14169
+ // keeps no lockfile: `module lock`, run in the refused command's root,
14170
+ // writes it.
14171
+ {
14172
+ id: "lock-missing",
14173
+ label: "Lock providers",
14174
+ placement: { row: "failure" },
14175
+ requiredPorts: ["commands"],
14176
+ requiredContext: ["root"],
14177
+ answers: ["no_lockfile"],
14178
+ binding: lock
14179
+ },
13935
14180
  {
13936
14181
  id: "preview",
13937
14182
  label: "Preview",
@@ -13964,6 +14209,23 @@ var CORE_COMMAND_ACTIONS = [
13964
14209
  ...MODULE_COMMAND_ACTIONS
13965
14210
  ];
13966
14211
 
14212
+ // src/core/entry-scope.ts
14213
+ function enclosingGroups(view) {
14214
+ return new Map(view.groups.flatMap((g) => g.node_ids.map((id) => [id, g.id])));
14215
+ }
14216
+ function entryScopeIds(view) {
14217
+ const enclosing = enclosingGroups(view);
14218
+ return [...view.nodes, ...view.groups].map((n) => n.id).filter((id) => !enclosing.has(id));
14219
+ }
14220
+ function inOneScope(view, ids) {
14221
+ const enclosing = enclosingGroups(view);
14222
+ return new Set(ids.map((id) => enclosing.get(id) ?? null)).size <= 1;
14223
+ }
14224
+ function inEntryScope(view, ids) {
14225
+ const entry = new Set(entryScopeIds(view));
14226
+ return ids.filter((id) => entry.has(id));
14227
+ }
14228
+
13967
14229
  // src/registry.ts
13968
14230
  var CONTEXT_NEEDS = {
13969
14231
  root: "an authoring root",
@@ -13977,7 +14239,11 @@ var CONTEXT_NEEDS = {
13977
14239
  sourceRefused: "the source-refused lock",
13978
14240
  needsConversion: "a tree out of lace shape",
13979
14241
  "selection.node": "a selected node",
13980
- "selection.edge": "a selected connection",
14242
+ "selection.several": "two selected nodes or more",
14243
+ "selection.entryScope": "a selected top-level node or group",
14244
+ "selection.oneScope": "selected nodes that share one scope",
14245
+ "selection.edge": "one selected connection",
14246
+ "selection.edges": "selected connections",
13981
14247
  diagnostics: "diagnostics to show",
13982
14248
  settingsOpen: "the settings panel open",
13983
14249
  generateIdle: "no Generate running",
@@ -13994,7 +14260,14 @@ var TARGET_NEEDS = {
13994
14260
  failure: "a failed command"
13995
14261
  };
13996
14262
  function busyReason(busy) {
13997
- return busy.kind === "run" ? "A run is in progress" : `${busy.running.label} is running`;
14263
+ switch (busy.kind) {
14264
+ case "run":
14265
+ return "A run is in progress";
14266
+ case "notify":
14267
+ return `${busy.running.label} is running`;
14268
+ case "edit":
14269
+ return "An edit is in progress";
14270
+ }
13998
14271
  }
13999
14272
  function runsOn(action, ctx, target) {
14000
14273
  if (action.requiredTarget?.includes("runId")) return `run:${target.runId}`;
@@ -14003,6 +14276,10 @@ function runsOn(action, ctx, target) {
14003
14276
  if (required.includes("root")) return `root:${ctx.root}`;
14004
14277
  return "";
14005
14278
  }
14279
+ function wiresAlone(ctx) {
14280
+ const selection = ctx.selection;
14281
+ return selection && selection.nodes.length === 0 ? selection.edges.length : 0;
14282
+ }
14006
14283
  function keySatisfied(ctx, key) {
14007
14284
  if (key === "editable") return ctx.editable === true;
14008
14285
  if (key === "saved") return ctx.view?.unsaved === false;
@@ -14012,13 +14289,18 @@ function keySatisfied(ctx, key) {
14012
14289
  if (key === "sourceRefused") return ctx.sourceRefused === true;
14013
14290
  if (key === "needsConversion")
14014
14291
  return ctx.sourceRefused === true && holdsLaceShapeRefusal(ctx.diagnostics ?? []);
14015
- if (key === "selection.node")
14016
- return ctx.selection !== void 0 && ctx.selection.nodes.length > 0;
14017
- if (key === "selection.edge") return ctx.selection !== void 0 && ctx.selection.edge !== null;
14292
+ if (key === "selection.node") return (ctx.selection?.nodes.length ?? 0) > 0;
14293
+ if (key === "selection.several") return (ctx.selection?.nodes.length ?? 0) > 1;
14294
+ if (key === "selection.entryScope")
14295
+ return ctx.view !== void 0 && ctx.selection !== void 0 && inEntryScope(ctx.view, ctx.selection.nodes).length > 0;
14296
+ if (key === "selection.oneScope")
14297
+ return ctx.view !== void 0 && ctx.selection !== void 0 && inOneScope(ctx.view, ctx.selection.nodes);
14298
+ if (key === "selection.edge") return wiresAlone(ctx) === 1;
14299
+ if (key === "selection.edges") return wiresAlone(ctx) > 0;
14018
14300
  if (key === "diagnostics") return ctx.diagnostics !== void 0 && ctx.diagnostics.length > 0;
14019
14301
  if (key === "settingsOpen") return ctx.settingsOpen === true;
14020
14302
  if (key === "generateIdle") return ctx.generating === false;
14021
- if (key === "generating") return ctx.generating === true;
14303
+ if (key === "generating") return ctx.generating !== void 0 && ctx.generating !== false;
14022
14304
  if (key === "ungenerated") return ctx.view?.ungenerated === true;
14023
14305
  if (key === "undoable") return ctx.view?.can_undo === true;
14024
14306
  if (key === "redoable") return ctx.view?.can_redo === true;
@@ -14035,9 +14317,13 @@ function disabledReason(action, ctx, busy) {
14035
14317
  return void 0;
14036
14318
  }
14037
14319
  function busyLabelOf(action, ctx, busy) {
14038
- if (action.busy && keySatisfied(ctx, action.busy.when)) return action.busy.label;
14320
+ if (action.busy && keySatisfied(ctx, action.busy.when)) {
14321
+ const { label } = action.busy;
14322
+ if (typeof label === "string") return label;
14323
+ return ctx.generating ? label[ctx.generating] : void 0;
14324
+ }
14039
14325
  if (busy === void 0 || action.binding.kind !== "command") return void 0;
14040
- return busy.kind === "run" || busy.running.path === action.binding.path ? action.label : void 0;
14326
+ return busy.kind === "run" || busy.kind === "notify" && busy.running.path === action.binding.path ? action.label : void 0;
14041
14327
  }
14042
14328
  function actionState(action, ctx, busy) {
14043
14329
  return {
@@ -14045,6 +14331,9 @@ function actionState(action, ctx, busy) {
14045
14331
  busyLabel: busyLabelOf(action, ctx, busy)
14046
14332
  };
14047
14333
  }
14334
+ function isInert(state) {
14335
+ return state.disabledReason !== void 0 || state.busyLabel !== void 0;
14336
+ }
14048
14337
  function missingPort(ports, required) {
14049
14338
  return required.find((name) => ports[name] === void 0);
14050
14339
  }
@@ -14121,6 +14410,15 @@ function rowActions(resolved, panelId) {
14121
14410
  }
14122
14411
 
14123
14412
  // src/core/run-binding.ts
14413
+ var EDIT_IN_PROGRESS = { kind: "edit" };
14414
+ function refusedBatch(message, reason) {
14415
+ return {
14416
+ success: false,
14417
+ errors: [{ moduleKey: "", instanceId: "", inputName: "", message, reason }],
14418
+ created: [],
14419
+ ties: []
14420
+ };
14421
+ }
14124
14422
  function createClipboardStore() {
14125
14423
  let clip = null;
14126
14424
  return {
@@ -14146,6 +14444,7 @@ function createActionRunner(ports, store, options = {}) {
14146
14444
  const notifyControllers = /* @__PURE__ */ new Map();
14147
14445
  let edits = 0;
14148
14446
  const editingListeners = /* @__PURE__ */ new Set();
14447
+ const tickListeners = /* @__PURE__ */ new Set();
14149
14448
  async function asEdit(edit) {
14150
14449
  edits += 1;
14151
14450
  if (edits === 1) for (const listener of editingListeners) listener(true);
@@ -14163,20 +14462,7 @@ function createActionRunner(ports, store, options = {}) {
14163
14462
  } catch (error) {
14164
14463
  const message = error instanceof Error ? error.message : String(error);
14165
14464
  ports.presenter.notify("error", message);
14166
- return {
14167
- success: false,
14168
- errors: [
14169
- {
14170
- moduleKey: "",
14171
- instanceId: "",
14172
- inputName: "",
14173
- message,
14174
- reason: rejectionReason(error)
14175
- }
14176
- ],
14177
- created: [],
14178
- ties: []
14179
- };
14465
+ return refusedBatch(message, rejectionReason(error));
14180
14466
  }
14181
14467
  if (!result.success) {
14182
14468
  for (const err of result.errors) ports.presenter.notify("error", err.message);
@@ -14195,8 +14481,14 @@ function createActionRunner(ports, store, options = {}) {
14195
14481
  async function applyActions(actions) {
14196
14482
  const editor = ports.editor;
14197
14483
  if (!editor) return;
14484
+ if (edits > 0) return heldEdit();
14198
14485
  return asEdit(() => applyWith(editor, actions));
14199
14486
  }
14487
+ function heldEdit() {
14488
+ const message = busyReason(EDIT_IN_PROGRESS);
14489
+ ports.presenter.notify("warn", message);
14490
+ return refusedBatch(message, 0 /* REASON_UNSPECIFIED */);
14491
+ }
14200
14492
  function askConfirm(spec) {
14201
14493
  const confirm = ports.presenter.confirm;
14202
14494
  return confirm ? confirm(spec) : Promise.resolve(false);
@@ -14217,7 +14509,10 @@ function createActionRunner(ports, store, options = {}) {
14217
14509
  },
14218
14510
  fail: (error) => run ? store.fail(run.resultKind, token, error) : false,
14219
14511
  detach: (kind, tok) => store.detach(kind, tok),
14220
- tick: () => store.bumpTick(),
14512
+ tick: () => {
14513
+ store.bumpTick();
14514
+ if (run) for (const listener of tickListeners) listener(run);
14515
+ },
14221
14516
  settled: onSettle
14222
14517
  };
14223
14518
  }
@@ -14230,8 +14525,14 @@ function createActionRunner(ports, store, options = {}) {
14230
14525
  }
14231
14526
  function busyOf(action, ctx, target) {
14232
14527
  const binding = action.binding;
14233
- if (binding.kind !== "command") return void 0;
14234
- return busyOn(binding.resultKind, action, ctx, target).busy;
14528
+ switch (binding.kind) {
14529
+ case "command":
14530
+ return busyOn(binding.resultKind, action, ctx, target).busy;
14531
+ case "editor":
14532
+ return edits > 0 ? EDIT_IN_PROGRESS : void 0;
14533
+ case "host":
14534
+ return void 0;
14535
+ }
14235
14536
  }
14236
14537
  function cwdOf(action, ctx) {
14237
14538
  return (action.requiredContext ?? []).includes("root") ? ctx.root : void 0;
@@ -14348,8 +14649,9 @@ function createActionRunner(ports, store, options = {}) {
14348
14649
  const hostSpec = binding.confirm?.(ctx);
14349
14650
  if (hostSpec && !await askConfirm(hostSpec)) return;
14350
14651
  const token = {};
14351
- await binding.run(runtimeFor(token, readOverOf(ctx), cwdOf(action, ctx)), ctx, target);
14352
- if (binding.invalidates) store.bumpTick();
14652
+ const rt = runtimeFor(token, readOverOf(ctx), cwdOf(action, ctx));
14653
+ await binding.run(rt, ctx, target);
14654
+ if (binding.invalidates) rt.tick();
14353
14655
  }
14354
14656
  return {
14355
14657
  async run(action, ...rest) {
@@ -14396,6 +14698,12 @@ function createActionRunner(ports, store, options = {}) {
14396
14698
  editingListeners.delete(listener);
14397
14699
  };
14398
14700
  },
14701
+ onDidTick(listener) {
14702
+ tickListeners.add(listener);
14703
+ return () => {
14704
+ tickListeners.delete(listener);
14705
+ };
14706
+ },
14399
14707
  busy(action, ctx, target) {
14400
14708
  return busyOf(action, ctx, target);
14401
14709
  },
@@ -14415,6 +14723,7 @@ function createActionRunner(ports, store, options = {}) {
14415
14723
  store.detach("notify", token);
14416
14724
  }
14417
14725
  notifyControllers.clear();
14726
+ tickListeners.clear();
14418
14727
  }
14419
14728
  };
14420
14729
  }
@@ -14509,23 +14818,31 @@ function autosave(source, save, policy, report) {
14509
14818
  export {
14510
14819
  uniqueDiagnostics,
14511
14820
  diagnosticsOf,
14821
+ entryScopeIds,
14822
+ inEntryScope,
14512
14823
  keySatisfied,
14513
14824
  disabledReason,
14514
14825
  actionState,
14826
+ isInert,
14515
14827
  answering,
14516
14828
  resolveContributions,
14517
14829
  rowActions,
14830
+ counted,
14518
14831
  Bundle,
14519
14832
  InputMode,
14520
14833
  Reason,
14521
14834
  currentFrame,
14835
+ GENERATE_STAGES,
14836
+ generatedTree,
14522
14837
  ApplyUnobservedError,
14523
14838
  CommandExitError,
14524
14839
  ConnectError,
14525
14840
  CommandDetachedError,
14526
14841
  CommandUnobservedError,
14527
14842
  COMMANDS,
14843
+ isCommandPath,
14528
14844
  toArgv,
14845
+ commandPathOf,
14529
14846
  reasonWire,
14530
14847
  SCHEMAS,
14531
14848
  isBoundPath,
@@ -14550,6 +14867,7 @@ export {
14550
14867
  MODULE_COMMAND_ACTIONS,
14551
14868
  CORE_COMMAND_ACTIONS,
14552
14869
  isPlainObject,
14870
+ deepEqual,
14553
14871
  createActionRunner,
14554
14872
  connectCaller,
14555
14873
  bridgeCaller,
@@ -14558,4 +14876,4 @@ export {
14558
14876
  AutosaveEndedError,
14559
14877
  autosave
14560
14878
  };
14561
- //# sourceMappingURL=chunk-ASG36ZXQ.mjs.map
14879
+ //# sourceMappingURL=chunk-MVOO7T3B.mjs.map