@lace-cloud/canvas 0.22.0 → 0.24.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.cjs CHANGED
@@ -38,6 +38,7 @@ __export(index_exports, {
38
38
  CommandArgsForm: () => CommandArgsForm,
39
39
  CommandDetachedError: () => CommandDetachedError,
40
40
  CommandExitError: () => CommandExitError,
41
+ CommandUnobservedError: () => CommandUnobservedError,
41
42
  ConflictBanner: () => ConflictBanner,
42
43
  ConnectError: () => ConnectError,
43
44
  ContextMenu: () => ContextMenu,
@@ -105,16 +106,16 @@ var import_proto14 = require("@lace-cloud/proto");
105
106
  var import_feedback = require("@lace-cloud/ui/feedback");
106
107
 
107
108
  // src/App.tsx
108
- var import_react41 = require("@xyflow/react");
109
- var import_react42 = require("react");
109
+ var import_react39 = require("@xyflow/react");
110
+ var import_react40 = require("react");
110
111
  var import_App = require("./App-IFIOMNV7.css");
111
112
 
112
113
  // src/Canvas.tsx
113
114
  var import_style = require("@xyflow/react/dist/style.css");
114
115
  var import_Canvas = require("./Canvas-JRY2HAY6.css");
115
116
  var import_proto7 = require("@lace-cloud/proto");
116
- var import_react19 = require("@xyflow/react");
117
- var import_react20 = require("react");
117
+ var import_react17 = require("@xyflow/react");
118
+ var import_react18 = require("react");
118
119
 
119
120
  // src/components/CanvasControls.tsx
120
121
  var import_ui = require("@lace-cloud/ui");
@@ -313,7 +314,7 @@ var CONTEXT_NEEDS = {
313
314
  resolved: "no open Keep or Reload conflict",
314
315
  conflict: "an open Keep or Reload conflict",
315
316
  sourceRefused: "the source-refused lock",
316
- needsConversion: "a tree that needs conversion",
317
+ needsConversion: "a tree out of lace shape",
317
318
  "selection.node": "a selected node",
318
319
  "selection.edge": "a selected connection",
319
320
  diagnostics: "diagnostics to show",
@@ -328,7 +329,8 @@ var TARGET_NEEDS = {
328
329
  nodeId: "a node",
329
330
  groupId: "a group",
330
331
  diagnostic: "a diagnostic",
331
- runId: "a run"
332
+ runId: "a run",
333
+ failure: "a failed command"
332
334
  };
333
335
  var BUSY_REASON = "A run is in progress";
334
336
  function keySatisfied(ctx, key) {
@@ -403,6 +405,12 @@ function unmetRequirement(action, ports, ctx, target) {
403
405
  if (key !== void 0) return `${label} needs ${CONTEXT_NEEDS[key]}`;
404
406
  const targetKey = (action.requiredTarget ?? []).find((k) => target[k] === void 0);
405
407
  if (targetKey !== void 0) return `${label} needs ${TARGET_NEEDS[targetKey]}`;
408
+ if (action.answers !== void 0) {
409
+ if (target.failure === void 0) return `${label} needs ${TARGET_NEEDS.failure}`;
410
+ if (!action.answers.includes(target.failure.reason)) {
411
+ return `${label} does not answer this failure`;
412
+ }
413
+ }
406
414
  if (binding.kind === "command" && !availableCommands(ports).has(binding.path)) {
407
415
  return `${label} runs lace ${binding.path}, which this host does not route`;
408
416
  }
@@ -4172,6 +4180,11 @@ var Reason = /* @__PURE__ */ ((Reason2) => {
4172
4180
  Reason2[Reason2["REASON_TOOL_MISSING"] = 14] = "REASON_TOOL_MISSING";
4173
4181
  Reason2[Reason2["REASON_CROSS_SCOPE"] = 15] = "REASON_CROSS_SCOPE";
4174
4182
  Reason2[Reason2["REASON_UNAUTHENTICATED"] = 16] = "REASON_UNAUTHENTICATED";
4183
+ Reason2[Reason2["REASON_IMPORT_RESIDUAL"] = 17] = "REASON_IMPORT_RESIDUAL";
4184
+ Reason2[Reason2["REASON_STACK_HAS_STATE"] = 18] = "REASON_STACK_HAS_STATE";
4185
+ Reason2[Reason2["REASON_NO_ORIGIN_REMOTE"] = 19] = "REASON_NO_ORIGIN_REMOTE";
4186
+ Reason2[Reason2["REASON_IMPORT_UNDECLARED"] = 20] = "REASON_IMPORT_UNDECLARED";
4187
+ Reason2[Reason2["REASON_ALREADY_IMPORTED"] = 21] = "REASON_ALREADY_IMPORTED";
4175
4188
  Reason2[Reason2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
4176
4189
  return Reason2;
4177
4190
  })(Reason || {});
@@ -4228,6 +4241,21 @@ function reasonFromJSON(object) {
4228
4241
  case 16:
4229
4242
  case "REASON_UNAUTHENTICATED":
4230
4243
  return 16 /* REASON_UNAUTHENTICATED */;
4244
+ case 17:
4245
+ case "REASON_IMPORT_RESIDUAL":
4246
+ return 17 /* REASON_IMPORT_RESIDUAL */;
4247
+ case 18:
4248
+ case "REASON_STACK_HAS_STATE":
4249
+ return 18 /* REASON_STACK_HAS_STATE */;
4250
+ case 19:
4251
+ case "REASON_NO_ORIGIN_REMOTE":
4252
+ return 19 /* REASON_NO_ORIGIN_REMOTE */;
4253
+ case 20:
4254
+ case "REASON_IMPORT_UNDECLARED":
4255
+ return 20 /* REASON_IMPORT_UNDECLARED */;
4256
+ case 21:
4257
+ case "REASON_ALREADY_IMPORTED":
4258
+ return 21 /* REASON_ALREADY_IMPORTED */;
4231
4259
  case -1:
4232
4260
  case "UNRECOGNIZED":
4233
4261
  default:
@@ -4270,6 +4298,16 @@ function reasonToJSON(object) {
4270
4298
  return "REASON_CROSS_SCOPE";
4271
4299
  case 16 /* REASON_UNAUTHENTICATED */:
4272
4300
  return "REASON_UNAUTHENTICATED";
4301
+ case 17 /* REASON_IMPORT_RESIDUAL */:
4302
+ return "REASON_IMPORT_RESIDUAL";
4303
+ case 18 /* REASON_STACK_HAS_STATE */:
4304
+ return "REASON_STACK_HAS_STATE";
4305
+ case 19 /* REASON_NO_ORIGIN_REMOTE */:
4306
+ return "REASON_NO_ORIGIN_REMOTE";
4307
+ case 20 /* REASON_IMPORT_UNDECLARED */:
4308
+ return "REASON_IMPORT_UNDECLARED";
4309
+ case 21 /* REASON_ALREADY_IMPORTED */:
4310
+ return "REASON_ALREADY_IMPORTED";
4273
4311
  case -1 /* UNRECOGNIZED */:
4274
4312
  default:
4275
4313
  return "UNRECOGNIZED";
@@ -11191,6 +11229,13 @@ var CommandDetachedError = class extends Error {
11191
11229
  super("command detached: the invoking consumer stopped listening");
11192
11230
  }
11193
11231
  };
11232
+ var CommandUnobservedError = class extends Error {
11233
+ constructor() {
11234
+ super(
11235
+ "the engine's stream ended before the command exited: the command ran and may have made changes, but its outcome is unknown"
11236
+ );
11237
+ }
11238
+ };
11194
11239
 
11195
11240
  // src/utils/arrangement.ts
11196
11241
  var import_proto = require("@lace-cloud/proto");
@@ -12583,56 +12628,14 @@ var ModuleNode = ({ id, data }) => {
12583
12628
  var ModuleNode_default = ModuleNode;
12584
12629
 
12585
12630
  // src/components/PaperGrid.tsx
12586
- var import_react13 = require("@xyflow/react");
12587
- var import_react14 = require("react");
12588
-
12589
- // src/utils/style-vars.ts
12590
- function readTokenPx(el, name) {
12591
- return Number.parseFloat(getComputedStyle(el).getPropertyValue(name));
12592
- }
12593
-
12594
- // src/components/PaperGrid.tsx
12595
- var import_PaperGrid = require("./PaperGrid-WFRL3N4P.css");
12631
+ var import_PaperGrid = require("./PaperGrid-JG4GBRDP.css");
12596
12632
  var import_jsx_runtime9 = require("react/jsx-runtime");
12597
- var FADE_FROM = 6;
12598
- var FADE_TO = 12;
12599
- function threadStrength(pitch) {
12600
- return Math.min(1, Math.max(0, (pitch - FADE_FROM) / (FADE_TO - FADE_FROM)));
12601
- }
12602
- function readPaperPitch(el) {
12603
- const fine = readTokenPx(el, "--lace-canvas-paper-pitch-fine");
12604
- const major = readTokenPx(el, "--lace-canvas-paper-pitch-major");
12605
- return fine > 0 && major > 0 ? { fine, major } : null;
12606
- }
12607
- var transformOf = (s) => s.transform;
12608
12633
  function PaperGrid() {
12609
- const ref = (0, import_react14.useRef)(null);
12610
- const [pitch, setPitch] = (0, import_react14.useState)(null);
12611
- (0, import_react14.useLayoutEffect)(() => {
12612
- if (ref.current) setPitch(readPaperPitch(ref.current));
12613
- }, []);
12614
- const [x, y, zoom] = (0, import_react13.useStore)(transformOf);
12615
- const strength = (px) => `${Math.round(threadStrength((px ?? 0) * zoom) * 100)}%`;
12616
- const style = {
12617
- "--paper-x": `${x}px`,
12618
- "--paper-y": `${y}px`,
12619
- "--paper-zoom": zoom,
12620
- "--paper-fine": strength(pitch?.fine),
12621
- "--paper-major": strength(pitch?.major)
12622
- };
12623
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
12624
- "div",
12625
- {
12626
- ref,
12627
- className: "lace-paper-layers lace-canvas-paper",
12628
- style,
12629
- "aria-hidden": "true"
12630
- }
12631
- );
12634
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "lace-paper-layers lace-canvas-paper", "aria-hidden": "true" });
12632
12635
  }
12633
12636
 
12634
12637
  // src/core/use-action-keys.ts
12635
- var import_react15 = require("react");
12638
+ var import_react13 = require("react");
12636
12639
 
12637
12640
  // src/contribution-types.ts
12638
12641
  var KEY_SCOPES = ["surface", "app"];
@@ -12655,7 +12658,7 @@ function isFormTarget(target) {
12655
12658
  return tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || target.isContentEditable;
12656
12659
  }
12657
12660
  function useFocusWhenNoneHeld(root, mounted) {
12658
- (0, import_react15.useEffect)(() => {
12661
+ (0, import_react13.useEffect)(() => {
12659
12662
  const element = root.current;
12660
12663
  if (!mounted || !element) return;
12661
12664
  const doc = element.ownerDocument;
@@ -12680,7 +12683,7 @@ function matchesKey(e, spec) {
12680
12683
  return e.key.toLowerCase() === chord.key.toLowerCase();
12681
12684
  }
12682
12685
  function useActionKeys(actions, ctx, runner, envExtras) {
12683
- (0, import_react15.useEffect)(() => {
12686
+ (0, import_react13.useEffect)(() => {
12684
12687
  if (!ctx || !envExtras) return;
12685
12688
  const activeCtx = ctx;
12686
12689
  const activeEnvExtras = envExtras;
@@ -12717,10 +12720,10 @@ function useActionKeys(actions, ctx, runner, envExtras) {
12717
12720
  }
12718
12721
 
12719
12722
  // src/hooks/useContextMenu.ts
12720
- var import_react16 = require("react");
12723
+ var import_react14 = require("react");
12721
12724
  function useContextMenu() {
12722
- const [contextMenu, setContextMenu] = (0, import_react16.useState)(null);
12723
- const showContextMenu = (0, import_react16.useCallback)((request) => {
12725
+ const [contextMenu, setContextMenu] = (0, import_react14.useState)(null);
12726
+ const showContextMenu = (0, import_react14.useCallback)((request) => {
12724
12727
  setContextMenu({
12725
12728
  x: request.x,
12726
12729
  y: request.y,
@@ -12728,21 +12731,21 @@ function useContextMenu() {
12728
12731
  groupId: request.groupId
12729
12732
  });
12730
12733
  }, []);
12731
- const dismissContextMenu = (0, import_react16.useCallback)(() => {
12734
+ const dismissContextMenu = (0, import_react14.useCallback)(() => {
12732
12735
  setContextMenu(null);
12733
12736
  }, []);
12734
12737
  return { contextMenu, showContextMenu, dismissContextMenu };
12735
12738
  }
12736
12739
 
12737
12740
  // src/hooks/useGroupLogic.ts
12738
- var import_react17 = require("react");
12741
+ var import_react15 = require("react");
12739
12742
  function drawnPosition(groups, node) {
12740
12743
  const parent = node.parentId ? groups.find((g) => g.id === node.parentId) : void 0;
12741
12744
  if (!parent) return node.position;
12742
12745
  return { x: parent.position.x + node.position.x, y: parent.position.y + node.position.y };
12743
12746
  }
12744
12747
  function useGroupLogic(nodes, edges, groups, newNodeIds, decorations) {
12745
- return (0, import_react17.useMemo)(() => {
12748
+ return (0, import_react15.useMemo)(() => {
12746
12749
  const parentOf = /* @__PURE__ */ new Map();
12747
12750
  for (const g of groups) {
12748
12751
  for (const id of g.node_ids) parentOf.set(id, g);
@@ -12850,12 +12853,12 @@ function renderEdgeToRfEdge(e) {
12850
12853
  }
12851
12854
 
12852
12855
  // src/hooks/useNewNodeTracking.ts
12853
- var import_react18 = require("react");
12856
+ var import_react16 = require("react");
12854
12857
  function useNewNodeTracking(view) {
12855
- const [newNodeIds, setNewNodeIds] = (0, import_react18.useState)(/* @__PURE__ */ new Set());
12856
- const prevNodeIdsRef = (0, import_react18.useRef)(/* @__PURE__ */ new Set());
12857
- const sessionLoadedRef = (0, import_react18.useRef)(false);
12858
- (0, import_react18.useEffect)(() => {
12858
+ const [newNodeIds, setNewNodeIds] = (0, import_react16.useState)(/* @__PURE__ */ new Set());
12859
+ const prevNodeIdsRef = (0, import_react16.useRef)(/* @__PURE__ */ new Set());
12860
+ const sessionLoadedRef = (0, import_react16.useRef)(false);
12861
+ (0, import_react16.useEffect)(() => {
12859
12862
  if (!view) return;
12860
12863
  const currentIds = new Set(view.nodes.map((n) => n.id));
12861
12864
  if (!sessionLoadedRef.current) {
@@ -12872,7 +12875,7 @@ function useNewNodeTracking(view) {
12872
12875
  });
12873
12876
  prevNodeIdsRef.current = currentIds;
12874
12877
  }, [view]);
12875
- const clearNew = (0, import_react18.useCallback)((...ids) => {
12878
+ const clearNew = (0, import_react16.useCallback)((...ids) => {
12876
12879
  setNewNodeIds((s) => {
12877
12880
  const next = new Set(s);
12878
12881
  let changed = false;
@@ -12956,19 +12959,19 @@ function CompositeEditor({
12956
12959
  paneRef,
12957
12960
  decorations
12958
12961
  }) {
12959
- const { fitView, getNode, getNodes, getNodesBounds, getViewport, setViewport } = (0, import_react19.useReactFlow)();
12960
- const xyflowInitialized = (0, import_react19.useNodesInitialized)();
12962
+ const { fitView, getNode, getNodes, getNodesBounds, getViewport, setViewport } = (0, import_react17.useReactFlow)();
12963
+ const xyflowInitialized = (0, import_react17.useNodesInitialized)();
12961
12964
  const nodesInitialized = xyflowInitialized || view.nodes.length === 0;
12962
- (0, import_react20.useEffect)(() => {
12965
+ (0, import_react18.useEffect)(() => {
12963
12966
  registerGoToNode((nodeId) => {
12964
12967
  if (!getNode(nodeId)) return;
12965
12968
  const bounds = getNodesBounds([nodeId]);
12966
12969
  layout.panIntoView(withMargin(bounds, REVEAL_MARGIN, getViewport().zoom));
12967
12970
  });
12968
12971
  }, [registerGoToNode, getNode, getNodesBounds, getViewport, layout]);
12969
- const focusRef = (0, import_react20.useRef)(focusIds);
12972
+ const focusRef = (0, import_react18.useRef)(focusIds);
12970
12973
  focusRef.current = focusIds;
12971
- (0, import_react20.useEffect)(() => {
12974
+ (0, import_react18.useEffect)(() => {
12972
12975
  const pane = paneRef.current;
12973
12976
  if (!pane || typeof ResizeObserver === "undefined") return;
12974
12977
  let before = { width: pane.clientWidth, height: pane.clientHeight };
@@ -13001,7 +13004,7 @@ function CompositeEditor({
13001
13004
  observer.disconnect();
13002
13005
  };
13003
13006
  }, [paneRef, getViewport, getNodes, getNode, getNodesBounds, fitView, setViewport]);
13004
- (0, import_react20.useEffect)(() => {
13007
+ (0, import_react18.useEffect)(() => {
13005
13008
  layout.panIntoView = (rect) => {
13006
13009
  const pane = paneRef.current?.getBoundingClientRect();
13007
13010
  if (!pane) return;
@@ -13018,24 +13021,24 @@ function CompositeEditor({
13018
13021
  );
13019
13022
  };
13020
13023
  }, [layout, getViewport, setViewport, paneRef]);
13021
- const firedRef = (0, import_react20.useRef)(false);
13022
- (0, import_react20.useEffect)(() => {
13024
+ const firedRef = (0, import_react18.useRef)(false);
13025
+ (0, import_react18.useEffect)(() => {
13023
13026
  if (firedRef.current || !nodesInitialized || view.nodes.length === 0) return;
13024
13027
  firedRef.current = true;
13025
13028
  requestAnimationFrame(() => fitView(FIT_VIEW_OPTIONS));
13026
13029
  }, [nodesInitialized, view.nodes.length, fitView]);
13027
13030
  const groupLogic = useGroupLogic(view.nodes, view.edges, view.groups, newNodeIds, decorations);
13028
13031
  const rfEdgesFromView = groupLogic.rfEdges;
13029
- const [rfEdges, setRfEdges] = (0, import_react20.useState)(rfEdgesFromView);
13030
- (0, import_react20.useEffect)(() => {
13032
+ const [rfEdges, setRfEdges] = (0, import_react18.useState)(rfEdgesFromView);
13033
+ (0, import_react18.useEffect)(() => {
13031
13034
  setRfEdges(rfEdgesFromView);
13032
13035
  }, [rfEdgesFromView]);
13033
- const onEdgesChange = (0, import_react20.useCallback)((changes) => {
13034
- setRfEdges((prev) => (0, import_react19.applyEdgeChanges)(changes, prev));
13036
+ const onEdgesChange = (0, import_react18.useCallback)((changes) => {
13037
+ setRfEdges((prev) => (0, import_react17.applyEdgeChanges)(changes, prev));
13035
13038
  }, []);
13036
13039
  const rfNodesFromView = groupLogic.rfNodes;
13037
- const [rfNodes, setRfNodes] = (0, import_react20.useState)(rfNodesFromView);
13038
- (0, import_react20.useEffect)(() => {
13040
+ const [rfNodes, setRfNodes] = (0, import_react18.useState)(rfNodesFromView);
13041
+ (0, import_react18.useEffect)(() => {
13039
13042
  setRfNodes((prev) => {
13040
13043
  const current = new Map(prev.map((n) => [n.id, n]));
13041
13044
  return rfNodesFromView.map((n) => {
@@ -13051,10 +13054,10 @@ function CompositeEditor({
13051
13054
  });
13052
13055
  });
13053
13056
  }, [rfNodesFromView]);
13054
- const onNodesChange = (0, import_react20.useCallback)((changes) => {
13055
- setRfNodes((prev) => (0, import_react19.applyNodeChanges)(changes, prev));
13057
+ const onNodesChange = (0, import_react18.useCallback)((changes) => {
13058
+ setRfNodes((prev) => (0, import_react17.applyNodeChanges)(changes, prev));
13056
13059
  }, []);
13057
- const onNodeDragStop = (0, import_react20.useCallback)(
13060
+ const onNodeDragStop = (0, import_react18.useCallback)(
13058
13061
  (_e, _draggedNode, draggedNodes) => {
13059
13062
  const positions = {};
13060
13063
  for (const n of draggedNodes) {
@@ -13069,7 +13072,7 @@ function CompositeEditor({
13069
13072
  animated: false
13070
13073
  };
13071
13074
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
13072
- import_react19.ReactFlow,
13075
+ import_react17.ReactFlow,
13073
13076
  {
13074
13077
  onInit,
13075
13078
  nodes: rfNodes,
@@ -13133,7 +13136,7 @@ function Canvas({ height }) {
13133
13136
  layout
13134
13137
  } = useCanvas();
13135
13138
  const editor = ctx.ports.editor;
13136
- const makeEnvExtras = (0, import_react20.useCallback)(
13139
+ const makeEnvExtras = (0, import_react18.useCallback)(
13137
13140
  () => ({
13138
13141
  bundle,
13139
13142
  arrangement: { get: () => arrangement, update: updateArrangement },
@@ -13141,34 +13144,34 @@ function Canvas({ height }) {
13141
13144
  }),
13142
13145
  [bundle, arrangement, updateArrangement, layout]
13143
13146
  );
13144
- const focusIds = (0, import_react20.useMemo)(
13147
+ const focusIds = (0, import_react18.useMemo)(
13145
13148
  () => selection.edge ? [selection.edge.source, selection.edge.target] : selection.nodes,
13146
13149
  [selection]
13147
13150
  );
13148
13151
  const { contextMenu, showContextMenu, dismissContextMenu } = useContextMenu();
13149
13152
  const { newNodeIds } = useNewNodeTracking(view);
13150
- const paneRef = (0, import_react20.useRef)(null);
13151
- const surfaceRef = (0, import_react20.useRef)(null);
13152
- (0, import_react20.useEffect)(() => {
13153
+ const paneRef = (0, import_react18.useRef)(null);
13154
+ const surfaceRef = (0, import_react18.useRef)(null);
13155
+ (0, import_react18.useEffect)(() => {
13153
13156
  registerKeyTarget(ctx, "surface", surfaceRef.current);
13154
13157
  return () => registerKeyTarget(ctx, "surface", null);
13155
13158
  }, [ctx]);
13156
- const onSurfacePointerDown = (0, import_react20.useCallback)((e) => {
13159
+ const onSurfacePointerDown = (0, import_react18.useCallback)((e) => {
13157
13160
  if (isFormTarget(e.target)) return;
13158
13161
  surfaceRef.current?.focus();
13159
13162
  }, []);
13160
- const goToNodeRef = (0, import_react20.useRef)(null);
13161
- const registerGoToNode = (0, import_react20.useCallback)((fn) => {
13163
+ const goToNodeRef = (0, import_react18.useRef)(null);
13164
+ const registerGoToNode = (0, import_react18.useCallback)((fn) => {
13162
13165
  goToNodeRef.current = fn;
13163
13166
  }, []);
13164
- const onOpenNodeConfig = (0, import_react20.useCallback)(
13167
+ const onOpenNodeConfig = (0, import_react18.useCallback)(
13165
13168
  (instanceId) => {
13166
13169
  setSelection({ nodes: [instanceId], edge: null });
13167
13170
  goToNodeRef.current?.(instanceId);
13168
13171
  },
13169
13172
  [setSelection]
13170
13173
  );
13171
- const onDragStop = (0, import_react20.useCallback)(
13174
+ const onDragStop = (0, import_react18.useCallback)(
13172
13175
  (positions) => {
13173
13176
  const pinned = Object.keys(positions).reduce(
13174
13177
  (next, id) => withScopesPinned(bundle, view, next, id),
@@ -13178,7 +13181,7 @@ function Canvas({ height }) {
13178
13181
  },
13179
13182
  [bundle, view, arrangement, updateArrangement]
13180
13183
  );
13181
- const onConnect = (0, import_react20.useCallback)(
13184
+ const onConnect = (0, import_react18.useCallback)(
13182
13185
  async (conn) => {
13183
13186
  if (!conn.source || !conn.target || !editor) return;
13184
13187
  const source = (0, import_proto7.instanceAddress)(bundle, conn.source);
@@ -13200,7 +13203,7 @@ function Canvas({ height }) {
13200
13203
  },
13201
13204
  [editor, runner, bundle]
13202
13205
  );
13203
- const onEdgeClick = (0, import_react20.useCallback)(
13206
+ const onEdgeClick = (0, import_react18.useCallback)(
13204
13207
  (_e, edge) => {
13205
13208
  const data = rfEdgeData(edge);
13206
13209
  if (!data) return;
@@ -13217,7 +13220,7 @@ function Canvas({ height }) {
13217
13220
  },
13218
13221
  [setSelection]
13219
13222
  );
13220
- const onEdgesDelete = (0, import_react20.useCallback)(
13223
+ const onEdgesDelete = (0, import_react18.useCallback)(
13221
13224
  async (edges) => {
13222
13225
  for (const edge of edges) {
13223
13226
  const data = rfEdgeData(edge);
@@ -13230,7 +13233,7 @@ function Canvas({ height }) {
13230
13233
  },
13231
13234
  [runner, bundle]
13232
13235
  );
13233
- const onNodesDelete = (0, import_react20.useCallback)(
13236
+ const onNodesDelete = (0, import_react18.useCallback)(
13234
13237
  async (nodes) => {
13235
13238
  const action = ctx.contributions.actions.find((a) => a.id === "delete-node");
13236
13239
  if (!action) return;
@@ -13241,7 +13244,7 @@ function Canvas({ height }) {
13241
13244
  },
13242
13245
  [ctx, runner, makeEnvExtras]
13243
13246
  );
13244
- const onSelectionChange = (0, import_react20.useCallback)(
13247
+ const onSelectionChange = (0, import_react18.useCallback)(
13245
13248
  (params) => {
13246
13249
  const ids = params.nodes.map((n) => n.id);
13247
13250
  setSelection({ nodes: ids, edge: selection.edge });
@@ -13249,14 +13252,14 @@ function Canvas({ height }) {
13249
13252
  [setSelection, selection.edge]
13250
13253
  );
13251
13254
  const menuTarget = contextMenu ? contextMenu.groupId ? groupTarget(contextMenu.groupId) : { nodeId: contextMenu.nodeId ?? void 0 } : NO_ENV_EXTRAS_TARGET;
13252
- const menuActions = (0, import_react20.useMemo)(() => {
13255
+ const menuActions = (0, import_react18.useMemo)(() => {
13253
13256
  if (!contextMenu) return [];
13254
13257
  const placement = menuTarget.nodeId === void 0 ? "pane-menu" : "node-menu";
13255
13258
  return resolveContributions(ctx.contributions, ctx.ports, ctx, menuTarget).actions.filter(
13256
13259
  (a) => a.placement === placement
13257
13260
  );
13258
13261
  }, [contextMenu, ctx, menuTarget]);
13259
- const runMenuAction = (0, import_react20.useCallback)(
13262
+ const runMenuAction = (0, import_react18.useCallback)(
13260
13263
  (action) => {
13261
13264
  void runner.run(action, ctx, menuTarget, makeEnvExtras());
13262
13265
  },
@@ -13317,7 +13320,14 @@ function Canvas({ height }) {
13317
13320
  }
13318
13321
 
13319
13322
  // src/components/Drawer.tsx
13320
- var import_react21 = require("react");
13323
+ var import_react19 = require("react");
13324
+
13325
+ // src/utils/style-vars.ts
13326
+ function readTokenPx(el, name) {
13327
+ return Number.parseFloat(getComputedStyle(el).getPropertyValue(name));
13328
+ }
13329
+
13330
+ // src/components/Drawer.tsx
13321
13331
  var import_Drawer = require("./Drawer-34ZYTEWE.css");
13322
13332
  var import_jsx_runtime11 = require("react/jsx-runtime");
13323
13333
  var KEY_STEP = 16;
@@ -13331,30 +13341,30 @@ function clampWidth(width, bounds) {
13331
13341
  return Math.min(bounds.max, Math.max(bounds.min, width));
13332
13342
  }
13333
13343
  function Drawer({ label, children }) {
13334
- const ref = (0, import_react21.useRef)(null);
13335
- const [bounds, setBounds] = (0, import_react21.useState)(null);
13336
- const [width, setWidth] = (0, import_react21.useState)(null);
13337
- const [measured, setMeasured] = (0, import_react21.useState)(0);
13338
- const drag = (0, import_react21.useRef)(null);
13339
- (0, import_react21.useLayoutEffect)(() => {
13344
+ const ref = (0, import_react19.useRef)(null);
13345
+ const [bounds, setBounds] = (0, import_react19.useState)(null);
13346
+ const [width, setWidth] = (0, import_react19.useState)(null);
13347
+ const [measured, setMeasured] = (0, import_react19.useState)(0);
13348
+ const drag = (0, import_react19.useRef)(null);
13349
+ (0, import_react19.useLayoutEffect)(() => {
13340
13350
  if (ref.current) setBounds(readDrawerBounds(ref.current));
13341
13351
  }, []);
13342
- (0, import_react21.useLayoutEffect)(() => {
13352
+ (0, import_react19.useLayoutEffect)(() => {
13343
13353
  if (ref.current) setMeasured(Math.round(ref.current.getBoundingClientRect().width));
13344
13354
  }, [width]);
13345
- const onPointerDown = (0, import_react21.useCallback)((e) => {
13355
+ const onPointerDown = (0, import_react19.useCallback)((e) => {
13346
13356
  e.preventDefault();
13347
13357
  e.currentTarget.setPointerCapture(e.pointerId);
13348
13358
  drag.current = { x: e.clientX, width: ref.current?.getBoundingClientRect().width ?? 0 };
13349
13359
  }, []);
13350
- const onPointerMove = (0, import_react21.useCallback)(
13360
+ const onPointerMove = (0, import_react19.useCallback)(
13351
13361
  (e) => {
13352
13362
  if (!drag.current) return;
13353
13363
  setWidth(clampWidth(drag.current.width + drag.current.x - e.clientX, bounds));
13354
13364
  },
13355
13365
  [bounds]
13356
13366
  );
13357
- const onPointerUp = (0, import_react21.useCallback)((e) => {
13367
+ const onPointerUp = (0, import_react19.useCallback)((e) => {
13358
13368
  drag.current = null;
13359
13369
  e.currentTarget.releasePointerCapture(e.pointerId);
13360
13370
  }, []);
@@ -13388,7 +13398,7 @@ function Drawer({ label, children }) {
13388
13398
  }
13389
13399
 
13390
13400
  // src/components/ErrorBoundary.tsx
13391
- var import_react22 = __toESM(require("react"));
13401
+ var import_react20 = __toESM(require("react"));
13392
13402
  var import_ErrorBoundary = require("./ErrorBoundary-IXSIVZFH.css");
13393
13403
  var import_jsx_runtime12 = require("react/jsx-runtime");
13394
13404
  function ErrorState({ message }) {
@@ -13406,7 +13416,7 @@ function ErrorState({ message }) {
13406
13416
  )
13407
13417
  ] });
13408
13418
  }
13409
- var ErrorBoundary = class extends import_react22.default.Component {
13419
+ var ErrorBoundary = class extends import_react20.default.Component {
13410
13420
  constructor() {
13411
13421
  super(...arguments);
13412
13422
  this.state = { error: null };
@@ -13492,7 +13502,7 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
13492
13502
  }
13493
13503
 
13494
13504
  // src/core/CommandArgsForm.tsx
13495
- var import_react23 = require("react");
13505
+ var import_react21 = require("react");
13496
13506
 
13497
13507
  // src/contracts/commands.gen.ts
13498
13508
  var COMMANDS = {
@@ -14805,6 +14815,31 @@ function completeArgs(path, partial) {
14805
14815
 
14806
14816
  // src/contracts/schemas.ts
14807
14817
  var import_zod = require("zod");
14818
+ var REASON_PREFIX = "REASON_";
14819
+ function reasonWire(reason) {
14820
+ return reasonToJSON(reason).slice(REASON_PREFIX.length).toLowerCase();
14821
+ }
14822
+ var LACE_REASONS = new Set(
14823
+ Object.values(Reason).filter((value) => typeof value === "number" && value !== -1 /* UNRECOGNIZED */).map(reasonWire)
14824
+ );
14825
+ var laceReasonSchema = import_zod.z.custom(
14826
+ (value) => typeof value === "string" && LACE_REASONS.has(value),
14827
+ { message: "not a reason of Lace\u2019s own" }
14828
+ );
14829
+ var importResidualSchema = import_zod.z.object({
14830
+ address: import_zod.z.string(),
14831
+ type: import_zod.z.string(),
14832
+ reason: import_zod.z.string()
14833
+ });
14834
+ var commandFailureSchema = import_zod.z.strictObject({
14835
+ reason: laceReasonSchema,
14836
+ message: import_zod.z.string(),
14837
+ url: import_zod.z.string().optional(),
14838
+ tool: import_zod.z.string().optional(),
14839
+ importResiduals: import_zod.z.array(importResidualSchema).optional(),
14840
+ addresses: import_zod.z.array(import_zod.z.string()).optional(),
14841
+ apiCode: import_zod.z.string().optional()
14842
+ });
14808
14843
  var moduleValidateDeviationSchema = import_zod.z.object({
14809
14844
  notCompositional: import_zod.z.boolean(),
14810
14845
  clusters: import_zod.z.array(import_zod.z.unknown()),
@@ -14856,6 +14891,7 @@ var moduleValidateResultSchema = import_zod.z.object({
14856
14891
  }).optional(),
14857
14892
  modules: import_zod.z.array(import_zod.z.object({ address: import_zod.z.string(), version: import_zod.z.string(), treeHash: import_zod.z.string() })).optional(),
14858
14893
  exitClass: import_zod.z.string(),
14894
+ failure: commandFailureSchema.optional(),
14859
14895
  diagnostics: import_zod.z.array(commandDiagnosticSchema)
14860
14896
  });
14861
14897
  var moduleConvertResultSchema = import_zod.z.object({
@@ -14966,6 +15002,7 @@ var registryDescribeSchema = import_zod.z.object({
14966
15002
  )
14967
15003
  })
14968
15004
  });
15005
+ var stackIdentSchema = import_zod.z.object({ id: import_zod.z.string(), slug: import_zod.z.string() });
14969
15006
  var stackSourceSchema = import_zod.z.object({
14970
15007
  kind: import_zod.z.literal("git"),
14971
15008
  repoUrl: import_zod.z.string(),
@@ -15149,7 +15186,7 @@ var previewEntrySchema = import_zod.z.discriminatedUnion("kind", [
15149
15186
  })
15150
15187
  ]);
15151
15188
  var stackPreviewSchema = import_zod.z.object({
15152
- stack: import_zod.z.object({ id: import_zod.z.string(), slug: import_zod.z.string() }),
15189
+ stack: stackIdentSchema,
15153
15190
  treeHash: import_zod.z.string(),
15154
15191
  plan: import_zod.z.object({ summary: planSummarySchema, human: import_zod.z.string() }),
15155
15192
  policy: import_zod.z.object({
@@ -15189,27 +15226,28 @@ var stackPreviewSchema = import_zod.z.object({
15189
15226
  bound: import_zod.z.number().optional()
15190
15227
  })
15191
15228
  });
15192
- var changeRequestSchema = import_zod.z.object({
15229
+ var gateChangeRequestSchema = import_zod.z.object({
15193
15230
  id: import_zod.z.string(),
15194
- orgId: import_zod.z.string(),
15195
- teamId: import_zod.z.string(),
15196
- runId: import_zod.z.string(),
15197
- bindingId: import_zod.z.string().nullable(),
15198
- invocationId: import_zod.z.string().nullable(),
15199
15231
  state: import_zod.z.string(),
15200
- approverUserId: import_zod.z.string().nullable(),
15201
- approvalChain: import_zod.z.unknown(),
15202
- emergencyApproval: import_zod.z.boolean(),
15203
- narrativeArtifactId: import_zod.z.string().nullable(),
15204
- policyResolution: import_zod.z.unknown(),
15205
- externalSystemId: import_zod.z.string().nullable(),
15206
- externalRef: import_zod.z.string().nullable(),
15207
- idempotencyKey: import_zod.z.string().nullable(),
15208
- lastReconciledAt: import_zod.z.string().nullable(),
15209
- submittedByUserId: import_zod.z.string().nullable(),
15210
- submittedAt: import_zod.z.string().nullable(),
15211
- createdAt: import_zod.z.string(),
15212
- updatedAt: import_zod.z.string()
15232
+ requirements: import_zod.z.array(
15233
+ import_zod.z.object({
15234
+ id: import_zod.z.string(),
15235
+ state: import_zod.z.string(),
15236
+ decidedBy: import_zod.z.enum(["lace", "ecm"]),
15237
+ recordId: import_zod.z.string().nullable()
15238
+ })
15239
+ ),
15240
+ records: import_zod.z.array(
15241
+ import_zod.z.object({
15242
+ id: import_zod.z.string(),
15243
+ externalSystemId: import_zod.z.string(),
15244
+ kind: import_zod.z.string(),
15245
+ externalRef: import_zod.z.string().nullable(),
15246
+ externalUrl: import_zod.z.string().nullable(),
15247
+ state: import_zod.z.string().nullable(),
15248
+ decision: import_zod.z.enum(["approved", "rejected"]).nullable()
15249
+ })
15250
+ )
15213
15251
  });
15214
15252
  var runEventSchema = import_zod.z.discriminatedUnion("type", [
15215
15253
  import_zod.z.object({ type: import_zod.z.literal("log"), text: import_zod.z.string() }),
@@ -15217,8 +15255,11 @@ var runEventSchema = import_zod.z.discriminatedUnion("type", [
15217
15255
  import_zod.z.object({
15218
15256
  type: import_zod.z.literal("gate"),
15219
15257
  resolution: import_zod.z.object({ mode: import_zod.z.string(), reason: import_zod.z.string().optional() }),
15220
- changeRequest: changeRequestSchema.nullable()
15221
- }),
15258
+ changeRequest: gateChangeRequestSchema.nullable()
15259
+ }).refine(
15260
+ (gate) => gate.resolution.mode === "awaiting_approval" === (gate.changeRequest !== null),
15261
+ { message: "a gate event carries a change request exactly when it holds the Run" }
15262
+ ),
15222
15263
  import_zod.z.object({
15223
15264
  type: import_zod.z.literal("result"),
15224
15265
  run: runSchema,
@@ -15228,6 +15269,7 @@ var runEventSchema = import_zod.z.discriminatedUnion("type", [
15228
15269
  })
15229
15270
  ]);
15230
15271
  var stackScanSchema = import_zod.z.object({
15272
+ stack: stackIdentSchema,
15231
15273
  triggered: import_zod.z.boolean(),
15232
15274
  reason: import_zod.z.string().nullable(),
15233
15275
  settled: import_zod.z.object({
@@ -15235,14 +15277,17 @@ var stackScanSchema = import_zod.z.object({
15235
15277
  driftCount: import_zod.z.number(),
15236
15278
  scannedAt: import_zod.z.string(),
15237
15279
  undeterminedReason: import_zod.z.string().nullable(),
15280
+ standingDriftFindings: import_zod.z.number(),
15281
+ footprintDestroyed: import_zod.z.boolean(),
15238
15282
  drift: driftSchema
15239
15283
  }).nullable()
15240
15284
  });
15241
15285
  var stackImportSchema = import_zod.z.object({
15242
- stack: import_zod.z.object({ id: import_zod.z.string(), slug: import_zod.z.string() }),
15286
+ stack: stackIdentSchema,
15243
15287
  written: import_zod.z.array(import_zod.z.string()),
15288
+ removed: import_zod.z.array(import_zod.z.string()),
15244
15289
  importBlocks: import_zod.z.number(),
15245
- importResiduals: import_zod.z.array(import_zod.z.unknown()),
15290
+ importResiduals: import_zod.z.array(importResidualSchema),
15246
15291
  validate: moduleValidateResultSchema
15247
15292
  });
15248
15293
  var artifactRefSchema = import_zod.z.object({ url: import_zod.z.string(), key: import_zod.z.string() });
@@ -15354,24 +15399,6 @@ function isBoundPath(path) {
15354
15399
  function parseBound(path, data) {
15355
15400
  return SCHEMAS[path].parse(data);
15356
15401
  }
15357
- var REASON_PREFIX = "REASON_";
15358
- function reasonWire(reason) {
15359
- return reasonToJSON(reason).slice(REASON_PREFIX.length).toLowerCase();
15360
- }
15361
- var LACE_REASONS = new Set(
15362
- Object.values(Reason).filter((value) => typeof value === "number" && value !== -1 /* UNRECOGNIZED */).map(reasonWire)
15363
- );
15364
- var laceReasonSchema = import_zod.z.custom(
15365
- (value) => typeof value === "string" && LACE_REASONS.has(value),
15366
- { message: "not a reason of Lace\u2019s own" }
15367
- );
15368
- var commandFailureSchema = import_zod.z.strictObject({
15369
- reason: laceReasonSchema,
15370
- message: import_zod.z.string(),
15371
- url: import_zod.z.string().optional(),
15372
- tool: import_zod.z.string().optional(),
15373
- apiCode: import_zod.z.string().optional()
15374
- });
15375
15402
  var failureMarkSchema = import_zod.z.object({ reason: import_zod.z.string(), message: import_zod.z.string() });
15376
15403
  function carriesFailure(data) {
15377
15404
  return failureMarkSchema.safeParse(data).success;
@@ -15379,6 +15406,12 @@ function carriesFailure(data) {
15379
15406
  function parseCommandFailure(data) {
15380
15407
  return commandFailureSchema.parse(data);
15381
15408
  }
15409
+ function resultFailure(path, data) {
15410
+ const result = parseBound(path, data);
15411
+ if ("failure" in result) return result.failure;
15412
+ if ("validate" in result) return result.validate.failure;
15413
+ return void 0;
15414
+ }
15382
15415
 
15383
15416
  // src/core/CommandArgsForm.tsx
15384
15417
  var import_jsx_runtime14 = require("react/jsx-runtime");
@@ -15389,7 +15422,7 @@ function flagsOf(path) {
15389
15422
  return COMMANDS[path].flags;
15390
15423
  }
15391
15424
  function CommandArgsForm({ form }) {
15392
- const [values, setValues] = (0, import_react23.useState)({});
15425
+ const [values, setValues] = (0, import_react21.useState)({});
15393
15426
  if (!form) return null;
15394
15427
  const flags = isCommandPath(form.path) ? flagsOf(form.path) : {};
15395
15428
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
@@ -15454,7 +15487,7 @@ function defineCommand(binding) {
15454
15487
  if (!binding.confirm) return void 0;
15455
15488
  const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
15456
15489
  if (!merged.ok) return void 0;
15457
- return binding.confirm(ctx, merged.args);
15490
+ return binding.confirm(ctx, merged.args, target);
15458
15491
  },
15459
15492
  async start(rt, ctx, target, formArgs, signal) {
15460
15493
  const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
@@ -15513,6 +15546,21 @@ var destroy = defineCommand({
15513
15546
  invalidates: "start+settle",
15514
15547
  result: slotSink("run")
15515
15548
  });
15549
+ function scanNotice(e) {
15550
+ const { slug } = e.stack;
15551
+ const settled = e.settled;
15552
+ if (!settled) {
15553
+ return e.triggered ? `Drift scan triggered for stack ${slug} (${e.stack.id}).` : `Drift scan already in progress for stack ${slug}.`;
15554
+ }
15555
+ if (settled.undeterminedReason !== null) return void 0;
15556
+ if (settled.footprintDestroyed) {
15557
+ return `Drift scan complete for stack ${slug}: IN_SYNC (0 drifted) \u2014 its resources were destroyed, so there was nothing to compare.`;
15558
+ }
15559
+ if (settled.standingDriftFindings > 0) {
15560
+ return `Drift scan complete for stack ${slug}: the scan observed no drift, but ${settled.standingDriftFindings} drift finding(s) from earlier scans still stand \u2014 the stack remains DRIFTED.`;
15561
+ }
15562
+ return `Drift scan complete for stack ${slug}: ${settled.driftStatus} (${settled.driftCount} drifted).`;
15563
+ }
15516
15564
  var scan = defineCommand({
15517
15565
  kind: "command",
15518
15566
  path: "stack scan",
@@ -15521,14 +15569,8 @@ var scan = defineCommand({
15521
15569
  result: {
15522
15570
  kind: "notify",
15523
15571
  consume: (rt, e) => {
15524
- if (!e.triggered) {
15525
- rt.ports.presenter.notify("info", e.reason ?? "Scan skipped");
15526
- return;
15527
- }
15528
- rt.ports.presenter.notify(
15529
- "info",
15530
- e.settled ? `Scan complete \u2014 ${e.settled.driftStatus}` : "Scan triggered"
15531
- );
15572
+ const notice = scanNotice(e);
15573
+ if (notice !== void 0) rt.ports.presenter.notify("info", notice);
15532
15574
  }
15533
15575
  }
15534
15576
  });
@@ -15542,15 +15584,51 @@ var create = defineCommand({
15542
15584
  consume: (rt, e) => rt.ports.presenter.notify("info", `Created stack ${e.slug}`)
15543
15585
  }
15544
15586
  });
15587
+ function residualAddresses(residuals) {
15588
+ return residuals.map((r) => r.address).join(", ");
15589
+ }
15590
+ function treeChanges(e) {
15591
+ return [
15592
+ ...e.written.length === 0 ? [] : [`rewriting ${e.written.join(", ")} in place`],
15593
+ ...e.removed.length === 0 ? [] : [`removing ${e.removed.join(", ")}`]
15594
+ ];
15595
+ }
15596
+ function importNotice(e) {
15597
+ const { slug } = e.stack;
15598
+ const changes = treeChanges(e);
15599
+ const changed = changes.length > 0;
15600
+ const files = changed ? `, ${changes.join(" and ")}` : "";
15601
+ const imported = `Imported ${e.importBlocks} resource(s) into ${slug}${files}.`;
15602
+ if (e.validate.exitClass !== "ok") {
15603
+ return ["warn", `${imported} The tree did not validate: fix it before you commit it.`];
15604
+ }
15605
+ const adopt = changed ? ` Review the change in git, commit it, then apply ${slug} to adopt them.` : "";
15606
+ if (e.importResiduals.length === 0) return ["info", `${imported}${adopt}`];
15607
+ return [
15608
+ "warn",
15609
+ `${imported}${adopt} Not adopted: ${residualAddresses(e.importResiduals)}; supply their import ids before applying, or the apply creates them anew.`
15610
+ ];
15611
+ }
15612
+ var importResult = {
15613
+ kind: "notify",
15614
+ consume: (rt, e) => rt.ports.presenter.notify(...importNotice(e))
15615
+ };
15545
15616
  var importStack = defineCommand({
15546
15617
  kind: "command",
15547
15618
  path: "stack import",
15548
15619
  args: (ctx) => ({ stack: ctx.stack?.id }),
15549
15620
  invalidates: true,
15550
- result: {
15551
- kind: "notify",
15552
- consume: (rt, e) => rt.ports.presenter.notify("info", `Imported ${e.importBlocks} block(s) into ${e.stack.slug}`)
15553
- }
15621
+ result: importResult
15622
+ });
15623
+ var importPartial = defineCommand({
15624
+ kind: "command",
15625
+ path: "stack import",
15626
+ args: (ctx) => ({ stack: ctx.stack?.id, allowPartial: true }),
15627
+ confirm: (ctx, _args, target) => ({
15628
+ text: `Import into ${ctx.stack?.slug} without adopting ${residualAddresses(target.failure?.importResiduals ?? [])}? Lace writes no import block for them, so the stack's apply creates them anew beside the live ones.`
15629
+ }),
15630
+ invalidates: true,
15631
+ result: importResult
15554
15632
  });
15555
15633
  var validate = defineCommand({
15556
15634
  kind: "command",
@@ -15618,12 +15696,14 @@ var MODULE_COMMAND_ACTIONS = [
15618
15696
  requiredContext: ["root"],
15619
15697
  binding: convert
15620
15698
  },
15621
- // The refused-tf banner's one action while the tree is out of lace shape:
15622
- // the same `module convert` the toolbar runs. The engine re-derives the
15623
- // tree it writes, which accepts it and lifts the lock.
15699
+ // Convert on the source-refused banner while the tree is out of lace
15700
+ // shape: the same `module convert` the toolbar runs, and the choice the
15701
+ // banner says of it. The engine re-derives the tree it writes, which
15702
+ // accepts it and lifts the lock.
15624
15703
  {
15625
15704
  id: "convert-refused",
15626
15705
  label: "Convert",
15706
+ choice: "Convert restructures it in place; a stack's apply creates only what its state does not hold yet.",
15627
15707
  icon: "convert",
15628
15708
  placement: { row: "source-refused" },
15629
15709
  requiredPorts: ["commands"],
@@ -15673,7 +15753,7 @@ var STACK_COMMAND_ACTIONS = [
15673
15753
  },
15674
15754
  {
15675
15755
  id: "import",
15676
- label: "Import state",
15756
+ label: "Import existing resources",
15677
15757
  placement: "toolbar",
15678
15758
  requiredPorts: ["commands"],
15679
15759
  // `stack import` writes the directory it runs in, the same way
@@ -15681,6 +15761,15 @@ var STACK_COMMAND_ACTIONS = [
15681
15761
  requiredContext: ["root", "stack"],
15682
15762
  binding: importStack
15683
15763
  },
15764
+ {
15765
+ id: "import-partial",
15766
+ label: "Import the rest",
15767
+ placement: { row: "failure" },
15768
+ requiredPorts: ["commands"],
15769
+ requiredContext: ["root", "stack"],
15770
+ answers: ["import_residual"],
15771
+ binding: importPartial
15772
+ },
15684
15773
  {
15685
15774
  id: "preview",
15686
15775
  label: "Preview",
@@ -15717,10 +15806,10 @@ var CORE_COMMAND_ACTIONS = [
15717
15806
  var import_proto8 = require("@lace-cloud/proto");
15718
15807
 
15719
15808
  // src/core/define-overlay.ts
15720
- var import_react26 = require("react");
15809
+ var import_react24 = require("react");
15721
15810
 
15722
15811
  // src/core/use-command-read.ts
15723
- var import_react25 = require("react");
15812
+ var import_react23 = require("react");
15724
15813
 
15725
15814
  // src/utils/is-plain-object.ts
15726
15815
  function isPlainObject(val) {
@@ -15728,11 +15817,11 @@ function isPlainObject(val) {
15728
15817
  }
15729
15818
 
15730
15819
  // src/core/panel-scope.tsx
15731
- var import_react24 = require("react");
15820
+ var import_react22 = require("react");
15732
15821
  var import_jsx_runtime15 = require("react/jsx-runtime");
15733
15822
  var noopReportError = () => {
15734
15823
  };
15735
- var PanelScopeContext = (0, import_react24.createContext)(null);
15824
+ var PanelScopeContext = (0, import_react22.createContext)(null);
15736
15825
  function PanelScope({
15737
15826
  ctx,
15738
15827
  target = {},
@@ -15742,14 +15831,14 @@ function PanelScope({
15742
15831
  children
15743
15832
  }) {
15744
15833
  const reportError = onReadError ?? noopReportError;
15745
- const value = (0, import_react24.useMemo)(
15834
+ const value = (0, import_react22.useMemo)(
15746
15835
  () => ({ ctx, target, paths: new Set(paths), tick, reportError }),
15747
15836
  [ctx, target, paths, tick, reportError]
15748
15837
  );
15749
15838
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PanelScopeContext.Provider, { value, children });
15750
15839
  }
15751
15840
  function usePanelScope() {
15752
- const value = (0, import_react24.useContext)(PanelScopeContext);
15841
+ const value = (0, import_react22.useContext)(PanelScopeContext);
15753
15842
  if (!value) {
15754
15843
  throw new Error(
15755
15844
  "usePanelScope: not inside a <PanelScope> \u2014 mount panels/overlays through App, which wraps every declared-read contribution"
@@ -15783,20 +15872,20 @@ function useCommandRead(read, target) {
15783
15872
  const effectiveTarget = target ?? scope.target;
15784
15873
  const args = read.args(scope.ctx, effectiveTarget);
15785
15874
  const key = args === null ? null : stableJson(args);
15786
- const [state, setState] = (0, import_react25.useState)(INITIAL);
15787
- const prevKeyRef = (0, import_react25.useRef)(NOT_YET_READ);
15875
+ const [state, setState] = (0, import_react23.useState)(INITIAL);
15876
+ const prevKeyRef = (0, import_react23.useRef)(NOT_YET_READ);
15788
15877
  const inputs = {
15789
15878
  path: read.path,
15790
15879
  args,
15791
15880
  commands: scope.ctx.ports.commands,
15792
15881
  reportError: scope.reportError
15793
15882
  };
15794
- const inputsRef = (0, import_react25.useRef)(inputs);
15795
- (0, import_react25.useEffect)(() => {
15883
+ const inputsRef = (0, import_react23.useRef)(inputs);
15884
+ (0, import_react23.useEffect)(() => {
15796
15885
  inputsRef.current = inputs;
15797
15886
  });
15798
- const request = (0, import_react25.useMemo)(() => ({ key, tick: scope.tick }), [key, scope.tick]);
15799
- (0, import_react25.useEffect)(() => {
15887
+ const request = (0, import_react23.useMemo)(() => ({ key, tick: scope.tick }), [key, scope.tick]);
15888
+ (0, import_react23.useEffect)(() => {
15800
15889
  const { path, args: args2, commands, reportError } = inputsRef.current;
15801
15890
  const keyChanged = prevKeyRef.current !== request.key;
15802
15891
  prevKeyRef.current = request.key;
@@ -15841,7 +15930,7 @@ function defineOverlay(o) {
15841
15930
  useDecorations(ctx) {
15842
15931
  const { data } = useCommandRead(o.read);
15843
15932
  const view = ctx.view;
15844
- return (0, import_react26.useMemo)(
15933
+ return (0, import_react24.useMemo)(
15845
15934
  () => data ? o.decorate(view, data) : EMPTY_DECORATIONS2,
15846
15935
  [o.decorate, view, data]
15847
15936
  );
@@ -15893,7 +15982,7 @@ var describeOverlay = defineOverlay({
15893
15982
  decorate: decorateDescribe
15894
15983
  });
15895
15984
 
15896
- // src/core/panels/ConflictBanner.tsx
15985
+ // src/core/panels/RowActionBanner.tsx
15897
15986
  var import_ui5 = require("@lace-cloud/ui");
15898
15987
 
15899
15988
  // src/components/Banner.tsx
@@ -15914,25 +16003,30 @@ function Banner({ severity, message, className, actions }) {
15914
16003
  );
15915
16004
  }
15916
16005
 
15917
- // src/core/panels/ConflictBanner.tsx
16006
+ // src/core/panels/RowActionBanner.tsx
15918
16007
  var import_jsx_runtime17 = require("react/jsx-runtime");
15919
- function ConflictBanner({ ctx }) {
16008
+ function bannerMessage(opening, actions) {
16009
+ return [opening, ...actions.flatMap((action) => action.choice ? [action.choice] : [])].join(
16010
+ " "
16011
+ );
16012
+ }
16013
+ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
15920
16014
  const { runner } = useCanvas();
15921
16015
  const envExtras = useEditorEnvExtras();
15922
- const actions = rowActionsFor(ctx, "conflict");
16016
+ const actions = rowActionsFor(ctx, panelId);
15923
16017
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
15924
16018
  Banner,
15925
16019
  {
15926
- severity: "warning",
15927
- className: "lace-conflict-banner",
15928
- message: "The module's .tf files changed outside the canvas while it held edits of its own.",
15929
- actions: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
16020
+ severity,
16021
+ className,
16022
+ message: bannerMessage(opening, actions),
16023
+ actions: actions.length === 0 ? void 0 : actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
15930
16024
  import_ui5.Button,
15931
16025
  {
15932
16026
  rung: true,
15933
16027
  size: "sm",
15934
16028
  variant: "secondary",
15935
- className: `lace-conflict-banner__${action.id}`,
16029
+ className: `${className}__${action.id}`,
15936
16030
  onClick: () => void runner.run(action, ctx, {}, envExtras),
15937
16031
  children: action.label
15938
16032
  },
@@ -15941,6 +16035,21 @@ function ConflictBanner({ ctx }) {
15941
16035
  }
15942
16036
  );
15943
16037
  }
16038
+
16039
+ // src/core/panels/ConflictBanner.tsx
16040
+ var import_jsx_runtime18 = require("react/jsx-runtime");
16041
+ function ConflictBanner({ ctx }) {
16042
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
16043
+ RowActionBanner,
16044
+ {
16045
+ ctx,
16046
+ panelId: "conflict",
16047
+ severity: "warning",
16048
+ className: "lace-conflict-banner",
16049
+ opening: "The module's .tf files changed outside the canvas while it held edits of its own."
16050
+ }
16051
+ );
16052
+ }
15944
16053
  var conflictPanel = {
15945
16054
  id: "conflict",
15946
16055
  title: "Conflict",
@@ -15954,9 +16063,9 @@ var conflictPanel = {
15954
16063
  var import_ui6 = require("@lace-cloud/ui");
15955
16064
 
15956
16065
  // src/components/Identifier.tsx
15957
- var import_react27 = require("react");
16066
+ var import_react25 = require("react");
15958
16067
  var import_Identifier = require("./Identifier-V6MZ37EG.css");
15959
- var import_jsx_runtime18 = (
16068
+ var import_jsx_runtime19 = (
15960
16069
  // biome-ignore lint/suspicious/noArrayIndexKey: a segment's place in the name is its identity.
15961
16070
  require("react/jsx-runtime")
15962
16071
  );
@@ -15964,15 +16073,15 @@ function identifierSegments(text) {
15964
16073
  return text.split(/(?<=[_.])/);
15965
16074
  }
15966
16075
  function Identifier({ text, className }) {
15967
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: className ? `lace-identifier ${className}` : "lace-identifier", children: identifierSegments(text).map((segment, i) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react27.Fragment, { children: [
15968
- i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("wbr", {}) : null,
16076
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: className ? `lace-identifier ${className}` : "lace-identifier", children: identifierSegments(text).map((segment, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react25.Fragment, { children: [
16077
+ i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("wbr", {}) : null,
15969
16078
  segment
15970
16079
  ] }, i)) });
15971
16080
  }
15972
16081
 
15973
16082
  // src/core/panels/DiagnosticsPanel.tsx
15974
16083
  var import_DiagnosticsPanel = require("./DiagnosticsPanel-T6VDHH4A.css");
15975
- var import_jsx_runtime19 = require("react/jsx-runtime");
16084
+ var import_jsx_runtime20 = require("react/jsx-runtime");
15976
16085
  function rowKey(d, index) {
15977
16086
  return `${d.severity}:${d.module_key ?? ""}.${d.instance_id ?? ""}:${index}`;
15978
16087
  }
@@ -15980,27 +16089,27 @@ function DiagnosticsPanel({ ctx }) {
15980
16089
  const { runner } = useCanvas();
15981
16090
  const envExtras = useEditorEnvExtras();
15982
16091
  const diagnostics = ctx.diagnostics;
15983
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("ul", { className: "lace-diagnostics-panel", role: "list", children: diagnostics.map((d, index) => {
16092
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ul", { className: "lace-diagnostics-panel", role: "list", children: diagnostics.map((d, index) => {
15984
16093
  const key = rowKey(d, index);
15985
16094
  const target = { diagnostic: d };
15986
16095
  const actions = rowActionsFor(ctx, "diagnostics", target);
15987
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
16096
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
15988
16097
  "li",
15989
16098
  {
15990
16099
  className: `lace-diagnostics-panel__row lace-diagnostics-panel__row--${d.severity}`,
15991
16100
  children: [
15992
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "lace-diagnostics-panel__icon", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CanvasIcon, { name: d.severity }) }),
15993
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "lace-diagnostics-panel__body", children: [
15994
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "lace-diagnostics-panel__message", children: d.message }),
15995
- d.instance_id !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
16101
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "lace-diagnostics-panel__icon", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CanvasIcon, { name: d.severity }) }),
16102
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "lace-diagnostics-panel__body", children: [
16103
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "lace-diagnostics-panel__message", children: d.message }),
16104
+ d.instance_id !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
15996
16105
  Identifier,
15997
16106
  {
15998
16107
  className: "lace-diagnostics-panel__where",
15999
16108
  text: d.input_name ? `${d.instance_id}.${d.input_name}` : d.instance_id
16000
16109
  }
16001
16110
  ),
16002
- d.code !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Identifier, { className: "lace-diagnostics-panel__code", text: d.code }),
16003
- actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
16111
+ d.code !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Identifier, { className: "lace-diagnostics-panel__code", text: d.code }),
16112
+ actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
16004
16113
  import_ui6.Button,
16005
16114
  {
16006
16115
  rung: true,
@@ -16033,13 +16142,13 @@ var diagnosticsPanel = {
16033
16142
 
16034
16143
  // src/core/panels/edge-inspector.ts
16035
16144
  var import_proto10 = require("@lace-cloud/proto");
16036
- var import_react28 = require("react");
16145
+ var import_react26 = require("react");
16037
16146
 
16038
16147
  // src/components/panels/EdgeInspectorPanel.tsx
16039
16148
  var import_proto9 = require("@lace-cloud/proto");
16040
16149
  var import_ui7 = require("@lace-cloud/ui");
16041
16150
  var import_EdgeInspectorPanel = require("./EdgeInspectorPanel-JD6CVUAT.css");
16042
- var import_jsx_runtime20 = require("react/jsx-runtime");
16151
+ var import_jsx_runtime21 = require("react/jsx-runtime");
16043
16152
  function EdgeInspectorPanel({
16044
16153
  source,
16045
16154
  target,
@@ -16048,23 +16157,23 @@ function EdgeInspectorPanel({
16048
16157
  onDelete,
16049
16158
  onClose
16050
16159
  }) {
16051
- const title = /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
16052
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "lace-edge-panel__title-eyebrow", children: "Connection" }),
16053
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "lace-edge-panel__title", children: [
16054
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Identifier, { text: source }),
16160
+ const title = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
16161
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "lace-edge-panel__title-eyebrow", children: "Connection" }),
16162
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "lace-edge-panel__title", children: [
16163
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Identifier, { text: source }),
16055
16164
  " \u2192 ",
16056
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Identifier, { text: target })
16165
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Identifier, { text: target })
16057
16166
  ] })
16058
16167
  ] });
16059
- const footer = onDelete ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_ui7.Button, { rung: true, variant: "danger", fullWidth: true, onClick: onDelete, children: "Delete connection" }) : void 0;
16060
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_ui7.Panel, { title, footer, onClose, children: [
16061
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "lace-edge-panel__section-label", children: "Wiring" }),
16062
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "lace-edge-panel__wiring", children: [
16063
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Identifier, { text: sourceOutput ? `${source}.outputs.${sourceOutput}` : (0, import_proto9.callText)(source) }),
16064
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "lace-edge-panel__wiring-arrow", children: "\u2193" }),
16065
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Identifier, { text: `${target}.inputs.${targetInput}` })
16168
+ const footer = onDelete ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_ui7.Button, { rung: true, variant: "danger", fullWidth: true, onClick: onDelete, children: "Delete connection" }) : void 0;
16169
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_ui7.Panel, { title, footer, onClose, children: [
16170
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "lace-edge-panel__section-label", children: "Wiring" }),
16171
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "lace-edge-panel__wiring", children: [
16172
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Identifier, { text: sourceOutput ? `${source}.outputs.${sourceOutput}` : (0, import_proto9.callText)(source) }),
16173
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "lace-edge-panel__wiring-arrow", children: "\u2193" }),
16174
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Identifier, { text: `${target}.inputs.${targetInput}` })
16066
16175
  ] }),
16067
- onDelete && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("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." })
16176
+ onDelete && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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." })
16068
16177
  ] });
16069
16178
  }
16070
16179
 
@@ -16096,7 +16205,7 @@ function EdgeInspectorPanel2({ ctx }) {
16096
16205
  if (!edge) return null;
16097
16206
  const close = () => setSelection({ nodes: [], edge: null });
16098
16207
  const disconnect = rowActionsFor(ctx, "edge-inspector").find((a) => a.id === "disconnect");
16099
- return (0, import_react28.createElement)(EdgeInspectorPanel, {
16208
+ return (0, import_react26.createElement)(EdgeInspectorPanel, {
16100
16209
  source: edge.source,
16101
16210
  target: edge.target,
16102
16211
  sourceOutput: edge.sourceOutput,
@@ -16123,9 +16232,9 @@ var edgeInspectorPanel = {
16123
16232
 
16124
16233
  // src/core/panels/Markers.tsx
16125
16234
  var import_ui8 = require("@lace-cloud/ui");
16126
- var import_jsx_runtime21 = require("react/jsx-runtime");
16235
+ var import_jsx_runtime22 = require("react/jsx-runtime");
16127
16236
  function UnsavedMarker() {
16128
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_ui8.Badge, { variant: "warning", dot: true, role: "status", className: "lace-marker lace-marker--unsaved", children: "Unsaved" });
16237
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui8.Badge, { variant: "warning", dot: true, role: "status", className: "lace-marker lace-marker--unsaved", children: "Unsaved" });
16129
16238
  }
16130
16239
  var unsavedMarker = {
16131
16240
  id: "unsaved-marker",
@@ -16137,7 +16246,7 @@ var unsavedMarker = {
16137
16246
  Component: UnsavedMarker
16138
16247
  };
16139
16248
  function UngeneratedMarker() {
16140
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_ui8.Badge, { variant: "neutral", role: "status", className: "lace-marker lace-marker--ungenerated", children: "Not generated" });
16249
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ui8.Badge, { variant: "neutral", role: "status", className: "lace-marker lace-marker--ungenerated", children: "Not generated" });
16141
16250
  }
16142
16251
  var ungeneratedMarker = {
16143
16252
  id: "ungenerated-marker",
@@ -16150,12 +16259,12 @@ var ungeneratedMarker = {
16150
16259
  };
16151
16260
 
16152
16261
  // src/core/panels/module-config.ts
16153
- var import_react39 = require("react");
16262
+ var import_react37 = require("react");
16154
16263
 
16155
16264
  // src/components/panels/ModuleConfigPanel.tsx
16156
16265
  var import_proto12 = require("@lace-cloud/proto");
16157
16266
  var import_ui17 = require("@lace-cloud/ui");
16158
- var import_react38 = require("react");
16267
+ var import_react36 = require("react");
16159
16268
 
16160
16269
  // src/exhaustive.ts
16161
16270
  function assertNever(value) {
@@ -16163,15 +16272,15 @@ function assertNever(value) {
16163
16272
  }
16164
16273
 
16165
16274
  // src/hooks/useUpdateState.ts
16166
- var import_react29 = require("react");
16275
+ var import_react27 = require("react");
16167
16276
  function useUpdateState(updateFn) {
16168
- const [status, setStatus] = (0, import_react29.useState)("idle");
16169
- const mountedRef = (0, import_react29.useRef)(true);
16170
- const resetTimerRef = (0, import_react29.useRef)(null);
16171
- const safeSetStatus = (0, import_react29.useCallback)((next) => {
16277
+ const [status, setStatus] = (0, import_react27.useState)("idle");
16278
+ const mountedRef = (0, import_react27.useRef)(true);
16279
+ const resetTimerRef = (0, import_react27.useRef)(null);
16280
+ const safeSetStatus = (0, import_react27.useCallback)((next) => {
16172
16281
  if (mountedRef.current) setStatus(next);
16173
16282
  }, []);
16174
- const scheduleReset = (0, import_react29.useCallback)(
16283
+ const scheduleReset = (0, import_react27.useCallback)(
16175
16284
  (delay) => {
16176
16285
  if (resetTimerRef.current !== null) clearTimeout(resetTimerRef.current);
16177
16286
  resetTimerRef.current = setTimeout(() => {
@@ -16181,7 +16290,7 @@ function useUpdateState(updateFn) {
16181
16290
  },
16182
16291
  [safeSetStatus]
16183
16292
  );
16184
- const handleUpdate = (0, import_react29.useCallback)(async () => {
16293
+ const handleUpdate = (0, import_react27.useCallback)(async () => {
16185
16294
  safeSetStatus("updating");
16186
16295
  try {
16187
16296
  await updateFn();
@@ -16192,7 +16301,7 @@ function useUpdateState(updateFn) {
16192
16301
  scheduleReset(2e3);
16193
16302
  }
16194
16303
  }, [updateFn, safeSetStatus, scheduleReset]);
16195
- (0, import_react29.useEffect)(() => {
16304
+ (0, import_react27.useEffect)(() => {
16196
16305
  return () => {
16197
16306
  mountedRef.current = false;
16198
16307
  if (resetTimerRef.current !== null) {
@@ -16205,13 +16314,13 @@ function useUpdateState(updateFn) {
16205
16314
  }
16206
16315
 
16207
16316
  // src/components/AccordionSection.tsx
16208
- var import_react30 = require("react");
16317
+ var import_react28 = require("react");
16209
16318
  var import_AccordionSection = require("./AccordionSection-J3ALHB5M.css");
16210
- var import_jsx_runtime22 = require("react/jsx-runtime");
16319
+ var import_jsx_runtime23 = require("react/jsx-runtime");
16211
16320
  function AccordionSection({ title, defaultOpen = false, badge, children }) {
16212
- const [open, setOpen] = (0, import_react30.useState)(defaultOpen);
16213
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `lace-accordion${open ? " lace-accordion--open" : ""}`, children: [
16214
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
16321
+ const [open, setOpen] = (0, import_react28.useState)(defaultOpen);
16322
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `lace-accordion${open ? " lace-accordion--open" : ""}`, children: [
16323
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
16215
16324
  "button",
16216
16325
  {
16217
16326
  type: "button",
@@ -16219,13 +16328,13 @@ function AccordionSection({ title, defaultOpen = false, badge, children }) {
16219
16328
  onClick: () => setOpen((v) => !v),
16220
16329
  "aria-expanded": open,
16221
16330
  children: [
16222
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "lace-accordion__chevron", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CanvasIcon, { name: "chevron-right" }) }),
16223
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "lace-accordion__title", children: title }),
16224
- badge && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "lace-accordion__badge", children: badge })
16331
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "lace-accordion__chevron", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CanvasIcon, { name: "chevron-right" }) }),
16332
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "lace-accordion__title", children: title }),
16333
+ badge && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "lace-accordion__badge", children: badge })
16225
16334
  ]
16226
16335
  }
16227
16336
  ),
16228
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "lace-accordion__body", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "lace-accordion__body-inner", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "lace-accordion__body-content", children }) }) })
16337
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "lace-accordion__body", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "lace-accordion__body-inner", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "lace-accordion__body-content", children }) }) })
16229
16338
  ] });
16230
16339
  }
16231
16340
 
@@ -16236,7 +16345,7 @@ var import_panels_shared8 = require("./panels-shared-5JFNYXQ7.css");
16236
16345
  // src/components/UpdateButton.tsx
16237
16346
  var import_ui9 = require("@lace-cloud/ui");
16238
16347
  var import_UpdateButton = require("./UpdateButton-TJKSFVBA.css");
16239
- var import_jsx_runtime23 = require("react/jsx-runtime");
16348
+ var import_jsx_runtime24 = require("react/jsx-runtime");
16240
16349
  var variantByStatus = {
16241
16350
  idle: "primary",
16242
16351
  updating: "primary",
@@ -16249,7 +16358,7 @@ var labelByStatus = {
16249
16358
  error: "Update failed \u2014 try again"
16250
16359
  };
16251
16360
  function UpdateButton({ status, label, onClick, disabled, disabledTitle }) {
16252
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "lace-commit-foot", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
16361
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "lace-commit-foot", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16253
16362
  import_ui9.Button,
16254
16363
  {
16255
16364
  rung: true,
@@ -16267,13 +16376,13 @@ function UpdateButton({ status, label, onClick, disabled, disabledTitle }) {
16267
16376
  // src/components/panels/ModuleDetails.tsx
16268
16377
  var import_proto11 = require("@lace-cloud/proto");
16269
16378
  var import_ui16 = require("@lace-cloud/ui");
16270
- var import_react37 = require("react");
16379
+ var import_react35 = require("react");
16271
16380
 
16272
16381
  // src/components/panels/BlockEditor.tsx
16273
16382
  var import_ui10 = require("@lace-cloud/ui");
16274
- var import_react31 = require("react");
16383
+ var import_react29 = require("react");
16275
16384
  var import_panels_shared = require("./panels-shared-5JFNYXQ7.css");
16276
- var import_jsx_runtime24 = require("react/jsx-runtime");
16385
+ var import_jsx_runtime25 = require("react/jsx-runtime");
16277
16386
  function replaceAt(list, index, item) {
16278
16387
  return list.map((x, i) => i === index ? item : x);
16279
16388
  }
@@ -16281,8 +16390,8 @@ function blockTitle(block) {
16281
16390
  return [block.type, ...block.labels.map((l) => `"${l}"`)].join(" ");
16282
16391
  }
16283
16392
  function BlockEditor({ blocks, onChange, editable, templates }) {
16284
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
16285
- blocks.map((block, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16393
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
16394
+ blocks.map((block, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16286
16395
  BlockCard,
16287
16396
  {
16288
16397
  block,
@@ -16292,7 +16401,7 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
16292
16401
  },
16293
16402
  i
16294
16403
  )),
16295
- editable && (templates ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "lace-panel-row-actions", children: templates.map((t) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
16404
+ editable && (templates ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "lace-panel-row-actions", children: templates.map((t) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
16296
16405
  import_ui10.Button,
16297
16406
  {
16298
16407
  variant: "secondary",
@@ -16313,7 +16422,7 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
16313
16422
  ]
16314
16423
  },
16315
16424
  t.type
16316
- )) }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16425
+ )) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16317
16426
  NewBlockRow,
16318
16427
  {
16319
16428
  onAdd: (type, label) => onChange([
@@ -16325,10 +16434,10 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
16325
16434
  ] });
16326
16435
  }
16327
16436
  function NewBlockRow({ onAdd }) {
16328
- const [type, setType] = (0, import_react31.useState)("");
16329
- const [label, setLabel] = (0, import_react31.useState)("");
16330
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "lace-panel-row-actions", children: [
16331
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16437
+ const [type, setType] = (0, import_react29.useState)("");
16438
+ const [label, setLabel] = (0, import_react29.useState)("");
16439
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "lace-panel-row-actions", children: [
16440
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16332
16441
  import_ui10.Input,
16333
16442
  {
16334
16443
  value: type,
@@ -16338,7 +16447,7 @@ function NewBlockRow({ onAdd }) {
16338
16447
  mono: true
16339
16448
  }
16340
16449
  ),
16341
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16450
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16342
16451
  import_ui10.Input,
16343
16452
  {
16344
16453
  value: label,
@@ -16348,7 +16457,7 @@ function NewBlockRow({ onAdd }) {
16348
16457
  mono: true
16349
16458
  }
16350
16459
  ),
16351
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16460
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16352
16461
  import_ui10.Button,
16353
16462
  {
16354
16463
  variant: "secondary",
@@ -16372,13 +16481,13 @@ function BlockCard({ block, editable, onChange, onRemove }) {
16372
16481
  [field]: value
16373
16482
  })
16374
16483
  });
16375
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "lace-panel-validation-block", children: [
16376
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "lace-panel-row-actions", children: [
16377
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Identifier, { className: "lace-panel-row-card__name", text: blockTitle(block) }),
16378
- editable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16484
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "lace-panel-validation-block", children: [
16485
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "lace-panel-row-actions", children: [
16486
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Identifier, { className: "lace-panel-row-card__name", text: blockTitle(block) }),
16487
+ editable && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16379
16488
  import_ui10.IconButton,
16380
16489
  {
16381
- icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CanvasIcon, { name: "close" }),
16490
+ icon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CanvasIcon, { name: "close" }),
16382
16491
  "aria-label": `Remove the ${block.type} block`,
16383
16492
  size: "md",
16384
16493
  tooltipPlacement: "bottom-end",
@@ -16388,8 +16497,8 @@ function BlockCard({ block, editable, onChange, onRemove }) {
16388
16497
  ] }),
16389
16498
  block.attributes.map((attribute, i) => (
16390
16499
  // biome-ignore lint/suspicious/noArrayIndexKey: attributes are positional; the render keeps their order
16391
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "lace-panel-row-actions", children: [
16392
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16500
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "lace-panel-row-actions", children: [
16501
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16393
16502
  import_ui10.Input,
16394
16503
  {
16395
16504
  value: attribute.name,
@@ -16400,7 +16509,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
16400
16509
  readOnly: !editable
16401
16510
  }
16402
16511
  ),
16403
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16512
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16404
16513
  import_ui10.Input,
16405
16514
  {
16406
16515
  value: attribute.value,
@@ -16411,10 +16520,10 @@ function BlockCard({ block, editable, onChange, onRemove }) {
16411
16520
  readOnly: !editable
16412
16521
  }
16413
16522
  ),
16414
- editable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16523
+ editable && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16415
16524
  import_ui10.IconButton,
16416
16525
  {
16417
- icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CanvasIcon, { name: "close" }),
16526
+ icon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CanvasIcon, { name: "close" }),
16418
16527
  "aria-label": `Remove ${attribute.name || "the argument"}`,
16419
16528
  size: "md",
16420
16529
  tooltipPlacement: "bottom-end",
@@ -16423,7 +16532,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
16423
16532
  )
16424
16533
  ] }, i)
16425
16534
  )),
16426
- editable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16535
+ editable && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16427
16536
  import_ui10.Button,
16428
16537
  {
16429
16538
  variant: "secondary",
@@ -16432,7 +16541,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
16432
16541
  children: "+ Add argument"
16433
16542
  }
16434
16543
  ),
16435
- (block.blocks.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16544
+ (block.blocks.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16436
16545
  BlockEditor,
16437
16546
  {
16438
16547
  blocks: block.blocks,
@@ -16445,7 +16554,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
16445
16554
 
16446
16555
  // src/components/panels/LocalsPanel.tsx
16447
16556
  var import_ui11 = require("@lace-cloud/ui");
16448
- var import_react32 = require("react");
16557
+ var import_react30 = require("react");
16449
16558
 
16450
16559
  // src/utils/duplicates.ts
16451
16560
  function findDuplicateIndices(items, keyFn) {
@@ -16465,7 +16574,7 @@ function findDuplicateIndices(items, keyFn) {
16465
16574
 
16466
16575
  // src/components/panels/LocalsPanel.tsx
16467
16576
  var import_panels_shared2 = require("./panels-shared-5JFNYXQ7.css");
16468
- var import_jsx_runtime25 = require("react/jsx-runtime");
16577
+ var import_jsx_runtime26 = require("react/jsx-runtime");
16469
16578
  function toRows(locals) {
16470
16579
  return (locals ?? []).map((l) => ({ id: crypto.randomUUID(), ...l }));
16471
16580
  }
@@ -16474,28 +16583,28 @@ function fromRows(rows) {
16474
16583
  }
16475
16584
  function LocalsContent({ locals, onSave }) {
16476
16585
  const { editable } = useCanvas();
16477
- const [rows, setRows] = (0, import_react32.useState)(() => toRows(locals));
16478
- const addLocal = (0, import_react32.useCallback)(() => {
16586
+ const [rows, setRows] = (0, import_react30.useState)(() => toRows(locals));
16587
+ const addLocal = (0, import_react30.useCallback)(() => {
16479
16588
  setRows((prev) => [...prev, { id: crypto.randomUUID(), name: "", value: "" }]);
16480
16589
  }, []);
16481
- const removeLocal = (0, import_react32.useCallback)((index) => {
16590
+ const removeLocal = (0, import_react30.useCallback)((index) => {
16482
16591
  setRows((prev) => prev.filter((_, i) => i !== index));
16483
16592
  }, []);
16484
- const updateRow = (0, import_react32.useCallback)((index, field, value) => {
16593
+ const updateRow = (0, import_react30.useCallback)((index, field, value) => {
16485
16594
  setRows((prev) => prev.map((r, i) => i === index ? { ...r, [field]: value } : r));
16486
16595
  }, []);
16487
16596
  const nameDupes = findDuplicateIndices(rows, (r) => r.name);
16488
16597
  const hasErrors = nameDupes.size > 0;
16489
16598
  const { status: updateStatus, handleUpdate } = useUpdateState(
16490
- (0, import_react32.useCallback)(async () => {
16599
+ (0, import_react30.useCallback)(async () => {
16491
16600
  if (hasErrors) return;
16492
16601
  await onSave(fromRows(rows));
16493
16602
  }, [onSave, rows, hasErrors])
16494
16603
  );
16495
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
16496
- rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
16497
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "lace-panel-row-actions", children: [
16498
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16604
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
16605
+ rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
16606
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-actions", children: [
16607
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16499
16608
  import_ui11.Input,
16500
16609
  {
16501
16610
  value: row.name,
@@ -16508,10 +16617,10 @@ function LocalsContent({ locals, onSave }) {
16508
16617
  readOnly: !editable
16509
16618
  }
16510
16619
  ),
16511
- editable && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16620
+ editable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16512
16621
  import_ui11.IconButton,
16513
16622
  {
16514
- icon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CanvasIcon, { name: "close" }),
16623
+ icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CanvasIcon, { name: "close" }),
16515
16624
  "aria-label": "Remove local",
16516
16625
  size: "md",
16517
16626
  tooltipPlacement: "bottom-end",
@@ -16519,8 +16628,8 @@ function LocalsContent({ locals, onSave }) {
16519
16628
  }
16520
16629
  )
16521
16630
  ] }),
16522
- nameDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "lace-panel-row-error", children: "Duplicate local name" }),
16523
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16631
+ nameDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-row-error", children: "Duplicate local name" }),
16632
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16524
16633
  import_ui11.Textarea,
16525
16634
  {
16526
16635
  value: row.value,
@@ -16534,9 +16643,9 @@ function LocalsContent({ locals, onSave }) {
16534
16643
  }
16535
16644
  ) })
16536
16645
  ] }, row.id)),
16537
- editable && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
16538
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ui11.Button, { variant: "secondary", size: "sm", onClick: addLocal, children: "+ Add local" }),
16539
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16646
+ editable && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
16647
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_ui11.Button, { variant: "secondary", size: "sm", onClick: addLocal, children: "+ Add local" }),
16648
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16540
16649
  UpdateButton,
16541
16650
  {
16542
16651
  status: updateStatus,
@@ -16550,14 +16659,14 @@ function LocalsContent({ locals, onSave }) {
16550
16659
  ] });
16551
16660
  }
16552
16661
  function LocalsPanel({ locals, onSave, onClose }) {
16553
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ui11.Panel, { title: "Locals", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(LocalsContent, { locals, onSave }) });
16662
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_ui11.Panel, { title: "Locals", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LocalsContent, { locals, onSave }) });
16554
16663
  }
16555
16664
 
16556
16665
  // src/components/panels/ModuleInterfacePanel.tsx
16557
16666
  var import_ui12 = require("@lace-cloud/ui");
16558
- var import_react33 = require("react");
16667
+ var import_react31 = require("react");
16559
16668
  var import_panels_shared3 = require("./panels-shared-5JFNYXQ7.css");
16560
- var import_jsx_runtime26 = require("react/jsx-runtime");
16669
+ var import_jsx_runtime27 = require("react/jsx-runtime");
16561
16670
  function variablesToRows(variables) {
16562
16671
  return variables.map((v) => ({
16563
16672
  id: crypto.randomUUID(),
@@ -16595,17 +16704,17 @@ function outputName(text) {
16595
16704
  }
16596
16705
  function ModuleInterfaceContent({ settings, onSave }) {
16597
16706
  const { editable } = useCanvas();
16598
- const [variables, setVariables2] = (0, import_react33.useState)(
16707
+ const [variables, setVariables2] = (0, import_react31.useState)(
16599
16708
  () => variablesToRows(settings.variables)
16600
16709
  );
16601
- const [outputs, setOutputs2] = (0, import_react33.useState)(() => outputsToRows(settings.outputs));
16602
- const updateVariable = (0, import_react33.useCallback)(
16710
+ const [outputs, setOutputs2] = (0, import_react31.useState)(() => outputsToRows(settings.outputs));
16711
+ const updateVariable = (0, import_react31.useCallback)(
16603
16712
  (index, field, value) => {
16604
16713
  setVariables2((prev) => prev.map((v, i) => i === index ? { ...v, [field]: value } : v));
16605
16714
  },
16606
16715
  []
16607
16716
  );
16608
- const addVariable = (0, import_react33.useCallback)(() => {
16717
+ const addVariable = (0, import_react31.useCallback)(() => {
16609
16718
  setVariables2((prev) => [
16610
16719
  ...prev,
16611
16720
  {
@@ -16623,7 +16732,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
16623
16732
  }
16624
16733
  ]);
16625
16734
  }, []);
16626
- const addValidation = (0, import_react33.useCallback)((index) => {
16735
+ const addValidation = (0, import_react31.useCallback)((index) => {
16627
16736
  setVariables2(
16628
16737
  (prev) => prev.map(
16629
16738
  (v, i) => i === index ? {
@@ -16636,14 +16745,14 @@ function ModuleInterfaceContent({ settings, onSave }) {
16636
16745
  )
16637
16746
  );
16638
16747
  }, []);
16639
- const removeValidation = (0, import_react33.useCallback)((index, vIndex) => {
16748
+ const removeValidation = (0, import_react31.useCallback)((index, vIndex) => {
16640
16749
  setVariables2(
16641
16750
  (prev) => prev.map(
16642
16751
  (v, i) => i === index ? { ...v, validation: v.validation.filter((_, j) => j !== vIndex) } : v
16643
16752
  )
16644
16753
  );
16645
16754
  }, []);
16646
- const updateValidation = (0, import_react33.useCallback)(
16755
+ const updateValidation = (0, import_react31.useCallback)(
16647
16756
  (index, vIndex, field, value) => {
16648
16757
  setVariables2(
16649
16758
  (prev) => prev.map(
@@ -16658,19 +16767,19 @@ function ModuleInterfaceContent({ settings, onSave }) {
16658
16767
  },
16659
16768
  []
16660
16769
  );
16661
- const updateOutput = (0, import_react33.useCallback)(
16770
+ const updateOutput = (0, import_react31.useCallback)(
16662
16771
  (index, field, value) => {
16663
16772
  setOutputs2((prev) => prev.map((o, i) => i === index ? { ...o, [field]: value } : o));
16664
16773
  },
16665
16774
  []
16666
16775
  );
16667
- const addOutput = (0, import_react33.useCallback)((name, value) => {
16776
+ const addOutput = (0, import_react31.useCallback)((name, value) => {
16668
16777
  setOutputs2((prev) => [
16669
16778
  ...prev,
16670
16779
  { id: crypto.randomUUID(), name, value, description: "", sensitive: false, depends_on: [] }
16671
16780
  ]);
16672
16781
  }, []);
16673
- const toggleDependsOn = (0, import_react33.useCallback)((index, dep) => {
16782
+ const toggleDependsOn = (0, import_react31.useCallback)((index, dep) => {
16674
16783
  setOutputs2(
16675
16784
  (prev) => prev.map((o, i) => {
16676
16785
  if (i !== index) return o;
@@ -16687,7 +16796,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
16687
16796
  const unnamedOutput = outputs.some((o) => !o.name.trim() || !o.value.trim());
16688
16797
  const hasErrors = variableDupes.size > 0 || outputDupes.size > 0 || unnamedOutput;
16689
16798
  const { status: updateStatus, handleUpdate } = useUpdateState(
16690
- (0, import_react33.useCallback)(async () => {
16799
+ (0, import_react31.useCallback)(async () => {
16691
16800
  if (hasErrors) return;
16692
16801
  const variableDefs = variables.filter((v) => v.name.trim()).map((v) => {
16693
16802
  const validation = v.validation.map((b) => ({ condition: b.condition.trim(), error_message: b.error_message.trim() })).filter((b) => b.condition || b.error_message);
@@ -16718,13 +16827,13 @@ function ModuleInterfaceContent({ settings, onSave }) {
16718
16827
  }, [variables, outputs, hasErrors, onSave])
16719
16828
  );
16720
16829
  const exposable = settings.call_outputs.filter((text) => !outputs.some((o) => o.value === text));
16721
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
16722
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-hint", children: "The module's public surface: the variables its callers set and the outputs they read." }),
16723
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h4", { className: "lace-panel-section-title", children: "Inputs" }),
16724
- variables.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-hint", children: "No variables." }),
16725
- variables.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
16726
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-actions", children: [
16727
- v.added ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16830
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
16831
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-hint", children: "The module's public surface: the variables its callers set and the outputs they read." }),
16832
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h4", { className: "lace-panel-section-title", children: "Inputs" }),
16833
+ variables.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-hint", children: "No variables." }),
16834
+ variables.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
16835
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "lace-panel-row-actions", children: [
16836
+ v.added ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16728
16837
  import_ui12.Input,
16729
16838
  {
16730
16839
  label: "Name",
@@ -16735,11 +16844,11 @@ function ModuleInterfaceContent({ settings, onSave }) {
16735
16844
  mono: true,
16736
16845
  error: variableDupes.has(i)
16737
16846
  }
16738
- ) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Identifier, { className: "lace-panel-row-card__name", text: v.name }),
16739
- editable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16847
+ ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Identifier, { className: "lace-panel-row-card__name", text: v.name }),
16848
+ editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16740
16849
  import_ui12.IconButton,
16741
16850
  {
16742
- icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CanvasIcon, { name: "close" }),
16851
+ icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CanvasIcon, { name: "close" }),
16743
16852
  "aria-label": `Remove variable ${v.name}`,
16744
16853
  size: "md",
16745
16854
  tooltipPlacement: "bottom-end",
@@ -16747,8 +16856,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
16747
16856
  }
16748
16857
  )
16749
16858
  ] }),
16750
- variableDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-row-error", children: "Duplicate variable name" }),
16751
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16859
+ variableDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-row-error", children: "Duplicate variable name" }),
16860
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16752
16861
  import_ui12.Input,
16753
16862
  {
16754
16863
  label: "Type",
@@ -16760,8 +16869,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
16760
16869
  readOnly: !editable
16761
16870
  }
16762
16871
  ) }),
16763
- v.defaultText && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_ui12.Input, { label: "Default", value: v.defaultText, fullWidth: true, mono: true, readOnly: true }) }),
16764
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16872
+ v.defaultText && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_ui12.Input, { label: "Default", value: v.defaultText, fullWidth: true, mono: true, readOnly: true }) }),
16873
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16765
16874
  import_ui12.Textarea,
16766
16875
  {
16767
16876
  label: "Description",
@@ -16773,9 +16882,9 @@ function ModuleInterfaceContent({ settings, onSave }) {
16773
16882
  readOnly: !editable
16774
16883
  }
16775
16884
  ) }),
16776
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-actions", children: [
16777
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
16778
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16885
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "lace-panel-row-actions", children: [
16886
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
16887
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16779
16888
  "input",
16780
16889
  {
16781
16890
  type: "checkbox",
@@ -16784,10 +16893,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
16784
16893
  disabled: !editable
16785
16894
  }
16786
16895
  ),
16787
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Required" })
16896
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Required" })
16788
16897
  ] }),
16789
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
16790
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16898
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
16899
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16791
16900
  "input",
16792
16901
  {
16793
16902
  type: "checkbox",
@@ -16796,10 +16905,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
16796
16905
  disabled: !editable
16797
16906
  }
16798
16907
  ),
16799
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Ephemeral" })
16908
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Ephemeral" })
16800
16909
  ] }),
16801
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
16802
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16910
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
16911
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16803
16912
  "input",
16804
16913
  {
16805
16914
  type: "checkbox",
@@ -16808,10 +16917,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
16808
16917
  disabled: !editable
16809
16918
  }
16810
16919
  ),
16811
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Sensitive" })
16920
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Sensitive" })
16812
16921
  ] }),
16813
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
16814
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16922
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
16923
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16815
16924
  "input",
16816
16925
  {
16817
16926
  type: "checkbox",
@@ -16820,13 +16929,13 @@ function ModuleInterfaceContent({ settings, onSave }) {
16820
16929
  disabled: !editable
16821
16930
  }
16822
16931
  ),
16823
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Nullable" })
16932
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Nullable" })
16824
16933
  ] })
16825
16934
  ] }),
16826
- (v.validation.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-content", children: [
16827
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-subsection-label", children: "Validation" }),
16828
- v.validation.map((block, j) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-validation-block", children: [
16829
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16935
+ (v.validation.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "lace-panel-row-content", children: [
16936
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-subsection-label", children: "Validation" }),
16937
+ v.validation.map((block, j) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "lace-panel-validation-block", children: [
16938
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16830
16939
  import_ui12.Input,
16831
16940
  {
16832
16941
  value: block.condition,
@@ -16838,7 +16947,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
16838
16947
  readOnly: !editable
16839
16948
  }
16840
16949
  ),
16841
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16950
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16842
16951
  import_ui12.Input,
16843
16952
  {
16844
16953
  value: block.error_message,
@@ -16849,10 +16958,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
16849
16958
  readOnly: !editable
16850
16959
  }
16851
16960
  ),
16852
- editable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16961
+ editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16853
16962
  import_ui12.IconButton,
16854
16963
  {
16855
- icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CanvasIcon, { name: "close" }),
16964
+ icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CanvasIcon, { name: "close" }),
16856
16965
  "aria-label": "Remove validation rule",
16857
16966
  size: "md",
16858
16967
  tooltipPlacement: "bottom-end",
@@ -16860,15 +16969,15 @@ function ModuleInterfaceContent({ settings, onSave }) {
16860
16969
  }
16861
16970
  )
16862
16971
  ] }, block.id)),
16863
- editable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_ui12.Button, { variant: "secondary", size: "sm", onClick: () => addValidation(i), children: "+ Add validation rule" })
16972
+ editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_ui12.Button, { variant: "secondary", size: "sm", onClick: () => addValidation(i), children: "+ Add validation rule" })
16864
16973
  ] })
16865
16974
  ] }, v.id)),
16866
- editable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_ui12.Button, { variant: "secondary", size: "sm", onClick: addVariable, children: "+ Add variable" }),
16867
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h4", { className: "lace-panel-section-title", children: "Outputs" }),
16868
- outputs.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-hint", children: "No outputs." }),
16869
- outputs.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
16870
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-actions", children: [
16871
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16975
+ editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_ui12.Button, { variant: "secondary", size: "sm", onClick: addVariable, children: "+ Add variable" }),
16976
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h4", { className: "lace-panel-section-title", children: "Outputs" }),
16977
+ outputs.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-hint", children: "No outputs." }),
16978
+ outputs.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
16979
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "lace-panel-row-actions", children: [
16980
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16872
16981
  import_ui12.Input,
16873
16982
  {
16874
16983
  label: "Name",
@@ -16881,10 +16990,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
16881
16990
  error: outputDupes.has(i) || editable && !o.name.trim()
16882
16991
  }
16883
16992
  ),
16884
- editable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16993
+ editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16885
16994
  import_ui12.IconButton,
16886
16995
  {
16887
- icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CanvasIcon, { name: "close" }),
16996
+ icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CanvasIcon, { name: "close" }),
16888
16997
  "aria-label": `Remove output ${o.name}`,
16889
16998
  size: "md",
16890
16999
  tooltipPlacement: "bottom-end",
@@ -16892,7 +17001,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
16892
17001
  }
16893
17002
  )
16894
17003
  ] }),
16895
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
17004
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16896
17005
  import_ui12.Input,
16897
17006
  {
16898
17007
  label: "Value",
@@ -16905,7 +17014,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
16905
17014
  error: editable && !o.value.trim()
16906
17015
  }
16907
17016
  ) }),
16908
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
17017
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16909
17018
  import_ui12.Textarea,
16910
17019
  {
16911
17020
  label: "Description",
@@ -16917,8 +17026,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
16917
17026
  readOnly: !editable
16918
17027
  }
16919
17028
  ) }),
16920
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
16921
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
17029
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
17030
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16922
17031
  "input",
16923
17032
  {
16924
17033
  type: "checkbox",
@@ -16927,12 +17036,12 @@ function ModuleInterfaceContent({ settings, onSave }) {
16927
17036
  disabled: !editable
16928
17037
  }
16929
17038
  ),
16930
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Sensitive" })
17039
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Sensitive" })
16931
17040
  ] }),
16932
- (o.depends_on.length > 0 || editable && settings.dependency_options.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-content", children: [
16933
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-subsection-label", children: "Depends on" }),
16934
- !editable ? o.depends_on.map((dep) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Identifier, { text: dep }) }, dep)) : settings.dependency_options.map((dep) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
16935
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
17041
+ (o.depends_on.length > 0 || editable && settings.dependency_options.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "lace-panel-row-content", children: [
17042
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-subsection-label", children: "Depends on" }),
17043
+ !editable ? o.depends_on.map((dep) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Identifier, { text: dep }) }, dep)) : settings.dependency_options.map((dep) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
17044
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16936
17045
  "input",
16937
17046
  {
16938
17047
  type: "checkbox",
@@ -16940,14 +17049,14 @@ function ModuleInterfaceContent({ settings, onSave }) {
16940
17049
  onChange: () => toggleDependsOn(i, dep)
16941
17050
  }
16942
17051
  ),
16943
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Identifier, { text: dep })
17052
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Identifier, { text: dep })
16944
17053
  ] }, dep))
16945
17054
  ] }),
16946
- outputDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-row-error", children: "Output names must be unique." })
17055
+ outputDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-row-error", children: "Output names must be unique." })
16947
17056
  ] }, o.id)),
16948
- editable && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-actions", children: [
16949
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_ui12.Button, { variant: "secondary", size: "sm", onClick: () => addOutput("", ""), children: "+ Add output" }),
16950
- exposable.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
17057
+ editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "lace-panel-row-actions", children: [
17058
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_ui12.Button, { variant: "secondary", size: "sm", onClick: () => addOutput("", ""), children: "+ Add output" }),
17059
+ exposable.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16951
17060
  import_ui12.Select,
16952
17061
  {
16953
17062
  "aria-label": "Expose a call's output",
@@ -16963,7 +17072,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
16963
17072
  }
16964
17073
  )
16965
17074
  ] }),
16966
- editable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
17075
+ editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16967
17076
  UpdateButton,
16968
17077
  {
16969
17078
  status: updateStatus,
@@ -16976,7 +17085,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
16976
17085
  ] });
16977
17086
  }
16978
17087
  function ModuleInterfacePanel({ onClose, ...content }) {
16979
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_ui12.Panel, { title: "Module Interface", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ModuleInterfaceContent, { ...content }) });
17088
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_ui12.Panel, { title: "Module Interface", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ModuleInterfaceContent, { ...content }) });
16980
17089
  }
16981
17090
 
16982
17091
  // src/components/panels/module-actions.ts
@@ -17094,9 +17203,9 @@ var import_panels_shared7 = require("./panels-shared-5JFNYXQ7.css");
17094
17203
 
17095
17204
  // src/components/panels/ProvidersPanel.tsx
17096
17205
  var import_ui13 = require("@lace-cloud/ui");
17097
- var import_react34 = require("react");
17206
+ var import_react32 = require("react");
17098
17207
  var import_panels_shared4 = require("./panels-shared-5JFNYXQ7.css");
17099
- var import_jsx_runtime27 = require("react/jsx-runtime");
17208
+ var import_jsx_runtime28 = require("react/jsx-runtime");
17100
17209
  function toRows2(providers) {
17101
17210
  if (!providers || providers.length === 0) return [];
17102
17211
  return providers.map((p) => ({
@@ -17124,8 +17233,8 @@ function fromRows2(rows) {
17124
17233
  }
17125
17234
  function ProvidersContent({ providers, onSave }) {
17126
17235
  const { editable } = useCanvas();
17127
- const [rows, setRows] = (0, import_react34.useState)(() => toRows2(providers));
17128
- const addProvider = (0, import_react34.useCallback)(() => {
17236
+ const [rows, setRows] = (0, import_react32.useState)(() => toRows2(providers));
17237
+ const addProvider = (0, import_react32.useCallback)(() => {
17129
17238
  setRows((prev) => [
17130
17239
  ...prev,
17131
17240
  {
@@ -17137,16 +17246,16 @@ function ProvidersContent({ providers, onSave }) {
17137
17246
  }
17138
17247
  ]);
17139
17248
  }, []);
17140
- const removeProvider = (0, import_react34.useCallback)((index) => {
17249
+ const removeProvider = (0, import_react32.useCallback)((index) => {
17141
17250
  setRows((prev) => prev.filter((_, i) => i !== index));
17142
17251
  }, []);
17143
- const updateField = (0, import_react34.useCallback)((index, field, value) => {
17252
+ const updateField = (0, import_react32.useCallback)((index, field, value) => {
17144
17253
  setRows((prev) => prev.map((r, i) => i === index ? { ...r, [field]: value } : r));
17145
17254
  }, []);
17146
- const updateBlocks = (0, import_react34.useCallback)((index, blocks) => {
17255
+ const updateBlocks = (0, import_react32.useCallback)((index, blocks) => {
17147
17256
  setRows((prev) => prev.map((r, i) => i === index ? { ...r, blocks } : r));
17148
17257
  }, []);
17149
- const addConfigEntry = (0, import_react34.useCallback)((providerIndex) => {
17258
+ const addConfigEntry = (0, import_react32.useCallback)((providerIndex) => {
17150
17259
  setRows(
17151
17260
  (prev) => prev.map(
17152
17261
  (r, i) => i === providerIndex ? {
@@ -17156,14 +17265,14 @@ function ProvidersContent({ providers, onSave }) {
17156
17265
  )
17157
17266
  );
17158
17267
  }, []);
17159
- const removeConfigEntry = (0, import_react34.useCallback)((providerIndex, entryIndex) => {
17268
+ const removeConfigEntry = (0, import_react32.useCallback)((providerIndex, entryIndex) => {
17160
17269
  setRows(
17161
17270
  (prev) => prev.map(
17162
17271
  (r, i) => i === providerIndex ? { ...r, configEntries: r.configEntries.filter((_, ei) => ei !== entryIndex) } : r
17163
17272
  )
17164
17273
  );
17165
17274
  }, []);
17166
- const updateConfigEntry = (0, import_react34.useCallback)(
17275
+ const updateConfigEntry = (0, import_react32.useCallback)(
17167
17276
  (providerIndex, entryIndex, field, value) => {
17168
17277
  setRows(
17169
17278
  (prev) => prev.map(
@@ -17179,14 +17288,14 @@ function ProvidersContent({ providers, onSave }) {
17179
17288
  []
17180
17289
  );
17181
17290
  const { status: updateStatus, handleUpdate } = useUpdateState(
17182
- (0, import_react34.useCallback)(async () => {
17291
+ (0, import_react32.useCallback)(async () => {
17183
17292
  await onSave(fromRows2(rows));
17184
17293
  }, [onSave, rows])
17185
17294
  );
17186
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
17187
- rows.map((row, pi) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
17188
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "lace-panel-row-actions", children: [
17189
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
17295
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
17296
+ rows.map((row, pi) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
17297
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-actions", children: [
17298
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17190
17299
  import_ui13.Input,
17191
17300
  {
17192
17301
  value: row.name,
@@ -17196,7 +17305,7 @@ function ProvidersContent({ providers, onSave }) {
17196
17305
  readOnly: !editable
17197
17306
  }
17198
17307
  ),
17199
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
17308
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17200
17309
  import_ui13.Input,
17201
17310
  {
17202
17311
  value: row.alias,
@@ -17206,10 +17315,10 @@ function ProvidersContent({ providers, onSave }) {
17206
17315
  readOnly: !editable
17207
17316
  }
17208
17317
  ),
17209
- editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
17318
+ editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17210
17319
  import_ui13.IconButton,
17211
17320
  {
17212
- icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CanvasIcon, { name: "close" }),
17321
+ icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CanvasIcon, { name: "close" }),
17213
17322
  "aria-label": "Remove provider",
17214
17323
  size: "md",
17215
17324
  tooltipPlacement: "bottom-end",
@@ -17217,9 +17326,9 @@ function ProvidersContent({ providers, onSave }) {
17217
17326
  }
17218
17327
  )
17219
17328
  ] }),
17220
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-row-sublabel", children: "Config" }),
17221
- row.configEntries.map((entry, ei) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "lace-panel-row-actions", children: [
17222
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
17329
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "lace-panel-row-sublabel", children: "Config" }),
17330
+ row.configEntries.map((entry, ei) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-actions", children: [
17331
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17223
17332
  import_ui13.Input,
17224
17333
  {
17225
17334
  value: entry.key,
@@ -17229,7 +17338,7 @@ function ProvidersContent({ providers, onSave }) {
17229
17338
  readOnly: !editable
17230
17339
  }
17231
17340
  ),
17232
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
17341
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17233
17342
  import_ui13.Input,
17234
17343
  {
17235
17344
  value: entry.value,
@@ -17239,10 +17348,10 @@ function ProvidersContent({ providers, onSave }) {
17239
17348
  readOnly: !editable
17240
17349
  }
17241
17350
  ),
17242
- editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
17351
+ editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17243
17352
  import_ui13.IconButton,
17244
17353
  {
17245
- icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CanvasIcon, { name: "close" }),
17354
+ icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CanvasIcon, { name: "close" }),
17246
17355
  "aria-label": "Remove config key",
17247
17356
  size: "md",
17248
17357
  tooltipPlacement: "bottom-end",
@@ -17250,10 +17359,10 @@ function ProvidersContent({ providers, onSave }) {
17250
17359
  }
17251
17360
  )
17252
17361
  ] }, entry.id)),
17253
- editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_ui13.Button, { variant: "secondary", size: "sm", onClick: () => addConfigEntry(pi), children: "+ Add config key" }),
17254
- (row.blocks.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
17255
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
17256
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
17362
+ editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_ui13.Button, { variant: "secondary", size: "sm", onClick: () => addConfigEntry(pi), children: "+ Add config key" }),
17363
+ (row.blocks.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
17364
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
17365
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17257
17366
  BlockEditor,
17258
17367
  {
17259
17368
  blocks: row.blocks,
@@ -17263,21 +17372,21 @@ function ProvidersContent({ providers, onSave }) {
17263
17372
  )
17264
17373
  ] })
17265
17374
  ] }, row.id)),
17266
- editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
17267
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_ui13.Button, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
17268
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(UpdateButton, { status: updateStatus, label: "Update providers", onClick: handleUpdate })
17375
+ editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
17376
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_ui13.Button, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
17377
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(UpdateButton, { status: updateStatus, label: "Update providers", onClick: handleUpdate })
17269
17378
  ] })
17270
17379
  ] });
17271
17380
  }
17272
17381
  function ProvidersPanel({ providers, onSave, onClose }) {
17273
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_ui13.Panel, { title: "Providers", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ProvidersContent, { providers, onSave }) });
17382
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_ui13.Panel, { title: "Providers", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ProvidersContent, { providers, onSave }) });
17274
17383
  }
17275
17384
 
17276
17385
  // src/components/panels/ResourcesPanel.tsx
17277
17386
  var import_ui14 = require("@lace-cloud/ui");
17278
- var import_react35 = require("react");
17387
+ var import_react33 = require("react");
17279
17388
  var import_panels_shared5 = require("./panels-shared-5JFNYXQ7.css");
17280
- var import_jsx_runtime28 = require("react/jsx-runtime");
17389
+ var import_jsx_runtime29 = require("react/jsx-runtime");
17281
17390
  function ResourcesContent({
17282
17391
  resources,
17283
17392
  dependencyOptions,
@@ -17287,9 +17396,9 @@ function ResourcesContent({
17287
17396
  onAdd
17288
17397
  }) {
17289
17398
  const { editable } = useCanvas();
17290
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
17291
- resources.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "lace-panel-hint", children: "No resources or data sources." }),
17292
- resources.map((resource) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17399
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
17400
+ resources.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-hint", children: "No resources or data sources." }),
17401
+ resources.map((resource) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17293
17402
  ResourceCard,
17294
17403
  {
17295
17404
  resource,
@@ -17302,7 +17411,7 @@ function ResourcesContent({
17302
17411
  },
17303
17412
  JSON.stringify(resource)
17304
17413
  )),
17305
- editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(NewResourceRow, { managed, onAdd })
17414
+ editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(NewResourceRow, { managed, onAdd })
17306
17415
  ] });
17307
17416
  }
17308
17417
  var MANAGED_OPTION = { value: "resource", label: "Resource" };
@@ -17312,14 +17421,14 @@ function NewResourceRow({
17312
17421
  onAdd
17313
17422
  }) {
17314
17423
  const options = managed ? [MANAGED_OPTION, DATA_OPTION] : [DATA_OPTION];
17315
- const [chosen, setChosen] = (0, import_react35.useState)("resource");
17424
+ const [chosen, setChosen] = (0, import_react33.useState)("resource");
17316
17425
  const kind = managed ? chosen : "data";
17317
- const [type, setType] = (0, import_react35.useState)("");
17318
- const [name, setName] = (0, import_react35.useState)("");
17319
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-card", children: [
17320
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "lace-panel-subsection-label", children: "Add a resource" }),
17321
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-actions", children: [
17322
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17426
+ const [type, setType] = (0, import_react33.useState)("");
17427
+ const [name, setName] = (0, import_react33.useState)("");
17428
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "lace-panel-row-card", children: [
17429
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-subsection-label", children: "Add a resource" }),
17430
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "lace-panel-row-actions", children: [
17431
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17323
17432
  import_ui14.Select,
17324
17433
  {
17325
17434
  "aria-label": "New resource kind",
@@ -17328,7 +17437,7 @@ function NewResourceRow({
17328
17437
  onChange: (e) => setChosen(e.target.value === "data" ? "data" : "resource")
17329
17438
  }
17330
17439
  ),
17331
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17440
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17332
17441
  import_ui14.Input,
17333
17442
  {
17334
17443
  value: type,
@@ -17338,7 +17447,7 @@ function NewResourceRow({
17338
17447
  mono: true
17339
17448
  }
17340
17449
  ),
17341
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17450
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17342
17451
  import_ui14.Input,
17343
17452
  {
17344
17453
  value: name,
@@ -17348,7 +17457,7 @@ function NewResourceRow({
17348
17457
  mono: true
17349
17458
  }
17350
17459
  ),
17351
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17460
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17352
17461
  import_ui14.Button,
17353
17462
  {
17354
17463
  variant: "secondary",
@@ -17366,8 +17475,8 @@ function NewResourceRow({
17366
17475
  ] });
17367
17476
  }
17368
17477
  function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemove }) {
17369
- const [draft, setDraft] = (0, import_react35.useState)(resource);
17370
- const set = (0, import_react35.useCallback)(
17478
+ const [draft, setDraft] = (0, import_react33.useState)(resource);
17479
+ const set = (0, import_react33.useCallback)(
17371
17480
  (field, value) => setDraft((prev) => ({ ...prev, [field]: value })),
17372
17481
  []
17373
17482
  );
@@ -17378,7 +17487,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17378
17487
  const argumentDupes = findDuplicateIndices(draft.arguments, (a) => a.name);
17379
17488
  const hasErrors = argumentDupes.size > 0 || draft.arguments.some((a) => !a.name.trim());
17380
17489
  const { status, handleUpdate } = useUpdateState(
17381
- (0, import_react35.useCallback)(async () => {
17490
+ (0, import_react33.useCallback)(async () => {
17382
17491
  if (hasErrors) return;
17383
17492
  await onUpdate(resource, draft);
17384
17493
  }, [onUpdate, resource, draft, hasErrors])
@@ -17388,20 +17497,20 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17388
17497
  { field: "for_each", placeholder: "e.g. var.names" },
17389
17498
  { field: "provider", placeholder: "e.g. aws.west" }
17390
17499
  ];
17391
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
17392
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-actions", children: [
17393
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_ui14.Badge, { variant: resource.kind === "data" ? "info" : "neutral", children: resource.kind === "data" ? "data" : "resource" }),
17394
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17500
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
17501
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "lace-panel-row-actions", children: [
17502
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_ui14.Badge, { variant: resource.kind === "data" ? "info" : "neutral", children: resource.kind === "data" ? "data" : "resource" }),
17503
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17395
17504
  Identifier,
17396
17505
  {
17397
17506
  className: "lace-panel-row-card__name",
17398
17507
  text: `${resource.type}.${resource.name}`
17399
17508
  }
17400
17509
  ),
17401
- editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17510
+ editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17402
17511
  import_ui14.IconButton,
17403
17512
  {
17404
- icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CanvasIcon, { name: "close" }),
17513
+ icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CanvasIcon, { name: "close" }),
17405
17514
  "aria-label": `Remove ${resource.type}.${resource.name}`,
17406
17515
  size: "md",
17407
17516
  tooltipPlacement: "bottom-end",
@@ -17410,7 +17519,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17410
17519
  )
17411
17520
  ] }),
17412
17521
  metaArguments.map(
17413
- ({ field, placeholder }) => draft[field] || editable ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17522
+ ({ field, placeholder }) => draft[field] || editable ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17414
17523
  import_ui14.Input,
17415
17524
  {
17416
17525
  label: field,
@@ -17423,11 +17532,11 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17423
17532
  }
17424
17533
  ) }, field) : null
17425
17534
  ),
17426
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "lace-panel-row-sublabel", children: "Arguments" }),
17535
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-row-sublabel", children: "Arguments" }),
17427
17536
  draft.arguments.map((argument, i) => (
17428
17537
  // biome-ignore lint/suspicious/noArrayIndexKey: argument rows are positional while edited
17429
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-actions", children: [
17430
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17538
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "lace-panel-row-actions", children: [
17539
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17431
17540
  import_ui14.Input,
17432
17541
  {
17433
17542
  value: argument.name,
@@ -17439,7 +17548,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17439
17548
  error: argumentDupes.has(i)
17440
17549
  }
17441
17550
  ),
17442
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17551
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17443
17552
  import_ui14.Input,
17444
17553
  {
17445
17554
  value: argument.value,
@@ -17450,10 +17559,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17450
17559
  readOnly: !editable
17451
17560
  }
17452
17561
  ),
17453
- editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17562
+ editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17454
17563
  import_ui14.IconButton,
17455
17564
  {
17456
- icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CanvasIcon, { name: "close" }),
17565
+ icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CanvasIcon, { name: "close" }),
17457
17566
  "aria-label": `Remove ${argument.name || "the argument"}`,
17458
17567
  size: "md",
17459
17568
  tooltipPlacement: "bottom-end",
@@ -17465,7 +17574,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17465
17574
  )
17466
17575
  ] }, i)
17467
17576
  )),
17468
- editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17577
+ editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17469
17578
  import_ui14.Button,
17470
17579
  {
17471
17580
  variant: "secondary",
@@ -17474,9 +17583,9 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17474
17583
  children: "+ Add argument"
17475
17584
  }
17476
17585
  ),
17477
- (draft.blocks.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
17478
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
17479
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17586
+ (draft.blocks.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
17587
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
17588
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17480
17589
  BlockEditor,
17481
17590
  {
17482
17591
  blocks: draft.blocks,
@@ -17485,10 +17594,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17485
17594
  }
17486
17595
  )
17487
17596
  ] }),
17488
- (draft.depends_on.length > 0 || editable && dependencyOptions.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
17489
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "lace-panel-row-sublabel", children: "Depends on" }),
17490
- !editable ? draft.depends_on.map((dep) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Identifier, { text: dep }) }, dep)) : dependencyOptions.map((dep) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
17491
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17597
+ (draft.depends_on.length > 0 || editable && dependencyOptions.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
17598
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-row-sublabel", children: "Depends on" }),
17599
+ !editable ? draft.depends_on.map((dep) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Identifier, { text: dep }) }, dep)) : dependencyOptions.map((dep) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
17600
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17492
17601
  "input",
17493
17602
  {
17494
17603
  type: "checkbox",
@@ -17499,10 +17608,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17499
17608
  )
17500
17609
  }
17501
17610
  ),
17502
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Identifier, { text: dep })
17611
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Identifier, { text: dep })
17503
17612
  ] }, dep))
17504
17613
  ] }),
17505
- editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17614
+ editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17506
17615
  UpdateButton,
17507
17616
  {
17508
17617
  status,
@@ -17517,13 +17626,13 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17517
17626
 
17518
17627
  // src/components/panels/TerraformConfigPanel.tsx
17519
17628
  var import_ui15 = require("@lace-cloud/ui");
17520
- var import_react36 = require("react");
17629
+ var import_react34 = require("react");
17521
17630
  var import_panels_shared6 = require("./panels-shared-5JFNYXQ7.css");
17522
- var import_jsx_runtime29 = require("react/jsx-runtime");
17631
+ var import_jsx_runtime30 = require("react/jsx-runtime");
17523
17632
  function TerraformConfigContent({ terraform, onSave }) {
17524
17633
  const { editable } = useCanvas();
17525
- const [requiredVersion, setRequiredVersion] = (0, import_react36.useState)(terraform?.required_version ?? "");
17526
- const [providers, setProviders2] = (0, import_react36.useState)(() => {
17634
+ const [requiredVersion, setRequiredVersion] = (0, import_react34.useState)(terraform?.required_version ?? "");
17635
+ const [providers, setProviders2] = (0, import_react34.useState)(() => {
17527
17636
  if (!terraform?.required_providers) return [];
17528
17637
  return terraform.required_providers.map((req) => ({
17529
17638
  id: crypto.randomUUID(),
@@ -17533,23 +17642,23 @@ function TerraformConfigContent({ terraform, onSave }) {
17533
17642
  aliases: (req.configuration_aliases ?? []).join(", ")
17534
17643
  }));
17535
17644
  });
17536
- const addProvider = (0, import_react36.useCallback)(() => {
17645
+ const addProvider = (0, import_react34.useCallback)(() => {
17537
17646
  setProviders2((prev) => [
17538
17647
  ...prev,
17539
17648
  { id: crypto.randomUUID(), name: "", source: "", version: "", aliases: "" }
17540
17649
  ]);
17541
17650
  }, []);
17542
- const removeProvider = (0, import_react36.useCallback)((index) => {
17651
+ const removeProvider = (0, import_react34.useCallback)((index) => {
17543
17652
  setProviders2((prev) => prev.filter((_, i) => i !== index));
17544
17653
  }, []);
17545
- const updateProvider = (0, import_react36.useCallback)(
17654
+ const updateProvider = (0, import_react34.useCallback)(
17546
17655
  (index, field, value) => {
17547
17656
  setProviders2((prev) => prev.map((p, i) => i === index ? { ...p, [field]: value } : p));
17548
17657
  },
17549
17658
  []
17550
17659
  );
17551
17660
  const { status: updateStatus, handleUpdate } = useUpdateState(
17552
- (0, import_react36.useCallback)(async () => {
17661
+ (0, import_react34.useCallback)(async () => {
17553
17662
  const block = {
17554
17663
  required_version: requiredVersion.trim() || "",
17555
17664
  required_providers: providers.filter((p) => p.name.trim()).map((p) => ({
@@ -17562,9 +17671,9 @@ function TerraformConfigContent({ terraform, onSave }) {
17562
17671
  await onSave(block);
17563
17672
  }, [onSave, requiredVersion, providers])
17564
17673
  );
17565
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
17566
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h4", { className: "lace-panel-section-title", children: "Required Version" }),
17567
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17674
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
17675
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h4", { className: "lace-panel-section-title", children: "Required Version" }),
17676
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-field", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17568
17677
  import_ui15.Input,
17569
17678
  {
17570
17679
  value: requiredVersion,
@@ -17574,10 +17683,10 @@ function TerraformConfigContent({ terraform, onSave }) {
17574
17683
  readOnly: !editable
17575
17684
  }
17576
17685
  ) }),
17577
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h4", { className: "lace-panel-section-title", children: "Required Providers" }),
17578
- providers.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
17579
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "lace-panel-row-actions", children: [
17580
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17686
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h4", { className: "lace-panel-section-title", children: "Required Providers" }),
17687
+ providers.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
17688
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-actions", children: [
17689
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17581
17690
  import_ui15.Input,
17582
17691
  {
17583
17692
  value: p.name,
@@ -17587,10 +17696,10 @@ function TerraformConfigContent({ terraform, onSave }) {
17587
17696
  readOnly: !editable
17588
17697
  }
17589
17698
  ),
17590
- editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17699
+ editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17591
17700
  import_ui15.IconButton,
17592
17701
  {
17593
- icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CanvasIcon, { name: "close" }),
17702
+ icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CanvasIcon, { name: "close" }),
17594
17703
  "aria-label": "Remove provider",
17595
17704
  size: "md",
17596
17705
  tooltipPlacement: "bottom-end",
@@ -17598,7 +17707,7 @@ function TerraformConfigContent({ terraform, onSave }) {
17598
17707
  }
17599
17708
  )
17600
17709
  ] }),
17601
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17710
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17602
17711
  import_ui15.Input,
17603
17712
  {
17604
17713
  value: p.source,
@@ -17608,7 +17717,7 @@ function TerraformConfigContent({ terraform, onSave }) {
17608
17717
  readOnly: !editable
17609
17718
  }
17610
17719
  ) }),
17611
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17720
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17612
17721
  import_ui15.Input,
17613
17722
  {
17614
17723
  value: p.version,
@@ -17618,7 +17727,7 @@ function TerraformConfigContent({ terraform, onSave }) {
17618
17727
  readOnly: !editable
17619
17728
  }
17620
17729
  ) }),
17621
- (p.aliases || editable) && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17730
+ (p.aliases || editable) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17622
17731
  import_ui15.Input,
17623
17732
  {
17624
17733
  value: p.aliases,
@@ -17631,39 +17740,39 @@ function TerraformConfigContent({ terraform, onSave }) {
17631
17740
  }
17632
17741
  ) })
17633
17742
  ] }, p.id)),
17634
- editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_ui15.Button, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
17635
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h4", { className: "lace-panel-section-title", children: "Backend" }),
17636
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-hint", children: "Terraform state is managed by Lace Cloud. The HTTP backend is configured automatically during generation." }),
17637
- editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(UpdateButton, { status: updateStatus, label: "Update terraform block", onClick: handleUpdate })
17743
+ editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_ui15.Button, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
17744
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h4", { className: "lace-panel-section-title", children: "Backend" }),
17745
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-hint", children: "Terraform state is managed by Lace Cloud. The HTTP backend is configured automatically during generation." }),
17746
+ editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(UpdateButton, { status: updateStatus, label: "Update terraform block", onClick: handleUpdate })
17638
17747
  ] });
17639
17748
  }
17640
17749
  function TerraformConfigPanel({ terraform, onSave, onClose }) {
17641
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_ui15.Panel, { title: "Terraform Configuration", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TerraformConfigContent, { terraform, onSave }) });
17750
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_ui15.Panel, { title: "Terraform Configuration", onClose, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TerraformConfigContent, { terraform, onSave }) });
17642
17751
  }
17643
17752
 
17644
17753
  // src/components/panels/ModuleDetails.tsx
17645
- var import_jsx_runtime30 = require("react/jsx-runtime");
17754
+ var import_jsx_runtime31 = require("react/jsx-runtime");
17646
17755
  function assertApplied(result) {
17647
17756
  if (!result?.success) throw new Error("apply failed");
17648
17757
  }
17649
17758
  var keyOf = (value) => JSON.stringify(value);
17650
17759
  function ModuleDetails({ moduleKey, open = [] }) {
17651
17760
  const { bundle, runner, editable } = useCanvas();
17652
- const settings = (0, import_react37.useMemo)(() => (0, import_proto11.deriveSettingsConfig)(bundle, moduleKey), [bundle, moduleKey]);
17761
+ const settings = (0, import_react35.useMemo)(() => (0, import_proto11.deriveSettingsConfig)(bundle, moduleKey), [bundle, moduleKey]);
17653
17762
  if (!settings) return null;
17654
- if (settings.reference) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ReferenceDetails, { settings });
17763
+ if (settings.reference) return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ReferenceDetails, { settings });
17655
17764
  const apply2 = async (actions) => {
17656
17765
  if (!editable) return;
17657
17766
  assertApplied(await runner.apply(actions));
17658
17767
  };
17659
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
17660
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17768
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
17769
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
17661
17770
  AccordionSection,
17662
17771
  {
17663
17772
  title: "Resources",
17664
17773
  defaultOpen: open.includes("Resources"),
17665
17774
  badge: `(${settings.resources.length})`,
17666
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17775
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
17667
17776
  ResourcesContent,
17668
17777
  {
17669
17778
  resources: settings.resources,
@@ -17676,7 +17785,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
17676
17785
  )
17677
17786
  }
17678
17787
  ),
17679
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AccordionSection, { title: "Interface", defaultOpen: open.includes("Interface"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17788
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AccordionSection, { title: "Interface", defaultOpen: open.includes("Interface"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
17680
17789
  ModuleInterfaceContent,
17681
17790
  {
17682
17791
  settings,
@@ -17684,13 +17793,13 @@ function ModuleDetails({ moduleKey, open = [] }) {
17684
17793
  },
17685
17794
  keyOf([settings.variables, settings.outputs, settings.call_outputs])
17686
17795
  ) }),
17687
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17796
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
17688
17797
  AccordionSection,
17689
17798
  {
17690
17799
  title: "Moved and import blocks",
17691
17800
  defaultOpen: open.includes("Moved and import blocks"),
17692
17801
  badge: settings.directives.length > 0 ? `(${settings.directives.length})` : void 0,
17693
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17802
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
17694
17803
  DirectivesContent,
17695
17804
  {
17696
17805
  directives: settings.directives,
@@ -17700,7 +17809,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
17700
17809
  )
17701
17810
  }
17702
17811
  ),
17703
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AccordionSection, { title: "Locals", defaultOpen: open.includes("Locals"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17812
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AccordionSection, { title: "Locals", defaultOpen: open.includes("Locals"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
17704
17813
  LocalsContent,
17705
17814
  {
17706
17815
  locals: settings.locals,
@@ -17708,7 +17817,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
17708
17817
  },
17709
17818
  keyOf(settings.locals)
17710
17819
  ) }),
17711
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AccordionSection, { title: "Providers", defaultOpen: open.includes("Providers"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17820
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AccordionSection, { title: "Providers", defaultOpen: open.includes("Providers"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
17712
17821
  ProvidersContent,
17713
17822
  {
17714
17823
  providers: settings.providers,
@@ -17716,7 +17825,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
17716
17825
  },
17717
17826
  keyOf(settings.providers)
17718
17827
  ) }),
17719
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AccordionSection, { title: "Terraform Config", defaultOpen: open.includes("Terraform Config"), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17828
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AccordionSection, { title: "Terraform Config", defaultOpen: open.includes("Terraform Config"), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
17720
17829
  TerraformConfigContent,
17721
17830
  {
17722
17831
  terraform: settings.terraform,
@@ -17731,11 +17840,11 @@ function DirectivesContent({
17731
17840
  onSave
17732
17841
  }) {
17733
17842
  const { editable } = useCanvas();
17734
- const [blocks, setBlocks] = (0, import_react37.useState)(directives);
17843
+ const [blocks, setBlocks] = (0, import_react35.useState)(directives);
17735
17844
  const { status, handleUpdate } = useUpdateState(() => onSave(blocks));
17736
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
17737
- blocks.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-hint", children: "No moved or import blocks." }),
17738
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17845
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
17846
+ blocks.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-panel-hint", children: "No moved or import blocks." }),
17847
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
17739
17848
  BlockEditor,
17740
17849
  {
17741
17850
  blocks,
@@ -17747,7 +17856,7 @@ function DirectivesContent({
17747
17856
  ]
17748
17857
  }
17749
17858
  ),
17750
- editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17859
+ editable && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
17751
17860
  UpdateButton,
17752
17861
  {
17753
17862
  status,
@@ -17760,26 +17869,26 @@ function DirectivesContent({
17760
17869
  function ReferenceDetails({ settings }) {
17761
17870
  const reference = settings.reference;
17762
17871
  if (!reference) return null;
17763
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
17764
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(AccordionSection, { title: "Source", defaultOpen: true, children: [
17765
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-hint", children: "A reference: Lace reads it where its source points and never edits it." }),
17766
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--stacked", children: [
17767
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_ui16.Input, { label: "Source", value: reference.source, fullWidth: true, mono: true, readOnly: true }),
17768
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_ui16.Input, { label: "Version", value: reference.version, fullWidth: true, mono: true, readOnly: true })
17872
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
17873
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(AccordionSection, { title: "Source", defaultOpen: true, children: [
17874
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-panel-hint", children: "A reference: Lace reads it where its source points and never edits it." }),
17875
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--stacked", children: [
17876
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_ui16.Input, { label: "Source", value: reference.source, fullWidth: true, mono: true, readOnly: true }),
17877
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_ui16.Input, { label: "Version", value: reference.version, fullWidth: true, mono: true, readOnly: true })
17769
17878
  ] })
17770
17879
  ] }),
17771
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(AccordionSection, { title: "Interface", defaultOpen: true, children: [
17772
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h4", { className: "lace-panel-section-title", children: "Inputs" }),
17773
- settings.variables.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-hint", children: "The IR holds no interface for this reference." }),
17774
- settings.variables.map((v) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Identifier, { text: `${typedName(v.name, v.type)}${v.required ? " (required)" : ""}` }) }, v.name)),
17775
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h4", { className: "lace-panel-section-title", children: "Outputs" }),
17776
- settings.outputs.map((o) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Identifier, { text: typedName(o.name, o.type) }) }, o.name))
17880
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(AccordionSection, { title: "Interface", defaultOpen: true, children: [
17881
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("h4", { className: "lace-panel-section-title", children: "Inputs" }),
17882
+ settings.variables.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-panel-hint", children: "The IR holds no interface for this reference." }),
17883
+ settings.variables.map((v) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Identifier, { text: `${typedName(v.name, v.type)}${v.required ? " (required)" : ""}` }) }, v.name)),
17884
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("h4", { className: "lace-panel-section-title", children: "Outputs" }),
17885
+ settings.outputs.map((o) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Identifier, { text: typedName(o.name, o.type) }) }, o.name))
17777
17886
  ] })
17778
17887
  ] });
17779
17888
  }
17780
17889
 
17781
17890
  // src/components/panels/ModuleConfigPanel.tsx
17782
- var import_jsx_runtime31 = require("react/jsx-runtime");
17891
+ var import_jsx_runtime32 = require("react/jsx-runtime");
17783
17892
  var MODE_ITEMS = [
17784
17893
  { value: "literal", label: "Lit" },
17785
17894
  { value: "variable", label: "Var" },
@@ -17804,11 +17913,11 @@ function toInputMode(mode) {
17804
17913
  }
17805
17914
  function ModuleConfigPanel({ instance_id, onClose, onModified }) {
17806
17915
  const { editable, bundle, runner } = useCanvas();
17807
- const config = (0, import_react38.useMemo)(
17916
+ const config = (0, import_react36.useMemo)(
17808
17917
  () => (0, import_proto12.deriveNodeConfig)(bundle, instance_id),
17809
17918
  [bundle, instance_id]
17810
17919
  );
17811
- const [inputState, setInputState] = (0, import_react38.useState)({
17920
+ const [inputState, setInputState] = (0, import_react36.useState)({
17812
17921
  modes: {},
17813
17922
  values: {},
17814
17923
  variables: {},
@@ -17820,26 +17929,26 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
17820
17929
  variables: localVariables,
17821
17930
  expressions: localExpressions
17822
17931
  } = inputState;
17823
- const setLocalModes = (0, import_react38.useCallback)(
17932
+ const setLocalModes = (0, import_react36.useCallback)(
17824
17933
  (fn) => setInputState((s) => ({ ...s, modes: fn(s.modes) })),
17825
17934
  []
17826
17935
  );
17827
- const setLocalValues = (0, import_react38.useCallback)(
17936
+ const setLocalValues = (0, import_react36.useCallback)(
17828
17937
  (fn) => setInputState((s) => ({ ...s, values: fn(s.values) })),
17829
17938
  []
17830
17939
  );
17831
- const setLocalVariables = (0, import_react38.useCallback)(
17940
+ const setLocalVariables = (0, import_react36.useCallback)(
17832
17941
  (fn) => setInputState((s) => ({ ...s, variables: fn(s.variables) })),
17833
17942
  []
17834
17943
  );
17835
- const setLocalExpressions = (0, import_react38.useCallback)(
17944
+ const setLocalExpressions = (0, import_react36.useCallback)(
17836
17945
  (fn) => setInputState((s) => ({ ...s, expressions: fn(s.expressions) })),
17837
17946
  []
17838
17947
  );
17839
- const [localDependsOn, setLocalDependsOn] = (0, import_react38.useState)(/* @__PURE__ */ new Set());
17840
- const [localProviders, setLocalProviders] = (0, import_react38.useState)([]);
17841
- const [localRepetition, setLocalRepetition] = (0, import_react38.useState)({ count: "", for_each: "" });
17842
- (0, import_react38.useEffect)(() => {
17948
+ const [localDependsOn, setLocalDependsOn] = (0, import_react36.useState)(/* @__PURE__ */ new Set());
17949
+ const [localProviders, setLocalProviders] = (0, import_react36.useState)([]);
17950
+ const [localRepetition, setLocalRepetition] = (0, import_react36.useState)({ count: "", for_each: "" });
17951
+ (0, import_react36.useEffect)(() => {
17843
17952
  if (!config) return;
17844
17953
  const modes = {};
17845
17954
  const values = {};
@@ -17858,7 +17967,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
17858
17967
  );
17859
17968
  setLocalRepetition({ count: config.count, for_each: config.for_each });
17860
17969
  }, [config]);
17861
- const switchMode = (0, import_react38.useCallback)(
17970
+ const switchMode = (0, import_react36.useCallback)(
17862
17971
  (name, mode, input) => {
17863
17972
  setLocalModes((prev) => ({ ...prev, [name]: mode }));
17864
17973
  switch (mode) {
@@ -17886,14 +17995,14 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
17886
17995
  },
17887
17996
  [setLocalModes, setLocalValues, setLocalVariables, setLocalExpressions]
17888
17997
  );
17889
- const { requiredInputs, optionalInputs } = (0, import_react38.useMemo)(
17998
+ const { requiredInputs, optionalInputs } = (0, import_react36.useMemo)(
17890
17999
  () => ({
17891
18000
  requiredInputs: (config?.inputs ?? []).filter((i) => i.required),
17892
18001
  optionalInputs: (config?.inputs ?? []).filter((i) => !i.required)
17893
18002
  }),
17894
18003
  [config?.inputs]
17895
18004
  );
17896
- const address = (0, import_react38.useMemo)(() => (0, import_proto12.instanceAddress)(bundle, instance_id), [bundle, instance_id]);
18005
+ const address = (0, import_react36.useMemo)(() => (0, import_proto12.instanceAddress)(bundle, instance_id), [bundle, instance_id]);
17897
18006
  const { status: updateStatus, handleUpdate } = useUpdateState(async () => {
17898
18007
  if (!config || !editable) return;
17899
18008
  const actions = [];
@@ -17980,7 +18089,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
17980
18089
  ...m,
17981
18090
  disabled: !editable || m.value === "wired" || isWired
17982
18091
  }));
17983
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18092
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
17984
18093
  import_ui17.ModeToggle,
17985
18094
  {
17986
18095
  value: currentMode,
@@ -17992,29 +18101,29 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
17992
18101
  }
17993
18102
  function renderInputField(input) {
17994
18103
  const currentMode = localModes[input.name] ?? input.mode;
17995
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-panel-field", children: [
17996
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "lace-panel-row-label", children: [
17997
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Identifier, { text: input.name }),
17998
- input.required && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "lace-mcp__required-star", children: "*" })
18104
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-panel-field", children: [
18105
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "lace-panel-row-label", children: [
18106
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Identifier, { text: input.name }),
18107
+ input.required && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "lace-mcp__required-star", children: "*" })
17999
18108
  ] }),
18000
18109
  renderModeSelector(input),
18001
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-panel-row-content", children: [
18110
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-panel-row-content", children: [
18002
18111
  currentMode === "wired" && renderWiredEditor(input),
18003
18112
  currentMode === "variable" && renderVariableEditor(input),
18004
18113
  currentMode === "expression" && renderExpressionEditor(input),
18005
18114
  currentMode === "literal" && renderLiteralEditor(input)
18006
18115
  ] }),
18007
- input.description && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-panel-field__description", children: input.description })
18116
+ input.description && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-panel-field__description", children: input.description })
18008
18117
  ] }, input.name);
18009
18118
  }
18010
18119
  function renderWiredEditor(input) {
18011
18120
  const label = input.wired_source ?? "Not wired";
18012
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-mcp__wired-row", children: [
18013
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-mcp__wired-input", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_ui17.Input, { value: label, readOnly: true, fullWidth: true, mono: true }) }),
18014
- editable && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18121
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-mcp__wired-row", children: [
18122
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-mcp__wired-input", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_ui17.Input, { value: label, readOnly: true, fullWidth: true, mono: true }) }),
18123
+ editable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18015
18124
  import_ui17.IconButton,
18016
18125
  {
18017
- icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CanvasIcon, { name: "close" }),
18126
+ icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CanvasIcon, { name: "close" }),
18018
18127
  "aria-label": "Disconnect this input",
18019
18128
  size: "md",
18020
18129
  tooltipPlacement: "bottom-end",
@@ -18025,7 +18134,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18025
18134
  }
18026
18135
  function renderVariableEditor(input) {
18027
18136
  const currentVar = localVariables[input.name] ?? input.variable ?? "";
18028
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18137
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18029
18138
  import_ui17.Input,
18030
18139
  {
18031
18140
  value: currentVar,
@@ -18043,7 +18152,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18043
18152
  }
18044
18153
  function renderExpressionEditor(input) {
18045
18154
  const currentExpr = localExpressions[input.name] ?? input.expression ?? "";
18046
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18155
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18047
18156
  import_ui17.Textarea,
18048
18157
  {
18049
18158
  value: currentExpr,
@@ -18063,7 +18172,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18063
18172
  setLocalValues((prev) => ({ ...prev, [input.name]: val }));
18064
18173
  };
18065
18174
  if (type === "bool") {
18066
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
18175
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
18067
18176
  "select",
18068
18177
  {
18069
18178
  className: "lace-mcp__select",
@@ -18071,14 +18180,14 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18071
18180
  onChange: (e) => updateValue(e.target.value === "true"),
18072
18181
  disabled: !editable,
18073
18182
  children: [
18074
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "true", children: "True" }),
18075
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "false", children: "False" })
18183
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "true", children: "True" }),
18184
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("option", { value: "false", children: "False" })
18076
18185
  ]
18077
18186
  }
18078
18187
  );
18079
18188
  }
18080
18189
  if (type === "number") {
18081
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18190
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18082
18191
  import_ui17.Input,
18083
18192
  {
18084
18193
  type: "number",
@@ -18091,7 +18200,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18091
18200
  }
18092
18201
  if (type.startsWith("list(") || type.startsWith("map(") || type.startsWith("set(") || type === "object" || type.startsWith("object(")) {
18093
18202
  const jsonStr = typeof value === "string" ? value : JSON.stringify(value ?? null, null, 2);
18094
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18203
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18095
18204
  import_ui17.Textarea,
18096
18205
  {
18097
18206
  value: jsonStr,
@@ -18109,7 +18218,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18109
18218
  }
18110
18219
  );
18111
18220
  }
18112
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18221
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18113
18222
  import_ui17.Input,
18114
18223
  {
18115
18224
  value: String(value ?? ""),
@@ -18126,35 +18235,35 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18126
18235
  );
18127
18236
  }
18128
18237
  if (!config) {
18129
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_ui17.Panel, { title: "Error", onClose, children: [
18130
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-mcp__error-title", children: [
18238
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_ui17.Panel, { title: "Error", onClose, children: [
18239
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-mcp__error-title", children: [
18131
18240
  'Failed to load configuration for "',
18132
18241
  instance_id,
18133
18242
  '":'
18134
18243
  ] }),
18135
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-mcp__error-detail", children: "Instance not found in the current Bundle." })
18244
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-mcp__error-detail", children: "Instance not found in the current Bundle." })
18136
18245
  ] });
18137
18246
  }
18138
18247
  const dependsOnCount = localDependsOn.size;
18139
- const title = /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-mcp__title", children: [
18140
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-mcp__title-eyebrow", children: "Module" }),
18141
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("h3", { className: "lace-mcp__title-id", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Identifier, { text: instance_id }) })
18248
+ const title = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-mcp__title", children: [
18249
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-mcp__title-eyebrow", children: "Module" }),
18250
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("h3", { className: "lace-mcp__title-id", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Identifier, { text: instance_id }) })
18142
18251
  ] });
18143
- const footer = editable ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(UpdateButton, { status: updateStatus, label: "Update configuration", onClick: handleUpdate }) : void 0;
18144
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_ui17.Panel, { title, footer, flush: true, onClose, children: [
18145
- requiredInputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AccordionSection, { title: "Required Inputs", defaultOpen: true, badge: `(${requiredInputs.length})`, children: requiredInputs.map(renderInputField) }),
18146
- optionalInputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AccordionSection, { title: "Optional Inputs", defaultOpen: true, badge: `(${optionalInputs.length})`, children: optionalInputs.map(renderInputField) }),
18147
- config.sibling_ids.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
18252
+ const footer = editable ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(UpdateButton, { status: updateStatus, label: "Update configuration", onClick: handleUpdate }) : void 0;
18253
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_ui17.Panel, { title, footer, flush: true, onClose, children: [
18254
+ requiredInputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(AccordionSection, { title: "Required Inputs", defaultOpen: true, badge: `(${requiredInputs.length})`, children: requiredInputs.map(renderInputField) }),
18255
+ optionalInputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(AccordionSection, { title: "Optional Inputs", defaultOpen: true, badge: `(${optionalInputs.length})`, children: optionalInputs.map(renderInputField) }),
18256
+ config.sibling_ids.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
18148
18257
  AccordionSection,
18149
18258
  {
18150
18259
  title: "Depends On",
18151
18260
  badge: dependsOnCount > 0 ? `(${dependsOnCount})` : void 0,
18152
18261
  children: [
18153
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-mcp__depends-hint", children: "Select sibling instances this module depends on." }),
18262
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-mcp__depends-hint", children: "Select sibling instances this module depends on." }),
18154
18263
  config.sibling_ids.map((sibId) => {
18155
18264
  const depKey = `module.${sibId}`;
18156
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "lace-mcp__depends-item", children: [
18157
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18265
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "lace-mcp__depends-item", children: [
18266
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18158
18267
  "input",
18159
18268
  {
18160
18269
  type: "checkbox",
@@ -18171,30 +18280,30 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18171
18280
  }
18172
18281
  }
18173
18282
  ),
18174
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Identifier, { className: "lace-mcp__depends-label", text: depKey })
18283
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Identifier, { className: "lace-mcp__depends-label", text: depKey })
18175
18284
  ] }, sibId);
18176
18285
  })
18177
18286
  ]
18178
18287
  }
18179
18288
  ),
18180
- (localProviders.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
18289
+ (localProviders.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
18181
18290
  AccordionSection,
18182
18291
  {
18183
18292
  title: "Providers",
18184
18293
  badge: localProviders.length > 0 ? `(${localProviders.length})` : void 0,
18185
18294
  children: [
18186
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-mcp__depends-hint", children: [
18295
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-mcp__depends-hint", children: [
18187
18296
  "Map each child-local provider name to the root provider reference passed down (e.g.",
18188
18297
  " ",
18189
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("code", { children: "aws" }),
18298
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("code", { children: "aws" }),
18190
18299
  " \u2192 ",
18191
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("code", { children: "aws.west" }),
18300
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("code", { children: "aws.west" }),
18192
18301
  ")."
18193
18302
  ] }),
18194
18303
  localProviders.map((row, i) => (
18195
18304
  // biome-ignore lint/suspicious/noArrayIndexKey: rows are positional and freely editable
18196
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-mcp__provider-row", children: [
18197
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18305
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-mcp__provider-row", children: [
18306
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18198
18307
  import_ui17.Input,
18199
18308
  {
18200
18309
  value: row.key,
@@ -18206,8 +18315,8 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18206
18315
  readOnly: !editable
18207
18316
  }
18208
18317
  ),
18209
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "lace-mcp__provider-arrow", children: "=" }),
18210
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18318
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "lace-mcp__provider-arrow", children: "=" }),
18319
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18211
18320
  import_ui17.Input,
18212
18321
  {
18213
18322
  value: row.value,
@@ -18219,10 +18328,10 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18219
18328
  readOnly: !editable
18220
18329
  }
18221
18330
  ),
18222
- editable && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18331
+ editable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18223
18332
  import_ui17.IconButton,
18224
18333
  {
18225
- icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CanvasIcon, { name: "close" }),
18334
+ icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CanvasIcon, { name: "close" }),
18226
18335
  "aria-label": "Remove this provider mapping",
18227
18336
  size: "md",
18228
18337
  tooltipPlacement: "bottom-end",
@@ -18231,7 +18340,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18231
18340
  )
18232
18341
  ] }, i)
18233
18342
  )),
18234
- editable && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18343
+ editable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18235
18344
  import_ui17.Button,
18236
18345
  {
18237
18346
  variant: "secondary",
@@ -18243,15 +18352,15 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18243
18352
  ]
18244
18353
  }
18245
18354
  ),
18246
- (localRepetition.count || localRepetition.for_each || editable) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(AccordionSection, { title: "Repetition", children: [
18247
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-mcp__depends-hint", children: [
18355
+ (localRepetition.count || localRepetition.for_each || editable) && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(AccordionSection, { title: "Repetition", children: [
18356
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-mcp__depends-hint", children: [
18248
18357
  "The call's ",
18249
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("code", { children: "count" }),
18358
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("code", { children: "count" }),
18250
18359
  " or ",
18251
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("code", { children: "for_each" }),
18360
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("code", { children: "for_each" }),
18252
18361
  ": one module, called once per instance."
18253
18362
  ] }),
18254
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18363
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18255
18364
  import_ui17.Input,
18256
18365
  {
18257
18366
  label: "count",
@@ -18263,7 +18372,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18263
18372
  readOnly: !editable
18264
18373
  }
18265
18374
  ),
18266
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18375
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18267
18376
  import_ui17.Input,
18268
18377
  {
18269
18378
  label: "for_each",
@@ -18276,20 +18385,20 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18276
18385
  }
18277
18386
  )
18278
18387
  ] }),
18279
- config.outputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AccordionSection, { title: "Outputs", badge: `(${config.outputs.length})`, children: config.outputs.map((o) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-mcp__output-card", children: [
18280
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-mcp__output-header", children: [
18281
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Identifier, { className: "lace-mcp__output-name", text: o.name }),
18282
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Identifier, { className: "lace-mcp__output-type", text: o.type ?? "" })
18388
+ config.outputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(AccordionSection, { title: "Outputs", badge: `(${config.outputs.length})`, children: config.outputs.map((o) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-mcp__output-card", children: [
18389
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-mcp__output-header", children: [
18390
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Identifier, { className: "lace-mcp__output-name", text: o.name }),
18391
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Identifier, { className: "lace-mcp__output-type", text: o.type ?? "" })
18283
18392
  ] }),
18284
- o.description && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-mcp__output-description", children: o.description }),
18285
- o.sensitive && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-mcp__output-sensitive", children: "sensitive" })
18393
+ o.description && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-mcp__output-description", children: o.description }),
18394
+ o.sensitive && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-mcp__output-sensitive", children: "sensitive" })
18286
18395
  ] }, o.name)) }),
18287
- config.module_key && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
18288
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-mcp__module-heading", children: [
18289
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-mcp__title-eyebrow", children: "Called module" }),
18290
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Identifier, { text: config.module_key })
18396
+ config.module_key && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
18397
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-mcp__module-heading", children: [
18398
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-mcp__title-eyebrow", children: "Called module" }),
18399
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Identifier, { text: config.module_key })
18291
18400
  ] }),
18292
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ModuleDetails, { moduleKey: config.module_key }, config.module_key)
18401
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ModuleDetails, { moduleKey: config.module_key }, config.module_key)
18293
18402
  ] })
18294
18403
  ] });
18295
18404
  }
@@ -18299,7 +18408,7 @@ function ModuleConfigPanel2({ ctx }) {
18299
18408
  const { setSelection } = useCanvas();
18300
18409
  const instanceId = ctx.selection.nodes[0];
18301
18410
  if (!instanceId) return null;
18302
- return (0, import_react39.createElement)(ModuleConfigPanel, {
18411
+ return (0, import_react37.createElement)(ModuleConfigPanel, {
18303
18412
  instance_id: instanceId,
18304
18413
  onClose: () => setSelection({ nodes: [], edge: null })
18305
18414
  });
@@ -18314,40 +18423,18 @@ var moduleConfigPanel = {
18314
18423
  };
18315
18424
 
18316
18425
  // src/core/panels/SourceRefusedBanner.tsx
18317
- var import_ui18 = require("@lace-cloud/ui");
18318
- var import_jsx_runtime32 = require("react/jsx-runtime");
18426
+ var import_jsx_runtime33 = require("react/jsx-runtime");
18427
+ 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.";
18428
+ var OUT_OF_LACE_SHAPE = "This Terraform is not in lace shape yet, so the canvas shows it read-only.";
18319
18429
  function SourceRefusedBanner({ ctx }) {
18320
- const { runner } = useCanvas();
18321
- const envExtras = useEditorEnvExtras();
18322
- if (!keySatisfied(ctx, "needsConversion")) {
18323
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18324
- Banner,
18325
- {
18326
- severity: "error",
18327
- className: "lace-source-refused-banner",
18328
- message: "The canvas can't take this module's .tf, so editing, saving and generating are locked until it can; the Diagnostics tab says why."
18329
- }
18330
- );
18331
- }
18332
- const actions = rowActionsFor(ctx, "source-refused");
18333
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18334
- Banner,
18430
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
18431
+ RowActionBanner,
18335
18432
  {
18433
+ ctx,
18434
+ panelId: "source-refused",
18336
18435
  severity: "error",
18337
- className: "lace-source-refused-banner lace-source-refused-banner--needs-conversion",
18338
- message: "Needs conversion: this module's .tf is not in lace shape, so the canvas shows it read-only. Convert composes each managed resource the Diagnostics tab names into a module of its own.",
18339
- actions: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18340
- import_ui18.Button,
18341
- {
18342
- rung: true,
18343
- size: "sm",
18344
- variant: "primary",
18345
- className: `lace-source-refused-banner__${action.id}`,
18346
- onClick: () => void runner.run(action, ctx, {}, envExtras),
18347
- children: action.label
18348
- },
18349
- action.id
18350
- ))
18436
+ className: "lace-source-refused-banner",
18437
+ opening: keySatisfied(ctx, "needsConversion") ? OUT_OF_LACE_SHAPE : LOCKED
18351
18438
  }
18352
18439
  );
18353
18440
  }
@@ -18361,22 +18448,22 @@ var sourceRefusedPanel = {
18361
18448
  };
18362
18449
 
18363
18450
  // src/core/panels/settings.ts
18364
- var import_ui20 = require("@lace-cloud/ui");
18365
- var import_react40 = require("react");
18451
+ var import_ui19 = require("@lace-cloud/ui");
18452
+ var import_react38 = require("react");
18366
18453
 
18367
18454
  // src/components/panels/UnifiedSettingsPanel.tsx
18368
- var import_ui19 = require("@lace-cloud/ui");
18455
+ var import_ui18 = require("@lace-cloud/ui");
18369
18456
  var import_panels_shared9 = require("./panels-shared-5JFNYXQ7.css");
18370
- var import_jsx_runtime33 = require("react/jsx-runtime");
18457
+ var import_jsx_runtime34 = require("react/jsx-runtime");
18371
18458
  function UnifiedSettingsPanel({ onClose }) {
18372
18459
  const { bundle } = useCanvas();
18373
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_ui19.Panel, { title: "Settings", flush: true, onClose, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ModuleDetails, { moduleKey: bundle.entry, open: ["Interface"] }, bundle.entry) });
18460
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui18.Panel, { title: "Settings", flush: true, onClose, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ModuleDetails, { moduleKey: bundle.entry, open: ["Interface"] }, bundle.entry) });
18374
18461
  }
18375
18462
 
18376
18463
  // src/core/panels/settings.ts
18377
18464
  function SettingsPanel(_props) {
18378
18465
  const { setSettingsOpen } = useCanvas();
18379
- return (0, import_react40.createElement)(UnifiedSettingsPanel, {
18466
+ return (0, import_react38.createElement)(UnifiedSettingsPanel, {
18380
18467
  onClose: () => setSettingsOpen(false)
18381
18468
  });
18382
18469
  }
@@ -18390,8 +18477,8 @@ var settingsPanel = {
18390
18477
  };
18391
18478
  function SettingsToggle({ ctx }) {
18392
18479
  const { setSettingsOpen } = useCanvas();
18393
- return (0, import_react40.createElement)(import_ui20.IconButton, {
18394
- icon: (0, import_react40.createElement)(CanvasIcon, { name: "settings" }),
18480
+ return (0, import_react38.createElement)(import_ui19.IconButton, {
18481
+ icon: (0, import_react38.createElement)(CanvasIcon, { name: "settings" }),
18395
18482
  "aria-label": "Settings",
18396
18483
  size: "md",
18397
18484
  tooltipPlacement: "bottom-end",
@@ -18535,10 +18622,10 @@ function reduceRun(prev, token, event) {
18535
18622
  const lastLog = event.type === "log" ? event.text : carried?.lastLog ?? null;
18536
18623
  const phases = event.type === "phase" ? withPhase(carried?.phases ?? [], event.name) : carried?.phases ?? [];
18537
18624
  const submitted = carried?.submitted || event.type === "phase" && event.name === "submit";
18538
- if (event.type === "gate" && event.resolution.mode === "awaiting_approval") {
18625
+ if (event.type === "gate" && event.changeRequest !== null) {
18539
18626
  return {
18540
18627
  token,
18541
- outcome: { kind: "awaiting-approval", changeRequestId: event.changeRequest?.id ?? "" },
18628
+ outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest, runUrl: null },
18542
18629
  lastLog,
18543
18630
  submitted,
18544
18631
  phases: closePhases(phases)
@@ -18546,7 +18633,13 @@ function reduceRun(prev, token, event) {
18546
18633
  }
18547
18634
  if (event.type === "result") {
18548
18635
  if (carried?.outcome.kind === "awaiting-approval") {
18549
- return { token, outcome: carried.outcome, lastLog, submitted, phases };
18636
+ return {
18637
+ token,
18638
+ outcome: { ...carried.outcome, runUrl: event.run.url ?? null },
18639
+ lastLog,
18640
+ submitted,
18641
+ phases
18642
+ };
18550
18643
  }
18551
18644
  if (event.error)
18552
18645
  return {
@@ -18574,7 +18667,7 @@ function settleRun(prev, token, error) {
18574
18667
  const lastLog = carried?.lastLog ?? null;
18575
18668
  const submitted = carried?.submitted ?? false;
18576
18669
  const phases = closePhases(carried?.phases ?? []);
18577
- if (error instanceof CommandDetachedError)
18670
+ if (error instanceof CommandDetachedError || error instanceof CommandUnobservedError)
18578
18671
  return { token, outcome: { kind: "detached", submitted }, lastLog, submitted, phases };
18579
18672
  if (error instanceof CommandExitError) {
18580
18673
  if (error.code === 130)
@@ -18963,7 +19056,7 @@ function createActionRunner(ports, store, options = {}) {
18963
19056
  }
18964
19057
 
18965
19058
  // src/App.tsx
18966
- var import_jsx_runtime34 = require("react/jsx-runtime");
19059
+ var import_jsx_runtime35 = require("react/jsx-runtime");
18967
19060
  var EMPTY_CONTRIBUTIONS = { overlays: [], panels: [], actions: [] };
18968
19061
  var NO_SELECTION = { nodes: [], edge: null };
18969
19062
  var NO_TARGET2 = {};
@@ -18973,8 +19066,8 @@ function OverlayRunner({
18973
19066
  tick,
18974
19067
  onDecorations
18975
19068
  }) {
18976
- const lastErrorRef = (0, import_react42.useRef)(/* @__PURE__ */ new Map());
18977
- const onReadError = (0, import_react42.useCallback)(
19069
+ const lastErrorRef = (0, import_react40.useRef)(/* @__PURE__ */ new Map());
19070
+ const onReadError = (0, import_react40.useCallback)(
18978
19071
  (path, error) => {
18979
19072
  const next = error?.message ?? null;
18980
19073
  if (lastErrorRef.current.get(path) === next) return;
@@ -18983,7 +19076,7 @@ function OverlayRunner({
18983
19076
  },
18984
19077
  [ctx.ports.presenter]
18985
19078
  );
18986
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelScope, { ctx, paths: overlay.paths, tick, onReadError, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(OverlayDecorations, { overlay, ctx, onDecorations }) });
19079
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelScope, { ctx, paths: overlay.paths, tick, onReadError, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(OverlayDecorations, { overlay, ctx, onDecorations }) });
18987
19080
  }
18988
19081
  function OverlayDecorations({
18989
19082
  overlay,
@@ -18991,14 +19084,14 @@ function OverlayDecorations({
18991
19084
  onDecorations
18992
19085
  }) {
18993
19086
  const decorations = overlay.useDecorations(ctx);
18994
- (0, import_react42.useEffect)(() => {
19087
+ (0, import_react40.useEffect)(() => {
18995
19088
  onDecorations(overlay.id, decorations);
18996
19089
  }, [overlay.id, decorations, onDecorations]);
18997
19090
  return null;
18998
19091
  }
18999
19092
  function PanelSlot({ panel, ctx, tick }) {
19000
- const [readErrors, setReadErrors] = (0, import_react42.useState)(/* @__PURE__ */ new Map());
19001
- const onReadError = (0, import_react42.useCallback)((path, error) => {
19093
+ const [readErrors, setReadErrors] = (0, import_react40.useState)(/* @__PURE__ */ new Map());
19094
+ const onReadError = (0, import_react40.useCallback)((path, error) => {
19002
19095
  setReadErrors((prev) => {
19003
19096
  if (error === null) {
19004
19097
  if (!prev.has(path)) return prev;
@@ -19011,7 +19104,7 @@ function PanelSlot({ panel, ctx, tick }) {
19011
19104
  return next;
19012
19105
  });
19013
19106
  }, []);
19014
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
19107
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
19015
19108
  PanelScope,
19016
19109
  {
19017
19110
  ctx,
@@ -19019,13 +19112,13 @@ function PanelSlot({ panel, ctx, tick }) {
19019
19112
  tick,
19020
19113
  onReadError,
19021
19114
  children: [
19022
- [...readErrors].map(([path, error]) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("p", { className: "lace-app__panel-error", children: [
19115
+ [...readErrors].map(([path, error]) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("p", { className: "lace-app__panel-error", children: [
19023
19116
  "Couldn't load ",
19024
19117
  path,
19025
19118
  ": ",
19026
19119
  error.message
19027
19120
  ] }, path)),
19028
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(panel.Component, { ctx })
19121
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(panel.Component, { ctx })
19029
19122
  ]
19030
19123
  }
19031
19124
  );
@@ -19035,12 +19128,12 @@ function BottomTabs({
19035
19128
  ctx,
19036
19129
  tick
19037
19130
  }) {
19038
- const [manualId, setManualId] = (0, import_react42.useState)(null);
19131
+ const [manualId, setManualId] = (0, import_react40.useState)(null);
19039
19132
  const manual = manualId !== null ? panels.find((p) => p.id === manualId) : void 0;
19040
19133
  const active = manual ?? panels[0] ?? null;
19041
19134
  if (panels.length === 0) return null;
19042
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "lace-app__bottom", children: [
19043
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "lace-app__bottom-tabs", role: "tablist", children: panels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
19135
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-app__bottom", children: [
19136
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-app__bottom-tabs", role: "tablist", children: panels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
19044
19137
  "button",
19045
19138
  {
19046
19139
  type: "button",
@@ -19052,7 +19145,7 @@ function BottomTabs({
19052
19145
  },
19053
19146
  panel.id
19054
19147
  )) }),
19055
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "lace-app__bottom-content", children: active && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelSlot, { panel: active, ctx, tick }) })
19148
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-app__bottom-content", children: active && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelSlot, { panel: active, ctx, tick }) })
19056
19149
  ] });
19057
19150
  }
19058
19151
  function endMessage(end) {
@@ -19064,8 +19157,8 @@ function App({
19064
19157
  height = "100vh",
19065
19158
  results: hostResults
19066
19159
  }) {
19067
- const results = (0, import_react42.useMemo)(() => hostResults ?? createResultStore(), [hostResults]);
19068
- const writeReport = (0, import_react42.useCallback)(
19160
+ const results = (0, import_react40.useMemo)(() => hostResults ?? createResultStore(), [hostResults]);
19161
+ const writeReport = (0, import_react40.useCallback)(
19069
19162
  (result, session2) => {
19070
19163
  try {
19071
19164
  results.write("report", session2, result, { stack: void 0 });
@@ -19076,43 +19169,43 @@ function App({
19076
19169
  },
19077
19170
  [results, ports.presenter]
19078
19171
  );
19079
- const dropReport = (0, import_react42.useCallback)((session2) => results.detach("report", session2), [results]);
19172
+ const dropReport = (0, import_react40.useCallback)((session2) => results.detach("report", session2), [results]);
19080
19173
  const { source, end, session } = useCanvasSource(ports.source, writeReport, dropReport);
19081
- const [arrangement, setArrangement] = (0, import_react42.useState)(() => ports.viewState.load());
19174
+ const [arrangement, setArrangement] = (0, import_react40.useState)(() => ports.viewState.load());
19082
19175
  const stack = ports.context.stack;
19083
- const [selection, setSelection] = (0, import_react42.useState)(
19176
+ const [selection, setSelection] = (0, import_react40.useState)(
19084
19177
  NO_SELECTION
19085
19178
  );
19086
- const [settingsOpen, setSettingsOpen] = (0, import_react42.useState)(false);
19087
- const select = (0, import_react42.useCallback)((next) => {
19179
+ const [settingsOpen, setSettingsOpen] = (0, import_react40.useState)(false);
19180
+ const select = (0, import_react40.useCallback)((next) => {
19088
19181
  setSelection(next);
19089
19182
  if (next.nodes.length > 0 || next.edge !== null) setSettingsOpen(false);
19090
19183
  }, []);
19091
- const [pendingForm, setPendingForm] = (0, import_react42.useState)(null);
19092
- const [overlayDecorations, setOverlayDecorations] = (0, import_react42.useState)({});
19093
- const layoutRef = (0, import_react42.useRef)({ panIntoView: () => {
19184
+ const [pendingForm, setPendingForm] = (0, import_react40.useState)(null);
19185
+ const [overlayDecorations, setOverlayDecorations] = (0, import_react40.useState)({});
19186
+ const layoutRef = (0, import_react40.useRef)({ panIntoView: () => {
19094
19187
  } });
19095
19188
  const { commands, presenter, editor } = ports;
19096
- const runner = (0, import_react42.useMemo)(
19189
+ const runner = (0, import_react40.useMemo)(
19097
19190
  () => createActionRunner({ commands, presenter, editor }, results, {
19098
19191
  onPendingFormChange: setPendingForm
19099
19192
  }),
19100
19193
  [commands, presenter, editor, results]
19101
19194
  );
19102
- (0, import_react42.useEffect)(() => {
19195
+ (0, import_react40.useEffect)(() => {
19103
19196
  return () => {
19104
19197
  runner.dispose();
19105
19198
  };
19106
19199
  }, [runner]);
19107
- const tick = (0, import_react42.useSyncExternalStore)(results.subscribe, results.getTick);
19108
- const updateArrangement = (0, import_react42.useCallback)(
19200
+ const tick = (0, import_react40.useSyncExternalStore)(results.subscribe, results.getTick);
19201
+ const updateArrangement = (0, import_react40.useCallback)(
19109
19202
  (next) => {
19110
19203
  setArrangement(next);
19111
19204
  ports.viewState.save(next);
19112
19205
  },
19113
19206
  [ports.viewState]
19114
19207
  );
19115
- const gcSeenBundle = (0, import_react42.useRef)(null);
19208
+ const gcSeenBundle = (0, import_react40.useRef)(null);
19116
19209
  if (source && gcSeenBundle.current !== source.bundle) {
19117
19210
  gcSeenBundle.current = source.bundle;
19118
19211
  const gced = gcArrangement(source.bundle, arrangement);
@@ -19123,12 +19216,12 @@ function App({
19123
19216
  });
19124
19217
  }
19125
19218
  }
19126
- const view = (0, import_react42.useMemo)(
19219
+ const view = (0, import_react40.useMemo)(
19127
19220
  () => source ? projectFrame(source, arrangement) : null,
19128
19221
  [source, arrangement]
19129
19222
  );
19130
19223
  const editable = ports.editor !== void 0 && !source?.sourceRefused;
19131
- const merged = (0, import_react42.useMemo)(
19224
+ const merged = (0, import_react40.useMemo)(
19132
19225
  () => ({
19133
19226
  overlays: [...CORE_CONTRIBUTIONS.overlays, ...contributions.overlays],
19134
19227
  panels: [...CORE_CONTRIBUTIONS.panels, ...contributions.panels],
@@ -19136,17 +19229,17 @@ function App({
19136
19229
  }),
19137
19230
  [contributions]
19138
19231
  );
19139
- const resultSlots = (0, import_react42.useSyncExternalStore)(results.subscribe, results.getSnapshot);
19232
+ const resultSlots = (0, import_react40.useSyncExternalStore)(results.subscribe, results.getSnapshot);
19140
19233
  const stackId = stack?.id;
19141
- const live = (0, import_react42.useMemo)(
19234
+ const live = (0, import_react40.useMemo)(
19142
19235
  () => source && session ? liveSlots(resultSlots, { session, treeHash: source.treeHash, stack: stackId }) : null,
19143
19236
  [resultSlots, source, session, stackId]
19144
19237
  );
19145
- const diagnostics = (0, import_react42.useMemo)(
19238
+ const diagnostics = (0, import_react40.useMemo)(
19146
19239
  () => source && live ? diagnosticsOf(source.diagnostics, live.report ? reportDiagnostics(live.report) : []) : [],
19147
19240
  [source, live]
19148
19241
  );
19149
- const ctx = (0, import_react42.useMemo)(() => {
19242
+ const ctx = (0, import_react40.useMemo)(() => {
19150
19243
  if (!source || !view) return null;
19151
19244
  return {
19152
19245
  ports,
@@ -19163,18 +19256,18 @@ function App({
19163
19256
  contributions: merged
19164
19257
  };
19165
19258
  }, [ports, source, view, stack, selection, settingsOpen, merged, diagnostics, editable]);
19166
- const resolved = (0, import_react42.useMemo)(() => {
19259
+ const resolved = (0, import_react40.useMemo)(() => {
19167
19260
  if (!ctx) return EMPTY_CONTRIBUTIONS;
19168
19261
  return resolveContributions(merged, ports, ctx, NO_TARGET2);
19169
19262
  }, [merged, ports, ctx]);
19170
- const setOverlayDecoration = (0, import_react42.useCallback)((id, next) => {
19263
+ const setOverlayDecoration = (0, import_react40.useCallback)((id, next) => {
19171
19264
  setOverlayDecorations((prev) => prev[id] === next ? prev : { ...prev, [id]: next });
19172
19265
  }, []);
19173
- const decorations = (0, import_react42.useMemo)(() => {
19266
+ const decorations = (0, import_react40.useMemo)(() => {
19174
19267
  if (!view || !source) return { nodes: {} };
19175
19268
  return decorate(view, Object.values(overlayDecorations), diagnostics);
19176
19269
  }, [view, source, overlayDecorations, diagnostics]);
19177
- const envExtras = (0, import_react42.useMemo)(() => {
19270
+ const envExtras = (0, import_react40.useMemo)(() => {
19178
19271
  if (!source) return null;
19179
19272
  return {
19180
19273
  bundle: source.bundle,
@@ -19186,8 +19279,8 @@ function App({
19186
19279
  resolved.actions.filter((action) => action.placement === "toolbar"),
19187
19280
  resolved.panels.filter((panel) => panel.slot === "toolbar")
19188
19281
  );
19189
- const rootRef = (0, import_react42.useRef)(null);
19190
- (0, import_react42.useEffect)(() => {
19282
+ const rootRef = (0, import_react40.useRef)(null);
19283
+ (0, import_react40.useEffect)(() => {
19191
19284
  if (!ctx) return;
19192
19285
  registerKeyTarget(ctx, "app", rootRef.current);
19193
19286
  return () => registerKeyTarget(ctx, "app", null);
@@ -19195,7 +19288,7 @@ function App({
19195
19288
  useFocusWhenNoneHeld(rootRef, Boolean(ctx && view && source && envExtras));
19196
19289
  useActionKeys(ctx && envExtras ? resolved.actions : [], ctx, runner, envExtras);
19197
19290
  if (!ctx || !view || !source || !envExtras) {
19198
- return end ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ErrorState, { message: endMessage(end) }) : null;
19291
+ return end ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ErrorState, { message: endMessage(end) }) : null;
19199
19292
  }
19200
19293
  const contextValue = {
19201
19294
  ports,
@@ -19215,8 +19308,8 @@ function App({
19215
19308
  const bannerPanels = resolved.panels.filter((panel) => panel.slot === "banner");
19216
19309
  const bottomPanels = resolved.panels.filter((panel) => panel.slot === "bottom");
19217
19310
  const drawerPanel = resolved.panels.find((panel) => panel.slot === "drawer");
19218
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(ErrorBoundary, { children: [
19219
- resolved.overlays.map((overlay) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
19311
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(ErrorBoundary, { children: [
19312
+ resolved.overlays.map((overlay) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
19220
19313
  OverlayRunner,
19221
19314
  {
19222
19315
  overlay,
@@ -19226,14 +19319,14 @@ function App({
19226
19319
  },
19227
19320
  overlay.id
19228
19321
  )),
19229
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CanvasContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { ref: rootRef, className: "lace-app", style: { height }, tabIndex: -1, children: [
19230
- (toolbar.sections.length > 0 || toolbar.trailing.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "lace-app__toolbar", children: [
19231
- toolbar.sections.map((section, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react42.Fragment, { children: [
19232
- index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "lace-app__toolbar-separator", "aria-hidden": "true" }) : null,
19233
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "lace-app__toolbar-section", children: [
19322
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CanvasContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { ref: rootRef, className: "lace-app", style: { height }, tabIndex: -1, children: [
19323
+ (toolbar.sections.length > 0 || toolbar.trailing.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-app__toolbar", children: [
19324
+ toolbar.sections.map((section, index) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react40.Fragment, { children: [
19325
+ index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "lace-app__toolbar-separator", "aria-hidden": "true" }) : null,
19326
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-app__toolbar-section", children: [
19234
19327
  section.actions.map((action) => {
19235
19328
  const commandBusy = action.binding.kind === "command" && results.isBusy(action.binding.resultKind);
19236
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
19329
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
19237
19330
  ToolbarAction,
19238
19331
  {
19239
19332
  action,
@@ -19245,20 +19338,20 @@ function App({
19245
19338
  action.id
19246
19339
  );
19247
19340
  }),
19248
- section.panels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelSlot, { panel, ctx, tick }, panel.id))
19341
+ section.panels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelSlot, { panel, ctx, tick }, panel.id))
19249
19342
  ] })
19250
19343
  ] }, section.key ?? "")),
19251
- toolbar.trailing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "lace-app__toolbar-end", children: toolbar.trailing.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelSlot, { panel, ctx, tick }, panel.id)) })
19344
+ toolbar.trailing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-app__toolbar-end", children: toolbar.trailing.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelSlot, { panel, ctx, tick }, panel.id)) })
19252
19345
  ] }),
19253
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "lace-app__banners", children: bannerPanels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelSlot, { panel, ctx, tick }, panel.id)) }),
19254
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "lace-app__body", children: [
19255
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "lace-app__main", children: [
19256
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "lace-app__canvas", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react41.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Canvas, { height: "100%" }) }) }),
19257
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(BottomTabs, { panels: bottomPanels, ctx, tick })
19346
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-app__banners", children: bannerPanels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelSlot, { panel, ctx, tick }, panel.id)) }),
19347
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-app__body", children: [
19348
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-app__main", children: [
19349
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-app__canvas", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react39.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Canvas, { height: "100%" }) }) }),
19350
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(BottomTabs, { panels: bottomPanels, ctx, tick })
19258
19351
  ] }),
19259
- drawerPanel && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Drawer, { label: drawerPanel.title, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PanelSlot, { panel: drawerPanel, ctx, tick }, drawerPanel.id) })
19352
+ drawerPanel && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Drawer, { label: drawerPanel.title, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelSlot, { panel: drawerPanel, ctx, tick }, drawerPanel.id) })
19260
19353
  ] }),
19261
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CommandArgsForm, { form: pendingForm })
19354
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CommandArgsForm, { form: pendingForm })
19262
19355
  ] }) })
19263
19356
  ] });
19264
19357
  }
@@ -19353,8 +19446,13 @@ async function* readConnectFrames(body, signal) {
19353
19446
  try {
19354
19447
  while (!signal.aborted) {
19355
19448
  const { value, done } = await reader.read();
19356
- if (done) return;
19357
19449
  if (signal.aborted) return;
19450
+ if (done) {
19451
+ throw new ConnectError(
19452
+ "internal",
19453
+ "the engine's stream was cut off before its end-of-stream frame"
19454
+ );
19455
+ }
19358
19456
  if (!value) continue;
19359
19457
  chunks.push(value);
19360
19458
  bufferedLen += value.length;
@@ -19930,13 +20028,14 @@ function commandsPort(caller, commandPaths, ownCwd) {
19930
20028
  throw new CommandExitError(
19931
20029
  event.exit.code,
19932
20030
  event.exit.stderr_tail,
19933
- exitFailure(event.exit.document)
20031
+ exitFailure(path, event.exit.document)
19934
20032
  );
19935
20033
  }
19936
20034
  return;
19937
20035
  }
19938
20036
  }
19939
- throw new CommandDetachedError();
20037
+ if (signal.aborted) throw new CommandDetachedError();
20038
+ throw new CommandUnobservedError();
19940
20039
  }
19941
20040
  return {
19942
20041
  events: run(),
@@ -19947,10 +20046,10 @@ function commandsPort(caller, commandPaths, ownCwd) {
19947
20046
  }
19948
20047
  };
19949
20048
  }
19950
- function exitFailure(document2) {
20049
+ function exitFailure(path, document2) {
19951
20050
  if (document2 === "") return void 0;
19952
20051
  const data = JSON.parse(document2);
19953
- return carriesFailure(data) ? parseCommandFailure(data) : void 0;
20052
+ return carriesFailure(data) ? parseCommandFailure(data) : resultFailure(path, data);
19954
20053
  }
19955
20054
  async function openSession(caller, target) {
19956
20055
  if ("fixture" in target) {
@@ -20019,6 +20118,7 @@ function convertCreatedRef(r) {
20019
20118
  CommandArgsForm,
20020
20119
  CommandDetachedError,
20021
20120
  CommandExitError,
20121
+ CommandUnobservedError,
20022
20122
  ConflictBanner,
20023
20123
  ConnectError,
20024
20124
  ContextMenu,