@lace-cloud/canvas 0.23.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({
@@ -15196,16 +15233,19 @@ var gateChangeRequestSchema = import_zod.z.object({
15196
15233
  import_zod.z.object({
15197
15234
  id: import_zod.z.string(),
15198
15235
  state: import_zod.z.string(),
15199
- decidedBy: import_zod.z.enum(["lace", "ecm"])
15236
+ decidedBy: import_zod.z.enum(["lace", "ecm"]),
15237
+ recordId: import_zod.z.string().nullable()
15200
15238
  })
15201
15239
  ),
15202
15240
  records: import_zod.z.array(
15203
15241
  import_zod.z.object({
15242
+ id: import_zod.z.string(),
15204
15243
  externalSystemId: import_zod.z.string(),
15205
15244
  kind: import_zod.z.string(),
15206
15245
  externalRef: import_zod.z.string().nullable(),
15207
15246
  externalUrl: import_zod.z.string().nullable(),
15208
- state: import_zod.z.string().nullable()
15247
+ state: import_zod.z.string().nullable(),
15248
+ decision: import_zod.z.enum(["approved", "rejected"]).nullable()
15209
15249
  })
15210
15250
  )
15211
15251
  });
@@ -15229,6 +15269,7 @@ var runEventSchema = import_zod.z.discriminatedUnion("type", [
15229
15269
  })
15230
15270
  ]);
15231
15271
  var stackScanSchema = import_zod.z.object({
15272
+ stack: stackIdentSchema,
15232
15273
  triggered: import_zod.z.boolean(),
15233
15274
  reason: import_zod.z.string().nullable(),
15234
15275
  settled: import_zod.z.object({
@@ -15236,14 +15277,17 @@ var stackScanSchema = import_zod.z.object({
15236
15277
  driftCount: import_zod.z.number(),
15237
15278
  scannedAt: import_zod.z.string(),
15238
15279
  undeterminedReason: import_zod.z.string().nullable(),
15280
+ standingDriftFindings: import_zod.z.number(),
15281
+ footprintDestroyed: import_zod.z.boolean(),
15239
15282
  drift: driftSchema
15240
15283
  }).nullable()
15241
15284
  });
15242
15285
  var stackImportSchema = import_zod.z.object({
15243
- stack: import_zod.z.object({ id: import_zod.z.string(), slug: import_zod.z.string() }),
15286
+ stack: stackIdentSchema,
15244
15287
  written: import_zod.z.array(import_zod.z.string()),
15288
+ removed: import_zod.z.array(import_zod.z.string()),
15245
15289
  importBlocks: import_zod.z.number(),
15246
- importResiduals: import_zod.z.array(import_zod.z.unknown()),
15290
+ importResiduals: import_zod.z.array(importResidualSchema),
15247
15291
  validate: moduleValidateResultSchema
15248
15292
  });
15249
15293
  var artifactRefSchema = import_zod.z.object({ url: import_zod.z.string(), key: import_zod.z.string() });
@@ -15355,24 +15399,6 @@ function isBoundPath(path) {
15355
15399
  function parseBound(path, data) {
15356
15400
  return SCHEMAS[path].parse(data);
15357
15401
  }
15358
- var REASON_PREFIX = "REASON_";
15359
- function reasonWire(reason) {
15360
- return reasonToJSON(reason).slice(REASON_PREFIX.length).toLowerCase();
15361
- }
15362
- var LACE_REASONS = new Set(
15363
- Object.values(Reason).filter((value) => typeof value === "number" && value !== -1 /* UNRECOGNIZED */).map(reasonWire)
15364
- );
15365
- var laceReasonSchema = import_zod.z.custom(
15366
- (value) => typeof value === "string" && LACE_REASONS.has(value),
15367
- { message: "not a reason of Lace\u2019s own" }
15368
- );
15369
- var commandFailureSchema = import_zod.z.strictObject({
15370
- reason: laceReasonSchema,
15371
- message: import_zod.z.string(),
15372
- url: import_zod.z.string().optional(),
15373
- tool: import_zod.z.string().optional(),
15374
- apiCode: import_zod.z.string().optional()
15375
- });
15376
15402
  var failureMarkSchema = import_zod.z.object({ reason: import_zod.z.string(), message: import_zod.z.string() });
15377
15403
  function carriesFailure(data) {
15378
15404
  return failureMarkSchema.safeParse(data).success;
@@ -15380,6 +15406,12 @@ function carriesFailure(data) {
15380
15406
  function parseCommandFailure(data) {
15381
15407
  return commandFailureSchema.parse(data);
15382
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
+ }
15383
15415
 
15384
15416
  // src/core/CommandArgsForm.tsx
15385
15417
  var import_jsx_runtime14 = require("react/jsx-runtime");
@@ -15390,7 +15422,7 @@ function flagsOf(path) {
15390
15422
  return COMMANDS[path].flags;
15391
15423
  }
15392
15424
  function CommandArgsForm({ form }) {
15393
- const [values, setValues] = (0, import_react23.useState)({});
15425
+ const [values, setValues] = (0, import_react21.useState)({});
15394
15426
  if (!form) return null;
15395
15427
  const flags = isCommandPath(form.path) ? flagsOf(form.path) : {};
15396
15428
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
@@ -15455,7 +15487,7 @@ function defineCommand(binding) {
15455
15487
  if (!binding.confirm) return void 0;
15456
15488
  const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
15457
15489
  if (!merged.ok) return void 0;
15458
- return binding.confirm(ctx, merged.args);
15490
+ return binding.confirm(ctx, merged.args, target);
15459
15491
  },
15460
15492
  async start(rt, ctx, target, formArgs, signal) {
15461
15493
  const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
@@ -15514,6 +15546,21 @@ var destroy = defineCommand({
15514
15546
  invalidates: "start+settle",
15515
15547
  result: slotSink("run")
15516
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
+ }
15517
15564
  var scan = defineCommand({
15518
15565
  kind: "command",
15519
15566
  path: "stack scan",
@@ -15522,14 +15569,8 @@ var scan = defineCommand({
15522
15569
  result: {
15523
15570
  kind: "notify",
15524
15571
  consume: (rt, e) => {
15525
- if (!e.triggered) {
15526
- rt.ports.presenter.notify("info", e.reason ?? "Scan skipped");
15527
- return;
15528
- }
15529
- rt.ports.presenter.notify(
15530
- "info",
15531
- e.settled ? `Scan complete \u2014 ${e.settled.driftStatus}` : "Scan triggered"
15532
- );
15572
+ const notice = scanNotice(e);
15573
+ if (notice !== void 0) rt.ports.presenter.notify("info", notice);
15533
15574
  }
15534
15575
  }
15535
15576
  });
@@ -15543,15 +15584,51 @@ var create = defineCommand({
15543
15584
  consume: (rt, e) => rt.ports.presenter.notify("info", `Created stack ${e.slug}`)
15544
15585
  }
15545
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
+ };
15546
15616
  var importStack = defineCommand({
15547
15617
  kind: "command",
15548
15618
  path: "stack import",
15549
15619
  args: (ctx) => ({ stack: ctx.stack?.id }),
15550
15620
  invalidates: true,
15551
- result: {
15552
- kind: "notify",
15553
- consume: (rt, e) => rt.ports.presenter.notify("info", `Imported ${e.importBlocks} block(s) into ${e.stack.slug}`)
15554
- }
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
15555
15632
  });
15556
15633
  var validate = defineCommand({
15557
15634
  kind: "command",
@@ -15619,12 +15696,14 @@ var MODULE_COMMAND_ACTIONS = [
15619
15696
  requiredContext: ["root"],
15620
15697
  binding: convert
15621
15698
  },
15622
- // The refused-tf banner's one action while the tree is out of lace shape:
15623
- // the same `module convert` the toolbar runs. The engine re-derives the
15624
- // 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.
15625
15703
  {
15626
15704
  id: "convert-refused",
15627
15705
  label: "Convert",
15706
+ choice: "Convert restructures it in place; a stack's apply creates only what its state does not hold yet.",
15628
15707
  icon: "convert",
15629
15708
  placement: { row: "source-refused" },
15630
15709
  requiredPorts: ["commands"],
@@ -15674,7 +15753,7 @@ var STACK_COMMAND_ACTIONS = [
15674
15753
  },
15675
15754
  {
15676
15755
  id: "import",
15677
- label: "Import state",
15756
+ label: "Import existing resources",
15678
15757
  placement: "toolbar",
15679
15758
  requiredPorts: ["commands"],
15680
15759
  // `stack import` writes the directory it runs in, the same way
@@ -15682,6 +15761,15 @@ var STACK_COMMAND_ACTIONS = [
15682
15761
  requiredContext: ["root", "stack"],
15683
15762
  binding: importStack
15684
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
+ },
15685
15773
  {
15686
15774
  id: "preview",
15687
15775
  label: "Preview",
@@ -15718,10 +15806,10 @@ var CORE_COMMAND_ACTIONS = [
15718
15806
  var import_proto8 = require("@lace-cloud/proto");
15719
15807
 
15720
15808
  // src/core/define-overlay.ts
15721
- var import_react26 = require("react");
15809
+ var import_react24 = require("react");
15722
15810
 
15723
15811
  // src/core/use-command-read.ts
15724
- var import_react25 = require("react");
15812
+ var import_react23 = require("react");
15725
15813
 
15726
15814
  // src/utils/is-plain-object.ts
15727
15815
  function isPlainObject(val) {
@@ -15729,11 +15817,11 @@ function isPlainObject(val) {
15729
15817
  }
15730
15818
 
15731
15819
  // src/core/panel-scope.tsx
15732
- var import_react24 = require("react");
15820
+ var import_react22 = require("react");
15733
15821
  var import_jsx_runtime15 = require("react/jsx-runtime");
15734
15822
  var noopReportError = () => {
15735
15823
  };
15736
- var PanelScopeContext = (0, import_react24.createContext)(null);
15824
+ var PanelScopeContext = (0, import_react22.createContext)(null);
15737
15825
  function PanelScope({
15738
15826
  ctx,
15739
15827
  target = {},
@@ -15743,14 +15831,14 @@ function PanelScope({
15743
15831
  children
15744
15832
  }) {
15745
15833
  const reportError = onReadError ?? noopReportError;
15746
- const value = (0, import_react24.useMemo)(
15834
+ const value = (0, import_react22.useMemo)(
15747
15835
  () => ({ ctx, target, paths: new Set(paths), tick, reportError }),
15748
15836
  [ctx, target, paths, tick, reportError]
15749
15837
  );
15750
15838
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PanelScopeContext.Provider, { value, children });
15751
15839
  }
15752
15840
  function usePanelScope() {
15753
- const value = (0, import_react24.useContext)(PanelScopeContext);
15841
+ const value = (0, import_react22.useContext)(PanelScopeContext);
15754
15842
  if (!value) {
15755
15843
  throw new Error(
15756
15844
  "usePanelScope: not inside a <PanelScope> \u2014 mount panels/overlays through App, which wraps every declared-read contribution"
@@ -15784,20 +15872,20 @@ function useCommandRead(read, target) {
15784
15872
  const effectiveTarget = target ?? scope.target;
15785
15873
  const args = read.args(scope.ctx, effectiveTarget);
15786
15874
  const key = args === null ? null : stableJson(args);
15787
- const [state, setState] = (0, import_react25.useState)(INITIAL);
15788
- 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);
15789
15877
  const inputs = {
15790
15878
  path: read.path,
15791
15879
  args,
15792
15880
  commands: scope.ctx.ports.commands,
15793
15881
  reportError: scope.reportError
15794
15882
  };
15795
- const inputsRef = (0, import_react25.useRef)(inputs);
15796
- (0, import_react25.useEffect)(() => {
15883
+ const inputsRef = (0, import_react23.useRef)(inputs);
15884
+ (0, import_react23.useEffect)(() => {
15797
15885
  inputsRef.current = inputs;
15798
15886
  });
15799
- const request = (0, import_react25.useMemo)(() => ({ key, tick: scope.tick }), [key, scope.tick]);
15800
- (0, import_react25.useEffect)(() => {
15887
+ const request = (0, import_react23.useMemo)(() => ({ key, tick: scope.tick }), [key, scope.tick]);
15888
+ (0, import_react23.useEffect)(() => {
15801
15889
  const { path, args: args2, commands, reportError } = inputsRef.current;
15802
15890
  const keyChanged = prevKeyRef.current !== request.key;
15803
15891
  prevKeyRef.current = request.key;
@@ -15842,7 +15930,7 @@ function defineOverlay(o) {
15842
15930
  useDecorations(ctx) {
15843
15931
  const { data } = useCommandRead(o.read);
15844
15932
  const view = ctx.view;
15845
- return (0, import_react26.useMemo)(
15933
+ return (0, import_react24.useMemo)(
15846
15934
  () => data ? o.decorate(view, data) : EMPTY_DECORATIONS2,
15847
15935
  [o.decorate, view, data]
15848
15936
  );
@@ -15894,7 +15982,7 @@ var describeOverlay = defineOverlay({
15894
15982
  decorate: decorateDescribe
15895
15983
  });
15896
15984
 
15897
- // src/core/panels/ConflictBanner.tsx
15985
+ // src/core/panels/RowActionBanner.tsx
15898
15986
  var import_ui5 = require("@lace-cloud/ui");
15899
15987
 
15900
15988
  // src/components/Banner.tsx
@@ -15915,25 +16003,30 @@ function Banner({ severity, message, className, actions }) {
15915
16003
  );
15916
16004
  }
15917
16005
 
15918
- // src/core/panels/ConflictBanner.tsx
16006
+ // src/core/panels/RowActionBanner.tsx
15919
16007
  var import_jsx_runtime17 = require("react/jsx-runtime");
15920
- 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 }) {
15921
16014
  const { runner } = useCanvas();
15922
16015
  const envExtras = useEditorEnvExtras();
15923
- const actions = rowActionsFor(ctx, "conflict");
16016
+ const actions = rowActionsFor(ctx, panelId);
15924
16017
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
15925
16018
  Banner,
15926
16019
  {
15927
- severity: "warning",
15928
- className: "lace-conflict-banner",
15929
- message: "The module's .tf files changed outside the canvas while it held edits of its own.",
15930
- 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)(
15931
16024
  import_ui5.Button,
15932
16025
  {
15933
16026
  rung: true,
15934
16027
  size: "sm",
15935
16028
  variant: "secondary",
15936
- className: `lace-conflict-banner__${action.id}`,
16029
+ className: `${className}__${action.id}`,
15937
16030
  onClick: () => void runner.run(action, ctx, {}, envExtras),
15938
16031
  children: action.label
15939
16032
  },
@@ -15942,6 +16035,21 @@ function ConflictBanner({ ctx }) {
15942
16035
  }
15943
16036
  );
15944
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
+ }
15945
16053
  var conflictPanel = {
15946
16054
  id: "conflict",
15947
16055
  title: "Conflict",
@@ -15955,9 +16063,9 @@ var conflictPanel = {
15955
16063
  var import_ui6 = require("@lace-cloud/ui");
15956
16064
 
15957
16065
  // src/components/Identifier.tsx
15958
- var import_react27 = require("react");
16066
+ var import_react25 = require("react");
15959
16067
  var import_Identifier = require("./Identifier-V6MZ37EG.css");
15960
- var import_jsx_runtime18 = (
16068
+ var import_jsx_runtime19 = (
15961
16069
  // biome-ignore lint/suspicious/noArrayIndexKey: a segment's place in the name is its identity.
15962
16070
  require("react/jsx-runtime")
15963
16071
  );
@@ -15965,15 +16073,15 @@ function identifierSegments(text) {
15965
16073
  return text.split(/(?<=[_.])/);
15966
16074
  }
15967
16075
  function Identifier({ text, className }) {
15968
- 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: [
15969
- 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,
15970
16078
  segment
15971
16079
  ] }, i)) });
15972
16080
  }
15973
16081
 
15974
16082
  // src/core/panels/DiagnosticsPanel.tsx
15975
16083
  var import_DiagnosticsPanel = require("./DiagnosticsPanel-T6VDHH4A.css");
15976
- var import_jsx_runtime19 = require("react/jsx-runtime");
16084
+ var import_jsx_runtime20 = require("react/jsx-runtime");
15977
16085
  function rowKey(d, index) {
15978
16086
  return `${d.severity}:${d.module_key ?? ""}.${d.instance_id ?? ""}:${index}`;
15979
16087
  }
@@ -15981,27 +16089,27 @@ function DiagnosticsPanel({ ctx }) {
15981
16089
  const { runner } = useCanvas();
15982
16090
  const envExtras = useEditorEnvExtras();
15983
16091
  const diagnostics = ctx.diagnostics;
15984
- 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) => {
15985
16093
  const key = rowKey(d, index);
15986
16094
  const target = { diagnostic: d };
15987
16095
  const actions = rowActionsFor(ctx, "diagnostics", target);
15988
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
16096
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
15989
16097
  "li",
15990
16098
  {
15991
16099
  className: `lace-diagnostics-panel__row lace-diagnostics-panel__row--${d.severity}`,
15992
16100
  children: [
15993
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "lace-diagnostics-panel__icon", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CanvasIcon, { name: d.severity }) }),
15994
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "lace-diagnostics-panel__body", children: [
15995
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "lace-diagnostics-panel__message", children: d.message }),
15996
- 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)(
15997
16105
  Identifier,
15998
16106
  {
15999
16107
  className: "lace-diagnostics-panel__where",
16000
16108
  text: d.input_name ? `${d.instance_id}.${d.input_name}` : d.instance_id
16001
16109
  }
16002
16110
  ),
16003
- d.code !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Identifier, { className: "lace-diagnostics-panel__code", text: d.code }),
16004
- 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)(
16005
16113
  import_ui6.Button,
16006
16114
  {
16007
16115
  rung: true,
@@ -16034,13 +16142,13 @@ var diagnosticsPanel = {
16034
16142
 
16035
16143
  // src/core/panels/edge-inspector.ts
16036
16144
  var import_proto10 = require("@lace-cloud/proto");
16037
- var import_react28 = require("react");
16145
+ var import_react26 = require("react");
16038
16146
 
16039
16147
  // src/components/panels/EdgeInspectorPanel.tsx
16040
16148
  var import_proto9 = require("@lace-cloud/proto");
16041
16149
  var import_ui7 = require("@lace-cloud/ui");
16042
16150
  var import_EdgeInspectorPanel = require("./EdgeInspectorPanel-JD6CVUAT.css");
16043
- var import_jsx_runtime20 = require("react/jsx-runtime");
16151
+ var import_jsx_runtime21 = require("react/jsx-runtime");
16044
16152
  function EdgeInspectorPanel({
16045
16153
  source,
16046
16154
  target,
@@ -16049,23 +16157,23 @@ function EdgeInspectorPanel({
16049
16157
  onDelete,
16050
16158
  onClose
16051
16159
  }) {
16052
- const title = /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
16053
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "lace-edge-panel__title-eyebrow", children: "Connection" }),
16054
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "lace-edge-panel__title", children: [
16055
- /* @__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 }),
16056
16164
  " \u2192 ",
16057
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Identifier, { text: target })
16165
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Identifier, { text: target })
16058
16166
  ] })
16059
16167
  ] });
16060
- 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;
16061
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_ui7.Panel, { title, footer, onClose, children: [
16062
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "lace-edge-panel__section-label", children: "Wiring" }),
16063
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "lace-edge-panel__wiring", children: [
16064
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Identifier, { text: sourceOutput ? `${source}.outputs.${sourceOutput}` : (0, import_proto9.callText)(source) }),
16065
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "lace-edge-panel__wiring-arrow", children: "\u2193" }),
16066
- /* @__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}` })
16067
16175
  ] }),
16068
- 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." })
16069
16177
  ] });
16070
16178
  }
16071
16179
 
@@ -16097,7 +16205,7 @@ function EdgeInspectorPanel2({ ctx }) {
16097
16205
  if (!edge) return null;
16098
16206
  const close = () => setSelection({ nodes: [], edge: null });
16099
16207
  const disconnect = rowActionsFor(ctx, "edge-inspector").find((a) => a.id === "disconnect");
16100
- return (0, import_react28.createElement)(EdgeInspectorPanel, {
16208
+ return (0, import_react26.createElement)(EdgeInspectorPanel, {
16101
16209
  source: edge.source,
16102
16210
  target: edge.target,
16103
16211
  sourceOutput: edge.sourceOutput,
@@ -16124,9 +16232,9 @@ var edgeInspectorPanel = {
16124
16232
 
16125
16233
  // src/core/panels/Markers.tsx
16126
16234
  var import_ui8 = require("@lace-cloud/ui");
16127
- var import_jsx_runtime21 = require("react/jsx-runtime");
16235
+ var import_jsx_runtime22 = require("react/jsx-runtime");
16128
16236
  function UnsavedMarker() {
16129
- 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" });
16130
16238
  }
16131
16239
  var unsavedMarker = {
16132
16240
  id: "unsaved-marker",
@@ -16138,7 +16246,7 @@ var unsavedMarker = {
16138
16246
  Component: UnsavedMarker
16139
16247
  };
16140
16248
  function UngeneratedMarker() {
16141
- 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" });
16142
16250
  }
16143
16251
  var ungeneratedMarker = {
16144
16252
  id: "ungenerated-marker",
@@ -16151,12 +16259,12 @@ var ungeneratedMarker = {
16151
16259
  };
16152
16260
 
16153
16261
  // src/core/panels/module-config.ts
16154
- var import_react39 = require("react");
16262
+ var import_react37 = require("react");
16155
16263
 
16156
16264
  // src/components/panels/ModuleConfigPanel.tsx
16157
16265
  var import_proto12 = require("@lace-cloud/proto");
16158
16266
  var import_ui17 = require("@lace-cloud/ui");
16159
- var import_react38 = require("react");
16267
+ var import_react36 = require("react");
16160
16268
 
16161
16269
  // src/exhaustive.ts
16162
16270
  function assertNever(value) {
@@ -16164,15 +16272,15 @@ function assertNever(value) {
16164
16272
  }
16165
16273
 
16166
16274
  // src/hooks/useUpdateState.ts
16167
- var import_react29 = require("react");
16275
+ var import_react27 = require("react");
16168
16276
  function useUpdateState(updateFn) {
16169
- const [status, setStatus] = (0, import_react29.useState)("idle");
16170
- const mountedRef = (0, import_react29.useRef)(true);
16171
- const resetTimerRef = (0, import_react29.useRef)(null);
16172
- 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) => {
16173
16281
  if (mountedRef.current) setStatus(next);
16174
16282
  }, []);
16175
- const scheduleReset = (0, import_react29.useCallback)(
16283
+ const scheduleReset = (0, import_react27.useCallback)(
16176
16284
  (delay) => {
16177
16285
  if (resetTimerRef.current !== null) clearTimeout(resetTimerRef.current);
16178
16286
  resetTimerRef.current = setTimeout(() => {
@@ -16182,7 +16290,7 @@ function useUpdateState(updateFn) {
16182
16290
  },
16183
16291
  [safeSetStatus]
16184
16292
  );
16185
- const handleUpdate = (0, import_react29.useCallback)(async () => {
16293
+ const handleUpdate = (0, import_react27.useCallback)(async () => {
16186
16294
  safeSetStatus("updating");
16187
16295
  try {
16188
16296
  await updateFn();
@@ -16193,7 +16301,7 @@ function useUpdateState(updateFn) {
16193
16301
  scheduleReset(2e3);
16194
16302
  }
16195
16303
  }, [updateFn, safeSetStatus, scheduleReset]);
16196
- (0, import_react29.useEffect)(() => {
16304
+ (0, import_react27.useEffect)(() => {
16197
16305
  return () => {
16198
16306
  mountedRef.current = false;
16199
16307
  if (resetTimerRef.current !== null) {
@@ -16206,13 +16314,13 @@ function useUpdateState(updateFn) {
16206
16314
  }
16207
16315
 
16208
16316
  // src/components/AccordionSection.tsx
16209
- var import_react30 = require("react");
16317
+ var import_react28 = require("react");
16210
16318
  var import_AccordionSection = require("./AccordionSection-J3ALHB5M.css");
16211
- var import_jsx_runtime22 = require("react/jsx-runtime");
16319
+ var import_jsx_runtime23 = require("react/jsx-runtime");
16212
16320
  function AccordionSection({ title, defaultOpen = false, badge, children }) {
16213
- const [open, setOpen] = (0, import_react30.useState)(defaultOpen);
16214
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `lace-accordion${open ? " lace-accordion--open" : ""}`, children: [
16215
- /* @__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)(
16216
16324
  "button",
16217
16325
  {
16218
16326
  type: "button",
@@ -16220,13 +16328,13 @@ function AccordionSection({ title, defaultOpen = false, badge, children }) {
16220
16328
  onClick: () => setOpen((v) => !v),
16221
16329
  "aria-expanded": open,
16222
16330
  children: [
16223
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "lace-accordion__chevron", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CanvasIcon, { name: "chevron-right" }) }),
16224
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "lace-accordion__title", children: title }),
16225
- 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 })
16226
16334
  ]
16227
16335
  }
16228
16336
  ),
16229
- /* @__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 }) }) })
16230
16338
  ] });
16231
16339
  }
16232
16340
 
@@ -16237,7 +16345,7 @@ var import_panels_shared8 = require("./panels-shared-5JFNYXQ7.css");
16237
16345
  // src/components/UpdateButton.tsx
16238
16346
  var import_ui9 = require("@lace-cloud/ui");
16239
16347
  var import_UpdateButton = require("./UpdateButton-TJKSFVBA.css");
16240
- var import_jsx_runtime23 = require("react/jsx-runtime");
16348
+ var import_jsx_runtime24 = require("react/jsx-runtime");
16241
16349
  var variantByStatus = {
16242
16350
  idle: "primary",
16243
16351
  updating: "primary",
@@ -16250,7 +16358,7 @@ var labelByStatus = {
16250
16358
  error: "Update failed \u2014 try again"
16251
16359
  };
16252
16360
  function UpdateButton({ status, label, onClick, disabled, disabledTitle }) {
16253
- 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)(
16254
16362
  import_ui9.Button,
16255
16363
  {
16256
16364
  rung: true,
@@ -16268,13 +16376,13 @@ function UpdateButton({ status, label, onClick, disabled, disabledTitle }) {
16268
16376
  // src/components/panels/ModuleDetails.tsx
16269
16377
  var import_proto11 = require("@lace-cloud/proto");
16270
16378
  var import_ui16 = require("@lace-cloud/ui");
16271
- var import_react37 = require("react");
16379
+ var import_react35 = require("react");
16272
16380
 
16273
16381
  // src/components/panels/BlockEditor.tsx
16274
16382
  var import_ui10 = require("@lace-cloud/ui");
16275
- var import_react31 = require("react");
16383
+ var import_react29 = require("react");
16276
16384
  var import_panels_shared = require("./panels-shared-5JFNYXQ7.css");
16277
- var import_jsx_runtime24 = require("react/jsx-runtime");
16385
+ var import_jsx_runtime25 = require("react/jsx-runtime");
16278
16386
  function replaceAt(list, index, item) {
16279
16387
  return list.map((x, i) => i === index ? item : x);
16280
16388
  }
@@ -16282,8 +16390,8 @@ function blockTitle(block) {
16282
16390
  return [block.type, ...block.labels.map((l) => `"${l}"`)].join(" ");
16283
16391
  }
16284
16392
  function BlockEditor({ blocks, onChange, editable, templates }) {
16285
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
16286
- 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)(
16287
16395
  BlockCard,
16288
16396
  {
16289
16397
  block,
@@ -16293,7 +16401,7 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
16293
16401
  },
16294
16402
  i
16295
16403
  )),
16296
- 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)(
16297
16405
  import_ui10.Button,
16298
16406
  {
16299
16407
  variant: "secondary",
@@ -16314,7 +16422,7 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
16314
16422
  ]
16315
16423
  },
16316
16424
  t.type
16317
- )) }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16425
+ )) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16318
16426
  NewBlockRow,
16319
16427
  {
16320
16428
  onAdd: (type, label) => onChange([
@@ -16326,10 +16434,10 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
16326
16434
  ] });
16327
16435
  }
16328
16436
  function NewBlockRow({ onAdd }) {
16329
- const [type, setType] = (0, import_react31.useState)("");
16330
- const [label, setLabel] = (0, import_react31.useState)("");
16331
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "lace-panel-row-actions", children: [
16332
- /* @__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)(
16333
16441
  import_ui10.Input,
16334
16442
  {
16335
16443
  value: type,
@@ -16339,7 +16447,7 @@ function NewBlockRow({ onAdd }) {
16339
16447
  mono: true
16340
16448
  }
16341
16449
  ),
16342
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16450
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16343
16451
  import_ui10.Input,
16344
16452
  {
16345
16453
  value: label,
@@ -16349,7 +16457,7 @@ function NewBlockRow({ onAdd }) {
16349
16457
  mono: true
16350
16458
  }
16351
16459
  ),
16352
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16460
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16353
16461
  import_ui10.Button,
16354
16462
  {
16355
16463
  variant: "secondary",
@@ -16373,13 +16481,13 @@ function BlockCard({ block, editable, onChange, onRemove }) {
16373
16481
  [field]: value
16374
16482
  })
16375
16483
  });
16376
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "lace-panel-validation-block", children: [
16377
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "lace-panel-row-actions", children: [
16378
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Identifier, { className: "lace-panel-row-card__name", text: blockTitle(block) }),
16379
- 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)(
16380
16488
  import_ui10.IconButton,
16381
16489
  {
16382
- icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CanvasIcon, { name: "close" }),
16490
+ icon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CanvasIcon, { name: "close" }),
16383
16491
  "aria-label": `Remove the ${block.type} block`,
16384
16492
  size: "md",
16385
16493
  tooltipPlacement: "bottom-end",
@@ -16389,8 +16497,8 @@ function BlockCard({ block, editable, onChange, onRemove }) {
16389
16497
  ] }),
16390
16498
  block.attributes.map((attribute, i) => (
16391
16499
  // biome-ignore lint/suspicious/noArrayIndexKey: attributes are positional; the render keeps their order
16392
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "lace-panel-row-actions", children: [
16393
- /* @__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)(
16394
16502
  import_ui10.Input,
16395
16503
  {
16396
16504
  value: attribute.name,
@@ -16401,7 +16509,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
16401
16509
  readOnly: !editable
16402
16510
  }
16403
16511
  ),
16404
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16512
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16405
16513
  import_ui10.Input,
16406
16514
  {
16407
16515
  value: attribute.value,
@@ -16412,10 +16520,10 @@ function BlockCard({ block, editable, onChange, onRemove }) {
16412
16520
  readOnly: !editable
16413
16521
  }
16414
16522
  ),
16415
- editable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16523
+ editable && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16416
16524
  import_ui10.IconButton,
16417
16525
  {
16418
- icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CanvasIcon, { name: "close" }),
16526
+ icon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CanvasIcon, { name: "close" }),
16419
16527
  "aria-label": `Remove ${attribute.name || "the argument"}`,
16420
16528
  size: "md",
16421
16529
  tooltipPlacement: "bottom-end",
@@ -16424,7 +16532,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
16424
16532
  )
16425
16533
  ] }, i)
16426
16534
  )),
16427
- editable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16535
+ editable && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16428
16536
  import_ui10.Button,
16429
16537
  {
16430
16538
  variant: "secondary",
@@ -16433,7 +16541,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
16433
16541
  children: "+ Add argument"
16434
16542
  }
16435
16543
  ),
16436
- (block.blocks.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
16544
+ (block.blocks.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16437
16545
  BlockEditor,
16438
16546
  {
16439
16547
  blocks: block.blocks,
@@ -16446,7 +16554,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
16446
16554
 
16447
16555
  // src/components/panels/LocalsPanel.tsx
16448
16556
  var import_ui11 = require("@lace-cloud/ui");
16449
- var import_react32 = require("react");
16557
+ var import_react30 = require("react");
16450
16558
 
16451
16559
  // src/utils/duplicates.ts
16452
16560
  function findDuplicateIndices(items, keyFn) {
@@ -16466,7 +16574,7 @@ function findDuplicateIndices(items, keyFn) {
16466
16574
 
16467
16575
  // src/components/panels/LocalsPanel.tsx
16468
16576
  var import_panels_shared2 = require("./panels-shared-5JFNYXQ7.css");
16469
- var import_jsx_runtime25 = require("react/jsx-runtime");
16577
+ var import_jsx_runtime26 = require("react/jsx-runtime");
16470
16578
  function toRows(locals) {
16471
16579
  return (locals ?? []).map((l) => ({ id: crypto.randomUUID(), ...l }));
16472
16580
  }
@@ -16475,28 +16583,28 @@ function fromRows(rows) {
16475
16583
  }
16476
16584
  function LocalsContent({ locals, onSave }) {
16477
16585
  const { editable } = useCanvas();
16478
- const [rows, setRows] = (0, import_react32.useState)(() => toRows(locals));
16479
- const addLocal = (0, import_react32.useCallback)(() => {
16586
+ const [rows, setRows] = (0, import_react30.useState)(() => toRows(locals));
16587
+ const addLocal = (0, import_react30.useCallback)(() => {
16480
16588
  setRows((prev) => [...prev, { id: crypto.randomUUID(), name: "", value: "" }]);
16481
16589
  }, []);
16482
- const removeLocal = (0, import_react32.useCallback)((index) => {
16590
+ const removeLocal = (0, import_react30.useCallback)((index) => {
16483
16591
  setRows((prev) => prev.filter((_, i) => i !== index));
16484
16592
  }, []);
16485
- const updateRow = (0, import_react32.useCallback)((index, field, value) => {
16593
+ const updateRow = (0, import_react30.useCallback)((index, field, value) => {
16486
16594
  setRows((prev) => prev.map((r, i) => i === index ? { ...r, [field]: value } : r));
16487
16595
  }, []);
16488
16596
  const nameDupes = findDuplicateIndices(rows, (r) => r.name);
16489
16597
  const hasErrors = nameDupes.size > 0;
16490
16598
  const { status: updateStatus, handleUpdate } = useUpdateState(
16491
- (0, import_react32.useCallback)(async () => {
16599
+ (0, import_react30.useCallback)(async () => {
16492
16600
  if (hasErrors) return;
16493
16601
  await onSave(fromRows(rows));
16494
16602
  }, [onSave, rows, hasErrors])
16495
16603
  );
16496
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
16497
- rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
16498
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "lace-panel-row-actions", children: [
16499
- /* @__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)(
16500
16608
  import_ui11.Input,
16501
16609
  {
16502
16610
  value: row.name,
@@ -16509,10 +16617,10 @@ function LocalsContent({ locals, onSave }) {
16509
16617
  readOnly: !editable
16510
16618
  }
16511
16619
  ),
16512
- editable && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
16620
+ editable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16513
16621
  import_ui11.IconButton,
16514
16622
  {
16515
- icon: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CanvasIcon, { name: "close" }),
16623
+ icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CanvasIcon, { name: "close" }),
16516
16624
  "aria-label": "Remove local",
16517
16625
  size: "md",
16518
16626
  tooltipPlacement: "bottom-end",
@@ -16520,8 +16628,8 @@ function LocalsContent({ locals, onSave }) {
16520
16628
  }
16521
16629
  )
16522
16630
  ] }),
16523
- nameDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "lace-panel-row-error", children: "Duplicate local name" }),
16524
- /* @__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)(
16525
16633
  import_ui11.Textarea,
16526
16634
  {
16527
16635
  value: row.value,
@@ -16535,9 +16643,9 @@ function LocalsContent({ locals, onSave }) {
16535
16643
  }
16536
16644
  ) })
16537
16645
  ] }, row.id)),
16538
- editable && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
16539
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ui11.Button, { variant: "secondary", size: "sm", onClick: addLocal, children: "+ Add local" }),
16540
- /* @__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)(
16541
16649
  UpdateButton,
16542
16650
  {
16543
16651
  status: updateStatus,
@@ -16551,14 +16659,14 @@ function LocalsContent({ locals, onSave }) {
16551
16659
  ] });
16552
16660
  }
16553
16661
  function LocalsPanel({ locals, onSave, onClose }) {
16554
- 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 }) });
16555
16663
  }
16556
16664
 
16557
16665
  // src/components/panels/ModuleInterfacePanel.tsx
16558
16666
  var import_ui12 = require("@lace-cloud/ui");
16559
- var import_react33 = require("react");
16667
+ var import_react31 = require("react");
16560
16668
  var import_panels_shared3 = require("./panels-shared-5JFNYXQ7.css");
16561
- var import_jsx_runtime26 = require("react/jsx-runtime");
16669
+ var import_jsx_runtime27 = require("react/jsx-runtime");
16562
16670
  function variablesToRows(variables) {
16563
16671
  return variables.map((v) => ({
16564
16672
  id: crypto.randomUUID(),
@@ -16596,17 +16704,17 @@ function outputName(text) {
16596
16704
  }
16597
16705
  function ModuleInterfaceContent({ settings, onSave }) {
16598
16706
  const { editable } = useCanvas();
16599
- const [variables, setVariables2] = (0, import_react33.useState)(
16707
+ const [variables, setVariables2] = (0, import_react31.useState)(
16600
16708
  () => variablesToRows(settings.variables)
16601
16709
  );
16602
- const [outputs, setOutputs2] = (0, import_react33.useState)(() => outputsToRows(settings.outputs));
16603
- const updateVariable = (0, import_react33.useCallback)(
16710
+ const [outputs, setOutputs2] = (0, import_react31.useState)(() => outputsToRows(settings.outputs));
16711
+ const updateVariable = (0, import_react31.useCallback)(
16604
16712
  (index, field, value) => {
16605
16713
  setVariables2((prev) => prev.map((v, i) => i === index ? { ...v, [field]: value } : v));
16606
16714
  },
16607
16715
  []
16608
16716
  );
16609
- const addVariable = (0, import_react33.useCallback)(() => {
16717
+ const addVariable = (0, import_react31.useCallback)(() => {
16610
16718
  setVariables2((prev) => [
16611
16719
  ...prev,
16612
16720
  {
@@ -16624,7 +16732,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
16624
16732
  }
16625
16733
  ]);
16626
16734
  }, []);
16627
- const addValidation = (0, import_react33.useCallback)((index) => {
16735
+ const addValidation = (0, import_react31.useCallback)((index) => {
16628
16736
  setVariables2(
16629
16737
  (prev) => prev.map(
16630
16738
  (v, i) => i === index ? {
@@ -16637,14 +16745,14 @@ function ModuleInterfaceContent({ settings, onSave }) {
16637
16745
  )
16638
16746
  );
16639
16747
  }, []);
16640
- const removeValidation = (0, import_react33.useCallback)((index, vIndex) => {
16748
+ const removeValidation = (0, import_react31.useCallback)((index, vIndex) => {
16641
16749
  setVariables2(
16642
16750
  (prev) => prev.map(
16643
16751
  (v, i) => i === index ? { ...v, validation: v.validation.filter((_, j) => j !== vIndex) } : v
16644
16752
  )
16645
16753
  );
16646
16754
  }, []);
16647
- const updateValidation = (0, import_react33.useCallback)(
16755
+ const updateValidation = (0, import_react31.useCallback)(
16648
16756
  (index, vIndex, field, value) => {
16649
16757
  setVariables2(
16650
16758
  (prev) => prev.map(
@@ -16659,19 +16767,19 @@ function ModuleInterfaceContent({ settings, onSave }) {
16659
16767
  },
16660
16768
  []
16661
16769
  );
16662
- const updateOutput = (0, import_react33.useCallback)(
16770
+ const updateOutput = (0, import_react31.useCallback)(
16663
16771
  (index, field, value) => {
16664
16772
  setOutputs2((prev) => prev.map((o, i) => i === index ? { ...o, [field]: value } : o));
16665
16773
  },
16666
16774
  []
16667
16775
  );
16668
- const addOutput = (0, import_react33.useCallback)((name, value) => {
16776
+ const addOutput = (0, import_react31.useCallback)((name, value) => {
16669
16777
  setOutputs2((prev) => [
16670
16778
  ...prev,
16671
16779
  { id: crypto.randomUUID(), name, value, description: "", sensitive: false, depends_on: [] }
16672
16780
  ]);
16673
16781
  }, []);
16674
- const toggleDependsOn = (0, import_react33.useCallback)((index, dep) => {
16782
+ const toggleDependsOn = (0, import_react31.useCallback)((index, dep) => {
16675
16783
  setOutputs2(
16676
16784
  (prev) => prev.map((o, i) => {
16677
16785
  if (i !== index) return o;
@@ -16688,7 +16796,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
16688
16796
  const unnamedOutput = outputs.some((o) => !o.name.trim() || !o.value.trim());
16689
16797
  const hasErrors = variableDupes.size > 0 || outputDupes.size > 0 || unnamedOutput;
16690
16798
  const { status: updateStatus, handleUpdate } = useUpdateState(
16691
- (0, import_react33.useCallback)(async () => {
16799
+ (0, import_react31.useCallback)(async () => {
16692
16800
  if (hasErrors) return;
16693
16801
  const variableDefs = variables.filter((v) => v.name.trim()).map((v) => {
16694
16802
  const validation = v.validation.map((b) => ({ condition: b.condition.trim(), error_message: b.error_message.trim() })).filter((b) => b.condition || b.error_message);
@@ -16719,13 +16827,13 @@ function ModuleInterfaceContent({ settings, onSave }) {
16719
16827
  }, [variables, outputs, hasErrors, onSave])
16720
16828
  );
16721
16829
  const exposable = settings.call_outputs.filter((text) => !outputs.some((o) => o.value === text));
16722
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
16723
- /* @__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." }),
16724
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h4", { className: "lace-panel-section-title", children: "Inputs" }),
16725
- variables.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-hint", children: "No variables." }),
16726
- variables.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
16727
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-actions", children: [
16728
- 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)(
16729
16837
  import_ui12.Input,
16730
16838
  {
16731
16839
  label: "Name",
@@ -16736,11 +16844,11 @@ function ModuleInterfaceContent({ settings, onSave }) {
16736
16844
  mono: true,
16737
16845
  error: variableDupes.has(i)
16738
16846
  }
16739
- ) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Identifier, { className: "lace-panel-row-card__name", text: v.name }),
16740
- 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)(
16741
16849
  import_ui12.IconButton,
16742
16850
  {
16743
- icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CanvasIcon, { name: "close" }),
16851
+ icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CanvasIcon, { name: "close" }),
16744
16852
  "aria-label": `Remove variable ${v.name}`,
16745
16853
  size: "md",
16746
16854
  tooltipPlacement: "bottom-end",
@@ -16748,8 +16856,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
16748
16856
  }
16749
16857
  )
16750
16858
  ] }),
16751
- variableDupes.has(i) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-row-error", children: "Duplicate variable name" }),
16752
- /* @__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)(
16753
16861
  import_ui12.Input,
16754
16862
  {
16755
16863
  label: "Type",
@@ -16761,8 +16869,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
16761
16869
  readOnly: !editable
16762
16870
  }
16763
16871
  ) }),
16764
- 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 }) }),
16765
- /* @__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)(
16766
16874
  import_ui12.Textarea,
16767
16875
  {
16768
16876
  label: "Description",
@@ -16774,9 +16882,9 @@ function ModuleInterfaceContent({ settings, onSave }) {
16774
16882
  readOnly: !editable
16775
16883
  }
16776
16884
  ) }),
16777
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-actions", children: [
16778
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
16779
- /* @__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)(
16780
16888
  "input",
16781
16889
  {
16782
16890
  type: "checkbox",
@@ -16785,10 +16893,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
16785
16893
  disabled: !editable
16786
16894
  }
16787
16895
  ),
16788
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Required" })
16896
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Required" })
16789
16897
  ] }),
16790
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
16791
- /* @__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)(
16792
16900
  "input",
16793
16901
  {
16794
16902
  type: "checkbox",
@@ -16797,10 +16905,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
16797
16905
  disabled: !editable
16798
16906
  }
16799
16907
  ),
16800
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Ephemeral" })
16908
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Ephemeral" })
16801
16909
  ] }),
16802
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
16803
- /* @__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)(
16804
16912
  "input",
16805
16913
  {
16806
16914
  type: "checkbox",
@@ -16809,10 +16917,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
16809
16917
  disabled: !editable
16810
16918
  }
16811
16919
  ),
16812
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Sensitive" })
16920
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Sensitive" })
16813
16921
  ] }),
16814
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
16815
- /* @__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)(
16816
16924
  "input",
16817
16925
  {
16818
16926
  type: "checkbox",
@@ -16821,13 +16929,13 @@ function ModuleInterfaceContent({ settings, onSave }) {
16821
16929
  disabled: !editable
16822
16930
  }
16823
16931
  ),
16824
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Nullable" })
16932
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Nullable" })
16825
16933
  ] })
16826
16934
  ] }),
16827
- (v.validation.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-content", children: [
16828
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-subsection-label", children: "Validation" }),
16829
- v.validation.map((block, j) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-validation-block", children: [
16830
- /* @__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)(
16831
16939
  import_ui12.Input,
16832
16940
  {
16833
16941
  value: block.condition,
@@ -16839,7 +16947,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
16839
16947
  readOnly: !editable
16840
16948
  }
16841
16949
  ),
16842
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16950
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16843
16951
  import_ui12.Input,
16844
16952
  {
16845
16953
  value: block.error_message,
@@ -16850,10 +16958,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
16850
16958
  readOnly: !editable
16851
16959
  }
16852
16960
  ),
16853
- editable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16961
+ editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16854
16962
  import_ui12.IconButton,
16855
16963
  {
16856
- icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CanvasIcon, { name: "close" }),
16964
+ icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CanvasIcon, { name: "close" }),
16857
16965
  "aria-label": "Remove validation rule",
16858
16966
  size: "md",
16859
16967
  tooltipPlacement: "bottom-end",
@@ -16861,15 +16969,15 @@ function ModuleInterfaceContent({ settings, onSave }) {
16861
16969
  }
16862
16970
  )
16863
16971
  ] }, block.id)),
16864
- 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" })
16865
16973
  ] })
16866
16974
  ] }, v.id)),
16867
- editable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_ui12.Button, { variant: "secondary", size: "sm", onClick: addVariable, children: "+ Add variable" }),
16868
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h4", { className: "lace-panel-section-title", children: "Outputs" }),
16869
- outputs.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-hint", children: "No outputs." }),
16870
- outputs.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
16871
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-actions", children: [
16872
- /* @__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)(
16873
16981
  import_ui12.Input,
16874
16982
  {
16875
16983
  label: "Name",
@@ -16882,10 +16990,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
16882
16990
  error: outputDupes.has(i) || editable && !o.name.trim()
16883
16991
  }
16884
16992
  ),
16885
- editable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
16993
+ editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16886
16994
  import_ui12.IconButton,
16887
16995
  {
16888
- icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CanvasIcon, { name: "close" }),
16996
+ icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CanvasIcon, { name: "close" }),
16889
16997
  "aria-label": `Remove output ${o.name}`,
16890
16998
  size: "md",
16891
16999
  tooltipPlacement: "bottom-end",
@@ -16893,7 +17001,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
16893
17001
  }
16894
17002
  )
16895
17003
  ] }),
16896
- /* @__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)(
16897
17005
  import_ui12.Input,
16898
17006
  {
16899
17007
  label: "Value",
@@ -16906,7 +17014,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
16906
17014
  error: editable && !o.value.trim()
16907
17015
  }
16908
17016
  ) }),
16909
- /* @__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)(
16910
17018
  import_ui12.Textarea,
16911
17019
  {
16912
17020
  label: "Description",
@@ -16918,8 +17026,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
16918
17026
  readOnly: !editable
16919
17027
  }
16920
17028
  ) }),
16921
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "lace-panel-checkbox-row", children: [
16922
- /* @__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)(
16923
17031
  "input",
16924
17032
  {
16925
17033
  type: "checkbox",
@@ -16928,12 +17036,12 @@ function ModuleInterfaceContent({ settings, onSave }) {
16928
17036
  disabled: !editable
16929
17037
  }
16930
17038
  ),
16931
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Sensitive" })
17039
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: "Sensitive" })
16932
17040
  ] }),
16933
- (o.depends_on.length > 0 || editable && settings.dependency_options.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-content", children: [
16934
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lace-panel-subsection-label", children: "Depends on" }),
16935
- !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: [
16936
- /* @__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)(
16937
17045
  "input",
16938
17046
  {
16939
17047
  type: "checkbox",
@@ -16941,14 +17049,14 @@ function ModuleInterfaceContent({ settings, onSave }) {
16941
17049
  onChange: () => toggleDependsOn(i, dep)
16942
17050
  }
16943
17051
  ),
16944
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Identifier, { text: dep })
17052
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Identifier, { text: dep })
16945
17053
  ] }, dep))
16946
17054
  ] }),
16947
- 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." })
16948
17056
  ] }, o.id)),
16949
- editable && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lace-panel-row-actions", children: [
16950
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_ui12.Button, { variant: "secondary", size: "sm", onClick: () => addOutput("", ""), children: "+ Add output" }),
16951
- 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)(
16952
17060
  import_ui12.Select,
16953
17061
  {
16954
17062
  "aria-label": "Expose a call's output",
@@ -16964,7 +17072,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
16964
17072
  }
16965
17073
  )
16966
17074
  ] }),
16967
- editable && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
17075
+ editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
16968
17076
  UpdateButton,
16969
17077
  {
16970
17078
  status: updateStatus,
@@ -16977,7 +17085,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
16977
17085
  ] });
16978
17086
  }
16979
17087
  function ModuleInterfacePanel({ onClose, ...content }) {
16980
- 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 }) });
16981
17089
  }
16982
17090
 
16983
17091
  // src/components/panels/module-actions.ts
@@ -17095,9 +17203,9 @@ var import_panels_shared7 = require("./panels-shared-5JFNYXQ7.css");
17095
17203
 
17096
17204
  // src/components/panels/ProvidersPanel.tsx
17097
17205
  var import_ui13 = require("@lace-cloud/ui");
17098
- var import_react34 = require("react");
17206
+ var import_react32 = require("react");
17099
17207
  var import_panels_shared4 = require("./panels-shared-5JFNYXQ7.css");
17100
- var import_jsx_runtime27 = require("react/jsx-runtime");
17208
+ var import_jsx_runtime28 = require("react/jsx-runtime");
17101
17209
  function toRows2(providers) {
17102
17210
  if (!providers || providers.length === 0) return [];
17103
17211
  return providers.map((p) => ({
@@ -17125,8 +17233,8 @@ function fromRows2(rows) {
17125
17233
  }
17126
17234
  function ProvidersContent({ providers, onSave }) {
17127
17235
  const { editable } = useCanvas();
17128
- const [rows, setRows] = (0, import_react34.useState)(() => toRows2(providers));
17129
- const addProvider = (0, import_react34.useCallback)(() => {
17236
+ const [rows, setRows] = (0, import_react32.useState)(() => toRows2(providers));
17237
+ const addProvider = (0, import_react32.useCallback)(() => {
17130
17238
  setRows((prev) => [
17131
17239
  ...prev,
17132
17240
  {
@@ -17138,16 +17246,16 @@ function ProvidersContent({ providers, onSave }) {
17138
17246
  }
17139
17247
  ]);
17140
17248
  }, []);
17141
- const removeProvider = (0, import_react34.useCallback)((index) => {
17249
+ const removeProvider = (0, import_react32.useCallback)((index) => {
17142
17250
  setRows((prev) => prev.filter((_, i) => i !== index));
17143
17251
  }, []);
17144
- const updateField = (0, import_react34.useCallback)((index, field, value) => {
17252
+ const updateField = (0, import_react32.useCallback)((index, field, value) => {
17145
17253
  setRows((prev) => prev.map((r, i) => i === index ? { ...r, [field]: value } : r));
17146
17254
  }, []);
17147
- const updateBlocks = (0, import_react34.useCallback)((index, blocks) => {
17255
+ const updateBlocks = (0, import_react32.useCallback)((index, blocks) => {
17148
17256
  setRows((prev) => prev.map((r, i) => i === index ? { ...r, blocks } : r));
17149
17257
  }, []);
17150
- const addConfigEntry = (0, import_react34.useCallback)((providerIndex) => {
17258
+ const addConfigEntry = (0, import_react32.useCallback)((providerIndex) => {
17151
17259
  setRows(
17152
17260
  (prev) => prev.map(
17153
17261
  (r, i) => i === providerIndex ? {
@@ -17157,14 +17265,14 @@ function ProvidersContent({ providers, onSave }) {
17157
17265
  )
17158
17266
  );
17159
17267
  }, []);
17160
- const removeConfigEntry = (0, import_react34.useCallback)((providerIndex, entryIndex) => {
17268
+ const removeConfigEntry = (0, import_react32.useCallback)((providerIndex, entryIndex) => {
17161
17269
  setRows(
17162
17270
  (prev) => prev.map(
17163
17271
  (r, i) => i === providerIndex ? { ...r, configEntries: r.configEntries.filter((_, ei) => ei !== entryIndex) } : r
17164
17272
  )
17165
17273
  );
17166
17274
  }, []);
17167
- const updateConfigEntry = (0, import_react34.useCallback)(
17275
+ const updateConfigEntry = (0, import_react32.useCallback)(
17168
17276
  (providerIndex, entryIndex, field, value) => {
17169
17277
  setRows(
17170
17278
  (prev) => prev.map(
@@ -17180,14 +17288,14 @@ function ProvidersContent({ providers, onSave }) {
17180
17288
  []
17181
17289
  );
17182
17290
  const { status: updateStatus, handleUpdate } = useUpdateState(
17183
- (0, import_react34.useCallback)(async () => {
17291
+ (0, import_react32.useCallback)(async () => {
17184
17292
  await onSave(fromRows2(rows));
17185
17293
  }, [onSave, rows])
17186
17294
  );
17187
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
17188
- rows.map((row, pi) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
17189
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "lace-panel-row-actions", children: [
17190
- /* @__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)(
17191
17299
  import_ui13.Input,
17192
17300
  {
17193
17301
  value: row.name,
@@ -17197,7 +17305,7 @@ function ProvidersContent({ providers, onSave }) {
17197
17305
  readOnly: !editable
17198
17306
  }
17199
17307
  ),
17200
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
17308
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17201
17309
  import_ui13.Input,
17202
17310
  {
17203
17311
  value: row.alias,
@@ -17207,10 +17315,10 @@ function ProvidersContent({ providers, onSave }) {
17207
17315
  readOnly: !editable
17208
17316
  }
17209
17317
  ),
17210
- editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
17318
+ editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17211
17319
  import_ui13.IconButton,
17212
17320
  {
17213
- icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CanvasIcon, { name: "close" }),
17321
+ icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CanvasIcon, { name: "close" }),
17214
17322
  "aria-label": "Remove provider",
17215
17323
  size: "md",
17216
17324
  tooltipPlacement: "bottom-end",
@@ -17218,9 +17326,9 @@ function ProvidersContent({ providers, onSave }) {
17218
17326
  }
17219
17327
  )
17220
17328
  ] }),
17221
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-row-sublabel", children: "Config" }),
17222
- row.configEntries.map((entry, ei) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "lace-panel-row-actions", children: [
17223
- /* @__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)(
17224
17332
  import_ui13.Input,
17225
17333
  {
17226
17334
  value: entry.key,
@@ -17230,7 +17338,7 @@ function ProvidersContent({ providers, onSave }) {
17230
17338
  readOnly: !editable
17231
17339
  }
17232
17340
  ),
17233
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
17341
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17234
17342
  import_ui13.Input,
17235
17343
  {
17236
17344
  value: entry.value,
@@ -17240,10 +17348,10 @@ function ProvidersContent({ providers, onSave }) {
17240
17348
  readOnly: !editable
17241
17349
  }
17242
17350
  ),
17243
- editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
17351
+ editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17244
17352
  import_ui13.IconButton,
17245
17353
  {
17246
- icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CanvasIcon, { name: "close" }),
17354
+ icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CanvasIcon, { name: "close" }),
17247
17355
  "aria-label": "Remove config key",
17248
17356
  size: "md",
17249
17357
  tooltipPlacement: "bottom-end",
@@ -17251,10 +17359,10 @@ function ProvidersContent({ providers, onSave }) {
17251
17359
  }
17252
17360
  )
17253
17361
  ] }, entry.id)),
17254
- editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_ui13.Button, { variant: "secondary", size: "sm", onClick: () => addConfigEntry(pi), children: "+ Add config key" }),
17255
- (row.blocks.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
17256
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
17257
- /* @__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)(
17258
17366
  BlockEditor,
17259
17367
  {
17260
17368
  blocks: row.blocks,
@@ -17264,21 +17372,21 @@ function ProvidersContent({ providers, onSave }) {
17264
17372
  )
17265
17373
  ] })
17266
17374
  ] }, row.id)),
17267
- editable && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
17268
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_ui13.Button, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
17269
- /* @__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 })
17270
17378
  ] })
17271
17379
  ] });
17272
17380
  }
17273
17381
  function ProvidersPanel({ providers, onSave, onClose }) {
17274
- 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 }) });
17275
17383
  }
17276
17384
 
17277
17385
  // src/components/panels/ResourcesPanel.tsx
17278
17386
  var import_ui14 = require("@lace-cloud/ui");
17279
- var import_react35 = require("react");
17387
+ var import_react33 = require("react");
17280
17388
  var import_panels_shared5 = require("./panels-shared-5JFNYXQ7.css");
17281
- var import_jsx_runtime28 = require("react/jsx-runtime");
17389
+ var import_jsx_runtime29 = require("react/jsx-runtime");
17282
17390
  function ResourcesContent({
17283
17391
  resources,
17284
17392
  dependencyOptions,
@@ -17288,9 +17396,9 @@ function ResourcesContent({
17288
17396
  onAdd
17289
17397
  }) {
17290
17398
  const { editable } = useCanvas();
17291
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
17292
- resources.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "lace-panel-hint", children: "No resources or data sources." }),
17293
- 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)(
17294
17402
  ResourceCard,
17295
17403
  {
17296
17404
  resource,
@@ -17303,7 +17411,7 @@ function ResourcesContent({
17303
17411
  },
17304
17412
  JSON.stringify(resource)
17305
17413
  )),
17306
- editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(NewResourceRow, { managed, onAdd })
17414
+ editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(NewResourceRow, { managed, onAdd })
17307
17415
  ] });
17308
17416
  }
17309
17417
  var MANAGED_OPTION = { value: "resource", label: "Resource" };
@@ -17313,14 +17421,14 @@ function NewResourceRow({
17313
17421
  onAdd
17314
17422
  }) {
17315
17423
  const options = managed ? [MANAGED_OPTION, DATA_OPTION] : [DATA_OPTION];
17316
- const [chosen, setChosen] = (0, import_react35.useState)("resource");
17424
+ const [chosen, setChosen] = (0, import_react33.useState)("resource");
17317
17425
  const kind = managed ? chosen : "data";
17318
- const [type, setType] = (0, import_react35.useState)("");
17319
- const [name, setName] = (0, import_react35.useState)("");
17320
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-card", children: [
17321
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "lace-panel-subsection-label", children: "Add a resource" }),
17322
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-actions", children: [
17323
- /* @__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)(
17324
17432
  import_ui14.Select,
17325
17433
  {
17326
17434
  "aria-label": "New resource kind",
@@ -17329,7 +17437,7 @@ function NewResourceRow({
17329
17437
  onChange: (e) => setChosen(e.target.value === "data" ? "data" : "resource")
17330
17438
  }
17331
17439
  ),
17332
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17440
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17333
17441
  import_ui14.Input,
17334
17442
  {
17335
17443
  value: type,
@@ -17339,7 +17447,7 @@ function NewResourceRow({
17339
17447
  mono: true
17340
17448
  }
17341
17449
  ),
17342
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17450
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17343
17451
  import_ui14.Input,
17344
17452
  {
17345
17453
  value: name,
@@ -17349,7 +17457,7 @@ function NewResourceRow({
17349
17457
  mono: true
17350
17458
  }
17351
17459
  ),
17352
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17460
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17353
17461
  import_ui14.Button,
17354
17462
  {
17355
17463
  variant: "secondary",
@@ -17367,8 +17475,8 @@ function NewResourceRow({
17367
17475
  ] });
17368
17476
  }
17369
17477
  function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemove }) {
17370
- const [draft, setDraft] = (0, import_react35.useState)(resource);
17371
- const set = (0, import_react35.useCallback)(
17478
+ const [draft, setDraft] = (0, import_react33.useState)(resource);
17479
+ const set = (0, import_react33.useCallback)(
17372
17480
  (field, value) => setDraft((prev) => ({ ...prev, [field]: value })),
17373
17481
  []
17374
17482
  );
@@ -17379,7 +17487,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17379
17487
  const argumentDupes = findDuplicateIndices(draft.arguments, (a) => a.name);
17380
17488
  const hasErrors = argumentDupes.size > 0 || draft.arguments.some((a) => !a.name.trim());
17381
17489
  const { status, handleUpdate } = useUpdateState(
17382
- (0, import_react35.useCallback)(async () => {
17490
+ (0, import_react33.useCallback)(async () => {
17383
17491
  if (hasErrors) return;
17384
17492
  await onUpdate(resource, draft);
17385
17493
  }, [onUpdate, resource, draft, hasErrors])
@@ -17389,20 +17497,20 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17389
17497
  { field: "for_each", placeholder: "e.g. var.names" },
17390
17498
  { field: "provider", placeholder: "e.g. aws.west" }
17391
17499
  ];
17392
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
17393
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-actions", children: [
17394
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_ui14.Badge, { variant: resource.kind === "data" ? "info" : "neutral", children: resource.kind === "data" ? "data" : "resource" }),
17395
- /* @__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)(
17396
17504
  Identifier,
17397
17505
  {
17398
17506
  className: "lace-panel-row-card__name",
17399
17507
  text: `${resource.type}.${resource.name}`
17400
17508
  }
17401
17509
  ),
17402
- editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17510
+ editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17403
17511
  import_ui14.IconButton,
17404
17512
  {
17405
- icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CanvasIcon, { name: "close" }),
17513
+ icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CanvasIcon, { name: "close" }),
17406
17514
  "aria-label": `Remove ${resource.type}.${resource.name}`,
17407
17515
  size: "md",
17408
17516
  tooltipPlacement: "bottom-end",
@@ -17411,7 +17519,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17411
17519
  )
17412
17520
  ] }),
17413
17521
  metaArguments.map(
17414
- ({ 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)(
17415
17523
  import_ui14.Input,
17416
17524
  {
17417
17525
  label: field,
@@ -17424,11 +17532,11 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17424
17532
  }
17425
17533
  ) }, field) : null
17426
17534
  ),
17427
- /* @__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" }),
17428
17536
  draft.arguments.map((argument, i) => (
17429
17537
  // biome-ignore lint/suspicious/noArrayIndexKey: argument rows are positional while edited
17430
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "lace-panel-row-actions", children: [
17431
- /* @__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)(
17432
17540
  import_ui14.Input,
17433
17541
  {
17434
17542
  value: argument.name,
@@ -17440,7 +17548,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17440
17548
  error: argumentDupes.has(i)
17441
17549
  }
17442
17550
  ),
17443
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17551
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17444
17552
  import_ui14.Input,
17445
17553
  {
17446
17554
  value: argument.value,
@@ -17451,10 +17559,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17451
17559
  readOnly: !editable
17452
17560
  }
17453
17561
  ),
17454
- editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17562
+ editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17455
17563
  import_ui14.IconButton,
17456
17564
  {
17457
- icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CanvasIcon, { name: "close" }),
17565
+ icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CanvasIcon, { name: "close" }),
17458
17566
  "aria-label": `Remove ${argument.name || "the argument"}`,
17459
17567
  size: "md",
17460
17568
  tooltipPlacement: "bottom-end",
@@ -17466,7 +17574,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17466
17574
  )
17467
17575
  ] }, i)
17468
17576
  )),
17469
- editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17577
+ editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17470
17578
  import_ui14.Button,
17471
17579
  {
17472
17580
  variant: "secondary",
@@ -17475,9 +17583,9 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17475
17583
  children: "+ Add argument"
17476
17584
  }
17477
17585
  ),
17478
- (draft.blocks.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
17479
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
17480
- /* @__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)(
17481
17589
  BlockEditor,
17482
17590
  {
17483
17591
  blocks: draft.blocks,
@@ -17486,10 +17594,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17486
17594
  }
17487
17595
  )
17488
17596
  ] }),
17489
- (draft.depends_on.length > 0 || editable && dependencyOptions.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
17490
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "lace-panel-row-sublabel", children: "Depends on" }),
17491
- !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: [
17492
- /* @__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)(
17493
17601
  "input",
17494
17602
  {
17495
17603
  type: "checkbox",
@@ -17500,10 +17608,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17500
17608
  )
17501
17609
  }
17502
17610
  ),
17503
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Identifier, { text: dep })
17611
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Identifier, { text: dep })
17504
17612
  ] }, dep))
17505
17613
  ] }),
17506
- editable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
17614
+ editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17507
17615
  UpdateButton,
17508
17616
  {
17509
17617
  status,
@@ -17518,13 +17626,13 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
17518
17626
 
17519
17627
  // src/components/panels/TerraformConfigPanel.tsx
17520
17628
  var import_ui15 = require("@lace-cloud/ui");
17521
- var import_react36 = require("react");
17629
+ var import_react34 = require("react");
17522
17630
  var import_panels_shared6 = require("./panels-shared-5JFNYXQ7.css");
17523
- var import_jsx_runtime29 = require("react/jsx-runtime");
17631
+ var import_jsx_runtime30 = require("react/jsx-runtime");
17524
17632
  function TerraformConfigContent({ terraform, onSave }) {
17525
17633
  const { editable } = useCanvas();
17526
- const [requiredVersion, setRequiredVersion] = (0, import_react36.useState)(terraform?.required_version ?? "");
17527
- 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)(() => {
17528
17636
  if (!terraform?.required_providers) return [];
17529
17637
  return terraform.required_providers.map((req) => ({
17530
17638
  id: crypto.randomUUID(),
@@ -17534,23 +17642,23 @@ function TerraformConfigContent({ terraform, onSave }) {
17534
17642
  aliases: (req.configuration_aliases ?? []).join(", ")
17535
17643
  }));
17536
17644
  });
17537
- const addProvider = (0, import_react36.useCallback)(() => {
17645
+ const addProvider = (0, import_react34.useCallback)(() => {
17538
17646
  setProviders2((prev) => [
17539
17647
  ...prev,
17540
17648
  { id: crypto.randomUUID(), name: "", source: "", version: "", aliases: "" }
17541
17649
  ]);
17542
17650
  }, []);
17543
- const removeProvider = (0, import_react36.useCallback)((index) => {
17651
+ const removeProvider = (0, import_react34.useCallback)((index) => {
17544
17652
  setProviders2((prev) => prev.filter((_, i) => i !== index));
17545
17653
  }, []);
17546
- const updateProvider = (0, import_react36.useCallback)(
17654
+ const updateProvider = (0, import_react34.useCallback)(
17547
17655
  (index, field, value) => {
17548
17656
  setProviders2((prev) => prev.map((p, i) => i === index ? { ...p, [field]: value } : p));
17549
17657
  },
17550
17658
  []
17551
17659
  );
17552
17660
  const { status: updateStatus, handleUpdate } = useUpdateState(
17553
- (0, import_react36.useCallback)(async () => {
17661
+ (0, import_react34.useCallback)(async () => {
17554
17662
  const block = {
17555
17663
  required_version: requiredVersion.trim() || "",
17556
17664
  required_providers: providers.filter((p) => p.name.trim()).map((p) => ({
@@ -17563,9 +17671,9 @@ function TerraformConfigContent({ terraform, onSave }) {
17563
17671
  await onSave(block);
17564
17672
  }, [onSave, requiredVersion, providers])
17565
17673
  );
17566
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
17567
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h4", { className: "lace-panel-section-title", children: "Required Version" }),
17568
- /* @__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)(
17569
17677
  import_ui15.Input,
17570
17678
  {
17571
17679
  value: requiredVersion,
@@ -17575,10 +17683,10 @@ function TerraformConfigContent({ terraform, onSave }) {
17575
17683
  readOnly: !editable
17576
17684
  }
17577
17685
  ) }),
17578
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h4", { className: "lace-panel-section-title", children: "Required Providers" }),
17579
- providers.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
17580
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "lace-panel-row-actions", children: [
17581
- /* @__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)(
17582
17690
  import_ui15.Input,
17583
17691
  {
17584
17692
  value: p.name,
@@ -17588,10 +17696,10 @@ function TerraformConfigContent({ terraform, onSave }) {
17588
17696
  readOnly: !editable
17589
17697
  }
17590
17698
  ),
17591
- editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
17699
+ editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17592
17700
  import_ui15.IconButton,
17593
17701
  {
17594
- icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CanvasIcon, { name: "close" }),
17702
+ icon: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CanvasIcon, { name: "close" }),
17595
17703
  "aria-label": "Remove provider",
17596
17704
  size: "md",
17597
17705
  tooltipPlacement: "bottom-end",
@@ -17599,7 +17707,7 @@ function TerraformConfigContent({ terraform, onSave }) {
17599
17707
  }
17600
17708
  )
17601
17709
  ] }),
17602
- /* @__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)(
17603
17711
  import_ui15.Input,
17604
17712
  {
17605
17713
  value: p.source,
@@ -17609,7 +17717,7 @@ function TerraformConfigContent({ terraform, onSave }) {
17609
17717
  readOnly: !editable
17610
17718
  }
17611
17719
  ) }),
17612
- /* @__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)(
17613
17721
  import_ui15.Input,
17614
17722
  {
17615
17723
  value: p.version,
@@ -17619,7 +17727,7 @@ function TerraformConfigContent({ terraform, onSave }) {
17619
17727
  readOnly: !editable
17620
17728
  }
17621
17729
  ) }),
17622
- (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)(
17623
17731
  import_ui15.Input,
17624
17732
  {
17625
17733
  value: p.aliases,
@@ -17632,39 +17740,39 @@ function TerraformConfigContent({ terraform, onSave }) {
17632
17740
  }
17633
17741
  ) })
17634
17742
  ] }, p.id)),
17635
- editable && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_ui15.Button, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
17636
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h4", { className: "lace-panel-section-title", children: "Backend" }),
17637
- /* @__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." }),
17638
- 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 })
17639
17747
  ] });
17640
17748
  }
17641
17749
  function TerraformConfigPanel({ terraform, onSave, onClose }) {
17642
- 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 }) });
17643
17751
  }
17644
17752
 
17645
17753
  // src/components/panels/ModuleDetails.tsx
17646
- var import_jsx_runtime30 = require("react/jsx-runtime");
17754
+ var import_jsx_runtime31 = require("react/jsx-runtime");
17647
17755
  function assertApplied(result) {
17648
17756
  if (!result?.success) throw new Error("apply failed");
17649
17757
  }
17650
17758
  var keyOf = (value) => JSON.stringify(value);
17651
17759
  function ModuleDetails({ moduleKey, open = [] }) {
17652
17760
  const { bundle, runner, editable } = useCanvas();
17653
- 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]);
17654
17762
  if (!settings) return null;
17655
- 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 });
17656
17764
  const apply2 = async (actions) => {
17657
17765
  if (!editable) return;
17658
17766
  assertApplied(await runner.apply(actions));
17659
17767
  };
17660
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
17661
- /* @__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)(
17662
17770
  AccordionSection,
17663
17771
  {
17664
17772
  title: "Resources",
17665
17773
  defaultOpen: open.includes("Resources"),
17666
17774
  badge: `(${settings.resources.length})`,
17667
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17775
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
17668
17776
  ResourcesContent,
17669
17777
  {
17670
17778
  resources: settings.resources,
@@ -17677,7 +17785,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
17677
17785
  )
17678
17786
  }
17679
17787
  ),
17680
- /* @__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)(
17681
17789
  ModuleInterfaceContent,
17682
17790
  {
17683
17791
  settings,
@@ -17685,13 +17793,13 @@ function ModuleDetails({ moduleKey, open = [] }) {
17685
17793
  },
17686
17794
  keyOf([settings.variables, settings.outputs, settings.call_outputs])
17687
17795
  ) }),
17688
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17796
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
17689
17797
  AccordionSection,
17690
17798
  {
17691
17799
  title: "Moved and import blocks",
17692
17800
  defaultOpen: open.includes("Moved and import blocks"),
17693
17801
  badge: settings.directives.length > 0 ? `(${settings.directives.length})` : void 0,
17694
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17802
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
17695
17803
  DirectivesContent,
17696
17804
  {
17697
17805
  directives: settings.directives,
@@ -17701,7 +17809,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
17701
17809
  )
17702
17810
  }
17703
17811
  ),
17704
- /* @__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)(
17705
17813
  LocalsContent,
17706
17814
  {
17707
17815
  locals: settings.locals,
@@ -17709,7 +17817,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
17709
17817
  },
17710
17818
  keyOf(settings.locals)
17711
17819
  ) }),
17712
- /* @__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)(
17713
17821
  ProvidersContent,
17714
17822
  {
17715
17823
  providers: settings.providers,
@@ -17717,7 +17825,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
17717
17825
  },
17718
17826
  keyOf(settings.providers)
17719
17827
  ) }),
17720
- /* @__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)(
17721
17829
  TerraformConfigContent,
17722
17830
  {
17723
17831
  terraform: settings.terraform,
@@ -17732,11 +17840,11 @@ function DirectivesContent({
17732
17840
  onSave
17733
17841
  }) {
17734
17842
  const { editable } = useCanvas();
17735
- const [blocks, setBlocks] = (0, import_react37.useState)(directives);
17843
+ const [blocks, setBlocks] = (0, import_react35.useState)(directives);
17736
17844
  const { status, handleUpdate } = useUpdateState(() => onSave(blocks));
17737
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
17738
- blocks.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-hint", children: "No moved or import blocks." }),
17739
- /* @__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)(
17740
17848
  BlockEditor,
17741
17849
  {
17742
17850
  blocks,
@@ -17748,7 +17856,7 @@ function DirectivesContent({
17748
17856
  ]
17749
17857
  }
17750
17858
  ),
17751
- editable && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
17859
+ editable && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
17752
17860
  UpdateButton,
17753
17861
  {
17754
17862
  status,
@@ -17761,26 +17869,26 @@ function DirectivesContent({
17761
17869
  function ReferenceDetails({ settings }) {
17762
17870
  const reference = settings.reference;
17763
17871
  if (!reference) return null;
17764
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
17765
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(AccordionSection, { title: "Source", defaultOpen: true, children: [
17766
- /* @__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." }),
17767
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "lace-panel-row-actions lace-panel-row-actions--stacked", children: [
17768
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_ui16.Input, { label: "Source", value: reference.source, fullWidth: true, mono: true, readOnly: true }),
17769
- /* @__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 })
17770
17878
  ] })
17771
17879
  ] }),
17772
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(AccordionSection, { title: "Interface", defaultOpen: true, children: [
17773
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h4", { className: "lace-panel-section-title", children: "Inputs" }),
17774
- settings.variables.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "lace-panel-hint", children: "The IR holds no interface for this reference." }),
17775
- 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)),
17776
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h4", { className: "lace-panel-section-title", children: "Outputs" }),
17777
- 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))
17778
17886
  ] })
17779
17887
  ] });
17780
17888
  }
17781
17889
 
17782
17890
  // src/components/panels/ModuleConfigPanel.tsx
17783
- var import_jsx_runtime31 = require("react/jsx-runtime");
17891
+ var import_jsx_runtime32 = require("react/jsx-runtime");
17784
17892
  var MODE_ITEMS = [
17785
17893
  { value: "literal", label: "Lit" },
17786
17894
  { value: "variable", label: "Var" },
@@ -17805,11 +17913,11 @@ function toInputMode(mode) {
17805
17913
  }
17806
17914
  function ModuleConfigPanel({ instance_id, onClose, onModified }) {
17807
17915
  const { editable, bundle, runner } = useCanvas();
17808
- const config = (0, import_react38.useMemo)(
17916
+ const config = (0, import_react36.useMemo)(
17809
17917
  () => (0, import_proto12.deriveNodeConfig)(bundle, instance_id),
17810
17918
  [bundle, instance_id]
17811
17919
  );
17812
- const [inputState, setInputState] = (0, import_react38.useState)({
17920
+ const [inputState, setInputState] = (0, import_react36.useState)({
17813
17921
  modes: {},
17814
17922
  values: {},
17815
17923
  variables: {},
@@ -17821,26 +17929,26 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
17821
17929
  variables: localVariables,
17822
17930
  expressions: localExpressions
17823
17931
  } = inputState;
17824
- const setLocalModes = (0, import_react38.useCallback)(
17932
+ const setLocalModes = (0, import_react36.useCallback)(
17825
17933
  (fn) => setInputState((s) => ({ ...s, modes: fn(s.modes) })),
17826
17934
  []
17827
17935
  );
17828
- const setLocalValues = (0, import_react38.useCallback)(
17936
+ const setLocalValues = (0, import_react36.useCallback)(
17829
17937
  (fn) => setInputState((s) => ({ ...s, values: fn(s.values) })),
17830
17938
  []
17831
17939
  );
17832
- const setLocalVariables = (0, import_react38.useCallback)(
17940
+ const setLocalVariables = (0, import_react36.useCallback)(
17833
17941
  (fn) => setInputState((s) => ({ ...s, variables: fn(s.variables) })),
17834
17942
  []
17835
17943
  );
17836
- const setLocalExpressions = (0, import_react38.useCallback)(
17944
+ const setLocalExpressions = (0, import_react36.useCallback)(
17837
17945
  (fn) => setInputState((s) => ({ ...s, expressions: fn(s.expressions) })),
17838
17946
  []
17839
17947
  );
17840
- const [localDependsOn, setLocalDependsOn] = (0, import_react38.useState)(/* @__PURE__ */ new Set());
17841
- const [localProviders, setLocalProviders] = (0, import_react38.useState)([]);
17842
- const [localRepetition, setLocalRepetition] = (0, import_react38.useState)({ count: "", for_each: "" });
17843
- (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)(() => {
17844
17952
  if (!config) return;
17845
17953
  const modes = {};
17846
17954
  const values = {};
@@ -17859,7 +17967,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
17859
17967
  );
17860
17968
  setLocalRepetition({ count: config.count, for_each: config.for_each });
17861
17969
  }, [config]);
17862
- const switchMode = (0, import_react38.useCallback)(
17970
+ const switchMode = (0, import_react36.useCallback)(
17863
17971
  (name, mode, input) => {
17864
17972
  setLocalModes((prev) => ({ ...prev, [name]: mode }));
17865
17973
  switch (mode) {
@@ -17887,14 +17995,14 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
17887
17995
  },
17888
17996
  [setLocalModes, setLocalValues, setLocalVariables, setLocalExpressions]
17889
17997
  );
17890
- const { requiredInputs, optionalInputs } = (0, import_react38.useMemo)(
17998
+ const { requiredInputs, optionalInputs } = (0, import_react36.useMemo)(
17891
17999
  () => ({
17892
18000
  requiredInputs: (config?.inputs ?? []).filter((i) => i.required),
17893
18001
  optionalInputs: (config?.inputs ?? []).filter((i) => !i.required)
17894
18002
  }),
17895
18003
  [config?.inputs]
17896
18004
  );
17897
- 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]);
17898
18006
  const { status: updateStatus, handleUpdate } = useUpdateState(async () => {
17899
18007
  if (!config || !editable) return;
17900
18008
  const actions = [];
@@ -17981,7 +18089,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
17981
18089
  ...m,
17982
18090
  disabled: !editable || m.value === "wired" || isWired
17983
18091
  }));
17984
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18092
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
17985
18093
  import_ui17.ModeToggle,
17986
18094
  {
17987
18095
  value: currentMode,
@@ -17993,29 +18101,29 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
17993
18101
  }
17994
18102
  function renderInputField(input) {
17995
18103
  const currentMode = localModes[input.name] ?? input.mode;
17996
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-panel-field", children: [
17997
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "lace-panel-row-label", children: [
17998
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Identifier, { text: input.name }),
17999
- 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: "*" })
18000
18108
  ] }),
18001
18109
  renderModeSelector(input),
18002
- /* @__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: [
18003
18111
  currentMode === "wired" && renderWiredEditor(input),
18004
18112
  currentMode === "variable" && renderVariableEditor(input),
18005
18113
  currentMode === "expression" && renderExpressionEditor(input),
18006
18114
  currentMode === "literal" && renderLiteralEditor(input)
18007
18115
  ] }),
18008
- 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 })
18009
18117
  ] }, input.name);
18010
18118
  }
18011
18119
  function renderWiredEditor(input) {
18012
18120
  const label = input.wired_source ?? "Not wired";
18013
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-mcp__wired-row", children: [
18014
- /* @__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 }) }),
18015
- 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)(
18016
18124
  import_ui17.IconButton,
18017
18125
  {
18018
- icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CanvasIcon, { name: "close" }),
18126
+ icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CanvasIcon, { name: "close" }),
18019
18127
  "aria-label": "Disconnect this input",
18020
18128
  size: "md",
18021
18129
  tooltipPlacement: "bottom-end",
@@ -18026,7 +18134,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18026
18134
  }
18027
18135
  function renderVariableEditor(input) {
18028
18136
  const currentVar = localVariables[input.name] ?? input.variable ?? "";
18029
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18137
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18030
18138
  import_ui17.Input,
18031
18139
  {
18032
18140
  value: currentVar,
@@ -18044,7 +18152,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18044
18152
  }
18045
18153
  function renderExpressionEditor(input) {
18046
18154
  const currentExpr = localExpressions[input.name] ?? input.expression ?? "";
18047
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18155
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18048
18156
  import_ui17.Textarea,
18049
18157
  {
18050
18158
  value: currentExpr,
@@ -18064,7 +18172,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18064
18172
  setLocalValues((prev) => ({ ...prev, [input.name]: val }));
18065
18173
  };
18066
18174
  if (type === "bool") {
18067
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
18175
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
18068
18176
  "select",
18069
18177
  {
18070
18178
  className: "lace-mcp__select",
@@ -18072,14 +18180,14 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18072
18180
  onChange: (e) => updateValue(e.target.value === "true"),
18073
18181
  disabled: !editable,
18074
18182
  children: [
18075
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("option", { value: "true", children: "True" }),
18076
- /* @__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" })
18077
18185
  ]
18078
18186
  }
18079
18187
  );
18080
18188
  }
18081
18189
  if (type === "number") {
18082
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18190
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18083
18191
  import_ui17.Input,
18084
18192
  {
18085
18193
  type: "number",
@@ -18092,7 +18200,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18092
18200
  }
18093
18201
  if (type.startsWith("list(") || type.startsWith("map(") || type.startsWith("set(") || type === "object" || type.startsWith("object(")) {
18094
18202
  const jsonStr = typeof value === "string" ? value : JSON.stringify(value ?? null, null, 2);
18095
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18203
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18096
18204
  import_ui17.Textarea,
18097
18205
  {
18098
18206
  value: jsonStr,
@@ -18110,7 +18218,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18110
18218
  }
18111
18219
  );
18112
18220
  }
18113
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18221
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18114
18222
  import_ui17.Input,
18115
18223
  {
18116
18224
  value: String(value ?? ""),
@@ -18127,35 +18235,35 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18127
18235
  );
18128
18236
  }
18129
18237
  if (!config) {
18130
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_ui17.Panel, { title: "Error", onClose, children: [
18131
- /* @__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: [
18132
18240
  'Failed to load configuration for "',
18133
18241
  instance_id,
18134
18242
  '":'
18135
18243
  ] }),
18136
- /* @__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." })
18137
18245
  ] });
18138
18246
  }
18139
18247
  const dependsOnCount = localDependsOn.size;
18140
- const title = /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-mcp__title", children: [
18141
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-mcp__title-eyebrow", children: "Module" }),
18142
- /* @__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 }) })
18143
18251
  ] });
18144
- const footer = editable ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(UpdateButton, { status: updateStatus, label: "Update configuration", onClick: handleUpdate }) : void 0;
18145
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_ui17.Panel, { title, footer, flush: true, onClose, children: [
18146
- requiredInputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AccordionSection, { title: "Required Inputs", defaultOpen: true, badge: `(${requiredInputs.length})`, children: requiredInputs.map(renderInputField) }),
18147
- optionalInputs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AccordionSection, { title: "Optional Inputs", defaultOpen: true, badge: `(${optionalInputs.length})`, children: optionalInputs.map(renderInputField) }),
18148
- 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)(
18149
18257
  AccordionSection,
18150
18258
  {
18151
18259
  title: "Depends On",
18152
18260
  badge: dependsOnCount > 0 ? `(${dependsOnCount})` : void 0,
18153
18261
  children: [
18154
- /* @__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." }),
18155
18263
  config.sibling_ids.map((sibId) => {
18156
18264
  const depKey = `module.${sibId}`;
18157
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("label", { className: "lace-mcp__depends-item", children: [
18158
- /* @__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)(
18159
18267
  "input",
18160
18268
  {
18161
18269
  type: "checkbox",
@@ -18172,30 +18280,30 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18172
18280
  }
18173
18281
  }
18174
18282
  ),
18175
- /* @__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 })
18176
18284
  ] }, sibId);
18177
18285
  })
18178
18286
  ]
18179
18287
  }
18180
18288
  ),
18181
- (localProviders.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
18289
+ (localProviders.length > 0 || editable) && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
18182
18290
  AccordionSection,
18183
18291
  {
18184
18292
  title: "Providers",
18185
18293
  badge: localProviders.length > 0 ? `(${localProviders.length})` : void 0,
18186
18294
  children: [
18187
- /* @__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: [
18188
18296
  "Map each child-local provider name to the root provider reference passed down (e.g.",
18189
18297
  " ",
18190
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("code", { children: "aws" }),
18298
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("code", { children: "aws" }),
18191
18299
  " \u2192 ",
18192
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("code", { children: "aws.west" }),
18300
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("code", { children: "aws.west" }),
18193
18301
  ")."
18194
18302
  ] }),
18195
18303
  localProviders.map((row, i) => (
18196
18304
  // biome-ignore lint/suspicious/noArrayIndexKey: rows are positional and freely editable
18197
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-mcp__provider-row", children: [
18198
- /* @__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)(
18199
18307
  import_ui17.Input,
18200
18308
  {
18201
18309
  value: row.key,
@@ -18207,8 +18315,8 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18207
18315
  readOnly: !editable
18208
18316
  }
18209
18317
  ),
18210
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "lace-mcp__provider-arrow", children: "=" }),
18211
- /* @__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)(
18212
18320
  import_ui17.Input,
18213
18321
  {
18214
18322
  value: row.value,
@@ -18220,10 +18328,10 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18220
18328
  readOnly: !editable
18221
18329
  }
18222
18330
  ),
18223
- editable && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18331
+ editable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18224
18332
  import_ui17.IconButton,
18225
18333
  {
18226
- icon: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CanvasIcon, { name: "close" }),
18334
+ icon: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CanvasIcon, { name: "close" }),
18227
18335
  "aria-label": "Remove this provider mapping",
18228
18336
  size: "md",
18229
18337
  tooltipPlacement: "bottom-end",
@@ -18232,7 +18340,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18232
18340
  )
18233
18341
  ] }, i)
18234
18342
  )),
18235
- editable && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18343
+ editable && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18236
18344
  import_ui17.Button,
18237
18345
  {
18238
18346
  variant: "secondary",
@@ -18244,15 +18352,15 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18244
18352
  ]
18245
18353
  }
18246
18354
  ),
18247
- (localRepetition.count || localRepetition.for_each || editable) && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(AccordionSection, { title: "Repetition", children: [
18248
- /* @__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: [
18249
18357
  "The call's ",
18250
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("code", { children: "count" }),
18358
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("code", { children: "count" }),
18251
18359
  " or ",
18252
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("code", { children: "for_each" }),
18360
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("code", { children: "for_each" }),
18253
18361
  ": one module, called once per instance."
18254
18362
  ] }),
18255
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18363
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18256
18364
  import_ui17.Input,
18257
18365
  {
18258
18366
  label: "count",
@@ -18264,7 +18372,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18264
18372
  readOnly: !editable
18265
18373
  }
18266
18374
  ),
18267
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
18375
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18268
18376
  import_ui17.Input,
18269
18377
  {
18270
18378
  label: "for_each",
@@ -18277,20 +18385,20 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
18277
18385
  }
18278
18386
  )
18279
18387
  ] }),
18280
- 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: [
18281
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-mcp__output-header", children: [
18282
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Identifier, { className: "lace-mcp__output-name", text: o.name }),
18283
- /* @__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 ?? "" })
18284
18392
  ] }),
18285
- o.description && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-mcp__output-description", children: o.description }),
18286
- 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" })
18287
18395
  ] }, o.name)) }),
18288
- config.module_key && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
18289
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "lace-mcp__module-heading", children: [
18290
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-mcp__title-eyebrow", children: "Called module" }),
18291
- /* @__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 })
18292
18400
  ] }),
18293
- /* @__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)
18294
18402
  ] })
18295
18403
  ] });
18296
18404
  }
@@ -18300,7 +18408,7 @@ function ModuleConfigPanel2({ ctx }) {
18300
18408
  const { setSelection } = useCanvas();
18301
18409
  const instanceId = ctx.selection.nodes[0];
18302
18410
  if (!instanceId) return null;
18303
- return (0, import_react39.createElement)(ModuleConfigPanel, {
18411
+ return (0, import_react37.createElement)(ModuleConfigPanel, {
18304
18412
  instance_id: instanceId,
18305
18413
  onClose: () => setSelection({ nodes: [], edge: null })
18306
18414
  });
@@ -18315,40 +18423,18 @@ var moduleConfigPanel = {
18315
18423
  };
18316
18424
 
18317
18425
  // src/core/panels/SourceRefusedBanner.tsx
18318
- var import_ui18 = require("@lace-cloud/ui");
18319
- 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.";
18320
18429
  function SourceRefusedBanner({ ctx }) {
18321
- const { runner } = useCanvas();
18322
- const envExtras = useEditorEnvExtras();
18323
- if (!keySatisfied(ctx, "needsConversion")) {
18324
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18325
- Banner,
18326
- {
18327
- severity: "error",
18328
- className: "lace-source-refused-banner",
18329
- 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."
18330
- }
18331
- );
18332
- }
18333
- const actions = rowActionsFor(ctx, "source-refused");
18334
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18335
- Banner,
18430
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
18431
+ RowActionBanner,
18336
18432
  {
18433
+ ctx,
18434
+ panelId: "source-refused",
18337
18435
  severity: "error",
18338
- className: "lace-source-refused-banner lace-source-refused-banner--needs-conversion",
18339
- 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.",
18340
- actions: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
18341
- import_ui18.Button,
18342
- {
18343
- rung: true,
18344
- size: "sm",
18345
- variant: "primary",
18346
- className: `lace-source-refused-banner__${action.id}`,
18347
- onClick: () => void runner.run(action, ctx, {}, envExtras),
18348
- children: action.label
18349
- },
18350
- action.id
18351
- ))
18436
+ className: "lace-source-refused-banner",
18437
+ opening: keySatisfied(ctx, "needsConversion") ? OUT_OF_LACE_SHAPE : LOCKED
18352
18438
  }
18353
18439
  );
18354
18440
  }
@@ -18362,22 +18448,22 @@ var sourceRefusedPanel = {
18362
18448
  };
18363
18449
 
18364
18450
  // src/core/panels/settings.ts
18365
- var import_ui20 = require("@lace-cloud/ui");
18366
- var import_react40 = require("react");
18451
+ var import_ui19 = require("@lace-cloud/ui");
18452
+ var import_react38 = require("react");
18367
18453
 
18368
18454
  // src/components/panels/UnifiedSettingsPanel.tsx
18369
- var import_ui19 = require("@lace-cloud/ui");
18455
+ var import_ui18 = require("@lace-cloud/ui");
18370
18456
  var import_panels_shared9 = require("./panels-shared-5JFNYXQ7.css");
18371
- var import_jsx_runtime33 = require("react/jsx-runtime");
18457
+ var import_jsx_runtime34 = require("react/jsx-runtime");
18372
18458
  function UnifiedSettingsPanel({ onClose }) {
18373
18459
  const { bundle } = useCanvas();
18374
- 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) });
18375
18461
  }
18376
18462
 
18377
18463
  // src/core/panels/settings.ts
18378
18464
  function SettingsPanel(_props) {
18379
18465
  const { setSettingsOpen } = useCanvas();
18380
- return (0, import_react40.createElement)(UnifiedSettingsPanel, {
18466
+ return (0, import_react38.createElement)(UnifiedSettingsPanel, {
18381
18467
  onClose: () => setSettingsOpen(false)
18382
18468
  });
18383
18469
  }
@@ -18391,8 +18477,8 @@ var settingsPanel = {
18391
18477
  };
18392
18478
  function SettingsToggle({ ctx }) {
18393
18479
  const { setSettingsOpen } = useCanvas();
18394
- return (0, import_react40.createElement)(import_ui20.IconButton, {
18395
- 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" }),
18396
18482
  "aria-label": "Settings",
18397
18483
  size: "md",
18398
18484
  tooltipPlacement: "bottom-end",
@@ -18539,7 +18625,7 @@ function reduceRun(prev, token, event) {
18539
18625
  if (event.type === "gate" && event.changeRequest !== null) {
18540
18626
  return {
18541
18627
  token,
18542
- outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest },
18628
+ outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest, runUrl: null },
18543
18629
  lastLog,
18544
18630
  submitted,
18545
18631
  phases: closePhases(phases)
@@ -18547,7 +18633,13 @@ function reduceRun(prev, token, event) {
18547
18633
  }
18548
18634
  if (event.type === "result") {
18549
18635
  if (carried?.outcome.kind === "awaiting-approval") {
18550
- 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
+ };
18551
18643
  }
18552
18644
  if (event.error)
18553
18645
  return {
@@ -18575,7 +18667,7 @@ function settleRun(prev, token, error) {
18575
18667
  const lastLog = carried?.lastLog ?? null;
18576
18668
  const submitted = carried?.submitted ?? false;
18577
18669
  const phases = closePhases(carried?.phases ?? []);
18578
- if (error instanceof CommandDetachedError)
18670
+ if (error instanceof CommandDetachedError || error instanceof CommandUnobservedError)
18579
18671
  return { token, outcome: { kind: "detached", submitted }, lastLog, submitted, phases };
18580
18672
  if (error instanceof CommandExitError) {
18581
18673
  if (error.code === 130)
@@ -18964,7 +19056,7 @@ function createActionRunner(ports, store, options = {}) {
18964
19056
  }
18965
19057
 
18966
19058
  // src/App.tsx
18967
- var import_jsx_runtime34 = require("react/jsx-runtime");
19059
+ var import_jsx_runtime35 = require("react/jsx-runtime");
18968
19060
  var EMPTY_CONTRIBUTIONS = { overlays: [], panels: [], actions: [] };
18969
19061
  var NO_SELECTION = { nodes: [], edge: null };
18970
19062
  var NO_TARGET2 = {};
@@ -18974,8 +19066,8 @@ function OverlayRunner({
18974
19066
  tick,
18975
19067
  onDecorations
18976
19068
  }) {
18977
- const lastErrorRef = (0, import_react42.useRef)(/* @__PURE__ */ new Map());
18978
- const onReadError = (0, import_react42.useCallback)(
19069
+ const lastErrorRef = (0, import_react40.useRef)(/* @__PURE__ */ new Map());
19070
+ const onReadError = (0, import_react40.useCallback)(
18979
19071
  (path, error) => {
18980
19072
  const next = error?.message ?? null;
18981
19073
  if (lastErrorRef.current.get(path) === next) return;
@@ -18984,7 +19076,7 @@ function OverlayRunner({
18984
19076
  },
18985
19077
  [ctx.ports.presenter]
18986
19078
  );
18987
- 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 }) });
18988
19080
  }
18989
19081
  function OverlayDecorations({
18990
19082
  overlay,
@@ -18992,14 +19084,14 @@ function OverlayDecorations({
18992
19084
  onDecorations
18993
19085
  }) {
18994
19086
  const decorations = overlay.useDecorations(ctx);
18995
- (0, import_react42.useEffect)(() => {
19087
+ (0, import_react40.useEffect)(() => {
18996
19088
  onDecorations(overlay.id, decorations);
18997
19089
  }, [overlay.id, decorations, onDecorations]);
18998
19090
  return null;
18999
19091
  }
19000
19092
  function PanelSlot({ panel, ctx, tick }) {
19001
- const [readErrors, setReadErrors] = (0, import_react42.useState)(/* @__PURE__ */ new Map());
19002
- 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) => {
19003
19095
  setReadErrors((prev) => {
19004
19096
  if (error === null) {
19005
19097
  if (!prev.has(path)) return prev;
@@ -19012,7 +19104,7 @@ function PanelSlot({ panel, ctx, tick }) {
19012
19104
  return next;
19013
19105
  });
19014
19106
  }, []);
19015
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
19107
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
19016
19108
  PanelScope,
19017
19109
  {
19018
19110
  ctx,
@@ -19020,13 +19112,13 @@ function PanelSlot({ panel, ctx, tick }) {
19020
19112
  tick,
19021
19113
  onReadError,
19022
19114
  children: [
19023
- [...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: [
19024
19116
  "Couldn't load ",
19025
19117
  path,
19026
19118
  ": ",
19027
19119
  error.message
19028
19120
  ] }, path)),
19029
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(panel.Component, { ctx })
19121
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(panel.Component, { ctx })
19030
19122
  ]
19031
19123
  }
19032
19124
  );
@@ -19036,12 +19128,12 @@ function BottomTabs({
19036
19128
  ctx,
19037
19129
  tick
19038
19130
  }) {
19039
- const [manualId, setManualId] = (0, import_react42.useState)(null);
19131
+ const [manualId, setManualId] = (0, import_react40.useState)(null);
19040
19132
  const manual = manualId !== null ? panels.find((p) => p.id === manualId) : void 0;
19041
19133
  const active = manual ?? panels[0] ?? null;
19042
19134
  if (panels.length === 0) return null;
19043
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "lace-app__bottom", children: [
19044
- /* @__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)(
19045
19137
  "button",
19046
19138
  {
19047
19139
  type: "button",
@@ -19053,7 +19145,7 @@ function BottomTabs({
19053
19145
  },
19054
19146
  panel.id
19055
19147
  )) }),
19056
- /* @__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 }) })
19057
19149
  ] });
19058
19150
  }
19059
19151
  function endMessage(end) {
@@ -19065,8 +19157,8 @@ function App({
19065
19157
  height = "100vh",
19066
19158
  results: hostResults
19067
19159
  }) {
19068
- const results = (0, import_react42.useMemo)(() => hostResults ?? createResultStore(), [hostResults]);
19069
- const writeReport = (0, import_react42.useCallback)(
19160
+ const results = (0, import_react40.useMemo)(() => hostResults ?? createResultStore(), [hostResults]);
19161
+ const writeReport = (0, import_react40.useCallback)(
19070
19162
  (result, session2) => {
19071
19163
  try {
19072
19164
  results.write("report", session2, result, { stack: void 0 });
@@ -19077,43 +19169,43 @@ function App({
19077
19169
  },
19078
19170
  [results, ports.presenter]
19079
19171
  );
19080
- 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]);
19081
19173
  const { source, end, session } = useCanvasSource(ports.source, writeReport, dropReport);
19082
- const [arrangement, setArrangement] = (0, import_react42.useState)(() => ports.viewState.load());
19174
+ const [arrangement, setArrangement] = (0, import_react40.useState)(() => ports.viewState.load());
19083
19175
  const stack = ports.context.stack;
19084
- const [selection, setSelection] = (0, import_react42.useState)(
19176
+ const [selection, setSelection] = (0, import_react40.useState)(
19085
19177
  NO_SELECTION
19086
19178
  );
19087
- const [settingsOpen, setSettingsOpen] = (0, import_react42.useState)(false);
19088
- const select = (0, import_react42.useCallback)((next) => {
19179
+ const [settingsOpen, setSettingsOpen] = (0, import_react40.useState)(false);
19180
+ const select = (0, import_react40.useCallback)((next) => {
19089
19181
  setSelection(next);
19090
19182
  if (next.nodes.length > 0 || next.edge !== null) setSettingsOpen(false);
19091
19183
  }, []);
19092
- const [pendingForm, setPendingForm] = (0, import_react42.useState)(null);
19093
- const [overlayDecorations, setOverlayDecorations] = (0, import_react42.useState)({});
19094
- 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: () => {
19095
19187
  } });
19096
19188
  const { commands, presenter, editor } = ports;
19097
- const runner = (0, import_react42.useMemo)(
19189
+ const runner = (0, import_react40.useMemo)(
19098
19190
  () => createActionRunner({ commands, presenter, editor }, results, {
19099
19191
  onPendingFormChange: setPendingForm
19100
19192
  }),
19101
19193
  [commands, presenter, editor, results]
19102
19194
  );
19103
- (0, import_react42.useEffect)(() => {
19195
+ (0, import_react40.useEffect)(() => {
19104
19196
  return () => {
19105
19197
  runner.dispose();
19106
19198
  };
19107
19199
  }, [runner]);
19108
- const tick = (0, import_react42.useSyncExternalStore)(results.subscribe, results.getTick);
19109
- const updateArrangement = (0, import_react42.useCallback)(
19200
+ const tick = (0, import_react40.useSyncExternalStore)(results.subscribe, results.getTick);
19201
+ const updateArrangement = (0, import_react40.useCallback)(
19110
19202
  (next) => {
19111
19203
  setArrangement(next);
19112
19204
  ports.viewState.save(next);
19113
19205
  },
19114
19206
  [ports.viewState]
19115
19207
  );
19116
- const gcSeenBundle = (0, import_react42.useRef)(null);
19208
+ const gcSeenBundle = (0, import_react40.useRef)(null);
19117
19209
  if (source && gcSeenBundle.current !== source.bundle) {
19118
19210
  gcSeenBundle.current = source.bundle;
19119
19211
  const gced = gcArrangement(source.bundle, arrangement);
@@ -19124,12 +19216,12 @@ function App({
19124
19216
  });
19125
19217
  }
19126
19218
  }
19127
- const view = (0, import_react42.useMemo)(
19219
+ const view = (0, import_react40.useMemo)(
19128
19220
  () => source ? projectFrame(source, arrangement) : null,
19129
19221
  [source, arrangement]
19130
19222
  );
19131
19223
  const editable = ports.editor !== void 0 && !source?.sourceRefused;
19132
- const merged = (0, import_react42.useMemo)(
19224
+ const merged = (0, import_react40.useMemo)(
19133
19225
  () => ({
19134
19226
  overlays: [...CORE_CONTRIBUTIONS.overlays, ...contributions.overlays],
19135
19227
  panels: [...CORE_CONTRIBUTIONS.panels, ...contributions.panels],
@@ -19137,17 +19229,17 @@ function App({
19137
19229
  }),
19138
19230
  [contributions]
19139
19231
  );
19140
- const resultSlots = (0, import_react42.useSyncExternalStore)(results.subscribe, results.getSnapshot);
19232
+ const resultSlots = (0, import_react40.useSyncExternalStore)(results.subscribe, results.getSnapshot);
19141
19233
  const stackId = stack?.id;
19142
- const live = (0, import_react42.useMemo)(
19234
+ const live = (0, import_react40.useMemo)(
19143
19235
  () => source && session ? liveSlots(resultSlots, { session, treeHash: source.treeHash, stack: stackId }) : null,
19144
19236
  [resultSlots, source, session, stackId]
19145
19237
  );
19146
- const diagnostics = (0, import_react42.useMemo)(
19238
+ const diagnostics = (0, import_react40.useMemo)(
19147
19239
  () => source && live ? diagnosticsOf(source.diagnostics, live.report ? reportDiagnostics(live.report) : []) : [],
19148
19240
  [source, live]
19149
19241
  );
19150
- const ctx = (0, import_react42.useMemo)(() => {
19242
+ const ctx = (0, import_react40.useMemo)(() => {
19151
19243
  if (!source || !view) return null;
19152
19244
  return {
19153
19245
  ports,
@@ -19164,18 +19256,18 @@ function App({
19164
19256
  contributions: merged
19165
19257
  };
19166
19258
  }, [ports, source, view, stack, selection, settingsOpen, merged, diagnostics, editable]);
19167
- const resolved = (0, import_react42.useMemo)(() => {
19259
+ const resolved = (0, import_react40.useMemo)(() => {
19168
19260
  if (!ctx) return EMPTY_CONTRIBUTIONS;
19169
19261
  return resolveContributions(merged, ports, ctx, NO_TARGET2);
19170
19262
  }, [merged, ports, ctx]);
19171
- const setOverlayDecoration = (0, import_react42.useCallback)((id, next) => {
19263
+ const setOverlayDecoration = (0, import_react40.useCallback)((id, next) => {
19172
19264
  setOverlayDecorations((prev) => prev[id] === next ? prev : { ...prev, [id]: next });
19173
19265
  }, []);
19174
- const decorations = (0, import_react42.useMemo)(() => {
19266
+ const decorations = (0, import_react40.useMemo)(() => {
19175
19267
  if (!view || !source) return { nodes: {} };
19176
19268
  return decorate(view, Object.values(overlayDecorations), diagnostics);
19177
19269
  }, [view, source, overlayDecorations, diagnostics]);
19178
- const envExtras = (0, import_react42.useMemo)(() => {
19270
+ const envExtras = (0, import_react40.useMemo)(() => {
19179
19271
  if (!source) return null;
19180
19272
  return {
19181
19273
  bundle: source.bundle,
@@ -19187,8 +19279,8 @@ function App({
19187
19279
  resolved.actions.filter((action) => action.placement === "toolbar"),
19188
19280
  resolved.panels.filter((panel) => panel.slot === "toolbar")
19189
19281
  );
19190
- const rootRef = (0, import_react42.useRef)(null);
19191
- (0, import_react42.useEffect)(() => {
19282
+ const rootRef = (0, import_react40.useRef)(null);
19283
+ (0, import_react40.useEffect)(() => {
19192
19284
  if (!ctx) return;
19193
19285
  registerKeyTarget(ctx, "app", rootRef.current);
19194
19286
  return () => registerKeyTarget(ctx, "app", null);
@@ -19196,7 +19288,7 @@ function App({
19196
19288
  useFocusWhenNoneHeld(rootRef, Boolean(ctx && view && source && envExtras));
19197
19289
  useActionKeys(ctx && envExtras ? resolved.actions : [], ctx, runner, envExtras);
19198
19290
  if (!ctx || !view || !source || !envExtras) {
19199
- 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;
19200
19292
  }
19201
19293
  const contextValue = {
19202
19294
  ports,
@@ -19216,8 +19308,8 @@ function App({
19216
19308
  const bannerPanels = resolved.panels.filter((panel) => panel.slot === "banner");
19217
19309
  const bottomPanels = resolved.panels.filter((panel) => panel.slot === "bottom");
19218
19310
  const drawerPanel = resolved.panels.find((panel) => panel.slot === "drawer");
19219
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(ErrorBoundary, { children: [
19220
- 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)(
19221
19313
  OverlayRunner,
19222
19314
  {
19223
19315
  overlay,
@@ -19227,14 +19319,14 @@ function App({
19227
19319
  },
19228
19320
  overlay.id
19229
19321
  )),
19230
- /* @__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: [
19231
- (toolbar.sections.length > 0 || toolbar.trailing.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "lace-app__toolbar", children: [
19232
- toolbar.sections.map((section, index) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react42.Fragment, { children: [
19233
- index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "lace-app__toolbar-separator", "aria-hidden": "true" }) : null,
19234
- /* @__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: [
19235
19327
  section.actions.map((action) => {
19236
19328
  const commandBusy = action.binding.kind === "command" && results.isBusy(action.binding.resultKind);
19237
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
19329
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
19238
19330
  ToolbarAction,
19239
19331
  {
19240
19332
  action,
@@ -19246,20 +19338,20 @@ function App({
19246
19338
  action.id
19247
19339
  );
19248
19340
  }),
19249
- 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))
19250
19342
  ] })
19251
19343
  ] }, section.key ?? "")),
19252
- 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)) })
19253
19345
  ] }),
19254
- /* @__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)) }),
19255
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "lace-app__body", children: [
19256
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "lace-app__main", children: [
19257
- /* @__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%" }) }) }),
19258
- /* @__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 })
19259
19351
  ] }),
19260
- 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) })
19261
19353
  ] }),
19262
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CommandArgsForm, { form: pendingForm })
19354
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CommandArgsForm, { form: pendingForm })
19263
19355
  ] }) })
19264
19356
  ] });
19265
19357
  }
@@ -19354,8 +19446,13 @@ async function* readConnectFrames(body, signal) {
19354
19446
  try {
19355
19447
  while (!signal.aborted) {
19356
19448
  const { value, done } = await reader.read();
19357
- if (done) return;
19358
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
+ }
19359
19456
  if (!value) continue;
19360
19457
  chunks.push(value);
19361
19458
  bufferedLen += value.length;
@@ -19931,13 +20028,14 @@ function commandsPort(caller, commandPaths, ownCwd) {
19931
20028
  throw new CommandExitError(
19932
20029
  event.exit.code,
19933
20030
  event.exit.stderr_tail,
19934
- exitFailure(event.exit.document)
20031
+ exitFailure(path, event.exit.document)
19935
20032
  );
19936
20033
  }
19937
20034
  return;
19938
20035
  }
19939
20036
  }
19940
- throw new CommandDetachedError();
20037
+ if (signal.aborted) throw new CommandDetachedError();
20038
+ throw new CommandUnobservedError();
19941
20039
  }
19942
20040
  return {
19943
20041
  events: run(),
@@ -19948,10 +20046,10 @@ function commandsPort(caller, commandPaths, ownCwd) {
19948
20046
  }
19949
20047
  };
19950
20048
  }
19951
- function exitFailure(document2) {
20049
+ function exitFailure(path, document2) {
19952
20050
  if (document2 === "") return void 0;
19953
20051
  const data = JSON.parse(document2);
19954
- return carriesFailure(data) ? parseCommandFailure(data) : void 0;
20052
+ return carriesFailure(data) ? parseCommandFailure(data) : resultFailure(path, data);
19955
20053
  }
19956
20054
  async function openSession(caller, target) {
19957
20055
  if ("fixture" in target) {
@@ -20020,6 +20118,7 @@ function convertCreatedRef(r) {
20020
20118
  CommandArgsForm,
20021
20119
  CommandDetachedError,
20022
20120
  CommandExitError,
20121
+ CommandUnobservedError,
20023
20122
  ConflictBanner,
20024
20123
  ConnectError,
20025
20124
  ContextMenu,