@lace-cloud/canvas 0.37.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  ApplyUnobservedError,
3
- Bundle,
4
3
  COMMANDS,
5
4
  CommandDetachedError,
6
5
  CommandExitError,
@@ -15,7 +14,6 @@ import {
15
14
  actionState,
16
15
  answering,
17
16
  bridgeCaller,
18
- carriesFailure,
19
17
  commandPathOf,
20
18
  commandUnderWay,
21
19
  connectCaller,
@@ -51,28 +49,22 @@ import {
51
49
  rowActions,
52
50
  sourceHandleId,
53
51
  targetHandleId,
54
- toArgv,
55
- uniqueDiagnostics,
56
52
  wireEndText
57
- } from "./chunk-45ZS7XCZ.mjs";
58
-
59
- // src/index.ts
60
- import { projectCanvasView as projectCanvasView2 } from "@lace-cloud/proto";
61
- import { Toast } from "@lace-cloud/ui/feedback";
53
+ } from "./chunk-GLQVTWB4.mjs";
62
54
 
63
55
  // src/App.tsx
64
56
  import { ReactFlowProvider } from "@xyflow/react";
65
57
  import {
66
- Fragment as Fragment15,
58
+ Fragment as Fragment16,
67
59
  useCallback as useCallback11,
68
60
  useEffect as useEffect13,
69
- useLayoutEffect as useLayoutEffect5,
61
+ useLayoutEffect as useLayoutEffect6,
70
62
  useMemo as useMemo12,
71
63
  useRef as useRef12,
72
64
  useState as useState17,
73
65
  useSyncExternalStore as useSyncExternalStore2
74
66
  } from "react";
75
- import "./App-IFIOMNV7.css";
67
+ import "./App-ZKO6I5AO.css";
76
68
 
77
69
  // src/Canvas.tsx
78
70
  import "@xyflow/react/dist/style.css";
@@ -85,7 +77,7 @@ import {
85
77
  useNodesInitialized,
86
78
  useReactFlow as useReactFlow3
87
79
  } from "@xyflow/react";
88
- import { useCallback as useCallback8, useEffect as useEffect9, useLayoutEffect as useLayoutEffect3, useMemo as useMemo6, useRef as useRef8, useState as useState8 } from "react";
80
+ import { useCallback as useCallback8, useEffect as useEffect9, useLayoutEffect as useLayoutEffect4, useMemo as useMemo6, useRef as useRef8, useState as useState8 } from "react";
89
81
 
90
82
  // src/components/CanvasControls.tsx
91
83
  import { IconButton } from "@lace-cloud/ui";
@@ -286,32 +278,31 @@ function isEmphasized(action, ctx) {
286
278
  }
287
279
 
288
280
  // src/utils/key-chord.ts
281
+ import { commandChord, isMacPlatform } from "@lace-cloud/ui";
282
+
283
+ // src/utils/key-spec.ts
289
284
  var BARE_KEYS = ["Delete", "Backspace"];
290
285
  var MODIFIERS = ["Mod", "Ctrl"];
291
- function parseChord(spec, mac) {
286
+
287
+ // src/utils/key-chord.ts
288
+ var MAC_GLYPHS = { Backspace: "\u232B", Delete: "\u2326" };
289
+ function keyChord(spec) {
290
+ const mac = isMacPlatform();
292
291
  if (BARE_KEYS.some((bare) => bare === spec)) {
293
- return { modifier: void 0, shift: false, key: spec };
292
+ return {
293
+ cap: mac ? MAC_GLYPHS[spec] : spec,
294
+ pressedBy: (e) => !(e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) && e.key === spec
295
+ };
294
296
  }
295
297
  const [head, ...rest] = spec.split("+");
296
298
  const modifier = MODIFIERS.find((m) => m === head);
297
299
  if (!modifier || modifier === "Ctrl" && mac) return void 0;
298
- if (rest.length === 1 && rest[0] !== "") return { modifier, shift: false, key: rest[0] };
299
- if (rest.length === 2 && rest[0] === "Shift" && rest[1] !== "") {
300
- return { modifier, shift: true, key: rest[1] };
301
- }
302
- return void 0;
303
- }
304
- var MAC_GLYPHS = { Backspace: "\u232B", Delete: "\u2326" };
305
- function formatChord(spec, mac) {
306
- const chord = parseChord(spec, mac);
307
- if (!chord) return void 0;
308
- if (!chord.modifier) return mac ? MAC_GLYPHS[chord.key] ?? chord.key : chord.key;
309
- const key = chord.key.length === 1 ? chord.key.toUpperCase() : chord.key;
310
- if (mac) return `${chord.shift ? "\u21E7" : ""}\u2318${key}`;
311
- return ["Ctrl", ...chord.shift ? ["Shift"] : [], key].join("+");
312
- }
313
- function isMacPlatform() {
314
- return typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.userAgent);
300
+ const shift = rest.length === 2 && rest[0] === "Shift";
301
+ const key = rest[rest.length - 1];
302
+ if (rest.length !== (shift ? 2 : 1) || !key) return void 0;
303
+ const chord = commandChord(key, shift);
304
+ if (modifier === "Mod") return chord;
305
+ return { cap: chord.cap, pressedBy: (e) => !e.metaKey && chord.pressedBy(e) };
315
306
  }
316
307
 
317
308
  // src/components/ContextMenu.tsx
@@ -394,7 +385,7 @@ function ContextMenu({
394
385
  children: sectionsOf(actions).map((section, index) => /* @__PURE__ */ jsxs2(Fragment2, { children: [
395
386
  index > 0 ? /* @__PURE__ */ jsx3("hr", { className: "lace-ctx-menu__separator" }) : null,
396
387
  section.actions.map((action) => {
397
- const chord = action.keys?.[0] ? formatChord(action.keys[0], isMacPlatform()) : void 0;
388
+ const chord = action.keys?.[0] ? keyChord(action.keys[0])?.cap : void 0;
398
389
  const reason = disabledReason2(action);
399
390
  return /* @__PURE__ */ jsx3(Tooltip, { content: reason, placement: "bottom-start", fullWidth: true, children: (describedBy) => /* @__PURE__ */ jsxs2(
400
391
  "button",
@@ -936,32 +927,6 @@ function gcArrangement(bundle, arrangement) {
936
927
  return changed ? next : arrangement;
937
928
  }
938
929
 
939
- // src/components/nodes/BadgeRow.tsx
940
- import { Badge as Chip } from "@lace-cloud/ui";
941
- import "./BadgeRow-KVODWDQK.css";
942
- import { jsx as jsx6 } from "react/jsx-runtime";
943
- var VARIANT = {
944
- neutral: "neutral",
945
- warn: "warning",
946
- error: "danger"
947
- };
948
- function BadgeRow({ badges }) {
949
- if (badges.length === 0) return null;
950
- return /* @__PURE__ */ jsx6("div", { className: "lace-badge-row", children: badges.map((b) => /* @__PURE__ */ jsx6(
951
- Chip,
952
- {
953
- "data-badge": b.id,
954
- "data-tone": b.tone,
955
- variant: VARIANT[b.tone],
956
- size: "md",
957
- className: "lace-badge-row__chip",
958
- title: b.title ?? b.label,
959
- children: /* @__PURE__ */ jsx6("span", { className: "lace-badge-row__text", children: b.label })
960
- },
961
- b.id
962
- )) });
963
- }
964
-
965
930
  // src/components/nodes/CallHandles.tsx
966
931
  import { Handle, Position, useUpdateNodeInternals } from "@xyflow/react";
967
932
  import { useEffect as useEffect2 } from "react";
@@ -1032,7 +997,7 @@ function pinFace(color, wired) {
1032
997
  }
1033
998
 
1034
999
  // src/components/nodes/CallHandles.tsx
1035
- import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
1000
+ import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
1036
1001
  var handleStyle = (top, side) => ({
1037
1002
  background: ANY_PIN_COLOR.fill,
1038
1003
  borderColor: ANY_PIN_COLOR.stroke,
@@ -1055,7 +1020,7 @@ var CallHandles = ({
1055
1020
  updateNodeInternals(nodeId);
1056
1021
  }, [nodeId, drawn, updateNodeInternals]);
1057
1022
  return /* @__PURE__ */ jsxs3(Fragment4, { children: [
1058
- callWired && /* @__PURE__ */ jsx7(
1023
+ callWired && /* @__PURE__ */ jsx6(
1059
1024
  Handle,
1060
1025
  {
1061
1026
  id: sourceHandleId(""),
@@ -1066,7 +1031,7 @@ var CallHandles = ({
1066
1031
  style: handleStyle(headerHeight / 2, "right")
1067
1032
  }
1068
1033
  ),
1069
- metaWired.map((meta) => /* @__PURE__ */ jsx7(
1034
+ metaWired.map((meta) => /* @__PURE__ */ jsx6(
1070
1035
  Handle,
1071
1036
  {
1072
1037
  id: targetHandleId(meta),
@@ -1101,7 +1066,7 @@ function useEditorEnvExtras() {
1101
1066
 
1102
1067
  // src/components/nodes/CardActions.tsx
1103
1068
  import "./CardActions-ORDC2L5Y.css";
1104
- import { jsx as jsx8 } from "react/jsx-runtime";
1069
+ import { jsx as jsx7 } from "react/jsx-runtime";
1105
1070
  function CardActions({ target }) {
1106
1071
  const { ctx, runner } = useCanvas();
1107
1072
  const envExtras = useEditorEnvExtras();
@@ -1120,13 +1085,13 @@ function CardActions({ target }) {
1120
1085
  );
1121
1086
  return actions.map((action) => {
1122
1087
  const state = actionState(action, ctx, runner.busy(action, ctx, target));
1123
- return /* @__PURE__ */ jsx8(
1088
+ return /* @__PURE__ */ jsx7(
1124
1089
  Tooltip2,
1125
1090
  {
1126
1091
  name: action.label,
1127
1092
  content: state.disabledReason,
1128
1093
  placement: "bottom-end",
1129
- children: (describedBy) => /* @__PURE__ */ jsx8(
1094
+ children: (describedBy) => /* @__PURE__ */ jsx7(
1130
1095
  "button",
1131
1096
  {
1132
1097
  type: "button",
@@ -1134,7 +1099,7 @@ function CardActions({ target }) {
1134
1099
  "aria-label": action.label,
1135
1100
  "aria-describedby": describedBy,
1136
1101
  ...inertProps2(isInert(state), runOnCard(action)),
1137
- children: action.icon ? /* @__PURE__ */ jsx8(CanvasIcon, { name: action.icon }) : action.label
1102
+ children: action.icon ? /* @__PURE__ */ jsx7(CanvasIcon, { name: action.icon }) : action.label
1138
1103
  }
1139
1104
  )
1140
1105
  },
@@ -1143,8 +1108,35 @@ function CardActions({ target }) {
1143
1108
  });
1144
1109
  }
1145
1110
 
1111
+ // src/components/nodes/CardDecoration.tsx
1112
+ import { StatusBadge } from "@lace-cloud/ui";
1113
+ import "./CardDecoration-VECUWURJ.css";
1114
+ import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
1115
+ var TONE = {
1116
+ neutral: "neutral",
1117
+ warn: "warn",
1118
+ error: "danger"
1119
+ };
1120
+ function CardDecoration({ badges, cloud }) {
1121
+ return /* @__PURE__ */ jsxs4(Fragment5, { children: [
1122
+ badges.length > 0 && /* @__PURE__ */ jsx8("div", { className: "lace-badge-row", children: badges.map((b) => /* @__PURE__ */ jsx8(
1123
+ StatusBadge,
1124
+ {
1125
+ "data-badge": b.id,
1126
+ "data-tone": b.tone,
1127
+ tone: TONE[b.tone],
1128
+ className: "lace-badge-row__chip",
1129
+ title: b.title ?? b.label,
1130
+ children: b.label
1131
+ },
1132
+ b.id
1133
+ )) }),
1134
+ cloud && /* @__PURE__ */ jsx8("span", { className: "lace-node-cloud", "data-cloud": "", role: "img", "aria-label": cloud.label })
1135
+ ] });
1136
+ }
1137
+
1146
1138
  // src/components/nodes/GroupNode.tsx
1147
- import "./GroupNode-2IGAUA6V.css";
1139
+ import "./GroupNode-ZTT7ELHC.css";
1148
1140
 
1149
1141
  // src/components/nodes/NodeDropTarget.tsx
1150
1142
  import { Handle as Handle2, Position as Position2, useStore as useStore3 } from "@xyflow/react";
@@ -1403,7 +1395,7 @@ function useRenameInstance() {
1403
1395
  }
1404
1396
 
1405
1397
  // src/components/nodes/GroupNode.tsx
1406
- import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
1398
+ import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
1407
1399
  var GroupHeader = ({
1408
1400
  label,
1409
1401
  memberCount,
@@ -1418,7 +1410,7 @@ var GroupHeader = ({
1418
1410
  onEditChange,
1419
1411
  onEditBlur,
1420
1412
  onEditKeyDown
1421
- }) => /* @__PURE__ */ jsxs4(
1413
+ }) => /* @__PURE__ */ jsxs5(
1422
1414
  "div",
1423
1415
  {
1424
1416
  className: `lace-group-node__header lace-group-node__header--${collapsed ? "collapsed" : "expanded"}`,
@@ -1448,7 +1440,7 @@ var GroupHeader = ({
1448
1440
  onClick: (e) => e.stopPropagation()
1449
1441
  }
1450
1442
  ) : /* @__PURE__ */ jsx10("span", { className: "lace-group-node__label", onDoubleClick, title: label, children: label }),
1451
- /* @__PURE__ */ jsxs4("span", { className: "lace-group-node__count", children: [
1443
+ /* @__PURE__ */ jsxs5("span", { className: "lace-group-node__count", children: [
1452
1444
  memberCount,
1453
1445
  " ",
1454
1446
  memberCount === 1 ? "module" : "modules"
@@ -1473,7 +1465,7 @@ var InterfacePinRow = ({
1473
1465
  [isInput ? "left" : "right"]: -5,
1474
1466
  top: NODE_ROW_HEIGHT / 2
1475
1467
  };
1476
- return /* @__PURE__ */ jsxs4(
1468
+ return /* @__PURE__ */ jsxs5(
1477
1469
  "div",
1478
1470
  {
1479
1471
  style: {
@@ -1599,7 +1591,7 @@ var GroupNode = ({ id, data }) => {
1599
1591
  ];
1600
1592
  if (collapsed) {
1601
1593
  const bare = data.interfacePins.length === 0;
1602
- return /* @__PURE__ */ jsxs4(
1594
+ return /* @__PURE__ */ jsxs5(
1603
1595
  "div",
1604
1596
  {
1605
1597
  "data-group": data.groupId,
@@ -1610,7 +1602,7 @@ var GroupNode = ({ id, data }) => {
1610
1602
  onMouseLeave: () => setHovered(false),
1611
1603
  children: [
1612
1604
  /* @__PURE__ */ jsx10(GroupHeader, { ...headerProps }),
1613
- /* @__PURE__ */ jsx10(BadgeRow, { badges: data.badges }),
1605
+ /* @__PURE__ */ jsx10(CardDecoration, { badges: data.badges, cloud: data.cloud }),
1614
1606
  callHandles,
1615
1607
  pinRows(true),
1616
1608
  editable && /* @__PURE__ */ jsx10(NodeDropTarget, {})
@@ -1618,7 +1610,7 @@ var GroupNode = ({ id, data }) => {
1618
1610
  }
1619
1611
  );
1620
1612
  }
1621
- return /* @__PURE__ */ jsxs4(
1613
+ return /* @__PURE__ */ jsxs5(
1622
1614
  "div",
1623
1615
  {
1624
1616
  "data-group": data.groupId,
@@ -1629,7 +1621,7 @@ var GroupNode = ({ id, data }) => {
1629
1621
  onMouseLeave: () => setHovered(false),
1630
1622
  children: [
1631
1623
  /* @__PURE__ */ jsx10(GroupHeader, { ...headerProps }),
1632
- /* @__PURE__ */ jsx10(BadgeRow, { badges: data.badges }),
1624
+ /* @__PURE__ */ jsx10(CardDecoration, { badges: data.badges, cloud: data.cloud }),
1633
1625
  callHandles,
1634
1626
  pinRows(false),
1635
1627
  editable && /* @__PURE__ */ jsx10(NodeDropTarget, {})
@@ -1660,13 +1652,12 @@ function hasErrorBadge(badges) {
1660
1652
  function decorate(view, overlayDecorations, diagnostics) {
1661
1653
  if (overlayDecorations.length === 0 && diagnostics.length === 0) return EMPTY_DECORATIONS;
1662
1654
  const nodes = {};
1663
- const addBadge = (nodeId, badge) => {
1664
- if (!nodes[nodeId]) nodes[nodeId] = { badges: [] };
1665
- nodes[nodeId].badges.push(badge);
1666
- };
1655
+ const at = (nodeId) => nodes[nodeId] ?? (nodes[nodeId] = { badges: [] });
1667
1656
  for (const overlayResult of overlayDecorations) {
1668
- for (const [nodeId, decoration] of Object.entries(overlayResult.nodes)) {
1669
- for (const badge of decoration.badges) addBadge(nodeId, badge);
1657
+ for (const [nodeId, { badges, cloud }] of Object.entries(overlayResult.nodes)) {
1658
+ const drawn = at(nodeId);
1659
+ drawn.badges.push(...badges);
1660
+ if (cloud) drawn.cloud = cloud;
1670
1661
  }
1671
1662
  }
1672
1663
  const byNode = /* @__PURE__ */ new Map();
@@ -1676,7 +1667,7 @@ function decorate(view, overlayDecorations, diagnostics) {
1676
1667
  byNode.set(nodeId, [...byNode.get(nodeId) ?? [], diagnostic]);
1677
1668
  }
1678
1669
  for (const [nodeId, held] of byNode) {
1679
- addBadge(nodeId, diagnosticsBadge(held));
1670
+ at(nodeId).badges.push(diagnosticsBadge(held));
1680
1671
  const pins = pinFindings(held);
1681
1672
  if (pins) nodes[nodeId].pins = pins;
1682
1673
  }
@@ -1714,7 +1705,7 @@ function typedName(name, type) {
1714
1705
  }
1715
1706
 
1716
1707
  // src/components/nodes/ModuleNode.tsx
1717
- import "./ModuleNode-3GTXKKVQ.css";
1708
+ import "./ModuleNode-6Q4ZBNGG.css";
1718
1709
 
1719
1710
  // src/components/nodes/node-config-bus.tsx
1720
1711
  import { createContext as createContext2, useContext as useContext2, useRef as useRef4 } from "react";
@@ -1736,7 +1727,7 @@ function useOpenNodeConfig() {
1736
1727
  }
1737
1728
 
1738
1729
  // src/components/nodes/ModuleNode.tsx
1739
- import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
1730
+ import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
1740
1731
  var ICON_SIZE = 16;
1741
1732
  var LABEL_ROOM = NODE_WIDTH - 28;
1742
1733
  var labelRoom = (shared) => shared ? LABEL_ROOM / 2 - 4 : LABEL_ROOM;
@@ -1761,7 +1752,7 @@ var PinRow = ({ pin, side, top, shared, problem, isConnectable }) => {
1761
1752
  top: NODE_ROW_HEIGHT2 / 2
1762
1753
  };
1763
1754
  const about = `${typedName(pin.name, pin.type)}${pin.description ? ` \u2014 ${pin.description}` : ""}`;
1764
- return /* @__PURE__ */ jsxs5(
1755
+ return /* @__PURE__ */ jsxs6(
1765
1756
  "div",
1766
1757
  {
1767
1758
  className: "lace-pin-row",
@@ -1892,7 +1883,7 @@ var ModuleNode = ({ id, data }) => {
1892
1883
  const bodyHeight = rowCount * NODE_ROW_HEIGHT2;
1893
1884
  const nodeHeight = NODE_HEADER_HEIGHT + bodyHeight;
1894
1885
  const stateClass = hasAnyError ? "lace-module-node--error" : isNew ? "lace-module-node--new" : "";
1895
- return /* @__PURE__ */ jsxs5(
1886
+ return /* @__PURE__ */ jsxs6(
1896
1887
  "div",
1897
1888
  {
1898
1889
  className: `lace-module-node${collapsed ? " lace-module-node--collapsed" : ""}${stateClass ? ` ${stateClass}` : ""}`,
@@ -1900,7 +1891,7 @@ var ModuleNode = ({ id, data }) => {
1900
1891
  onMouseEnter: () => setHovered(true),
1901
1892
  onMouseLeave: () => setHovered(false),
1902
1893
  children: [
1903
- /* @__PURE__ */ jsxs5(
1894
+ /* @__PURE__ */ jsxs6(
1904
1895
  "div",
1905
1896
  {
1906
1897
  className: "lace-module-node__header",
@@ -1953,7 +1944,7 @@ var ModuleNode = ({ id, data }) => {
1953
1944
  ]
1954
1945
  }
1955
1946
  ),
1956
- /* @__PURE__ */ jsx12(BadgeRow, { badges }),
1947
+ /* @__PURE__ */ jsx12(CardDecoration, { badges, cloud: data.cloud }),
1957
1948
  /* @__PURE__ */ jsx12(
1958
1949
  CallHandles,
1959
1950
  {
@@ -1963,7 +1954,7 @@ var ModuleNode = ({ id, data }) => {
1963
1954
  headerHeight: NODE_HEADER_HEIGHT
1964
1955
  }
1965
1956
  ),
1966
- !collapsed && /* @__PURE__ */ jsxs5("div", { className: "lace-module-node__body", style: { height: bodyHeight }, children: [
1957
+ !collapsed && /* @__PURE__ */ jsxs6("div", { className: "lace-module-node__body", style: { height: bodyHeight }, children: [
1967
1958
  shownInputs.map((pin, i) => /* @__PURE__ */ jsx12(
1968
1959
  PinRow,
1969
1960
  {
@@ -1987,7 +1978,7 @@ var ModuleNode = ({ id, data }) => {
1987
1978
  },
1988
1979
  `out:${pin.name}`
1989
1980
  )),
1990
- hiddenInputCount > 0 && /* @__PURE__ */ jsxs5(
1981
+ hiddenInputCount > 0 && /* @__PURE__ */ jsxs6(
1991
1982
  "div",
1992
1983
  {
1993
1984
  className: "lace-module-node__hidden-count",
@@ -2012,7 +2003,7 @@ var ModuleNode = ({ id, data }) => {
2012
2003
  }
2013
2004
  )
2014
2005
  ] }),
2015
- collapsed && /* @__PURE__ */ jsxs5(Fragment5, { children: [
2006
+ collapsed && /* @__PURE__ */ jsxs6(Fragment6, { children: [
2016
2007
  inputs.map((pin, i) => {
2017
2008
  const face = pinFace(pinColor(pin), !!pin.wired);
2018
2009
  return /* @__PURE__ */ jsx12(
@@ -2060,7 +2051,7 @@ var ModuleNode = ({ id, data }) => {
2060
2051
  );
2061
2052
  })
2062
2053
  ] }),
2063
- editable && /* @__PURE__ */ jsxs5(Fragment5, { children: [
2054
+ editable && /* @__PURE__ */ jsxs6(Fragment6, { children: [
2064
2055
  /* @__PURE__ */ jsx12(
2065
2056
  Handle4,
2066
2057
  {
@@ -2080,7 +2071,7 @@ var ModuleNode = ({ id, data }) => {
2080
2071
  var ModuleNode_default = ModuleNode;
2081
2072
 
2082
2073
  // src/components/PaperGrid.tsx
2083
- import "./PaperGrid-JG4GBRDP.css";
2074
+ import "./PaperGrid-NNLCTIEC.css";
2084
2075
  import { jsx as jsx13 } from "react/jsx-runtime";
2085
2076
  function PaperGrid() {
2086
2077
  return /* @__PURE__ */ jsx13("div", { className: "lace-paper-layers lace-canvas-paper", "aria-hidden": "true" });
@@ -2548,7 +2539,8 @@ var CORE_EDITOR_ACTIONS = [
2548
2539
  ];
2549
2540
 
2550
2541
  // src/core/use-action-keys.ts
2551
- import { useEffect as useEffect6 } from "react";
2542
+ import { listenKeydown } from "@lace-cloud/ui";
2543
+ import { useEffect as useEffect6, useLayoutEffect as useLayoutEffect2 } from "react";
2552
2544
 
2553
2545
  // src/contribution-types.ts
2554
2546
  var KEY_SCOPES = ["surface", "app"];
@@ -2623,45 +2615,33 @@ function useFocusKeptOnRemoval(target, mounted) {
2623
2615
  function keyScopeOf(action) {
2624
2616
  return action.keyScope ?? "surface";
2625
2617
  }
2626
- function matchesKey(e, spec, mac) {
2627
- const chord = parseChord(spec, mac);
2628
- if (!chord) return false;
2629
- const modHeld = e.metaKey || e.ctrlKey;
2630
- const held = { Mod: modHeld, Ctrl: e.ctrlKey && !e.metaKey };
2631
- if (chord.modifier ? !held[chord.modifier] : modHeld || e.altKey) return false;
2632
- if (e.shiftKey !== chord.shift) return false;
2633
- return e.key.toLowerCase() === chord.key.toLowerCase();
2634
- }
2635
2618
  function useActionKeys(actions, ctx, runner, envExtras) {
2636
- useEffect6(() => {
2619
+ useLayoutEffect2(() => {
2637
2620
  if (!ctx || !envExtras) return;
2638
2621
  const activeCtx = ctx;
2639
2622
  const activeEnvExtras = envExtras;
2640
2623
  const targets = targetsByCtx.get(ctx) ?? {};
2641
2624
  const target = {};
2642
- const mac = isMacPlatform();
2643
2625
  function bind(scope) {
2644
2626
  const { handlesFormTargets } = KEY_SCOPE_RULES[scope];
2645
2627
  const element = targets[scope];
2646
2628
  if (!element) return void 0;
2647
- const keyed = actions.filter((a) => (a.keys?.length ?? 0) > 0 && keyScopeOf(a) === scope);
2629
+ const keyed = actions.filter((a) => keyScopeOf(a) === scope).flatMap(
2630
+ (action) => (action.keys ?? []).flatMap((spec) => {
2631
+ const chord = keyChord(spec);
2632
+ return chord ? [{ action, chord }] : [];
2633
+ })
2634
+ );
2648
2635
  function onKeyDown(e) {
2649
- if (!(e instanceof KeyboardEvent)) return;
2650
2636
  if (e.defaultPrevented) return;
2651
2637
  if (!handlesFormTargets && isFormTarget(e.target)) return;
2652
- for (const action of keyed) {
2653
- for (const spec of action.keys ?? []) {
2654
- if (matchesKey(e, spec, mac)) {
2655
- e.preventDefault();
2656
- e.stopPropagation();
2657
- void runner.run(action, activeCtx, target, activeEnvExtras);
2658
- return;
2659
- }
2660
- }
2661
- }
2638
+ const hit = keyed.find(({ chord }) => chord.pressedBy(e));
2639
+ if (!hit) return;
2640
+ e.preventDefault();
2641
+ e.stopPropagation();
2642
+ void runner.run(hit.action, activeCtx, target, activeEnvExtras);
2662
2643
  }
2663
- element.addEventListener("keydown", onKeyDown);
2664
- return () => element.removeEventListener("keydown", onKeyDown);
2644
+ return listenKeydown(element, onKeyDown);
2665
2645
  }
2666
2646
  const unbind = KEY_SCOPES.map(bind);
2667
2647
  return () => {
@@ -2740,6 +2720,7 @@ function useGroupLogic(nodes, edges, groups, newNodeIds, decorations) {
2740
2720
  collapsed: true,
2741
2721
  hasErrors,
2742
2722
  badges: groupBadges,
2723
+ cloud: [group2.id, ...group2.node_ids].map((id) => decorations?.nodes[id]?.cloud).find(Boolean),
2743
2724
  interfacePins: pinsOf(group2),
2744
2725
  callWired: !!group2.call_wired,
2745
2726
  metaWired: group2.meta_wired ?? []
@@ -2757,6 +2738,7 @@ function useGroupLogic(nodes, edges, groups, newNodeIds, decorations) {
2757
2738
  collapsed: false,
2758
2739
  hasErrors: hasErrorBadge(groupBadges),
2759
2740
  badges: groupBadges,
2741
+ cloud: decorations?.nodes[group2.id]?.cloud,
2760
2742
  interfacePins: pinsOf(group2),
2761
2743
  callWired: !!group2.call_wired,
2762
2744
  metaWired: group2.meta_wired ?? []
@@ -2772,8 +2754,7 @@ function useGroupLogic(nodes, edges, groups, newNodeIds, decorations) {
2772
2754
  data: {
2773
2755
  ...n,
2774
2756
  isNew: newNodeIds.has(n.id),
2775
- badges: decorations?.nodes[n.id]?.badges,
2776
- pins: decorations?.nodes[n.id]?.pins
2757
+ ...decorations?.nodes[n.id]
2777
2758
  }
2778
2759
  });
2779
2760
  }
@@ -2851,7 +2832,7 @@ function useNewNodeTracking(view) {
2851
2832
  // src/hooks/useViewport.ts
2852
2833
  import { extentOf as extentOf2 } from "@lace-cloud/proto";
2853
2834
  import { useReactFlow as useReactFlow2 } from "@xyflow/react";
2854
- import { useCallback as useCallback7, useEffect as useEffect8, useLayoutEffect as useLayoutEffect2, useMemo as useMemo5, useRef as useRef7 } from "react";
2835
+ import { useCallback as useCallback7, useEffect as useEffect8, useLayoutEffect as useLayoutEffect3, useMemo as useMemo5, useRef as useRef7 } from "react";
2855
2836
  var FIT = { duration: 300, maxZoom: 1 };
2856
2837
  var PAN_MS = 300;
2857
2838
  var RESIZE_MS = 200;
@@ -2909,7 +2890,7 @@ function useViewport(pane, focusIds) {
2909
2890
  );
2910
2891
  const resized = useRef7((_was, _after) => {
2911
2892
  });
2912
- useLayoutEffect2(() => {
2893
+ useLayoutEffect3(() => {
2913
2894
  resized.current = (was, after) => {
2914
2895
  const from = heading()?.viewport ?? getViewport();
2915
2896
  const drawn = getNodes().filter((n) => !n.hidden);
@@ -2990,7 +2971,7 @@ function useViewport(pane, focusIds) {
2990
2971
  }
2991
2972
 
2992
2973
  // src/Canvas.tsx
2993
- import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
2974
+ import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
2994
2975
  var nodeTypes = {
2995
2976
  moduleNode: ModuleNode_default,
2996
2977
  groupNode: GroupNode_default
@@ -3058,12 +3039,7 @@ function CompositeEditor({
3058
3039
  const selectedEdgeIds = useMemo6(() => new Set(selection.edges), [selection.edges]);
3059
3040
  const [rfEdges, setRfEdges] = useState8(rfEdgesFromView);
3060
3041
  useEffect9(() => {
3061
- setRfEdges((prev) => {
3062
- const held = new Set(prev.filter((e) => e.selected).map((e) => e.id));
3063
- return rfEdgesFromView.map(
3064
- (e) => held.has(e.id) || selectedEdgeIds.has(e.id) ? { ...e, selected: true } : e
3065
- );
3066
- });
3042
+ setRfEdges(rfEdgesFromView.map((e) => ({ ...e, selected: selectedEdgeIds.has(e.id) })));
3067
3043
  }, [rfEdgesFromView, selectedEdgeIds]);
3068
3044
  const onEdgesChange = useCallback8(
3069
3045
  (changes) => {
@@ -3122,7 +3098,7 @@ function CompositeEditor({
3122
3098
  y: e.clientY
3123
3099
  });
3124
3100
  };
3125
- return /* @__PURE__ */ jsxs6(
3101
+ return /* @__PURE__ */ jsxs7(
3126
3102
  ReactFlow,
3127
3103
  {
3128
3104
  onInit,
@@ -3201,13 +3177,13 @@ function Canvas({ height }) {
3201
3177
  }, [selection.nodes, clearNew]);
3202
3178
  const [pane, setPane] = useState8(null);
3203
3179
  const surfaceRef = useRef8(null);
3204
- useEffect9(() => {
3180
+ useLayoutEffect4(() => {
3205
3181
  registerKeyTarget(ctx, "surface", surfaceRef.current);
3206
3182
  return () => registerKeyTarget(ctx, "surface", null);
3207
3183
  }, [ctx]);
3208
3184
  const onSurfacePointerDown = useCallback8((e) => {
3209
3185
  if (isFormTarget(e.target)) return;
3210
- surfaceRef.current?.focus();
3186
+ surfaceRef.current?.focus({ preventScroll: true });
3211
3187
  }, []);
3212
3188
  useFocusKeptOnRemoval(surfaceRef, true);
3213
3189
  const goToNodeRef = useRef8(null);
@@ -3215,7 +3191,7 @@ function Canvas({ height }) {
3215
3191
  goToNodeRef.current = fn;
3216
3192
  }, []);
3217
3193
  const reported = useRef8(selection);
3218
- useLayoutEffect3(() => {
3194
+ useLayoutEffect4(() => {
3219
3195
  reported.current = selection;
3220
3196
  }, [selection]);
3221
3197
  const selectNow = useCallback8(
@@ -3309,7 +3285,7 @@ function Canvas({ height }) {
3309
3285
  },
3310
3286
  [runner, menuCtx, menuTarget, makeEnvExtras]
3311
3287
  );
3312
- return /* @__PURE__ */ jsx14(NodeConfigBusProvider, { onOpen: onOpenNodeConfig, children: /* @__PURE__ */ jsxs6(
3288
+ return /* @__PURE__ */ jsx14(NodeConfigBusProvider, { onOpen: onOpenNodeConfig, children: /* @__PURE__ */ jsxs7(
3313
3289
  "div",
3314
3290
  {
3315
3291
  ref: surfaceRef,
@@ -3334,7 +3310,7 @@ function Canvas({ height }) {
3334
3310
  onDismiss: dismissContextMenu
3335
3311
  }
3336
3312
  ),
3337
- /* @__PURE__ */ jsxs6("div", { ref: setPane, style: { position: "relative", flex: "1 1 auto", minHeight: 0 }, children: [
3313
+ /* @__PURE__ */ jsxs7("div", { ref: setPane, style: { position: "relative", flex: "1 1 auto", minHeight: 0 }, children: [
3338
3314
  /* @__PURE__ */ jsx14(
3339
3315
  CompositeEditor,
3340
3316
  {
@@ -3364,8 +3340,18 @@ function Canvas({ height }) {
3364
3340
  ) });
3365
3341
  }
3366
3342
 
3343
+ // src/components/CanvasRoot.tsx
3344
+ import { forwardRef } from "react";
3345
+ import { jsx as jsx15 } from "react/jsx-runtime";
3346
+ var CanvasRoot = forwardRef(
3347
+ function CanvasRoot2(props, ref) {
3348
+ return /* @__PURE__ */ jsx15("div", { ...props, ref, "data-lace-type-set": "compact" });
3349
+ }
3350
+ );
3351
+ var CanvasRoot_default = CanvasRoot;
3352
+
3367
3353
  // src/components/Drawer.tsx
3368
- import { useCallback as useCallback9, useLayoutEffect as useLayoutEffect4, useRef as useRef9, useState as useState9 } from "react";
3354
+ import { useCallback as useCallback9, useLayoutEffect as useLayoutEffect5, useRef as useRef9, useState as useState9 } from "react";
3369
3355
 
3370
3356
  // src/utils/style-vars.ts
3371
3357
  function readTokenPx(el, name) {
@@ -3373,8 +3359,8 @@ function readTokenPx(el, name) {
3373
3359
  }
3374
3360
 
3375
3361
  // src/components/Drawer.tsx
3376
- import "./Drawer-34ZYTEWE.css";
3377
- import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
3362
+ import "./Drawer-R4IFVVJE.css";
3363
+ import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
3378
3364
  var KEY_STEP = 16;
3379
3365
  function readDrawerBounds(el) {
3380
3366
  const min = readTokenPx(el, "--lace-size-drawer-min");
@@ -3391,10 +3377,10 @@ function Drawer({ label, children }) {
3391
3377
  const [width, setWidth] = useState9(null);
3392
3378
  const [measured, setMeasured] = useState9(0);
3393
3379
  const drag = useRef9(null);
3394
- useLayoutEffect4(() => {
3380
+ useLayoutEffect5(() => {
3395
3381
  if (ref.current) setBounds(readDrawerBounds(ref.current));
3396
3382
  }, []);
3397
- useLayoutEffect4(() => {
3383
+ useLayoutEffect5(() => {
3398
3384
  if (ref.current) setMeasured(Math.round(ref.current.getBoundingClientRect().width));
3399
3385
  }, [width]);
3400
3386
  const onPointerDown = useCallback9((e) => {
@@ -3420,8 +3406,8 @@ function Drawer({ label, children }) {
3420
3406
  setWidth(clampWidth(next, bounds));
3421
3407
  };
3422
3408
  const style = width === null ? void 0 : { "--drawer-width": `${width}px` };
3423
- return /* @__PURE__ */ jsxs7("aside", { ref, className: "lace-app__drawer", "aria-label": label, style, children: [
3424
- /* @__PURE__ */ jsx15(
3409
+ return /* @__PURE__ */ jsxs8("aside", { ref, className: "lace-app__drawer", "aria-label": label, style, children: [
3410
+ /* @__PURE__ */ jsx16(
3425
3411
  "div",
3426
3412
  {
3427
3413
  className: "lace-app__drawer-handle",
@@ -3438,19 +3424,19 @@ function Drawer({ label, children }) {
3438
3424
  onKeyDown
3439
3425
  }
3440
3426
  ),
3441
- /* @__PURE__ */ jsx15("div", { className: "lace-app__drawer-body", children })
3427
+ /* @__PURE__ */ jsx16("div", { className: "lace-app__drawer-body", children })
3442
3428
  ] });
3443
3429
  }
3444
3430
 
3445
3431
  // src/components/ErrorBoundary.tsx
3446
3432
  import React from "react";
3447
3433
  import "./ErrorBoundary-IXSIVZFH.css";
3448
- import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
3434
+ import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
3449
3435
  function ErrorState({ message }) {
3450
- return /* @__PURE__ */ jsxs8("div", { className: "lace-error-state", role: "alert", children: [
3451
- /* @__PURE__ */ jsx16("h3", { className: "lace-error-state__title", children: "Something went wrong" }),
3452
- /* @__PURE__ */ jsx16("pre", { className: "lace-error-state__message", children: message }),
3453
- /* @__PURE__ */ jsx16(
3436
+ return /* @__PURE__ */ jsxs9("div", { className: "lace-error-state", role: "alert", children: [
3437
+ /* @__PURE__ */ jsx17("h3", { className: "lace-error-state__title", children: "Something went wrong" }),
3438
+ /* @__PURE__ */ jsx17("pre", { className: "lace-error-state__message", children: message }),
3439
+ /* @__PURE__ */ jsx17(
3454
3440
  "button",
3455
3441
  {
3456
3442
  type: "button",
@@ -3471,7 +3457,7 @@ var ErrorBoundary = class extends React.Component {
3471
3457
  }
3472
3458
  render() {
3473
3459
  if (this.state.error) {
3474
- return /* @__PURE__ */ jsx16(ErrorState, { message: this.state.error.message });
3460
+ return /* @__PURE__ */ jsx17(ErrorState, { message: this.state.error.message });
3475
3461
  }
3476
3462
  return this.props.children;
3477
3463
  }
@@ -3480,26 +3466,25 @@ var ErrorBoundary = class extends React.Component {
3480
3466
  // src/components/ToolbarAction.tsx
3481
3467
  import { Button, IconButton as IconButton2, Spinner } from "@lace-cloud/ui";
3482
3468
  import "./ToolbarAction-PQNWHJSU.css";
3483
- import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
3469
+ import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
3484
3470
  var TIP = "bottom-start";
3485
3471
  function actionTip(keys, reason) {
3486
- const chord = keys?.[0] ? formatChord(keys[0], isMacPlatform()) : void 0;
3472
+ const chord = keys?.[0] ? keyChord(keys[0])?.cap : void 0;
3487
3473
  if (!chord && !reason) return void 0;
3488
- return /* @__PURE__ */ jsxs9("span", { className: "lace-action-tip", children: [
3489
- chord ? /* @__PURE__ */ jsx17("kbd", { className: "lace-action-tip__key", children: chord }) : null,
3490
- reason ? /* @__PURE__ */ jsx17("span", { className: "lace-action-tip__reason", children: reason }) : null
3474
+ return /* @__PURE__ */ jsxs10("span", { className: "lace-action-tip", children: [
3475
+ chord ? /* @__PURE__ */ jsx18("kbd", { className: "lace-action-tip__key", children: chord }) : null,
3476
+ reason ? /* @__PURE__ */ jsx18("span", { className: "lace-action-tip__reason", children: reason }) : null
3491
3477
  ] });
3492
3478
  }
3493
3479
  function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, busyLabel, onRun }) {
3494
3480
  const busy = busyLabel !== void 0;
3495
3481
  const inert = isInert({ disabledReason: disabledReason2, busyLabel });
3496
3482
  const tooltip = actionTip(action.keys, disabledReason2);
3497
- const glyph = action.icon ? /* @__PURE__ */ jsx17(CanvasIcon, { name: action.icon }) : void 0;
3483
+ const glyph = action.icon ? /* @__PURE__ */ jsx18(CanvasIcon, { name: action.icon }) : void 0;
3498
3484
  if (action.primary) {
3499
- return /* @__PURE__ */ jsx17(
3485
+ return /* @__PURE__ */ jsx18(
3500
3486
  Button,
3501
3487
  {
3502
- rung: true,
3503
3488
  size: "sm",
3504
3489
  variant: emphasized && !inert ? "primary" : "secondary",
3505
3490
  icon: busy ? void 0 : glyph,
@@ -3515,10 +3500,10 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
3515
3500
  );
3516
3501
  }
3517
3502
  if (glyph) {
3518
- return /* @__PURE__ */ jsx17(
3503
+ return /* @__PURE__ */ jsx18(
3519
3504
  IconButton2,
3520
3505
  {
3521
- icon: busy ? /* @__PURE__ */ jsx17(Spinner, { size: 14, "aria-hidden": "true" }) : glyph,
3506
+ icon: busy ? /* @__PURE__ */ jsx18(Spinner, { size: 14, "aria-hidden": "true" }) : glyph,
3522
3507
  "aria-label": action.label,
3523
3508
  size: "md",
3524
3509
  "aria-disabled": inert,
@@ -3528,10 +3513,9 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
3528
3513
  }
3529
3514
  );
3530
3515
  }
3531
- return /* @__PURE__ */ jsx17(
3516
+ return /* @__PURE__ */ jsx18(
3532
3517
  Button,
3533
3518
  {
3534
- rung: true,
3535
3519
  size: "sm",
3536
3520
  variant: "ghost",
3537
3521
  loading: busy,
@@ -3548,7 +3532,7 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
3548
3532
 
3549
3533
  // src/core/CommandArgsForm.tsx
3550
3534
  import { useState as useState10 } from "react";
3551
- import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
3535
+ import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
3552
3536
  function flagsOf(path) {
3553
3537
  return COMMANDS[path].flags;
3554
3538
  }
@@ -3556,7 +3540,7 @@ function CommandArgsForm({ form }) {
3556
3540
  const [values, setValues] = useState10({});
3557
3541
  if (!form) return null;
3558
3542
  const flags = isCommandPath(form.path) ? flagsOf(form.path) : {};
3559
- return /* @__PURE__ */ jsxs10(
3543
+ return /* @__PURE__ */ jsxs11(
3560
3544
  "form",
3561
3545
  {
3562
3546
  className: "lace-command-args-form",
@@ -3567,16 +3551,16 @@ function CommandArgsForm({ form }) {
3567
3551
  children: [
3568
3552
  form.missing.map((key) => {
3569
3553
  const flagType = flags[key]?.type;
3570
- return /* @__PURE__ */ jsxs10("label", { className: "lace-command-args-form__field", children: [
3571
- /* @__PURE__ */ jsx18("span", { children: key }),
3572
- flagType === "bool" ? /* @__PURE__ */ jsx18(
3554
+ return /* @__PURE__ */ jsxs11("label", { className: "lace-command-args-form__field", children: [
3555
+ /* @__PURE__ */ jsx19("span", { children: key }),
3556
+ flagType === "bool" ? /* @__PURE__ */ jsx19(
3573
3557
  "input",
3574
3558
  {
3575
3559
  type: "checkbox",
3576
3560
  checked: Boolean(values[key]),
3577
3561
  onChange: (e) => setValues((prev) => ({ ...prev, [key]: e.target.checked }))
3578
3562
  }
3579
- ) : /* @__PURE__ */ jsx18(
3563
+ ) : /* @__PURE__ */ jsx19(
3580
3564
  "input",
3581
3565
  {
3582
3566
  type: "text",
@@ -3587,9 +3571,9 @@ function CommandArgsForm({ form }) {
3587
3571
  )
3588
3572
  ] }, key);
3589
3573
  }),
3590
- /* @__PURE__ */ jsxs10("div", { className: "lace-command-args-form__actions", children: [
3591
- /* @__PURE__ */ jsx18("button", { type: "submit", children: "Continue" }),
3592
- /* @__PURE__ */ jsx18("button", { type: "button", onClick: form.cancel, children: "Cancel" })
3574
+ /* @__PURE__ */ jsxs11("div", { className: "lace-command-args-form__actions", children: [
3575
+ /* @__PURE__ */ jsx19("button", { type: "submit", children: "Continue" }),
3576
+ /* @__PURE__ */ jsx19("button", { type: "button", onClick: form.cancel, children: "Cancel" })
3593
3577
  ] })
3594
3578
  ]
3595
3579
  }
@@ -3607,7 +3591,7 @@ import { useEffect as useEffect10, useMemo as useMemo8, useRef as useRef10, useS
3607
3591
 
3608
3592
  // src/core/panel-scope.tsx
3609
3593
  import { createContext as createContext3, useContext as useContext3, useMemo as useMemo7 } from "react";
3610
- import { jsx as jsx19 } from "react/jsx-runtime";
3594
+ import { jsx as jsx20 } from "react/jsx-runtime";
3611
3595
  var noopReportError = () => {
3612
3596
  };
3613
3597
  var PanelScopeContext = createContext3(null);
@@ -3624,7 +3608,7 @@ function PanelScope({
3624
3608
  () => ({ ctx, target, paths: new Set(paths), tick, reportError }),
3625
3609
  [ctx, target, paths, tick, reportError]
3626
3610
  );
3627
- return /* @__PURE__ */ jsx19(PanelScopeContext.Provider, { value, children });
3611
+ return /* @__PURE__ */ jsx20(PanelScopeContext.Provider, { value, children });
3628
3612
  }
3629
3613
  function usePanelScope() {
3630
3614
  const value = useContext3(PanelScopeContext);
@@ -3716,6 +3700,7 @@ function defineOverlay(o) {
3716
3700
  return {
3717
3701
  id: o.id,
3718
3702
  paths: [o.read.path],
3703
+ requiredContext: o.requiredContext,
3719
3704
  useDecorations(ctx) {
3720
3705
  const { data } = useCommandRead(o.read);
3721
3706
  const view = ctx.view;
@@ -3728,6 +3713,14 @@ function defineOverlay(o) {
3728
3713
  }
3729
3714
 
3730
3715
  // src/core/overlays/describe.ts
3716
+ function resourcesByNode(view, resources) {
3717
+ const counts = /* @__PURE__ */ new Map();
3718
+ for (const { address } of resources) {
3719
+ const nodeId = nodeIdForAddress(view, address);
3720
+ if (nodeId !== null) counts.set(nodeId, (counts.get(nodeId) ?? 0) + 1);
3721
+ }
3722
+ return counts;
3723
+ }
3731
3724
  function decorateDescribe(view, data) {
3732
3725
  const nodes = {};
3733
3726
  const addBadge = (nodeId, badge) => {
@@ -3735,13 +3728,7 @@ function decorateDescribe(view, data) {
3735
3728
  nodes[nodeId].badges.push(badge);
3736
3729
  };
3737
3730
  if (data.state) {
3738
- const countByNode = /* @__PURE__ */ new Map();
3739
- for (const resource of data.state.resources) {
3740
- const nodeId = nodeIdForAddress(view, resource.address);
3741
- if (nodeId === null) continue;
3742
- countByNode.set(nodeId, (countByNode.get(nodeId) ?? 0) + 1);
3743
- }
3744
- for (const [nodeId, count] of countByNode) {
3731
+ for (const [nodeId, count] of resourcesByNode(view, data.state.resources)) {
3745
3732
  addBadge(nodeId, {
3746
3733
  id: "resources",
3747
3734
  tone: "neutral",
@@ -3771,29 +3758,47 @@ var describeOverlay = defineOverlay({
3771
3758
  decorate: decorateDescribe
3772
3759
  });
3773
3760
 
3761
+ // src/core/overlays/plan.ts
3762
+ function decoratePlan(view, data) {
3763
+ const nodes = {};
3764
+ for (const [nodeId, count] of resourcesByNode(view, data.plan?.resources ?? [])) {
3765
+ nodes[nodeId] = { badges: [], cloud: { label: counted(count, "planned change") } };
3766
+ }
3767
+ return { nodes };
3768
+ }
3769
+ var planOverlay = defineOverlay({
3770
+ id: "plan",
3771
+ read: {
3772
+ path: "run plan",
3773
+ args: (ctx) => ctx.run ? { run: ctx.run.id } : null
3774
+ },
3775
+ requiredContext: ["run"],
3776
+ decorate: decoratePlan
3777
+ });
3778
+
3774
3779
  // src/core/panels/RowActionBanner.tsx
3775
3780
  import { Button as Button2 } from "@lace-cloud/ui";
3776
3781
 
3777
3782
  // src/components/Banner.tsx
3778
- import "./Banner-4TSIKYLF.css";
3779
- import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
3783
+ import "./Banner-V657C2TO.css";
3784
+ import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
3780
3785
  function Banner({ severity, message, className, actions }) {
3781
- return /* @__PURE__ */ jsxs11(
3786
+ return /* @__PURE__ */ jsxs12(
3782
3787
  "div",
3783
3788
  {
3784
3789
  className: `lace-banner lace-banner--${severity} ${className}`,
3785
3790
  role: severity === "error" ? "alert" : "status",
3786
3791
  children: [
3787
- /* @__PURE__ */ jsx20("span", { className: "lace-banner__icon", children: /* @__PURE__ */ jsx20(CanvasIcon, { name: severity }) }),
3788
- /* @__PURE__ */ jsx20("span", { className: "lace-banner__message", children: message }),
3789
- actions ? /* @__PURE__ */ jsx20("span", { className: "lace-banner__actions", children: actions }) : null
3792
+ /* @__PURE__ */ jsx21("span", { className: "lace-banner__icon", children: /* @__PURE__ */ jsx21(CanvasIcon, { name: severity }) }),
3793
+ /* @__PURE__ */ jsx21("span", { className: "lace-banner__message", children: message }),
3794
+ actions ? /* @__PURE__ */ jsx21("span", { className: "lace-banner__actions", children: actions }) : null
3790
3795
  ]
3791
3796
  }
3792
3797
  );
3793
3798
  }
3794
3799
 
3795
3800
  // src/core/panels/RowActionBanner.tsx
3796
- import { jsx as jsx21 } from "react/jsx-runtime";
3801
+ import { jsx as jsx22 } from "react/jsx-runtime";
3797
3802
  function bannerMessage(opening, actions) {
3798
3803
  return [opening, ...actions.flatMap((action) => action.choice ? [action.choice] : [])].join(
3799
3804
  " "
@@ -3803,7 +3808,7 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
3803
3808
  const { runner } = useCanvas();
3804
3809
  const envExtras = useEditorEnvExtras();
3805
3810
  const actions = rowActionsFor(ctx, panelId);
3806
- return /* @__PURE__ */ jsx21(
3811
+ return /* @__PURE__ */ jsx22(
3807
3812
  Banner,
3808
3813
  {
3809
3814
  severity,
@@ -3811,10 +3816,9 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
3811
3816
  message: bannerMessage(opening, actions),
3812
3817
  actions: actions.length === 0 ? void 0 : actions.map((action) => {
3813
3818
  const state = actionState(action, ctx, runner.busy(action, ctx, {}));
3814
- return /* @__PURE__ */ jsx21(
3819
+ return /* @__PURE__ */ jsx22(
3815
3820
  Button2,
3816
3821
  {
3817
- rung: true,
3818
3822
  size: "sm",
3819
3823
  variant: "secondary",
3820
3824
  className: `${className}__${action.id}`,
@@ -3832,9 +3836,9 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
3832
3836
  }
3833
3837
 
3834
3838
  // src/core/panels/ConflictBanner.tsx
3835
- import { jsx as jsx22 } from "react/jsx-runtime";
3839
+ import { jsx as jsx23 } from "react/jsx-runtime";
3836
3840
  function ConflictBanner({ ctx }) {
3837
- return /* @__PURE__ */ jsx22(
3841
+ return /* @__PURE__ */ jsx23(
3838
3842
  RowActionBanner,
3839
3843
  {
3840
3844
  ctx,
@@ -3858,17 +3862,17 @@ var conflictPanel = {
3858
3862
  import { Button as Button3 } from "@lace-cloud/ui";
3859
3863
 
3860
3864
  // src/components/Identifier.tsx
3861
- import { Fragment as Fragment6 } from "react";
3865
+ import { Fragment as Fragment7 } from "react";
3862
3866
  import "./Identifier-V6MZ37EG.css";
3863
- import { jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
3867
+ import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
3864
3868
  function identifierSegments(text) {
3865
3869
  return text.split(/(?<=[_.])/);
3866
3870
  }
3867
3871
  function Identifier({ text, className }) {
3868
- return /* @__PURE__ */ jsx23("span", { className: className ? `lace-identifier ${className}` : "lace-identifier", children: identifierSegments(text).map((segment, i) => (
3872
+ return /* @__PURE__ */ jsx24("span", { className: className ? `lace-identifier ${className}` : "lace-identifier", children: identifierSegments(text).map((segment, i) => (
3869
3873
  // biome-ignore lint/suspicious/noArrayIndexKey: a segment's place in the name is its identity.
3870
- /* @__PURE__ */ jsxs12(Fragment6, { children: [
3871
- i > 0 ? /* @__PURE__ */ jsx23("wbr", {}) : null,
3874
+ /* @__PURE__ */ jsxs13(Fragment7, { children: [
3875
+ i > 0 ? /* @__PURE__ */ jsx24("wbr", {}) : null,
3872
3876
  segment
3873
3877
  ] }, i)
3874
3878
  )) });
@@ -3876,7 +3880,7 @@ function Identifier({ text, className }) {
3876
3880
 
3877
3881
  // src/core/panels/DiagnosticsPanel.tsx
3878
3882
  import "./DiagnosticsPanel-MSK72CGM.css";
3879
- import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
3883
+ import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
3880
3884
  function locationOf(file, line) {
3881
3885
  return line === void 0 ? file : `${file}:${line}`;
3882
3886
  }
@@ -3887,39 +3891,38 @@ function DiagnosticsPanel({ ctx }) {
3887
3891
  const { runner } = useCanvas();
3888
3892
  const envExtras = useEditorEnvExtras();
3889
3893
  const diagnostics = ctx.diagnostics;
3890
- return /* @__PURE__ */ jsx24("ul", { className: "lace-diagnostics-panel", role: "list", children: diagnostics.map((d, index) => {
3894
+ return /* @__PURE__ */ jsx25("ul", { className: "lace-diagnostics-panel", role: "list", children: diagnostics.map((d, index) => {
3891
3895
  const key = rowKey(d, index);
3892
3896
  const target = { diagnostic: d };
3893
3897
  const actions = rowActionsFor(ctx, "diagnostics", target);
3894
- return /* @__PURE__ */ jsxs13(
3898
+ return /* @__PURE__ */ jsxs14(
3895
3899
  "li",
3896
3900
  {
3897
3901
  className: `lace-diagnostics-panel__row lace-diagnostics-panel__row--${d.severity}`,
3898
3902
  children: [
3899
- /* @__PURE__ */ jsx24("span", { className: "lace-diagnostics-panel__icon", children: /* @__PURE__ */ jsx24(CanvasIcon, { name: d.severity }) }),
3900
- /* @__PURE__ */ jsxs13("span", { className: "lace-diagnostics-panel__body", children: [
3901
- /* @__PURE__ */ jsx24("span", { className: "lace-diagnostics-panel__message", children: d.message }),
3902
- d.file !== void 0 && /* @__PURE__ */ jsx24(
3903
+ /* @__PURE__ */ jsx25("span", { className: "lace-diagnostics-panel__icon", children: /* @__PURE__ */ jsx25(CanvasIcon, { name: d.severity }) }),
3904
+ /* @__PURE__ */ jsxs14("span", { className: "lace-diagnostics-panel__body", children: [
3905
+ /* @__PURE__ */ jsx25("span", { className: "lace-diagnostics-panel__message", children: d.message }),
3906
+ d.file !== void 0 && /* @__PURE__ */ jsx25(
3903
3907
  Identifier,
3904
3908
  {
3905
3909
  className: "lace-diagnostics-panel__file",
3906
3910
  text: locationOf(d.file, d.line)
3907
3911
  }
3908
3912
  ),
3909
- d.instance_id !== void 0 && /* @__PURE__ */ jsx24(
3913
+ d.instance_id !== void 0 && /* @__PURE__ */ jsx25(
3910
3914
  Identifier,
3911
3915
  {
3912
3916
  className: "lace-diagnostics-panel__where",
3913
3917
  text: d.input_name ? `${d.instance_id}.${d.input_name}` : d.instance_id
3914
3918
  }
3915
3919
  ),
3916
- d.code !== void 0 && /* @__PURE__ */ jsx24(Identifier, { className: "lace-diagnostics-panel__code", text: d.code }),
3920
+ d.code !== void 0 && /* @__PURE__ */ jsx25(Identifier, { className: "lace-diagnostics-panel__code", text: d.code }),
3917
3921
  actions.map((action) => {
3918
3922
  const state = actionState(action, ctx, runner.busy(action, ctx, target));
3919
- return /* @__PURE__ */ jsx24(
3923
+ return /* @__PURE__ */ jsx25(
3920
3924
  Button3,
3921
3925
  {
3922
- rung: true,
3923
3926
  size: "sm",
3924
3927
  variant: "ghost",
3925
3928
  className: "lace-diagnostics-panel__action",
@@ -3958,7 +3961,7 @@ import { createElement } from "react";
3958
3961
  // src/components/panels/EdgeInspectorPanel.tsx
3959
3962
  import { Button as Button4, Panel } from "@lace-cloud/ui";
3960
3963
  import "./EdgeInspectorPanel-JD6CVUAT.css";
3961
- import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
3964
+ import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
3962
3965
  var pinText = (node, pin, end) => `${node}.${end === "source" ? "outputs" : "inputs"}.${pin}`;
3963
3966
  function EdgeInspectorPanel({
3964
3967
  source,
@@ -3970,12 +3973,12 @@ function EdgeInspectorPanel({
3970
3973
  onDelete,
3971
3974
  onClose
3972
3975
  }) {
3973
- const title = /* @__PURE__ */ jsxs14("div", { children: [
3974
- /* @__PURE__ */ jsx25("div", { className: "lace-edge-panel__title-eyebrow", children: "Connection" }),
3975
- /* @__PURE__ */ jsxs14("div", { className: "lace-edge-panel__title", children: [
3976
- /* @__PURE__ */ jsx25(Identifier, { text: source }),
3976
+ const title = /* @__PURE__ */ jsxs15("div", { children: [
3977
+ /* @__PURE__ */ jsx26("div", { className: "lace-edge-panel__title-eyebrow", children: "Connection" }),
3978
+ /* @__PURE__ */ jsxs15("div", { className: "lace-edge-panel__title", children: [
3979
+ /* @__PURE__ */ jsx26(Identifier, { text: source }),
3977
3980
  " \u2192 ",
3978
- /* @__PURE__ */ jsx25(Identifier, { text: target })
3981
+ /* @__PURE__ */ jsx26(Identifier, { text: target })
3979
3982
  ] })
3980
3983
  ] });
3981
3984
  const wire = {
@@ -3988,15 +3991,15 @@ function EdgeInspectorPanel({
3988
3991
  };
3989
3992
  const sourceText = wireEndText(wire, "source", pinText);
3990
3993
  const targetText = wireEndText(wire, "target", pinText);
3991
- const footer = onDelete ? /* @__PURE__ */ jsx25(Button4, { rung: true, variant: "danger", fullWidth: true, onClick: onDelete, children: "Delete connection" }) : void 0;
3992
- return /* @__PURE__ */ jsxs14(Panel, { title, footer, onClose, children: [
3993
- /* @__PURE__ */ jsx25("div", { className: "lace-edge-panel__section-label", children: "Wiring" }),
3994
- /* @__PURE__ */ jsxs14("div", { className: "lace-edge-panel__wiring", children: [
3995
- /* @__PURE__ */ jsx25(Identifier, { text: sourceText }),
3996
- /* @__PURE__ */ jsx25("div", { className: "lace-edge-panel__wiring-arrow", children: "\u2193" }),
3997
- /* @__PURE__ */ jsx25(Identifier, { text: targetText })
3994
+ const footer = onDelete ? /* @__PURE__ */ jsx26(Button4, { variant: "danger", fullWidth: true, onClick: onDelete, children: "Delete connection" }) : void 0;
3995
+ return /* @__PURE__ */ jsxs15(Panel, { title, footer, onClose, children: [
3996
+ /* @__PURE__ */ jsx26("div", { className: "lace-edge-panel__section-label", children: "Wiring" }),
3997
+ /* @__PURE__ */ jsxs15("div", { className: "lace-edge-panel__wiring", children: [
3998
+ /* @__PURE__ */ jsx26(Identifier, { text: sourceText }),
3999
+ /* @__PURE__ */ jsx26("div", { className: "lace-edge-panel__wiring-arrow", children: "\u2193" }),
4000
+ /* @__PURE__ */ jsx26(Identifier, { text: targetText })
3998
4001
  ] }),
3999
- 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." })
4002
+ onDelete && /* @__PURE__ */ jsx26("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." })
4000
4003
  ] });
4001
4004
  }
4002
4005
 
@@ -4061,10 +4064,10 @@ var edgeInspectorPanel = {
4061
4064
  };
4062
4065
 
4063
4066
  // src/core/panels/Markers.tsx
4064
- import { Badge } from "@lace-cloud/ui";
4065
- import { jsx as jsx26 } from "react/jsx-runtime";
4067
+ import { StatusBadge as StatusBadge2 } from "@lace-cloud/ui";
4068
+ import { jsx as jsx27 } from "react/jsx-runtime";
4066
4069
  function UnsavedMarker() {
4067
- return /* @__PURE__ */ jsx26(Badge, { variant: "warning", dot: true, role: "status", className: "lace-marker lace-marker--unsaved", children: "Unsaved" });
4070
+ return /* @__PURE__ */ jsx27(StatusBadge2, { tone: "warn", role: "status", className: "lace-marker lace-marker--unsaved", children: "Unsaved" });
4068
4071
  }
4069
4072
  var unsavedMarker = {
4070
4073
  id: "unsaved-marker",
@@ -4076,7 +4079,7 @@ var unsavedMarker = {
4076
4079
  Component: UnsavedMarker
4077
4080
  };
4078
4081
  function UngeneratedMarker() {
4079
- return /* @__PURE__ */ jsx26(Badge, { variant: "neutral", role: "status", className: "lace-marker lace-marker--ungenerated", children: "Not generated" });
4082
+ return /* @__PURE__ */ jsx27(StatusBadge2, { tone: "neutral", role: "status", className: "lace-marker lace-marker--ungenerated", children: "Not generated" });
4080
4083
  }
4081
4084
  var ungeneratedMarker = {
4082
4085
  id: "ungenerated-marker",
@@ -4098,8 +4101,8 @@ import {
4098
4101
  Button as Button12,
4099
4102
  IconButton as IconButton9,
4100
4103
  Input as Input8,
4101
- ModeToggle,
4102
4104
  Panel as Panel6,
4105
+ SegmentedControl,
4103
4106
  Textarea as Textarea3
4104
4107
  } from "@lace-cloud/ui";
4105
4108
  import { useMemo as useMemo11 } from "react";
@@ -4109,8 +4112,14 @@ import { useSyncExternalStore } from "react";
4109
4112
 
4110
4113
  // src/hooks/useUpdateState.ts
4111
4114
  import { useCallback as useCallback10, useEffect as useEffect11, useRef as useRef11, useState as useState12 } from "react";
4115
+
4116
+ // src/utils/update-error.ts
4117
+ var UPDATE_FAILURE = "The update could not be applied.";
4118
+
4119
+ // src/hooks/useUpdateState.ts
4112
4120
  function useUpdateState(updateFn) {
4113
4121
  const [status, setStatus] = useState12("idle");
4122
+ const [error, setError] = useState12(null);
4114
4123
  const mountedRef = useRef11(true);
4115
4124
  const resetTimerRef = useRef11(null);
4116
4125
  const safeSetStatus = useCallback10((next) => {
@@ -4127,14 +4136,21 @@ function useUpdateState(updateFn) {
4127
4136
  [safeSetStatus]
4128
4137
  );
4129
4138
  const handleUpdate = useCallback10(async () => {
4139
+ if (resetTimerRef.current !== null) {
4140
+ clearTimeout(resetTimerRef.current);
4141
+ resetTimerRef.current = null;
4142
+ }
4143
+ if (mountedRef.current) setError(null);
4130
4144
  safeSetStatus("updating");
4131
4145
  try {
4132
4146
  await updateFn();
4133
4147
  safeSetStatus("updated");
4134
4148
  scheduleReset(1500);
4135
- } catch {
4149
+ } catch (cause) {
4150
+ if (mountedRef.current) {
4151
+ setError(cause instanceof Error && cause.message.trim() ? cause.message : UPDATE_FAILURE);
4152
+ }
4136
4153
  safeSetStatus("error");
4137
- scheduleReset(2e3);
4138
4154
  }
4139
4155
  }, [updateFn, safeSetStatus, scheduleReset]);
4140
4156
  useEffect11(() => {
@@ -4147,7 +4163,7 @@ function useUpdateState(updateFn) {
4147
4163
  }
4148
4164
  };
4149
4165
  }, []);
4150
- return { status, handleUpdate };
4166
+ return { status, error, handleUpdate };
4151
4167
  }
4152
4168
 
4153
4169
  // src/hooks/useDraft.ts
@@ -4156,7 +4172,7 @@ function useDraft(kind, params, seed, send) {
4156
4172
  const held = useSyncExternalStore(store.subscribe, () => store.read(kind, params));
4157
4173
  const live = editable && held ? keeping(held.drafts, unsettledIn(seed)) : NO_DRAFTS;
4158
4174
  const value = { ...seed, ...Object.fromEntries(live) };
4159
- const { status, handleUpdate } = useUpdateState(async () => {
4175
+ const { status, error, handleUpdate } = useUpdateState(async () => {
4160
4176
  const sent2 = value;
4161
4177
  try {
4162
4178
  await send(sent2);
@@ -4169,6 +4185,7 @@ function useDraft(kind, params, seed, send) {
4169
4185
  return {
4170
4186
  value,
4171
4187
  dirty,
4188
+ error,
4172
4189
  set: (key, next) => store.set(kind, params, key, next, seed),
4173
4190
  status: held?.sending ? "updating" : status === "updated" && dirty ? "idle" : status,
4174
4191
  update: async () => {
@@ -4180,11 +4197,11 @@ function useDraft(kind, params, seed, send) {
4180
4197
  // src/components/AccordionSection.tsx
4181
4198
  import { useState as useState13 } from "react";
4182
4199
  import "./AccordionSection-5X2XWUYY.css";
4183
- import { jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
4200
+ import { jsx as jsx28, jsxs as jsxs16 } from "react/jsx-runtime";
4184
4201
  function AccordionSection({ title, defaultOpen = false, badge, children }) {
4185
4202
  const [open, setOpen] = useState13(defaultOpen);
4186
- return /* @__PURE__ */ jsxs15("div", { className: `lace-accordion${open ? " lace-accordion--open" : ""}`, children: [
4187
- /* @__PURE__ */ jsxs15(
4203
+ return /* @__PURE__ */ jsxs16("div", { className: `lace-accordion${open ? " lace-accordion--open" : ""}`, children: [
4204
+ /* @__PURE__ */ jsxs16(
4188
4205
  "button",
4189
4206
  {
4190
4207
  type: "button",
@@ -4192,27 +4209,27 @@ function AccordionSection({ title, defaultOpen = false, badge, children }) {
4192
4209
  onClick: () => setOpen((v) => !v),
4193
4210
  "aria-expanded": open,
4194
4211
  children: [
4195
- /* @__PURE__ */ jsx27("span", { className: "lace-accordion__chevron", children: /* @__PURE__ */ jsx27(CanvasIcon, { name: "chevron-right" }) }),
4196
- /* @__PURE__ */ jsx27("span", { className: "lace-accordion__title", children: title }),
4197
- badge && /* @__PURE__ */ jsx27("span", { className: "lace-accordion__badge", children: badge })
4212
+ /* @__PURE__ */ jsx28("span", { className: "lace-accordion__chevron", children: /* @__PURE__ */ jsx28(CanvasIcon, { name: "chevron-right" }) }),
4213
+ /* @__PURE__ */ jsx28("span", { className: "lace-accordion__title", children: title }),
4214
+ badge && /* @__PURE__ */ jsx28("span", { className: "lace-accordion__badge", children: badge })
4198
4215
  ]
4199
4216
  }
4200
4217
  ),
4201
- /* @__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 }) }) })
4218
+ /* @__PURE__ */ jsx28("div", { className: "lace-accordion__body", children: /* @__PURE__ */ jsx28("div", { className: "lace-accordion__body-inner", children: /* @__PURE__ */ jsx28("div", { className: "lace-accordion__body-content", children }) }) })
4202
4219
  ] });
4203
4220
  }
4204
4221
 
4205
4222
  // src/components/panels/ModuleConfigPanel.tsx
4206
4223
  import "./ModuleConfigPanel-DW3RSOEL.css";
4207
- import "./panels-shared-3HUQC7TC.css";
4224
+ import "./panels-shared-Y4ULZZLB.css";
4208
4225
 
4209
4226
  // src/components/UpdateButton.tsx
4210
4227
  import { Button as Button5 } from "@lace-cloud/ui";
4211
- import "./UpdateButton-VSIHLAZC.css";
4212
- import { jsx as jsx28 } from "react/jsx-runtime";
4228
+ import "./UpdateButton-JJ4WELPG.css";
4229
+ import { jsx as jsx29, jsxs as jsxs17 } from "react/jsx-runtime";
4213
4230
  var variantByStatus = {
4214
4231
  updating: "primary",
4215
- updated: "success",
4232
+ updated: "secondary",
4216
4233
  error: "danger"
4217
4234
  };
4218
4235
  var labelByStatus = {
@@ -4225,19 +4242,29 @@ function variantOf({ status, dirty }, blocked) {
4225
4242
  return dirty && blocked === void 0 ? "primary" : "secondary";
4226
4243
  }
4227
4244
  function UpdateButton({ draft, label, blocked }) {
4228
- return /* @__PURE__ */ jsx28("div", { className: "lace-commit-foot", children: /* @__PURE__ */ jsx28(
4229
- Button5,
4230
- {
4231
- rung: true,
4232
- variant: variantOf(draft, blocked),
4233
- fullWidth: true,
4234
- loading: draft.status === "updating",
4235
- "aria-disabled": blocked !== void 0 || draft.status === "updated",
4236
- onClick: draft.update,
4237
- tooltip: blocked,
4238
- children: draft.status === "idle" ? label : labelByStatus[draft.status]
4239
- }
4240
- ) });
4245
+ return /* @__PURE__ */ jsxs17("div", { className: "lace-commit-foot", children: [
4246
+ draft.status === "error" && draft.error && /* @__PURE__ */ jsx29("p", { className: "lace-commit-foot__error", role: "alert", children: draft.error }),
4247
+ /* @__PURE__ */ jsx29(
4248
+ Button5,
4249
+ {
4250
+ variant: variantOf(draft, blocked),
4251
+ fullWidth: true,
4252
+ loading: draft.status === "updating",
4253
+ "aria-disabled": blocked !== void 0 || draft.status === "updated",
4254
+ onClick: draft.update,
4255
+ tooltip: blocked,
4256
+ children: draft.status === "idle" ? label : labelByStatus[draft.status]
4257
+ }
4258
+ )
4259
+ ] });
4260
+ }
4261
+
4262
+ // src/components/panels/assert-applied.ts
4263
+ function assertApplied(result) {
4264
+ if (!result?.success) {
4265
+ const reasons = result?.errors.map((error) => error.message).filter((message) => message.trim());
4266
+ throw new Error(reasons?.join("\n") || UPDATE_FAILURE);
4267
+ }
4241
4268
  }
4242
4269
 
4243
4270
  // src/components/panels/ModuleDetails.tsx
@@ -4248,8 +4275,8 @@ import { useMemo as useMemo10 } from "react";
4248
4275
  // src/components/panels/BlockEditor.tsx
4249
4276
  import { Button as Button6, IconButton as IconButton3, Input } from "@lace-cloud/ui";
4250
4277
  import { useState as useState14 } from "react";
4251
- import "./panels-shared-3HUQC7TC.css";
4252
- import { Fragment as Fragment7, jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
4278
+ import "./panels-shared-Y4ULZZLB.css";
4279
+ import { Fragment as Fragment8, jsx as jsx30, jsxs as jsxs18 } from "react/jsx-runtime";
4253
4280
  function replaceAt(list, index, item) {
4254
4281
  return list.map((x, i) => i === index ? item : x);
4255
4282
  }
@@ -4257,8 +4284,8 @@ function blockTitle(block) {
4257
4284
  return [block.type, ...block.labels.map((l) => `"${l}"`)].join(" ");
4258
4285
  }
4259
4286
  function BlockEditor({ blocks, onChange, editable, templates }) {
4260
- return /* @__PURE__ */ jsxs16(Fragment7, { children: [
4261
- blocks.map((block, i) => /* @__PURE__ */ jsx29(
4287
+ return /* @__PURE__ */ jsxs18(Fragment8, { children: [
4288
+ blocks.map((block, i) => /* @__PURE__ */ jsx30(
4262
4289
  BlockCard,
4263
4290
  {
4264
4291
  block,
@@ -4268,7 +4295,7 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
4268
4295
  },
4269
4296
  i
4270
4297
  )),
4271
- editable && (templates ? /* @__PURE__ */ jsx29("div", { className: "lace-panel-row-actions", children: templates.map((t) => /* @__PURE__ */ jsxs16(
4298
+ editable && (templates ? /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-actions", children: templates.map((t) => /* @__PURE__ */ jsxs18(
4272
4299
  Button6,
4273
4300
  {
4274
4301
  variant: "secondary",
@@ -4289,7 +4316,7 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
4289
4316
  ]
4290
4317
  },
4291
4318
  t.type
4292
- )) }) : /* @__PURE__ */ jsx29(
4319
+ )) }) : /* @__PURE__ */ jsx30(
4293
4320
  NewBlockRow,
4294
4321
  {
4295
4322
  onAdd: (type, label) => onChange([
@@ -4303,8 +4330,8 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
4303
4330
  function NewBlockRow({ onAdd }) {
4304
4331
  const [type, setType] = useState14("");
4305
4332
  const [label, setLabel] = useState14("");
4306
- return /* @__PURE__ */ jsxs16("div", { className: "lace-panel-row-actions", children: [
4307
- /* @__PURE__ */ jsx29(
4333
+ return /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions", children: [
4334
+ /* @__PURE__ */ jsx30(
4308
4335
  Input,
4309
4336
  {
4310
4337
  value: type,
@@ -4314,7 +4341,7 @@ function NewBlockRow({ onAdd }) {
4314
4341
  mono: true
4315
4342
  }
4316
4343
  ),
4317
- /* @__PURE__ */ jsx29(
4344
+ /* @__PURE__ */ jsx30(
4318
4345
  Input,
4319
4346
  {
4320
4347
  value: label,
@@ -4324,7 +4351,7 @@ function NewBlockRow({ onAdd }) {
4324
4351
  mono: true
4325
4352
  }
4326
4353
  ),
4327
- /* @__PURE__ */ jsx29(
4354
+ /* @__PURE__ */ jsx30(
4328
4355
  Button6,
4329
4356
  {
4330
4357
  variant: "secondary",
@@ -4348,13 +4375,13 @@ function BlockCard({ block, editable, onChange, onRemove }) {
4348
4375
  [field]: value
4349
4376
  })
4350
4377
  });
4351
- return /* @__PURE__ */ jsxs16("div", { className: "lace-panel-validation-block", children: [
4352
- /* @__PURE__ */ jsxs16("div", { className: "lace-panel-row-actions", children: [
4353
- /* @__PURE__ */ jsx29(Identifier, { className: "lace-panel-row-card__name", text: blockTitle(block) }),
4354
- editable && /* @__PURE__ */ jsx29(
4378
+ return /* @__PURE__ */ jsxs18("div", { className: "lace-panel-validation-block", children: [
4379
+ /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions", children: [
4380
+ /* @__PURE__ */ jsx30(Identifier, { className: "lace-panel-row-card__name", text: blockTitle(block) }),
4381
+ editable && /* @__PURE__ */ jsx30(
4355
4382
  IconButton3,
4356
4383
  {
4357
- icon: /* @__PURE__ */ jsx29(CanvasIcon, { name: "close" }),
4384
+ icon: /* @__PURE__ */ jsx30(CanvasIcon, { name: "close" }),
4358
4385
  "aria-label": `Remove the ${block.type} block`,
4359
4386
  size: "md",
4360
4387
  tooltipPlacement: "bottom-end",
@@ -4364,8 +4391,8 @@ function BlockCard({ block, editable, onChange, onRemove }) {
4364
4391
  ] }),
4365
4392
  block.attributes.map((attribute, i) => (
4366
4393
  // biome-ignore lint/suspicious/noArrayIndexKey: attributes are positional; the render keeps their order
4367
- /* @__PURE__ */ jsxs16("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4368
- /* @__PURE__ */ jsx29(
4394
+ /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4395
+ /* @__PURE__ */ jsx30(
4369
4396
  Input,
4370
4397
  {
4371
4398
  value: attribute.name,
@@ -4376,7 +4403,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
4376
4403
  readOnly: !editable
4377
4404
  }
4378
4405
  ),
4379
- /* @__PURE__ */ jsx29(
4406
+ /* @__PURE__ */ jsx30(
4380
4407
  Input,
4381
4408
  {
4382
4409
  value: attribute.value,
@@ -4387,10 +4414,10 @@ function BlockCard({ block, editable, onChange, onRemove }) {
4387
4414
  readOnly: !editable
4388
4415
  }
4389
4416
  ),
4390
- editable && /* @__PURE__ */ jsx29(
4417
+ editable && /* @__PURE__ */ jsx30(
4391
4418
  IconButton3,
4392
4419
  {
4393
- icon: /* @__PURE__ */ jsx29(CanvasIcon, { name: "close" }),
4420
+ icon: /* @__PURE__ */ jsx30(CanvasIcon, { name: "close" }),
4394
4421
  "aria-label": `Remove ${attribute.name || "the argument"}`,
4395
4422
  size: "md",
4396
4423
  tooltipPlacement: "bottom-end",
@@ -4399,7 +4426,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
4399
4426
  )
4400
4427
  ] }, i)
4401
4428
  )),
4402
- editable && /* @__PURE__ */ jsx29(
4429
+ editable && /* @__PURE__ */ jsx30(
4403
4430
  Button6,
4404
4431
  {
4405
4432
  variant: "secondary",
@@ -4408,7 +4435,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
4408
4435
  children: "+ Add argument"
4409
4436
  }
4410
4437
  ),
4411
- (block.blocks.length > 0 || editable) && /* @__PURE__ */ jsx29(
4438
+ (block.blocks.length > 0 || editable) && /* @__PURE__ */ jsx30(
4412
4439
  BlockEditor,
4413
4440
  {
4414
4441
  blocks: block.blocks,
@@ -4443,8 +4470,8 @@ function firstDuplicate(items, keyFn) {
4443
4470
  }
4444
4471
 
4445
4472
  // src/components/panels/LocalsPanel.tsx
4446
- import "./panels-shared-3HUQC7TC.css";
4447
- import { Fragment as Fragment8, jsx as jsx30, jsxs as jsxs17 } from "react/jsx-runtime";
4473
+ import "./panels-shared-Y4ULZZLB.css";
4474
+ import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
4448
4475
  function toRows(locals) {
4449
4476
  return (locals ?? []).map((l) => ({ id: l.name, ...l }));
4450
4477
  }
@@ -4463,10 +4490,10 @@ function LocalsContent({ moduleKey, locals, onSave }) {
4463
4490
  const updateRow = (index, field, value) => setRows(rows.map((r, i) => i === index ? { ...r, [field]: value } : r));
4464
4491
  const nameDupes = findDuplicateIndices(rows, (r) => r.name);
4465
4492
  const duplicate = firstDuplicate(rows, (r) => r.name);
4466
- return /* @__PURE__ */ jsxs17(Fragment8, { children: [
4467
- rows.map((row, i) => /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
4468
- /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4469
- /* @__PURE__ */ jsx30(
4493
+ return /* @__PURE__ */ jsxs19(Fragment9, { children: [
4494
+ rows.map((row, i) => /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
4495
+ /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4496
+ /* @__PURE__ */ jsx31(
4470
4497
  Input2,
4471
4498
  {
4472
4499
  value: row.name,
@@ -4479,10 +4506,10 @@ function LocalsContent({ moduleKey, locals, onSave }) {
4479
4506
  readOnly: !editable
4480
4507
  }
4481
4508
  ),
4482
- editable && /* @__PURE__ */ jsx30(
4509
+ editable && /* @__PURE__ */ jsx31(
4483
4510
  IconButton4,
4484
4511
  {
4485
- icon: /* @__PURE__ */ jsx30(CanvasIcon, { name: "close" }),
4512
+ icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
4486
4513
  "aria-label": "Remove local",
4487
4514
  size: "md",
4488
4515
  tooltipPlacement: "bottom-end",
@@ -4490,8 +4517,8 @@ function LocalsContent({ moduleKey, locals, onSave }) {
4490
4517
  }
4491
4518
  )
4492
4519
  ] }),
4493
- nameDupes.has(i) && /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-error", children: "Duplicate local name" }),
4494
- /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx30(
4520
+ nameDupes.has(i) && /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-error", children: "Duplicate local name" }),
4521
+ /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx31(
4495
4522
  Textarea,
4496
4523
  {
4497
4524
  value: row.value,
@@ -4505,8 +4532,8 @@ function LocalsContent({ moduleKey, locals, onSave }) {
4505
4532
  }
4506
4533
  ) })
4507
4534
  ] }, row.id)),
4508
- editable && /* @__PURE__ */ jsxs17(Fragment8, { children: [
4509
- /* @__PURE__ */ jsx30(
4535
+ editable && /* @__PURE__ */ jsxs19(Fragment9, { children: [
4536
+ /* @__PURE__ */ jsx31(
4510
4537
  Button7,
4511
4538
  {
4512
4539
  variant: "secondary",
@@ -4515,7 +4542,7 @@ function LocalsContent({ moduleKey, locals, onSave }) {
4515
4542
  children: "+ Add local"
4516
4543
  }
4517
4544
  ),
4518
- /* @__PURE__ */ jsx30(
4545
+ /* @__PURE__ */ jsx31(
4519
4546
  UpdateButton,
4520
4547
  {
4521
4548
  draft,
@@ -4527,13 +4554,13 @@ function LocalsContent({ moduleKey, locals, onSave }) {
4527
4554
  ] });
4528
4555
  }
4529
4556
  function LocalsPanel({ onClose, ...content }) {
4530
- return /* @__PURE__ */ jsx30(Panel2, { title: "Locals", onClose, children: /* @__PURE__ */ jsx30(LocalsContent, { ...content }) });
4557
+ return /* @__PURE__ */ jsx31(Panel2, { title: "Locals", onClose, children: /* @__PURE__ */ jsx31(LocalsContent, { ...content }) });
4531
4558
  }
4532
4559
 
4533
4560
  // src/components/panels/ModuleInterfacePanel.tsx
4534
4561
  import { Button as Button8, IconButton as IconButton5, Input as Input3, Panel as Panel3, Select, Textarea as Textarea2 } from "@lace-cloud/ui";
4535
- import "./panels-shared-3HUQC7TC.css";
4536
- import { Fragment as Fragment9, jsx as jsx31, jsxs as jsxs18 } from "react/jsx-runtime";
4562
+ import "./panels-shared-Y4ULZZLB.css";
4563
+ import { Fragment as Fragment10, jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
4537
4564
  function variablesToRows(variables) {
4538
4565
  return variables.map((v) => ({
4539
4566
  id: v.name,
@@ -4667,13 +4694,13 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4667
4694
  const variableDupes = findDuplicateIndices(variables, (v) => v.name);
4668
4695
  const outputDupes = findDuplicateIndices(outputs, (o) => o.name);
4669
4696
  const exposable = settings.call_outputs.filter((text) => !outputs.some((o) => o.value === text));
4670
- return /* @__PURE__ */ jsxs18(Fragment9, { children: [
4671
- /* @__PURE__ */ jsx31("div", { className: "lace-panel-hint", children: "The module's public surface: the variables its callers set and the outputs they read." }),
4672
- /* @__PURE__ */ jsx31("h4", { className: "lace-panel-section-title", children: "Inputs" }),
4673
- variables.length === 0 && /* @__PURE__ */ jsx31("div", { className: "lace-panel-hint", children: "No variables." }),
4674
- variables.map((v, i) => /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
4675
- /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4676
- v.added ? /* @__PURE__ */ jsx31(
4697
+ return /* @__PURE__ */ jsxs20(Fragment10, { children: [
4698
+ /* @__PURE__ */ jsx32("div", { className: "lace-panel-hint", children: "The module's public surface: the variables its callers set and the outputs they read." }),
4699
+ /* @__PURE__ */ jsx32("h4", { className: "lace-panel-section-title", children: "Inputs" }),
4700
+ variables.length === 0 && /* @__PURE__ */ jsx32("div", { className: "lace-panel-hint", children: "No variables." }),
4701
+ variables.map((v, i) => /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
4702
+ /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4703
+ v.added ? /* @__PURE__ */ jsx32(
4677
4704
  Input3,
4678
4705
  {
4679
4706
  label: "Name",
@@ -4684,11 +4711,11 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4684
4711
  mono: true,
4685
4712
  error: variableDupes.has(i)
4686
4713
  }
4687
- ) : /* @__PURE__ */ jsx31(Identifier, { className: "lace-panel-row-card__name", text: v.name }),
4688
- editable && /* @__PURE__ */ jsx31(
4714
+ ) : /* @__PURE__ */ jsx32(Identifier, { className: "lace-panel-row-card__name", text: v.name }),
4715
+ editable && /* @__PURE__ */ jsx32(
4689
4716
  IconButton5,
4690
4717
  {
4691
- icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
4718
+ icon: /* @__PURE__ */ jsx32(CanvasIcon, { name: "close" }),
4692
4719
  "aria-label": `Remove variable ${v.name}`,
4693
4720
  size: "md",
4694
4721
  tooltipPlacement: "bottom-end",
@@ -4696,8 +4723,8 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4696
4723
  }
4697
4724
  )
4698
4725
  ] }),
4699
- variableDupes.has(i) && /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-error", children: "Duplicate variable name" }),
4700
- /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx31(
4726
+ variableDupes.has(i) && /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-error", children: "Duplicate variable name" }),
4727
+ /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx32(
4701
4728
  Input3,
4702
4729
  {
4703
4730
  label: "Type",
@@ -4709,8 +4736,8 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4709
4736
  readOnly: !editable
4710
4737
  }
4711
4738
  ) }),
4712
- 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 }) }),
4713
- /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx31(
4739
+ v.defaultText && /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx32(Input3, { label: "Default", value: v.defaultText, fullWidth: true, mono: true, readOnly: true }) }),
4740
+ /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx32(
4714
4741
  Textarea2,
4715
4742
  {
4716
4743
  label: "Description",
@@ -4722,9 +4749,9 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4722
4749
  readOnly: !editable
4723
4750
  }
4724
4751
  ) }),
4725
- /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions", children: [
4726
- /* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
4727
- /* @__PURE__ */ jsx31(
4752
+ /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-actions", children: [
4753
+ /* @__PURE__ */ jsxs20("label", { className: "lace-panel-checkbox-row", children: [
4754
+ /* @__PURE__ */ jsx32(
4728
4755
  "input",
4729
4756
  {
4730
4757
  type: "checkbox",
@@ -4733,10 +4760,10 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4733
4760
  disabled: !editable
4734
4761
  }
4735
4762
  ),
4736
- /* @__PURE__ */ jsx31("span", { children: "Required" })
4763
+ /* @__PURE__ */ jsx32("span", { children: "Required" })
4737
4764
  ] }),
4738
- /* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
4739
- /* @__PURE__ */ jsx31(
4765
+ /* @__PURE__ */ jsxs20("label", { className: "lace-panel-checkbox-row", children: [
4766
+ /* @__PURE__ */ jsx32(
4740
4767
  "input",
4741
4768
  {
4742
4769
  type: "checkbox",
@@ -4745,10 +4772,10 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4745
4772
  disabled: !editable
4746
4773
  }
4747
4774
  ),
4748
- /* @__PURE__ */ jsx31("span", { children: "Ephemeral" })
4775
+ /* @__PURE__ */ jsx32("span", { children: "Ephemeral" })
4749
4776
  ] }),
4750
- /* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
4751
- /* @__PURE__ */ jsx31(
4777
+ /* @__PURE__ */ jsxs20("label", { className: "lace-panel-checkbox-row", children: [
4778
+ /* @__PURE__ */ jsx32(
4752
4779
  "input",
4753
4780
  {
4754
4781
  type: "checkbox",
@@ -4757,10 +4784,10 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4757
4784
  disabled: !editable
4758
4785
  }
4759
4786
  ),
4760
- /* @__PURE__ */ jsx31("span", { children: "Sensitive" })
4787
+ /* @__PURE__ */ jsx32("span", { children: "Sensitive" })
4761
4788
  ] }),
4762
- /* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
4763
- /* @__PURE__ */ jsx31(
4789
+ /* @__PURE__ */ jsxs20("label", { className: "lace-panel-checkbox-row", children: [
4790
+ /* @__PURE__ */ jsx32(
4764
4791
  "input",
4765
4792
  {
4766
4793
  type: "checkbox",
@@ -4769,13 +4796,13 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4769
4796
  disabled: !editable
4770
4797
  }
4771
4798
  ),
4772
- /* @__PURE__ */ jsx31("span", { children: "Nullable" })
4799
+ /* @__PURE__ */ jsx32("span", { children: "Nullable" })
4773
4800
  ] })
4774
4801
  ] }),
4775
- (v.validation.length > 0 || editable) && /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-content", children: [
4776
- /* @__PURE__ */ jsx31("div", { className: "lace-panel-subsection-label", children: "Validation" }),
4777
- v.validation.map((block, j) => /* @__PURE__ */ jsxs18("div", { className: "lace-panel-validation-block", children: [
4778
- /* @__PURE__ */ jsx31(
4802
+ (v.validation.length > 0 || editable) && /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-content", children: [
4803
+ /* @__PURE__ */ jsx32("div", { className: "lace-panel-subsection-label", children: "Validation" }),
4804
+ v.validation.map((block, j) => /* @__PURE__ */ jsxs20("div", { className: "lace-panel-validation-block", children: [
4805
+ /* @__PURE__ */ jsx32(
4779
4806
  Input3,
4780
4807
  {
4781
4808
  value: block.condition,
@@ -4787,7 +4814,7 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4787
4814
  readOnly: !editable
4788
4815
  }
4789
4816
  ),
4790
- /* @__PURE__ */ jsx31(
4817
+ /* @__PURE__ */ jsx32(
4791
4818
  Input3,
4792
4819
  {
4793
4820
  value: block.error_message,
@@ -4798,10 +4825,10 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4798
4825
  readOnly: !editable
4799
4826
  }
4800
4827
  ),
4801
- editable && /* @__PURE__ */ jsx31(
4828
+ editable && /* @__PURE__ */ jsx32(
4802
4829
  IconButton5,
4803
4830
  {
4804
- icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
4831
+ icon: /* @__PURE__ */ jsx32(CanvasIcon, { name: "close" }),
4805
4832
  "aria-label": "Remove validation rule",
4806
4833
  size: "md",
4807
4834
  tooltipPlacement: "bottom-end",
@@ -4809,15 +4836,15 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4809
4836
  }
4810
4837
  )
4811
4838
  ] }, block.id)),
4812
- editable && /* @__PURE__ */ jsx31(Button8, { variant: "secondary", size: "sm", onClick: () => addValidation(i), children: "+ Add validation rule" })
4839
+ editable && /* @__PURE__ */ jsx32(Button8, { variant: "secondary", size: "sm", onClick: () => addValidation(i), children: "+ Add validation rule" })
4813
4840
  ] })
4814
4841
  ] }, v.id)),
4815
- editable && /* @__PURE__ */ jsx31(Button8, { variant: "secondary", size: "sm", onClick: addVariable, children: "+ Add variable" }),
4816
- /* @__PURE__ */ jsx31("h4", { className: "lace-panel-section-title", children: "Outputs" }),
4817
- outputs.length === 0 && /* @__PURE__ */ jsx31("div", { className: "lace-panel-hint", children: "No outputs." }),
4818
- outputs.map((o, i) => /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
4819
- /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4820
- /* @__PURE__ */ jsx31(
4842
+ editable && /* @__PURE__ */ jsx32(Button8, { variant: "secondary", size: "sm", onClick: addVariable, children: "+ Add variable" }),
4843
+ /* @__PURE__ */ jsx32("h4", { className: "lace-panel-section-title", children: "Outputs" }),
4844
+ outputs.length === 0 && /* @__PURE__ */ jsx32("div", { className: "lace-panel-hint", children: "No outputs." }),
4845
+ outputs.map((o, i) => /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
4846
+ /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4847
+ /* @__PURE__ */ jsx32(
4821
4848
  Input3,
4822
4849
  {
4823
4850
  label: "Name",
@@ -4830,10 +4857,10 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4830
4857
  error: outputDupes.has(i) || editable && !o.name.trim()
4831
4858
  }
4832
4859
  ),
4833
- editable && /* @__PURE__ */ jsx31(
4860
+ editable && /* @__PURE__ */ jsx32(
4834
4861
  IconButton5,
4835
4862
  {
4836
- icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
4863
+ icon: /* @__PURE__ */ jsx32(CanvasIcon, { name: "close" }),
4837
4864
  "aria-label": `Remove output ${o.name}`,
4838
4865
  size: "md",
4839
4866
  tooltipPlacement: "bottom-end",
@@ -4841,7 +4868,7 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4841
4868
  }
4842
4869
  )
4843
4870
  ] }),
4844
- /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx31(
4871
+ /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx32(
4845
4872
  Input3,
4846
4873
  {
4847
4874
  label: "Value",
@@ -4854,7 +4881,7 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4854
4881
  error: editable && !o.value.trim()
4855
4882
  }
4856
4883
  ) }),
4857
- /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx31(
4884
+ /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx32(
4858
4885
  Textarea2,
4859
4886
  {
4860
4887
  label: "Description",
@@ -4866,8 +4893,8 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4866
4893
  readOnly: !editable
4867
4894
  }
4868
4895
  ) }),
4869
- /* @__PURE__ */ jsxs18("label", { className: "lace-panel-checkbox-row", children: [
4870
- /* @__PURE__ */ jsx31(
4896
+ /* @__PURE__ */ jsxs20("label", { className: "lace-panel-checkbox-row", children: [
4897
+ /* @__PURE__ */ jsx32(
4871
4898
  "input",
4872
4899
  {
4873
4900
  type: "checkbox",
@@ -4876,12 +4903,12 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4876
4903
  disabled: !editable
4877
4904
  }
4878
4905
  ),
4879
- /* @__PURE__ */ jsx31("span", { children: "Sensitive" })
4906
+ /* @__PURE__ */ jsx32("span", { children: "Sensitive" })
4880
4907
  ] }),
4881
- (o.depends_on.length > 0 || editable && settings.dependency_options.length > 0) && /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-content", children: [
4882
- /* @__PURE__ */ jsx31("div", { className: "lace-panel-subsection-label", children: "Depends on" }),
4883
- !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: [
4884
- /* @__PURE__ */ jsx31(
4908
+ (o.depends_on.length > 0 || editable && settings.dependency_options.length > 0) && /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-content", children: [
4909
+ /* @__PURE__ */ jsx32("div", { className: "lace-panel-subsection-label", children: "Depends on" }),
4910
+ !editable ? o.depends_on.map((dep) => /* @__PURE__ */ jsx32("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx32(Identifier, { text: dep }) }, dep)) : settings.dependency_options.map((dep) => /* @__PURE__ */ jsxs20("label", { className: "lace-panel-checkbox-row", children: [
4911
+ /* @__PURE__ */ jsx32(
4885
4912
  "input",
4886
4913
  {
4887
4914
  type: "checkbox",
@@ -4889,14 +4916,14 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4889
4916
  onChange: () => toggleDependsOn(i, dep)
4890
4917
  }
4891
4918
  ),
4892
- /* @__PURE__ */ jsx31(Identifier, { text: dep })
4919
+ /* @__PURE__ */ jsx32(Identifier, { text: dep })
4893
4920
  ] }, dep))
4894
4921
  ] }),
4895
- outputDupes.has(i) && /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-error", children: "Output names must be unique." })
4922
+ outputDupes.has(i) && /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-error", children: "Output names must be unique." })
4896
4923
  ] }, o.id)),
4897
- editable && /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions", children: [
4898
- /* @__PURE__ */ jsx31(Button8, { variant: "secondary", size: "sm", onClick: () => addOutput("", ""), children: "+ Add output" }),
4899
- exposable.length > 0 && /* @__PURE__ */ jsx31(
4924
+ editable && /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-actions", children: [
4925
+ /* @__PURE__ */ jsx32(Button8, { variant: "secondary", size: "sm", onClick: () => addOutput("", ""), children: "+ Add output" }),
4926
+ exposable.length > 0 && /* @__PURE__ */ jsx32(
4900
4927
  Select,
4901
4928
  {
4902
4929
  "aria-label": "Expose a call's output",
@@ -4912,7 +4939,7 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4912
4939
  }
4913
4940
  )
4914
4941
  ] }),
4915
- editable && /* @__PURE__ */ jsx31(
4942
+ editable && /* @__PURE__ */ jsx32(
4916
4943
  UpdateButton,
4917
4944
  {
4918
4945
  draft,
@@ -4923,7 +4950,7 @@ function ModuleInterfaceContent({ moduleKey, settings, onSave }) {
4923
4950
  ] });
4924
4951
  }
4925
4952
  function ModuleInterfacePanel({ onClose, ...content }) {
4926
- return /* @__PURE__ */ jsx31(Panel3, { title: "Module Interface", onClose, children: /* @__PURE__ */ jsx31(ModuleInterfaceContent, { ...content }) });
4953
+ return /* @__PURE__ */ jsx32(Panel3, { title: "Module Interface", onClose, children: /* @__PURE__ */ jsx32(ModuleInterfaceContent, { ...content }) });
4927
4954
  }
4928
4955
 
4929
4956
  // src/components/panels/module-actions.ts
@@ -5033,16 +5060,25 @@ function resourceActions(scope, before, after) {
5033
5060
  set_depends_on: { scope, instance_id: before.id, depends_on: after.depends_on }
5034
5061
  });
5035
5062
  }
5063
+ if (before.name !== after.name) {
5064
+ actions.push({
5065
+ rename_instance: {
5066
+ scope,
5067
+ old_id: before.id,
5068
+ new_id: `${before.kind}.${before.type}.${after.name}`
5069
+ }
5070
+ });
5071
+ }
5036
5072
  return actions;
5037
5073
  }
5038
5074
 
5039
5075
  // src/components/panels/ModuleDetails.tsx
5040
- import "./panels-shared-3HUQC7TC.css";
5076
+ import "./panels-shared-Y4ULZZLB.css";
5041
5077
 
5042
5078
  // src/components/panels/ProvidersPanel.tsx
5043
5079
  import { Button as Button9, IconButton as IconButton6, Input as Input4, Panel as Panel4 } from "@lace-cloud/ui";
5044
- import "./panels-shared-3HUQC7TC.css";
5045
- import { Fragment as Fragment10, jsx as jsx32, jsxs as jsxs19 } from "react/jsx-runtime";
5080
+ import "./panels-shared-Y4ULZZLB.css";
5081
+ import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs21 } from "react/jsx-runtime";
5046
5082
  function toRows2(providers) {
5047
5083
  if (!providers || providers.length === 0) return [];
5048
5084
  return providers.map((p) => ({
@@ -5103,10 +5139,10 @@ function ProvidersContent({ moduleKey, providers, onSave }) {
5103
5139
  (c, ei) => ei === entryIndex ? { ...c, [field]: value } : c
5104
5140
  )
5105
5141
  );
5106
- return /* @__PURE__ */ jsxs19(Fragment10, { children: [
5107
- rows.map((row, pi) => /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
5108
- /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
5109
- /* @__PURE__ */ jsx32(
5142
+ return /* @__PURE__ */ jsxs21(Fragment11, { children: [
5143
+ rows.map((row, pi) => /* @__PURE__ */ jsxs21("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
5144
+ /* @__PURE__ */ jsxs21("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
5145
+ /* @__PURE__ */ jsx33(
5110
5146
  Input4,
5111
5147
  {
5112
5148
  value: row.name,
@@ -5116,7 +5152,7 @@ function ProvidersContent({ moduleKey, providers, onSave }) {
5116
5152
  readOnly: !editable
5117
5153
  }
5118
5154
  ),
5119
- /* @__PURE__ */ jsx32(
5155
+ /* @__PURE__ */ jsx33(
5120
5156
  Input4,
5121
5157
  {
5122
5158
  value: row.alias,
@@ -5126,10 +5162,10 @@ function ProvidersContent({ moduleKey, providers, onSave }) {
5126
5162
  readOnly: !editable
5127
5163
  }
5128
5164
  ),
5129
- editable && /* @__PURE__ */ jsx32(
5165
+ editable && /* @__PURE__ */ jsx33(
5130
5166
  IconButton6,
5131
5167
  {
5132
- icon: /* @__PURE__ */ jsx32(CanvasIcon, { name: "close" }),
5168
+ icon: /* @__PURE__ */ jsx33(CanvasIcon, { name: "close" }),
5133
5169
  "aria-label": "Remove provider",
5134
5170
  size: "md",
5135
5171
  tooltipPlacement: "bottom-end",
@@ -5137,9 +5173,9 @@ function ProvidersContent({ moduleKey, providers, onSave }) {
5137
5173
  }
5138
5174
  )
5139
5175
  ] }),
5140
- /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-sublabel", children: "Config" }),
5141
- row.configEntries.map((entry, ei) => /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
5142
- /* @__PURE__ */ jsx32(
5176
+ /* @__PURE__ */ jsx33("div", { className: "lace-panel-row-sublabel", children: "Config" }),
5177
+ row.configEntries.map((entry, ei) => /* @__PURE__ */ jsxs21("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
5178
+ /* @__PURE__ */ jsx33(
5143
5179
  Input4,
5144
5180
  {
5145
5181
  value: entry.key,
@@ -5149,7 +5185,7 @@ function ProvidersContent({ moduleKey, providers, onSave }) {
5149
5185
  readOnly: !editable
5150
5186
  }
5151
5187
  ),
5152
- /* @__PURE__ */ jsx32(
5188
+ /* @__PURE__ */ jsx33(
5153
5189
  Input4,
5154
5190
  {
5155
5191
  value: entry.value,
@@ -5159,10 +5195,10 @@ function ProvidersContent({ moduleKey, providers, onSave }) {
5159
5195
  readOnly: !editable
5160
5196
  }
5161
5197
  ),
5162
- editable && /* @__PURE__ */ jsx32(
5198
+ editable && /* @__PURE__ */ jsx33(
5163
5199
  IconButton6,
5164
5200
  {
5165
- icon: /* @__PURE__ */ jsx32(CanvasIcon, { name: "close" }),
5201
+ icon: /* @__PURE__ */ jsx33(CanvasIcon, { name: "close" }),
5166
5202
  "aria-label": "Remove config key",
5167
5203
  size: "md",
5168
5204
  tooltipPlacement: "bottom-end",
@@ -5173,7 +5209,7 @@ function ProvidersContent({ moduleKey, providers, onSave }) {
5173
5209
  }
5174
5210
  )
5175
5211
  ] }, entry.id)),
5176
- editable && /* @__PURE__ */ jsx32(
5212
+ editable && /* @__PURE__ */ jsx33(
5177
5213
  Button9,
5178
5214
  {
5179
5215
  variant: "secondary",
@@ -5185,9 +5221,9 @@ function ProvidersContent({ moduleKey, providers, onSave }) {
5185
5221
  children: "+ Add config key"
5186
5222
  }
5187
5223
  ),
5188
- (row.blocks.length > 0 || editable) && /* @__PURE__ */ jsxs19(Fragment10, { children: [
5189
- /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
5190
- /* @__PURE__ */ jsx32(
5224
+ (row.blocks.length > 0 || editable) && /* @__PURE__ */ jsxs21(Fragment11, { children: [
5225
+ /* @__PURE__ */ jsx33("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
5226
+ /* @__PURE__ */ jsx33(
5191
5227
  BlockEditor,
5192
5228
  {
5193
5229
  blocks: row.blocks,
@@ -5197,21 +5233,21 @@ function ProvidersContent({ moduleKey, providers, onSave }) {
5197
5233
  )
5198
5234
  ] })
5199
5235
  ] }, row.id)),
5200
- editable && /* @__PURE__ */ jsxs19(Fragment10, { children: [
5201
- /* @__PURE__ */ jsx32(Button9, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
5202
- /* @__PURE__ */ jsx32(UpdateButton, { draft, label: "Update providers" })
5236
+ editable && /* @__PURE__ */ jsxs21(Fragment11, { children: [
5237
+ /* @__PURE__ */ jsx33(Button9, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
5238
+ /* @__PURE__ */ jsx33(UpdateButton, { draft, label: "Update providers" })
5203
5239
  ] })
5204
5240
  ] });
5205
5241
  }
5206
5242
  function ProvidersPanel({ onClose, ...content }) {
5207
- return /* @__PURE__ */ jsx32(Panel4, { title: "Providers", onClose, children: /* @__PURE__ */ jsx32(ProvidersContent, { ...content }) });
5243
+ return /* @__PURE__ */ jsx33(Panel4, { title: "Providers", onClose, children: /* @__PURE__ */ jsx33(ProvidersContent, { ...content }) });
5208
5244
  }
5209
5245
 
5210
5246
  // src/components/panels/ResourcesPanel.tsx
5211
- import { Badge as Badge2, Button as Button10, IconButton as IconButton7, Input as Input5, Select as Select2 } from "@lace-cloud/ui";
5247
+ import { Button as Button10, IconButton as IconButton7, Input as Input5, Select as Select2, StatusBadge as StatusBadge3 } from "@lace-cloud/ui";
5212
5248
  import { useState as useState15 } from "react";
5213
- import "./panels-shared-3HUQC7TC.css";
5214
- import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs20 } from "react/jsx-runtime";
5249
+ import "./panels-shared-Y4ULZZLB.css";
5250
+ import { Fragment as Fragment12, jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
5215
5251
  var resourceDraft = {
5216
5252
  name: "resource",
5217
5253
  seed: (derive, [moduleKey, id]) => derive.settings(moduleKey)?.resources.find((r) => r.id === id) ?? null
@@ -5226,9 +5262,9 @@ function ResourcesContent({
5226
5262
  onAdd
5227
5263
  }) {
5228
5264
  const { editable } = useCanvas();
5229
- return /* @__PURE__ */ jsxs20(Fragment11, { children: [
5230
- resources.length === 0 && /* @__PURE__ */ jsx33("div", { className: "lace-panel-hint", children: "No resources or data sources." }),
5231
- resources.map((resource) => /* @__PURE__ */ jsx33(
5265
+ return /* @__PURE__ */ jsxs22(Fragment12, { children: [
5266
+ resources.length === 0 && /* @__PURE__ */ jsx34("div", { className: "lace-panel-hint", children: "No resources or data sources." }),
5267
+ resources.map((resource) => /* @__PURE__ */ jsx34(
5232
5268
  ResourceCard,
5233
5269
  {
5234
5270
  moduleKey,
@@ -5242,7 +5278,7 @@ function ResourcesContent({
5242
5278
  },
5243
5279
  resource.id
5244
5280
  )),
5245
- editable && /* @__PURE__ */ jsx33(NewResourceRow, { managed, onAdd })
5281
+ editable && /* @__PURE__ */ jsx34(NewResourceRow, { managed, onAdd })
5246
5282
  ] });
5247
5283
  }
5248
5284
  var MANAGED_OPTION = { value: "resource", label: "Resource" };
@@ -5256,10 +5292,10 @@ function NewResourceRow({
5256
5292
  const kind = managed ? chosen : "data";
5257
5293
  const [type, setType] = useState15("");
5258
5294
  const [name, setName] = useState15("");
5259
- return /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-card", children: [
5260
- /* @__PURE__ */ jsx33("div", { className: "lace-panel-subsection-label", children: "Add a resource" }),
5261
- /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-actions", children: [
5262
- /* @__PURE__ */ jsx33(
5295
+ return /* @__PURE__ */ jsxs22("div", { className: "lace-panel-row-card", children: [
5296
+ /* @__PURE__ */ jsx34("div", { className: "lace-panel-subsection-label", children: "Add a resource" }),
5297
+ /* @__PURE__ */ jsxs22("div", { className: "lace-panel-row-actions", children: [
5298
+ /* @__PURE__ */ jsx34(
5263
5299
  Select2,
5264
5300
  {
5265
5301
  "aria-label": "New resource kind",
@@ -5268,7 +5304,7 @@ function NewResourceRow({
5268
5304
  onChange: (e) => setChosen(e.target.value === "data" ? "data" : "resource")
5269
5305
  }
5270
5306
  ),
5271
- /* @__PURE__ */ jsx33(
5307
+ /* @__PURE__ */ jsx34(
5272
5308
  Input5,
5273
5309
  {
5274
5310
  value: type,
@@ -5278,7 +5314,7 @@ function NewResourceRow({
5278
5314
  mono: true
5279
5315
  }
5280
5316
  ),
5281
- /* @__PURE__ */ jsx33(
5317
+ /* @__PURE__ */ jsx34(
5282
5318
  Input5,
5283
5319
  {
5284
5320
  value: name,
@@ -5288,7 +5324,7 @@ function NewResourceRow({
5288
5324
  mono: true
5289
5325
  }
5290
5326
  ),
5291
- /* @__PURE__ */ jsx33(
5327
+ /* @__PURE__ */ jsx34(
5292
5328
  Button10,
5293
5329
  {
5294
5330
  variant: "secondary",
@@ -5336,20 +5372,20 @@ function ResourceCard({
5336
5372
  { field: "for_each", placeholder: "e.g. var.names" },
5337
5373
  { field: "provider", placeholder: "e.g. aws.west" }
5338
5374
  ];
5339
- return /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
5340
- /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-actions", children: [
5341
- /* @__PURE__ */ jsx33(Badge2, { variant: resource.kind === "data" ? "info" : "neutral", children: resource.kind === "data" ? "data" : "resource" }),
5342
- /* @__PURE__ */ jsx33(
5375
+ return /* @__PURE__ */ jsxs22("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
5376
+ /* @__PURE__ */ jsxs22("div", { className: "lace-panel-row-actions", children: [
5377
+ /* @__PURE__ */ jsx34(StatusBadge3, { tone: "neutral", children: resource.kind === "data" ? "data" : "resource" }),
5378
+ /* @__PURE__ */ jsx34(
5343
5379
  Identifier,
5344
5380
  {
5345
5381
  className: "lace-panel-row-card__name",
5346
5382
  text: `${resource.type}.${resource.name}`
5347
5383
  }
5348
5384
  ),
5349
- editable && /* @__PURE__ */ jsx33(
5385
+ editable && /* @__PURE__ */ jsx34(
5350
5386
  IconButton7,
5351
5387
  {
5352
- icon: /* @__PURE__ */ jsx33(CanvasIcon, { name: "close" }),
5388
+ icon: /* @__PURE__ */ jsx34(CanvasIcon, { name: "close" }),
5353
5389
  "aria-label": `Remove ${resource.type}.${resource.name}`,
5354
5390
  size: "md",
5355
5391
  tooltipPlacement: "bottom-end",
@@ -5357,8 +5393,19 @@ function ResourceCard({
5357
5393
  }
5358
5394
  )
5359
5395
  ] }),
5396
+ editable && /* @__PURE__ */ jsx34("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx34(
5397
+ Input5,
5398
+ {
5399
+ label: "Name",
5400
+ "aria-label": `Name of ${resource.type}.${resource.name}`,
5401
+ value: draft.name,
5402
+ onChange: (e) => set("name", e.target.value),
5403
+ fullWidth: true,
5404
+ mono: true
5405
+ }
5406
+ ) }),
5360
5407
  metaArguments.map(
5361
- ({ field, placeholder }) => draft[field] || editable ? /* @__PURE__ */ jsx33("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx33(
5408
+ ({ field, placeholder }) => draft[field] || editable ? /* @__PURE__ */ jsx34("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx34(
5362
5409
  Input5,
5363
5410
  {
5364
5411
  label: field,
@@ -5371,11 +5418,11 @@ function ResourceCard({
5371
5418
  }
5372
5419
  ) }, field) : null
5373
5420
  ),
5374
- /* @__PURE__ */ jsx33("div", { className: "lace-panel-row-sublabel", children: "Arguments" }),
5421
+ /* @__PURE__ */ jsx34("div", { className: "lace-panel-row-sublabel", children: "Arguments" }),
5375
5422
  draft.arguments.map((argument, i) => (
5376
5423
  // biome-ignore lint/suspicious/noArrayIndexKey: argument rows are positional while edited
5377
- /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
5378
- /* @__PURE__ */ jsx33(
5424
+ /* @__PURE__ */ jsxs22("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
5425
+ /* @__PURE__ */ jsx34(
5379
5426
  Input5,
5380
5427
  {
5381
5428
  value: argument.name,
@@ -5387,7 +5434,7 @@ function ResourceCard({
5387
5434
  error: argumentDupes.has(i)
5388
5435
  }
5389
5436
  ),
5390
- /* @__PURE__ */ jsx33(
5437
+ /* @__PURE__ */ jsx34(
5391
5438
  Input5,
5392
5439
  {
5393
5440
  value: argument.value,
@@ -5398,10 +5445,10 @@ function ResourceCard({
5398
5445
  readOnly: !editable
5399
5446
  }
5400
5447
  ),
5401
- editable && /* @__PURE__ */ jsx33(
5448
+ editable && /* @__PURE__ */ jsx34(
5402
5449
  IconButton7,
5403
5450
  {
5404
- icon: /* @__PURE__ */ jsx33(CanvasIcon, { name: "close" }),
5451
+ icon: /* @__PURE__ */ jsx34(CanvasIcon, { name: "close" }),
5405
5452
  "aria-label": `Remove ${argument.name || "the argument"}`,
5406
5453
  size: "md",
5407
5454
  tooltipPlacement: "bottom-end",
@@ -5413,7 +5460,7 @@ function ResourceCard({
5413
5460
  )
5414
5461
  ] }, i)
5415
5462
  )),
5416
- editable && /* @__PURE__ */ jsx33(
5463
+ editable && /* @__PURE__ */ jsx34(
5417
5464
  Button10,
5418
5465
  {
5419
5466
  variant: "secondary",
@@ -5422,9 +5469,9 @@ function ResourceCard({
5422
5469
  children: "+ Add argument"
5423
5470
  }
5424
5471
  ),
5425
- (draft.blocks.length > 0 || editable) && /* @__PURE__ */ jsxs20(Fragment11, { children: [
5426
- /* @__PURE__ */ jsx33("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
5427
- /* @__PURE__ */ jsx33(
5472
+ (draft.blocks.length > 0 || editable) && /* @__PURE__ */ jsxs22(Fragment12, { children: [
5473
+ /* @__PURE__ */ jsx34("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
5474
+ /* @__PURE__ */ jsx34(
5428
5475
  BlockEditor,
5429
5476
  {
5430
5477
  blocks: draft.blocks,
@@ -5433,10 +5480,10 @@ function ResourceCard({
5433
5480
  }
5434
5481
  )
5435
5482
  ] }),
5436
- (draft.depends_on.length > 0 || editable && dependencyOptions.length > 0) && /* @__PURE__ */ jsxs20(Fragment11, { children: [
5437
- /* @__PURE__ */ jsx33("div", { className: "lace-panel-row-sublabel", children: "Depends on" }),
5438
- !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: [
5439
- /* @__PURE__ */ jsx33(
5483
+ (draft.depends_on.length > 0 || editable && dependencyOptions.length > 0) && /* @__PURE__ */ jsxs22(Fragment12, { children: [
5484
+ /* @__PURE__ */ jsx34("div", { className: "lace-panel-row-sublabel", children: "Depends on" }),
5485
+ !editable ? draft.depends_on.map((dep) => /* @__PURE__ */ jsx34("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx34(Identifier, { text: dep }) }, dep)) : dependencyOptions.map((dep) => /* @__PURE__ */ jsxs22("label", { className: "lace-panel-checkbox-row", children: [
5486
+ /* @__PURE__ */ jsx34(
5440
5487
  "input",
5441
5488
  {
5442
5489
  type: "checkbox",
@@ -5447,15 +5494,15 @@ function ResourceCard({
5447
5494
  )
5448
5495
  }
5449
5496
  ),
5450
- /* @__PURE__ */ jsx33(Identifier, { text: dep })
5497
+ /* @__PURE__ */ jsx34(Identifier, { text: dep })
5451
5498
  ] }, dep))
5452
5499
  ] }),
5453
- editable && /* @__PURE__ */ jsx33(
5500
+ editable && /* @__PURE__ */ jsx34(
5454
5501
  UpdateButton,
5455
5502
  {
5456
5503
  draft: card,
5457
5504
  label: "Update resource",
5458
- blocked: argumentsBlocker(draft.arguments)
5505
+ blocked: !draft.name.trim() ? "Enter a name" : argumentsBlocker(draft.arguments)
5459
5506
  }
5460
5507
  )
5461
5508
  ] });
@@ -5463,8 +5510,8 @@ function ResourceCard({
5463
5510
 
5464
5511
  // src/components/panels/TerraformConfigPanel.tsx
5465
5512
  import { Button as Button11, IconButton as IconButton8, Input as Input6, Panel as Panel5 } from "@lace-cloud/ui";
5466
- import "./panels-shared-3HUQC7TC.css";
5467
- import { Fragment as Fragment12, jsx as jsx34, jsxs as jsxs21 } from "react/jsx-runtime";
5513
+ import "./panels-shared-Y4ULZZLB.css";
5514
+ import { Fragment as Fragment13, jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
5468
5515
  function toRows3(terraform) {
5469
5516
  return (terraform?.required_providers ?? []).map((req) => ({
5470
5517
  id: req.name,
@@ -5506,9 +5553,9 @@ function TerraformConfigContent({ moduleKey, terraform, onSave }) {
5506
5553
  const { requiredVersion, providers } = draft.value;
5507
5554
  const setProviders2 = (next) => draft.set("providers", next);
5508
5555
  const updateProvider = (index, field, value) => setProviders2(providers.map((p, i) => i === index ? { ...p, [field]: value } : p));
5509
- return /* @__PURE__ */ jsxs21(Fragment12, { children: [
5510
- /* @__PURE__ */ jsx34("h4", { className: "lace-panel-section-title", children: "Required Version" }),
5511
- /* @__PURE__ */ jsx34("div", { className: "lace-panel-field", children: /* @__PURE__ */ jsx34(
5556
+ return /* @__PURE__ */ jsxs23(Fragment13, { children: [
5557
+ /* @__PURE__ */ jsx35("h4", { className: "lace-panel-section-title", children: "Required Version" }),
5558
+ /* @__PURE__ */ jsx35("div", { className: "lace-panel-field", children: /* @__PURE__ */ jsx35(
5512
5559
  Input6,
5513
5560
  {
5514
5561
  value: requiredVersion,
@@ -5518,10 +5565,10 @@ function TerraformConfigContent({ moduleKey, terraform, onSave }) {
5518
5565
  readOnly: !editable
5519
5566
  }
5520
5567
  ) }),
5521
- /* @__PURE__ */ jsx34("h4", { className: "lace-panel-section-title", children: "Required Providers" }),
5522
- providers.map((p, i) => /* @__PURE__ */ jsxs21("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
5523
- /* @__PURE__ */ jsxs21("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
5524
- /* @__PURE__ */ jsx34(
5568
+ /* @__PURE__ */ jsx35("h4", { className: "lace-panel-section-title", children: "Required Providers" }),
5569
+ providers.map((p, i) => /* @__PURE__ */ jsxs23("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
5570
+ /* @__PURE__ */ jsxs23("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
5571
+ /* @__PURE__ */ jsx35(
5525
5572
  Input6,
5526
5573
  {
5527
5574
  value: p.name,
@@ -5531,10 +5578,10 @@ function TerraformConfigContent({ moduleKey, terraform, onSave }) {
5531
5578
  readOnly: !editable
5532
5579
  }
5533
5580
  ),
5534
- editable && /* @__PURE__ */ jsx34(
5581
+ editable && /* @__PURE__ */ jsx35(
5535
5582
  IconButton8,
5536
5583
  {
5537
- icon: /* @__PURE__ */ jsx34(CanvasIcon, { name: "close" }),
5584
+ icon: /* @__PURE__ */ jsx35(CanvasIcon, { name: "close" }),
5538
5585
  "aria-label": "Remove provider",
5539
5586
  size: "md",
5540
5587
  tooltipPlacement: "bottom-end",
@@ -5542,7 +5589,7 @@ function TerraformConfigContent({ moduleKey, terraform, onSave }) {
5542
5589
  }
5543
5590
  )
5544
5591
  ] }),
5545
- /* @__PURE__ */ jsx34("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx34(
5592
+ /* @__PURE__ */ jsx35("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx35(
5546
5593
  Input6,
5547
5594
  {
5548
5595
  value: p.source,
@@ -5552,7 +5599,7 @@ function TerraformConfigContent({ moduleKey, terraform, onSave }) {
5552
5599
  readOnly: !editable
5553
5600
  }
5554
5601
  ) }),
5555
- /* @__PURE__ */ jsx34("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx34(
5602
+ /* @__PURE__ */ jsx35("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx35(
5556
5603
  Input6,
5557
5604
  {
5558
5605
  value: p.version,
@@ -5562,7 +5609,7 @@ function TerraformConfigContent({ moduleKey, terraform, onSave }) {
5562
5609
  readOnly: !editable
5563
5610
  }
5564
5611
  ) }),
5565
- (p.aliases || editable) && /* @__PURE__ */ jsx34("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx34(
5612
+ (p.aliases || editable) && /* @__PURE__ */ jsx35("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx35(
5566
5613
  Input6,
5567
5614
  {
5568
5615
  value: p.aliases,
@@ -5575,7 +5622,7 @@ function TerraformConfigContent({ moduleKey, terraform, onSave }) {
5575
5622
  }
5576
5623
  ) })
5577
5624
  ] }, p.id)),
5578
- editable && /* @__PURE__ */ jsx34(
5625
+ editable && /* @__PURE__ */ jsx35(
5579
5626
  Button11,
5580
5627
  {
5581
5628
  variant: "secondary",
@@ -5587,37 +5634,34 @@ function TerraformConfigContent({ moduleKey, terraform, onSave }) {
5587
5634
  children: "+ Add provider"
5588
5635
  }
5589
5636
  ),
5590
- /* @__PURE__ */ jsx34("h4", { className: "lace-panel-section-title", children: "Backend" }),
5591
- /* @__PURE__ */ jsx34("div", { className: "lace-panel-hint", children: "Terraform state is managed by Lace Cloud. The HTTP backend is configured automatically during generation." }),
5592
- editable && /* @__PURE__ */ jsx34(UpdateButton, { draft, label: "Update terraform block" })
5637
+ /* @__PURE__ */ jsx35("h4", { className: "lace-panel-section-title", children: "Backend" }),
5638
+ /* @__PURE__ */ jsx35("div", { className: "lace-panel-hint", children: "Terraform state is managed by Lace Cloud. The HTTP backend is configured automatically during generation." }),
5639
+ editable && /* @__PURE__ */ jsx35(UpdateButton, { draft, label: "Update terraform block" })
5593
5640
  ] });
5594
5641
  }
5595
5642
  function TerraformConfigPanel({ onClose, ...content }) {
5596
- return /* @__PURE__ */ jsx34(Panel5, { title: "Terraform Configuration", onClose, children: /* @__PURE__ */ jsx34(TerraformConfigContent, { ...content }) });
5643
+ return /* @__PURE__ */ jsx35(Panel5, { title: "Terraform Configuration", onClose, children: /* @__PURE__ */ jsx35(TerraformConfigContent, { ...content }) });
5597
5644
  }
5598
5645
 
5599
5646
  // src/components/panels/ModuleDetails.tsx
5600
- import { Fragment as Fragment13, jsx as jsx35, jsxs as jsxs22 } from "react/jsx-runtime";
5601
- function assertApplied(result) {
5602
- if (!result?.success) throw new Error("apply failed");
5603
- }
5647
+ import { Fragment as Fragment14, jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
5604
5648
  var sectionKey = (moduleKey, section) => `${moduleKey}:${section}`;
5605
5649
  function ModuleDetails({ moduleKey, open = [] }) {
5606
5650
  const { bundle, runner } = useCanvas();
5607
5651
  const settings = useMemo10(() => deriveSettingsConfig2(bundle, moduleKey), [bundle, moduleKey]);
5608
5652
  if (!settings) return null;
5609
- if (settings.reference) return /* @__PURE__ */ jsx35(ReferenceDetails, { settings });
5653
+ if (settings.reference) return /* @__PURE__ */ jsx36(ReferenceDetails, { settings });
5610
5654
  const apply = async (actions) => {
5611
5655
  assertApplied(await runner.apply(actions));
5612
5656
  };
5613
- return /* @__PURE__ */ jsxs22(Fragment13, { children: [
5614
- /* @__PURE__ */ jsx35(
5657
+ return /* @__PURE__ */ jsxs24(Fragment14, { children: [
5658
+ /* @__PURE__ */ jsx36(
5615
5659
  AccordionSection,
5616
5660
  {
5617
5661
  title: "Resources",
5618
5662
  defaultOpen: open.includes("Resources"),
5619
5663
  badge: `(${settings.resources.length})`,
5620
- children: /* @__PURE__ */ jsx35(
5664
+ children: /* @__PURE__ */ jsx36(
5621
5665
  ResourcesContent,
5622
5666
  {
5623
5667
  moduleKey,
@@ -5632,7 +5676,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
5632
5676
  )
5633
5677
  }
5634
5678
  ),
5635
- /* @__PURE__ */ jsx35(AccordionSection, { title: "Interface", defaultOpen: open.includes("Interface"), children: /* @__PURE__ */ jsx35(
5679
+ /* @__PURE__ */ jsx36(AccordionSection, { title: "Interface", defaultOpen: open.includes("Interface"), children: /* @__PURE__ */ jsx36(
5636
5680
  ModuleInterfaceContent,
5637
5681
  {
5638
5682
  moduleKey,
@@ -5641,13 +5685,13 @@ function ModuleDetails({ moduleKey, open = [] }) {
5641
5685
  },
5642
5686
  sectionKey(moduleKey, "Interface")
5643
5687
  ) }),
5644
- /* @__PURE__ */ jsx35(
5688
+ /* @__PURE__ */ jsx36(
5645
5689
  AccordionSection,
5646
5690
  {
5647
5691
  title: "Moved and import blocks",
5648
5692
  defaultOpen: open.includes("Moved and import blocks"),
5649
5693
  badge: settings.directives.length > 0 ? `(${settings.directives.length})` : void 0,
5650
- children: /* @__PURE__ */ jsx35(
5694
+ children: /* @__PURE__ */ jsx36(
5651
5695
  DirectivesContent,
5652
5696
  {
5653
5697
  moduleKey,
@@ -5658,7 +5702,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
5658
5702
  )
5659
5703
  }
5660
5704
  ),
5661
- /* @__PURE__ */ jsx35(AccordionSection, { title: "Locals", defaultOpen: open.includes("Locals"), children: /* @__PURE__ */ jsx35(
5705
+ /* @__PURE__ */ jsx36(AccordionSection, { title: "Locals", defaultOpen: open.includes("Locals"), children: /* @__PURE__ */ jsx36(
5662
5706
  LocalsContent,
5663
5707
  {
5664
5708
  moduleKey,
@@ -5667,7 +5711,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
5667
5711
  },
5668
5712
  sectionKey(moduleKey, "Locals")
5669
5713
  ) }),
5670
- /* @__PURE__ */ jsx35(AccordionSection, { title: "Providers", defaultOpen: open.includes("Providers"), children: /* @__PURE__ */ jsx35(
5714
+ /* @__PURE__ */ jsx36(AccordionSection, { title: "Providers", defaultOpen: open.includes("Providers"), children: /* @__PURE__ */ jsx36(
5671
5715
  ProvidersContent,
5672
5716
  {
5673
5717
  moduleKey,
@@ -5676,7 +5720,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
5676
5720
  },
5677
5721
  sectionKey(moduleKey, "Providers")
5678
5722
  ) }),
5679
- /* @__PURE__ */ jsx35(AccordionSection, { title: "Terraform Config", defaultOpen: open.includes("Terraform Config"), children: /* @__PURE__ */ jsx35(
5723
+ /* @__PURE__ */ jsx36(AccordionSection, { title: "Terraform Config", defaultOpen: open.includes("Terraform Config"), children: /* @__PURE__ */ jsx36(
5680
5724
  TerraformConfigContent,
5681
5725
  {
5682
5726
  moduleKey,
@@ -5705,9 +5749,9 @@ function DirectivesContent({
5705
5749
  ({ blocks: blocks2 }) => onSave(blocks2)
5706
5750
  );
5707
5751
  const { blocks } = draft.value;
5708
- return /* @__PURE__ */ jsxs22(Fragment13, { children: [
5709
- blocks.length === 0 && /* @__PURE__ */ jsx35("div", { className: "lace-panel-hint", children: "No moved or import blocks." }),
5710
- /* @__PURE__ */ jsx35(
5752
+ return /* @__PURE__ */ jsxs24(Fragment14, { children: [
5753
+ blocks.length === 0 && /* @__PURE__ */ jsx36("div", { className: "lace-panel-hint", children: "No moved or import blocks." }),
5754
+ /* @__PURE__ */ jsx36(
5711
5755
  BlockEditor,
5712
5756
  {
5713
5757
  blocks,
@@ -5719,32 +5763,32 @@ function DirectivesContent({
5719
5763
  ]
5720
5764
  }
5721
5765
  ),
5722
- editable && /* @__PURE__ */ jsx35(UpdateButton, { draft, label: "Update moved and import blocks" })
5766
+ editable && /* @__PURE__ */ jsx36(UpdateButton, { draft, label: "Update moved and import blocks" })
5723
5767
  ] });
5724
5768
  }
5725
5769
  function ReferenceDetails({ settings }) {
5726
5770
  const reference = settings.reference;
5727
5771
  if (!reference) return null;
5728
- return /* @__PURE__ */ jsxs22(Fragment13, { children: [
5729
- /* @__PURE__ */ jsxs22(AccordionSection, { title: "Source", defaultOpen: true, children: [
5730
- /* @__PURE__ */ jsx35("div", { className: "lace-panel-hint", children: "A reference: Lace reads it where its source points and never edits it." }),
5731
- /* @__PURE__ */ jsxs22("div", { className: "lace-panel-row-actions lace-panel-row-actions--stacked", children: [
5732
- /* @__PURE__ */ jsx35(Input7, { label: "Source", value: reference.source, fullWidth: true, mono: true, readOnly: true }),
5733
- /* @__PURE__ */ jsx35(Input7, { label: "Version", value: reference.version, fullWidth: true, mono: true, readOnly: true })
5772
+ return /* @__PURE__ */ jsxs24(Fragment14, { children: [
5773
+ /* @__PURE__ */ jsxs24(AccordionSection, { title: "Source", defaultOpen: true, children: [
5774
+ /* @__PURE__ */ jsx36("div", { className: "lace-panel-hint", children: "A reference: Lace reads it where its source points and never edits it." }),
5775
+ /* @__PURE__ */ jsxs24("div", { className: "lace-panel-row-actions lace-panel-row-actions--stacked", children: [
5776
+ /* @__PURE__ */ jsx36(Input7, { label: "Source", value: reference.source, fullWidth: true, mono: true, readOnly: true }),
5777
+ /* @__PURE__ */ jsx36(Input7, { label: "Version", value: reference.version, fullWidth: true, mono: true, readOnly: true })
5734
5778
  ] })
5735
5779
  ] }),
5736
- /* @__PURE__ */ jsxs22(AccordionSection, { title: "Interface", defaultOpen: true, children: [
5737
- /* @__PURE__ */ jsx35("h4", { className: "lace-panel-section-title", children: "Inputs" }),
5738
- settings.variables.length === 0 && /* @__PURE__ */ jsx35("div", { className: "lace-panel-hint", children: "The IR holds no interface for this reference." }),
5739
- 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)),
5740
- /* @__PURE__ */ jsx35("h4", { className: "lace-panel-section-title", children: "Outputs" }),
5741
- settings.outputs.map((o) => /* @__PURE__ */ jsx35("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx35(Identifier, { text: typedName(o.name, o.type) }) }, o.name))
5780
+ /* @__PURE__ */ jsxs24(AccordionSection, { title: "Interface", defaultOpen: true, children: [
5781
+ /* @__PURE__ */ jsx36("h4", { className: "lace-panel-section-title", children: "Inputs" }),
5782
+ settings.variables.length === 0 && /* @__PURE__ */ jsx36("div", { className: "lace-panel-hint", children: "The IR holds no interface for this reference." }),
5783
+ settings.variables.map((v) => /* @__PURE__ */ jsx36("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx36(Identifier, { text: `${typedName(v.name, v.type)}${v.required ? " (required)" : ""}` }) }, v.name)),
5784
+ /* @__PURE__ */ jsx36("h4", { className: "lace-panel-section-title", children: "Outputs" }),
5785
+ settings.outputs.map((o) => /* @__PURE__ */ jsx36("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx36(Identifier, { text: typedName(o.name, o.type) }) }, o.name))
5742
5786
  ] })
5743
5787
  ] });
5744
5788
  }
5745
5789
 
5746
5790
  // src/components/panels/ModuleConfigPanel.tsx
5747
- import { Fragment as Fragment14, jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
5791
+ import { Fragment as Fragment15, jsx as jsx37, jsxs as jsxs25 } from "react/jsx-runtime";
5748
5792
  var MODE_ITEMS = [
5749
5793
  { value: "empty", label: "Unset" },
5750
5794
  { value: "literal", label: "Lit" },
@@ -5863,8 +5907,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5863
5907
  const seed = useMemo11(() => callFields(config), [config]);
5864
5908
  const draft = useDraft(callDraft, [instance_id], seed, async (fields2) => {
5865
5909
  if (!config) throw new Error(`no instance ${instance_id} to update`);
5866
- const result = await runner.apply(callActions(config, address, fields2));
5867
- if (!result?.success) throw new Error("apply failed");
5910
+ assertApplied(await runner.apply(callActions(config, address, fields2)));
5868
5911
  });
5869
5912
  const fields = draft.value;
5870
5913
  const binding = (input) => fields[inputField(input.name)];
@@ -5896,41 +5939,41 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5896
5939
  ...m,
5897
5940
  disabled: !editable || m.value === "wired" || currentMode === "wired"
5898
5941
  }));
5899
- return /* @__PURE__ */ jsx36(
5900
- ModeToggle,
5942
+ return /* @__PURE__ */ jsx37(
5943
+ SegmentedControl,
5901
5944
  {
5945
+ label: `${input.name} binding mode`,
5902
5946
  value: currentMode,
5903
5947
  onChange: (next) => switchMode(input, next),
5904
- items,
5905
- "aria-label": `${input.name} binding mode`
5948
+ options: items
5906
5949
  }
5907
5950
  );
5908
5951
  }
5909
5952
  function renderInputField(input) {
5910
5953
  const currentMode = binding(input)?.mode ?? input.mode;
5911
- return /* @__PURE__ */ jsxs23("div", { className: "lace-panel-field", children: [
5912
- /* @__PURE__ */ jsxs23("label", { className: "lace-panel-row-label", children: [
5913
- /* @__PURE__ */ jsx36(Identifier, { text: input.name }),
5914
- input.required && /* @__PURE__ */ jsx36("span", { className: "lace-mcp__required-star", children: "*" })
5954
+ return /* @__PURE__ */ jsxs25("div", { className: "lace-panel-field", children: [
5955
+ /* @__PURE__ */ jsxs25("label", { className: "lace-panel-row-label", children: [
5956
+ /* @__PURE__ */ jsx37(Identifier, { text: input.name }),
5957
+ input.required && /* @__PURE__ */ jsx37("span", { className: "lace-mcp__required-star", children: "*" })
5915
5958
  ] }),
5916
5959
  renderModeSelector(input),
5917
- /* @__PURE__ */ jsxs23("div", { className: "lace-panel-row-content", children: [
5960
+ /* @__PURE__ */ jsxs25("div", { className: "lace-panel-row-content", children: [
5918
5961
  currentMode === "wired" && renderWiredEditor(input),
5919
5962
  currentMode === "variable" && renderVariableEditor(input),
5920
5963
  currentMode === "expression" && renderExpressionEditor(input),
5921
5964
  currentMode === "literal" && renderLiteralEditor(input)
5922
5965
  ] }),
5923
- input.description && /* @__PURE__ */ jsx36("div", { className: "lace-panel-field__description", children: input.description })
5966
+ input.description && /* @__PURE__ */ jsx37("div", { className: "lace-panel-field__description", children: input.description })
5924
5967
  ] }, input.name);
5925
5968
  }
5926
5969
  function renderWiredEditor(input) {
5927
5970
  const label = input.wired_source ?? "Not wired";
5928
- return /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__wired-row", children: [
5929
- /* @__PURE__ */ jsx36("div", { className: "lace-mcp__wired-input", children: /* @__PURE__ */ jsx36(Input8, { value: label, readOnly: true, fullWidth: true, mono: true }) }),
5930
- editable && /* @__PURE__ */ jsx36(
5971
+ return /* @__PURE__ */ jsxs25("div", { className: "lace-mcp__wired-row", children: [
5972
+ /* @__PURE__ */ jsx37("div", { className: "lace-mcp__wired-input", children: /* @__PURE__ */ jsx37(Input8, { value: label, readOnly: true, fullWidth: true, mono: true }) }),
5973
+ editable && /* @__PURE__ */ jsx37(
5931
5974
  IconButton9,
5932
5975
  {
5933
- icon: /* @__PURE__ */ jsx36(CanvasIcon, { name: "close" }),
5976
+ icon: /* @__PURE__ */ jsx37(CanvasIcon, { name: "close" }),
5934
5977
  "aria-label": "Disconnect this input",
5935
5978
  size: "md",
5936
5979
  tooltipPlacement: "bottom-end",
@@ -5940,7 +5983,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5940
5983
  ] });
5941
5984
  }
5942
5985
  function renderVariableEditor(input) {
5943
- return /* @__PURE__ */ jsx36(
5986
+ return /* @__PURE__ */ jsx37(
5944
5987
  Input8,
5945
5988
  {
5946
5989
  value: binding(input)?.variable ?? "",
@@ -5956,7 +5999,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5956
5999
  );
5957
6000
  }
5958
6001
  function renderExpressionEditor(input) {
5959
- return /* @__PURE__ */ jsx36(
6002
+ return /* @__PURE__ */ jsx37(
5960
6003
  Textarea3,
5961
6004
  {
5962
6005
  value: binding(input)?.expression ?? "",
@@ -5974,7 +6017,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5974
6017
  const kind = literalKind(input.type);
5975
6018
  const updateValue = (next) => setBinding(input, { value: next });
5976
6019
  if (kind === "bool") {
5977
- return /* @__PURE__ */ jsxs23(
6020
+ return /* @__PURE__ */ jsxs25(
5978
6021
  "select",
5979
6022
  {
5980
6023
  className: "lace-mcp__select",
@@ -5982,14 +6025,14 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5982
6025
  onChange: (e) => updateValue(e.target.value === "true"),
5983
6026
  disabled: !editable,
5984
6027
  children: [
5985
- /* @__PURE__ */ jsx36("option", { value: "true", children: "True" }),
5986
- /* @__PURE__ */ jsx36("option", { value: "false", children: "False" })
6028
+ /* @__PURE__ */ jsx37("option", { value: "true", children: "True" }),
6029
+ /* @__PURE__ */ jsx37("option", { value: "false", children: "False" })
5987
6030
  ]
5988
6031
  }
5989
6032
  );
5990
6033
  }
5991
6034
  if (kind === "number") {
5992
- return /* @__PURE__ */ jsx36(
6035
+ return /* @__PURE__ */ jsx37(
5993
6036
  Input8,
5994
6037
  {
5995
6038
  type: "number",
@@ -6002,7 +6045,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
6002
6045
  }
6003
6046
  if (kind === "collection") {
6004
6047
  const jsonStr = typeof value === "string" ? value : JSON.stringify(value ?? null, null, 2);
6005
- return /* @__PURE__ */ jsx36(
6048
+ return /* @__PURE__ */ jsx37(
6006
6049
  Textarea3,
6007
6050
  {
6008
6051
  value: jsonStr,
@@ -6020,7 +6063,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
6020
6063
  }
6021
6064
  );
6022
6065
  }
6023
- return /* @__PURE__ */ jsx36(
6066
+ return /* @__PURE__ */ jsx37(
6024
6067
  Input8,
6025
6068
  {
6026
6069
  value: String(value ?? ""),
@@ -6037,34 +6080,34 @@ function ModuleConfigPanel({ instance_id, onClose }) {
6037
6080
  );
6038
6081
  }
6039
6082
  if (!config) {
6040
- return /* @__PURE__ */ jsxs23(Panel6, { title: "Error", onClose, children: [
6041
- /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__error-title", children: [
6083
+ return /* @__PURE__ */ jsxs25(Panel6, { title: "Error", onClose, children: [
6084
+ /* @__PURE__ */ jsxs25("div", { className: "lace-mcp__error-title", children: [
6042
6085
  'Failed to load configuration for "',
6043
6086
  instance_id,
6044
6087
  '":'
6045
6088
  ] }),
6046
- /* @__PURE__ */ jsx36("div", { className: "lace-mcp__error-detail", children: "Instance not found in the current Bundle." })
6089
+ /* @__PURE__ */ jsx37("div", { className: "lace-mcp__error-detail", children: "Instance not found in the current Bundle." })
6047
6090
  ] });
6048
6091
  }
6049
6092
  const dependsOn = fields.depends_on;
6050
6093
  const setProviders2 = (next) => draft.set("providers", next);
6051
- const title = /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__title", children: [
6052
- /* @__PURE__ */ jsx36("div", { className: "lace-mcp__title-eyebrow", children: "Module" }),
6053
- /* @__PURE__ */ jsx36("h3", { className: "lace-mcp__title-id", children: /* @__PURE__ */ jsx36(Identifier, { text: instance_id }) })
6094
+ const title = /* @__PURE__ */ jsxs25("div", { className: "lace-mcp__title", children: [
6095
+ /* @__PURE__ */ jsx37("div", { className: "lace-mcp__title-eyebrow", children: "Module" }),
6096
+ /* @__PURE__ */ jsx37("h3", { className: "lace-mcp__title-id", children: /* @__PURE__ */ jsx37(Identifier, { text: instance_id }) })
6054
6097
  ] });
6055
- const footer = editable ? /* @__PURE__ */ jsx36(UpdateButton, { draft, label: "Update configuration" }) : void 0;
6056
- return /* @__PURE__ */ jsxs23(Panel6, { title, footer, flush: true, onClose, children: [
6057
- requiredInputs.length > 0 && /* @__PURE__ */ jsx36(AccordionSection, { title: "Required Inputs", defaultOpen: true, badge: `(${requiredInputs.length})`, children: requiredInputs.map(renderInputField) }),
6058
- optionalInputs.length > 0 && /* @__PURE__ */ jsx36(AccordionSection, { title: "Optional Inputs", defaultOpen: true, badge: `(${optionalInputs.length})`, children: optionalInputs.map(renderInputField) }),
6059
- config.dependency_options.length > 0 && /* @__PURE__ */ jsxs23(
6098
+ const footer = editable ? /* @__PURE__ */ jsx37(UpdateButton, { draft, label: "Update configuration" }) : void 0;
6099
+ return /* @__PURE__ */ jsxs25(Panel6, { title, footer, flush: true, onClose, children: [
6100
+ requiredInputs.length > 0 && /* @__PURE__ */ jsx37(AccordionSection, { title: "Required Inputs", defaultOpen: true, badge: `(${requiredInputs.length})`, children: requiredInputs.map(renderInputField) }),
6101
+ optionalInputs.length > 0 && /* @__PURE__ */ jsx37(AccordionSection, { title: "Optional Inputs", defaultOpen: true, badge: `(${optionalInputs.length})`, children: optionalInputs.map(renderInputField) }),
6102
+ config.dependency_options.length > 0 && /* @__PURE__ */ jsxs25(
6060
6103
  AccordionSection,
6061
6104
  {
6062
6105
  title: "Depends On",
6063
6106
  badge: dependsOn.length > 0 ? `(${dependsOn.length})` : void 0,
6064
6107
  children: [
6065
- /* @__PURE__ */ jsx36("div", { className: "lace-mcp__depends-hint", children: "Select sibling instances this module depends on." }),
6066
- config.dependency_options.map((option) => /* @__PURE__ */ jsxs23("label", { className: "lace-mcp__depends-item", children: [
6067
- /* @__PURE__ */ jsx36(
6108
+ /* @__PURE__ */ jsx37("div", { className: "lace-mcp__depends-hint", children: "Select sibling instances this module depends on." }),
6109
+ config.dependency_options.map((option) => /* @__PURE__ */ jsxs25("label", { className: "lace-mcp__depends-item", children: [
6110
+ /* @__PURE__ */ jsx37(
6068
6111
  "input",
6069
6112
  {
6070
6113
  type: "checkbox",
@@ -6077,29 +6120,29 @@ function ModuleConfigPanel({ instance_id, onClose }) {
6077
6120
  )
6078
6121
  }
6079
6122
  ),
6080
- /* @__PURE__ */ jsx36(Identifier, { className: "lace-mcp__depends-label", text: option })
6123
+ /* @__PURE__ */ jsx37(Identifier, { className: "lace-mcp__depends-label", text: option })
6081
6124
  ] }, option))
6082
6125
  ]
6083
6126
  }
6084
6127
  ),
6085
- (fields.providers.length > 0 || editable) && /* @__PURE__ */ jsxs23(
6128
+ (fields.providers.length > 0 || editable) && /* @__PURE__ */ jsxs25(
6086
6129
  AccordionSection,
6087
6130
  {
6088
6131
  title: "Providers",
6089
6132
  badge: fields.providers.length > 0 ? `(${fields.providers.length})` : void 0,
6090
6133
  children: [
6091
- /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__depends-hint", children: [
6134
+ /* @__PURE__ */ jsxs25("div", { className: "lace-mcp__depends-hint", children: [
6092
6135
  "Map each child-local provider name to the root provider reference passed down (e.g.",
6093
6136
  " ",
6094
- /* @__PURE__ */ jsx36("code", { children: "aws" }),
6137
+ /* @__PURE__ */ jsx37("code", { children: "aws" }),
6095
6138
  " \u2192 ",
6096
- /* @__PURE__ */ jsx36("code", { children: "aws.west" }),
6139
+ /* @__PURE__ */ jsx37("code", { children: "aws.west" }),
6097
6140
  ")."
6098
6141
  ] }),
6099
6142
  fields.providers.map((row, i) => (
6100
6143
  // biome-ignore lint/suspicious/noArrayIndexKey: rows are positional and freely editable
6101
- /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__provider-row", children: [
6102
- /* @__PURE__ */ jsx36(
6144
+ /* @__PURE__ */ jsxs25("div", { className: "lace-mcp__provider-row", children: [
6145
+ /* @__PURE__ */ jsx37(
6103
6146
  Input8,
6104
6147
  {
6105
6148
  value: row.key,
@@ -6111,8 +6154,8 @@ function ModuleConfigPanel({ instance_id, onClose }) {
6111
6154
  readOnly: !editable
6112
6155
  }
6113
6156
  ),
6114
- /* @__PURE__ */ jsx36("span", { className: "lace-mcp__provider-arrow", children: "=" }),
6115
- /* @__PURE__ */ jsx36(
6157
+ /* @__PURE__ */ jsx37("span", { className: "lace-mcp__provider-arrow", children: "=" }),
6158
+ /* @__PURE__ */ jsx37(
6116
6159
  Input8,
6117
6160
  {
6118
6161
  value: row.value,
@@ -6124,10 +6167,10 @@ function ModuleConfigPanel({ instance_id, onClose }) {
6124
6167
  readOnly: !editable
6125
6168
  }
6126
6169
  ),
6127
- editable && /* @__PURE__ */ jsx36(
6170
+ editable && /* @__PURE__ */ jsx37(
6128
6171
  IconButton9,
6129
6172
  {
6130
- icon: /* @__PURE__ */ jsx36(CanvasIcon, { name: "close" }),
6173
+ icon: /* @__PURE__ */ jsx37(CanvasIcon, { name: "close" }),
6131
6174
  "aria-label": "Remove this provider mapping",
6132
6175
  size: "md",
6133
6176
  tooltipPlacement: "bottom-end",
@@ -6136,7 +6179,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
6136
6179
  )
6137
6180
  ] }, i)
6138
6181
  )),
6139
- editable && /* @__PURE__ */ jsx36(
6182
+ editable && /* @__PURE__ */ jsx37(
6140
6183
  Button12,
6141
6184
  {
6142
6185
  variant: "secondary",
@@ -6148,15 +6191,15 @@ function ModuleConfigPanel({ instance_id, onClose }) {
6148
6191
  ]
6149
6192
  }
6150
6193
  ),
6151
- (fields.count || fields.for_each || editable) && /* @__PURE__ */ jsxs23(AccordionSection, { title: "Repetition", children: [
6152
- /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__depends-hint", children: [
6194
+ (fields.count || fields.for_each || editable) && /* @__PURE__ */ jsxs25(AccordionSection, { title: "Repetition", children: [
6195
+ /* @__PURE__ */ jsxs25("div", { className: "lace-mcp__depends-hint", children: [
6153
6196
  "The call's ",
6154
- /* @__PURE__ */ jsx36("code", { children: "count" }),
6197
+ /* @__PURE__ */ jsx37("code", { children: "count" }),
6155
6198
  " or ",
6156
- /* @__PURE__ */ jsx36("code", { children: "for_each" }),
6199
+ /* @__PURE__ */ jsx37("code", { children: "for_each" }),
6157
6200
  ": one module, called once per instance."
6158
6201
  ] }),
6159
- /* @__PURE__ */ jsx36(
6202
+ /* @__PURE__ */ jsx37(
6160
6203
  Input8,
6161
6204
  {
6162
6205
  label: "count",
@@ -6168,7 +6211,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
6168
6211
  readOnly: !editable
6169
6212
  }
6170
6213
  ),
6171
- /* @__PURE__ */ jsx36(
6214
+ /* @__PURE__ */ jsx37(
6172
6215
  Input8,
6173
6216
  {
6174
6217
  label: "for_each",
@@ -6181,26 +6224,26 @@ function ModuleConfigPanel({ instance_id, onClose }) {
6181
6224
  }
6182
6225
  )
6183
6226
  ] }),
6184
- 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: [
6185
- /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__output-header", children: [
6186
- /* @__PURE__ */ jsx36(Identifier, { className: "lace-mcp__output-name", text: o.name }),
6187
- /* @__PURE__ */ jsx36(Identifier, { className: "lace-mcp__output-type", text: o.type ?? "" })
6227
+ config.outputs.length > 0 && /* @__PURE__ */ jsx37(AccordionSection, { title: "Outputs", badge: `(${config.outputs.length})`, children: config.outputs.map((o) => /* @__PURE__ */ jsxs25("div", { className: "lace-mcp__output-card", children: [
6228
+ /* @__PURE__ */ jsxs25("div", { className: "lace-mcp__output-header", children: [
6229
+ /* @__PURE__ */ jsx37(Identifier, { className: "lace-mcp__output-name", text: o.name }),
6230
+ /* @__PURE__ */ jsx37(Identifier, { className: "lace-mcp__output-type", text: o.type ?? "" })
6188
6231
  ] }),
6189
- o.description && /* @__PURE__ */ jsx36("div", { className: "lace-mcp__output-description", children: o.description }),
6190
- o.sensitive && /* @__PURE__ */ jsx36("div", { className: "lace-mcp__output-sensitive", children: "sensitive" })
6232
+ o.description && /* @__PURE__ */ jsx37("div", { className: "lace-mcp__output-description", children: o.description }),
6233
+ o.sensitive && /* @__PURE__ */ jsx37("div", { className: "lace-mcp__output-sensitive", children: "sensitive" })
6191
6234
  ] }, o.name)) }),
6192
- config.module_key && /* @__PURE__ */ jsxs23(Fragment14, { children: [
6193
- /* @__PURE__ */ jsxs23("div", { className: "lace-mcp__module-heading", children: [
6194
- /* @__PURE__ */ jsx36("div", { className: "lace-mcp__title-eyebrow", children: "Called module" }),
6195
- /* @__PURE__ */ jsxs23("div", { children: [
6196
- /* @__PURE__ */ jsx36(Identifier, { text: config.module_key }),
6197
- config.source && /* @__PURE__ */ jsxs23("span", { className: "lace-mcp__module-source", children: [
6235
+ config.module_key && /* @__PURE__ */ jsxs25(Fragment15, { children: [
6236
+ /* @__PURE__ */ jsxs25("div", { className: "lace-mcp__module-heading", children: [
6237
+ /* @__PURE__ */ jsx37("div", { className: "lace-mcp__title-eyebrow", children: "Called module" }),
6238
+ /* @__PURE__ */ jsxs25("div", { children: [
6239
+ /* @__PURE__ */ jsx37(Identifier, { text: config.module_key }),
6240
+ config.source && /* @__PURE__ */ jsxs25("span", { className: "lace-mcp__module-source", children: [
6198
6241
  " \xB7 ",
6199
- /* @__PURE__ */ jsx36(Identifier, { text: config.source })
6242
+ /* @__PURE__ */ jsx37(Identifier, { text: config.source })
6200
6243
  ] })
6201
6244
  ] })
6202
6245
  ] }),
6203
- /* @__PURE__ */ jsx36(ModuleDetails, { moduleKey: config.module_key }, config.module_key)
6246
+ /* @__PURE__ */ jsx37(ModuleDetails, { moduleKey: config.module_key }, config.module_key)
6204
6247
  ] })
6205
6248
  ] });
6206
6249
  }
@@ -6226,11 +6269,11 @@ var moduleConfigPanel = {
6226
6269
  };
6227
6270
 
6228
6271
  // src/core/panels/SourceRefusedBanner.tsx
6229
- import { jsx as jsx37 } from "react/jsx-runtime";
6272
+ import { jsx as jsx38 } from "react/jsx-runtime";
6230
6273
  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.";
6231
6274
  var OUT_OF_LACE_SHAPE = "This Terraform is not in lace shape yet, so the canvas shows it read-only.";
6232
6275
  function SourceRefusedBanner({ ctx }) {
6233
- return /* @__PURE__ */ jsx37(
6276
+ return /* @__PURE__ */ jsx38(
6234
6277
  RowActionBanner,
6235
6278
  {
6236
6279
  ctx,
@@ -6256,11 +6299,11 @@ import { createElement as createElement3 } from "react";
6256
6299
 
6257
6300
  // src/components/panels/UnifiedSettingsPanel.tsx
6258
6301
  import { Panel as Panel7 } from "@lace-cloud/ui";
6259
- import "./panels-shared-3HUQC7TC.css";
6260
- import { jsx as jsx38 } from "react/jsx-runtime";
6302
+ import "./panels-shared-Y4ULZZLB.css";
6303
+ import { jsx as jsx39 } from "react/jsx-runtime";
6261
6304
  function UnifiedSettingsPanel({ onClose }) {
6262
6305
  const { bundle } = useCanvas();
6263
- return /* @__PURE__ */ jsx38(Panel7, { title: "Settings", flush: true, onClose, children: /* @__PURE__ */ jsx38(ModuleDetails, { moduleKey: bundle.entry, open: ["Interface"] }, bundle.entry) });
6306
+ return /* @__PURE__ */ jsx39(Panel7, { title: "Settings", flush: true, onClose, children: /* @__PURE__ */ jsx39(ModuleDetails, { moduleKey: bundle.entry, open: ["Interface"] }, bundle.entry) });
6264
6307
  }
6265
6308
 
6266
6309
  // src/core/panels/settings.ts
@@ -6299,7 +6342,7 @@ var settingsToggle = {
6299
6342
 
6300
6343
  // src/core/contributions.ts
6301
6344
  var CORE_CONTRIBUTIONS = {
6302
- overlays: [describeOverlay],
6345
+ overlays: [describeOverlay, planOverlay],
6303
6346
  panels: [
6304
6347
  conflictPanel,
6305
6348
  sourceRefusedPanel,
@@ -6328,7 +6371,7 @@ function useEditing(runner) {
6328
6371
  }
6329
6372
 
6330
6373
  // src/App.tsx
6331
- import { jsx as jsx39, jsxs as jsxs24 } from "react/jsx-runtime";
6374
+ import { jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
6332
6375
  var EMPTY_CONTRIBUTIONS = { overlays: [], panels: [], actions: [] };
6333
6376
  var NO_TARGET = {};
6334
6377
  function OverlayRunner({
@@ -6347,7 +6390,7 @@ function OverlayRunner({
6347
6390
  },
6348
6391
  [ctx.ports.presenter]
6349
6392
  );
6350
- return /* @__PURE__ */ jsx39(PanelScope, { ctx, paths: overlay.paths, tick, onReadError, children: /* @__PURE__ */ jsx39(OverlayDecorations, { overlay, ctx, onDecorations }) });
6393
+ return /* @__PURE__ */ jsx40(PanelScope, { ctx, paths: overlay.paths, tick, onReadError, children: /* @__PURE__ */ jsx40(OverlayDecorations, { overlay, ctx, onDecorations }) });
6351
6394
  }
6352
6395
  function OverlayDecorations({
6353
6396
  overlay,
@@ -6376,7 +6419,7 @@ function PanelSlot({ panel, ctx, tick }) {
6376
6419
  return next;
6377
6420
  });
6378
6421
  }, []);
6379
- return /* @__PURE__ */ jsxs24(
6422
+ return /* @__PURE__ */ jsxs26(
6380
6423
  PanelScope,
6381
6424
  {
6382
6425
  ctx,
@@ -6384,13 +6427,13 @@ function PanelSlot({ panel, ctx, tick }) {
6384
6427
  tick,
6385
6428
  onReadError,
6386
6429
  children: [
6387
- [...readErrors].map(([path, error]) => /* @__PURE__ */ jsxs24("p", { className: "lace-app__panel-error", children: [
6430
+ [...readErrors].map(([path, error]) => /* @__PURE__ */ jsxs26("p", { className: "lace-app__panel-error", children: [
6388
6431
  "Couldn't load ",
6389
6432
  path,
6390
6433
  ": ",
6391
6434
  error.message
6392
6435
  ] }, path)),
6393
- /* @__PURE__ */ jsx39(panel.Component, { ctx })
6436
+ /* @__PURE__ */ jsx40(panel.Component, { ctx })
6394
6437
  ]
6395
6438
  }
6396
6439
  );
@@ -6404,8 +6447,8 @@ function BottomTabs({
6404
6447
  const manual = manualId !== null ? panels.find((p) => p.id === manualId) : void 0;
6405
6448
  const active = manual ?? panels[0] ?? null;
6406
6449
  if (panels.length === 0) return null;
6407
- return /* @__PURE__ */ jsxs24("div", { className: "lace-app__bottom", children: [
6408
- /* @__PURE__ */ jsx39("div", { className: "lace-app__bottom-tabs", role: "tablist", children: panels.map((panel) => /* @__PURE__ */ jsx39(
6450
+ return /* @__PURE__ */ jsxs26("div", { className: "lace-app__bottom", children: [
6451
+ /* @__PURE__ */ jsx40("div", { className: "lace-app__bottom-tabs", role: "tablist", children: panels.map((panel) => /* @__PURE__ */ jsx40(
6409
6452
  "button",
6410
6453
  {
6411
6454
  type: "button",
@@ -6417,7 +6460,7 @@ function BottomTabs({
6417
6460
  },
6418
6461
  panel.id
6419
6462
  )) }),
6420
- /* @__PURE__ */ jsx39("div", { className: "lace-app__bottom-content", children: active && /* @__PURE__ */ jsx39(PanelSlot, { panel: active, ctx, tick }) })
6463
+ /* @__PURE__ */ jsx40("div", { className: "lace-app__bottom-content", children: active && /* @__PURE__ */ jsx40(PanelSlot, { panel: active, ctx, tick }) })
6421
6464
  ] });
6422
6465
  }
6423
6466
  function endMessage(end) {
@@ -6515,7 +6558,7 @@ function App({
6515
6558
  }, [source, stored, ports.source]);
6516
6559
  const arrangement = projected?.arrangement ?? stored;
6517
6560
  const view = projected?.view ?? null;
6518
- useLayoutEffect5(() => {
6561
+ useLayoutEffect6(() => {
6519
6562
  if (!source || !projected) return;
6520
6563
  const held = ledgerFor(portLedger.current, ports.source);
6521
6564
  const landed = held.shown?.source !== source;
@@ -6530,12 +6573,22 @@ function App({
6530
6573
  queueMicrotask(() => ports.viewState.save(corrected));
6531
6574
  }, [source, projected, stored, ports.source, ports.viewState]);
6532
6575
  const reconciledFrame = useRef12(null);
6533
- useLayoutEffect5(() => {
6576
+ useLayoutEffect6(() => {
6534
6577
  if (!source || !view || reconciledFrame.current === source) return;
6535
6578
  reconciledFrame.current = source;
6536
6579
  setSelection((current) => reconcileSelection(view, current));
6537
6580
  }, [source, view]);
6538
- useLayoutEffect5(() => {
6581
+ const selectionPort = ports.selection;
6582
+ const heardModules = useRef12(NO_SELECTION.nodes);
6583
+ useEffect13(() => {
6584
+ if (!selectionPort) return;
6585
+ const modules = selection.nodes;
6586
+ const heard = heardModules.current;
6587
+ if (modules.length === heard.length && modules.every((id) => heard.includes(id))) return;
6588
+ heardModules.current = modules;
6589
+ selectionPort.selected(modules);
6590
+ }, [selectionPort, selection.nodes]);
6591
+ useLayoutEffect6(() => {
6539
6592
  if (source) drafts.settle(source.bundle);
6540
6593
  }, [source, drafts]);
6541
6594
  const editable = ports.editor !== void 0 && !source?.sourceRefused;
@@ -6564,6 +6617,7 @@ function App({
6564
6617
  root: ports.context.root,
6565
6618
  sessionId: ports.context.sessionId,
6566
6619
  stack,
6620
+ run: ports.context.run,
6567
6621
  editable,
6568
6622
  generating: source.generating,
6569
6623
  sourceRefused: source.sourceRefused,
@@ -6605,7 +6659,7 @@ function App({
6605
6659
  resolved.panels.filter((panel) => panel.slot === "toolbar")
6606
6660
  );
6607
6661
  const rootRef = useRef12(null);
6608
- useEffect13(() => {
6662
+ useLayoutEffect6(() => {
6609
6663
  if (!ctx) return;
6610
6664
  registerKeyTarget(ctx, "app", rootRef.current);
6611
6665
  return () => registerKeyTarget(ctx, "app", null);
@@ -6615,7 +6669,7 @@ function App({
6615
6669
  useFocusKeptOnRemoval(rootRef, rootMounted);
6616
6670
  useActionKeys(ctx && envExtras ? resolved.actions : [], ctx, runner, envExtras);
6617
6671
  if (!ctx || !view || !source || !envExtras) {
6618
- return end ? /* @__PURE__ */ jsx39(ErrorState, { message: endMessage(end) }) : null;
6672
+ return end ? /* @__PURE__ */ jsx40(CanvasRoot_default, { className: "lace-app", style: { height }, children: /* @__PURE__ */ jsx40(ErrorState, { message: endMessage(end) }) }) : null;
6619
6673
  }
6620
6674
  const contextValue = {
6621
6675
  ports,
@@ -6637,8 +6691,8 @@ function App({
6637
6691
  const bannerPanels = resolved.panels.filter((panel) => panel.slot === "banner");
6638
6692
  const bottomPanels = resolved.panels.filter((panel) => panel.slot === "bottom");
6639
6693
  const drawerPanel = resolved.panels.find((panel) => panel.slot === "drawer");
6640
- return /* @__PURE__ */ jsxs24(ErrorBoundary, { children: [
6641
- resolved.overlays.map((overlay) => /* @__PURE__ */ jsx39(
6694
+ return /* @__PURE__ */ jsx40(CanvasRoot_default, { ref: rootRef, className: "lace-app", style: { height }, tabIndex: -1, children: /* @__PURE__ */ jsxs26(ErrorBoundary, { children: [
6695
+ resolved.overlays.map((overlay) => /* @__PURE__ */ jsx40(
6642
6696
  OverlayRunner,
6643
6697
  {
6644
6698
  overlay,
@@ -6648,15 +6702,15 @@ function App({
6648
6702
  },
6649
6703
  overlay.id
6650
6704
  )),
6651
- /* @__PURE__ */ jsx39(CanvasContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs24("div", { ref: rootRef, className: "lace-app", style: { height }, tabIndex: -1, children: [
6652
- (toolbar.sections.length > 0 || toolbar.trailing.length > 0) && /* @__PURE__ */ jsxs24("div", { className: "lace-app__toolbar", children: [
6653
- toolbar.sections.map((section, index) => /* @__PURE__ */ jsxs24(Fragment15, { children: [
6654
- index > 0 ? /* @__PURE__ */ jsx39("span", { className: "lace-app__toolbar-separator", "aria-hidden": "true" }) : null,
6655
- /* @__PURE__ */ jsxs24("div", { className: "lace-app__toolbar-section", children: [
6705
+ /* @__PURE__ */ jsxs26(CanvasContext.Provider, { value: contextValue, children: [
6706
+ (toolbar.sections.length > 0 || toolbar.trailing.length > 0) && /* @__PURE__ */ jsxs26("div", { className: "lace-app__toolbar", children: [
6707
+ toolbar.sections.map((section, index) => /* @__PURE__ */ jsxs26(Fragment16, { children: [
6708
+ index > 0 ? /* @__PURE__ */ jsx40("span", { className: "lace-app__toolbar-separator", "aria-hidden": "true" }) : null,
6709
+ /* @__PURE__ */ jsxs26("div", { className: "lace-app__toolbar-section", children: [
6656
6710
  section.actions.map((action) => (
6657
6711
  // `runner.busy` reads the store, whose every write
6658
6712
  // re-renders App (`resultSlots`).
6659
- /* @__PURE__ */ jsx39(
6713
+ /* @__PURE__ */ jsx40(
6660
6714
  ToolbarAction,
6661
6715
  {
6662
6716
  action,
@@ -6667,50 +6721,39 @@ function App({
6667
6721
  action.id
6668
6722
  )
6669
6723
  )),
6670
- section.panels.map((panel) => /* @__PURE__ */ jsx39(PanelSlot, { panel, ctx, tick }, panel.id))
6724
+ section.panels.map((panel) => /* @__PURE__ */ jsx40(PanelSlot, { panel, ctx, tick }, panel.id))
6671
6725
  ] })
6672
6726
  ] }, section.key ?? "")),
6673
- 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)) })
6727
+ toolbar.trailing.length > 0 && /* @__PURE__ */ jsx40("div", { className: "lace-app__toolbar-end", children: toolbar.trailing.map((panel) => /* @__PURE__ */ jsx40(PanelSlot, { panel, ctx, tick }, panel.id)) })
6674
6728
  ] }),
6675
- /* @__PURE__ */ jsx39("div", { className: "lace-app__banners", children: bannerPanels.map((panel) => /* @__PURE__ */ jsx39(PanelSlot, { panel, ctx, tick }, panel.id)) }),
6676
- /* @__PURE__ */ jsxs24("div", { className: "lace-app__body", children: [
6677
- /* @__PURE__ */ jsxs24("div", { className: "lace-app__main", children: [
6678
- /* @__PURE__ */ jsx39("div", { className: "lace-app__canvas", children: /* @__PURE__ */ jsx39(ReactFlowProvider, { children: /* @__PURE__ */ jsx39(Canvas, { height: "100%" }) }) }),
6679
- /* @__PURE__ */ jsx39(BottomTabs, { panels: bottomPanels, ctx, tick })
6729
+ /* @__PURE__ */ jsx40("div", { className: "lace-app__banners", children: bannerPanels.map((panel) => /* @__PURE__ */ jsx40(PanelSlot, { panel, ctx, tick }, panel.id)) }),
6730
+ /* @__PURE__ */ jsxs26("div", { className: "lace-app__body", children: [
6731
+ /* @__PURE__ */ jsxs26("div", { className: "lace-app__main", children: [
6732
+ /* @__PURE__ */ jsx40("div", { className: "lace-app__canvas", children: /* @__PURE__ */ jsx40(ReactFlowProvider, { children: /* @__PURE__ */ jsx40(Canvas, { height: "100%" }) }) }),
6733
+ /* @__PURE__ */ jsx40(BottomTabs, { panels: bottomPanels, ctx, tick })
6680
6734
  ] }),
6681
- drawerPanel && /* @__PURE__ */ jsx39(Drawer, { label: drawerPanel.title, children: /* @__PURE__ */ jsx39(PanelSlot, { panel: drawerPanel, ctx, tick }, drawerPanel.id) })
6735
+ drawerPanel && /* @__PURE__ */ jsx40(Drawer, { label: drawerPanel.title, children: /* @__PURE__ */ jsx40(PanelSlot, { panel: drawerPanel, ctx, tick }, drawerPanel.id) })
6682
6736
  ] }),
6683
- /* @__PURE__ */ jsx39(CommandArgsForm, { form: pendingForm })
6684
- ] }) })
6685
- ] });
6737
+ /* @__PURE__ */ jsx40(CommandArgsForm, { form: pendingForm })
6738
+ ] })
6739
+ ] }) });
6686
6740
  }
6687
6741
 
6688
6742
  // src/adapters/snapshot-source.ts
6689
- var SnapshotFetchError = class extends Error {
6690
- constructor(status) {
6691
- super(`snapshotSource: failed to fetch bundle (status ${status})`);
6692
- this.status = status;
6693
- this.name = "SnapshotFetchError";
6694
- }
6695
- };
6743
+ import { Bundle } from "@lace-cloud/proto";
6696
6744
  function snapshotSource(input) {
6697
- const fetchImpl = input.fetch ?? globalThis.fetch.bind(globalThis);
6698
6745
  let cached = null;
6699
6746
  let loadPromise = null;
6700
6747
  async function load() {
6701
6748
  if (cached) return cached;
6702
- const res = await fetchImpl(input.bundleUrl, {
6703
- method: "GET",
6704
- headers: { accept: "application/octet-stream", ...input.headers },
6705
- credentials: "include"
6706
- });
6707
- if (!res.ok) throw new SnapshotFetchError(res.status);
6708
- const bytes = new Uint8Array(await res.arrayBuffer());
6749
+ const bytes = await input.read();
6709
6750
  const source = {
6710
6751
  bundle: Bundle.decode(bytes),
6711
6752
  canUndo: false,
6712
6753
  canRedo: false,
6713
6754
  unsaved: false,
6755
+ workingDigest: "",
6756
+ savedDigest: "",
6714
6757
  ungenerated: false,
6715
6758
  conflict: null,
6716
6759
  sourceRefused: false,
@@ -6750,6 +6793,7 @@ export {
6750
6793
  ApplyUnobservedError,
6751
6794
  COMMANDS,
6752
6795
  CanvasContext,
6796
+ CanvasRoot_default as CanvasRoot,
6753
6797
  CommandArgsForm,
6754
6798
  CommandDetachedError,
6755
6799
  CommandExitError,
@@ -6763,42 +6807,30 @@ export {
6763
6807
  ErrorState,
6764
6808
  GENERATE_STAGES,
6765
6809
  GroupNode_default as GroupNode,
6766
- LocalsContent,
6767
6810
  LocalsPanel,
6768
6811
  ModuleConfigPanel,
6769
- ModuleInterfaceContent,
6770
6812
  ModuleInterfacePanel,
6771
6813
  ModuleNode_default as ModuleNode,
6772
6814
  NodeConfigBusProvider,
6773
6815
  PanelScope,
6774
- ProvidersContent,
6775
6816
  ProvidersPanel,
6776
6817
  Reason,
6777
6818
  SCHEMAS,
6778
- SnapshotFetchError,
6779
- SourceRefusedBanner,
6780
6819
  TerraformConfigContent,
6781
6820
  TerraformConfigPanel,
6782
- Toast,
6783
- UngeneratedMarker,
6784
6821
  UnifiedSettingsPanel,
6785
- UnsavedMarker,
6786
6822
  answering,
6787
6823
  bridgeCaller,
6788
- carriesFailure,
6789
6824
  commandPathOf,
6790
6825
  commandUnderWay,
6791
- conflictPanel,
6792
6826
  connectCaller,
6793
6827
  createActionRunner,
6794
6828
  createDraftStore,
6795
6829
  createResultStore,
6796
6830
  currentReport,
6797
6831
  decorate,
6798
- decorateDescribe,
6799
6832
  defineCommand,
6800
6833
  defineOverlay,
6801
- describeOverlay,
6802
6834
  diagnosticsOf,
6803
6835
  disabledReason,
6804
6836
  foldReport,
@@ -6808,16 +6840,10 @@ export {
6808
6840
  openEngineSession,
6809
6841
  parseBound,
6810
6842
  parseCommandFailure,
6811
- projectCanvasView2 as projectCanvasView,
6812
6843
  reportDiagnostics,
6813
6844
  resolveContributions,
6814
6845
  rowActions,
6815
6846
  snapshotSource,
6816
- sourceRefusedPanel,
6817
- toArgv,
6818
- ungeneratedMarker,
6819
- uniqueDiagnostics,
6820
- unsavedMarker,
6821
6847
  useCanvas,
6822
6848
  useCanvasSource,
6823
6849
  useCommandRead,