@lace-cloud/canvas 0.28.0 → 0.30.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.
@@ -29,6 +29,7 @@ __export(engine_exports, {
29
29
  CommandUnobservedError: () => CommandUnobservedError,
30
30
  ConnectError: () => ConnectError,
31
31
  EMPTY_REPORT_FOLD: () => EMPTY_REPORT_FOLD,
32
+ GENERATE_STAGES: () => GENERATE_STAGES,
32
33
  InputMode: () => InputMode,
33
34
  Reason: () => Reason,
34
35
  SCHEMAS: () => SCHEMAS,
@@ -46,6 +47,7 @@ __export(engine_exports, {
46
47
  diagnosticsOfDocument: () => diagnosticsOfDocument,
47
48
  failureSays: () => failureSays,
48
49
  foldReport: () => foldReport,
50
+ generatedTree: () => generatedTree,
49
51
  isBoundPath: () => isBoundPath,
50
52
  liveSlots: () => liveSlots,
51
53
  openEngineCommands: () => openEngineCommands,
@@ -4492,13 +4494,19 @@ var SessionGenerateRequest = {
4492
4494
  }
4493
4495
  };
4494
4496
  function createBaseSessionGenerateResponse() {
4495
- return { files_written: [], validate_json: "", revision: 0 };
4497
+ return { files_written: [], files_changed: [], files_removed: [], validate_json: "", revision: 0 };
4496
4498
  }
4497
4499
  var SessionGenerateResponse = {
4498
4500
  encode(message, writer = new import_wire4.BinaryWriter()) {
4499
4501
  for (const v of message.files_written) {
4500
4502
  writer.uint32(10).string(v);
4501
4503
  }
4504
+ for (const v of message.files_changed) {
4505
+ writer.uint32(50).string(v);
4506
+ }
4507
+ for (const v of message.files_removed) {
4508
+ writer.uint32(58).string(v);
4509
+ }
4502
4510
  if (message.validate_json !== "") {
4503
4511
  writer.uint32(34).string(message.validate_json);
4504
4512
  }
@@ -4521,6 +4529,20 @@ var SessionGenerateResponse = {
4521
4529
  message.files_written.push(reader.string());
4522
4530
  continue;
4523
4531
  }
4532
+ case 6: {
4533
+ if (tag !== 50) {
4534
+ break;
4535
+ }
4536
+ message.files_changed.push(reader.string());
4537
+ continue;
4538
+ }
4539
+ case 7: {
4540
+ if (tag !== 58) {
4541
+ break;
4542
+ }
4543
+ message.files_removed.push(reader.string());
4544
+ continue;
4545
+ }
4524
4546
  case 4: {
4525
4547
  if (tag !== 34) {
4526
4548
  break;
@@ -4546,6 +4568,8 @@ var SessionGenerateResponse = {
4546
4568
  fromJSON(object) {
4547
4569
  return {
4548
4570
  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)) : [],
4571
+ 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)) : [],
4572
+ 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)) : [],
4549
4573
  validate_json: isSet3(object.validateJson) ? globalThis.String(object.validateJson) : isSet3(object.validate_json) ? globalThis.String(object.validate_json) : "",
4550
4574
  revision: isSet3(object.revision) ? globalThis.Number(object.revision) : 0
4551
4575
  };
@@ -4555,6 +4579,12 @@ var SessionGenerateResponse = {
4555
4579
  if (message.files_written?.length) {
4556
4580
  obj.filesWritten = message.files_written;
4557
4581
  }
4582
+ if (message.files_changed?.length) {
4583
+ obj.filesChanged = message.files_changed;
4584
+ }
4585
+ if (message.files_removed?.length) {
4586
+ obj.filesRemoved = message.files_removed;
4587
+ }
4558
4588
  if (message.validate_json !== "") {
4559
4589
  obj.validateJson = message.validate_json;
4560
4590
  }
@@ -4569,6 +4599,8 @@ var SessionGenerateResponse = {
4569
4599
  fromPartial(object) {
4570
4600
  const message = createBaseSessionGenerateResponse();
4571
4601
  message.files_written = object.files_written?.map((e) => e) || [];
4602
+ message.files_changed = object.files_changed?.map((e) => e) || [];
4603
+ message.files_removed = object.files_removed?.map((e) => e) || [];
4572
4604
  message.validate_json = object.validate_json ?? "";
4573
4605
  message.revision = object.revision ?? 0;
4574
4606
  return message;
@@ -8489,13 +8521,19 @@ var GenerateProgress = {
8489
8521
  }
8490
8522
  };
8491
8523
  function createBaseGenerateSuccess() {
8492
- return { files_written: [], validate_json: "", generate_id: "" };
8524
+ return { files_written: [], files_changed: [], files_removed: [], validate_json: "", generate_id: "" };
8493
8525
  }
8494
8526
  var GenerateSuccess = {
8495
8527
  encode(message, writer = new import_wire4.BinaryWriter()) {
8496
8528
  for (const v of message.files_written) {
8497
8529
  writer.uint32(10).string(v);
8498
8530
  }
8531
+ for (const v of message.files_changed) {
8532
+ writer.uint32(42).string(v);
8533
+ }
8534
+ for (const v of message.files_removed) {
8535
+ writer.uint32(50).string(v);
8536
+ }
8499
8537
  if (message.validate_json !== "") {
8500
8538
  writer.uint32(26).string(message.validate_json);
8501
8539
  }
@@ -8518,6 +8556,20 @@ var GenerateSuccess = {
8518
8556
  message.files_written.push(reader.string());
8519
8557
  continue;
8520
8558
  }
8559
+ case 5: {
8560
+ if (tag !== 42) {
8561
+ break;
8562
+ }
8563
+ message.files_changed.push(reader.string());
8564
+ continue;
8565
+ }
8566
+ case 6: {
8567
+ if (tag !== 50) {
8568
+ break;
8569
+ }
8570
+ message.files_removed.push(reader.string());
8571
+ continue;
8572
+ }
8521
8573
  case 3: {
8522
8574
  if (tag !== 26) {
8523
8575
  break;
@@ -8543,6 +8595,8 @@ var GenerateSuccess = {
8543
8595
  fromJSON(object) {
8544
8596
  return {
8545
8597
  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)) : [],
8598
+ 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)) : [],
8599
+ 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)) : [],
8546
8600
  validate_json: isSet3(object.validateJson) ? globalThis.String(object.validateJson) : isSet3(object.validate_json) ? globalThis.String(object.validate_json) : "",
8547
8601
  generate_id: isSet3(object.generateId) ? globalThis.String(object.generateId) : isSet3(object.generate_id) ? globalThis.String(object.generate_id) : ""
8548
8602
  };
@@ -8552,6 +8606,12 @@ var GenerateSuccess = {
8552
8606
  if (message.files_written?.length) {
8553
8607
  obj.filesWritten = message.files_written;
8554
8608
  }
8609
+ if (message.files_changed?.length) {
8610
+ obj.filesChanged = message.files_changed;
8611
+ }
8612
+ if (message.files_removed?.length) {
8613
+ obj.filesRemoved = message.files_removed;
8614
+ }
8555
8615
  if (message.validate_json !== "") {
8556
8616
  obj.validateJson = message.validate_json;
8557
8617
  }
@@ -8566,6 +8626,8 @@ var GenerateSuccess = {
8566
8626
  fromPartial(object) {
8567
8627
  const message = createBaseGenerateSuccess();
8568
8628
  message.files_written = object.files_written?.map((e) => e) || [];
8629
+ message.files_changed = object.files_changed?.map((e) => e) || [];
8630
+ message.files_removed = object.files_removed?.map((e) => e) || [];
8569
8631
  message.validate_json = object.validate_json ?? "";
8570
8632
  message.generate_id = object.generate_id ?? "";
8571
8633
  return message;
@@ -10518,6 +10580,22 @@ function isSet3(value) {
10518
10580
 
10519
10581
  // src/ports.ts
10520
10582
  var import_proto = require("@lace-cloud/proto");
10583
+ var GENERATE_STAGES = ["generating", "validating"];
10584
+ function isGenerateStage(stage) {
10585
+ return GENERATE_STAGES.some((known) => known === stage);
10586
+ }
10587
+ function generatedTree({
10588
+ written,
10589
+ changed,
10590
+ removed
10591
+ }) {
10592
+ return {
10593
+ changed,
10594
+ removed,
10595
+ unchanged: written.length - changed.length,
10596
+ treeChanged: changed.length > 0 || removed.length > 0
10597
+ };
10598
+ }
10521
10599
  var ApplyUnobservedError = class extends Error {
10522
10600
  constructor(end) {
10523
10601
  super(`unobserved: the source stopped (${end.kind}) before the frame that carries the write`);
@@ -11204,6 +11282,32 @@ var COMMANDS = {
11204
11282
  "hidden": false,
11205
11283
  "yes": false
11206
11284
  },
11285
+ "module lock": {
11286
+ "path": "module lock",
11287
+ "positionals": [],
11288
+ "flags": {
11289
+ "org": {
11290
+ "type": "string"
11291
+ },
11292
+ "output": {
11293
+ "type": "string",
11294
+ "values": [
11295
+ "table",
11296
+ "json"
11297
+ ]
11298
+ },
11299
+ "path": {
11300
+ "type": "string"
11301
+ },
11302
+ "upgrade": {
11303
+ "type": "stringArray",
11304
+ "repeated": true
11305
+ }
11306
+ },
11307
+ "effect": "write",
11308
+ "hidden": false,
11309
+ "yes": false
11310
+ },
11207
11311
  "module scan": {
11208
11312
  "path": "module scan",
11209
11313
  "positionals": [],
@@ -12350,10 +12454,18 @@ var moduleValidateResultSchema = import_zod.z.object({
12350
12454
  failure: commandFailureSchema.optional(),
12351
12455
  diagnostics: import_zod.z.array(commandDiagnosticSchema)
12352
12456
  });
12457
+ var moduleLockResultSchema = import_zod.z.object({
12458
+ path: import_zod.z.string(),
12459
+ lockfile: import_zod.z.string(),
12460
+ providers: import_zod.z.array(
12461
+ import_zod.z.object({ address: import_zod.z.string(), version: import_zod.z.string(), platforms: import_zod.z.array(import_zod.z.string()) })
12462
+ )
12463
+ });
12353
12464
  var moduleConvertResultSchema = import_zod.z.object({
12354
12465
  changed: import_zod.z.boolean(),
12355
12466
  written: import_zod.z.array(import_zod.z.string()),
12356
12467
  removed: import_zod.z.array(import_zod.z.string()),
12468
+ lock: moduleLockResultSchema.nullable(),
12357
12469
  validate: moduleValidateResultSchema,
12358
12470
  diagnostics: import_zod.z.array(commandDiagnosticSchema)
12359
12471
  });
@@ -12433,6 +12545,12 @@ var moduleFmtResultSchema = import_zod.z.object({ changed: import_zod.z.array(im
12433
12545
  var moduleDocsResultSchema = import_zod.z.object({ markdown: import_zod.z.string() });
12434
12546
  var moduleScanResultSchema = import_zod.z.object({
12435
12547
  treeHash: import_zod.z.string(),
12548
+ tool: import_zod.z.object({
12549
+ name: import_zod.z.string(),
12550
+ version: import_zod.z.string().nullable(),
12551
+ path: import_zod.z.string(),
12552
+ source: import_zod.z.enum(["env", "path", "cache"])
12553
+ }),
12436
12554
  diagnostics: import_zod.z.array(commandDiagnosticSchema)
12437
12555
  });
12438
12556
  var registryDescribeSchema = import_zod.z.object({
@@ -12586,6 +12704,22 @@ var runSchema = import_zod.z.object({
12586
12704
  // a portal mount reading the API body sees it absent — optional so both
12587
12705
  // bodies parse. A host opens this link and never composes a portal route.
12588
12706
  url: import_zod.z.string().optional(),
12707
+ // The provider versions the Run's lockfile pins, each with the
12708
+ // organization's admission it ran under when the version is one admitted
12709
+ // outside the curated range. A single-run read carries it; a list does
12710
+ // not, and the CLI omits an empty one.
12711
+ providers: import_zod.z.array(
12712
+ import_zod.z.object({
12713
+ address: import_zod.z.string(),
12714
+ version: import_zod.z.string(),
12715
+ admission: import_zod.z.object({
12716
+ id: import_zod.z.string(),
12717
+ admittedBy: import_zod.z.string(),
12718
+ admittedByName: import_zod.z.string().nullable(),
12719
+ admittedAt: import_zod.z.string()
12720
+ }).optional()
12721
+ })
12722
+ ).optional(),
12589
12723
  // The CLI's own `api.Run` decode struct (apps/cli/internal/api/runs.go) has no
12590
12724
  // json tag for these, so every CLI JSON golden omits them; the API always sends
12591
12725
  // them (apps/api/src/openapi/schemas/runs.ts) — optional so both bodies parse.
@@ -12805,16 +12939,22 @@ var currentSelectionSchema = import_zod.z.union([
12805
12939
  import_zod.z.object({ slug: import_zod.z.null(), source: import_zod.z.null() })
12806
12940
  ]);
12807
12941
  var loginUserSchema = import_zod.z.object({ id: import_zod.z.string(), email: import_zod.z.string(), name: import_zod.z.string() });
12808
- var logoutSchema = import_zod.z.object({ loggedOut: import_zod.z.boolean() });
12942
+ var keyRevocationSchema = import_zod.z.object({
12943
+ revocation: import_zod.z.enum(["revoked", "refused", "unreachable", "unreadable", "none"]),
12944
+ detail: import_zod.z.string().optional(),
12945
+ portalUrl: import_zod.z.string().optional()
12946
+ });
12947
+ var logoutSchema = keyRevocationSchema.extend({ loggedOut: import_zod.z.boolean() });
12809
12948
  var loginEventSchema = import_zod.z.discriminatedUnion("type", [
12810
12949
  import_zod.z.object({ type: import_zod.z.literal("code"), code: import_zod.z.string(), verificationUrl: import_zod.z.string().optional() }),
12811
12950
  import_zod.z.object({ type: import_zod.z.literal("url"), url: import_zod.z.string() }),
12812
12951
  import_zod.z.object({ type: import_zod.z.literal("email_sent"), email: import_zod.z.string() }),
12813
- import_zod.z.object({ type: import_zod.z.literal("result"), user: loginUserSchema })
12952
+ import_zod.z.object({ type: import_zod.z.literal("result"), user: loginUserSchema, replacedKey: keyRevocationSchema })
12814
12953
  ]);
12815
12954
  var SCHEMAS = {
12816
12955
  "module validate": moduleValidateResultSchema,
12817
12956
  "module convert": moduleConvertResultSchema,
12957
+ "module lock": moduleLockResultSchema,
12818
12958
  "module fmt": moduleFmtResultSchema,
12819
12959
  "module docs": moduleDocsResultSchema,
12820
12960
  "module scan": moduleScanResultSchema,
@@ -12925,6 +13065,7 @@ async function openEngineSession(caller, target, options = {}) {
12925
13065
  const progressListeners = /* @__PURE__ */ new Set();
12926
13066
  const ownGenerates = /* @__PURE__ */ new Set();
12927
13067
  let sessionGenerating = initialState.generating;
13068
+ let stage = "generating";
12928
13069
  let currentSource = null;
12929
13070
  let ended = null;
12930
13071
  let deliveredRevision = initialState.revision;
@@ -12934,6 +13075,7 @@ async function openEngineSession(caller, target, options = {}) {
12934
13075
  const published = state.bundle ?? import_proto2.EMPTY_BUNDLE;
12935
13076
  const bundle = currentSource && deepEqual(currentSource.bundle, published) ? currentSource.bundle : published;
12936
13077
  sessionGenerating = state.generating;
13078
+ if (!running()) stage = "generating";
12937
13079
  currentSource = {
12938
13080
  bundle,
12939
13081
  canUndo: state.can_undo,
@@ -12955,16 +13097,27 @@ async function openEngineSession(caller, target, options = {}) {
12955
13097
  }
12956
13098
  }
12957
13099
  adopt(initialState);
12958
- function generating() {
13100
+ function running() {
12959
13101
  return sessionGenerating || ownGenerates.size > 0;
12960
13102
  }
13103
+ function generating() {
13104
+ return running() && stage;
13105
+ }
13106
+ function republishGenerating() {
13107
+ if (!currentSource || currentSource.generating === generating()) return;
13108
+ currentSource = { ...currentSource, generating: generating() };
13109
+ for (const listener of sourceListeners) deliver(listener, currentSource);
13110
+ }
12961
13111
  function track(id, on) {
12962
- const was = generating();
12963
13112
  if (on) ownGenerates.add(id);
12964
13113
  else ownGenerates.delete(id);
12965
- if (!currentSource || generating() === was) return;
12966
- currentSource = { ...currentSource, generating: generating() };
12967
- for (const listener of sourceListeners) deliver(listener, currentSource);
13114
+ if (!running()) stage = "generating";
13115
+ republishGenerating();
13116
+ }
13117
+ function reached(next) {
13118
+ if (!running() || !isGenerateStage(next)) return;
13119
+ stage = next;
13120
+ republishGenerating();
12968
13121
  }
12969
13122
  function observed(revision) {
12970
13123
  if (deliveredRevision >= revision) return Promise.resolve();
@@ -13010,6 +13163,7 @@ async function openEngineSession(caller, target, options = {}) {
13010
13163
  continue;
13011
13164
  }
13012
13165
  if (event.generate_progress) {
13166
+ reached(event.generate_progress.stage);
13013
13167
  for (const listener of progressListeners) listener(event.generate_progress);
13014
13168
  }
13015
13169
  }
@@ -13078,9 +13232,8 @@ async function openEngineSession(caller, target, options = {}) {
13078
13232
  track(generateId, true);
13079
13233
  const onProgress = (progress) => {
13080
13234
  if (progress.generate_id !== generateId) return;
13081
- const stage = progress.stage;
13082
- if (stage === "generating" || stage === "validating") {
13083
- queue.push({ type: "progress", stage });
13235
+ if (isGenerateStage(progress.stage)) {
13236
+ queue.push({ type: "progress", stage: progress.stage });
13084
13237
  }
13085
13238
  };
13086
13239
  progressListeners.add(onProgress);
@@ -13199,6 +13352,8 @@ function generated(response) {
13199
13352
  return {
13200
13353
  type: "success",
13201
13354
  written: response.files_written,
13355
+ changed: response.files_changed,
13356
+ removed: response.files_removed,
13202
13357
  validate: parseBound("module validate", JSON.parse(response.validate_json))
13203
13358
  };
13204
13359
  }
@@ -13648,6 +13803,10 @@ function didNotValidate(v) {
13648
13803
  const why = whyNotValid(v);
13649
13804
  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.`;
13650
13805
  }
13806
+ function lockFailed(e) {
13807
+ return e.changed && e.lock === null;
13808
+ }
13809
+ var DID_NOT_LOCK = "The tree's providers did not lock: run `lace module lock` once the cause is fixed, before you commit it.";
13651
13810
  function beside(v) {
13652
13811
  return v.failure ? [v.failure] : [];
13653
13812
  }
@@ -13743,11 +13902,15 @@ function importNotice(e) {
13743
13902
  if (e.validate.exitClass !== "ok") {
13744
13903
  return ["warn", `${imported} ${didNotValidate(e.validate)}`, ...beside(e.validate)];
13745
13904
  }
13746
- const adopt = e.changed ? ` Review the change in git, commit it, then apply ${slug} to adopt them.` : "";
13747
- if (e.importResiduals.length === 0) return ["info", `${imported}${adopt}`];
13905
+ if (lockFailed(e)) return ["warn", `${imported} ${DID_NOT_LOCK}`];
13906
+ const adopts = e.importBlocks > 0;
13907
+ const next = adopts ? `, commit it, then apply ${slug} to adopt them` : " and commit it";
13908
+ const review = e.changed ? ` Review the change in git${next}.` : "";
13909
+ if (e.importResiduals.length === 0) return ["info", `${imported}${review}`];
13910
+ const unadopted = adopts ? "Not adopted" : "No resource was adopted";
13748
13911
  return [
13749
13912
  "warn",
13750
- `${imported}${adopt} Not adopted: ${residualAddresses(e.importResiduals)}; supply their import ids before applying, or the apply creates them anew.`
13913
+ `${imported}${review} ${unadopted}: ${residualAddresses(e.importResiduals)}; supply their import ids before applying, or the apply creates them anew.`
13751
13914
  ];
13752
13915
  }
13753
13916
  var importResult = {
@@ -13779,8 +13942,11 @@ function validateNotice(v) {
13779
13942
  }
13780
13943
  function convertNotice(e) {
13781
13944
  const converted = e.changed ? `Converted \u2014 ${e.written.length} file(s) written` : "Already lace-style \u2014 nothing to write";
13782
- if (e.validate.exitClass === "ok") return ["info", converted];
13783
- return ["warn", `${converted}. ${didNotValidate(e.validate)}`, ...beside(e.validate)];
13945
+ if (e.validate.exitClass !== "ok") {
13946
+ return ["warn", `${converted}. ${didNotValidate(e.validate)}`, ...beside(e.validate)];
13947
+ }
13948
+ if (lockFailed(e)) return ["warn", `${converted}. ${DID_NOT_LOCK}`];
13949
+ return ["info", converted];
13784
13950
  }
13785
13951
  var validate = defineCommand({
13786
13952
  kind: "command",
@@ -13949,6 +14115,16 @@ var CORE_COMMAND_ACTIONS = [
13949
14115
  ...MODULE_COMMAND_ACTIONS
13950
14116
  ];
13951
14117
 
14118
+ // src/core/entry-scope.ts
14119
+ function entryScopeIds(view) {
14120
+ const nested = new Set(view.groups.flatMap((g) => g.node_ids));
14121
+ return [...view.nodes, ...view.groups].map((n) => n.id).filter((id) => !nested.has(id));
14122
+ }
14123
+ function inEntryScope(view, ids) {
14124
+ const entry = new Set(entryScopeIds(view));
14125
+ return ids.filter((id) => entry.has(id));
14126
+ }
14127
+
13952
14128
  // src/registry.ts
13953
14129
  var CONTEXT_NEEDS = {
13954
14130
  root: "an authoring root",
@@ -13962,7 +14138,10 @@ var CONTEXT_NEEDS = {
13962
14138
  sourceRefused: "the source-refused lock",
13963
14139
  needsConversion: "a tree out of lace shape",
13964
14140
  "selection.node": "a selected node",
13965
- "selection.edge": "a selected connection",
14141
+ "selection.several": "two selected nodes or more",
14142
+ "selection.entryScope": "a selected top-level node or group",
14143
+ "selection.edge": "one selected connection",
14144
+ "selection.edges": "selected connections",
13966
14145
  diagnostics: "diagnostics to show",
13967
14146
  settingsOpen: "the settings panel open",
13968
14147
  generateIdle: "no Generate running",
@@ -13988,6 +14167,10 @@ function runsOn(action, ctx, target) {
13988
14167
  if (required.includes("root")) return `root:${ctx.root}`;
13989
14168
  return "";
13990
14169
  }
14170
+ function wiresAlone(ctx) {
14171
+ const selection = ctx.selection;
14172
+ return selection && selection.nodes.length === 0 ? selection.edges.length : 0;
14173
+ }
13991
14174
  function keySatisfied(ctx, key) {
13992
14175
  if (key === "editable") return ctx.editable === true;
13993
14176
  if (key === "saved") return ctx.view?.unsaved === false;
@@ -13997,13 +14180,16 @@ function keySatisfied(ctx, key) {
13997
14180
  if (key === "sourceRefused") return ctx.sourceRefused === true;
13998
14181
  if (key === "needsConversion")
13999
14182
  return ctx.sourceRefused === true && holdsLaceShapeRefusal(ctx.diagnostics ?? []);
14000
- if (key === "selection.node")
14001
- return ctx.selection !== void 0 && ctx.selection.nodes.length > 0;
14002
- if (key === "selection.edge") return ctx.selection !== void 0 && ctx.selection.edge !== null;
14183
+ if (key === "selection.node") return (ctx.selection?.nodes.length ?? 0) > 0;
14184
+ if (key === "selection.several") return (ctx.selection?.nodes.length ?? 0) > 1;
14185
+ if (key === "selection.entryScope")
14186
+ return ctx.view !== void 0 && ctx.selection !== void 0 && inEntryScope(ctx.view, ctx.selection.nodes).length > 0;
14187
+ if (key === "selection.edge") return wiresAlone(ctx) === 1;
14188
+ if (key === "selection.edges") return wiresAlone(ctx) > 0;
14003
14189
  if (key === "diagnostics") return ctx.diagnostics !== void 0 && ctx.diagnostics.length > 0;
14004
14190
  if (key === "settingsOpen") return ctx.settingsOpen === true;
14005
14191
  if (key === "generateIdle") return ctx.generating === false;
14006
- if (key === "generating") return ctx.generating === true;
14192
+ if (key === "generating") return ctx.generating !== void 0 && ctx.generating !== false;
14007
14193
  if (key === "ungenerated") return ctx.view?.ungenerated === true;
14008
14194
  if (key === "undoable") return ctx.view?.can_undo === true;
14009
14195
  if (key === "redoable") return ctx.view?.can_redo === true;
@@ -14088,6 +14274,7 @@ function createActionRunner(ports, store, options = {}) {
14088
14274
  const notifyControllers = /* @__PURE__ */ new Map();
14089
14275
  let edits = 0;
14090
14276
  const editingListeners = /* @__PURE__ */ new Set();
14277
+ const tickListeners = /* @__PURE__ */ new Set();
14091
14278
  async function asEdit(edit) {
14092
14279
  edits += 1;
14093
14280
  if (edits === 1) for (const listener of editingListeners) listener(true);
@@ -14159,7 +14346,10 @@ function createActionRunner(ports, store, options = {}) {
14159
14346
  },
14160
14347
  fail: (error) => run ? store.fail(run.resultKind, token, error) : false,
14161
14348
  detach: (kind, tok) => store.detach(kind, tok),
14162
- tick: () => store.bumpTick(),
14349
+ tick: () => {
14350
+ store.bumpTick();
14351
+ if (run) for (const listener of tickListeners) listener(run);
14352
+ },
14163
14353
  settled: onSettle
14164
14354
  };
14165
14355
  }
@@ -14290,8 +14480,9 @@ function createActionRunner(ports, store, options = {}) {
14290
14480
  const hostSpec = binding.confirm?.(ctx);
14291
14481
  if (hostSpec && !await askConfirm(hostSpec)) return;
14292
14482
  const token = {};
14293
- await binding.run(runtimeFor(token, readOverOf(ctx), cwdOf(action, ctx)), ctx, target);
14294
- if (binding.invalidates) store.bumpTick();
14483
+ const rt = runtimeFor(token, readOverOf(ctx), cwdOf(action, ctx));
14484
+ await binding.run(rt, ctx, target);
14485
+ if (binding.invalidates) rt.tick();
14295
14486
  }
14296
14487
  return {
14297
14488
  async run(action, ...rest) {
@@ -14338,6 +14529,12 @@ function createActionRunner(ports, store, options = {}) {
14338
14529
  editingListeners.delete(listener);
14339
14530
  };
14340
14531
  },
14532
+ onDidTick(listener) {
14533
+ tickListeners.add(listener);
14534
+ return () => {
14535
+ tickListeners.delete(listener);
14536
+ };
14537
+ },
14341
14538
  busy(action, ctx, target) {
14342
14539
  return busyOf(action, ctx, target);
14343
14540
  },
@@ -14357,6 +14554,7 @@ function createActionRunner(ports, store, options = {}) {
14357
14554
  store.detach("notify", token);
14358
14555
  }
14359
14556
  notifyControllers.clear();
14557
+ tickListeners.clear();
14360
14558
  }
14361
14559
  };
14362
14560
  }
@@ -14458,6 +14656,7 @@ function autosave(source, save, policy, report) {
14458
14656
  CommandUnobservedError,
14459
14657
  ConnectError,
14460
14658
  EMPTY_REPORT_FOLD,
14659
+ GENERATE_STAGES,
14461
14660
  InputMode,
14462
14661
  Reason,
14463
14662
  SCHEMAS,
@@ -14475,6 +14674,7 @@ function autosave(source, save, policy, report) {
14475
14674
  diagnosticsOfDocument,
14476
14675
  failureSays,
14477
14676
  foldReport,
14677
+ generatedTree,
14478
14678
  isBoundPath,
14479
14679
  liveSlots,
14480
14680
  openEngineCommands,