@lace-cloud/canvas 0.35.0 → 0.37.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.
@@ -492,6 +492,7 @@ var Reason = /* @__PURE__ */ ((Reason3) => {
492
492
  Reason3[Reason3["REASON_IMPORT_UNDECLARED"] = 20] = "REASON_IMPORT_UNDECLARED";
493
493
  Reason3[Reason3["REASON_ALREADY_IMPORTED"] = 21] = "REASON_ALREADY_IMPORTED";
494
494
  Reason3[Reason3["REASON_NO_LOCKFILE"] = 22] = "REASON_NO_LOCKFILE";
495
+ Reason3[Reason3["REASON_NO_COMMIT"] = 23] = "REASON_NO_COMMIT";
495
496
  Reason3[Reason3["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
496
497
  return Reason3;
497
498
  })(Reason || {});
@@ -566,6 +567,9 @@ function reasonFromJSON(object) {
566
567
  case 22:
567
568
  case "REASON_NO_LOCKFILE":
568
569
  return 22 /* REASON_NO_LOCKFILE */;
570
+ case 23:
571
+ case "REASON_NO_COMMIT":
572
+ return 23 /* REASON_NO_COMMIT */;
569
573
  case -1:
570
574
  case "UNRECOGNIZED":
571
575
  default:
@@ -620,6 +624,8 @@ function reasonToJSON(object) {
620
624
  return "REASON_ALREADY_IMPORTED";
621
625
  case 22 /* REASON_NO_LOCKFILE */:
622
626
  return "REASON_NO_LOCKFILE";
627
+ case 23 /* REASON_NO_COMMIT */:
628
+ return "REASON_NO_COMMIT";
623
629
  case -1 /* UNRECOGNIZED */:
624
630
  default:
625
631
  return "UNRECOGNIZED";
@@ -3702,7 +3708,7 @@ var InitializeRequest = {
3702
3708
  }
3703
3709
  };
3704
3710
  function createBaseInitializeResponse() {
3705
- return { server_version: "", protocol_version: "", supported_protocols: [], command_paths: [] };
3711
+ return { server_version: "", protocol_version: "", supported_protocols: [], command_paths: [], contract: "" };
3706
3712
  }
3707
3713
  var InitializeResponse = {
3708
3714
  encode(message, writer = new BinaryWriter4()) {
@@ -3718,6 +3724,9 @@ var InitializeResponse = {
3718
3724
  for (const v of message.command_paths) {
3719
3725
  writer.uint32(42).string(v);
3720
3726
  }
3727
+ if (message.contract !== "") {
3728
+ writer.uint32(50).string(message.contract);
3729
+ }
3721
3730
  return writer;
3722
3731
  },
3723
3732
  decode(input, length) {
@@ -3755,6 +3764,13 @@ var InitializeResponse = {
3755
3764
  message.command_paths.push(reader.string());
3756
3765
  continue;
3757
3766
  }
3767
+ case 6: {
3768
+ if (tag !== 50) {
3769
+ break;
3770
+ }
3771
+ message.contract = reader.string();
3772
+ continue;
3773
+ }
3758
3774
  }
3759
3775
  if ((tag & 7) === 4 || tag === 0) {
3760
3776
  break;
@@ -3768,7 +3784,8 @@ var InitializeResponse = {
3768
3784
  server_version: isSet3(object.serverVersion) ? globalThis.String(object.serverVersion) : isSet3(object.server_version) ? globalThis.String(object.server_version) : "",
3769
3785
  protocol_version: isSet3(object.protocolVersion) ? globalThis.String(object.protocolVersion) : isSet3(object.protocol_version) ? globalThis.String(object.protocol_version) : "",
3770
3786
  supported_protocols: globalThis.Array.isArray(object?.supportedProtocols) ? object.supportedProtocols.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.supported_protocols) ? object.supported_protocols.map((e) => globalThis.String(e)) : [],
3771
- command_paths: globalThis.Array.isArray(object?.commandPaths) ? object.commandPaths.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.command_paths) ? object.command_paths.map((e) => globalThis.String(e)) : []
3787
+ command_paths: globalThis.Array.isArray(object?.commandPaths) ? object.commandPaths.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.command_paths) ? object.command_paths.map((e) => globalThis.String(e)) : [],
3788
+ contract: isSet3(object.contract) ? globalThis.String(object.contract) : ""
3772
3789
  };
3773
3790
  },
3774
3791
  toJSON(message) {
@@ -3785,6 +3802,9 @@ var InitializeResponse = {
3785
3802
  if (message.command_paths?.length) {
3786
3803
  obj.commandPaths = message.command_paths;
3787
3804
  }
3805
+ if (message.contract !== "") {
3806
+ obj.contract = message.contract;
3807
+ }
3788
3808
  return obj;
3789
3809
  },
3790
3810
  create(base) {
@@ -3796,6 +3816,7 @@ var InitializeResponse = {
3796
3816
  message.protocol_version = object.protocol_version ?? "";
3797
3817
  message.supported_protocols = object.supported_protocols?.map((e) => e) || [];
3798
3818
  message.command_paths = object.command_paths?.map((e) => e) || [];
3819
+ message.contract = object.contract ?? "";
3799
3820
  return message;
3800
3821
  }
3801
3822
  };
@@ -9285,7 +9306,7 @@ var BundleApplyResult = {
9285
9306
  }
9286
9307
  };
9287
9308
  function createBaseCreatedRef() {
9288
- return { scope: "", id: "", module_key: "", source_id: "" };
9309
+ return { scope: "", id: "", module_key: "", source_id: "", group_id: "" };
9289
9310
  }
9290
9311
  var CreatedRef = {
9291
9312
  encode(message, writer = new BinaryWriter4()) {
@@ -9301,6 +9322,9 @@ var CreatedRef = {
9301
9322
  if (message.source_id !== "") {
9302
9323
  writer.uint32(34).string(message.source_id);
9303
9324
  }
9325
+ if (message.group_id !== "") {
9326
+ writer.uint32(42).string(message.group_id);
9327
+ }
9304
9328
  return writer;
9305
9329
  },
9306
9330
  decode(input, length) {
@@ -9338,6 +9362,13 @@ var CreatedRef = {
9338
9362
  message.source_id = reader.string();
9339
9363
  continue;
9340
9364
  }
9365
+ case 5: {
9366
+ if (tag !== 42) {
9367
+ break;
9368
+ }
9369
+ message.group_id = reader.string();
9370
+ continue;
9371
+ }
9341
9372
  }
9342
9373
  if ((tag & 7) === 4 || tag === 0) {
9343
9374
  break;
@@ -9351,7 +9382,8 @@ var CreatedRef = {
9351
9382
  scope: isSet3(object.scope) ? globalThis.String(object.scope) : "",
9352
9383
  id: isSet3(object.id) ? globalThis.String(object.id) : "",
9353
9384
  module_key: isSet3(object.moduleKey) ? globalThis.String(object.moduleKey) : isSet3(object.module_key) ? globalThis.String(object.module_key) : "",
9354
- source_id: isSet3(object.sourceId) ? globalThis.String(object.sourceId) : isSet3(object.source_id) ? globalThis.String(object.source_id) : ""
9385
+ source_id: isSet3(object.sourceId) ? globalThis.String(object.sourceId) : isSet3(object.source_id) ? globalThis.String(object.source_id) : "",
9386
+ group_id: isSet3(object.groupId) ? globalThis.String(object.groupId) : isSet3(object.group_id) ? globalThis.String(object.group_id) : ""
9355
9387
  };
9356
9388
  },
9357
9389
  toJSON(message) {
@@ -9368,6 +9400,9 @@ var CreatedRef = {
9368
9400
  if (message.source_id !== "") {
9369
9401
  obj.sourceId = message.source_id;
9370
9402
  }
9403
+ if (message.group_id !== "") {
9404
+ obj.groupId = message.group_id;
9405
+ }
9371
9406
  return obj;
9372
9407
  },
9373
9408
  create(base) {
@@ -9379,6 +9414,7 @@ var CreatedRef = {
9379
9414
  message.id = object.id ?? "";
9380
9415
  message.module_key = object.module_key ?? "";
9381
9416
  message.source_id = object.source_id ?? "";
9417
+ message.group_id = object.group_id ?? "";
9382
9418
  return message;
9383
9419
  }
9384
9420
  };
@@ -10946,7 +10982,7 @@ function bridgeCaller(bridge) {
10946
10982
 
10947
10983
  // src/adapters/engine/mapping.ts
10948
10984
  import {
10949
- checkEngineProtocol,
10985
+ checkEngineIdentity,
10950
10986
  convertDiagnostic,
10951
10987
  EMPTY_BUNDLE,
10952
10988
  ENGINE_PROTOCOL_VERSION
@@ -11689,6 +11725,13 @@ var COMMANDS = {
11689
11725
  },
11690
11726
  "readme": {
11691
11727
  "type": "string"
11728
+ },
11729
+ "visibility": {
11730
+ "type": "string",
11731
+ "values": [
11732
+ "public",
11733
+ "org_private"
11734
+ ]
11692
11735
  }
11693
11736
  },
11694
11737
  "effect": "read",
@@ -12252,6 +12295,27 @@ var COMMANDS = {
12252
12295
  "hidden": false,
12253
12296
  "yes": false
12254
12297
  },
12298
+ "stack validate": {
12299
+ "path": "stack validate",
12300
+ "positionals": [],
12301
+ "flags": {
12302
+ "output": {
12303
+ "type": "string",
12304
+ "values": [
12305
+ "table",
12306
+ "json"
12307
+ ],
12308
+ "short": "o"
12309
+ },
12310
+ "source": {
12311
+ "type": "string",
12312
+ "required": true
12313
+ }
12314
+ },
12315
+ "effect": "read",
12316
+ "hidden": false,
12317
+ "yes": false
12318
+ },
12255
12319
  "team current": {
12256
12320
  "path": "team current",
12257
12321
  "positionals": [],
@@ -12462,7 +12526,6 @@ var commandFailureSchema = z.strictObject({
12462
12526
  var moduleValidateDeviationSchema = z.object({
12463
12527
  notCompositional: z.boolean(),
12464
12528
  clusters: z.array(z.unknown()),
12465
- residuals: z.array(z.unknown()),
12466
12529
  hasManagedBackend: z.boolean(),
12467
12530
  backendFindings: z.array(z.object({ file: z.string(), line: z.number(), kind: z.string() })),
12468
12531
  sharedLocalSource: z.boolean(),
@@ -12558,7 +12621,8 @@ var registryListSchema = z.object({
12558
12621
  })
12559
12622
  ),
12560
12623
  truncated: z.boolean(),
12561
- publishingGuideUrl: z.string()
12624
+ publishingGuideUrl: z.string(),
12625
+ scopeNotice: z.string().optional()
12562
12626
  });
12563
12627
  var registryManifestSchema = z.object({
12564
12628
  id: z.string(),
@@ -13060,6 +13124,7 @@ var SCHEMAS = {
13060
13124
  "stack destroy": runEventSchema,
13061
13125
  "drift scan": driftScanSchema,
13062
13126
  "stack create": stackSchema,
13127
+ "stack validate": stackSourceSchema,
13063
13128
  "module import": moduleImportSchema,
13064
13129
  "run get": runSchema,
13065
13130
  "run plan": runPlanSchema,
@@ -13136,7 +13201,11 @@ async function initialize(caller) {
13136
13201
  client_version: "@lace-cloud/canvas",
13137
13202
  protocol_version: ENGINE_PROTOCOL_VERSION
13138
13203
  });
13139
- checkEngineProtocol(initialize2.server_version, initialize2.protocol_version);
13204
+ checkEngineIdentity({
13205
+ version: initialize2.server_version,
13206
+ protocol: initialize2.protocol_version,
13207
+ contract: initialize2.contract
13208
+ });
13140
13209
  return new Set(initialize2.command_paths);
13141
13210
  }
13142
13211
  async function openEngineCommands(caller, { cwd }) {
@@ -13481,7 +13550,13 @@ function convertGraphError(e) {
13481
13550
  };
13482
13551
  }
13483
13552
  function convertCreatedRef(r) {
13484
- return { scope: r.scope, id: r.id, moduleKey: r.module_key, sourceId: r.source_id };
13553
+ return {
13554
+ scope: r.scope,
13555
+ id: r.id,
13556
+ moduleKey: r.module_key,
13557
+ sourceId: r.source_id,
13558
+ groupId: r.group_id
13559
+ };
13485
13560
  }
13486
13561
 
13487
13562
  // src/utils/counted.ts
@@ -13578,7 +13653,11 @@ function diagnosticsOfDocument(document) {
13578
13653
  }));
13579
13654
  }
13580
13655
  function diagnosticsOfEntry(entry) {
13581
- return entry.kind === "failure" ? [{ severity: "error", message: entry.failure.message }] : diagnosticsOfDocument(entry.document);
13656
+ if (entry.kind === "failure") return [{ severity: "error", message: entry.failure.message }];
13657
+ const found = diagnosticsOfDocument(entry.document);
13658
+ if (entry.path !== "module validate") return found;
13659
+ const { failure } = entry.document;
13660
+ return failure && !found.some((d) => d.severity === "error") ? [...found, { severity: "error", message: failure.message }] : found;
13582
13661
  }
13583
13662
  function reportDiagnostics(fold) {
13584
13663
  return uniqueDiagnostics(
@@ -13718,6 +13797,14 @@ function failureSays(error) {
13718
13797
  }
13719
13798
  return { message: error instanceof Error ? error.message : String(error) };
13720
13799
  }
13800
+ function notifyFailure(presenter, error, label) {
13801
+ const { message, failure } = failureSays(error);
13802
+ presenter.notify(
13803
+ "error",
13804
+ label ? `${label}: ${message}` : message,
13805
+ ...failure ? [failure] : []
13806
+ );
13807
+ }
13721
13808
  function settleRun(prev, token, error) {
13722
13809
  const carried = prev && prev.token === token ? prev : null;
13723
13810
  const run = carried?.run ?? null;
@@ -13862,6 +13949,7 @@ function defineCommand(binding) {
13862
13949
  kind: "command",
13863
13950
  path: binding.path,
13864
13951
  confirms: binding.confirm !== void 0,
13952
+ preflightPath: binding.preflight?.path,
13865
13953
  resultKind: binding.result.kind,
13866
13954
  invalidates: binding.invalidates,
13867
13955
  partialArgs(ctx, target) {
@@ -13873,6 +13961,24 @@ function defineCommand(binding) {
13873
13961
  if (!merged.ok) return void 0;
13874
13962
  return binding.confirm(ctx, merged.args, target);
13875
13963
  },
13964
+ async preflight(rt, ctx, target, signal) {
13965
+ const commands = rt.ports.commands;
13966
+ if (!binding.preflight || !commands) return true;
13967
+ const { path, args } = binding.preflight;
13968
+ const merged = completeArgs(path, args(ctx, target));
13969
+ if (!merged.ok) return true;
13970
+ try {
13971
+ const events = commands.invoke(path, merged.args, signal, rt.cwd).events;
13972
+ const read = events[Symbol.asyncIterator]();
13973
+ let step = await read.next();
13974
+ while (!step.done) step = await read.next();
13975
+ return true;
13976
+ } catch (err) {
13977
+ if (err instanceof CommandDetachedError) return false;
13978
+ notifyFailure(rt.ports.presenter, err);
13979
+ return false;
13980
+ }
13981
+ },
13876
13982
  async start(rt, ctx, target, formArgs, signal) {
13877
13983
  const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
13878
13984
  if (!merged.ok) return null;
@@ -13892,8 +13998,7 @@ function defineCommand(binding) {
13892
13998
  } catch (err) {
13893
13999
  const settledByDocument = rendered && binding.result.kind === "notify" && (err instanceof CommandExitError || err instanceof CommandUnobservedError);
13894
14000
  if (!rt.fail(err) && !(err instanceof CommandDetachedError) && !settledByDocument) {
13895
- const { message, failure } = failureSays(err);
13896
- rt.ports.presenter.notify("error", message, ...failure ? [failure] : []);
14001
+ notifyFailure(rt.ports.presenter, err);
13897
14002
  }
13898
14003
  if (binding.invalidates) rt.tick();
13899
14004
  } finally {
@@ -14000,6 +14105,7 @@ var create = defineCommand({
14000
14105
  kind: "command",
14001
14106
  path: "stack create",
14002
14107
  args: (ctx) => ({ source: ctx.root }),
14108
+ preflight: { path: "stack validate", args: (ctx) => ({ source: ctx.root }) },
14003
14109
  invalidates: true,
14004
14110
  result: {
14005
14111
  kind: "notify",
@@ -14062,6 +14168,13 @@ function validateNotice(v) {
14062
14168
  const why = whyNotValid(v);
14063
14169
  return ["warn", why === void 0 ? "Not valid for Lace" : `Not valid: ${why}`];
14064
14170
  }
14171
+ function generateNotice(e) {
14172
+ if (e.validate.exitClass === "ok") return void 0;
14173
+ const tree = generatedTree(e);
14174
+ const count = tree.changed.length + tree.unchanged;
14175
+ const generated2 = count === 0 ? "Generated \u2014 nothing to write" : `Generated \u2014 ${counted(count, "file")} written`;
14176
+ return ["warn", `${generated2}. ${didNotValidate(e.validate)}`, ...beside(e.validate)];
14177
+ }
14065
14178
  function convertNotice(e) {
14066
14179
  const locked = e.lock === null ? "" : `, locking ${lockedIn(e.lock)}`;
14067
14180
  const converted = e.changed ? `Converted \u2014 ${e.written.length} file(s) written${locked}` : "Already lace-style \u2014 nothing to write";
@@ -14276,6 +14389,31 @@ function inEntryScope(view, ids) {
14276
14389
  return ids.filter((id) => entry.has(id));
14277
14390
  }
14278
14391
 
14392
+ // src/utils/handleId.ts
14393
+ var NODE_HANDLE = "node";
14394
+ function parseHandleId(handleId, prefix) {
14395
+ if (!handleId) return null;
14396
+ const marker = `${prefix}:`;
14397
+ if (!handleId.startsWith(marker)) return null;
14398
+ const name = handleId.slice(marker.length);
14399
+ return name.length > 0 ? name : null;
14400
+ }
14401
+ function sourceHandleId(output) {
14402
+ return `out:${output}`;
14403
+ }
14404
+ function targetHandleId(input) {
14405
+ return `in:${input}`;
14406
+ }
14407
+ function edgeHandles(e) {
14408
+ return {
14409
+ sourceHandle: e.source_pin ? targetHandleId(e.source_output) : sourceHandleId(e.source_output),
14410
+ targetHandle: e.target_pin ? sourceHandleId(e.target_input) : targetHandleId(e.target_input)
14411
+ };
14412
+ }
14413
+ function isDisconnectable(e) {
14414
+ return !e.target_pin;
14415
+ }
14416
+
14279
14417
  // src/registry.ts
14280
14418
  var CONTEXT_NEEDS = {
14281
14419
  root: "an authoring root",
@@ -14294,6 +14432,7 @@ var CONTEXT_NEEDS = {
14294
14432
  "selection.oneScope": "selected nodes that share one scope",
14295
14433
  "selection.edge": "one selected connection",
14296
14434
  "selection.edges": "selected connections",
14435
+ "selection.disconnectable": "a selected connection that feeds an input",
14297
14436
  diagnostics: "diagnostics to show",
14298
14437
  settingsOpen: "the settings panel open",
14299
14438
  generateIdle: "no Generate running",
@@ -14347,6 +14486,10 @@ function keySatisfied(ctx, key) {
14347
14486
  return ctx.view !== void 0 && ctx.selection !== void 0 && inOneScope(ctx.view, ctx.selection.nodes);
14348
14487
  if (key === "selection.edge") return wiresAlone(ctx) === 1;
14349
14488
  if (key === "selection.edges") return wiresAlone(ctx) > 0;
14489
+ if (key === "selection.disconnectable")
14490
+ return wiresAlone(ctx) > 0 && (ctx.view?.edges ?? []).some(
14491
+ (e) => ctx.selection?.edges.includes(e.id) && isDisconnectable(e)
14492
+ );
14350
14493
  if (key === "diagnostics") return ctx.diagnostics !== void 0 && ctx.diagnostics.length > 0;
14351
14494
  if (key === "settingsOpen") return ctx.settingsOpen === true;
14352
14495
  if (key === "generateIdle") return ctx.generating === false;
@@ -14439,8 +14582,13 @@ function unmetRequirement(action, ports, ctx, target) {
14439
14582
  if (target.failure === void 0) return `${label} needs ${TARGET_NEEDS.failure}`;
14440
14583
  if (!answersFailure(action, target.failure)) return `${label} does not answer this failure`;
14441
14584
  }
14442
- if (binding.kind === "command" && !availableCommands(ports).has(binding.path)) {
14443
- return `${label} runs lace ${binding.path}, which this host does not route`;
14585
+ if (binding.kind === "command") {
14586
+ const available = availableCommands(ports);
14587
+ for (const path of [binding.path, binding.preflightPath]) {
14588
+ if (path !== void 0 && !available.has(path)) {
14589
+ return `${label} runs lace ${path}, which this host does not route`;
14590
+ }
14591
+ }
14444
14592
  }
14445
14593
  return void 0;
14446
14594
  }
@@ -14492,6 +14640,8 @@ function createActionRunner(ports, store, options = {}) {
14492
14640
  const tokens = /* @__PURE__ */ new Map();
14493
14641
  const clipboard = createClipboardStore();
14494
14642
  const notifyControllers = /* @__PURE__ */ new Map();
14643
+ const preflighting = /* @__PURE__ */ new Set();
14644
+ const preflightControllers = /* @__PURE__ */ new Set();
14495
14645
  let edits = 0;
14496
14646
  const editingListeners = /* @__PURE__ */ new Set();
14497
14647
  const tickListeners = /* @__PURE__ */ new Set();
@@ -14566,6 +14716,15 @@ function createActionRunner(ports, store, options = {}) {
14566
14716
  settled: onSettle
14567
14717
  };
14568
14718
  }
14719
+ function invocationOf(action, binding, ctx, target, on) {
14720
+ const token = {};
14721
+ const run = { token, path: binding.path, resultKind: binding.resultKind, ctx, target };
14722
+ const started = { target, on, path: binding.path, label: action.label };
14723
+ return {
14724
+ token,
14725
+ runtime: (onSettle) => runtimeFor(token, readOverOf(ctx), cwdOf(action, ctx), { run, started }, onSettle)
14726
+ };
14727
+ }
14569
14728
  function readOverOf(ctx) {
14570
14729
  return { stack: ctx.stack?.id };
14571
14730
  }
@@ -14598,7 +14757,7 @@ function createActionRunner(ports, store, options = {}) {
14598
14757
  }
14599
14758
  function tellFailure(error) {
14600
14759
  if (error instanceof CommandDetachedError) return;
14601
- ports.presenter.notify("error", error instanceof Error ? error.message : String(error));
14760
+ notifyFailure(ports.presenter, error);
14602
14761
  }
14603
14762
  async function startCommand(action, ctx, target, formArgs) {
14604
14763
  const binding = action.binding;
@@ -14610,16 +14769,12 @@ function createActionRunner(ports, store, options = {}) {
14610
14769
  ports.presenter.notify("warn", busyReason(busy));
14611
14770
  return;
14612
14771
  }
14613
- const readOver = readOverOf(ctx);
14614
- const cwd = cwdOf(action, ctx);
14615
- const token = {};
14616
- const run = { token, path: binding.path, resultKind: binding.resultKind, ctx, target };
14617
- const started = { target, on, path: binding.path, label: action.label };
14772
+ const { token, runtime } = invocationOf(action, binding, ctx, target, on);
14618
14773
  const controller = new AbortController();
14619
14774
  if (binding.resultKind === "notify") {
14620
14775
  notifyControllers.set(controller, token);
14621
14776
  await binding.start(
14622
- runtimeFor(token, readOver, cwd, { run, started }, () => {
14777
+ runtime(() => {
14623
14778
  notifyControllers.delete(controller);
14624
14779
  store.detach("notify", token);
14625
14780
  }),
@@ -14633,18 +14788,33 @@ function createActionRunner(ports, store, options = {}) {
14633
14788
  detachSlot(binding.resultKind);
14634
14789
  controllers.set(binding.resultKind, controller);
14635
14790
  tokens.set(binding.resultKind, token);
14636
- const handle = await binding.start(
14637
- runtimeFor(token, readOver, cwd, { run, started }),
14638
- ctx,
14639
- target,
14640
- formArgs,
14641
- controller.signal
14642
- );
14791
+ const handle = await binding.start(runtime(), ctx, target, formArgs, controller.signal);
14643
14792
  if (handle) handles.set(binding.resultKind, handle);
14644
14793
  }
14645
14794
  async function runCommand(action, ctx, target) {
14646
14795
  const binding = action.binding;
14647
14796
  if (binding.kind !== "command") return;
14797
+ if (binding.preflightPath !== void 0) {
14798
+ if (preflighting.has(action.id)) return;
14799
+ preflighting.add(action.id);
14800
+ const { token, runtime } = invocationOf(
14801
+ action,
14802
+ binding,
14803
+ ctx,
14804
+ target,
14805
+ runsOn(action, ctx, target)
14806
+ );
14807
+ const rt = runtime(() => store.detach("notify", token));
14808
+ const controller = new AbortController();
14809
+ preflightControllers.add(controller);
14810
+ if (binding.resultKind === "notify") rt.begin();
14811
+ const proceed = await binding.preflight(rt, ctx, target, controller.signal).finally(() => {
14812
+ if (binding.resultKind === "notify") rt.settled?.();
14813
+ preflighting.delete(action.id);
14814
+ preflightControllers.delete(controller);
14815
+ });
14816
+ if (!proceed) return;
14817
+ }
14648
14818
  const completion = completeArgs(binding.path, binding.partialArgs(ctx, target));
14649
14819
  if (!completion.ok) {
14650
14820
  if (!options.onPendingFormChange) {
@@ -14680,6 +14850,7 @@ function createActionRunner(ports, store, options = {}) {
14680
14850
  ctx,
14681
14851
  target,
14682
14852
  clipboard,
14853
+ dissolved: options.onDissolved,
14683
14854
  ...envExtras
14684
14855
  };
14685
14856
  if (binding.result === "apply") {
@@ -14688,6 +14859,10 @@ function createActionRunner(ports, store, options = {}) {
14688
14859
  if (binding.result === "generate") {
14689
14860
  for await (const event of binding.run(env)) {
14690
14861
  if (event.type === "error") ports.presenter.notify("error", event.message);
14862
+ if (event.type === "success") {
14863
+ const notice = generateNotice(event);
14864
+ if (notice) ports.presenter.notify(...notice);
14865
+ }
14691
14866
  }
14692
14867
  return;
14693
14868
  }
@@ -14773,6 +14948,7 @@ function createActionRunner(ports, store, options = {}) {
14773
14948
  store.detach("notify", token);
14774
14949
  }
14775
14950
  notifyControllers.clear();
14951
+ for (const controller of preflightControllers) controller.abort();
14776
14952
  tickListeners.clear();
14777
14953
  }
14778
14954
  };
@@ -14796,6 +14972,28 @@ function proposeStackSlug(folder) {
14796
14972
  return "";
14797
14973
  }
14798
14974
 
14975
+ // src/utils/wire-end.ts
14976
+ import { callText, groupPinText } from "@lace-cloud/proto";
14977
+ function wireEnd(wire, end) {
14978
+ const source = end === "source";
14979
+ const node = source ? wire.source : wire.target;
14980
+ const pin = source ? wire.source_output : wire.target_input;
14981
+ if (source ? wire.source_pin : wire.target_pin) return { kind: "group-pin", node, pin };
14982
+ if (source && !pin) return { kind: "call", node };
14983
+ return { kind: "pin", node, pin };
14984
+ }
14985
+ function wireEndText(wire, end, pinText) {
14986
+ const part = wireEnd(wire, end);
14987
+ switch (part.kind) {
14988
+ case "group-pin":
14989
+ return groupPinText(part.node, end, part.pin);
14990
+ case "call":
14991
+ return callText(part.node);
14992
+ case "pin":
14993
+ return pinText(part.node, part.pin, end);
14994
+ }
14995
+ }
14996
+
14799
14997
  // src/engine/autosave.ts
14800
14998
  var AutosaveEndedError = class extends Error {
14801
14999
  constructor(reason) {
@@ -14888,6 +15086,12 @@ export {
14888
15086
  diagnosticsOf,
14889
15087
  entryScopeIds,
14890
15088
  inEntryScope,
15089
+ NODE_HANDLE,
15090
+ parseHandleId,
15091
+ sourceHandleId,
15092
+ targetHandleId,
15093
+ edgeHandles,
15094
+ isDisconnectable,
14891
15095
  keySatisfied,
14892
15096
  disabledReason,
14893
15097
  actionState,
@@ -14895,6 +15099,8 @@ export {
14895
15099
  answering,
14896
15100
  resolveContributions,
14897
15101
  rowActions,
15102
+ isPlainObject,
15103
+ deepEqual,
14898
15104
  counted,
14899
15105
  Reason,
14900
15106
  Bundle,
@@ -14926,6 +15132,7 @@ export {
14926
15132
  commandUnderWay,
14927
15133
  reduceRun,
14928
15134
  failureSays,
15135
+ notifyFailure,
14929
15136
  settleRun,
14930
15137
  reducePreview,
14931
15138
  reduceReport,
@@ -14940,8 +15147,8 @@ export {
14940
15147
  LOCK_LABEL,
14941
15148
  MODULE_COMMAND_ACTIONS,
14942
15149
  CORE_COMMAND_ACTIONS,
14943
- isPlainObject,
14944
- deepEqual,
15150
+ wireEnd,
15151
+ wireEndText,
14945
15152
  createActionRunner,
14946
15153
  connectCaller,
14947
15154
  bridgeCaller,
@@ -14952,4 +15159,4 @@ export {
14952
15159
  AutosaveEndedError,
14953
15160
  autosave
14954
15161
  };
14955
- //# sourceMappingURL=chunk-O3I4KLND.mjs.map
15162
+ //# sourceMappingURL=chunk-45ZS7XCZ.mjs.map