@lace-cloud/canvas 0.36.0 → 0.37.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  EMPTY_REPORT_FOLD,
10
10
  GENERATE_STAGES,
11
11
  MODULE_COMMAND_ACTIONS,
12
+ NODE_HANDLE,
12
13
  Reason,
13
14
  SCHEMAS,
14
15
  actionState,
@@ -27,26 +28,33 @@ import {
27
28
  defineCommand,
28
29
  diagnosticsOf,
29
30
  disabledReason,
31
+ edgeHandles,
30
32
  entryScopeIds,
31
33
  foldReport,
32
34
  generatedTree,
33
35
  inEntryScope,
34
36
  isBoundPath,
35
37
  isCommandPath,
38
+ isDisconnectable,
36
39
  isInert,
37
40
  isPlainObject,
38
41
  keySatisfied,
39
42
  liveSlots,
43
+ notifyFailure,
40
44
  openEngineCommands,
41
45
  openEngineSession,
42
46
  parseBound,
43
47
  parseCommandFailure,
48
+ parseHandleId,
44
49
  reportDiagnostics,
45
50
  resolveContributions,
46
51
  rowActions,
52
+ sourceHandleId,
53
+ targetHandleId,
47
54
  toArgv,
48
- uniqueDiagnostics
49
- } from "./chunk-XPHDFIKV.mjs";
55
+ uniqueDiagnostics,
56
+ wireEndText
57
+ } from "./chunk-323MYV3H.mjs";
50
58
 
51
59
  // src/index.ts
52
60
  import { projectCanvasView as projectCanvasView2 } from "@lace-cloud/proto";
@@ -61,14 +69,14 @@ import {
61
69
  useLayoutEffect as useLayoutEffect5,
62
70
  useMemo as useMemo12,
63
71
  useRef as useRef12,
64
- useState as useState18,
65
- useSyncExternalStore
72
+ useState as useState17,
73
+ useSyncExternalStore as useSyncExternalStore2
66
74
  } from "react";
67
75
  import "./App-IFIOMNV7.css";
68
76
 
69
77
  // src/Canvas.tsx
70
78
  import "@xyflow/react/dist/style.css";
71
- import "./Canvas-VQQEZSPA.css";
79
+ import "./Canvas-UTKLP6WI.css";
72
80
  import { drawnRect as drawnRect2, extentOf as extentOf3, instanceAddress as instanceAddress4, localIn as localIn3 } from "@lace-cloud/proto";
73
81
  import {
74
82
  applyEdgeChanges,
@@ -307,7 +315,7 @@ function isMacPlatform() {
307
315
  }
308
316
 
309
317
  // src/components/ContextMenu.tsx
310
- import "./ContextMenu-S3JIZMET.css";
318
+ import "./ContextMenu-P457V6QE.css";
311
319
  import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
312
320
  var atPoint = (x, y) => ({ left: x, right: x, top: y, bottom: y });
313
321
  function naturalSize(menu) {
@@ -715,7 +723,7 @@ import {
715
723
  groupPinY,
716
724
  NODE_ROW_HEIGHT
717
725
  } from "@lace-cloud/proto";
718
- import { Handle as Handle2, Position as Position2 } from "@xyflow/react";
726
+ import { Handle as Handle3, Position as Position3 } from "@xyflow/react";
719
727
  import { useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef3, useState as useState4 } from "react";
720
728
 
721
729
  // src/state/canvas-context.ts
@@ -728,7 +736,7 @@ function useCanvas() {
728
736
  }
729
737
 
730
738
  // src/utils/arrangement.ts
731
- import { drawnAt, frameOf, localIn, resolveInstance, splitPath } from "@lace-cloud/proto";
739
+ import { drawnAt, frameOf, joinPath, localIn, resolveInstance, splitPath } from "@lace-cloud/proto";
732
740
  function scopeKeyForCanvasPath(bundle, canvasPath) {
733
741
  return resolveInstance(bundle, canvasPath)?.scopeKey ?? null;
734
742
  }
@@ -804,31 +812,104 @@ function setScopeEntry(arrangement, scopeKey, entry) {
804
812
  next[scopeKey] = entry;
805
813
  return next;
806
814
  }
815
+ function promotedId(created, scope, groupId, member) {
816
+ const sourceId = splitPath(member).localId;
817
+ return created.filter((ref) => ref.scope === scope && ref.groupId === groupId && ref.sourceId === sourceId).pop()?.id ?? sourceId;
818
+ }
819
+ function promotedPath(created, scope, groupPath, member) {
820
+ const { parentPath, localId } = splitPath(groupPath);
821
+ return joinPath(parentPath, promotedId(created, scope, localId, member));
822
+ }
823
+ function withoutNodes(view, ids) {
824
+ const gone = new Set(ids);
825
+ return {
826
+ nodes: view.nodes.filter((n) => !gone.has(n.id)),
827
+ groups: view.groups.map((g) => ({ ...g, node_ids: g.node_ids.filter((n) => !gone.has(n)) }))
828
+ };
829
+ }
830
+ function dissolvedView(bundle, view, id, created) {
831
+ const group2 = view.groups.find((g) => g.id === id);
832
+ const scope = scopeKeyForCanvasPath(bundle, id);
833
+ if (!group2 || !scope) return view;
834
+ const moved = new Map(
835
+ group2.node_ids.map((member) => [member, promotedPath(created, scope, id, member)])
836
+ );
837
+ const renamed = (item) => ({
838
+ ...item,
839
+ id: moved.get(item.id) ?? item.id
840
+ });
841
+ return {
842
+ nodes: view.nodes.map(renamed),
843
+ groups: view.groups.filter((g) => g.id !== id).map(
844
+ (g) => g.id === splitPath(id).parentPath ? { ...g, node_ids: g.node_ids.flatMap((n) => n === id ? [...moved.values()] : [n]) } : renamed(g)
845
+ )
846
+ };
847
+ }
807
848
  function migrateUngroup(bundle, view, arrangement, groupCanvasPath, groupModuleKey, promoted = []) {
808
849
  const parentScopeKey = scopeKeyForCanvasPath(bundle, groupCanvasPath);
809
850
  const group2 = view.groups.find((g) => g.id === groupCanvasPath);
810
851
  if (!parentScopeKey || !group2) return arrangement;
811
- const { localId } = splitPath(groupCanvasPath);
812
852
  const pinned = withScopesPinned(bundle, view, arrangement, groupCanvasPath);
813
853
  const parentEntry = pinned[parentScopeKey] ?? {};
814
854
  const groupEntry = pinned[groupModuleKey] ?? {};
815
- const renameMap = new Map(
816
- promoted.filter((ref) => ref.scope === parentScopeKey && ref.sourceId).map((ref) => [ref.sourceId, ref.id])
817
- );
818
- const rename = (id) => renameMap.get(id) ?? id;
855
+ const finalId = (member) => promotedId(promoted, parentScopeKey, splitPath(groupCanvasPath).localId, member);
819
856
  const frame = frameOf(view, groupCanvasPath);
820
857
  const nodes = { ...parentEntry.nodes };
821
- delete nodes[localId];
822
858
  for (const member of group2.node_ids) {
823
859
  const at = drawnAt(view, member);
824
- if (at) nodes[rename(splitPath(member).localId)] = localIn(view, member, at, frame);
860
+ if (at) nodes[finalId(member)] = localIn(view, member, at, frame);
825
861
  }
826
- const remainingGroups = parentEntry.groups ? { ...parentEntry.groups } : void 0;
827
- if (remainingGroups) delete remainingGroups[localId];
828
- const migratedGroups = groupEntry.groups ? Object.fromEntries(Object.entries(groupEntry.groups).map(([id, g]) => [rename(id), g])) : void 0;
829
- const groups = remainingGroups || migratedGroups ? { ...remainingGroups, ...migratedGroups } : void 0;
862
+ const memberGroups = group2.node_ids.filter((member) => view.groups.some((g) => g.id === member));
863
+ const taken = new Set(memberGroups.map(finalId));
864
+ const keptGroups = parentEntry.groups && Object.fromEntries(Object.entries(parentEntry.groups).filter(([id]) => !taken.has(id)));
865
+ const migratedGroups = groupEntry.groups ? Object.fromEntries(
866
+ memberGroups.flatMap((member) => {
867
+ const entry = groupEntry.groups?.[splitPath(member).localId];
868
+ return entry ? [[finalId(member), entry]] : [];
869
+ })
870
+ ) : void 0;
871
+ const groups = keptGroups || migratedGroups ? { ...keptGroups, ...migratedGroups } : void 0;
830
872
  return setScopeEntry(pinned, parentScopeKey, { nodes, groups });
831
873
  }
874
+ var MAX_DISSOLUTIONS = 50;
875
+ function contentOf(bundle, groups, deleted) {
876
+ return [
877
+ ...groups.map((g) => [resolveInstance(bundle, g.path)?.child, bundle.modules[g.moduleKey]]),
878
+ ...deleted.map((id) => resolveInstance(bundle, id)?.child)
879
+ ];
880
+ }
881
+ function dissolveBatch(bundle, view, arrangement, { dissolved, deleted }, created) {
882
+ const promoted = [...created];
883
+ let after = arrangement;
884
+ let drawn = withoutNodes(view, deleted);
885
+ const groups = [];
886
+ for (const id of dissolved) {
887
+ const group2 = drawn.groups.find((g) => g.id === id);
888
+ const at = drawnAt(drawn, id);
889
+ if (!group2?.module_key || !at) continue;
890
+ groups.push({
891
+ path: id,
892
+ moduleKey: group2.module_key,
893
+ at: localIn(drawn, id, at, frameOf(drawn, id)),
894
+ collapsed: group2.collapsed
895
+ });
896
+ after = migrateUngroup(bundle, drawn, after, id, group2.module_key, promoted);
897
+ drawn = dissolvedView(bundle, drawn, id, promoted);
898
+ }
899
+ return {
900
+ arrangement: after,
901
+ dissolution: {
902
+ state: "done",
903
+ groups,
904
+ deleted,
905
+ created,
906
+ content: contentOf(bundle, groups, deleted)
907
+ }
908
+ };
909
+ }
910
+ function recordDissolution(records, dissolution) {
911
+ return [dissolution, ...records].slice(0, MAX_DISSOLUTIONS);
912
+ }
832
913
  function gcArrangement(bundle, arrangement) {
833
914
  const next = {};
834
915
  let changed = false;
@@ -885,22 +966,6 @@ function BadgeRow({ badges }) {
885
966
  import { Handle, Position, useUpdateNodeInternals } from "@xyflow/react";
886
967
  import { useEffect as useEffect2 } from "react";
887
968
 
888
- // src/utils/handleId.ts
889
- var NODE_HANDLE = "node";
890
- function parseHandleId(handleId, prefix) {
891
- if (!handleId) return null;
892
- const marker = `${prefix}:`;
893
- if (!handleId.startsWith(marker)) return null;
894
- const name = handleId.slice(marker.length);
895
- return name.length > 0 ? name : null;
896
- }
897
- function sourceHandleId(output) {
898
- return `out:${output}`;
899
- }
900
- function targetHandleId(input) {
901
- return `in:${input}`;
902
- }
903
-
904
969
  // src/components/nodes/pinColor.ts
905
970
  var STRING = {
906
971
  fill: "var(--lace-pin-string-fill)",
@@ -1035,7 +1100,7 @@ function useEditorEnvExtras() {
1035
1100
  }
1036
1101
 
1037
1102
  // src/components/nodes/CardActions.tsx
1038
- import "./CardActions-QLTNQUVW.css";
1103
+ import "./CardActions-ORDC2L5Y.css";
1039
1104
  import { jsx as jsx8 } from "react/jsx-runtime";
1040
1105
  function CardActions({ target }) {
1041
1106
  const { ctx, runner } = useCanvas();
@@ -1079,15 +1144,135 @@ function CardActions({ target }) {
1079
1144
  }
1080
1145
 
1081
1146
  // src/components/nodes/GroupNode.tsx
1082
- import "./GroupNode-NJOGOGQM.css";
1147
+ import "./GroupNode-2IGAUA6V.css";
1148
+
1149
+ // src/components/nodes/NodeDropTarget.tsx
1150
+ import { Handle as Handle2, Position as Position2, useStore as useStore3 } from "@xyflow/react";
1151
+ import "./NodeDropTarget-H5L3NZS6.css";
1152
+ import { jsx as jsx9 } from "react/jsx-runtime";
1153
+ var nodeDragging = (s) => s.connection.fromHandle?.id === NODE_HANDLE;
1154
+ var NodeDropTarget = () => {
1155
+ const connecting = useStore3(nodeDragging);
1156
+ return /* @__PURE__ */ jsx9(
1157
+ Handle2,
1158
+ {
1159
+ id: NODE_HANDLE,
1160
+ type: "target",
1161
+ position: Position2.Top,
1162
+ isConnectableStart: false,
1163
+ isConnectableEnd: connecting,
1164
+ className: "lace-node-drop"
1165
+ }
1166
+ );
1167
+ };
1083
1168
 
1084
1169
  // src/components/nodes/use-rename-instance.ts
1085
1170
  import { instanceAddress } from "@lace-cloud/proto";
1086
1171
  import { useCallback as useCallback2, useRef as useRef2 } from "react";
1087
1172
 
1088
1173
  // src/core/pipeline.ts
1089
- import { projectCanvasView } from "@lace-cloud/proto";
1174
+ import { projectCanvasView, splitPath as splitPath2 } from "@lace-cloud/proto";
1090
1175
  import { useEffect as useEffect3, useState as useState3 } from "react";
1176
+
1177
+ // src/core/draft-store.ts
1178
+ import { deriveNodeConfig, deriveSettingsConfig } from "@lace-cloud/proto";
1179
+ function memoized(compute) {
1180
+ const cache = /* @__PURE__ */ new Map();
1181
+ return (key) => {
1182
+ const hit = cache.get(key);
1183
+ if (hit) return hit.value;
1184
+ const value = compute(key);
1185
+ cache.set(key, { value });
1186
+ return value;
1187
+ };
1188
+ }
1189
+ var derivations = (bundle) => ({
1190
+ settings: memoized((moduleKey) => deriveSettingsConfig(bundle, moduleKey)),
1191
+ node: memoized((path) => deriveNodeConfig(bundle, path))
1192
+ });
1193
+ var sectionKind = (name, pick) => ({
1194
+ name,
1195
+ seed(derive, [moduleKey]) {
1196
+ const settings = derive.settings(moduleKey);
1197
+ return settings && !settings.reference ? pick(settings) : null;
1198
+ }
1199
+ });
1200
+ var draftId = (kind, params) => JSON.stringify([kind.name, ...params]);
1201
+ var unsettledIn = (seed) => (key, draft) => key in seed && !deepEqual(draft, seed[key]);
1202
+ function keeping(drafts, keep) {
1203
+ return new Map([...drafts].filter(([key, draft]) => keep(key, draft)));
1204
+ }
1205
+ var NO_DRAFTS = /* @__PURE__ */ new Map();
1206
+ function settleDrafts(entries, bundle) {
1207
+ const derive = derivations(bundle);
1208
+ let changed = false;
1209
+ const next = /* @__PURE__ */ new Map();
1210
+ for (const [id, held] of entries) {
1211
+ const seed = held.kind.seed(derive, held.params);
1212
+ const drafts = seed ? keeping(held.drafts, unsettledIn(seed)) : NO_DRAFTS;
1213
+ if (drafts.size === held.drafts.size) {
1214
+ next.set(id, held);
1215
+ continue;
1216
+ }
1217
+ changed = true;
1218
+ if (drafts.size > 0 || held.sending) next.set(id, { ...held, drafts });
1219
+ }
1220
+ return changed ? next : entries;
1221
+ }
1222
+ function createDraftStore() {
1223
+ let entries = /* @__PURE__ */ new Map();
1224
+ const listeners = /* @__PURE__ */ new Set();
1225
+ const write = (next) => {
1226
+ if (next === entries) return;
1227
+ entries = next;
1228
+ for (const listener of [...listeners]) listener();
1229
+ };
1230
+ const put = (id, held) => {
1231
+ const empty = held.drafts.size === 0 && !held.sending;
1232
+ if (empty && !entries.has(id)) return;
1233
+ const next = new Map(entries);
1234
+ if (empty) next.delete(id);
1235
+ else next.set(id, held);
1236
+ write(next);
1237
+ };
1238
+ const heldOf = (kind, params) => entries.get(draftId(kind, params)) ?? { kind, params, drafts: NO_DRAFTS, sending: false };
1239
+ return {
1240
+ subscribe(listener) {
1241
+ listeners.add(listener);
1242
+ return () => {
1243
+ listeners.delete(listener);
1244
+ };
1245
+ },
1246
+ read: (kind, params) => entries.get(draftId(kind, params)),
1247
+ set(kind, params, field, value, seed) {
1248
+ const held = heldOf(kind, params);
1249
+ const drafts = new Map(held.drafts);
1250
+ if (unsettledIn(seed)(field, value)) drafts.set(field, value);
1251
+ else drafts.delete(field);
1252
+ put(draftId(kind, params), { ...held, drafts });
1253
+ },
1254
+ begin(kind, params) {
1255
+ const held = heldOf(kind, params);
1256
+ if (held.sending) return false;
1257
+ put(draftId(kind, params), { ...held, sending: true });
1258
+ return true;
1259
+ },
1260
+ settleSent(kind, params, sent2) {
1261
+ const held = heldOf(kind, params);
1262
+ const drafts = keeping(held.drafts, (key, draft) => draft !== sent2[key]);
1263
+ if (drafts.size < held.drafts.size) put(draftId(kind, params), { ...held, drafts });
1264
+ },
1265
+ end(kind, params) {
1266
+ const held = heldOf(kind, params);
1267
+ put(draftId(kind, params), { ...held, sending: false });
1268
+ },
1269
+ settle(bundle) {
1270
+ if (entries.size > 0) write(settleDrafts(entries, bundle));
1271
+ }
1272
+ };
1273
+ }
1274
+
1275
+ // src/core/pipeline.ts
1091
1276
  function projectFrame(frame, arrangement) {
1092
1277
  return projectCanvasView(frame.bundle, arrangement, {
1093
1278
  canUndo: frame.canUndo,
@@ -1115,6 +1300,57 @@ function carrySelection(selection, oldPath, newPath) {
1115
1300
  if (copies.length === 0) return selection;
1116
1301
  return { ...selection, nodes: [...selection.nodes, ...copies] };
1117
1302
  }
1303
+ function ledgerFor(held, port) {
1304
+ return held?.port === port ? held : { port, records: [], shown: null, drafts: createDraftStore() };
1305
+ }
1306
+ var holds = (view, g) => view.groups.some((held) => held.id === g.path && held.module_key === g.moduleKey);
1307
+ function promotedHeld(bundle, created) {
1308
+ return created.every(
1309
+ (ref) => !bundle.modules[ref.scope] || bundle.modules[ref.scope]?.modules?.some((u) => u.id === ref.id)
1310
+ );
1311
+ }
1312
+ function withGroupBack(bundle, arrangement, g) {
1313
+ const scope = scopeKeyForCanvasPath(bundle, g.path);
1314
+ const { localId } = splitPath2(g.path);
1315
+ const entry = scope ? arrangement[scope] : void 0;
1316
+ if (!scope || deepEqual(entry?.nodes?.[localId], g.at) && entry?.groups?.[localId]?.collapsed === g.collapsed) {
1317
+ return arrangement;
1318
+ }
1319
+ return withGroupCollapsed(
1320
+ bundle,
1321
+ withNodePosition(bundle, arrangement, g.path, g.at),
1322
+ g.path,
1323
+ g.collapsed
1324
+ );
1325
+ }
1326
+ function reconcileDissolutions(records, prev, next, arrangement) {
1327
+ if (!prev) return { records, arrangement };
1328
+ let out = arrangement;
1329
+ const reconciled = records.flatMap((record) => {
1330
+ const { groups } = record;
1331
+ if (record.state === "done") {
1332
+ const back = next.source.canRedo && groups.every((g) => !holds(prev.view, g) && holds(next.view, g)) && deepEqual(contentOf(next.source.bundle, groups, record.deleted), record.content);
1333
+ if (!back) return [record];
1334
+ for (const g of groups) out = withGroupBack(next.source.bundle, out, g);
1335
+ return [{ ...record, state: "undone" }];
1336
+ }
1337
+ if (groups.every((g) => holds(prev.view, g) && !holds(next.view, g))) {
1338
+ if (!promotedHeld(next.source.bundle, record.created)) return [];
1339
+ const batch = dissolveBatch(
1340
+ prev.source.bundle,
1341
+ prev.view,
1342
+ out,
1343
+ { dissolved: groups.map((g) => g.path), deleted: record.deleted },
1344
+ record.created
1345
+ );
1346
+ out = batch.arrangement;
1347
+ return [batch.dissolution];
1348
+ }
1349
+ return next.source.canRedo ? [record] : [];
1350
+ });
1351
+ const same = reconciled.length === records.length && reconciled.every((r, i) => r === records[i]);
1352
+ return { records: same ? records : reconciled, arrangement: out };
1353
+ }
1118
1354
  var NO_SOURCE = { source: null, end: null, session: null };
1119
1355
  function useCanvasSource(source, onCommandResult, onSessionEnd) {
1120
1356
  const [held, setHeld] = useState3({ ...NO_SOURCE, port: null });
@@ -1167,7 +1403,7 @@ function useRenameInstance() {
1167
1403
  }
1168
1404
 
1169
1405
  // src/components/nodes/GroupNode.tsx
1170
- import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1406
+ import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
1171
1407
  var GroupHeader = ({
1172
1408
  label,
1173
1409
  memberCount,
@@ -1188,7 +1424,7 @@ var GroupHeader = ({
1188
1424
  className: `lace-group-node__header lace-group-node__header--${collapsed ? "collapsed" : "expanded"}`,
1189
1425
  style: collapsed ? { height: GROUP_HEADER_HEIGHT } : void 0,
1190
1426
  children: [
1191
- /* @__PURE__ */ jsx9(
1427
+ /* @__PURE__ */ jsx10(
1192
1428
  "button",
1193
1429
  {
1194
1430
  type: "button",
@@ -1196,11 +1432,11 @@ var GroupHeader = ({
1196
1432
  className: "lace-group-node__collapse-btn",
1197
1433
  title: collapsed ? "Expand" : "Collapse",
1198
1434
  "aria-label": collapsed ? "Expand" : "Collapse",
1199
- children: /* @__PURE__ */ jsx9(CanvasIcon, { name: collapsed ? "chevron-right" : "chevron-down" })
1435
+ children: /* @__PURE__ */ jsx10(CanvasIcon, { name: collapsed ? "chevron-right" : "chevron-down" })
1200
1436
  }
1201
1437
  ),
1202
- /* @__PURE__ */ jsx9("span", { className: "lace-group-node__glyph", children: /* @__PURE__ */ jsx9(CanvasIcon, { name: "group" }) }),
1203
- editing ? /* @__PURE__ */ jsx9(
1438
+ /* @__PURE__ */ jsx10("span", { className: "lace-group-node__glyph", children: /* @__PURE__ */ jsx10(CanvasIcon, { name: "group" }) }),
1439
+ editing ? /* @__PURE__ */ jsx10(
1204
1440
  "input",
1205
1441
  {
1206
1442
  ref: inputRef,
@@ -1211,13 +1447,13 @@ var GroupHeader = ({
1211
1447
  className: "lace-group-node__rename-input",
1212
1448
  onClick: (e) => e.stopPropagation()
1213
1449
  }
1214
- ) : /* @__PURE__ */ jsx9("span", { className: "lace-group-node__label", onDoubleClick, title: label, children: label }),
1450
+ ) : /* @__PURE__ */ jsx10("span", { className: "lace-group-node__label", onDoubleClick, title: label, children: label }),
1215
1451
  /* @__PURE__ */ jsxs4("span", { className: "lace-group-node__count", children: [
1216
1452
  memberCount,
1217
1453
  " ",
1218
1454
  memberCount === 1 ? "module" : "modules"
1219
1455
  ] }),
1220
- hovered && /* @__PURE__ */ jsx9(CardActions, { target })
1456
+ hovered && /* @__PURE__ */ jsx10(CardActions, { target })
1221
1457
  ]
1222
1458
  }
1223
1459
  );
@@ -1227,6 +1463,16 @@ var InterfacePinRow = ({
1227
1463
  spans
1228
1464
  }) => {
1229
1465
  const isInput = pin.side === "input";
1466
+ const handleStyle2 = {
1467
+ background: pin.color.fill,
1468
+ borderColor: pin.color.stroke,
1469
+ borderWidth: 1,
1470
+ borderStyle: "solid",
1471
+ width: 10,
1472
+ height: 10,
1473
+ [isInput ? "left" : "right"]: -5,
1474
+ top: NODE_ROW_HEIGHT / 2
1475
+ };
1230
1476
  return /* @__PURE__ */ jsxs4(
1231
1477
  "div",
1232
1478
  {
@@ -1243,27 +1489,33 @@ var InterfacePinRow = ({
1243
1489
  },
1244
1490
  title: pin.name,
1245
1491
  children: [
1246
- /* @__PURE__ */ jsx9(
1247
- Handle2,
1492
+ /* @__PURE__ */ jsx10(
1493
+ Handle3,
1248
1494
  {
1249
1495
  id: pin.handleId,
1250
1496
  type: isInput ? "target" : "source",
1251
- position: isInput ? Position2.Left : Position2.Right,
1497
+ position: isInput ? Position3.Left : Position3.Right,
1498
+ isConnectable: false,
1499
+ className: "lace-pin-handle",
1500
+ style: handleStyle2
1501
+ }
1502
+ ),
1503
+ !spans && /* @__PURE__ */ jsx10(
1504
+ Handle3,
1505
+ {
1506
+ id: pin.handleId,
1507
+ type: isInput ? "source" : "target",
1508
+ position: isInput ? Position3.Right : Position3.Left,
1252
1509
  isConnectable: false,
1253
1510
  className: "lace-pin-handle",
1254
1511
  style: {
1255
- background: pin.color.fill,
1256
- borderColor: pin.color.stroke,
1257
- borderWidth: 1,
1258
- borderStyle: "solid",
1259
- width: 10,
1260
- height: 10,
1261
- [isInput ? "left" : "right"]: -5,
1262
- top: NODE_ROW_HEIGHT / 2
1512
+ ...handleStyle2,
1513
+ [isInput ? "right" : "left"]: "auto",
1514
+ transform: `translate(${isInput ? "-50%" : "50%"}, -50%)`
1263
1515
  }
1264
1516
  }
1265
1517
  ),
1266
- /* @__PURE__ */ jsx9("span", { className: "lace-group-node__pin-label", style: { maxWidth: COLLAPSED_GROUP_WIDTH - 28 }, children: pin.name })
1518
+ /* @__PURE__ */ jsx10("span", { className: "lace-group-node__pin-label", style: { maxWidth: COLLAPSED_GROUP_WIDTH - 28 }, children: pin.name })
1267
1519
  ]
1268
1520
  }
1269
1521
  );
@@ -1332,7 +1584,7 @@ var GroupNode = ({ id, data }) => {
1332
1584
  };
1333
1585
  const inputs = data.interfacePins.filter((p) => p.side === "input");
1334
1586
  const outputs = data.interfacePins.filter((p) => p.side === "output");
1335
- const callHandles = /* @__PURE__ */ jsx9(
1587
+ const callHandles = /* @__PURE__ */ jsx10(
1336
1588
  CallHandles,
1337
1589
  {
1338
1590
  nodeId: id,
@@ -1342,8 +1594,8 @@ var GroupNode = ({ id, data }) => {
1342
1594
  }
1343
1595
  );
1344
1596
  const pinRows = (spans) => [
1345
- ...inputs.map((pin, i) => /* @__PURE__ */ jsx9(InterfacePinRow, { pin, y: groupPinY(i), spans }, pin.handleId)),
1346
- ...outputs.map((pin, i) => /* @__PURE__ */ jsx9(InterfacePinRow, { pin, y: groupPinY(i), spans }, pin.handleId))
1597
+ ...inputs.map((pin, i) => /* @__PURE__ */ jsx10(InterfacePinRow, { pin, y: groupPinY(i), spans }, pin.handleId)),
1598
+ ...outputs.map((pin, i) => /* @__PURE__ */ jsx10(InterfacePinRow, { pin, y: groupPinY(i), spans }, pin.handleId))
1347
1599
  ];
1348
1600
  if (collapsed) {
1349
1601
  const bare = data.interfacePins.length === 0;
@@ -1357,10 +1609,11 @@ var GroupNode = ({ id, data }) => {
1357
1609
  onMouseEnter: () => setHovered(true),
1358
1610
  onMouseLeave: () => setHovered(false),
1359
1611
  children: [
1360
- /* @__PURE__ */ jsx9(GroupHeader, { ...headerProps }),
1361
- /* @__PURE__ */ jsx9(BadgeRow, { badges: data.badges }),
1612
+ /* @__PURE__ */ jsx10(GroupHeader, { ...headerProps }),
1613
+ /* @__PURE__ */ jsx10(BadgeRow, { badges: data.badges }),
1362
1614
  callHandles,
1363
- pinRows(true)
1615
+ pinRows(true),
1616
+ editable && /* @__PURE__ */ jsx10(NodeDropTarget, {})
1364
1617
  ]
1365
1618
  }
1366
1619
  );
@@ -1375,10 +1628,11 @@ var GroupNode = ({ id, data }) => {
1375
1628
  onMouseEnter: () => setHovered(true),
1376
1629
  onMouseLeave: () => setHovered(false),
1377
1630
  children: [
1378
- /* @__PURE__ */ jsx9(GroupHeader, { ...headerProps }),
1379
- /* @__PURE__ */ jsx9(BadgeRow, { badges: data.badges }),
1631
+ /* @__PURE__ */ jsx10(GroupHeader, { ...headerProps }),
1632
+ /* @__PURE__ */ jsx10(BadgeRow, { badges: data.badges }),
1380
1633
  callHandles,
1381
- pinRows(false)
1634
+ pinRows(false),
1635
+ editable && /* @__PURE__ */ jsx10(NodeDropTarget, {})
1382
1636
  ]
1383
1637
  }
1384
1638
  );
@@ -1394,12 +1648,7 @@ import {
1394
1648
  nodeRows,
1395
1649
  visibleInputs
1396
1650
  } from "@lace-cloud/proto";
1397
- import {
1398
- Handle as Handle3,
1399
- Position as Position3,
1400
- useStore as useStore3,
1401
- useUpdateNodeInternals as useUpdateNodeInternals2
1402
- } from "@xyflow/react";
1651
+ import { Handle as Handle4, Position as Position4, useUpdateNodeInternals as useUpdateNodeInternals2 } from "@xyflow/react";
1403
1652
  import { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef5, useState as useState5 } from "react";
1404
1653
 
1405
1654
  // src/core/decorate.ts
@@ -1465,11 +1714,11 @@ function typedName(name, type) {
1465
1714
  }
1466
1715
 
1467
1716
  // src/components/nodes/ModuleNode.tsx
1468
- import "./ModuleNode-LPPBJZCD.css";
1717
+ import "./ModuleNode-3GTXKKVQ.css";
1469
1718
 
1470
1719
  // src/components/nodes/node-config-bus.tsx
1471
1720
  import { createContext as createContext2, useContext as useContext2, useRef as useRef4 } from "react";
1472
- import { jsx as jsx10 } from "react/jsx-runtime";
1721
+ import { jsx as jsx11 } from "react/jsx-runtime";
1473
1722
  var NodeConfigBusContext = createContext2(null);
1474
1723
  function NodeConfigBusProvider({
1475
1724
  onOpen,
@@ -1478,7 +1727,7 @@ function NodeConfigBusProvider({
1478
1727
  const onOpenRef = useRef4(onOpen);
1479
1728
  onOpenRef.current = onOpen;
1480
1729
  const stableRef = useRef4((instanceId) => onOpenRef.current(instanceId));
1481
- return /* @__PURE__ */ jsx10(NodeConfigBusContext.Provider, { value: stableRef.current, children });
1730
+ return /* @__PURE__ */ jsx11(NodeConfigBusContext.Provider, { value: stableRef.current, children });
1482
1731
  }
1483
1732
  function useOpenNodeConfig() {
1484
1733
  const fn = useContext2(NodeConfigBusContext);
@@ -1487,11 +1736,10 @@ function useOpenNodeConfig() {
1487
1736
  }
1488
1737
 
1489
1738
  // src/components/nodes/ModuleNode.tsx
1490
- import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
1739
+ import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
1491
1740
  var ICON_SIZE = 16;
1492
1741
  var LABEL_ROOM = NODE_WIDTH - 28;
1493
1742
  var labelRoom = (shared) => shared ? LABEL_ROOM / 2 - 4 : LABEL_ROOM;
1494
- var nodeDragging = (s) => s.connection.fromHandle?.id === NODE_HANDLE;
1495
1743
  var PROBLEM_RING = {
1496
1744
  error: "var(--lace-node-error-border)",
1497
1745
  warn: "var(--lace-color-warning-fg)",
@@ -1506,7 +1754,6 @@ var PinRow = ({ pin, side, top, shared, problem, isConnectable }) => {
1506
1754
  const handleStyle2 = {
1507
1755
  background: face.background,
1508
1756
  borderColor: ring ?? face.borderColor,
1509
- borderWidth: ring ? 2 : 1.5,
1510
1757
  borderStyle: "solid",
1511
1758
  width: 10,
1512
1759
  height: 10,
@@ -1533,18 +1780,19 @@ var PinRow = ({ pin, side, top, shared, problem, isConnectable }) => {
1533
1780
  title: problem ? `${problem.message}
1534
1781
  ${about}` : about,
1535
1782
  children: [
1536
- /* @__PURE__ */ jsx11(
1537
- Handle3,
1783
+ /* @__PURE__ */ jsx12(
1784
+ Handle4,
1538
1785
  {
1539
1786
  id: isInput ? targetHandleId(pin.name) : sourceHandleId(pin.name),
1540
1787
  type: isInput ? "target" : "source",
1541
- position: isInput ? Position3.Left : Position3.Right,
1788
+ position: isInput ? Position4.Left : Position4.Right,
1542
1789
  isConnectable,
1543
1790
  className: "lace-pin-handle",
1791
+ "data-problem": ring ? problem?.tone : void 0,
1544
1792
  style: handleStyle2
1545
1793
  }
1546
1794
  ),
1547
- /* @__PURE__ */ jsx11(
1795
+ /* @__PURE__ */ jsx12(
1548
1796
  "span",
1549
1797
  {
1550
1798
  className: `lace-module-node__pin-row-label lace-module-node__pin-row-label--${isError ? "error" : filled ? "wired" : "default"}`,
@@ -1559,7 +1807,6 @@ ${about}` : about,
1559
1807
  var ModuleNode = ({ id, data }) => {
1560
1808
  const { editable, bundle } = useCanvas();
1561
1809
  const rename = useRenameInstance();
1562
- const connecting = useStore3(nodeDragging);
1563
1810
  const openNodeConfig = useOpenNodeConfig();
1564
1811
  const [editing, setEditing] = useState5(false);
1565
1812
  const [editValue, setEditValue] = useState5(id);
@@ -1661,7 +1908,7 @@ var ModuleNode = ({ id, data }) => {
1661
1908
  onClick: onHeaderClick,
1662
1909
  title: badges.length > 0 ? badges.map((b) => b.title ?? b.label).join("\n") : data.label,
1663
1910
  children: [
1664
- /* @__PURE__ */ jsx11(
1911
+ /* @__PURE__ */ jsx12(
1665
1912
  "button",
1666
1913
  {
1667
1914
  type: "button",
@@ -1669,10 +1916,10 @@ var ModuleNode = ({ id, data }) => {
1669
1916
  className: "lace-module-node__collapse-btn",
1670
1917
  title: collapsed ? "Expand" : "Collapse",
1671
1918
  "aria-label": collapsed ? "Expand" : "Collapse",
1672
- children: /* @__PURE__ */ jsx11(CanvasIcon, { name: collapsed ? "chevron-right" : "chevron-down" })
1919
+ children: /* @__PURE__ */ jsx12(CanvasIcon, { name: collapsed ? "chevron-right" : "chevron-down" })
1673
1920
  }
1674
1921
  ),
1675
- showIcon ? /* @__PURE__ */ jsx11(
1922
+ showIcon ? /* @__PURE__ */ jsx12(
1676
1923
  "img",
1677
1924
  {
1678
1925
  src: data.icon_url,
@@ -1681,8 +1928,8 @@ var ModuleNode = ({ id, data }) => {
1681
1928
  style: { width: ICON_SIZE, height: ICON_SIZE },
1682
1929
  onError: () => setImgFailed(true)
1683
1930
  }
1684
- ) : /* @__PURE__ */ jsx11("span", { className: "lace-module-node__icon-fallback", children: /* @__PURE__ */ jsx11(CanvasIcon, { name: "module" }) }),
1685
- editing ? /* @__PURE__ */ jsx11(
1931
+ ) : /* @__PURE__ */ jsx12("span", { className: "lace-module-node__icon-fallback", children: /* @__PURE__ */ jsx12(CanvasIcon, { name: "module" }) }),
1932
+ editing ? /* @__PURE__ */ jsx12(
1686
1933
  "input",
1687
1934
  {
1688
1935
  ref: inputRef,
@@ -1693,7 +1940,7 @@ var ModuleNode = ({ id, data }) => {
1693
1940
  className: "lace-module-node__rename-input",
1694
1941
  onClick: (e) => e.stopPropagation()
1695
1942
  }
1696
- ) : /* @__PURE__ */ jsx11(
1943
+ ) : /* @__PURE__ */ jsx12(
1697
1944
  "span",
1698
1945
  {
1699
1946
  className: "lace-module-node__label",
@@ -1702,12 +1949,12 @@ var ModuleNode = ({ id, data }) => {
1702
1949
  children: data.label
1703
1950
  }
1704
1951
  ),
1705
- hovered && /* @__PURE__ */ jsx11(CardActions, { target })
1952
+ hovered && /* @__PURE__ */ jsx12(CardActions, { target })
1706
1953
  ]
1707
1954
  }
1708
1955
  ),
1709
- /* @__PURE__ */ jsx11(BadgeRow, { badges }),
1710
- /* @__PURE__ */ jsx11(
1956
+ /* @__PURE__ */ jsx12(BadgeRow, { badges }),
1957
+ /* @__PURE__ */ jsx12(
1711
1958
  CallHandles,
1712
1959
  {
1713
1960
  nodeId: id,
@@ -1717,7 +1964,7 @@ var ModuleNode = ({ id, data }) => {
1717
1964
  }
1718
1965
  ),
1719
1966
  !collapsed && /* @__PURE__ */ jsxs5("div", { className: "lace-module-node__body", style: { height: bodyHeight }, children: [
1720
- shownInputs.map((pin, i) => /* @__PURE__ */ jsx11(
1967
+ shownInputs.map((pin, i) => /* @__PURE__ */ jsx12(
1721
1968
  PinRow,
1722
1969
  {
1723
1970
  pin,
@@ -1729,7 +1976,7 @@ var ModuleNode = ({ id, data }) => {
1729
1976
  },
1730
1977
  `in:${pin.name}`
1731
1978
  )),
1732
- outputs.map((pin, i) => /* @__PURE__ */ jsx11(
1979
+ outputs.map((pin, i) => /* @__PURE__ */ jsx12(
1733
1980
  PinRow,
1734
1981
  {
1735
1982
  pin,
@@ -1768,12 +2015,12 @@ var ModuleNode = ({ id, data }) => {
1768
2015
  collapsed && /* @__PURE__ */ jsxs5(Fragment5, { children: [
1769
2016
  inputs.map((pin, i) => {
1770
2017
  const face = pinFace(pinColor(pin), !!pin.wired);
1771
- return /* @__PURE__ */ jsx11(
1772
- Handle3,
2018
+ return /* @__PURE__ */ jsx12(
2019
+ Handle4,
1773
2020
  {
1774
2021
  id: targetHandleId(pin.name),
1775
2022
  type: "target",
1776
- position: Position3.Left,
2023
+ position: Position4.Left,
1777
2024
  isConnectable: editable,
1778
2025
  className: "lace-pin-handle",
1779
2026
  style: {
@@ -1791,12 +2038,12 @@ var ModuleNode = ({ id, data }) => {
1791
2038
  }),
1792
2039
  outputs.map((pin, i) => {
1793
2040
  const face = pinFace(pinColor(pin), !!pin.wired);
1794
- return /* @__PURE__ */ jsx11(
1795
- Handle3,
2041
+ return /* @__PURE__ */ jsx12(
2042
+ Handle4,
1796
2043
  {
1797
2044
  id: sourceHandleId(pin.name),
1798
2045
  type: "source",
1799
- position: Position3.Right,
2046
+ position: Position4.Right,
1800
2047
  isConnectable: editable,
1801
2048
  className: "lace-pin-handle",
1802
2049
  style: {
@@ -1814,27 +2061,17 @@ var ModuleNode = ({ id, data }) => {
1814
2061
  })
1815
2062
  ] }),
1816
2063
  editable && /* @__PURE__ */ jsxs5(Fragment5, { children: [
1817
- /* @__PURE__ */ jsx11(
1818
- Handle3,
2064
+ /* @__PURE__ */ jsx12(
2065
+ Handle4,
1819
2066
  {
1820
2067
  id: NODE_HANDLE,
1821
2068
  type: "source",
1822
- position: Position3.Bottom,
2069
+ position: Position4.Bottom,
1823
2070
  onClick: void 0,
1824
2071
  className: "lace-module-node__grip"
1825
2072
  }
1826
2073
  ),
1827
- /* @__PURE__ */ jsx11(
1828
- Handle3,
1829
- {
1830
- id: NODE_HANDLE,
1831
- type: "target",
1832
- position: Position3.Top,
1833
- isConnectableStart: false,
1834
- isConnectableEnd: connecting,
1835
- className: "lace-module-node__drop"
1836
- }
1837
- )
2074
+ /* @__PURE__ */ jsx12(NodeDropTarget, {})
1838
2075
  ] })
1839
2076
  ]
1840
2077
  }
@@ -1844,9 +2081,9 @@ var ModuleNode_default = ModuleNode;
1844
2081
 
1845
2082
  // src/components/PaperGrid.tsx
1846
2083
  import "./PaperGrid-JG4GBRDP.css";
1847
- import { jsx as jsx12 } from "react/jsx-runtime";
2084
+ import { jsx as jsx13 } from "react/jsx-runtime";
1848
2085
  function PaperGrid() {
1849
- return /* @__PURE__ */ jsx12("div", { className: "lace-paper-layers lace-canvas-paper", "aria-hidden": "true" });
2086
+ return /* @__PURE__ */ jsx13("div", { className: "lace-paper-layers lace-canvas-paper", "aria-hidden": "true" });
1850
2087
  }
1851
2088
 
1852
2089
  // src/core/editor-actions.ts
@@ -1859,12 +2096,12 @@ import {
1859
2096
  groupPins,
1860
2097
  groupReach,
1861
2098
  instanceAddress as instanceAddress3,
1862
- joinPath,
2099
+ joinPath as joinPath2,
1863
2100
  keepOrder,
1864
2101
  localIn as localIn2,
1865
2102
  originAt,
1866
2103
  reachRect,
1867
- splitPath as splitPath2,
2104
+ splitPath as splitPath3,
1868
2105
  stepDown
1869
2106
  } from "@lace-cloud/proto";
1870
2107
  function emptyApplyResult() {
@@ -1975,7 +2212,7 @@ async function groupRun(env) {
1975
2212
  const parentEntry = before[created.scope] ?? {};
1976
2213
  const drawn = ids.flatMap((id) => {
1977
2214
  const rect = drawnRect(view, id);
1978
- return rect ? [{ id, localId: splitPath2(id).localId, rect }] : [];
2215
+ return rect ? [{ id, localId: splitPath3(id).localId, rect }] : [];
1979
2216
  });
1980
2217
  if (drawn.length === 0) return result;
1981
2218
  const members = extentOf(drawn.map((m) => m.rect));
@@ -1993,15 +2230,15 @@ async function groupRun(env) {
1993
2230
  groups: Object.keys(memberGroups).length > 0 ? memberGroups : void 0
1994
2231
  });
1995
2232
  const reach = groupReach(groupPins(minted), groupBoxSize(members));
1996
- const { parentPath } = splitPath2(ids[0]);
1997
- const groupPath = joinPath(parentPath, created.id);
2233
+ const { parentPath } = splitPath3(ids[0]);
2234
+ const groupPath = joinPath2(parentPath, created.id);
1998
2235
  const declared = new Map(
1999
2236
  (frame.bundle.modules[created.scope]?.modules ?? []).map((use, i) => [use.id, i])
2000
2237
  );
2001
2238
  const keyOf = (id, at) => ({ ...at, declared: declared.get(id) ?? 0 });
2002
2239
  const selected = new Set(ids);
2003
2240
  const others = [...view.nodes, ...view.groups].flatMap(({ id }) => {
2004
- const { parentPath: scopePath, localId } = splitPath2(id);
2241
+ const { parentPath: scopePath, localId } = splitPath3(id);
2005
2242
  const rect = selected.has(id) || scopePath !== parentPath ? void 0 : drawnRect(view, id);
2006
2243
  return rect ? [{ rect, key: keyOf(localId, rect) }] : [];
2007
2244
  });
@@ -2029,21 +2266,28 @@ function ungroupAction(bundle, id) {
2029
2266
  const { scope, id: group_id } = instanceAddress3(bundle, id);
2030
2267
  return { ungroup: { scope, group_id } };
2031
2268
  }
2032
- async function applyDissolving(env, actions, dissolved) {
2269
+ async function applyDissolving(env, actions, dissolving) {
2033
2270
  const result = await env.apply(actions);
2034
2271
  if (!result.success) return result;
2035
2272
  const before = env.arrangement.get();
2036
- const after = dissolved.reduce((arrangement, id) => {
2037
- const moduleKey = env.ctx.view.groups.find((g) => g.id === id)?.module_key;
2038
- return moduleKey ? migrateUngroup(env.bundle, env.ctx.view, arrangement, id, moduleKey, result.created) : arrangement;
2039
- }, before);
2273
+ const { arrangement: after, dissolution } = dissolveBatch(
2274
+ env.bundle,
2275
+ env.ctx.view,
2276
+ before,
2277
+ dissolving,
2278
+ result.created
2279
+ );
2040
2280
  if (after !== before) env.arrangement.update(after);
2281
+ if (dissolution.groups.length > 0) env.dissolved?.(dissolution);
2041
2282
  return result;
2042
2283
  }
2043
2284
  async function ungroupRun(env) {
2044
2285
  const groupId = env.target.groupId;
2045
2286
  if (!groupId) return emptyApplyResult();
2046
- return applyDissolving(env, [ungroupAction(env.bundle, groupId)], [groupId]);
2287
+ return applyDissolving(env, [ungroupAction(env.bundle, groupId)], {
2288
+ dissolved: [groupId],
2289
+ deleted: []
2290
+ });
2047
2291
  }
2048
2292
  async function deleteRun(env, ids) {
2049
2293
  if (ids.length === 0) return emptyApplyResult();
@@ -2057,7 +2301,7 @@ async function deleteRun(env, ids) {
2057
2301
  return applyDissolving(
2058
2302
  env,
2059
2303
  [...deletes, ...dissolved.map((id) => ungroupAction(env.bundle, id))],
2060
- dissolved
2304
+ { dissolved, deleted: calls }
2061
2305
  );
2062
2306
  }
2063
2307
  async function deleteNodeRun(env) {
@@ -2533,8 +2777,13 @@ function useGroupLogic(nodes, edges, groups, newNodeIds, decorations) {
2533
2777
  }
2534
2778
  });
2535
2779
  }
2780
+ const groupById = new Map(groups.map((g) => [g.id, g]));
2781
+ const scopeOf2 = (e) => {
2782
+ if (e.source_pin && e.target_pin) return groupById.get(e.source);
2783
+ return parentOf.get(e.source_pin ? e.target : e.source);
2784
+ };
2536
2785
  const rfEdges = edges.filter((e) => {
2537
- const scope = parentOf.get(e.source);
2786
+ const scope = scopeOf2(e);
2538
2787
  return !(scope && membersHidden(scope));
2539
2788
  }).map(renderEdgeToRfEdge);
2540
2789
  return { rfNodes, rfEdges };
@@ -2552,8 +2801,7 @@ function renderEdgeToRfEdge(e) {
2552
2801
  id: e.id,
2553
2802
  source: e.source,
2554
2803
  target: e.target,
2555
- sourceHandle: sourceHandleId(e.source_output),
2556
- targetHandle: targetHandleId(e.target_input),
2804
+ ...edgeHandles(e),
2557
2805
  data: { source_output: e.source_output, target_input: e.target_input },
2558
2806
  type: DEPENDENCY_EDGE_TYPE
2559
2807
  };
@@ -2742,7 +2990,7 @@ function useViewport(pane, focusIds) {
2742
2990
  }
2743
2991
 
2744
2992
  // src/Canvas.tsx
2745
- import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
2993
+ import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
2746
2994
  var nodeTypes = {
2747
2995
  moduleNode: ModuleNode_default,
2748
2996
  groupNode: GroupNode_default
@@ -2810,12 +3058,7 @@ function CompositeEditor({
2810
3058
  const selectedEdgeIds = useMemo6(() => new Set(selection.edges), [selection.edges]);
2811
3059
  const [rfEdges, setRfEdges] = useState8(rfEdgesFromView);
2812
3060
  useEffect9(() => {
2813
- setRfEdges((prev) => {
2814
- const held = new Set(prev.filter((e) => e.selected).map((e) => e.id));
2815
- return rfEdgesFromView.map(
2816
- (e) => held.has(e.id) || selectedEdgeIds.has(e.id) ? { ...e, selected: true } : e
2817
- );
2818
- });
3061
+ setRfEdges(rfEdgesFromView.map((e) => ({ ...e, selected: selectedEdgeIds.has(e.id) })));
2819
3062
  }, [rfEdgesFromView, selectedEdgeIds]);
2820
3063
  const onEdgesChange = useCallback8(
2821
3064
  (changes) => {
@@ -2910,9 +3153,9 @@ function CompositeEditor({
2910
3153
  proOptions: { hideAttribution: true },
2911
3154
  style: { background: "var(--lace-color-bg-canvas)" },
2912
3155
  children: [
2913
- /* @__PURE__ */ jsx13(CanvasControls, { onFit: viewport.fit }),
2914
- /* @__PURE__ */ jsx13(PaperGrid, {}),
2915
- nodesInitialized ? /* @__PURE__ */ jsx13("div", { hidden: true, "data-rendered": "" }) : null
3156
+ /* @__PURE__ */ jsx14(CanvasControls, { onFit: viewport.fit }),
3157
+ /* @__PURE__ */ jsx14(PaperGrid, {}),
3158
+ nodesInitialized ? /* @__PURE__ */ jsx14("div", { hidden: true, "data-rendered": "" }) : null
2916
3159
  ]
2917
3160
  }
2918
3161
  );
@@ -3061,7 +3304,7 @@ function Canvas({ height }) {
3061
3304
  },
3062
3305
  [runner, menuCtx, menuTarget, makeEnvExtras]
3063
3306
  );
3064
- return /* @__PURE__ */ jsx13(NodeConfigBusProvider, { onOpen: onOpenNodeConfig, children: /* @__PURE__ */ jsxs6(
3307
+ return /* @__PURE__ */ jsx14(NodeConfigBusProvider, { onOpen: onOpenNodeConfig, children: /* @__PURE__ */ jsxs6(
3065
3308
  "div",
3066
3309
  {
3067
3310
  ref: surfaceRef,
@@ -3076,7 +3319,7 @@ function Canvas({ height }) {
3076
3319
  outline: "none"
3077
3320
  },
3078
3321
  children: [
3079
- /* @__PURE__ */ jsx13(
3322
+ /* @__PURE__ */ jsx14(
3080
3323
  ContextMenu,
3081
3324
  {
3082
3325
  contextMenu,
@@ -3087,7 +3330,7 @@ function Canvas({ height }) {
3087
3330
  }
3088
3331
  ),
3089
3332
  /* @__PURE__ */ jsxs6("div", { ref: setPane, style: { position: "relative", flex: "1 1 auto", minHeight: 0 }, children: [
3090
- /* @__PURE__ */ jsx13(
3333
+ /* @__PURE__ */ jsx14(
3091
3334
  CompositeEditor,
3092
3335
  {
3093
3336
  view,
@@ -3109,7 +3352,7 @@ function Canvas({ height }) {
3109
3352
  decorations
3110
3353
  }
3111
3354
  ),
3112
- !ctx.sourceRefused && view.nodes.length === 0 && view.groups.length === 0 ? /* @__PURE__ */ jsx13(EmptyCanvas, { editable }) : null
3355
+ !ctx.sourceRefused && view.nodes.length === 0 && view.groups.length === 0 ? /* @__PURE__ */ jsx14(EmptyCanvas, { editable }) : null
3113
3356
  ] })
3114
3357
  ]
3115
3358
  }
@@ -3126,7 +3369,7 @@ function readTokenPx(el, name) {
3126
3369
 
3127
3370
  // src/components/Drawer.tsx
3128
3371
  import "./Drawer-34ZYTEWE.css";
3129
- import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
3372
+ import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
3130
3373
  var KEY_STEP = 16;
3131
3374
  function readDrawerBounds(el) {
3132
3375
  const min = readTokenPx(el, "--lace-size-drawer-min");
@@ -3173,7 +3416,7 @@ function Drawer({ label, children }) {
3173
3416
  };
3174
3417
  const style = width === null ? void 0 : { "--drawer-width": `${width}px` };
3175
3418
  return /* @__PURE__ */ jsxs7("aside", { ref, className: "lace-app__drawer", "aria-label": label, style, children: [
3176
- /* @__PURE__ */ jsx14(
3419
+ /* @__PURE__ */ jsx15(
3177
3420
  "div",
3178
3421
  {
3179
3422
  className: "lace-app__drawer-handle",
@@ -3190,19 +3433,19 @@ function Drawer({ label, children }) {
3190
3433
  onKeyDown
3191
3434
  }
3192
3435
  ),
3193
- /* @__PURE__ */ jsx14("div", { className: "lace-app__drawer-body", children })
3436
+ /* @__PURE__ */ jsx15("div", { className: "lace-app__drawer-body", children })
3194
3437
  ] });
3195
3438
  }
3196
3439
 
3197
3440
  // src/components/ErrorBoundary.tsx
3198
3441
  import React from "react";
3199
3442
  import "./ErrorBoundary-IXSIVZFH.css";
3200
- import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
3443
+ import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
3201
3444
  function ErrorState({ message }) {
3202
3445
  return /* @__PURE__ */ jsxs8("div", { className: "lace-error-state", role: "alert", children: [
3203
- /* @__PURE__ */ jsx15("h3", { className: "lace-error-state__title", children: "Something went wrong" }),
3204
- /* @__PURE__ */ jsx15("pre", { className: "lace-error-state__message", children: message }),
3205
- /* @__PURE__ */ jsx15(
3446
+ /* @__PURE__ */ jsx16("h3", { className: "lace-error-state__title", children: "Something went wrong" }),
3447
+ /* @__PURE__ */ jsx16("pre", { className: "lace-error-state__message", children: message }),
3448
+ /* @__PURE__ */ jsx16(
3206
3449
  "button",
3207
3450
  {
3208
3451
  type: "button",
@@ -3223,7 +3466,7 @@ var ErrorBoundary = class extends React.Component {
3223
3466
  }
3224
3467
  render() {
3225
3468
  if (this.state.error) {
3226
- return /* @__PURE__ */ jsx15(ErrorState, { message: this.state.error.message });
3469
+ return /* @__PURE__ */ jsx16(ErrorState, { message: this.state.error.message });
3227
3470
  }
3228
3471
  return this.props.children;
3229
3472
  }
@@ -3232,23 +3475,23 @@ var ErrorBoundary = class extends React.Component {
3232
3475
  // src/components/ToolbarAction.tsx
3233
3476
  import { Button, IconButton as IconButton2, Spinner } from "@lace-cloud/ui";
3234
3477
  import "./ToolbarAction-PQNWHJSU.css";
3235
- import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
3478
+ import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
3236
3479
  var TIP = "bottom-start";
3237
3480
  function actionTip(keys, reason) {
3238
3481
  const chord = keys?.[0] ? formatChord(keys[0], isMacPlatform()) : void 0;
3239
3482
  if (!chord && !reason) return void 0;
3240
3483
  return /* @__PURE__ */ jsxs9("span", { className: "lace-action-tip", children: [
3241
- chord ? /* @__PURE__ */ jsx16("kbd", { className: "lace-action-tip__key", children: chord }) : null,
3242
- reason ? /* @__PURE__ */ jsx16("span", { className: "lace-action-tip__reason", children: reason }) : null
3484
+ chord ? /* @__PURE__ */ jsx17("kbd", { className: "lace-action-tip__key", children: chord }) : null,
3485
+ reason ? /* @__PURE__ */ jsx17("span", { className: "lace-action-tip__reason", children: reason }) : null
3243
3486
  ] });
3244
3487
  }
3245
3488
  function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, busyLabel, onRun }) {
3246
3489
  const busy = busyLabel !== void 0;
3247
3490
  const inert = isInert({ disabledReason: disabledReason2, busyLabel });
3248
3491
  const tooltip = actionTip(action.keys, disabledReason2);
3249
- const glyph = action.icon ? /* @__PURE__ */ jsx16(CanvasIcon, { name: action.icon }) : void 0;
3492
+ const glyph = action.icon ? /* @__PURE__ */ jsx17(CanvasIcon, { name: action.icon }) : void 0;
3250
3493
  if (action.primary) {
3251
- return /* @__PURE__ */ jsx16(
3494
+ return /* @__PURE__ */ jsx17(
3252
3495
  Button,
3253
3496
  {
3254
3497
  rung: true,
@@ -3267,10 +3510,10 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
3267
3510
  );
3268
3511
  }
3269
3512
  if (glyph) {
3270
- return /* @__PURE__ */ jsx16(
3513
+ return /* @__PURE__ */ jsx17(
3271
3514
  IconButton2,
3272
3515
  {
3273
- icon: busy ? /* @__PURE__ */ jsx16(Spinner, { size: 14, "aria-hidden": "true" }) : glyph,
3516
+ icon: busy ? /* @__PURE__ */ jsx17(Spinner, { size: 14, "aria-hidden": "true" }) : glyph,
3274
3517
  "aria-label": action.label,
3275
3518
  size: "md",
3276
3519
  "aria-disabled": inert,
@@ -3280,7 +3523,7 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
3280
3523
  }
3281
3524
  );
3282
3525
  }
3283
- return /* @__PURE__ */ jsx16(
3526
+ return /* @__PURE__ */ jsx17(
3284
3527
  Button,
3285
3528
  {
3286
3529
  rung: true,
@@ -3300,7 +3543,7 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
3300
3543
 
3301
3544
  // src/core/CommandArgsForm.tsx
3302
3545
  import { useState as useState10 } from "react";
3303
- import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
3546
+ import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
3304
3547
  function flagsOf(path) {
3305
3548
  return COMMANDS[path].flags;
3306
3549
  }
@@ -3320,15 +3563,15 @@ function CommandArgsForm({ form }) {
3320
3563
  form.missing.map((key) => {
3321
3564
  const flagType = flags[key]?.type;
3322
3565
  return /* @__PURE__ */ jsxs10("label", { className: "lace-command-args-form__field", children: [
3323
- /* @__PURE__ */ jsx17("span", { children: key }),
3324
- flagType === "bool" ? /* @__PURE__ */ jsx17(
3566
+ /* @__PURE__ */ jsx18("span", { children: key }),
3567
+ flagType === "bool" ? /* @__PURE__ */ jsx18(
3325
3568
  "input",
3326
3569
  {
3327
3570
  type: "checkbox",
3328
3571
  checked: Boolean(values[key]),
3329
3572
  onChange: (e) => setValues((prev) => ({ ...prev, [key]: e.target.checked }))
3330
3573
  }
3331
- ) : /* @__PURE__ */ jsx17(
3574
+ ) : /* @__PURE__ */ jsx18(
3332
3575
  "input",
3333
3576
  {
3334
3577
  type: "text",
@@ -3340,8 +3583,8 @@ function CommandArgsForm({ form }) {
3340
3583
  ] }, key);
3341
3584
  }),
3342
3585
  /* @__PURE__ */ jsxs10("div", { className: "lace-command-args-form__actions", children: [
3343
- /* @__PURE__ */ jsx17("button", { type: "submit", children: "Continue" }),
3344
- /* @__PURE__ */ jsx17("button", { type: "button", onClick: form.cancel, children: "Cancel" })
3586
+ /* @__PURE__ */ jsx18("button", { type: "submit", children: "Continue" }),
3587
+ /* @__PURE__ */ jsx18("button", { type: "button", onClick: form.cancel, children: "Cancel" })
3345
3588
  ] })
3346
3589
  ]
3347
3590
  }
@@ -3359,7 +3602,7 @@ import { useEffect as useEffect10, useMemo as useMemo8, useRef as useRef10, useS
3359
3602
 
3360
3603
  // src/core/panel-scope.tsx
3361
3604
  import { createContext as createContext3, useContext as useContext3, useMemo as useMemo7 } from "react";
3362
- import { jsx as jsx18 } from "react/jsx-runtime";
3605
+ import { jsx as jsx19 } from "react/jsx-runtime";
3363
3606
  var noopReportError = () => {
3364
3607
  };
3365
3608
  var PanelScopeContext = createContext3(null);
@@ -3376,7 +3619,7 @@ function PanelScope({
3376
3619
  () => ({ ctx, target, paths: new Set(paths), tick, reportError }),
3377
3620
  [ctx, target, paths, tick, reportError]
3378
3621
  );
3379
- return /* @__PURE__ */ jsx18(PanelScopeContext.Provider, { value, children });
3622
+ return /* @__PURE__ */ jsx19(PanelScopeContext.Provider, { value, children });
3380
3623
  }
3381
3624
  function usePanelScope() {
3382
3625
  const value = useContext3(PanelScopeContext);
@@ -3528,7 +3771,7 @@ import { Button as Button2 } from "@lace-cloud/ui";
3528
3771
 
3529
3772
  // src/components/Banner.tsx
3530
3773
  import "./Banner-4TSIKYLF.css";
3531
- import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
3774
+ import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
3532
3775
  function Banner({ severity, message, className, actions }) {
3533
3776
  return /* @__PURE__ */ jsxs11(
3534
3777
  "div",
@@ -3536,16 +3779,16 @@ function Banner({ severity, message, className, actions }) {
3536
3779
  className: `lace-banner lace-banner--${severity} ${className}`,
3537
3780
  role: severity === "error" ? "alert" : "status",
3538
3781
  children: [
3539
- /* @__PURE__ */ jsx19("span", { className: "lace-banner__icon", children: /* @__PURE__ */ jsx19(CanvasIcon, { name: severity }) }),
3540
- /* @__PURE__ */ jsx19("span", { className: "lace-banner__message", children: message }),
3541
- actions ? /* @__PURE__ */ jsx19("span", { className: "lace-banner__actions", children: actions }) : null
3782
+ /* @__PURE__ */ jsx20("span", { className: "lace-banner__icon", children: /* @__PURE__ */ jsx20(CanvasIcon, { name: severity }) }),
3783
+ /* @__PURE__ */ jsx20("span", { className: "lace-banner__message", children: message }),
3784
+ actions ? /* @__PURE__ */ jsx20("span", { className: "lace-banner__actions", children: actions }) : null
3542
3785
  ]
3543
3786
  }
3544
3787
  );
3545
3788
  }
3546
3789
 
3547
3790
  // src/core/panels/RowActionBanner.tsx
3548
- import { jsx as jsx20 } from "react/jsx-runtime";
3791
+ import { jsx as jsx21 } from "react/jsx-runtime";
3549
3792
  function bannerMessage(opening, actions) {
3550
3793
  return [opening, ...actions.flatMap((action) => action.choice ? [action.choice] : [])].join(
3551
3794
  " "
@@ -3555,7 +3798,7 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
3555
3798
  const { runner } = useCanvas();
3556
3799
  const envExtras = useEditorEnvExtras();
3557
3800
  const actions = rowActionsFor(ctx, panelId);
3558
- return /* @__PURE__ */ jsx20(
3801
+ return /* @__PURE__ */ jsx21(
3559
3802
  Banner,
3560
3803
  {
3561
3804
  severity,
@@ -3563,7 +3806,7 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
3563
3806
  message: bannerMessage(opening, actions),
3564
3807
  actions: actions.length === 0 ? void 0 : actions.map((action) => {
3565
3808
  const state = actionState(action, ctx, runner.busy(action, ctx, {}));
3566
- return /* @__PURE__ */ jsx20(
3809
+ return /* @__PURE__ */ jsx21(
3567
3810
  Button2,
3568
3811
  {
3569
3812
  rung: true,
@@ -3584,9 +3827,9 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
3584
3827
  }
3585
3828
 
3586
3829
  // src/core/panels/ConflictBanner.tsx
3587
- import { jsx as jsx21 } from "react/jsx-runtime";
3830
+ import { jsx as jsx22 } from "react/jsx-runtime";
3588
3831
  function ConflictBanner({ ctx }) {
3589
- return /* @__PURE__ */ jsx21(
3832
+ return /* @__PURE__ */ jsx22(
3590
3833
  RowActionBanner,
3591
3834
  {
3592
3835
  ctx,
@@ -3612,15 +3855,15 @@ import { Button as Button3 } from "@lace-cloud/ui";
3612
3855
  // src/components/Identifier.tsx
3613
3856
  import { Fragment as Fragment6 } from "react";
3614
3857
  import "./Identifier-V6MZ37EG.css";
3615
- import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
3858
+ import { jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
3616
3859
  function identifierSegments(text) {
3617
3860
  return text.split(/(?<=[_.])/);
3618
3861
  }
3619
3862
  function Identifier({ text, className }) {
3620
- return /* @__PURE__ */ jsx22("span", { className: className ? `lace-identifier ${className}` : "lace-identifier", children: identifierSegments(text).map((segment, i) => (
3863
+ return /* @__PURE__ */ jsx23("span", { className: className ? `lace-identifier ${className}` : "lace-identifier", children: identifierSegments(text).map((segment, i) => (
3621
3864
  // biome-ignore lint/suspicious/noArrayIndexKey: a segment's place in the name is its identity.
3622
3865
  /* @__PURE__ */ jsxs12(Fragment6, { children: [
3623
- i > 0 ? /* @__PURE__ */ jsx22("wbr", {}) : null,
3866
+ i > 0 ? /* @__PURE__ */ jsx23("wbr", {}) : null,
3624
3867
  segment
3625
3868
  ] }, i)
3626
3869
  )) });
@@ -3628,7 +3871,7 @@ function Identifier({ text, className }) {
3628
3871
 
3629
3872
  // src/core/panels/DiagnosticsPanel.tsx
3630
3873
  import "./DiagnosticsPanel-MSK72CGM.css";
3631
- import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
3874
+ import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
3632
3875
  function locationOf(file, line) {
3633
3876
  return line === void 0 ? file : `${file}:${line}`;
3634
3877
  }
@@ -3639,7 +3882,7 @@ function DiagnosticsPanel({ ctx }) {
3639
3882
  const { runner } = useCanvas();
3640
3883
  const envExtras = useEditorEnvExtras();
3641
3884
  const diagnostics = ctx.diagnostics;
3642
- return /* @__PURE__ */ jsx23("ul", { className: "lace-diagnostics-panel", role: "list", children: diagnostics.map((d, index) => {
3885
+ return /* @__PURE__ */ jsx24("ul", { className: "lace-diagnostics-panel", role: "list", children: diagnostics.map((d, index) => {
3643
3886
  const key = rowKey(d, index);
3644
3887
  const target = { diagnostic: d };
3645
3888
  const actions = rowActionsFor(ctx, "diagnostics", target);
@@ -3648,27 +3891,27 @@ function DiagnosticsPanel({ ctx }) {
3648
3891
  {
3649
3892
  className: `lace-diagnostics-panel__row lace-diagnostics-panel__row--${d.severity}`,
3650
3893
  children: [
3651
- /* @__PURE__ */ jsx23("span", { className: "lace-diagnostics-panel__icon", children: /* @__PURE__ */ jsx23(CanvasIcon, { name: d.severity }) }),
3894
+ /* @__PURE__ */ jsx24("span", { className: "lace-diagnostics-panel__icon", children: /* @__PURE__ */ jsx24(CanvasIcon, { name: d.severity }) }),
3652
3895
  /* @__PURE__ */ jsxs13("span", { className: "lace-diagnostics-panel__body", children: [
3653
- /* @__PURE__ */ jsx23("span", { className: "lace-diagnostics-panel__message", children: d.message }),
3654
- d.file !== void 0 && /* @__PURE__ */ jsx23(
3896
+ /* @__PURE__ */ jsx24("span", { className: "lace-diagnostics-panel__message", children: d.message }),
3897
+ d.file !== void 0 && /* @__PURE__ */ jsx24(
3655
3898
  Identifier,
3656
3899
  {
3657
3900
  className: "lace-diagnostics-panel__file",
3658
3901
  text: locationOf(d.file, d.line)
3659
3902
  }
3660
3903
  ),
3661
- d.instance_id !== void 0 && /* @__PURE__ */ jsx23(
3904
+ d.instance_id !== void 0 && /* @__PURE__ */ jsx24(
3662
3905
  Identifier,
3663
3906
  {
3664
3907
  className: "lace-diagnostics-panel__where",
3665
3908
  text: d.input_name ? `${d.instance_id}.${d.input_name}` : d.instance_id
3666
3909
  }
3667
3910
  ),
3668
- d.code !== void 0 && /* @__PURE__ */ jsx23(Identifier, { className: "lace-diagnostics-panel__code", text: d.code }),
3911
+ d.code !== void 0 && /* @__PURE__ */ jsx24(Identifier, { className: "lace-diagnostics-panel__code", text: d.code }),
3669
3912
  actions.map((action) => {
3670
3913
  const state = actionState(action, ctx, runner.busy(action, ctx, target));
3671
- return /* @__PURE__ */ jsx23(
3914
+ return /* @__PURE__ */ jsx24(
3672
3915
  Button3,
3673
3916
  {
3674
3917
  rung: true,
@@ -3708,35 +3951,47 @@ import { instanceAddress as instanceAddress5 } from "@lace-cloud/proto";
3708
3951
  import { createElement } from "react";
3709
3952
 
3710
3953
  // src/components/panels/EdgeInspectorPanel.tsx
3711
- import { callText } from "@lace-cloud/proto";
3712
3954
  import { Button as Button4, Panel } from "@lace-cloud/ui";
3713
3955
  import "./EdgeInspectorPanel-JD6CVUAT.css";
3714
- import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
3956
+ import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
3957
+ var pinText = (node, pin, end) => `${node}.${end === "source" ? "outputs" : "inputs"}.${pin}`;
3715
3958
  function EdgeInspectorPanel({
3716
3959
  source,
3717
3960
  target,
3718
3961
  sourceOutput,
3719
3962
  targetInput,
3963
+ sourcePin,
3964
+ targetPin,
3720
3965
  onDelete,
3721
3966
  onClose
3722
3967
  }) {
3723
3968
  const title = /* @__PURE__ */ jsxs14("div", { children: [
3724
- /* @__PURE__ */ jsx24("div", { className: "lace-edge-panel__title-eyebrow", children: "Connection" }),
3969
+ /* @__PURE__ */ jsx25("div", { className: "lace-edge-panel__title-eyebrow", children: "Connection" }),
3725
3970
  /* @__PURE__ */ jsxs14("div", { className: "lace-edge-panel__title", children: [
3726
- /* @__PURE__ */ jsx24(Identifier, { text: source }),
3971
+ /* @__PURE__ */ jsx25(Identifier, { text: source }),
3727
3972
  " \u2192 ",
3728
- /* @__PURE__ */ jsx24(Identifier, { text: target })
3973
+ /* @__PURE__ */ jsx25(Identifier, { text: target })
3729
3974
  ] })
3730
3975
  ] });
3731
- const footer = onDelete ? /* @__PURE__ */ jsx24(Button4, { rung: true, variant: "danger", fullWidth: true, onClick: onDelete, children: "Delete connection" }) : void 0;
3976
+ const wire = {
3977
+ source,
3978
+ target,
3979
+ source_output: sourceOutput,
3980
+ target_input: targetInput,
3981
+ source_pin: sourcePin,
3982
+ target_pin: targetPin
3983
+ };
3984
+ const sourceText = wireEndText(wire, "source", pinText);
3985
+ const targetText = wireEndText(wire, "target", pinText);
3986
+ const footer = onDelete ? /* @__PURE__ */ jsx25(Button4, { rung: true, variant: "danger", fullWidth: true, onClick: onDelete, children: "Delete connection" }) : void 0;
3732
3987
  return /* @__PURE__ */ jsxs14(Panel, { title, footer, onClose, children: [
3733
- /* @__PURE__ */ jsx24("div", { className: "lace-edge-panel__section-label", children: "Wiring" }),
3988
+ /* @__PURE__ */ jsx25("div", { className: "lace-edge-panel__section-label", children: "Wiring" }),
3734
3989
  /* @__PURE__ */ jsxs14("div", { className: "lace-edge-panel__wiring", children: [
3735
- /* @__PURE__ */ jsx24(Identifier, { text: sourceOutput ? `${source}.outputs.${sourceOutput}` : callText(source) }),
3736
- /* @__PURE__ */ jsx24("div", { className: "lace-edge-panel__wiring-arrow", children: "\u2193" }),
3737
- /* @__PURE__ */ jsx24(Identifier, { text: `${target}.inputs.${targetInput}` })
3990
+ /* @__PURE__ */ jsx25(Identifier, { text: sourceText }),
3991
+ /* @__PURE__ */ jsx25("div", { className: "lace-edge-panel__wiring-arrow", children: "\u2193" }),
3992
+ /* @__PURE__ */ jsx25(Identifier, { text: targetText })
3738
3993
  ] }),
3739
- onDelete && /* @__PURE__ */ jsx24("div", { className: "lace-edge-panel__hint", children: "Delete or press Backspace with the edge selected to remove this connection. Create new edges by dragging between the pins on each node's edge." })
3994
+ onDelete && /* @__PURE__ */ jsx25("div", { className: "lace-edge-panel__hint", children: "Delete or press Backspace with the edge selected to remove this connection. Create new edges by dragging between the pins on each node's edge." })
3740
3995
  ] });
3741
3996
  }
3742
3997
 
@@ -3748,7 +4003,7 @@ var disconnectBinding = {
3748
4003
  const selected = new Set(env.ctx.selection.edges);
3749
4004
  const actions = /* @__PURE__ */ new Map();
3750
4005
  for (const edge of env.ctx.view.edges) {
3751
- if (!selected.has(edge.id)) continue;
4006
+ if (!selected.has(edge.id) || !isDisconnectable(edge)) continue;
3752
4007
  const { scope, id } = instanceAddress5(env.bundle, edge.target);
3753
4008
  actions.set(JSON.stringify([scope, id, edge.target_input]), {
3754
4009
  disconnect: { scope, target: id, input_name: edge.target_input }
@@ -3764,7 +4019,8 @@ var disconnectEdge = {
3764
4019
  placement: { row: "edge-inspector" },
3765
4020
  keys: ["Delete", "Backspace"],
3766
4021
  requiredPorts: ["editor"],
3767
- requiredContext: ["editable", "selection.edges"],
4022
+ // `selection.disconnectable`: a wire into a group's output pin feeds no input to disconnect.
4023
+ requiredContext: ["editable", "selection.edges", "selection.disconnectable"],
3768
4024
  binding: disconnectBinding
3769
4025
  };
3770
4026
  function EdgeInspectorPanel2({ ctx }) {
@@ -3779,6 +4035,8 @@ function EdgeInspectorPanel2({ ctx }) {
3779
4035
  target: edge.target,
3780
4036
  sourceOutput: edge.source_output,
3781
4037
  targetInput: edge.target_input,
4038
+ sourcePin: edge.source_pin,
4039
+ targetPin: edge.target_pin,
3782
4040
  // The delete button exists exactly when `disconnect` resolved.
3783
4041
  ...disconnect ? {
3784
4042
  onDelete: () => {
@@ -3799,9 +4057,9 @@ var edgeInspectorPanel = {
3799
4057
 
3800
4058
  // src/core/panels/Markers.tsx
3801
4059
  import { Badge } from "@lace-cloud/ui";
3802
- import { jsx as jsx25 } from "react/jsx-runtime";
4060
+ import { jsx as jsx26 } from "react/jsx-runtime";
3803
4061
  function UnsavedMarker() {
3804
- return /* @__PURE__ */ jsx25(Badge, { variant: "warning", dot: true, role: "status", className: "lace-marker lace-marker--unsaved", children: "Unsaved" });
4062
+ return /* @__PURE__ */ jsx26(Badge, { variant: "warning", dot: true, role: "status", className: "lace-marker lace-marker--unsaved", children: "Unsaved" });
3805
4063
  }
3806
4064
  var unsavedMarker = {
3807
4065
  id: "unsaved-marker",
@@ -3813,7 +4071,7 @@ var unsavedMarker = {
3813
4071
  Component: UnsavedMarker
3814
4072
  };
3815
4073
  function UngeneratedMarker() {
3816
- return /* @__PURE__ */ jsx25(Badge, { variant: "neutral", role: "status", className: "lace-marker lace-marker--ungenerated", children: "Not generated" });
4074
+ return /* @__PURE__ */ jsx26(Badge, { variant: "neutral", role: "status", className: "lace-marker lace-marker--ungenerated", children: "Not generated" });
3817
4075
  }
3818
4076
  var ungeneratedMarker = {
3819
4077
  id: "ungenerated-marker",
@@ -3829,7 +4087,7 @@ var ungeneratedMarker = {
3829
4087
  import { createElement as createElement2 } from "react";
3830
4088
 
3831
4089
  // src/components/panels/ModuleConfigPanel.tsx
3832
- import { deriveNodeConfig, instanceAddress as instanceAddress6 } from "@lace-cloud/proto";
4090
+ import { deriveNodeConfig as deriveNodeConfig2, instanceAddress as instanceAddress6 } from "@lace-cloud/proto";
3833
4091
  import {
3834
4092
  assertNever,
3835
4093
  Button as Button12,
@@ -3842,7 +4100,7 @@ import {
3842
4100
  import { useMemo as useMemo11 } from "react";
3843
4101
 
3844
4102
  // src/hooks/useDraft.ts
3845
- import { useState as useState13 } from "react";
4103
+ import { useSyncExternalStore } from "react";
3846
4104
 
3847
4105
  // src/hooks/useUpdateState.ts
3848
4106
  import { useCallback as useCallback10, useEffect as useEffect11, useRef as useRef11, useState as useState12 } from "react";
@@ -3888,36 +4146,38 @@ function useUpdateState(updateFn) {
3888
4146
  }
3889
4147
 
3890
4148
  // src/hooks/useDraft.ts
3891
- function keeping(drafts, keep) {
3892
- return new Map([...drafts].filter(([key, draft]) => keep(key, draft)));
3893
- }
3894
- function useDraft(seed, send) {
3895
- const [drafts, setDrafts] = useState13(() => /* @__PURE__ */ new Map());
3896
- const unsettled = (key, draft) => key in seed && !deepEqual(draft, seed[key]);
3897
- const live = keeping(drafts, unsettled);
3898
- if (live.size < drafts.size) setDrafts((prev) => keeping(prev, unsettled));
4149
+ function useDraft(kind, params, seed, send) {
4150
+ const { drafts: store, editable } = useCanvas();
4151
+ const held = useSyncExternalStore(store.subscribe, () => store.read(kind, params));
4152
+ const live = editable && held ? keeping(held.drafts, unsettledIn(seed)) : NO_DRAFTS;
3899
4153
  const value = { ...seed, ...Object.fromEntries(live) };
3900
4154
  const { status, handleUpdate } = useUpdateState(async () => {
3901
4155
  const sent2 = value;
3902
- await send(sent2);
3903
- setDrafts((prev) => keeping(prev, (key, draft) => draft !== sent2[key]));
4156
+ try {
4157
+ await send(sent2);
4158
+ store.settleSent(kind, params, sent2);
4159
+ } finally {
4160
+ store.end(kind, params);
4161
+ }
3904
4162
  });
3905
4163
  const dirty = live.size > 0;
3906
4164
  return {
3907
4165
  value,
3908
4166
  dirty,
3909
- set: (key, next) => setDrafts((prev) => new Map(prev).set(key, next)),
3910
- status: status === "updated" && dirty ? "idle" : status,
3911
- update: handleUpdate
4167
+ set: (key, next) => store.set(kind, params, key, next, seed),
4168
+ status: held?.sending ? "updating" : status === "updated" && dirty ? "idle" : status,
4169
+ update: async () => {
4170
+ if (store.begin(kind, params)) await handleUpdate();
4171
+ }
3912
4172
  };
3913
4173
  }
3914
4174
 
3915
4175
  // src/components/AccordionSection.tsx
3916
- import { useState as useState14 } from "react";
4176
+ import { useState as useState13 } from "react";
3917
4177
  import "./AccordionSection-5X2XWUYY.css";
3918
- import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
4178
+ import { jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
3919
4179
  function AccordionSection({ title, defaultOpen = false, badge, children }) {
3920
- const [open, setOpen] = useState14(defaultOpen);
4180
+ const [open, setOpen] = useState13(defaultOpen);
3921
4181
  return /* @__PURE__ */ jsxs15("div", { className: `lace-accordion${open ? " lace-accordion--open" : ""}`, children: [
3922
4182
  /* @__PURE__ */ jsxs15(
3923
4183
  "button",
@@ -3927,13 +4187,13 @@ function AccordionSection({ title, defaultOpen = false, badge, children }) {
3927
4187
  onClick: () => setOpen((v) => !v),
3928
4188
  "aria-expanded": open,
3929
4189
  children: [
3930
- /* @__PURE__ */ jsx26("span", { className: "lace-accordion__chevron", children: /* @__PURE__ */ jsx26(CanvasIcon, { name: "chevron-right" }) }),
3931
- /* @__PURE__ */ jsx26("span", { className: "lace-accordion__title", children: title }),
3932
- badge && /* @__PURE__ */ jsx26("span", { className: "lace-accordion__badge", children: badge })
4190
+ /* @__PURE__ */ jsx27("span", { className: "lace-accordion__chevron", children: /* @__PURE__ */ jsx27(CanvasIcon, { name: "chevron-right" }) }),
4191
+ /* @__PURE__ */ jsx27("span", { className: "lace-accordion__title", children: title }),
4192
+ badge && /* @__PURE__ */ jsx27("span", { className: "lace-accordion__badge", children: badge })
3933
4193
  ]
3934
4194
  }
3935
4195
  ),
3936
- /* @__PURE__ */ jsx26("div", { className: "lace-accordion__body", children: /* @__PURE__ */ jsx26("div", { className: "lace-accordion__body-inner", children: /* @__PURE__ */ jsx26("div", { className: "lace-accordion__body-content", children }) }) })
4196
+ /* @__PURE__ */ jsx27("div", { className: "lace-accordion__body", children: /* @__PURE__ */ jsx27("div", { className: "lace-accordion__body-inner", children: /* @__PURE__ */ jsx27("div", { className: "lace-accordion__body-content", children }) }) })
3937
4197
  ] });
3938
4198
  }
3939
4199
 
@@ -3944,7 +4204,7 @@ import "./panels-shared-3HUQC7TC.css";
3944
4204
  // src/components/UpdateButton.tsx
3945
4205
  import { Button as Button5 } from "@lace-cloud/ui";
3946
4206
  import "./UpdateButton-VSIHLAZC.css";
3947
- import { jsx as jsx27 } from "react/jsx-runtime";
4207
+ import { jsx as jsx28 } from "react/jsx-runtime";
3948
4208
  var variantByStatus = {
3949
4209
  updating: "primary",
3950
4210
  updated: "success",
@@ -3960,7 +4220,7 @@ function variantOf({ status, dirty }, blocked) {
3960
4220
  return dirty && blocked === void 0 ? "primary" : "secondary";
3961
4221
  }
3962
4222
  function UpdateButton({ draft, label, blocked }) {
3963
- return /* @__PURE__ */ jsx27("div", { className: "lace-commit-foot", children: /* @__PURE__ */ jsx27(
4223
+ return /* @__PURE__ */ jsx28("div", { className: "lace-commit-foot", children: /* @__PURE__ */ jsx28(
3964
4224
  Button5,
3965
4225
  {
3966
4226
  rung: true,
@@ -3976,15 +4236,15 @@ function UpdateButton({ draft, label, blocked }) {
3976
4236
  }
3977
4237
 
3978
4238
  // src/components/panels/ModuleDetails.tsx
3979
- import { deriveSettingsConfig } from "@lace-cloud/proto";
4239
+ import { deriveSettingsConfig as deriveSettingsConfig2 } from "@lace-cloud/proto";
3980
4240
  import { Input as Input7 } from "@lace-cloud/ui";
3981
4241
  import { useMemo as useMemo10 } from "react";
3982
4242
 
3983
4243
  // src/components/panels/BlockEditor.tsx
3984
4244
  import { Button as Button6, IconButton as IconButton3, Input } from "@lace-cloud/ui";
3985
- import { useState as useState15 } from "react";
4245
+ import { useState as useState14 } from "react";
3986
4246
  import "./panels-shared-3HUQC7TC.css";
3987
- import { Fragment as Fragment7, jsx as jsx28, jsxs as jsxs16 } from "react/jsx-runtime";
4247
+ import { Fragment as Fragment7, jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
3988
4248
  function replaceAt(list, index, item) {
3989
4249
  return list.map((x, i) => i === index ? item : x);
3990
4250
  }
@@ -3993,7 +4253,7 @@ function blockTitle(block) {
3993
4253
  }
3994
4254
  function BlockEditor({ blocks, onChange, editable, templates }) {
3995
4255
  return /* @__PURE__ */ jsxs16(Fragment7, { children: [
3996
- blocks.map((block, i) => /* @__PURE__ */ jsx28(
4256
+ blocks.map((block, i) => /* @__PURE__ */ jsx29(
3997
4257
  BlockCard,
3998
4258
  {
3999
4259
  block,
@@ -4003,7 +4263,7 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
4003
4263
  },
4004
4264
  i
4005
4265
  )),
4006
- editable && (templates ? /* @__PURE__ */ jsx28("div", { className: "lace-panel-row-actions", children: templates.map((t) => /* @__PURE__ */ jsxs16(
4266
+ editable && (templates ? /* @__PURE__ */ jsx29("div", { className: "lace-panel-row-actions", children: templates.map((t) => /* @__PURE__ */ jsxs16(
4007
4267
  Button6,
4008
4268
  {
4009
4269
  variant: "secondary",
@@ -4024,7 +4284,7 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
4024
4284
  ]
4025
4285
  },
4026
4286
  t.type
4027
- )) }) : /* @__PURE__ */ jsx28(
4287
+ )) }) : /* @__PURE__ */ jsx29(
4028
4288
  NewBlockRow,
4029
4289
  {
4030
4290
  onAdd: (type, label) => onChange([
@@ -4036,10 +4296,10 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
4036
4296
  ] });
4037
4297
  }
4038
4298
  function NewBlockRow({ onAdd }) {
4039
- const [type, setType] = useState15("");
4040
- const [label, setLabel] = useState15("");
4299
+ const [type, setType] = useState14("");
4300
+ const [label, setLabel] = useState14("");
4041
4301
  return /* @__PURE__ */ jsxs16("div", { className: "lace-panel-row-actions", children: [
4042
- /* @__PURE__ */ jsx28(
4302
+ /* @__PURE__ */ jsx29(
4043
4303
  Input,
4044
4304
  {
4045
4305
  value: type,
@@ -4049,7 +4309,7 @@ function NewBlockRow({ onAdd }) {
4049
4309
  mono: true
4050
4310
  }
4051
4311
  ),
4052
- /* @__PURE__ */ jsx28(
4312
+ /* @__PURE__ */ jsx29(
4053
4313
  Input,
4054
4314
  {
4055
4315
  value: label,
@@ -4059,7 +4319,7 @@ function NewBlockRow({ onAdd }) {
4059
4319
  mono: true
4060
4320
  }
4061
4321
  ),
4062
- /* @__PURE__ */ jsx28(
4322
+ /* @__PURE__ */ jsx29(
4063
4323
  Button6,
4064
4324
  {
4065
4325
  variant: "secondary",
@@ -4085,11 +4345,11 @@ function BlockCard({ block, editable, onChange, onRemove }) {
4085
4345
  });
4086
4346
  return /* @__PURE__ */ jsxs16("div", { className: "lace-panel-validation-block", children: [
4087
4347
  /* @__PURE__ */ jsxs16("div", { className: "lace-panel-row-actions", children: [
4088
- /* @__PURE__ */ jsx28(Identifier, { className: "lace-panel-row-card__name", text: blockTitle(block) }),
4089
- editable && /* @__PURE__ */ jsx28(
4348
+ /* @__PURE__ */ jsx29(Identifier, { className: "lace-panel-row-card__name", text: blockTitle(block) }),
4349
+ editable && /* @__PURE__ */ jsx29(
4090
4350
  IconButton3,
4091
4351
  {
4092
- icon: /* @__PURE__ */ jsx28(CanvasIcon, { name: "close" }),
4352
+ icon: /* @__PURE__ */ jsx29(CanvasIcon, { name: "close" }),
4093
4353
  "aria-label": `Remove the ${block.type} block`,
4094
4354
  size: "md",
4095
4355
  tooltipPlacement: "bottom-end",
@@ -4100,7 +4360,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
4100
4360
  block.attributes.map((attribute, i) => (
4101
4361
  // biome-ignore lint/suspicious/noArrayIndexKey: attributes are positional; the render keeps their order
4102
4362
  /* @__PURE__ */ jsxs16("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4103
- /* @__PURE__ */ jsx28(
4363
+ /* @__PURE__ */ jsx29(
4104
4364
  Input,
4105
4365
  {
4106
4366
  value: attribute.name,
@@ -4111,7 +4371,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
4111
4371
  readOnly: !editable
4112
4372
  }
4113
4373
  ),
4114
- /* @__PURE__ */ jsx28(
4374
+ /* @__PURE__ */ jsx29(
4115
4375
  Input,
4116
4376
  {
4117
4377
  value: attribute.value,
@@ -4122,10 +4382,10 @@ function BlockCard({ block, editable, onChange, onRemove }) {
4122
4382
  readOnly: !editable
4123
4383
  }
4124
4384
  ),
4125
- editable && /* @__PURE__ */ jsx28(
4385
+ editable && /* @__PURE__ */ jsx29(
4126
4386
  IconButton3,
4127
4387
  {
4128
- icon: /* @__PURE__ */ jsx28(CanvasIcon, { name: "close" }),
4388
+ icon: /* @__PURE__ */ jsx29(CanvasIcon, { name: "close" }),
4129
4389
  "aria-label": `Remove ${attribute.name || "the argument"}`,
4130
4390
  size: "md",
4131
4391
  tooltipPlacement: "bottom-end",
@@ -4134,7 +4394,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
4134
4394
  )
4135
4395
  ] }, i)
4136
4396
  )),
4137
- editable && /* @__PURE__ */ jsx28(
4397
+ editable && /* @__PURE__ */ jsx29(
4138
4398
  Button6,
4139
4399
  {
4140
4400
  variant: "secondary",
@@ -4143,7 +4403,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
4143
4403
  children: "+ Add argument"
4144
4404
  }
4145
4405
  ),
4146
- (block.blocks.length > 0 || editable) && /* @__PURE__ */ jsx28(
4406
+ (block.blocks.length > 0 || editable) && /* @__PURE__ */ jsx29(
4147
4407
  BlockEditor,
4148
4408
  {
4149
4409
  blocks: block.blocks,
@@ -4179,16 +4439,18 @@ function firstDuplicate(items, keyFn) {
4179
4439
 
4180
4440
  // src/components/panels/LocalsPanel.tsx
4181
4441
  import "./panels-shared-3HUQC7TC.css";
4182
- import { Fragment as Fragment8, jsx as jsx29, jsxs as jsxs17 } from "react/jsx-runtime";
4442
+ import { Fragment as Fragment8, jsx as jsx30, jsxs as jsxs17 } from "react/jsx-runtime";
4183
4443
  function toRows(locals) {
4184
4444
  return (locals ?? []).map((l) => ({ id: l.name, ...l }));
4185
4445
  }
4186
4446
  function fromRows(rows) {
4187
4447
  return rows.filter((r) => r.name.trim()).map((r) => ({ name: r.name.trim(), value: r.value }));
4188
4448
  }
4189
- function LocalsContent({ locals, onSave }) {
4449
+ var localsSeed = (locals) => ({ rows: toRows(locals) });
4450
+ var localsDraft = sectionKind("locals", (settings) => localsSeed(settings.locals));
4451
+ function LocalsContent({ moduleKey, locals, onSave }) {
4190
4452
  const { editable } = useCanvas();
4191
- const draft = useDraft({ rows: toRows(locals) }, async ({ rows: rows2 }) => {
4453
+ const draft = useDraft(localsDraft, [moduleKey], localsSeed(locals), async ({ rows: rows2 }) => {
4192
4454
  await onSave(fromRows(rows2));
4193
4455
  });
4194
4456
  const { rows } = draft.value;
@@ -4199,7 +4461,7 @@ function LocalsContent({ locals, onSave }) {
4199
4461
  return /* @__PURE__ */ jsxs17(Fragment8, { children: [
4200
4462
  rows.map((row, i) => /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
4201
4463
  /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4202
- /* @__PURE__ */ jsx29(
4464
+ /* @__PURE__ */ jsx30(
4203
4465
  Input2,
4204
4466
  {
4205
4467
  value: row.name,
@@ -4212,10 +4474,10 @@ function LocalsContent({ locals, onSave }) {
4212
4474
  readOnly: !editable
4213
4475
  }
4214
4476
  ),
4215
- editable && /* @__PURE__ */ jsx29(
4477
+ editable && /* @__PURE__ */ jsx30(
4216
4478
  IconButton4,
4217
4479
  {
4218
- icon: /* @__PURE__ */ jsx29(CanvasIcon, { name: "close" }),
4480
+ icon: /* @__PURE__ */ jsx30(CanvasIcon, { name: "close" }),
4219
4481
  "aria-label": "Remove local",
4220
4482
  size: "md",
4221
4483
  tooltipPlacement: "bottom-end",
@@ -4223,8 +4485,8 @@ function LocalsContent({ locals, onSave }) {
4223
4485
  }
4224
4486
  )
4225
4487
  ] }),
4226
- nameDupes.has(i) && /* @__PURE__ */ jsx29("div", { className: "lace-panel-row-error", children: "Duplicate local name" }),
4227
- /* @__PURE__ */ jsx29("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx29(
4488
+ nameDupes.has(i) && /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-error", children: "Duplicate local name" }),
4489
+ /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx30(
4228
4490
  Textarea,
4229
4491
  {
4230
4492
  value: row.value,
@@ -4239,7 +4501,7 @@ function LocalsContent({ locals, onSave }) {
4239
4501
  ) })
4240
4502
  ] }, row.id)),
4241
4503
  editable && /* @__PURE__ */ jsxs17(Fragment8, { children: [
4242
- /* @__PURE__ */ jsx29(
4504
+ /* @__PURE__ */ jsx30(
4243
4505
  Button7,
4244
4506
  {
4245
4507
  variant: "secondary",
@@ -4248,7 +4510,7 @@ function LocalsContent({ locals, onSave }) {
4248
4510
  children: "+ Add local"
4249
4511
  }
4250
4512
  ),
4251
- /* @__PURE__ */ jsx29(
4513
+ /* @__PURE__ */ jsx30(
4252
4514
  UpdateButton,
4253
4515
  {
4254
4516
  draft,
@@ -4260,13 +4522,13 @@ function LocalsContent({ locals, onSave }) {
4260
4522
  ] });
4261
4523
  }
4262
4524
  function LocalsPanel({ onClose, ...content }) {
4263
- return /* @__PURE__ */ jsx29(Panel2, { title: "Locals", onClose, children: /* @__PURE__ */ jsx29(LocalsContent, { ...content }) });
4525
+ return /* @__PURE__ */ jsx30(Panel2, { title: "Locals", onClose, children: /* @__PURE__ */ jsx30(LocalsContent, { ...content }) });
4264
4526
  }
4265
4527
 
4266
4528
  // src/components/panels/ModuleInterfacePanel.tsx
4267
4529
  import { Button as Button8, IconButton as IconButton5, Input as Input3, Panel as Panel3, Select, Textarea as Textarea2 } from "@lace-cloud/ui";
4268
4530
  import "./panels-shared-3HUQC7TC.css";
4269
- import { Fragment as Fragment9, jsx as jsx30, jsxs as jsxs18 } from "react/jsx-runtime";
4531
+ import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs18 } from "react/jsx-runtime";
4270
4532
  function variablesToRows(variables) {
4271
4533
  return variables.map((v) => ({
4272
4534
  id: v.name,
@@ -4341,14 +4603,16 @@ function interfaceBlocker(variables, outputs) {
4341
4603
  function outputName(text) {
4342
4604
  return text.slice(text.lastIndexOf(".") + 1);
4343
4605
  }
4344
- function ModuleInterfaceContent({ settings, onSave }) {
4606
+ var interfaceSeed = (settings) => ({
4607
+ variables: variablesToRows(settings.variables),
4608
+ outputs: outputsToRows(settings.outputs)
4609
+ });
4610
+ var interfaceDraft = sectionKind("interface", interfaceSeed);
4611
+ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4345
4612
  const { editable } = useCanvas();
4346
- const draft = useDraft(
4347
- { variables: variablesToRows(settings.variables), outputs: outputsToRows(settings.outputs) },
4348
- async (value) => {
4349
- await onSave(variableDefs(value.variables), outputDefs(value.outputs));
4350
- }
4351
- );
4613
+ const draft = useDraft(interfaceDraft, [moduleKey], interfaceSeed(settings), async (value) => {
4614
+ await onSave(variableDefs(value.variables), outputDefs(value.outputs));
4615
+ });
4352
4616
  const { variables, outputs } = draft.value;
4353
4617
  const setVariables2 = (next) => draft.set("variables", next);
4354
4618
  const setOutputs2 = (next) => draft.set("outputs", next);
@@ -4399,12 +4663,12 @@ function ModuleInterfaceContent({ settings, onSave }) {
4399
4663
  const outputDupes = findDuplicateIndices(outputs, (o) => o.name);
4400
4664
  const exposable = settings.call_outputs.filter((text) => !outputs.some((o) => o.value === text));
4401
4665
  return /* @__PURE__ */ jsxs18(Fragment9, { children: [
4402
- /* @__PURE__ */ jsx30("div", { className: "lace-panel-hint", children: "The module's public surface: the variables its callers set and the outputs they read." }),
4403
- /* @__PURE__ */ jsx30("h4", { className: "lace-panel-section-title", children: "Inputs" }),
4404
- variables.length === 0 && /* @__PURE__ */ jsx30("div", { className: "lace-panel-hint", children: "No variables." }),
4666
+ /* @__PURE__ */ jsx31("div", { className: "lace-panel-hint", children: "The module's public surface: the variables its callers set and the outputs they read." }),
4667
+ /* @__PURE__ */ jsx31("h4", { className: "lace-panel-section-title", children: "Inputs" }),
4668
+ variables.length === 0 && /* @__PURE__ */ jsx31("div", { className: "lace-panel-hint", children: "No variables." }),
4405
4669
  variables.map((v, i) => /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
4406
4670
  /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4407
- v.added ? /* @__PURE__ */ jsx30(
4671
+ v.added ? /* @__PURE__ */ jsx31(
4408
4672
  Input3,
4409
4673
  {
4410
4674
  label: "Name",
@@ -4415,11 +4679,11 @@ function ModuleInterfaceContent({ settings, onSave }) {
4415
4679
  mono: true,
4416
4680
  error: variableDupes.has(i)
4417
4681
  }
4418
- ) : /* @__PURE__ */ jsx30(Identifier, { className: "lace-panel-row-card__name", text: v.name }),
4419
- editable && /* @__PURE__ */ jsx30(
4682
+ ) : /* @__PURE__ */ jsx31(Identifier, { className: "lace-panel-row-card__name", text: v.name }),
4683
+ editable && /* @__PURE__ */ jsx31(
4420
4684
  IconButton5,
4421
4685
  {
4422
- icon: /* @__PURE__ */ jsx30(CanvasIcon, { name: "close" }),
4686
+ icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
4423
4687
  "aria-label": `Remove variable ${v.name}`,
4424
4688
  size: "md",
4425
4689
  tooltipPlacement: "bottom-end",
@@ -4427,8 +4691,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
4427
4691
  }
4428
4692
  )
4429
4693
  ] }),
4430
- variableDupes.has(i) && /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-error", children: "Duplicate variable name" }),
4431
- /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx30(
4694
+ variableDupes.has(i) && /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-error", children: "Duplicate variable name" }),
4695
+ /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx31(
4432
4696
  Input3,
4433
4697
  {
4434
4698
  label: "Type",
@@ -4440,8 +4704,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
4440
4704
  readOnly: !editable
4441
4705
  }
4442
4706
  ) }),
4443
- v.defaultText && /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx30(Input3, { label: "Default", value: v.defaultText, fullWidth: true, mono: true, readOnly: true }) }),
4444
- /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx30(
4707
+ v.defaultText && /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx31(Input3, { label: "Default", value: v.defaultText, fullWidth: true, mono: true, readOnly: true }) }),
4708
+ /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx31(
4445
4709
  Textarea2,
4446
4710
  {
4447
4711
  label: "Description",
@@ -4455,7 +4719,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
4455
4719
  ) }),
4456
4720
  /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions", children: [
4457
4721
  /* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
4458
- /* @__PURE__ */ jsx30(
4722
+ /* @__PURE__ */ jsx31(
4459
4723
  "input",
4460
4724
  {
4461
4725
  type: "checkbox",
@@ -4464,10 +4728,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
4464
4728
  disabled: !editable
4465
4729
  }
4466
4730
  ),
4467
- /* @__PURE__ */ jsx30("span", { children: "Required" })
4731
+ /* @__PURE__ */ jsx31("span", { children: "Required" })
4468
4732
  ] }),
4469
4733
  /* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
4470
- /* @__PURE__ */ jsx30(
4734
+ /* @__PURE__ */ jsx31(
4471
4735
  "input",
4472
4736
  {
4473
4737
  type: "checkbox",
@@ -4476,10 +4740,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
4476
4740
  disabled: !editable
4477
4741
  }
4478
4742
  ),
4479
- /* @__PURE__ */ jsx30("span", { children: "Ephemeral" })
4743
+ /* @__PURE__ */ jsx31("span", { children: "Ephemeral" })
4480
4744
  ] }),
4481
4745
  /* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
4482
- /* @__PURE__ */ jsx30(
4746
+ /* @__PURE__ */ jsx31(
4483
4747
  "input",
4484
4748
  {
4485
4749
  type: "checkbox",
@@ -4488,10 +4752,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
4488
4752
  disabled: !editable
4489
4753
  }
4490
4754
  ),
4491
- /* @__PURE__ */ jsx30("span", { children: "Sensitive" })
4755
+ /* @__PURE__ */ jsx31("span", { children: "Sensitive" })
4492
4756
  ] }),
4493
4757
  /* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
4494
- /* @__PURE__ */ jsx30(
4758
+ /* @__PURE__ */ jsx31(
4495
4759
  "input",
4496
4760
  {
4497
4761
  type: "checkbox",
@@ -4500,13 +4764,13 @@ function ModuleInterfaceContent({ settings, onSave }) {
4500
4764
  disabled: !editable
4501
4765
  }
4502
4766
  ),
4503
- /* @__PURE__ */ jsx30("span", { children: "Nullable" })
4767
+ /* @__PURE__ */ jsx31("span", { children: "Nullable" })
4504
4768
  ] })
4505
4769
  ] }),
4506
4770
  (v.validation.length > 0 || editable) && /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-content", children: [
4507
- /* @__PURE__ */ jsx30("div", { className: "lace-panel-subsection-label", children: "Validation" }),
4771
+ /* @__PURE__ */ jsx31("div", { className: "lace-panel-subsection-label", children: "Validation" }),
4508
4772
  v.validation.map((block, j) => /* @__PURE__ */ jsxs18("div", { className: "lace-panel-validation-block", children: [
4509
- /* @__PURE__ */ jsx30(
4773
+ /* @__PURE__ */ jsx31(
4510
4774
  Input3,
4511
4775
  {
4512
4776
  value: block.condition,
@@ -4518,7 +4782,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
4518
4782
  readOnly: !editable
4519
4783
  }
4520
4784
  ),
4521
- /* @__PURE__ */ jsx30(
4785
+ /* @__PURE__ */ jsx31(
4522
4786
  Input3,
4523
4787
  {
4524
4788
  value: block.error_message,
@@ -4529,10 +4793,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
4529
4793
  readOnly: !editable
4530
4794
  }
4531
4795
  ),
4532
- editable && /* @__PURE__ */ jsx30(
4796
+ editable && /* @__PURE__ */ jsx31(
4533
4797
  IconButton5,
4534
4798
  {
4535
- icon: /* @__PURE__ */ jsx30(CanvasIcon, { name: "close" }),
4799
+ icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
4536
4800
  "aria-label": "Remove validation rule",
4537
4801
  size: "md",
4538
4802
  tooltipPlacement: "bottom-end",
@@ -4540,15 +4804,15 @@ function ModuleInterfaceContent({ settings, onSave }) {
4540
4804
  }
4541
4805
  )
4542
4806
  ] }, block.id)),
4543
- editable && /* @__PURE__ */ jsx30(Button8, { variant: "secondary", size: "sm", onClick: () => addValidation(i), children: "+ Add validation rule" })
4807
+ editable && /* @__PURE__ */ jsx31(Button8, { variant: "secondary", size: "sm", onClick: () => addValidation(i), children: "+ Add validation rule" })
4544
4808
  ] })
4545
4809
  ] }, v.id)),
4546
- editable && /* @__PURE__ */ jsx30(Button8, { variant: "secondary", size: "sm", onClick: addVariable, children: "+ Add variable" }),
4547
- /* @__PURE__ */ jsx30("h4", { className: "lace-panel-section-title", children: "Outputs" }),
4548
- outputs.length === 0 && /* @__PURE__ */ jsx30("div", { className: "lace-panel-hint", children: "No outputs." }),
4810
+ editable && /* @__PURE__ */ jsx31(Button8, { variant: "secondary", size: "sm", onClick: addVariable, children: "+ Add variable" }),
4811
+ /* @__PURE__ */ jsx31("h4", { className: "lace-panel-section-title", children: "Outputs" }),
4812
+ outputs.length === 0 && /* @__PURE__ */ jsx31("div", { className: "lace-panel-hint", children: "No outputs." }),
4549
4813
  outputs.map((o, i) => /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
4550
4814
  /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4551
- /* @__PURE__ */ jsx30(
4815
+ /* @__PURE__ */ jsx31(
4552
4816
  Input3,
4553
4817
  {
4554
4818
  label: "Name",
@@ -4561,10 +4825,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
4561
4825
  error: outputDupes.has(i) || editable && !o.name.trim()
4562
4826
  }
4563
4827
  ),
4564
- editable && /* @__PURE__ */ jsx30(
4828
+ editable && /* @__PURE__ */ jsx31(
4565
4829
  IconButton5,
4566
4830
  {
4567
- icon: /* @__PURE__ */ jsx30(CanvasIcon, { name: "close" }),
4831
+ icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
4568
4832
  "aria-label": `Remove output ${o.name}`,
4569
4833
  size: "md",
4570
4834
  tooltipPlacement: "bottom-end",
@@ -4572,7 +4836,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
4572
4836
  }
4573
4837
  )
4574
4838
  ] }),
4575
- /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx30(
4839
+ /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx31(
4576
4840
  Input3,
4577
4841
  {
4578
4842
  label: "Value",
@@ -4585,7 +4849,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
4585
4849
  error: editable && !o.value.trim()
4586
4850
  }
4587
4851
  ) }),
4588
- /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx30(
4852
+ /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx31(
4589
4853
  Textarea2,
4590
4854
  {
4591
4855
  label: "Description",
@@ -4598,7 +4862,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
4598
4862
  }
4599
4863
  ) }),
4600
4864
  /* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
4601
- /* @__PURE__ */ jsx30(
4865
+ /* @__PURE__ */ jsx31(
4602
4866
  "input",
4603
4867
  {
4604
4868
  type: "checkbox",
@@ -4607,12 +4871,12 @@ function ModuleInterfaceContent({ settings, onSave }) {
4607
4871
  disabled: !editable
4608
4872
  }
4609
4873
  ),
4610
- /* @__PURE__ */ jsx30("span", { children: "Sensitive" })
4874
+ /* @__PURE__ */ jsx31("span", { children: "Sensitive" })
4611
4875
  ] }),
4612
4876
  (o.depends_on.length > 0 || editable && settings.dependency_options.length > 0) && /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-content", children: [
4613
- /* @__PURE__ */ jsx30("div", { className: "lace-panel-subsection-label", children: "Depends on" }),
4614
- !editable ? o.depends_on.map((dep) => /* @__PURE__ */ jsx30("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx30(Identifier, { text: dep }) }, dep)) : settings.dependency_options.map((dep) => /* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
4615
- /* @__PURE__ */ jsx30(
4877
+ /* @__PURE__ */ jsx31("div", { className: "lace-panel-subsection-label", children: "Depends on" }),
4878
+ !editable ? o.depends_on.map((dep) => /* @__PURE__ */ jsx31("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx31(Identifier, { text: dep }) }, dep)) : settings.dependency_options.map((dep) => /* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
4879
+ /* @__PURE__ */ jsx31(
4616
4880
  "input",
4617
4881
  {
4618
4882
  type: "checkbox",
@@ -4620,14 +4884,14 @@ function ModuleInterfaceContent({ settings, onSave }) {
4620
4884
  onChange: () => toggleDependsOn(i, dep)
4621
4885
  }
4622
4886
  ),
4623
- /* @__PURE__ */ jsx30(Identifier, { text: dep })
4887
+ /* @__PURE__ */ jsx31(Identifier, { text: dep })
4624
4888
  ] }, dep))
4625
4889
  ] }),
4626
- outputDupes.has(i) && /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-error", children: "Output names must be unique." })
4890
+ outputDupes.has(i) && /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-error", children: "Output names must be unique." })
4627
4891
  ] }, o.id)),
4628
4892
  editable && /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions", children: [
4629
- /* @__PURE__ */ jsx30(Button8, { variant: "secondary", size: "sm", onClick: () => addOutput("", ""), children: "+ Add output" }),
4630
- exposable.length > 0 && /* @__PURE__ */ jsx30(
4893
+ /* @__PURE__ */ jsx31(Button8, { variant: "secondary", size: "sm", onClick: () => addOutput("", ""), children: "+ Add output" }),
4894
+ exposable.length > 0 && /* @__PURE__ */ jsx31(
4631
4895
  Select,
4632
4896
  {
4633
4897
  "aria-label": "Expose a call's output",
@@ -4643,7 +4907,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
4643
4907
  }
4644
4908
  )
4645
4909
  ] }),
4646
- editable && /* @__PURE__ */ jsx30(
4910
+ editable && /* @__PURE__ */ jsx31(
4647
4911
  UpdateButton,
4648
4912
  {
4649
4913
  draft,
@@ -4654,7 +4918,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
4654
4918
  ] });
4655
4919
  }
4656
4920
  function ModuleInterfacePanel({ onClose, ...content }) {
4657
- return /* @__PURE__ */ jsx30(Panel3, { title: "Module Interface", onClose, children: /* @__PURE__ */ jsx30(ModuleInterfaceContent, { ...content }) });
4921
+ return /* @__PURE__ */ jsx31(Panel3, { title: "Module Interface", onClose, children: /* @__PURE__ */ jsx31(ModuleInterfaceContent, { ...content }) });
4658
4922
  }
4659
4923
 
4660
4924
  // src/components/panels/module-actions.ts
@@ -4764,6 +5028,15 @@ function resourceActions(scope, before, after) {
4764
5028
  set_depends_on: { scope, instance_id: before.id, depends_on: after.depends_on }
4765
5029
  });
4766
5030
  }
5031
+ if (before.name !== after.name) {
5032
+ actions.push({
5033
+ rename_instance: {
5034
+ scope,
5035
+ old_id: before.id,
5036
+ new_id: `${before.kind}.${before.type}.${after.name}`
5037
+ }
5038
+ });
5039
+ }
4767
5040
  return actions;
4768
5041
  }
4769
5042
 
@@ -4773,7 +5046,7 @@ import "./panels-shared-3HUQC7TC.css";
4773
5046
  // src/components/panels/ProvidersPanel.tsx
4774
5047
  import { Button as Button9, IconButton as IconButton6, Input as Input4, Panel as Panel4 } from "@lace-cloud/ui";
4775
5048
  import "./panels-shared-3HUQC7TC.css";
4776
- import { Fragment as Fragment10, jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
5049
+ import { Fragment as Fragment10, jsx as jsx32, jsxs as jsxs19 } from "react/jsx-runtime";
4777
5050
  function toRows2(providers) {
4778
5051
  if (!providers || providers.length === 0) return [];
4779
5052
  return providers.map((p) => ({
@@ -4799,11 +5072,21 @@ function fromRows2(rows) {
4799
5072
  return { name: r.name.trim(), alias: r.alias.trim() || "", config, blocks: r.blocks };
4800
5073
  });
4801
5074
  }
4802
- function ProvidersContent({ providers, onSave }) {
5075
+ var providersSeed = (providers) => ({ rows: toRows2(providers) });
5076
+ var providersDraft = sectionKind(
5077
+ "providers",
5078
+ (settings) => providersSeed(settings.providers)
5079
+ );
5080
+ function ProvidersContent({ moduleKey, providers, onSave }) {
4803
5081
  const { editable } = useCanvas();
4804
- const draft = useDraft({ rows: toRows2(providers) }, async ({ rows: rows2 }) => {
4805
- await onSave(fromRows2(rows2));
4806
- });
5082
+ const draft = useDraft(
5083
+ providersDraft,
5084
+ [moduleKey],
5085
+ providersSeed(providers),
5086
+ async ({ rows: rows2 }) => {
5087
+ await onSave(fromRows2(rows2));
5088
+ }
5089
+ );
4807
5090
  const { rows } = draft.value;
4808
5091
  const setRows = (next) => draft.set("rows", next);
4809
5092
  const updateRow = (index, change) => setRows(rows.map((r, i) => i === index ? { ...r, ...change } : r));
@@ -4827,7 +5110,7 @@ function ProvidersContent({ providers, onSave }) {
4827
5110
  return /* @__PURE__ */ jsxs19(Fragment10, { children: [
4828
5111
  rows.map((row, pi) => /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
4829
5112
  /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4830
- /* @__PURE__ */ jsx31(
5113
+ /* @__PURE__ */ jsx32(
4831
5114
  Input4,
4832
5115
  {
4833
5116
  value: row.name,
@@ -4837,7 +5120,7 @@ function ProvidersContent({ providers, onSave }) {
4837
5120
  readOnly: !editable
4838
5121
  }
4839
5122
  ),
4840
- /* @__PURE__ */ jsx31(
5123
+ /* @__PURE__ */ jsx32(
4841
5124
  Input4,
4842
5125
  {
4843
5126
  value: row.alias,
@@ -4847,10 +5130,10 @@ function ProvidersContent({ providers, onSave }) {
4847
5130
  readOnly: !editable
4848
5131
  }
4849
5132
  ),
4850
- editable && /* @__PURE__ */ jsx31(
5133
+ editable && /* @__PURE__ */ jsx32(
4851
5134
  IconButton6,
4852
5135
  {
4853
- icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
5136
+ icon: /* @__PURE__ */ jsx32(CanvasIcon, { name: "close" }),
4854
5137
  "aria-label": "Remove provider",
4855
5138
  size: "md",
4856
5139
  tooltipPlacement: "bottom-end",
@@ -4858,9 +5141,9 @@ function ProvidersContent({ providers, onSave }) {
4858
5141
  }
4859
5142
  )
4860
5143
  ] }),
4861
- /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-sublabel", children: "Config" }),
5144
+ /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-sublabel", children: "Config" }),
4862
5145
  row.configEntries.map((entry, ei) => /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4863
- /* @__PURE__ */ jsx31(
5146
+ /* @__PURE__ */ jsx32(
4864
5147
  Input4,
4865
5148
  {
4866
5149
  value: entry.key,
@@ -4870,7 +5153,7 @@ function ProvidersContent({ providers, onSave }) {
4870
5153
  readOnly: !editable
4871
5154
  }
4872
5155
  ),
4873
- /* @__PURE__ */ jsx31(
5156
+ /* @__PURE__ */ jsx32(
4874
5157
  Input4,
4875
5158
  {
4876
5159
  value: entry.value,
@@ -4880,10 +5163,10 @@ function ProvidersContent({ providers, onSave }) {
4880
5163
  readOnly: !editable
4881
5164
  }
4882
5165
  ),
4883
- editable && /* @__PURE__ */ jsx31(
5166
+ editable && /* @__PURE__ */ jsx32(
4884
5167
  IconButton6,
4885
5168
  {
4886
- icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
5169
+ icon: /* @__PURE__ */ jsx32(CanvasIcon, { name: "close" }),
4887
5170
  "aria-label": "Remove config key",
4888
5171
  size: "md",
4889
5172
  tooltipPlacement: "bottom-end",
@@ -4894,7 +5177,7 @@ function ProvidersContent({ providers, onSave }) {
4894
5177
  }
4895
5178
  )
4896
5179
  ] }, entry.id)),
4897
- editable && /* @__PURE__ */ jsx31(
5180
+ editable && /* @__PURE__ */ jsx32(
4898
5181
  Button9,
4899
5182
  {
4900
5183
  variant: "secondary",
@@ -4907,8 +5190,8 @@ function ProvidersContent({ providers, onSave }) {
4907
5190
  }
4908
5191
  ),
4909
5192
  (row.blocks.length > 0 || editable) && /* @__PURE__ */ jsxs19(Fragment10, { children: [
4910
- /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
4911
- /* @__PURE__ */ jsx31(
5193
+ /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
5194
+ /* @__PURE__ */ jsx32(
4912
5195
  BlockEditor,
4913
5196
  {
4914
5197
  blocks: row.blocks,
@@ -4919,21 +5202,26 @@ function ProvidersContent({ providers, onSave }) {
4919
5202
  ] })
4920
5203
  ] }, row.id)),
4921
5204
  editable && /* @__PURE__ */ jsxs19(Fragment10, { children: [
4922
- /* @__PURE__ */ jsx31(Button9, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
4923
- /* @__PURE__ */ jsx31(UpdateButton, { draft, label: "Update providers" })
5205
+ /* @__PURE__ */ jsx32(Button9, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
5206
+ /* @__PURE__ */ jsx32(UpdateButton, { draft, label: "Update providers" })
4924
5207
  ] })
4925
5208
  ] });
4926
5209
  }
4927
- function ProvidersPanel({ providers, onSave, onClose }) {
4928
- return /* @__PURE__ */ jsx31(Panel4, { title: "Providers", onClose, children: /* @__PURE__ */ jsx31(ProvidersContent, { providers, onSave }) });
5210
+ function ProvidersPanel({ onClose, ...content }) {
5211
+ return /* @__PURE__ */ jsx32(Panel4, { title: "Providers", onClose, children: /* @__PURE__ */ jsx32(ProvidersContent, { ...content }) });
4929
5212
  }
4930
5213
 
4931
5214
  // src/components/panels/ResourcesPanel.tsx
4932
5215
  import { Badge as Badge2, Button as Button10, IconButton as IconButton7, Input as Input5, Select as Select2 } from "@lace-cloud/ui";
4933
- import { useState as useState16 } from "react";
5216
+ import { useState as useState15 } from "react";
4934
5217
  import "./panels-shared-3HUQC7TC.css";
4935
- import { Fragment as Fragment11, jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
5218
+ import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs20 } from "react/jsx-runtime";
5219
+ var resourceDraft = {
5220
+ name: "resource",
5221
+ seed: (derive, [moduleKey, id]) => derive.settings(moduleKey)?.resources.find((r) => r.id === id) ?? null
5222
+ };
4936
5223
  function ResourcesContent({
5224
+ moduleKey,
4937
5225
  resources,
4938
5226
  dependencyOptions,
4939
5227
  managed,
@@ -4943,10 +5231,11 @@ function ResourcesContent({
4943
5231
  }) {
4944
5232
  const { editable } = useCanvas();
4945
5233
  return /* @__PURE__ */ jsxs20(Fragment11, { children: [
4946
- resources.length === 0 && /* @__PURE__ */ jsx32("div", { className: "lace-panel-hint", children: "No resources or data sources." }),
4947
- resources.map((resource) => /* @__PURE__ */ jsx32(
5234
+ resources.length === 0 && /* @__PURE__ */ jsx33("div", { className: "lace-panel-hint", children: "No resources or data sources." }),
5235
+ resources.map((resource) => /* @__PURE__ */ jsx33(
4948
5236
  ResourceCard,
4949
5237
  {
5238
+ moduleKey,
4950
5239
  resource,
4951
5240
  dependencyOptions: dependencyOptions.filter(
4952
5241
  (dep) => dep !== resource.id.replace(/^resource\./, "")
@@ -4957,7 +5246,7 @@ function ResourcesContent({
4957
5246
  },
4958
5247
  resource.id
4959
5248
  )),
4960
- editable && /* @__PURE__ */ jsx32(NewResourceRow, { managed, onAdd })
5249
+ editable && /* @__PURE__ */ jsx33(NewResourceRow, { managed, onAdd })
4961
5250
  ] });
4962
5251
  }
4963
5252
  var MANAGED_OPTION = { value: "resource", label: "Resource" };
@@ -4967,14 +5256,14 @@ function NewResourceRow({
4967
5256
  onAdd
4968
5257
  }) {
4969
5258
  const options = managed ? [MANAGED_OPTION, DATA_OPTION] : [DATA_OPTION];
4970
- const [chosen, setChosen] = useState16("resource");
5259
+ const [chosen, setChosen] = useState15("resource");
4971
5260
  const kind = managed ? chosen : "data";
4972
- const [type, setType] = useState16("");
4973
- const [name, setName] = useState16("");
5261
+ const [type, setType] = useState15("");
5262
+ const [name, setName] = useState15("");
4974
5263
  return /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-card", children: [
4975
- /* @__PURE__ */ jsx32("div", { className: "lace-panel-subsection-label", children: "Add a resource" }),
5264
+ /* @__PURE__ */ jsx33("div", { className: "lace-panel-subsection-label", children: "Add a resource" }),
4976
5265
  /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-actions", children: [
4977
- /* @__PURE__ */ jsx32(
5266
+ /* @__PURE__ */ jsx33(
4978
5267
  Select2,
4979
5268
  {
4980
5269
  "aria-label": "New resource kind",
@@ -4983,7 +5272,7 @@ function NewResourceRow({
4983
5272
  onChange: (e) => setChosen(e.target.value === "data" ? "data" : "resource")
4984
5273
  }
4985
5274
  ),
4986
- /* @__PURE__ */ jsx32(
5275
+ /* @__PURE__ */ jsx33(
4987
5276
  Input5,
4988
5277
  {
4989
5278
  value: type,
@@ -4993,7 +5282,7 @@ function NewResourceRow({
4993
5282
  mono: true
4994
5283
  }
4995
5284
  ),
4996
- /* @__PURE__ */ jsx32(
5285
+ /* @__PURE__ */ jsx33(
4997
5286
  Input5,
4998
5287
  {
4999
5288
  value: name,
@@ -5003,7 +5292,7 @@ function NewResourceRow({
5003
5292
  mono: true
5004
5293
  }
5005
5294
  ),
5006
- /* @__PURE__ */ jsx32(
5295
+ /* @__PURE__ */ jsx33(
5007
5296
  Button10,
5008
5297
  {
5009
5298
  variant: "secondary",
@@ -5025,8 +5314,20 @@ function argumentsBlocker(args) {
5025
5314
  const duplicate = firstDuplicate(args, (a) => a.name);
5026
5315
  return duplicate === void 0 ? void 0 : `Argument "${duplicate}" is set twice`;
5027
5316
  }
5028
- function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemove }) {
5029
- const card = useDraft(resource, (after) => onUpdate(resource, after));
5317
+ function ResourceCard({
5318
+ moduleKey,
5319
+ resource,
5320
+ dependencyOptions,
5321
+ editable,
5322
+ onUpdate,
5323
+ onRemove
5324
+ }) {
5325
+ const card = useDraft(
5326
+ resourceDraft,
5327
+ [moduleKey, resource.id],
5328
+ resource,
5329
+ (after) => onUpdate(resource, after)
5330
+ );
5030
5331
  const draft = card.value;
5031
5332
  const set = card.set;
5032
5333
  const setArgument = (index, field, value) => set(
@@ -5041,18 +5342,18 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
5041
5342
  ];
5042
5343
  return /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
5043
5344
  /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-actions", children: [
5044
- /* @__PURE__ */ jsx32(Badge2, { variant: resource.kind === "data" ? "info" : "neutral", children: resource.kind === "data" ? "data" : "resource" }),
5045
- /* @__PURE__ */ jsx32(
5345
+ /* @__PURE__ */ jsx33(Badge2, { variant: resource.kind === "data" ? "info" : "neutral", children: resource.kind === "data" ? "data" : "resource" }),
5346
+ /* @__PURE__ */ jsx33(
5046
5347
  Identifier,
5047
5348
  {
5048
5349
  className: "lace-panel-row-card__name",
5049
5350
  text: `${resource.type}.${resource.name}`
5050
5351
  }
5051
5352
  ),
5052
- editable && /* @__PURE__ */ jsx32(
5353
+ editable && /* @__PURE__ */ jsx33(
5053
5354
  IconButton7,
5054
5355
  {
5055
- icon: /* @__PURE__ */ jsx32(CanvasIcon, { name: "close" }),
5356
+ icon: /* @__PURE__ */ jsx33(CanvasIcon, { name: "close" }),
5056
5357
  "aria-label": `Remove ${resource.type}.${resource.name}`,
5057
5358
  size: "md",
5058
5359
  tooltipPlacement: "bottom-end",
@@ -5060,8 +5361,19 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
5060
5361
  }
5061
5362
  )
5062
5363
  ] }),
5364
+ editable && /* @__PURE__ */ jsx33("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx33(
5365
+ Input5,
5366
+ {
5367
+ label: "Name",
5368
+ "aria-label": `Name of ${resource.type}.${resource.name}`,
5369
+ value: draft.name,
5370
+ onChange: (e) => set("name", e.target.value),
5371
+ fullWidth: true,
5372
+ mono: true
5373
+ }
5374
+ ) }),
5063
5375
  metaArguments.map(
5064
- ({ field, placeholder }) => draft[field] || editable ? /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx32(
5376
+ ({ field, placeholder }) => draft[field] || editable ? /* @__PURE__ */ jsx33("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx33(
5065
5377
  Input5,
5066
5378
  {
5067
5379
  label: field,
@@ -5074,11 +5386,11 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
5074
5386
  }
5075
5387
  ) }, field) : null
5076
5388
  ),
5077
- /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-sublabel", children: "Arguments" }),
5389
+ /* @__PURE__ */ jsx33("div", { className: "lace-panel-row-sublabel", children: "Arguments" }),
5078
5390
  draft.arguments.map((argument, i) => (
5079
5391
  // biome-ignore lint/suspicious/noArrayIndexKey: argument rows are positional while edited
5080
5392
  /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
5081
- /* @__PURE__ */ jsx32(
5393
+ /* @__PURE__ */ jsx33(
5082
5394
  Input5,
5083
5395
  {
5084
5396
  value: argument.name,
@@ -5090,7 +5402,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
5090
5402
  error: argumentDupes.has(i)
5091
5403
  }
5092
5404
  ),
5093
- /* @__PURE__ */ jsx32(
5405
+ /* @__PURE__ */ jsx33(
5094
5406
  Input5,
5095
5407
  {
5096
5408
  value: argument.value,
@@ -5101,10 +5413,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
5101
5413
  readOnly: !editable
5102
5414
  }
5103
5415
  ),
5104
- editable && /* @__PURE__ */ jsx32(
5416
+ editable && /* @__PURE__ */ jsx33(
5105
5417
  IconButton7,
5106
5418
  {
5107
- icon: /* @__PURE__ */ jsx32(CanvasIcon, { name: "close" }),
5419
+ icon: /* @__PURE__ */ jsx33(CanvasIcon, { name: "close" }),
5108
5420
  "aria-label": `Remove ${argument.name || "the argument"}`,
5109
5421
  size: "md",
5110
5422
  tooltipPlacement: "bottom-end",
@@ -5116,7 +5428,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
5116
5428
  )
5117
5429
  ] }, i)
5118
5430
  )),
5119
- editable && /* @__PURE__ */ jsx32(
5431
+ editable && /* @__PURE__ */ jsx33(
5120
5432
  Button10,
5121
5433
  {
5122
5434
  variant: "secondary",
@@ -5126,8 +5438,8 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
5126
5438
  }
5127
5439
  ),
5128
5440
  (draft.blocks.length > 0 || editable) && /* @__PURE__ */ jsxs20(Fragment11, { children: [
5129
- /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
5130
- /* @__PURE__ */ jsx32(
5441
+ /* @__PURE__ */ jsx33("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
5442
+ /* @__PURE__ */ jsx33(
5131
5443
  BlockEditor,
5132
5444
  {
5133
5445
  blocks: draft.blocks,
@@ -5137,9 +5449,9 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
5137
5449
  )
5138
5450
  ] }),
5139
5451
  (draft.depends_on.length > 0 || editable && dependencyOptions.length > 0) && /* @__PURE__ */ jsxs20(Fragment11, { children: [
5140
- /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-sublabel", children: "Depends on" }),
5141
- !editable ? draft.depends_on.map((dep) => /* @__PURE__ */ jsx32("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx32(Identifier, { text: dep }) }, dep)) : dependencyOptions.map((dep) => /* @__PURE__ */ jsxs20("label", { className: "lace-panel-checkbox-row", children: [
5142
- /* @__PURE__ */ jsx32(
5452
+ /* @__PURE__ */ jsx33("div", { className: "lace-panel-row-sublabel", children: "Depends on" }),
5453
+ !editable ? draft.depends_on.map((dep) => /* @__PURE__ */ jsx33("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx33(Identifier, { text: dep }) }, dep)) : dependencyOptions.map((dep) => /* @__PURE__ */ jsxs20("label", { className: "lace-panel-checkbox-row", children: [
5454
+ /* @__PURE__ */ jsx33(
5143
5455
  "input",
5144
5456
  {
5145
5457
  type: "checkbox",
@@ -5150,15 +5462,15 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
5150
5462
  )
5151
5463
  }
5152
5464
  ),
5153
- /* @__PURE__ */ jsx32(Identifier, { text: dep })
5465
+ /* @__PURE__ */ jsx33(Identifier, { text: dep })
5154
5466
  ] }, dep))
5155
5467
  ] }),
5156
- editable && /* @__PURE__ */ jsx32(
5468
+ editable && /* @__PURE__ */ jsx33(
5157
5469
  UpdateButton,
5158
5470
  {
5159
5471
  draft: card,
5160
5472
  label: "Update resource",
5161
- blocked: argumentsBlocker(draft.arguments)
5473
+ blocked: !draft.name.trim() ? "Enter a name" : argumentsBlocker(draft.arguments)
5162
5474
  }
5163
5475
  )
5164
5476
  ] });
@@ -5167,7 +5479,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
5167
5479
  // src/components/panels/TerraformConfigPanel.tsx
5168
5480
  import { Button as Button11, IconButton as IconButton8, Input as Input6, Panel as Panel5 } from "@lace-cloud/ui";
5169
5481
  import "./panels-shared-3HUQC7TC.css";
5170
- import { Fragment as Fragment12, jsx as jsx33, jsxs as jsxs21 } from "react/jsx-runtime";
5482
+ import { Fragment as Fragment12, jsx as jsx34, jsxs as jsxs21 } from "react/jsx-runtime";
5171
5483
  function toRows3(terraform) {
5172
5484
  return (terraform?.required_providers ?? []).map((req) => ({
5173
5485
  id: req.name,
@@ -5188,10 +5500,20 @@ function fromRows3(requiredVersion, providers) {
5188
5500
  }))
5189
5501
  };
5190
5502
  }
5191
- function TerraformConfigContent({ terraform, onSave }) {
5503
+ var terraformSeed = (terraform) => ({
5504
+ requiredVersion: terraform?.required_version ?? "",
5505
+ providers: toRows3(terraform)
5506
+ });
5507
+ var terraformDraft = sectionKind(
5508
+ "terraform",
5509
+ (settings) => terraformSeed(settings.terraform)
5510
+ );
5511
+ function TerraformConfigContent({ moduleKey, terraform, onSave }) {
5192
5512
  const { editable } = useCanvas();
5193
5513
  const draft = useDraft(
5194
- { requiredVersion: terraform?.required_version ?? "", providers: toRows3(terraform) },
5514
+ terraformDraft,
5515
+ [moduleKey],
5516
+ terraformSeed(terraform),
5195
5517
  async ({ requiredVersion: requiredVersion2, providers: providers2 }) => {
5196
5518
  await onSave(fromRows3(requiredVersion2, providers2));
5197
5519
  }
@@ -5200,8 +5522,8 @@ function TerraformConfigContent({ terraform, onSave }) {
5200
5522
  const setProviders2 = (next) => draft.set("providers", next);
5201
5523
  const updateProvider = (index, field, value) => setProviders2(providers.map((p, i) => i === index ? { ...p, [field]: value } : p));
5202
5524
  return /* @__PURE__ */ jsxs21(Fragment12, { children: [
5203
- /* @__PURE__ */ jsx33("h4", { className: "lace-panel-section-title", children: "Required Version" }),
5204
- /* @__PURE__ */ jsx33("div", { className: "lace-panel-field", children: /* @__PURE__ */ jsx33(
5525
+ /* @__PURE__ */ jsx34("h4", { className: "lace-panel-section-title", children: "Required Version" }),
5526
+ /* @__PURE__ */ jsx34("div", { className: "lace-panel-field", children: /* @__PURE__ */ jsx34(
5205
5527
  Input6,
5206
5528
  {
5207
5529
  value: requiredVersion,
@@ -5211,10 +5533,10 @@ function TerraformConfigContent({ terraform, onSave }) {
5211
5533
  readOnly: !editable
5212
5534
  }
5213
5535
  ) }),
5214
- /* @__PURE__ */ jsx33("h4", { className: "lace-panel-section-title", children: "Required Providers" }),
5536
+ /* @__PURE__ */ jsx34("h4", { className: "lace-panel-section-title", children: "Required Providers" }),
5215
5537
  providers.map((p, i) => /* @__PURE__ */ jsxs21("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
5216
5538
  /* @__PURE__ */ jsxs21("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
5217
- /* @__PURE__ */ jsx33(
5539
+ /* @__PURE__ */ jsx34(
5218
5540
  Input6,
5219
5541
  {
5220
5542
  value: p.name,
@@ -5224,10 +5546,10 @@ function TerraformConfigContent({ terraform, onSave }) {
5224
5546
  readOnly: !editable
5225
5547
  }
5226
5548
  ),
5227
- editable && /* @__PURE__ */ jsx33(
5549
+ editable && /* @__PURE__ */ jsx34(
5228
5550
  IconButton8,
5229
5551
  {
5230
- icon: /* @__PURE__ */ jsx33(CanvasIcon, { name: "close" }),
5552
+ icon: /* @__PURE__ */ jsx34(CanvasIcon, { name: "close" }),
5231
5553
  "aria-label": "Remove provider",
5232
5554
  size: "md",
5233
5555
  tooltipPlacement: "bottom-end",
@@ -5235,7 +5557,7 @@ function TerraformConfigContent({ terraform, onSave }) {
5235
5557
  }
5236
5558
  )
5237
5559
  ] }),
5238
- /* @__PURE__ */ jsx33("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx33(
5560
+ /* @__PURE__ */ jsx34("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx34(
5239
5561
  Input6,
5240
5562
  {
5241
5563
  value: p.source,
@@ -5245,7 +5567,7 @@ function TerraformConfigContent({ terraform, onSave }) {
5245
5567
  readOnly: !editable
5246
5568
  }
5247
5569
  ) }),
5248
- /* @__PURE__ */ jsx33("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx33(
5570
+ /* @__PURE__ */ jsx34("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx34(
5249
5571
  Input6,
5250
5572
  {
5251
5573
  value: p.version,
@@ -5255,7 +5577,7 @@ function TerraformConfigContent({ terraform, onSave }) {
5255
5577
  readOnly: !editable
5256
5578
  }
5257
5579
  ) }),
5258
- (p.aliases || editable) && /* @__PURE__ */ jsx33("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx33(
5580
+ (p.aliases || editable) && /* @__PURE__ */ jsx34("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx34(
5259
5581
  Input6,
5260
5582
  {
5261
5583
  value: p.aliases,
@@ -5268,7 +5590,7 @@ function TerraformConfigContent({ terraform, onSave }) {
5268
5590
  }
5269
5591
  ) })
5270
5592
  ] }, p.id)),
5271
- editable && /* @__PURE__ */ jsx33(
5593
+ editable && /* @__PURE__ */ jsx34(
5272
5594
  Button11,
5273
5595
  {
5274
5596
  variant: "secondary",
@@ -5280,39 +5602,40 @@ function TerraformConfigContent({ terraform, onSave }) {
5280
5602
  children: "+ Add provider"
5281
5603
  }
5282
5604
  ),
5283
- /* @__PURE__ */ jsx33("h4", { className: "lace-panel-section-title", children: "Backend" }),
5284
- /* @__PURE__ */ jsx33("div", { className: "lace-panel-hint", children: "Terraform state is managed by Lace Cloud. The HTTP backend is configured automatically during generation." }),
5285
- editable && /* @__PURE__ */ jsx33(UpdateButton, { draft, label: "Update terraform block" })
5605
+ /* @__PURE__ */ jsx34("h4", { className: "lace-panel-section-title", children: "Backend" }),
5606
+ /* @__PURE__ */ jsx34("div", { className: "lace-panel-hint", children: "Terraform state is managed by Lace Cloud. The HTTP backend is configured automatically during generation." }),
5607
+ editable && /* @__PURE__ */ jsx34(UpdateButton, { draft, label: "Update terraform block" })
5286
5608
  ] });
5287
5609
  }
5288
- function TerraformConfigPanel({ terraform, onSave, onClose }) {
5289
- return /* @__PURE__ */ jsx33(Panel5, { title: "Terraform Configuration", onClose, children: /* @__PURE__ */ jsx33(TerraformConfigContent, { terraform, onSave }) });
5610
+ function TerraformConfigPanel({ onClose, ...content }) {
5611
+ return /* @__PURE__ */ jsx34(Panel5, { title: "Terraform Configuration", onClose, children: /* @__PURE__ */ jsx34(TerraformConfigContent, { ...content }) });
5290
5612
  }
5291
5613
 
5292
5614
  // src/components/panels/ModuleDetails.tsx
5293
- import { Fragment as Fragment13, jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
5615
+ import { Fragment as Fragment13, jsx as jsx35, jsxs as jsxs22 } from "react/jsx-runtime";
5294
5616
  function assertApplied(result) {
5295
5617
  if (!result?.success) throw new Error("apply failed");
5296
5618
  }
5297
5619
  var sectionKey = (moduleKey, section) => `${moduleKey}:${section}`;
5298
5620
  function ModuleDetails({ moduleKey, open = [] }) {
5299
5621
  const { bundle, runner } = useCanvas();
5300
- const settings = useMemo10(() => deriveSettingsConfig(bundle, moduleKey), [bundle, moduleKey]);
5622
+ const settings = useMemo10(() => deriveSettingsConfig2(bundle, moduleKey), [bundle, moduleKey]);
5301
5623
  if (!settings) return null;
5302
- if (settings.reference) return /* @__PURE__ */ jsx34(ReferenceDetails, { settings });
5624
+ if (settings.reference) return /* @__PURE__ */ jsx35(ReferenceDetails, { settings });
5303
5625
  const apply = async (actions) => {
5304
5626
  assertApplied(await runner.apply(actions));
5305
5627
  };
5306
5628
  return /* @__PURE__ */ jsxs22(Fragment13, { children: [
5307
- /* @__PURE__ */ jsx34(
5629
+ /* @__PURE__ */ jsx35(
5308
5630
  AccordionSection,
5309
5631
  {
5310
5632
  title: "Resources",
5311
5633
  defaultOpen: open.includes("Resources"),
5312
5634
  badge: `(${settings.resources.length})`,
5313
- children: /* @__PURE__ */ jsx34(
5635
+ children: /* @__PURE__ */ jsx35(
5314
5636
  ResourcesContent,
5315
5637
  {
5638
+ moduleKey,
5316
5639
  resources: settings.resources,
5317
5640
  dependencyOptions: settings.dependency_options,
5318
5641
  managed: settings.holds_managed_resources,
@@ -5324,23 +5647,25 @@ function ModuleDetails({ moduleKey, open = [] }) {
5324
5647
  )
5325
5648
  }
5326
5649
  ),
5327
- /* @__PURE__ */ jsx34(AccordionSection, { title: "Interface", defaultOpen: open.includes("Interface"), children: /* @__PURE__ */ jsx34(
5650
+ /* @__PURE__ */ jsx35(AccordionSection, { title: "Interface", defaultOpen: open.includes("Interface"), children: /* @__PURE__ */ jsx35(
5328
5651
  ModuleInterfaceContent,
5329
5652
  {
5653
+ moduleKey,
5330
5654
  settings,
5331
5655
  onSave: (variables, outputs) => apply([setVariables(moduleKey, variables), setOutputs(moduleKey, outputs)])
5332
5656
  },
5333
5657
  sectionKey(moduleKey, "Interface")
5334
5658
  ) }),
5335
- /* @__PURE__ */ jsx34(
5659
+ /* @__PURE__ */ jsx35(
5336
5660
  AccordionSection,
5337
5661
  {
5338
5662
  title: "Moved and import blocks",
5339
5663
  defaultOpen: open.includes("Moved and import blocks"),
5340
5664
  badge: settings.directives.length > 0 ? `(${settings.directives.length})` : void 0,
5341
- children: /* @__PURE__ */ jsx34(
5665
+ children: /* @__PURE__ */ jsx35(
5342
5666
  DirectivesContent,
5343
5667
  {
5668
+ moduleKey,
5344
5669
  directives: settings.directives,
5345
5670
  onSave: (blocks) => apply([setDirectives(moduleKey, blocks)])
5346
5671
  },
@@ -5348,25 +5673,28 @@ function ModuleDetails({ moduleKey, open = [] }) {
5348
5673
  )
5349
5674
  }
5350
5675
  ),
5351
- /* @__PURE__ */ jsx34(AccordionSection, { title: "Locals", defaultOpen: open.includes("Locals"), children: /* @__PURE__ */ jsx34(
5676
+ /* @__PURE__ */ jsx35(AccordionSection, { title: "Locals", defaultOpen: open.includes("Locals"), children: /* @__PURE__ */ jsx35(
5352
5677
  LocalsContent,
5353
5678
  {
5679
+ moduleKey,
5354
5680
  locals: settings.locals,
5355
5681
  onSave: (locals) => apply([setLocals(moduleKey, locals)])
5356
5682
  },
5357
5683
  sectionKey(moduleKey, "Locals")
5358
5684
  ) }),
5359
- /* @__PURE__ */ jsx34(AccordionSection, { title: "Providers", defaultOpen: open.includes("Providers"), children: /* @__PURE__ */ jsx34(
5685
+ /* @__PURE__ */ jsx35(AccordionSection, { title: "Providers", defaultOpen: open.includes("Providers"), children: /* @__PURE__ */ jsx35(
5360
5686
  ProvidersContent,
5361
5687
  {
5688
+ moduleKey,
5362
5689
  providers: settings.providers,
5363
5690
  onSave: (providers) => apply([setProviders(moduleKey, providers)])
5364
5691
  },
5365
5692
  sectionKey(moduleKey, "Providers")
5366
5693
  ) }),
5367
- /* @__PURE__ */ jsx34(AccordionSection, { title: "Terraform Config", defaultOpen: open.includes("Terraform Config"), children: /* @__PURE__ */ jsx34(
5694
+ /* @__PURE__ */ jsx35(AccordionSection, { title: "Terraform Config", defaultOpen: open.includes("Terraform Config"), children: /* @__PURE__ */ jsx35(
5368
5695
  TerraformConfigContent,
5369
5696
  {
5697
+ moduleKey,
5370
5698
  terraform: settings.terraform,
5371
5699
  onSave: (terraform) => apply([setTerraform(moduleKey, terraform)])
5372
5700
  },
@@ -5374,16 +5702,27 @@ function ModuleDetails({ moduleKey, open = [] }) {
5374
5702
  ) })
5375
5703
  ] });
5376
5704
  }
5705
+ var directivesSeed = (directives) => ({ blocks: directives });
5706
+ var directivesDraft = sectionKind(
5707
+ "directives",
5708
+ (settings) => directivesSeed(settings.directives)
5709
+ );
5377
5710
  function DirectivesContent({
5711
+ moduleKey,
5378
5712
  directives,
5379
5713
  onSave
5380
5714
  }) {
5381
5715
  const { editable } = useCanvas();
5382
- const draft = useDraft({ blocks: directives }, ({ blocks: blocks2 }) => onSave(blocks2));
5716
+ const draft = useDraft(
5717
+ directivesDraft,
5718
+ [moduleKey],
5719
+ directivesSeed(directives),
5720
+ ({ blocks: blocks2 }) => onSave(blocks2)
5721
+ );
5383
5722
  const { blocks } = draft.value;
5384
5723
  return /* @__PURE__ */ jsxs22(Fragment13, { children: [
5385
- blocks.length === 0 && /* @__PURE__ */ jsx34("div", { className: "lace-panel-hint", children: "No moved or import blocks." }),
5386
- /* @__PURE__ */ jsx34(
5724
+ blocks.length === 0 && /* @__PURE__ */ jsx35("div", { className: "lace-panel-hint", children: "No moved or import blocks." }),
5725
+ /* @__PURE__ */ jsx35(
5387
5726
  BlockEditor,
5388
5727
  {
5389
5728
  blocks,
@@ -5395,7 +5734,7 @@ function DirectivesContent({
5395
5734
  ]
5396
5735
  }
5397
5736
  ),
5398
- editable && /* @__PURE__ */ jsx34(UpdateButton, { draft, label: "Update moved and import blocks" })
5737
+ editable && /* @__PURE__ */ jsx35(UpdateButton, { draft, label: "Update moved and import blocks" })
5399
5738
  ] });
5400
5739
  }
5401
5740
  function ReferenceDetails({ settings }) {
@@ -5403,24 +5742,24 @@ function ReferenceDetails({ settings }) {
5403
5742
  if (!reference) return null;
5404
5743
  return /* @__PURE__ */ jsxs22(Fragment13, { children: [
5405
5744
  /* @__PURE__ */ jsxs22(AccordionSection, { title: "Source", defaultOpen: true, children: [
5406
- /* @__PURE__ */ jsx34("div", { className: "lace-panel-hint", children: "A reference: Lace reads it where its source points and never edits it." }),
5745
+ /* @__PURE__ */ jsx35("div", { className: "lace-panel-hint", children: "A reference: Lace reads it where its source points and never edits it." }),
5407
5746
  /* @__PURE__ */ jsxs22("div", { className: "lace-panel-row-actions lace-panel-row-actions--stacked", children: [
5408
- /* @__PURE__ */ jsx34(Input7, { label: "Source", value: reference.source, fullWidth: true, mono: true, readOnly: true }),
5409
- /* @__PURE__ */ jsx34(Input7, { label: "Version", value: reference.version, fullWidth: true, mono: true, readOnly: true })
5747
+ /* @__PURE__ */ jsx35(Input7, { label: "Source", value: reference.source, fullWidth: true, mono: true, readOnly: true }),
5748
+ /* @__PURE__ */ jsx35(Input7, { label: "Version", value: reference.version, fullWidth: true, mono: true, readOnly: true })
5410
5749
  ] })
5411
5750
  ] }),
5412
5751
  /* @__PURE__ */ jsxs22(AccordionSection, { title: "Interface", defaultOpen: true, children: [
5413
- /* @__PURE__ */ jsx34("h4", { className: "lace-panel-section-title", children: "Inputs" }),
5414
- settings.variables.length === 0 && /* @__PURE__ */ jsx34("div", { className: "lace-panel-hint", children: "The IR holds no interface for this reference." }),
5415
- settings.variables.map((v) => /* @__PURE__ */ jsx34("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx34(Identifier, { text: `${typedName(v.name, v.type)}${v.required ? " (required)" : ""}` }) }, v.name)),
5416
- /* @__PURE__ */ jsx34("h4", { className: "lace-panel-section-title", children: "Outputs" }),
5417
- settings.outputs.map((o) => /* @__PURE__ */ jsx34("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx34(Identifier, { text: typedName(o.name, o.type) }) }, o.name))
5752
+ /* @__PURE__ */ jsx35("h4", { className: "lace-panel-section-title", children: "Inputs" }),
5753
+ settings.variables.length === 0 && /* @__PURE__ */ jsx35("div", { className: "lace-panel-hint", children: "The IR holds no interface for this reference." }),
5754
+ settings.variables.map((v) => /* @__PURE__ */ jsx35("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx35(Identifier, { text: `${typedName(v.name, v.type)}${v.required ? " (required)" : ""}` }) }, v.name)),
5755
+ /* @__PURE__ */ jsx35("h4", { className: "lace-panel-section-title", children: "Outputs" }),
5756
+ settings.outputs.map((o) => /* @__PURE__ */ jsx35("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx35(Identifier, { text: typedName(o.name, o.type) }) }, o.name))
5418
5757
  ] })
5419
5758
  ] });
5420
5759
  }
5421
5760
 
5422
5761
  // src/components/panels/ModuleConfigPanel.tsx
5423
- import { Fragment as Fragment14, jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
5762
+ import { Fragment as Fragment14, jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
5424
5763
  var MODE_ITEMS = [
5425
5764
  { value: "empty", label: "Unset" },
5426
5765
  { value: "literal", label: "Lit" },
@@ -5471,6 +5810,13 @@ function callFields(config) {
5471
5810
  }
5472
5811
  return fields;
5473
5812
  }
5813
+ var callDraft = {
5814
+ name: "call",
5815
+ seed(derive, [path]) {
5816
+ const config = derive.node(path);
5817
+ return config ? callFields(config) : null;
5818
+ }
5819
+ };
5474
5820
  function sent(mode, binding = {}) {
5475
5821
  return { mode: toInputMode(mode), value: void 0, variable: "", expression: "", ...binding };
5476
5822
  }
@@ -5525,12 +5871,12 @@ function callActions(config, address, fields) {
5525
5871
  function ModuleConfigPanel({ instance_id, onClose }) {
5526
5872
  const { editable, bundle, runner } = useCanvas();
5527
5873
  const config = useMemo11(
5528
- () => deriveNodeConfig(bundle, instance_id),
5874
+ () => deriveNodeConfig2(bundle, instance_id),
5529
5875
  [bundle, instance_id]
5530
5876
  );
5531
5877
  const address = useMemo11(() => instanceAddress6(bundle, instance_id), [bundle, instance_id]);
5532
5878
  const seed = useMemo11(() => callFields(config), [config]);
5533
- const draft = useDraft(seed, async (fields2) => {
5879
+ const draft = useDraft(callDraft, [instance_id], seed, async (fields2) => {
5534
5880
  if (!config) throw new Error(`no instance ${instance_id} to update`);
5535
5881
  const result = await runner.apply(callActions(config, address, fields2));
5536
5882
  if (!result?.success) throw new Error("apply failed");
@@ -5565,7 +5911,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5565
5911
  ...m,
5566
5912
  disabled: !editable || m.value === "wired" || currentMode === "wired"
5567
5913
  }));
5568
- return /* @__PURE__ */ jsx35(
5914
+ return /* @__PURE__ */ jsx36(
5569
5915
  ModeToggle,
5570
5916
  {
5571
5917
  value: currentMode,
@@ -5579,8 +5925,8 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5579
5925
  const currentMode = binding(input)?.mode ?? input.mode;
5580
5926
  return /* @__PURE__ */ jsxs23("div", { className: "lace-panel-field", children: [
5581
5927
  /* @__PURE__ */ jsxs23("label", { className: "lace-panel-row-label", children: [
5582
- /* @__PURE__ */ jsx35(Identifier, { text: input.name }),
5583
- input.required && /* @__PURE__ */ jsx35("span", { className: "lace-mcp__required-star", children: "*" })
5928
+ /* @__PURE__ */ jsx36(Identifier, { text: input.name }),
5929
+ input.required && /* @__PURE__ */ jsx36("span", { className: "lace-mcp__required-star", children: "*" })
5584
5930
  ] }),
5585
5931
  renderModeSelector(input),
5586
5932
  /* @__PURE__ */ jsxs23("div", { className: "lace-panel-row-content", children: [
@@ -5589,17 +5935,17 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5589
5935
  currentMode === "expression" && renderExpressionEditor(input),
5590
5936
  currentMode === "literal" && renderLiteralEditor(input)
5591
5937
  ] }),
5592
- input.description && /* @__PURE__ */ jsx35("div", { className: "lace-panel-field__description", children: input.description })
5938
+ input.description && /* @__PURE__ */ jsx36("div", { className: "lace-panel-field__description", children: input.description })
5593
5939
  ] }, input.name);
5594
5940
  }
5595
5941
  function renderWiredEditor(input) {
5596
5942
  const label = input.wired_source ?? "Not wired";
5597
5943
  return /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__wired-row", children: [
5598
- /* @__PURE__ */ jsx35("div", { className: "lace-mcp__wired-input", children: /* @__PURE__ */ jsx35(Input8, { value: label, readOnly: true, fullWidth: true, mono: true }) }),
5599
- editable && /* @__PURE__ */ jsx35(
5944
+ /* @__PURE__ */ jsx36("div", { className: "lace-mcp__wired-input", children: /* @__PURE__ */ jsx36(Input8, { value: label, readOnly: true, fullWidth: true, mono: true }) }),
5945
+ editable && /* @__PURE__ */ jsx36(
5600
5946
  IconButton9,
5601
5947
  {
5602
- icon: /* @__PURE__ */ jsx35(CanvasIcon, { name: "close" }),
5948
+ icon: /* @__PURE__ */ jsx36(CanvasIcon, { name: "close" }),
5603
5949
  "aria-label": "Disconnect this input",
5604
5950
  size: "md",
5605
5951
  tooltipPlacement: "bottom-end",
@@ -5609,7 +5955,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5609
5955
  ] });
5610
5956
  }
5611
5957
  function renderVariableEditor(input) {
5612
- return /* @__PURE__ */ jsx35(
5958
+ return /* @__PURE__ */ jsx36(
5613
5959
  Input8,
5614
5960
  {
5615
5961
  value: binding(input)?.variable ?? "",
@@ -5625,7 +5971,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5625
5971
  );
5626
5972
  }
5627
5973
  function renderExpressionEditor(input) {
5628
- return /* @__PURE__ */ jsx35(
5974
+ return /* @__PURE__ */ jsx36(
5629
5975
  Textarea3,
5630
5976
  {
5631
5977
  value: binding(input)?.expression ?? "",
@@ -5651,14 +5997,14 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5651
5997
  onChange: (e) => updateValue(e.target.value === "true"),
5652
5998
  disabled: !editable,
5653
5999
  children: [
5654
- /* @__PURE__ */ jsx35("option", { value: "true", children: "True" }),
5655
- /* @__PURE__ */ jsx35("option", { value: "false", children: "False" })
6000
+ /* @__PURE__ */ jsx36("option", { value: "true", children: "True" }),
6001
+ /* @__PURE__ */ jsx36("option", { value: "false", children: "False" })
5656
6002
  ]
5657
6003
  }
5658
6004
  );
5659
6005
  }
5660
6006
  if (kind === "number") {
5661
- return /* @__PURE__ */ jsx35(
6007
+ return /* @__PURE__ */ jsx36(
5662
6008
  Input8,
5663
6009
  {
5664
6010
  type: "number",
@@ -5671,7 +6017,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5671
6017
  }
5672
6018
  if (kind === "collection") {
5673
6019
  const jsonStr = typeof value === "string" ? value : JSON.stringify(value ?? null, null, 2);
5674
- return /* @__PURE__ */ jsx35(
6020
+ return /* @__PURE__ */ jsx36(
5675
6021
  Textarea3,
5676
6022
  {
5677
6023
  value: jsonStr,
@@ -5689,7 +6035,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5689
6035
  }
5690
6036
  );
5691
6037
  }
5692
- return /* @__PURE__ */ jsx35(
6038
+ return /* @__PURE__ */ jsx36(
5693
6039
  Input8,
5694
6040
  {
5695
6041
  value: String(value ?? ""),
@@ -5712,28 +6058,28 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5712
6058
  instance_id,
5713
6059
  '":'
5714
6060
  ] }),
5715
- /* @__PURE__ */ jsx35("div", { className: "lace-mcp__error-detail", children: "Instance not found in the current Bundle." })
6061
+ /* @__PURE__ */ jsx36("div", { className: "lace-mcp__error-detail", children: "Instance not found in the current Bundle." })
5716
6062
  ] });
5717
6063
  }
5718
6064
  const dependsOn = fields.depends_on;
5719
6065
  const setProviders2 = (next) => draft.set("providers", next);
5720
6066
  const title = /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__title", children: [
5721
- /* @__PURE__ */ jsx35("div", { className: "lace-mcp__title-eyebrow", children: "Module" }),
5722
- /* @__PURE__ */ jsx35("h3", { className: "lace-mcp__title-id", children: /* @__PURE__ */ jsx35(Identifier, { text: instance_id }) })
6067
+ /* @__PURE__ */ jsx36("div", { className: "lace-mcp__title-eyebrow", children: "Module" }),
6068
+ /* @__PURE__ */ jsx36("h3", { className: "lace-mcp__title-id", children: /* @__PURE__ */ jsx36(Identifier, { text: instance_id }) })
5723
6069
  ] });
5724
- const footer = editable ? /* @__PURE__ */ jsx35(UpdateButton, { draft, label: "Update configuration" }) : void 0;
6070
+ const footer = editable ? /* @__PURE__ */ jsx36(UpdateButton, { draft, label: "Update configuration" }) : void 0;
5725
6071
  return /* @__PURE__ */ jsxs23(Panel6, { title, footer, flush: true, onClose, children: [
5726
- requiredInputs.length > 0 && /* @__PURE__ */ jsx35(AccordionSection, { title: "Required Inputs", defaultOpen: true, badge: `(${requiredInputs.length})`, children: requiredInputs.map(renderInputField) }),
5727
- optionalInputs.length > 0 && /* @__PURE__ */ jsx35(AccordionSection, { title: "Optional Inputs", defaultOpen: true, badge: `(${optionalInputs.length})`, children: optionalInputs.map(renderInputField) }),
6072
+ requiredInputs.length > 0 && /* @__PURE__ */ jsx36(AccordionSection, { title: "Required Inputs", defaultOpen: true, badge: `(${requiredInputs.length})`, children: requiredInputs.map(renderInputField) }),
6073
+ optionalInputs.length > 0 && /* @__PURE__ */ jsx36(AccordionSection, { title: "Optional Inputs", defaultOpen: true, badge: `(${optionalInputs.length})`, children: optionalInputs.map(renderInputField) }),
5728
6074
  config.dependency_options.length > 0 && /* @__PURE__ */ jsxs23(
5729
6075
  AccordionSection,
5730
6076
  {
5731
6077
  title: "Depends On",
5732
6078
  badge: dependsOn.length > 0 ? `(${dependsOn.length})` : void 0,
5733
6079
  children: [
5734
- /* @__PURE__ */ jsx35("div", { className: "lace-mcp__depends-hint", children: "Select sibling instances this module depends on." }),
6080
+ /* @__PURE__ */ jsx36("div", { className: "lace-mcp__depends-hint", children: "Select sibling instances this module depends on." }),
5735
6081
  config.dependency_options.map((option) => /* @__PURE__ */ jsxs23("label", { className: "lace-mcp__depends-item", children: [
5736
- /* @__PURE__ */ jsx35(
6082
+ /* @__PURE__ */ jsx36(
5737
6083
  "input",
5738
6084
  {
5739
6085
  type: "checkbox",
@@ -5746,7 +6092,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5746
6092
  )
5747
6093
  }
5748
6094
  ),
5749
- /* @__PURE__ */ jsx35(Identifier, { className: "lace-mcp__depends-label", text: option })
6095
+ /* @__PURE__ */ jsx36(Identifier, { className: "lace-mcp__depends-label", text: option })
5750
6096
  ] }, option))
5751
6097
  ]
5752
6098
  }
@@ -5760,15 +6106,15 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5760
6106
  /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__depends-hint", children: [
5761
6107
  "Map each child-local provider name to the root provider reference passed down (e.g.",
5762
6108
  " ",
5763
- /* @__PURE__ */ jsx35("code", { children: "aws" }),
6109
+ /* @__PURE__ */ jsx36("code", { children: "aws" }),
5764
6110
  " \u2192 ",
5765
- /* @__PURE__ */ jsx35("code", { children: "aws.west" }),
6111
+ /* @__PURE__ */ jsx36("code", { children: "aws.west" }),
5766
6112
  ")."
5767
6113
  ] }),
5768
6114
  fields.providers.map((row, i) => (
5769
6115
  // biome-ignore lint/suspicious/noArrayIndexKey: rows are positional and freely editable
5770
6116
  /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__provider-row", children: [
5771
- /* @__PURE__ */ jsx35(
6117
+ /* @__PURE__ */ jsx36(
5772
6118
  Input8,
5773
6119
  {
5774
6120
  value: row.key,
@@ -5780,8 +6126,8 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5780
6126
  readOnly: !editable
5781
6127
  }
5782
6128
  ),
5783
- /* @__PURE__ */ jsx35("span", { className: "lace-mcp__provider-arrow", children: "=" }),
5784
- /* @__PURE__ */ jsx35(
6129
+ /* @__PURE__ */ jsx36("span", { className: "lace-mcp__provider-arrow", children: "=" }),
6130
+ /* @__PURE__ */ jsx36(
5785
6131
  Input8,
5786
6132
  {
5787
6133
  value: row.value,
@@ -5793,10 +6139,10 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5793
6139
  readOnly: !editable
5794
6140
  }
5795
6141
  ),
5796
- editable && /* @__PURE__ */ jsx35(
6142
+ editable && /* @__PURE__ */ jsx36(
5797
6143
  IconButton9,
5798
6144
  {
5799
- icon: /* @__PURE__ */ jsx35(CanvasIcon, { name: "close" }),
6145
+ icon: /* @__PURE__ */ jsx36(CanvasIcon, { name: "close" }),
5800
6146
  "aria-label": "Remove this provider mapping",
5801
6147
  size: "md",
5802
6148
  tooltipPlacement: "bottom-end",
@@ -5805,7 +6151,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5805
6151
  )
5806
6152
  ] }, i)
5807
6153
  )),
5808
- editable && /* @__PURE__ */ jsx35(
6154
+ editable && /* @__PURE__ */ jsx36(
5809
6155
  Button12,
5810
6156
  {
5811
6157
  variant: "secondary",
@@ -5820,12 +6166,12 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5820
6166
  (fields.count || fields.for_each || editable) && /* @__PURE__ */ jsxs23(AccordionSection, { title: "Repetition", children: [
5821
6167
  /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__depends-hint", children: [
5822
6168
  "The call's ",
5823
- /* @__PURE__ */ jsx35("code", { children: "count" }),
6169
+ /* @__PURE__ */ jsx36("code", { children: "count" }),
5824
6170
  " or ",
5825
- /* @__PURE__ */ jsx35("code", { children: "for_each" }),
6171
+ /* @__PURE__ */ jsx36("code", { children: "for_each" }),
5826
6172
  ": one module, called once per instance."
5827
6173
  ] }),
5828
- /* @__PURE__ */ jsx35(
6174
+ /* @__PURE__ */ jsx36(
5829
6175
  Input8,
5830
6176
  {
5831
6177
  label: "count",
@@ -5837,7 +6183,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5837
6183
  readOnly: !editable
5838
6184
  }
5839
6185
  ),
5840
- /* @__PURE__ */ jsx35(
6186
+ /* @__PURE__ */ jsx36(
5841
6187
  Input8,
5842
6188
  {
5843
6189
  label: "for_each",
@@ -5850,26 +6196,26 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5850
6196
  }
5851
6197
  )
5852
6198
  ] }),
5853
- config.outputs.length > 0 && /* @__PURE__ */ jsx35(AccordionSection, { title: "Outputs", badge: `(${config.outputs.length})`, children: config.outputs.map((o) => /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__output-card", children: [
6199
+ config.outputs.length > 0 && /* @__PURE__ */ jsx36(AccordionSection, { title: "Outputs", badge: `(${config.outputs.length})`, children: config.outputs.map((o) => /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__output-card", children: [
5854
6200
  /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__output-header", children: [
5855
- /* @__PURE__ */ jsx35(Identifier, { className: "lace-mcp__output-name", text: o.name }),
5856
- /* @__PURE__ */ jsx35(Identifier, { className: "lace-mcp__output-type", text: o.type ?? "" })
6201
+ /* @__PURE__ */ jsx36(Identifier, { className: "lace-mcp__output-name", text: o.name }),
6202
+ /* @__PURE__ */ jsx36(Identifier, { className: "lace-mcp__output-type", text: o.type ?? "" })
5857
6203
  ] }),
5858
- o.description && /* @__PURE__ */ jsx35("div", { className: "lace-mcp__output-description", children: o.description }),
5859
- o.sensitive && /* @__PURE__ */ jsx35("div", { className: "lace-mcp__output-sensitive", children: "sensitive" })
6204
+ o.description && /* @__PURE__ */ jsx36("div", { className: "lace-mcp__output-description", children: o.description }),
6205
+ o.sensitive && /* @__PURE__ */ jsx36("div", { className: "lace-mcp__output-sensitive", children: "sensitive" })
5860
6206
  ] }, o.name)) }),
5861
6207
  config.module_key && /* @__PURE__ */ jsxs23(Fragment14, { children: [
5862
6208
  /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__module-heading", children: [
5863
- /* @__PURE__ */ jsx35("div", { className: "lace-mcp__title-eyebrow", children: "Called module" }),
6209
+ /* @__PURE__ */ jsx36("div", { className: "lace-mcp__title-eyebrow", children: "Called module" }),
5864
6210
  /* @__PURE__ */ jsxs23("div", { children: [
5865
- /* @__PURE__ */ jsx35(Identifier, { text: config.module_key }),
6211
+ /* @__PURE__ */ jsx36(Identifier, { text: config.module_key }),
5866
6212
  config.source && /* @__PURE__ */ jsxs23("span", { className: "lace-mcp__module-source", children: [
5867
6213
  " \xB7 ",
5868
- /* @__PURE__ */ jsx35(Identifier, { text: config.source })
6214
+ /* @__PURE__ */ jsx36(Identifier, { text: config.source })
5869
6215
  ] })
5870
6216
  ] })
5871
6217
  ] }),
5872
- /* @__PURE__ */ jsx35(ModuleDetails, { moduleKey: config.module_key }, config.module_key)
6218
+ /* @__PURE__ */ jsx36(ModuleDetails, { moduleKey: config.module_key }, config.module_key)
5873
6219
  ] })
5874
6220
  ] });
5875
6221
  }
@@ -5895,11 +6241,11 @@ var moduleConfigPanel = {
5895
6241
  };
5896
6242
 
5897
6243
  // src/core/panels/SourceRefusedBanner.tsx
5898
- import { jsx as jsx36 } from "react/jsx-runtime";
6244
+ import { jsx as jsx37 } from "react/jsx-runtime";
5899
6245
  var LOCKED = "The canvas can't take this module's .tf, so editing, saving and generating are locked until it can; the Diagnostics tab says why.";
5900
6246
  var OUT_OF_LACE_SHAPE = "This Terraform is not in lace shape yet, so the canvas shows it read-only.";
5901
6247
  function SourceRefusedBanner({ ctx }) {
5902
- return /* @__PURE__ */ jsx36(
6248
+ return /* @__PURE__ */ jsx37(
5903
6249
  RowActionBanner,
5904
6250
  {
5905
6251
  ctx,
@@ -5926,10 +6272,10 @@ import { createElement as createElement3 } from "react";
5926
6272
  // src/components/panels/UnifiedSettingsPanel.tsx
5927
6273
  import { Panel as Panel7 } from "@lace-cloud/ui";
5928
6274
  import "./panels-shared-3HUQC7TC.css";
5929
- import { jsx as jsx37 } from "react/jsx-runtime";
6275
+ import { jsx as jsx38 } from "react/jsx-runtime";
5930
6276
  function UnifiedSettingsPanel({ onClose }) {
5931
6277
  const { bundle } = useCanvas();
5932
- return /* @__PURE__ */ jsx37(Panel7, { title: "Settings", flush: true, onClose, children: /* @__PURE__ */ jsx37(ModuleDetails, { moduleKey: bundle.entry, open: ["Interface"] }, bundle.entry) });
6278
+ return /* @__PURE__ */ jsx38(Panel7, { title: "Settings", flush: true, onClose, children: /* @__PURE__ */ jsx38(ModuleDetails, { moduleKey: bundle.entry, open: ["Interface"] }, bundle.entry) });
5933
6279
  }
5934
6280
 
5935
6281
  // src/core/panels/settings.ts
@@ -5986,9 +6332,9 @@ var CORE_CONTRIBUTIONS = {
5986
6332
  };
5987
6333
 
5988
6334
  // src/core/use-editing.ts
5989
- import { useEffect as useEffect12, useState as useState17 } from "react";
6335
+ import { useEffect as useEffect12, useState as useState16 } from "react";
5990
6336
  function useEditing(runner) {
5991
- const [editing, setEditing] = useState17(() => runner.editing());
6337
+ const [editing, setEditing] = useState16(() => runner.editing());
5992
6338
  useEffect12(() => {
5993
6339
  setEditing(runner.editing());
5994
6340
  return runner.onEditingChange(setEditing);
@@ -5997,7 +6343,7 @@ function useEditing(runner) {
5997
6343
  }
5998
6344
 
5999
6345
  // src/App.tsx
6000
- import { jsx as jsx38, jsxs as jsxs24 } from "react/jsx-runtime";
6346
+ import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
6001
6347
  var EMPTY_CONTRIBUTIONS = { overlays: [], panels: [], actions: [] };
6002
6348
  var NO_TARGET = {};
6003
6349
  function OverlayRunner({
@@ -6012,11 +6358,11 @@ function OverlayRunner({
6012
6358
  const next = error?.message ?? null;
6013
6359
  if (lastErrorRef.current.get(path) === next) return;
6014
6360
  lastErrorRef.current.set(path, next);
6015
- if (error) ctx.ports.presenter.notify("error", `${path}: ${error.message}`);
6361
+ if (error) notifyFailure(ctx.ports.presenter, error, path);
6016
6362
  },
6017
6363
  [ctx.ports.presenter]
6018
6364
  );
6019
- return /* @__PURE__ */ jsx38(PanelScope, { ctx, paths: overlay.paths, tick, onReadError, children: /* @__PURE__ */ jsx38(OverlayDecorations, { overlay, ctx, onDecorations }) });
6365
+ return /* @__PURE__ */ jsx39(PanelScope, { ctx, paths: overlay.paths, tick, onReadError, children: /* @__PURE__ */ jsx39(OverlayDecorations, { overlay, ctx, onDecorations }) });
6020
6366
  }
6021
6367
  function OverlayDecorations({
6022
6368
  overlay,
@@ -6031,7 +6377,7 @@ function OverlayDecorations({
6031
6377
  return null;
6032
6378
  }
6033
6379
  function PanelSlot({ panel, ctx, tick }) {
6034
- const [readErrors, setReadErrors] = useState18(/* @__PURE__ */ new Map());
6380
+ const [readErrors, setReadErrors] = useState17(/* @__PURE__ */ new Map());
6035
6381
  const onReadError = useCallback11((path, error) => {
6036
6382
  setReadErrors((prev) => {
6037
6383
  if (error === null) {
@@ -6059,7 +6405,7 @@ function PanelSlot({ panel, ctx, tick }) {
6059
6405
  ": ",
6060
6406
  error.message
6061
6407
  ] }, path)),
6062
- /* @__PURE__ */ jsx38(panel.Component, { ctx })
6408
+ /* @__PURE__ */ jsx39(panel.Component, { ctx })
6063
6409
  ]
6064
6410
  }
6065
6411
  );
@@ -6069,12 +6415,12 @@ function BottomTabs({
6069
6415
  ctx,
6070
6416
  tick
6071
6417
  }) {
6072
- const [manualId, setManualId] = useState18(null);
6418
+ const [manualId, setManualId] = useState17(null);
6073
6419
  const manual = manualId !== null ? panels.find((p) => p.id === manualId) : void 0;
6074
6420
  const active = manual ?? panels[0] ?? null;
6075
6421
  if (panels.length === 0) return null;
6076
6422
  return /* @__PURE__ */ jsxs24("div", { className: "lace-app__bottom", children: [
6077
- /* @__PURE__ */ jsx38("div", { className: "lace-app__bottom-tabs", role: "tablist", children: panels.map((panel) => /* @__PURE__ */ jsx38(
6423
+ /* @__PURE__ */ jsx39("div", { className: "lace-app__bottom-tabs", role: "tablist", children: panels.map((panel) => /* @__PURE__ */ jsx39(
6078
6424
  "button",
6079
6425
  {
6080
6426
  type: "button",
@@ -6086,7 +6432,7 @@ function BottomTabs({
6086
6432
  },
6087
6433
  panel.id
6088
6434
  )) }),
6089
- /* @__PURE__ */ jsx38("div", { className: "lace-app__bottom-content", children: active && /* @__PURE__ */ jsx38(PanelSlot, { panel: active, ctx, tick }) })
6435
+ /* @__PURE__ */ jsx39("div", { className: "lace-app__bottom-content", children: active && /* @__PURE__ */ jsx39(PanelSlot, { panel: active, ctx, tick }) })
6090
6436
  ] });
6091
6437
  }
6092
6438
  function endMessage(end) {
@@ -6112,31 +6458,41 @@ function App({
6112
6458
  );
6113
6459
  const dropReport = useCallback11((session2) => results.detach("report", session2), [results]);
6114
6460
  const { source, end, session } = useCanvasSource(ports.source, writeReport, dropReport);
6115
- const [arrangement, setArrangement] = useState18(() => ports.viewState.load());
6461
+ const [stored, setArrangement] = useState17(() => ports.viewState.load());
6116
6462
  const stack = ports.context.stack;
6117
- const [selection, setSelection] = useState18(NO_SELECTION);
6118
- const [settingsOpen, setSettingsOpen] = useState18(false);
6463
+ const [selection, setSelection] = useState17(NO_SELECTION);
6464
+ const [settingsOpen, setSettingsOpen] = useState17(false);
6119
6465
  const select = useCallback11((next) => {
6120
6466
  setSelection(next);
6121
6467
  if (next.nodes.length > 0 || next.edges.length > 0) setSettingsOpen(false);
6122
6468
  }, []);
6123
- const [pendingForm, setPendingForm] = useState18(null);
6124
- const [overlayDecorations, setOverlayDecorations] = useState18({});
6469
+ const [pendingForm, setPendingForm] = useState17(null);
6470
+ const [overlayDecorations, setOverlayDecorations] = useState17({});
6125
6471
  const layoutRef = useRef12({ panIntoView: () => {
6126
6472
  } });
6473
+ const sourcePort = useRef12(ports.source);
6474
+ sourcePort.current = ports.source;
6475
+ const portLedger = useRef12(null);
6476
+ portLedger.current = ledgerFor(portLedger.current, ports.source);
6477
+ const drafts = portLedger.current.drafts;
6478
+ const recordDissolved = useCallback11((dissolution) => {
6479
+ const held = ledgerFor(portLedger.current, sourcePort.current);
6480
+ portLedger.current = { ...held, records: recordDissolution(held.records, dissolution) };
6481
+ }, []);
6127
6482
  const { commands, presenter, editor } = ports;
6128
6483
  const runner = useMemo12(
6129
6484
  () => createActionRunner({ commands, presenter, editor }, results, {
6130
- onPendingFormChange: setPendingForm
6485
+ onPendingFormChange: setPendingForm,
6486
+ onDissolved: recordDissolved
6131
6487
  }),
6132
- [commands, presenter, editor, results]
6488
+ [commands, presenter, editor, results, recordDissolved]
6133
6489
  );
6134
6490
  useEffect13(() => {
6135
6491
  return () => {
6136
6492
  runner.dispose();
6137
6493
  };
6138
6494
  }, [runner]);
6139
- const tick = useSyncExternalStore(results.subscribe, results.getTick);
6495
+ const tick = useSyncExternalStore2(results.subscribe, results.getTick);
6140
6496
  const editing = useEditing(runner);
6141
6497
  const updateArrangement = useCallback11(
6142
6498
  (next) => {
@@ -6148,24 +6504,55 @@ function App({
6148
6504
  const pruned = useRef12(false);
6149
6505
  if (source && !pruned.current) {
6150
6506
  pruned.current = true;
6151
- const gced = gcArrangement(source.bundle, arrangement);
6152
- if (gced !== arrangement) {
6507
+ const gced = gcArrangement(source.bundle, stored);
6508
+ if (gced !== stored) {
6153
6509
  queueMicrotask(() => {
6154
6510
  setArrangement(gced);
6155
6511
  ports.viewState.save(gced);
6156
6512
  });
6157
6513
  }
6158
6514
  }
6159
- const view = useMemo12(
6160
- () => source ? projectFrame(source, arrangement) : null,
6161
- [source, arrangement]
6162
- );
6515
+ const projected = useMemo12(() => {
6516
+ if (!source) return null;
6517
+ const view2 = projectFrame(source, stored);
6518
+ const held = ledgerFor(portLedger.current, ports.source);
6519
+ const { records, arrangement: arrangement2 } = reconcileDissolutions(
6520
+ held.records,
6521
+ held.shown,
6522
+ { source, view: view2 },
6523
+ stored
6524
+ );
6525
+ return {
6526
+ view: arrangement2 === stored ? view2 : projectFrame(source, arrangement2),
6527
+ arrangement: arrangement2,
6528
+ records
6529
+ };
6530
+ }, [source, stored, ports.source]);
6531
+ const arrangement = projected?.arrangement ?? stored;
6532
+ const view = projected?.view ?? null;
6533
+ useLayoutEffect5(() => {
6534
+ if (!source || !projected) return;
6535
+ const held = ledgerFor(portLedger.current, ports.source);
6536
+ const landed = held.shown?.source !== source;
6537
+ portLedger.current = {
6538
+ ...held,
6539
+ records: landed ? projected.records : held.records,
6540
+ shown: { source, view: projected.view }
6541
+ };
6542
+ if (projected.arrangement === stored) return;
6543
+ const corrected = projected.arrangement;
6544
+ setArrangement(corrected);
6545
+ queueMicrotask(() => ports.viewState.save(corrected));
6546
+ }, [source, projected, stored, ports.source, ports.viewState]);
6163
6547
  const reconciledFrame = useRef12(null);
6164
6548
  useLayoutEffect5(() => {
6165
6549
  if (!source || !view || reconciledFrame.current === source) return;
6166
6550
  reconciledFrame.current = source;
6167
6551
  setSelection((current) => reconcileSelection(view, current));
6168
6552
  }, [source, view]);
6553
+ useLayoutEffect5(() => {
6554
+ if (source) drafts.settle(source.bundle);
6555
+ }, [source, drafts]);
6169
6556
  const editable = ports.editor !== void 0 && !source?.sourceRefused;
6170
6557
  const merged = useMemo12(
6171
6558
  () => ({
@@ -6175,7 +6562,7 @@ function App({
6175
6562
  }),
6176
6563
  [contributions]
6177
6564
  );
6178
- const resultSlots = useSyncExternalStore(results.subscribe, results.getSnapshot);
6565
+ const resultSlots = useSyncExternalStore2(results.subscribe, results.getSnapshot);
6179
6566
  const stackId = stack?.id;
6180
6567
  const live = useMemo12(
6181
6568
  () => source && session ? liveSlots(resultSlots, { session, treeHash: source.treeHash, stack: stackId }) : null,
@@ -6243,7 +6630,7 @@ function App({
6243
6630
  useFocusKeptOnRemoval(rootRef, rootMounted);
6244
6631
  useActionKeys(ctx && envExtras ? resolved.actions : [], ctx, runner, envExtras);
6245
6632
  if (!ctx || !view || !source || !envExtras) {
6246
- return end ? /* @__PURE__ */ jsx38(ErrorState, { message: endMessage(end) }) : null;
6633
+ return end ? /* @__PURE__ */ jsx39(ErrorState, { message: endMessage(end) }) : null;
6247
6634
  }
6248
6635
  const contextValue = {
6249
6636
  ports,
@@ -6252,6 +6639,7 @@ function App({
6252
6639
  ctx,
6253
6640
  decorations,
6254
6641
  editable,
6642
+ drafts,
6255
6643
  arrangement,
6256
6644
  updateArrangement,
6257
6645
  selection,
@@ -6265,7 +6653,7 @@ function App({
6265
6653
  const bottomPanels = resolved.panels.filter((panel) => panel.slot === "bottom");
6266
6654
  const drawerPanel = resolved.panels.find((panel) => panel.slot === "drawer");
6267
6655
  return /* @__PURE__ */ jsxs24(ErrorBoundary, { children: [
6268
- resolved.overlays.map((overlay) => /* @__PURE__ */ jsx38(
6656
+ resolved.overlays.map((overlay) => /* @__PURE__ */ jsx39(
6269
6657
  OverlayRunner,
6270
6658
  {
6271
6659
  overlay,
@@ -6275,15 +6663,15 @@ function App({
6275
6663
  },
6276
6664
  overlay.id
6277
6665
  )),
6278
- /* @__PURE__ */ jsx38(CanvasContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs24("div", { ref: rootRef, className: "lace-app", style: { height }, tabIndex: -1, children: [
6666
+ /* @__PURE__ */ jsx39(CanvasContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs24("div", { ref: rootRef, className: "lace-app", style: { height }, tabIndex: -1, children: [
6279
6667
  (toolbar.sections.length > 0 || toolbar.trailing.length > 0) && /* @__PURE__ */ jsxs24("div", { className: "lace-app__toolbar", children: [
6280
6668
  toolbar.sections.map((section, index) => /* @__PURE__ */ jsxs24(Fragment15, { children: [
6281
- index > 0 ? /* @__PURE__ */ jsx38("span", { className: "lace-app__toolbar-separator", "aria-hidden": "true" }) : null,
6669
+ index > 0 ? /* @__PURE__ */ jsx39("span", { className: "lace-app__toolbar-separator", "aria-hidden": "true" }) : null,
6282
6670
  /* @__PURE__ */ jsxs24("div", { className: "lace-app__toolbar-section", children: [
6283
6671
  section.actions.map((action) => (
6284
6672
  // `runner.busy` reads the store, whose every write
6285
6673
  // re-renders App (`resultSlots`).
6286
- /* @__PURE__ */ jsx38(
6674
+ /* @__PURE__ */ jsx39(
6287
6675
  ToolbarAction,
6288
6676
  {
6289
6677
  action,
@@ -6294,20 +6682,20 @@ function App({
6294
6682
  action.id
6295
6683
  )
6296
6684
  )),
6297
- section.panels.map((panel) => /* @__PURE__ */ jsx38(PanelSlot, { panel, ctx, tick }, panel.id))
6685
+ section.panels.map((panel) => /* @__PURE__ */ jsx39(PanelSlot, { panel, ctx, tick }, panel.id))
6298
6686
  ] })
6299
6687
  ] }, section.key ?? "")),
6300
- toolbar.trailing.length > 0 && /* @__PURE__ */ jsx38("div", { className: "lace-app__toolbar-end", children: toolbar.trailing.map((panel) => /* @__PURE__ */ jsx38(PanelSlot, { panel, ctx, tick }, panel.id)) })
6688
+ toolbar.trailing.length > 0 && /* @__PURE__ */ jsx39("div", { className: "lace-app__toolbar-end", children: toolbar.trailing.map((panel) => /* @__PURE__ */ jsx39(PanelSlot, { panel, ctx, tick }, panel.id)) })
6301
6689
  ] }),
6302
- /* @__PURE__ */ jsx38("div", { className: "lace-app__banners", children: bannerPanels.map((panel) => /* @__PURE__ */ jsx38(PanelSlot, { panel, ctx, tick }, panel.id)) }),
6690
+ /* @__PURE__ */ jsx39("div", { className: "lace-app__banners", children: bannerPanels.map((panel) => /* @__PURE__ */ jsx39(PanelSlot, { panel, ctx, tick }, panel.id)) }),
6303
6691
  /* @__PURE__ */ jsxs24("div", { className: "lace-app__body", children: [
6304
6692
  /* @__PURE__ */ jsxs24("div", { className: "lace-app__main", children: [
6305
- /* @__PURE__ */ jsx38("div", { className: "lace-app__canvas", children: /* @__PURE__ */ jsx38(ReactFlowProvider, { children: /* @__PURE__ */ jsx38(Canvas, { height: "100%" }) }) }),
6306
- /* @__PURE__ */ jsx38(BottomTabs, { panels: bottomPanels, ctx, tick })
6693
+ /* @__PURE__ */ jsx39("div", { className: "lace-app__canvas", children: /* @__PURE__ */ jsx39(ReactFlowProvider, { children: /* @__PURE__ */ jsx39(Canvas, { height: "100%" }) }) }),
6694
+ /* @__PURE__ */ jsx39(BottomTabs, { panels: bottomPanels, ctx, tick })
6307
6695
  ] }),
6308
- drawerPanel && /* @__PURE__ */ jsx38(Drawer, { label: drawerPanel.title, children: /* @__PURE__ */ jsx38(PanelSlot, { panel: drawerPanel, ctx, tick }, drawerPanel.id) })
6696
+ drawerPanel && /* @__PURE__ */ jsx39(Drawer, { label: drawerPanel.title, children: /* @__PURE__ */ jsx39(PanelSlot, { panel: drawerPanel, ctx, tick }, drawerPanel.id) })
6309
6697
  ] }),
6310
- /* @__PURE__ */ jsx38(CommandArgsForm, { form: pendingForm })
6698
+ /* @__PURE__ */ jsx39(CommandArgsForm, { form: pendingForm })
6311
6699
  ] }) })
6312
6700
  ] });
6313
6701
  }
@@ -6338,6 +6726,8 @@ function snapshotSource(input) {
6338
6726
  canUndo: false,
6339
6727
  canRedo: false,
6340
6728
  unsaved: false,
6729
+ workingDigest: "",
6730
+ savedDigest: "",
6341
6731
  ungenerated: false,
6342
6732
  conflict: null,
6343
6733
  sourceRefused: false,
@@ -6418,6 +6808,7 @@ export {
6418
6808
  conflictPanel,
6419
6809
  connectCaller,
6420
6810
  createActionRunner,
6811
+ createDraftStore,
6421
6812
  createResultStore,
6422
6813
  currentReport,
6423
6814
  decorate,