@lace-cloud/canvas 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -15,8 +15,10 @@ import {
15
15
  answering,
16
16
  bridgeCaller,
17
17
  carriesFailure,
18
+ commandPathOf,
18
19
  commandUnderWay,
19
20
  connectCaller,
21
+ counted,
20
22
  createActionRunner,
21
23
  createResultStore,
22
24
  currentFrame,
@@ -30,6 +32,7 @@ import {
30
32
  generatedTree,
31
33
  inEntryScope,
32
34
  isBoundPath,
35
+ isCommandPath,
33
36
  isInert,
34
37
  isPlainObject,
35
38
  keySatisfied,
@@ -43,7 +46,7 @@ import {
43
46
  rowActions,
44
47
  toArgv,
45
48
  uniqueDiagnostics
46
- } from "./chunk-A3ATETIA.mjs";
49
+ } from "./chunk-MVOO7T3B.mjs";
47
50
 
48
51
  // src/index.ts
49
52
  import { projectCanvasView as projectCanvasView2 } from "@lace-cloud/proto";
@@ -53,10 +56,10 @@ import { Toast } from "@lace-cloud/ui/feedback";
53
56
  import { ReactFlowProvider } from "@xyflow/react";
54
57
  import {
55
58
  Fragment as Fragment14,
56
- useCallback as useCallback10,
59
+ useCallback as useCallback11,
57
60
  useEffect as useEffect11,
58
61
  useLayoutEffect as useLayoutEffect5,
59
- useMemo as useMemo10,
62
+ useMemo as useMemo12,
60
63
  useRef as useRef12,
61
64
  useState as useState17,
62
65
  useSyncExternalStore
@@ -74,7 +77,7 @@ import {
74
77
  useNodesInitialized,
75
78
  useReactFlow as useReactFlow3
76
79
  } from "@xyflow/react";
77
- import { useCallback as useCallback7, useEffect as useEffect8, useLayoutEffect as useLayoutEffect3, useMemo as useMemo4, useRef as useRef8, useState as useState8 } from "react";
80
+ import { useCallback as useCallback8, useEffect as useEffect8, useLayoutEffect as useLayoutEffect3, useMemo as useMemo6, useRef as useRef8, useState as useState8 } from "react";
78
81
 
79
82
  // src/components/CanvasControls.tsx
80
83
  import { IconButton } from "@lace-cloud/ui";
@@ -709,26 +712,16 @@ import {
709
712
  NODE_ROW_HEIGHT
710
713
  } from "@lace-cloud/proto";
711
714
  import { Handle, Position } from "@xyflow/react";
712
- import { useCallback as useCallback2, useEffect as useEffect3, useRef as useRef3, useState as useState4 } from "react";
715
+ import { useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef3, useState as useState4 } from "react";
713
716
 
714
- // src/core/editor-actions.ts
715
- import {
716
- boxAt,
717
- drawnRect,
718
- extentOf,
719
- freeSlot,
720
- groupBoxSize,
721
- groupPins,
722
- groupReach,
723
- instanceAddress,
724
- joinPath,
725
- keepOrder,
726
- localIn as localIn2,
727
- originAt,
728
- reachRect,
729
- splitPath as splitPath2,
730
- stepDown
731
- } from "@lace-cloud/proto";
717
+ // src/state/canvas-context.ts
718
+ import { createContext, useContext } from "react";
719
+ var CanvasContext = createContext(null);
720
+ function useCanvas() {
721
+ const value = useContext(CanvasContext);
722
+ if (!value) throw new Error("CanvasContext not available: mount inside <App>");
723
+ return value;
724
+ }
732
725
 
733
726
  // src/utils/arrangement.ts
734
727
  import { drawnAt, frameOf, localIn, resolveInstance, splitPath } from "@lace-cloud/proto";
@@ -858,897 +851,501 @@ function gcArrangement(bundle, arrangement) {
858
851
  return changed ? next : arrangement;
859
852
  }
860
853
 
861
- // src/core/editor-actions.ts
862
- function emptyApplyResult() {
863
- return { success: true, errors: [], created: [], ties: [] };
864
- }
865
- function copySource(env) {
866
- return inEntryScope(env.ctx.view, env.ctx.selection.nodes);
867
- }
868
- function placeCreatedClones(bundle, view, arrangement, created) {
869
- const sources = /* @__PURE__ */ new Map();
870
- for (const ref of created) {
871
- const rect = ref.scope === bundle.entry && ref.sourceId ? reachRect(view, ref.sourceId) : void 0;
872
- if (rect) {
873
- sources.set(ref.id, {
874
- sourceId: ref.sourceId,
875
- rect,
876
- stored: localIn2(view, ref.sourceId, rect)
877
- });
878
- }
879
- }
880
- const first = sources.values().next().value;
881
- if (!first) return arrangement;
882
- const extent = extentOf([...sources.values()].map((s) => s.rect));
883
- const occupied = entryScopeIds(view).flatMap((id) => drawnRect(view, id) ?? []);
884
- const slot = freeSlot(extent, occupied);
885
- const pinned = withScopesPinned(bundle, view, arrangement, first.sourceId);
886
- const scopeEntry = pinned[bundle.entry] ?? {};
887
- const placed = {};
888
- for (const [id, { stored }] of sources) {
889
- placed[id] = { x: slot.x - extent.x + stored.x, y: slot.y - extent.y + stored.y };
890
- }
891
- return setScopeEntry(pinned, bundle.entry, {
892
- ...scopeEntry,
893
- nodes: { ...scopeEntry.nodes, ...placed }
894
- });
895
- }
896
- async function saveRun(env) {
897
- await env.editor.save();
898
- }
899
- function generateRun(env) {
900
- return env.editor.generate();
901
- }
902
- async function undoRun(env) {
903
- return env.apply([{ undo: {} }]);
904
- }
905
- async function redoRun(env) {
906
- return env.apply([{ redo: {} }]);
854
+ // src/components/nodes/BadgeRow.tsx
855
+ import { Badge as Chip } from "@lace-cloud/ui";
856
+ import "./BadgeRow-KVODWDQK.css";
857
+ import { jsx as jsx6 } from "react/jsx-runtime";
858
+ var VARIANT = {
859
+ neutral: "neutral",
860
+ warn: "warning",
861
+ error: "danger"
862
+ };
863
+ function BadgeRow({ badges }) {
864
+ if (badges.length === 0) return null;
865
+ return /* @__PURE__ */ jsx6("div", { className: "lace-badge-row", children: badges.map((b) => /* @__PURE__ */ jsx6(
866
+ Chip,
867
+ {
868
+ "data-badge": b.id,
869
+ "data-tone": b.tone,
870
+ variant: VARIANT[b.tone],
871
+ size: "md",
872
+ className: "lace-badge-row__chip",
873
+ title: b.title ?? b.label,
874
+ children: /* @__PURE__ */ jsx6("span", { className: "lace-badge-row__text", children: b.label })
875
+ },
876
+ b.id
877
+ )) });
907
878
  }
908
- async function clearGraphRun(env) {
909
- const ids = entryScopeIds(env.ctx.view);
910
- if (ids.length === 0) return emptyApplyResult();
911
- const scope = env.bundle.entry;
912
- return env.apply(ids.map((id) => ({ delete_instance: { scope, instance_id: id } })));
879
+
880
+ // src/components/nodes/CardActions.tsx
881
+ import { inertProps as inertProps2, Tooltip as Tooltip2 } from "@lace-cloud/ui";
882
+ import { useCallback, useMemo } from "react";
883
+
884
+ // src/core/panels/row-actions.ts
885
+ function rowActionsFor(ctx, panelId, target = {}) {
886
+ const resolved = resolveContributions(ctx.contributions, ctx.ports, ctx, target);
887
+ return rowActions(resolved, panelId);
913
888
  }
914
- function clipRun(cut2) {
915
- return async (env) => {
916
- const ids = copySource(env);
917
- env.clipboard.set(ids, cut2);
918
- env.ctx.ports.presenter.notify(
919
- "info",
920
- `${cut2 ? "Cut" : "Copied"} ${ids.length} node${ids.length > 1 ? "s" : ""}`
921
- );
889
+ function useEditorEnvExtras() {
890
+ const { bundle, arrangement, updateArrangement, layout } = useCanvas();
891
+ return {
892
+ bundle,
893
+ arrangement: { get: () => arrangement, update: updateArrangement },
894
+ layout
922
895
  };
923
896
  }
924
- async function pasteRun(env) {
925
- const clip = env.clipboard.get();
926
- if (!clip) {
927
- env.ctx.ports.presenter.notify("error", "Clipboard empty \u2014 copy a node first");
928
- return emptyApplyResult();
929
- }
930
- const { ids, cut: cut2 } = clip;
931
- const scope = env.bundle.entry;
932
- const actions = cut2 ? [
933
- { copy_instances: { scope, instance_ids: [...ids] } },
934
- ...ids.map((id) => ({ delete_instance: { scope, instance_id: id } }))
935
- ] : [{ copy_instances: { scope, instance_ids: [...ids] } }];
936
- const result = await env.apply(actions);
937
- if (!result.success) return result;
938
- const created = result.created.filter((c) => c.sourceId);
939
- if (created.length === 0) {
940
- if (!cut2) {
941
- env.ctx.ports.presenter.notify("error", "Paste produced no new nodes \u2014 nothing pasted");
942
- }
943
- } else {
944
- env.arrangement.update(
945
- placeCreatedClones(env.bundle, env.ctx.view, env.arrangement.get(), created)
946
- );
947
- }
948
- if (cut2) env.clipboard.clear();
949
- return result;
950
- }
951
- async function groupRun(env) {
952
- const ids = env.ctx.selection.nodes;
953
- const { scope } = instanceAddress(env.bundle, ids[0]);
954
- const nodeIds = ids.map((id) => {
955
- const address = instanceAddress(env.bundle, id);
956
- return address.scope === scope ? address.id : id;
957
- });
958
- const result = await env.apply([{ create_group: { scope, node_ids: nodeIds } }]);
959
- if (!result.success) return result;
960
- const created = result.created[0];
961
- if (!created?.moduleKey) return result;
962
- const frame = await currentFrame(env.ctx.ports.source);
963
- const minted = frame?.bundle.modules[created.moduleKey];
964
- if (!minted) {
965
- throw new Error(`Group: the source delivered no module ${created.moduleKey} after the apply`);
966
- }
967
- const view = env.ctx.view;
968
- const before = withScopesPinned(env.bundle, view, env.arrangement.get(), ids[0]);
969
- const parentEntry = before[created.scope] ?? {};
970
- const drawn = ids.flatMap((id) => {
971
- const rect = drawnRect(view, id);
972
- return rect ? [{ id, localId: splitPath2(id).localId, rect }] : [];
973
- });
974
- if (drawn.length === 0) return result;
975
- const members = extentOf(drawn.map((m) => m.rect));
976
- const origin = { x: members.x, y: members.y };
977
- const memberGroups = Object.fromEntries(
978
- drawn.flatMap(({ localId }) => {
979
- const entry = parentEntry.groups?.[localId];
980
- return entry ? [[localId, entry]] : [];
981
- })
982
- );
983
- const next = setScopeEntry(before, created.moduleKey, {
984
- nodes: Object.fromEntries(
985
- drawn.map(({ id, localId, rect }) => [localId, localIn2(view, id, rect, origin)])
897
+
898
+ // src/components/nodes/CardActions.tsx
899
+ import "./CardActions-QLTNQUVW.css";
900
+ import { jsx as jsx7 } from "react/jsx-runtime";
901
+ function CardActions({ target }) {
902
+ const { ctx, runner } = useCanvas();
903
+ const envExtras = useEditorEnvExtras();
904
+ const actions = useMemo(
905
+ () => resolveContributions(ctx.contributions, ctx.ports, ctx, target).actions.filter(
906
+ (a) => a.placement === "card"
986
907
  ),
987
- groups: Object.keys(memberGroups).length > 0 ? memberGroups : void 0
988
- });
989
- const reach = groupReach(groupPins(minted), groupBoxSize(members));
990
- const { parentPath } = splitPath2(ids[0]);
991
- const groupPath = joinPath(parentPath, created.id);
992
- const declared = new Map(
993
- (frame.bundle.modules[created.scope]?.modules ?? []).map((use, i) => [use.id, i])
908
+ [ctx, target]
994
909
  );
995
- const keyOf = (id, at) => ({ ...at, declared: declared.get(id) ?? 0 });
996
- const selected = new Set(ids);
997
- const others = [...view.nodes, ...view.groups].flatMap(({ id }) => {
998
- const { parentPath: scopePath, localId } = splitPath2(id);
999
- const rect = selected.has(id) || scopePath !== parentPath ? void 0 : drawnRect(view, id);
1000
- return rect ? [{ rect, key: keyOf(localId, rect) }] : [];
1001
- });
1002
- const enclosing = view.groups.find((g) => g.id === parentPath);
1003
- const wanted = boxAt(origin);
1004
- let anchor = enclosing ? { x: wanted.x, y: Math.max(wanted.y, originAt(enclosing.position).y) } : wanted;
1005
- for (let moved = true; moved; ) {
1006
- const groupKey = keyOf(created.id, anchor);
1007
- const keptFirst = others.filter((o) => keepOrder(o.key, groupKey) < 0).map((o) => o.rect);
1008
- const stepped = stepDown(anchor, reach, keptFirst);
1009
- moved = stepped.y !== anchor.y;
1010
- anchor = stepped;
1011
- }
1012
- const written = setScopeEntry(next, created.scope, {
1013
- nodes: { ...parentEntry.nodes, [created.id]: localIn2(view, groupPath, anchor) },
1014
- groups: { ...parentEntry.groups, [created.id]: { collapsed: true } }
910
+ const runOnCard = useCallback(
911
+ (action) => (e) => {
912
+ e.stopPropagation();
913
+ void runner.run(action, ctx, target, envExtras);
914
+ },
915
+ [ctx, runner, envExtras, target]
916
+ );
917
+ return actions.map((action) => {
918
+ const state = actionState(action, ctx, runner.busy(action, ctx, target));
919
+ return /* @__PURE__ */ jsx7(
920
+ Tooltip2,
921
+ {
922
+ name: action.label,
923
+ content: state.disabledReason,
924
+ placement: "bottom-end",
925
+ children: (describedBy) => /* @__PURE__ */ jsx7(
926
+ "button",
927
+ {
928
+ type: "button",
929
+ className: `lace-card-action${action.tone === "danger" ? " lace-card-action--danger" : ""}`,
930
+ "aria-label": action.label,
931
+ "aria-describedby": describedBy,
932
+ ...inertProps2(isInert(state), runOnCard(action)),
933
+ children: action.icon ? /* @__PURE__ */ jsx7(CanvasIcon, { name: action.icon }) : action.label
934
+ }
935
+ )
936
+ },
937
+ action.id
938
+ );
1015
939
  });
1016
- env.arrangement.update(written);
1017
- return result;
1018
940
  }
1019
- function groupTarget(id) {
1020
- return { nodeId: id, groupId: id };
941
+
942
+ // src/components/nodes/GroupNode.tsx
943
+ import "./GroupNode-NJOGOGQM.css";
944
+
945
+ // src/components/nodes/use-rename-instance.ts
946
+ import { instanceAddress } from "@lace-cloud/proto";
947
+ import { useCallback as useCallback2, useRef as useRef2 } from "react";
948
+
949
+ // src/core/pipeline.ts
950
+ import { projectCanvasView } from "@lace-cloud/proto";
951
+ import { useEffect as useEffect2, useState as useState3 } from "react";
952
+ function projectFrame(frame, arrangement) {
953
+ return projectCanvasView(frame.bundle, arrangement, {
954
+ canUndo: frame.canUndo,
955
+ canRedo: frame.canRedo,
956
+ unsaved: frame.unsaved,
957
+ conflict: frame.conflict ? { base_tree_hash: frame.conflict.baseTreeHash, tree_hash: frame.conflict.treeHash } : void 0,
958
+ ungenerated: frame.ungenerated
959
+ });
1021
960
  }
1022
- function ungroupAction(bundle, id) {
1023
- const { scope, id: group_id } = instanceAddress(bundle, id);
1024
- return { ungroup: { scope, group_id } };
961
+ var NO_SELECTION = { nodes: [], edges: [] };
962
+ function reconcileSelection(view, selection) {
963
+ const heldNodes = new Set([...view.nodes, ...view.groups].map((n) => n.id));
964
+ const heldEdges = new Set(view.edges.map((e) => e.id));
965
+ const nodes = selection.nodes.filter((id) => heldNodes.has(id));
966
+ const edges = selection.edges.filter((id) => heldEdges.has(id));
967
+ if (nodes.length === selection.nodes.length && edges.length === selection.edges.length) {
968
+ return selection;
969
+ }
970
+ return { nodes, edges };
1025
971
  }
1026
- async function applyDissolving(env, actions, dissolved) {
1027
- const result = await env.apply(actions);
1028
- if (!result.success) return result;
1029
- const before = env.arrangement.get();
1030
- const after = dissolved.reduce((arrangement, id) => {
1031
- const moduleKey = env.ctx.view.groups.find((g) => g.id === id)?.module_key;
1032
- return moduleKey ? migrateUngroup(env.bundle, env.ctx.view, arrangement, id, moduleKey, result.created) : arrangement;
1033
- }, before);
1034
- if (after !== before) env.arrangement.update(after);
1035
- return result;
1036
- }
1037
- async function ungroupRun(env) {
1038
- const groupId = env.target.groupId;
1039
- if (!groupId) return emptyApplyResult();
1040
- return applyDissolving(env, [ungroupAction(env.bundle, groupId)], [groupId]);
1041
- }
1042
- async function deleteRun(env, ids) {
1043
- if (ids.length === 0) return emptyApplyResult();
1044
- const groups = new Set(env.ctx.view.groups.map((g) => g.id));
1045
- const calls = ids.filter((id) => !groups.has(id));
1046
- const dissolved = ids.filter((id) => groups.has(id)).sort((a, b) => b.length - a.length);
1047
- const deletes = calls.map((id) => {
1048
- const { scope, id: instance_id } = instanceAddress(env.bundle, id);
1049
- return { delete_instance: { scope, instance_id } };
1050
- });
1051
- return applyDissolving(
1052
- env,
1053
- [...deletes, ...dissolved.map((id) => ungroupAction(env.bundle, id))],
1054
- dissolved
972
+ function carrySelection(selection, oldPath, newPath) {
973
+ const copies = selection.nodes.flatMap(
974
+ (id) => id === oldPath || id.startsWith(`${oldPath}.`) ? [newPath + id.slice(oldPath.length)] : []
1055
975
  );
976
+ if (copies.length === 0) return selection;
977
+ return { ...selection, nodes: [...selection.nodes, ...copies] };
1056
978
  }
1057
- async function deleteNodeRun(env) {
1058
- return deleteRun(env, env.target.nodeId === void 0 ? [] : [env.target.nodeId]);
1059
- }
1060
- async function deleteSelectionRun(env) {
1061
- return deleteRun(env, env.ctx.selection.nodes);
1062
- }
1063
- async function conflictKeepRun(env) {
1064
- const conflict = env.ctx.view.conflict;
1065
- if (!conflict) return;
1066
- await env.editor.resolveConflict("keep", conflict.tree_hash);
979
+ var NO_SOURCE = { source: null, end: null, session: null };
980
+ function useCanvasSource(source, onCommandResult, onSessionEnd) {
981
+ const [held, setHeld] = useState3({ ...NO_SOURCE, port: null });
982
+ useEffect2(() => {
983
+ const session = {};
984
+ const unsubscribe = source.subscribe(
985
+ (next) => setHeld({ source: next, end: null, session, port: source }),
986
+ (end) => setHeld((prev) => ({
987
+ source: prev.session === session ? prev.source : null,
988
+ end,
989
+ session,
990
+ port: source
991
+ })),
992
+ (result) => onCommandResult(result, session)
993
+ );
994
+ return () => {
995
+ unsubscribe();
996
+ onSessionEnd(session);
997
+ };
998
+ }, [source, onCommandResult, onSessionEnd]);
999
+ if (held.port !== source) return NO_SOURCE;
1000
+ return { source: held.source, end: held.end, session: held.session };
1067
1001
  }
1068
- async function conflictReloadRun(env) {
1069
- const conflict = env.ctx.view.conflict;
1070
- if (!conflict) return;
1071
- await env.editor.resolveConflict("reload", conflict.tree_hash);
1002
+
1003
+ // src/components/nodes/use-rename-instance.ts
1004
+ function useRenameInstance() {
1005
+ const { bundle, view, arrangement, updateArrangement, selection, setSelection, runner } = useCanvas();
1006
+ const latest = useRef2({ view, selection });
1007
+ latest.current = { view, selection };
1008
+ return useCallback2(
1009
+ async (canvasPath, newId) => {
1010
+ const { scope, id: oldId } = instanceAddress(bundle, canvasPath);
1011
+ if (!newId || newId === oldId) return;
1012
+ const taken = bundle.modules[scope]?.modules?.some((u) => u.id === newId) ?? false;
1013
+ const newPath = canvasPath.slice(0, canvasPath.length - oldId.length) + newId;
1014
+ const carriedArrangement = taken ? arrangement : withRenameCarried(arrangement, scope, oldId, newId);
1015
+ const carriedSelection = taken ? selection : carrySelection(selection, canvasPath, newPath);
1016
+ if (carriedArrangement !== arrangement) updateArrangement(carriedArrangement);
1017
+ if (carriedSelection !== selection) setSelection(carriedSelection);
1018
+ const result = await runner.apply([
1019
+ { rename_instance: { scope, old_id: oldId, new_id: newId } }
1020
+ ]);
1021
+ if (result?.success || carriedSelection === selection) return;
1022
+ const now = latest.current;
1023
+ const held = reconcileSelection(now.view, now.selection);
1024
+ if (held !== now.selection) setSelection(held);
1025
+ },
1026
+ [bundle, arrangement, updateArrangement, selection, setSelection, runner]
1027
+ );
1072
1028
  }
1073
- var save = { kind: "editor", result: "none", run: saveRun };
1074
- var generate = { kind: "editor", result: "generate", run: generateRun };
1075
- var undo = { kind: "editor", result: "apply", run: undoRun };
1076
- var redo = { kind: "editor", result: "apply", run: redoRun };
1077
- var clearGraph = {
1078
- kind: "editor",
1079
- result: "apply",
1080
- run: clearGraphRun,
1081
- confirm: () => ({
1082
- text: "Clear the graph? Every module call and group on the canvas is deleted; Undo brings them back."
1083
- })
1084
- };
1085
- var copy = { kind: "editor", result: "none", run: clipRun(false) };
1086
- var cut = { kind: "editor", result: "none", run: clipRun(true) };
1087
- var paste = { kind: "editor", result: "apply", run: pasteRun };
1088
- var group = { kind: "editor", result: "apply", run: groupRun };
1089
- var ungroup = { kind: "editor", result: "apply", run: ungroupRun };
1090
- var deleteNode = { kind: "editor", result: "apply", run: deleteNodeRun };
1091
- var deleteSelection = {
1092
- kind: "editor",
1093
- result: "apply",
1094
- run: deleteSelectionRun
1095
- };
1096
- var conflictKeep = { kind: "editor", result: "none", run: conflictKeepRun };
1097
- var conflictReload = {
1098
- kind: "editor",
1099
- result: "none",
1100
- run: conflictReloadRun,
1101
- confirm: () => ({
1102
- text: "Reload from the module's .tf files? They replace the canvas's saved and unsaved edits."
1103
- })
1104
- };
1105
- var INSIDE_A_GROUP = "The selection is inside a group \u2014 copy and cut act on top-level nodes and groups";
1106
- var CORE_EDITOR_ACTIONS = [
1107
- {
1108
- id: "save",
1109
- label: "Save",
1110
- icon: "save",
1111
- section: "write",
1112
- placement: "toolbar",
1113
- keys: ["Mod+s"],
1114
- // Heard at the App root: Save is reachable from an inspector field.
1115
- keyScope: "app",
1116
- requiredPorts: ["editor"],
1117
- requiredContext: ["root", "editable"],
1118
- binding: save
1119
- },
1029
+
1030
+ // src/components/nodes/GroupNode.tsx
1031
+ import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
1032
+ var GroupHeader = ({
1033
+ label,
1034
+ memberCount,
1035
+ collapsed,
1036
+ hovered,
1037
+ target,
1038
+ editing,
1039
+ editValue,
1040
+ inputRef,
1041
+ onToggleCollapsed,
1042
+ onDoubleClick,
1043
+ onEditChange,
1044
+ onEditBlur,
1045
+ onEditKeyDown
1046
+ }) => /* @__PURE__ */ jsxs3(
1047
+ "div",
1120
1048
  {
1121
- id: "generate",
1122
- label: "Generate",
1123
- icon: "generate",
1124
- section: "write",
1125
- // The toolbar's call to action while the saved IR waits to be
1126
- // generated; in flight from the click until the engine answers.
1127
- primary: { when: "ungenerated" },
1128
- busy: {
1129
- when: "generating",
1130
- label: { generating: "Generating\u2026", validating: "Validating the written Terraform\u2026" }
1049
+ className: `lace-group-node__header lace-group-node__header--${collapsed ? "collapsed" : "expanded"}`,
1050
+ style: collapsed ? { height: GROUP_HEADER_HEIGHT } : void 0,
1051
+ children: [
1052
+ /* @__PURE__ */ jsx8(
1053
+ "button",
1054
+ {
1055
+ type: "button",
1056
+ onClick: onToggleCollapsed,
1057
+ className: "lace-group-node__collapse-btn",
1058
+ title: collapsed ? "Expand" : "Collapse",
1059
+ "aria-label": collapsed ? "Expand" : "Collapse",
1060
+ children: /* @__PURE__ */ jsx8(CanvasIcon, { name: collapsed ? "chevron-right" : "chevron-down" })
1061
+ }
1062
+ ),
1063
+ /* @__PURE__ */ jsx8("span", { className: "lace-group-node__glyph", children: /* @__PURE__ */ jsx8(CanvasIcon, { name: "group" }) }),
1064
+ editing ? /* @__PURE__ */ jsx8(
1065
+ "input",
1066
+ {
1067
+ ref: inputRef,
1068
+ value: editValue,
1069
+ onChange: (e) => onEditChange(e.target.value),
1070
+ onBlur: onEditBlur,
1071
+ onKeyDown: onEditKeyDown,
1072
+ className: "lace-group-node__rename-input",
1073
+ onClick: (e) => e.stopPropagation()
1074
+ }
1075
+ ) : /* @__PURE__ */ jsx8("span", { className: "lace-group-node__label", onDoubleClick, title: label, children: label }),
1076
+ /* @__PURE__ */ jsxs3("span", { className: "lace-group-node__count", children: [
1077
+ memberCount,
1078
+ " ",
1079
+ memberCount === 1 ? "module" : "modules"
1080
+ ] }),
1081
+ hovered && /* @__PURE__ */ jsx8(CardActions, { target })
1082
+ ]
1083
+ }
1084
+ );
1085
+ var InterfacePinRow = ({ pin, y }) => {
1086
+ const isInput = pin.side === "input";
1087
+ return /* @__PURE__ */ jsxs3(
1088
+ "div",
1089
+ {
1090
+ style: {
1091
+ position: "absolute",
1092
+ top: y - NODE_ROW_HEIGHT / 2,
1093
+ left: 0,
1094
+ right: 0,
1095
+ height: NODE_ROW_HEIGHT,
1096
+ paddingLeft: isInput ? 12 : 8,
1097
+ paddingRight: isInput ? 8 : 12,
1098
+ display: "flex",
1099
+ alignItems: "center",
1100
+ justifyContent: isInput ? "flex-start" : "flex-end"
1101
+ },
1102
+ title: pin.name,
1103
+ children: [
1104
+ /* @__PURE__ */ jsx8(
1105
+ Handle,
1106
+ {
1107
+ id: pin.handleId,
1108
+ type: isInput ? "target" : "source",
1109
+ position: isInput ? Position.Left : Position.Right,
1110
+ isConnectable: false,
1111
+ className: "lace-pin-handle",
1112
+ style: {
1113
+ background: pin.color.fill,
1114
+ borderColor: pin.color.stroke,
1115
+ borderWidth: 1,
1116
+ borderStyle: "solid",
1117
+ width: 10,
1118
+ height: 10,
1119
+ [isInput ? "left" : "right"]: -5,
1120
+ top: NODE_ROW_HEIGHT / 2
1121
+ }
1122
+ }
1123
+ ),
1124
+ /* @__PURE__ */ jsx8("span", { className: "lace-group-node__pin-label", style: { maxWidth: COLLAPSED_GROUP_WIDTH - 28 }, children: pin.name })
1125
+ ]
1126
+ }
1127
+ );
1128
+ };
1129
+ var GroupNode = ({ data }) => {
1130
+ const { editable, bundle, arrangement, updateArrangement } = useCanvas();
1131
+ const rename = useRenameInstance();
1132
+ const [editing, setEditing] = useState4(false);
1133
+ const [editValue, setEditValue] = useState4(data.label);
1134
+ const [hovered, setHovered] = useState4(false);
1135
+ const inputRef = useRef3(null);
1136
+ const collapsed = data.collapsed;
1137
+ useEffect3(() => {
1138
+ if (editing && inputRef.current) {
1139
+ inputRef.current.focus();
1140
+ inputRef.current.select();
1141
+ }
1142
+ }, [editing]);
1143
+ const onDoubleClick = useCallback3(
1144
+ (e) => {
1145
+ if (!editable) return;
1146
+ e.stopPropagation();
1147
+ setEditValue(data.label);
1148
+ setEditing(true);
1131
1149
  },
1132
- placement: "toolbar",
1133
- requiredPorts: ["editor"],
1134
- requiredContext: ["root", "editable"],
1135
- // Hidden under the lock (requiredContext 'editable') exactly like Save;
1136
- // shown disabled while editable, positive keys in order: `generateIdle`
1137
- // (the engine runs one Generate at a time per session, and this one is
1138
- // running until the engine answers), then `resolved` (no open
1139
- // Keep/Reload conflict), then `saved` (nothing unsaved).
1140
- enabledWhen: [
1141
- { key: "generateIdle", reason: "A Generate is running" },
1142
- { key: "resolved", reason: "Keep or Reload the conflicting tree first" },
1143
- { key: "saved", reason: "Save first" }
1144
- ],
1145
- binding: generate
1146
- },
1147
- {
1148
- id: "undo",
1149
- label: "Undo",
1150
- icon: "undo",
1151
- section: "history",
1152
- placement: "toolbar",
1153
- keys: ["Mod+z"],
1154
- requiredPorts: ["editor"],
1155
- requiredContext: ["editable"],
1156
- enabledWhen: [{ key: "undoable", reason: "Nothing to undo" }],
1157
- binding: undo
1158
- },
1159
- {
1160
- id: "redo",
1161
- label: "Redo",
1162
- icon: "redo",
1163
- section: "history",
1164
- placement: "toolbar",
1165
- keys: ["Mod+Shift+z"],
1166
- requiredPorts: ["editor"],
1167
- requiredContext: ["editable"],
1168
- enabledWhen: [{ key: "redoable", reason: "Nothing to redo" }],
1169
- binding: redo
1170
- },
1171
- {
1172
- id: "clear-graph",
1173
- label: "Clear graph",
1174
- icon: "clear",
1175
- section: "graph",
1176
- placement: "toolbar",
1177
- requiredPorts: ["editor"],
1178
- requiredContext: ["editable"],
1179
- binding: clearGraph
1180
- },
1181
- {
1182
- id: "copy",
1183
- label: "Copy",
1184
- placement: "node-menu",
1185
- section: "clipboard",
1186
- keys: ["Mod+c"],
1187
- requiredPorts: ["editor"],
1188
- // Gated on a node selection existing at all — without it, Mod+C never
1189
- // resolves into the keymap's own action list, so it falls through to
1190
- // the browser's native copy (selected text in run logs/diagnostics)
1191
- // instead of hijacking the shortcut for an empty clipboard op.
1192
- requiredContext: ["editable", "selection.node"],
1193
- enabledWhen: [{ key: "selection.entryScope", reason: INSIDE_A_GROUP }],
1194
- binding: copy
1195
- },
1196
- {
1197
- id: "cut",
1198
- label: "Cut",
1199
- placement: "node-menu",
1200
- section: "clipboard",
1201
- keys: ["Mod+x"],
1202
- requiredPorts: ["editor"],
1203
- requiredContext: ["editable", "selection.node"],
1204
- enabledWhen: [{ key: "selection.entryScope", reason: INSIDE_A_GROUP }],
1205
- binding: cut
1206
- },
1207
- {
1208
- id: "paste",
1209
- label: "Paste",
1210
- // Pastes onto the canvas, not onto a node: the empty canvas's menu.
1211
- placement: "pane-menu",
1212
- keys: ["Mod+v"],
1213
- requiredPorts: ["editor"],
1214
- requiredContext: ["editable"],
1215
- binding: paste
1216
- },
1217
- {
1218
- id: "group",
1219
- label: "Group selected",
1220
- placement: "node-menu",
1221
- section: "group",
1222
- requiredPorts: ["editor"],
1223
- requiredContext: ["editable", "selection.node"],
1224
- enabledWhen: [{ key: "selection.several", reason: "Select at least two nodes to group" }],
1225
- binding: group
1226
- },
1227
- {
1228
- id: "ungroup",
1229
- label: "Ungroup",
1230
- placement: "node-menu",
1231
- section: "group",
1232
- requiredPorts: ["editor"],
1233
- requiredContext: ["editable"],
1234
- requiredTarget: ["groupId"],
1235
- binding: ungroup
1236
- },
1237
- {
1238
- id: "delete-node",
1239
- label: "Delete",
1240
- icon: "clear",
1241
- placement: "card",
1242
- tone: "danger",
1243
- requiredPorts: ["editor"],
1244
- requiredContext: ["editable"],
1245
- requiredTarget: ["nodeId"],
1246
- binding: deleteNode
1247
- },
1248
- {
1249
- id: "delete-selection",
1250
- label: "Delete",
1251
- // The node menu's Delete, over what the menu acts on as Copy, Cut and
1252
- // Group do; its keys are heard on the canvas's surface, where a field
1253
- // keeps them for its text.
1254
- placement: "node-menu",
1255
- section: "remove",
1256
- tone: "danger",
1257
- keys: ["Delete", "Backspace"],
1258
- requiredPorts: ["editor"],
1259
- requiredContext: ["editable", "selection.node"],
1260
- binding: deleteSelection
1261
- },
1262
- {
1263
- id: "conflict-keep",
1264
- label: "Keep canvas IR",
1265
- placement: { row: "conflict" },
1266
- // Hidden under the source-refused lock exactly like Save/Generate —
1267
- // `editable` gates Keep/Reload the same as every other mutating action.
1268
- requiredPorts: ["editor"],
1269
- requiredContext: ["editable"],
1270
- binding: conflictKeep
1271
- },
1272
- {
1273
- id: "conflict-reload",
1274
- label: "Reload from tf\u2026",
1275
- placement: { row: "conflict" },
1276
- requiredPorts: ["editor"],
1277
- requiredContext: ["editable"],
1278
- binding: conflictReload
1150
+ [data.label, editable]
1151
+ );
1152
+ const renamingRef = useRef3(false);
1153
+ const commitRename = useCallback3(async () => {
1154
+ if (renamingRef.current) return;
1155
+ renamingRef.current = true;
1156
+ setEditing(false);
1157
+ await rename(data.groupId, editValue.trim());
1158
+ renamingRef.current = false;
1159
+ }, [editValue, data.groupId, rename]);
1160
+ const onKeyDown = useCallback3(
1161
+ (e) => {
1162
+ e.stopPropagation();
1163
+ if (e.key === "Enter") commitRename();
1164
+ else if (e.key === "Escape") setEditing(false);
1165
+ },
1166
+ [commitRename]
1167
+ );
1168
+ const toggleCollapsed = useCallback3(
1169
+ (e) => {
1170
+ e.stopPropagation();
1171
+ updateArrangement(withGroupCollapsed(bundle, arrangement, data.groupId, !data.collapsed));
1172
+ },
1173
+ [bundle, data.groupId, data.collapsed, arrangement, updateArrangement]
1174
+ );
1175
+ const target = useMemo2(() => ({ groupId: data.groupId }), [data.groupId]);
1176
+ const headerProps = {
1177
+ label: data.label,
1178
+ memberCount: data.memberCount,
1179
+ collapsed,
1180
+ hovered,
1181
+ target,
1182
+ editing,
1183
+ editValue,
1184
+ inputRef,
1185
+ onToggleCollapsed: toggleCollapsed,
1186
+ onDoubleClick,
1187
+ onEditChange: setEditValue,
1188
+ onEditBlur: commitRename,
1189
+ onEditKeyDown: onKeyDown
1190
+ };
1191
+ if (collapsed) {
1192
+ const inputs = data.interfacePins.filter((p) => p.side === "input");
1193
+ const outputs = data.interfacePins.filter((p) => p.side === "output");
1194
+ const bare = data.interfacePins.length === 0;
1195
+ return /* @__PURE__ */ jsxs3(
1196
+ "div",
1197
+ {
1198
+ "data-group": data.groupId,
1199
+ "data-collapsed": "true",
1200
+ className: `lace-group-node lace-group-node--collapsed${bare ? " lace-group-node--bare" : ""}${data.hasErrors ? " lace-group-node--error" : ""}`,
1201
+ style: collapsedGroupSize({ inputs, outputs }),
1202
+ onMouseEnter: () => setHovered(true),
1203
+ onMouseLeave: () => setHovered(false),
1204
+ children: [
1205
+ /* @__PURE__ */ jsx8(GroupHeader, { ...headerProps }),
1206
+ /* @__PURE__ */ jsx8(BadgeRow, { badges: data.badges }),
1207
+ inputs.map((pin, i) => /* @__PURE__ */ jsx8(InterfacePinRow, { pin, y: groupPinY(i) }, pin.handleId)),
1208
+ outputs.map((pin, i) => /* @__PURE__ */ jsx8(InterfacePinRow, { pin, y: groupPinY(i) }, pin.handleId))
1209
+ ]
1210
+ }
1211
+ );
1279
1212
  }
1280
- ];
1213
+ return /* @__PURE__ */ jsxs3(
1214
+ "div",
1215
+ {
1216
+ "data-group": data.groupId,
1217
+ "data-collapsed": "false",
1218
+ className: "lace-group-node lace-group-node--expanded",
1219
+ style: { width: "100%", height: "100%" },
1220
+ onMouseEnter: () => setHovered(true),
1221
+ onMouseLeave: () => setHovered(false),
1222
+ children: [
1223
+ /* @__PURE__ */ jsx8(GroupHeader, { ...headerProps }),
1224
+ /* @__PURE__ */ jsx8(BadgeRow, { badges: data.badges })
1225
+ ]
1226
+ }
1227
+ );
1228
+ };
1229
+ var GroupNode_default = GroupNode;
1281
1230
 
1282
- // src/state/canvas-context.ts
1283
- import { createContext, useContext } from "react";
1284
- var CanvasContext = createContext(null);
1285
- function useCanvas() {
1286
- const value = useContext(CanvasContext);
1287
- if (!value) throw new Error("CanvasContext not available: mount inside <App>");
1288
- return value;
1289
- }
1231
+ // src/components/nodes/ModuleNode.tsx
1232
+ import {
1233
+ instanceAddress as instanceAddress2,
1234
+ NODE_HEADER_HEIGHT,
1235
+ NODE_ROW_HEIGHT as NODE_ROW_HEIGHT2,
1236
+ NODE_WIDTH,
1237
+ nodeRows,
1238
+ visibleInputs
1239
+ } from "@lace-cloud/proto";
1240
+ import {
1241
+ Handle as Handle2,
1242
+ Position as Position2,
1243
+ useStore as useStore3,
1244
+ useUpdateNodeInternals
1245
+ } from "@xyflow/react";
1246
+ import { useCallback as useCallback4, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef5, useState as useState5 } from "react";
1290
1247
 
1291
- // src/core/panels/row-actions.ts
1292
- function rowActionsFor(ctx, panelId, target = {}) {
1293
- const resolved = resolveContributions(ctx.contributions, ctx.ports, ctx, target);
1294
- return rowActions(resolved, panelId);
1248
+ // src/core/decorate.ts
1249
+ import { nodeIdForDiagnostic } from "@lace-cloud/proto";
1250
+ var EMPTY_DECORATIONS = { nodes: {} };
1251
+ function hasErrorBadge(badges) {
1252
+ return (badges ?? []).some((b) => b.tone === "error");
1295
1253
  }
1296
- function useEditorEnvExtras() {
1297
- const { bundle, arrangement, updateArrangement, layout } = useCanvas();
1298
- return {
1299
- bundle,
1300
- arrangement: { get: () => arrangement, update: updateArrangement },
1301
- layout
1254
+ function decorate(view, overlayDecorations, diagnostics) {
1255
+ if (overlayDecorations.length === 0 && diagnostics.length === 0) return EMPTY_DECORATIONS;
1256
+ const nodes = {};
1257
+ const addBadge = (nodeId, badge) => {
1258
+ if (!nodes[nodeId]) nodes[nodeId] = { badges: [] };
1259
+ nodes[nodeId].badges.push(badge);
1302
1260
  };
1261
+ for (const overlayResult of overlayDecorations) {
1262
+ for (const [nodeId, decoration] of Object.entries(overlayResult.nodes)) {
1263
+ for (const badge of decoration.badges) addBadge(nodeId, badge);
1264
+ }
1265
+ }
1266
+ const byNode = /* @__PURE__ */ new Map();
1267
+ for (const diagnostic of diagnostics) {
1268
+ const nodeId = nodeIdForDiagnostic(view, diagnostic);
1269
+ if (nodeId === null) continue;
1270
+ byNode.set(nodeId, [...byNode.get(nodeId) ?? [], diagnostic]);
1271
+ }
1272
+ for (const [nodeId, held] of byNode) {
1273
+ addBadge(nodeId, diagnosticsBadge(held));
1274
+ const pins = pinFindings(held);
1275
+ if (pins) nodes[nodeId].pins = pins;
1276
+ }
1277
+ return { nodes };
1303
1278
  }
1304
-
1305
- // src/components/nodes/BadgeRow.tsx
1306
- import { Badge as Chip } from "@lace-cloud/ui";
1307
- import "./BadgeRow-KVODWDQK.css";
1308
- import { jsx as jsx6 } from "react/jsx-runtime";
1309
- var VARIANT = {
1310
- neutral: "neutral",
1311
- warn: "warning",
1312
- error: "danger"
1313
- };
1314
- function BadgeRow({ badges }) {
1315
- if (badges.length === 0) return null;
1316
- return /* @__PURE__ */ jsx6("div", { className: "lace-badge-row", children: badges.map((b) => /* @__PURE__ */ jsx6(
1317
- Chip,
1318
- {
1319
- "data-badge": b.id,
1320
- "data-tone": b.tone,
1321
- variant: VARIANT[b.tone],
1322
- size: "md",
1323
- className: "lace-badge-row__chip",
1324
- title: b.title ?? b.label,
1325
- children: /* @__PURE__ */ jsx6("span", { className: "lace-badge-row__text", children: b.label })
1326
- },
1327
- b.id
1328
- )) });
1329
- }
1330
-
1331
- // src/components/nodes/GroupNode.tsx
1332
- import "./GroupNode-FXLQCVAE.css";
1333
-
1334
- // src/components/nodes/use-rename-instance.ts
1335
- import { instanceAddress as instanceAddress2 } from "@lace-cloud/proto";
1336
- import { useCallback, useRef as useRef2 } from "react";
1337
-
1338
- // src/core/pipeline.ts
1339
- import { projectCanvasView } from "@lace-cloud/proto";
1340
- import { useEffect as useEffect2, useState as useState3 } from "react";
1341
- function projectFrame(frame, arrangement) {
1342
- return projectCanvasView(frame.bundle, arrangement, {
1343
- canUndo: frame.canUndo,
1344
- canRedo: frame.canRedo,
1345
- unsaved: frame.unsaved,
1346
- conflict: frame.conflict ? { base_tree_hash: frame.conflict.baseTreeHash, tree_hash: frame.conflict.treeHash } : void 0,
1347
- ungenerated: frame.ungenerated
1348
- });
1279
+ var TONE_RANK = { neutral: 0, warn: 1, error: 2 };
1280
+ function toneOf(d) {
1281
+ return d.severity === "error" ? "error" : d.severity === "warning" ? "warn" : "neutral";
1349
1282
  }
1350
- var NO_SELECTION = { nodes: [], edges: [] };
1351
- function reconcileSelection(view, selection) {
1352
- const heldNodes = new Set([...view.nodes, ...view.groups].map((n) => n.id));
1353
- const heldEdges = new Set(view.edges.map((e) => e.id));
1354
- const nodes = selection.nodes.filter((id) => heldNodes.has(id));
1355
- const edges = selection.edges.filter((id) => heldEdges.has(id));
1356
- if (nodes.length === selection.nodes.length && edges.length === selection.edges.length) {
1357
- return selection;
1283
+ function pinFindings(held) {
1284
+ const pins = {};
1285
+ for (const d of held) {
1286
+ if (!d.input_name) continue;
1287
+ const tone = toneOf(d);
1288
+ const kept = pins[d.input_name];
1289
+ if (!kept || TONE_RANK[tone] > TONE_RANK[kept.tone]) {
1290
+ pins[d.input_name] = { message: d.message, tone };
1291
+ }
1358
1292
  }
1359
- return { nodes, edges };
1293
+ return Object.keys(pins).length > 0 ? pins : void 0;
1360
1294
  }
1361
- function carrySelection(selection, oldPath, newPath) {
1362
- const copies = selection.nodes.flatMap(
1363
- (id) => id === oldPath || id.startsWith(`${oldPath}.`) ? [newPath + id.slice(oldPath.length)] : []
1364
- );
1365
- if (copies.length === 0) return selection;
1366
- return { ...selection, nodes: [...selection.nodes, ...copies] };
1295
+ function diagnosticsBadge(held) {
1296
+ const tone = held.map(toneOf).reduce((worst, t) => TONE_RANK[t] > TONE_RANK[worst] ? t : worst);
1297
+ return {
1298
+ id: "diagnostics",
1299
+ label: counted(held.length, "problem"),
1300
+ tone,
1301
+ title: held.map((d) => d.message).join("\n")
1302
+ };
1367
1303
  }
1368
- function useCanvasSource(source, onCommandResult, onSessionEnd) {
1369
- const [state, setState] = useState3({ source: null, end: null, session: null });
1370
- useEffect2(() => {
1371
- const session = {};
1372
- setState({ source: null, end: null, session });
1373
- const unsubscribe = source.subscribe(
1374
- (next) => setState({ source: next, end: null, session }),
1375
- (end) => setState((prev) => ({ source: prev.source, end, session })),
1376
- (result) => onCommandResult(result, session)
1377
- );
1378
- return () => {
1379
- unsubscribe();
1380
- onSessionEnd(session);
1381
- };
1382
- }, [source, onCommandResult, onSessionEnd]);
1383
- return state;
1304
+
1305
+ // src/utils/handleId.ts
1306
+ var NODE_HANDLE = "node";
1307
+ function parseHandleId(handleId, prefix) {
1308
+ if (!handleId) return null;
1309
+ const marker = `${prefix}:`;
1310
+ if (!handleId.startsWith(marker)) return null;
1311
+ const name = handleId.slice(marker.length);
1312
+ return name.length > 0 ? name : null;
1313
+ }
1314
+ function sourceHandleId(output) {
1315
+ return `out:${output}`;
1384
1316
  }
1385
1317
 
1386
- // src/components/nodes/use-rename-instance.ts
1387
- function useRenameInstance() {
1388
- const { bundle, view, arrangement, updateArrangement, selection, setSelection, runner } = useCanvas();
1389
- const latest = useRef2({ view, selection });
1390
- latest.current = { view, selection };
1391
- return useCallback(
1392
- async (canvasPath, newId) => {
1393
- const { scope, id: oldId } = instanceAddress2(bundle, canvasPath);
1394
- if (!newId || newId === oldId) return;
1395
- const taken = bundle.modules[scope]?.modules?.some((u) => u.id === newId) ?? false;
1396
- const newPath = canvasPath.slice(0, canvasPath.length - oldId.length) + newId;
1397
- const carriedArrangement = taken ? arrangement : withRenameCarried(arrangement, scope, oldId, newId);
1398
- const carriedSelection = taken ? selection : carrySelection(selection, canvasPath, newPath);
1399
- if (carriedArrangement !== arrangement) updateArrangement(carriedArrangement);
1400
- if (carriedSelection !== selection) setSelection(carriedSelection);
1401
- const result = await runner.apply([
1402
- { rename_instance: { scope, old_id: oldId, new_id: newId } }
1403
- ]);
1404
- if (result?.success || carriedSelection === selection) return;
1405
- const now = latest.current;
1406
- const held = reconcileSelection(now.view, now.selection);
1407
- if (held !== now.selection) setSelection(held);
1408
- },
1409
- [bundle, arrangement, updateArrangement, selection, setSelection, runner]
1410
- );
1318
+ // src/utils/typed-name.ts
1319
+ function typedName(name, type) {
1320
+ return type ? `${name}: ${type}` : name;
1411
1321
  }
1412
1322
 
1413
- // src/components/nodes/GroupNode.tsx
1414
- import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
1415
- var GroupHeader = ({
1416
- label,
1417
- memberCount,
1418
- collapsed,
1419
- hovered,
1420
- editing,
1421
- editValue,
1422
- inputRef,
1423
- onToggleCollapsed,
1424
- onUngroup,
1425
- onDoubleClick,
1426
- onEditChange,
1427
- onEditBlur,
1428
- onEditKeyDown
1429
- }) => /* @__PURE__ */ jsxs3(
1430
- "div",
1431
- {
1432
- className: `lace-group-node__header lace-group-node__header--${collapsed ? "collapsed" : "expanded"}`,
1433
- style: collapsed ? { height: GROUP_HEADER_HEIGHT } : void 0,
1434
- children: [
1435
- /* @__PURE__ */ jsx7(
1436
- "button",
1437
- {
1438
- type: "button",
1439
- onClick: onToggleCollapsed,
1440
- className: "lace-group-node__collapse-btn",
1441
- title: collapsed ? "Expand" : "Collapse",
1442
- "aria-label": collapsed ? "Expand" : "Collapse",
1443
- children: /* @__PURE__ */ jsx7(CanvasIcon, { name: collapsed ? "chevron-right" : "chevron-down" })
1444
- }
1445
- ),
1446
- /* @__PURE__ */ jsx7("span", { className: "lace-group-node__glyph", children: /* @__PURE__ */ jsx7(CanvasIcon, { name: "group" }) }),
1447
- editing ? /* @__PURE__ */ jsx7(
1448
- "input",
1449
- {
1450
- ref: inputRef,
1451
- value: editValue,
1452
- onChange: (e) => onEditChange(e.target.value),
1453
- onBlur: onEditBlur,
1454
- onKeyDown: onEditKeyDown,
1455
- className: "lace-group-node__rename-input",
1456
- onClick: (e) => e.stopPropagation()
1457
- }
1458
- ) : /* @__PURE__ */ jsx7("span", { className: "lace-group-node__label", onDoubleClick, title: label, children: label }),
1459
- /* @__PURE__ */ jsxs3("span", { className: "lace-group-node__count", children: [
1460
- memberCount,
1461
- " ",
1462
- memberCount === 1 ? "module" : "modules"
1463
- ] }),
1464
- hovered && /* @__PURE__ */ jsx7(
1465
- "button",
1466
- {
1467
- type: "button",
1468
- onClick: onUngroup,
1469
- className: "lace-group-node__ungroup-btn",
1470
- title: "Ungroup",
1471
- "aria-label": "Ungroup",
1472
- children: /* @__PURE__ */ jsx7(CanvasIcon, { name: "close" })
1473
- }
1474
- )
1475
- ]
1476
- }
1477
- );
1478
- var InterfacePinRow = ({ pin, y }) => {
1479
- const isInput = pin.side === "input";
1480
- return /* @__PURE__ */ jsxs3(
1481
- "div",
1482
- {
1483
- style: {
1484
- position: "absolute",
1485
- top: y - NODE_ROW_HEIGHT / 2,
1486
- left: 0,
1487
- right: 0,
1488
- height: NODE_ROW_HEIGHT,
1489
- paddingLeft: isInput ? 12 : 8,
1490
- paddingRight: isInput ? 8 : 12,
1491
- display: "flex",
1492
- alignItems: "center",
1493
- justifyContent: isInput ? "flex-start" : "flex-end"
1494
- },
1495
- title: pin.name,
1496
- children: [
1497
- /* @__PURE__ */ jsx7(
1498
- Handle,
1499
- {
1500
- id: pin.handleId,
1501
- type: isInput ? "target" : "source",
1502
- position: isInput ? Position.Left : Position.Right,
1503
- isConnectable: false,
1504
- className: "lace-pin-handle",
1505
- style: {
1506
- background: pin.color.fill,
1507
- borderColor: pin.color.stroke,
1508
- borderWidth: 1,
1509
- borderStyle: "solid",
1510
- width: 10,
1511
- height: 10,
1512
- [isInput ? "left" : "right"]: -5,
1513
- top: NODE_ROW_HEIGHT / 2
1514
- }
1515
- }
1516
- ),
1517
- /* @__PURE__ */ jsx7("span", { className: "lace-group-node__pin-label", style: { maxWidth: COLLAPSED_GROUP_WIDTH - 28 }, children: pin.name })
1518
- ]
1519
- }
1520
- );
1521
- };
1522
- var GroupNode = ({ data }) => {
1523
- const { editable, ctx, runner, bundle, arrangement, updateArrangement } = useCanvas();
1524
- const rename = useRenameInstance();
1525
- const envExtras = useEditorEnvExtras();
1526
- const [editing, setEditing] = useState4(false);
1527
- const [editValue, setEditValue] = useState4(data.label);
1528
- const [hovered, setHovered] = useState4(false);
1529
- const inputRef = useRef3(null);
1530
- const collapsed = data.collapsed;
1531
- useEffect3(() => {
1532
- if (editing && inputRef.current) {
1533
- inputRef.current.focus();
1534
- inputRef.current.select();
1535
- }
1536
- }, [editing]);
1537
- const onDoubleClick = useCallback2(
1538
- (e) => {
1539
- if (!editable) return;
1540
- e.stopPropagation();
1541
- setEditValue(data.label);
1542
- setEditing(true);
1543
- },
1544
- [data.label, editable]
1545
- );
1546
- const renamingRef = useRef3(false);
1547
- const commitRename = useCallback2(async () => {
1548
- if (renamingRef.current) return;
1549
- renamingRef.current = true;
1550
- setEditing(false);
1551
- await rename(data.groupId, editValue.trim());
1552
- renamingRef.current = false;
1553
- }, [editValue, data.groupId, rename]);
1554
- const onKeyDown = useCallback2(
1555
- (e) => {
1556
- e.stopPropagation();
1557
- if (e.key === "Enter") commitRename();
1558
- else if (e.key === "Escape") setEditing(false);
1559
- },
1560
- [commitRename]
1561
- );
1562
- const toggleCollapsed = useCallback2(
1563
- (e) => {
1564
- e.stopPropagation();
1565
- updateArrangement(withGroupCollapsed(bundle, arrangement, data.groupId, !data.collapsed));
1566
- },
1567
- [bundle, data.groupId, data.collapsed, arrangement, updateArrangement]
1568
- );
1569
- const onUngroup = useCallback2(
1570
- async (e) => {
1571
- e.stopPropagation();
1572
- const action = ctx.contributions.actions.find((a) => a.id === "ungroup");
1573
- if (!action) return;
1574
- await runner.run(action, ctx, groupTarget(data.groupId), envExtras);
1575
- },
1576
- [ctx, runner, envExtras, data.groupId]
1577
- );
1578
- const headerProps = {
1579
- label: data.label,
1580
- memberCount: data.memberCount,
1581
- collapsed,
1582
- hovered: hovered && editable,
1583
- editing,
1584
- editValue,
1585
- inputRef,
1586
- onToggleCollapsed: toggleCollapsed,
1587
- onUngroup,
1588
- onDoubleClick,
1589
- onEditChange: setEditValue,
1590
- onEditBlur: commitRename,
1591
- onEditKeyDown: onKeyDown
1592
- };
1593
- if (collapsed) {
1594
- const inputs = data.interfacePins.filter((p) => p.side === "input");
1595
- const outputs = data.interfacePins.filter((p) => p.side === "output");
1596
- const bare = data.interfacePins.length === 0;
1597
- return /* @__PURE__ */ jsxs3(
1598
- "div",
1599
- {
1600
- "data-group": data.groupId,
1601
- "data-collapsed": "true",
1602
- className: `lace-group-node lace-group-node--collapsed${bare ? " lace-group-node--bare" : ""}${data.hasErrors ? " lace-group-node--error" : ""}`,
1603
- style: collapsedGroupSize({ inputs, outputs }),
1604
- onMouseEnter: () => setHovered(true),
1605
- onMouseLeave: () => setHovered(false),
1606
- children: [
1607
- /* @__PURE__ */ jsx7(GroupHeader, { ...headerProps }),
1608
- /* @__PURE__ */ jsx7(BadgeRow, { badges: data.badges }),
1609
- inputs.map((pin, i) => /* @__PURE__ */ jsx7(InterfacePinRow, { pin, y: groupPinY(i) }, pin.handleId)),
1610
- outputs.map((pin, i) => /* @__PURE__ */ jsx7(InterfacePinRow, { pin, y: groupPinY(i) }, pin.handleId))
1611
- ]
1612
- }
1613
- );
1614
- }
1615
- return /* @__PURE__ */ jsxs3(
1616
- "div",
1617
- {
1618
- "data-group": data.groupId,
1619
- "data-collapsed": "false",
1620
- className: "lace-group-node lace-group-node--expanded",
1621
- style: { width: "100%", height: "100%" },
1622
- onMouseEnter: () => setHovered(true),
1623
- onMouseLeave: () => setHovered(false),
1624
- children: [
1625
- /* @__PURE__ */ jsx7(GroupHeader, { ...headerProps }),
1626
- /* @__PURE__ */ jsx7(BadgeRow, { badges: data.badges })
1627
- ]
1628
- }
1629
- );
1630
- };
1631
- var GroupNode_default = GroupNode;
1632
-
1633
- // src/components/nodes/ModuleNode.tsx
1634
- import {
1635
- instanceAddress as instanceAddress3,
1636
- NODE_HEADER_HEIGHT,
1637
- NODE_ROW_HEIGHT as NODE_ROW_HEIGHT2,
1638
- NODE_WIDTH,
1639
- nodeRows,
1640
- visibleInputs
1641
- } from "@lace-cloud/proto";
1642
- import { inertProps as inertProps2, Tooltip as Tooltip2 } from "@lace-cloud/ui";
1643
- import {
1644
- Handle as Handle2,
1645
- Position as Position2,
1646
- useStore as useStore3,
1647
- useUpdateNodeInternals
1648
- } from "@xyflow/react";
1649
- import { useCallback as useCallback3, useEffect as useEffect4, useMemo, useRef as useRef5, useState as useState5 } from "react";
1650
-
1651
- // src/core/decorate.ts
1652
- import { nodeIdForDiagnostic } from "@lace-cloud/proto";
1653
- var EMPTY_DECORATIONS = { nodes: {} };
1654
- function hasErrorBadge(badges) {
1655
- return (badges ?? []).some((b) => b.tone === "error");
1656
- }
1657
- function decorate(view, overlayDecorations, diagnostics) {
1658
- if (overlayDecorations.length === 0 && diagnostics.length === 0) return EMPTY_DECORATIONS;
1659
- const nodes = {};
1660
- const addBadge = (nodeId, badge) => {
1661
- if (!nodes[nodeId]) nodes[nodeId] = { badges: [] };
1662
- nodes[nodeId].badges.push(badge);
1663
- };
1664
- for (const overlayResult of overlayDecorations) {
1665
- for (const [nodeId, decoration] of Object.entries(overlayResult.nodes)) {
1666
- for (const badge of decoration.badges) addBadge(nodeId, badge);
1667
- }
1668
- }
1669
- const byNode = /* @__PURE__ */ new Map();
1670
- for (const diagnostic of diagnostics) {
1671
- const nodeId = nodeIdForDiagnostic(view, diagnostic);
1672
- if (nodeId === null) continue;
1673
- byNode.set(nodeId, [...byNode.get(nodeId) ?? [], diagnostic]);
1674
- }
1675
- for (const [nodeId, held] of byNode) {
1676
- addBadge(nodeId, diagnosticsBadge(held));
1677
- const pins = pinFindings(held);
1678
- if (pins) nodes[nodeId].pins = pins;
1679
- }
1680
- return { nodes };
1681
- }
1682
- var TONE_RANK = { neutral: 0, warn: 1, error: 2 };
1683
- function toneOf(d) {
1684
- return d.severity === "error" ? "error" : d.severity === "warning" ? "warn" : "neutral";
1685
- }
1686
- function pinFindings(held) {
1687
- const pins = {};
1688
- for (const d of held) {
1689
- if (!d.input_name) continue;
1690
- const tone = toneOf(d);
1691
- const kept = pins[d.input_name];
1692
- if (!kept || TONE_RANK[tone] > TONE_RANK[kept.tone]) {
1693
- pins[d.input_name] = { message: d.message, tone };
1694
- }
1695
- }
1696
- return Object.keys(pins).length > 0 ? pins : void 0;
1697
- }
1698
- function diagnosticsBadge(held) {
1699
- const tone = held.map(toneOf).reduce((worst, t) => TONE_RANK[t] > TONE_RANK[worst] ? t : worst);
1700
- return {
1701
- id: "diagnostics",
1702
- label: `${held.length} ${held.length === 1 ? "problem" : "problems"}`,
1703
- tone,
1704
- title: held.map((d) => d.message).join("\n")
1705
- };
1706
- }
1707
-
1708
- // src/utils/handleId.ts
1709
- var NODE_HANDLE = "node";
1710
- function parseHandleId(handleId, prefix) {
1711
- if (!handleId) return null;
1712
- const marker = `${prefix}:`;
1713
- if (!handleId.startsWith(marker)) return null;
1714
- const name = handleId.slice(marker.length);
1715
- return name.length > 0 ? name : null;
1716
- }
1717
- function sourceHandleId(output) {
1718
- return `out:${output}`;
1719
- }
1720
-
1721
- // src/utils/typed-name.ts
1722
- function typedName(name, type) {
1723
- return type ? `${name}: ${type}` : name;
1724
- }
1725
-
1726
- // src/components/nodes/ModuleNode.tsx
1727
- import "./ModuleNode-PPAN7NLP.css";
1728
-
1729
- // src/components/nodes/node-config-bus.tsx
1730
- import { createContext as createContext2, useContext as useContext2, useRef as useRef4 } from "react";
1731
- import { jsx as jsx8 } from "react/jsx-runtime";
1732
- var NodeConfigBusContext = createContext2(null);
1733
- function NodeConfigBusProvider({
1734
- onOpen,
1735
- children
1736
- }) {
1737
- const onOpenRef = useRef4(onOpen);
1738
- onOpenRef.current = onOpen;
1739
- const stableRef = useRef4((instanceId) => onOpenRef.current(instanceId));
1740
- return /* @__PURE__ */ jsx8(NodeConfigBusContext.Provider, { value: stableRef.current, children });
1741
- }
1742
- function useOpenNodeConfig() {
1743
- const fn = useContext2(NodeConfigBusContext);
1744
- if (!fn) throw new Error("useOpenNodeConfig: mount inside <NodeConfigBusProvider>");
1745
- return fn;
1746
- }
1747
-
1748
- // src/components/nodes/pinColor.ts
1749
- var STRING = {
1750
- fill: "var(--lace-pin-string-fill)",
1751
- stroke: "var(--lace-pin-string-stroke)"
1323
+ // src/components/nodes/ModuleNode.tsx
1324
+ import "./ModuleNode-LPPBJZCD.css";
1325
+
1326
+ // src/components/nodes/node-config-bus.tsx
1327
+ import { createContext as createContext2, useContext as useContext2, useRef as useRef4 } from "react";
1328
+ import { jsx as jsx9 } from "react/jsx-runtime";
1329
+ var NodeConfigBusContext = createContext2(null);
1330
+ function NodeConfigBusProvider({
1331
+ onOpen,
1332
+ children
1333
+ }) {
1334
+ const onOpenRef = useRef4(onOpen);
1335
+ onOpenRef.current = onOpen;
1336
+ const stableRef = useRef4((instanceId) => onOpenRef.current(instanceId));
1337
+ return /* @__PURE__ */ jsx9(NodeConfigBusContext.Provider, { value: stableRef.current, children });
1338
+ }
1339
+ function useOpenNodeConfig() {
1340
+ const fn = useContext2(NodeConfigBusContext);
1341
+ if (!fn) throw new Error("useOpenNodeConfig: mount inside <NodeConfigBusProvider>");
1342
+ return fn;
1343
+ }
1344
+
1345
+ // src/components/nodes/pinColor.ts
1346
+ var STRING = {
1347
+ fill: "var(--lace-pin-string-fill)",
1348
+ stroke: "var(--lace-pin-string-stroke)"
1752
1349
  };
1753
1350
  var NUMBER = {
1754
1351
  fill: "var(--lace-pin-number-fill)",
@@ -1801,7 +1398,7 @@ function pinColor(pin) {
1801
1398
  }
1802
1399
 
1803
1400
  // src/components/nodes/ModuleNode.tsx
1804
- import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1401
+ import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
1805
1402
  var ICON_SIZE = 16;
1806
1403
  var LABEL_ROOM = NODE_WIDTH - 28;
1807
1404
  var labelRoom = (shared) => shared ? LABEL_ROOM / 2 - 4 : LABEL_ROOM;
@@ -1847,7 +1444,7 @@ var PinRow = ({ pin, side, top, shared, problem, isConnectable }) => {
1847
1444
  title: problem ? `${problem.message}
1848
1445
  ${about}` : about,
1849
1446
  children: [
1850
- /* @__PURE__ */ jsx9(
1447
+ /* @__PURE__ */ jsx10(
1851
1448
  Handle2,
1852
1449
  {
1853
1450
  id: `${isInput ? "in" : "out"}:${pin.name}`,
@@ -1858,7 +1455,7 @@ ${about}` : about,
1858
1455
  style: handleStyle
1859
1456
  }
1860
1457
  ),
1861
- /* @__PURE__ */ jsx9(
1458
+ /* @__PURE__ */ jsx10(
1862
1459
  "span",
1863
1460
  {
1864
1461
  className: `lace-module-node__pin-row-label lace-module-node__pin-row-label--${isError ? "error" : filled ? "wired" : "default"}`,
@@ -1871,11 +1468,10 @@ ${about}` : about,
1871
1468
  );
1872
1469
  };
1873
1470
  var ModuleNode = ({ id, data }) => {
1874
- const { editable, ctx, runner, bundle } = useCanvas();
1471
+ const { editable, bundle } = useCanvas();
1875
1472
  const rename = useRenameInstance();
1876
1473
  const connecting = useStore3(nodeDragging);
1877
1474
  const openNodeConfig = useOpenNodeConfig();
1878
- const envExtras = useEditorEnvExtras();
1879
1475
  const [editing, setEditing] = useState5(false);
1880
1476
  const [editValue, setEditValue] = useState5(id);
1881
1477
  const [hovered, setHovered] = useState5(false);
@@ -1892,7 +1488,7 @@ var ModuleNode = ({ id, data }) => {
1892
1488
  }, [editing]);
1893
1489
  const inputs = data.inputs ?? [];
1894
1490
  const outputs = data.outputs ?? [];
1895
- const { shownInputs, hiddenInputCount } = useMemo(() => {
1491
+ const { shownInputs, hiddenInputCount } = useMemo3(() => {
1896
1492
  if (showAllInputs) {
1897
1493
  return { shownInputs: inputs, hiddenInputCount: 0 };
1898
1494
  }
@@ -1911,23 +1507,23 @@ var ModuleNode = ({ id, data }) => {
1911
1507
  useEffect4(() => {
1912
1508
  updateNodeInternals(id);
1913
1509
  }, [id, drawnHandles, updateNodeInternals]);
1914
- const onDoubleClick = useCallback3(
1510
+ const onDoubleClick = useCallback4(
1915
1511
  (e) => {
1916
1512
  if (!editable) return;
1917
1513
  e.stopPropagation();
1918
- setEditValue(instanceAddress3(bundle, id).id);
1514
+ setEditValue(instanceAddress2(bundle, id).id);
1919
1515
  setEditing(true);
1920
1516
  },
1921
1517
  [id, editable, bundle]
1922
1518
  );
1923
- const commitRename = useCallback3(async () => {
1519
+ const commitRename = useCallback4(async () => {
1924
1520
  if (renamingRef.current) return;
1925
1521
  renamingRef.current = true;
1926
1522
  setEditing(false);
1927
1523
  await rename(id, editValue.trim());
1928
1524
  renamingRef.current = false;
1929
1525
  }, [editValue, id, rename]);
1930
- const onKeyDown = useCallback3(
1526
+ const onKeyDown = useCallback4(
1931
1527
  (e) => {
1932
1528
  e.stopPropagation();
1933
1529
  if (e.key === "Enter") commitRename();
@@ -1935,7 +1531,7 @@ var ModuleNode = ({ id, data }) => {
1935
1531
  },
1936
1532
  [commitRename]
1937
1533
  );
1938
- const onHeaderClick = useCallback3(
1534
+ const onHeaderClick = useCallback4(
1939
1535
  (e) => {
1940
1536
  if (!e.shiftKey && !e.metaKey && !e.ctrlKey) {
1941
1537
  openNodeConfig(data.id);
@@ -1943,25 +1539,12 @@ var ModuleNode = ({ id, data }) => {
1943
1539
  },
1944
1540
  [data.id, openNodeConfig]
1945
1541
  );
1946
- const target = useMemo(() => ({ nodeId: data.id }), [data.id]);
1947
- const cardActions = useMemo(
1948
- () => resolveContributions(ctx.contributions, ctx.ports, ctx, target).actions.filter(
1949
- (a) => a.placement === "card"
1950
- ),
1951
- [ctx, target]
1952
- );
1953
- const runOnCard = useCallback3(
1954
- (action) => (e) => {
1955
- e.stopPropagation();
1956
- void runner.run(action, ctx, target, envExtras);
1957
- },
1958
- [ctx, runner, envExtras, target]
1959
- );
1960
- const toggleCollapsed = useCallback3((e) => {
1542
+ const target = useMemo3(() => ({ nodeId: data.id }), [data.id]);
1543
+ const toggleCollapsed = useCallback4((e) => {
1961
1544
  e.stopPropagation();
1962
1545
  setCollapsed((v) => !v);
1963
1546
  }, []);
1964
- const toggleShowAllInputs = useCallback3((e) => {
1547
+ const toggleShowAllInputs = useCallback4((e) => {
1965
1548
  e.stopPropagation();
1966
1549
  setShowAllInputs((v) => !v);
1967
1550
  }, []);
@@ -1989,7 +1572,7 @@ var ModuleNode = ({ id, data }) => {
1989
1572
  onClick: onHeaderClick,
1990
1573
  title: badges.length > 0 ? badges.map((b) => b.title ?? b.label).join("\n") : data.label,
1991
1574
  children: [
1992
- /* @__PURE__ */ jsx9(
1575
+ /* @__PURE__ */ jsx10(
1993
1576
  "button",
1994
1577
  {
1995
1578
  type: "button",
@@ -1997,10 +1580,10 @@ var ModuleNode = ({ id, data }) => {
1997
1580
  className: "lace-module-node__collapse-btn",
1998
1581
  title: collapsed ? "Expand" : "Collapse",
1999
1582
  "aria-label": collapsed ? "Expand" : "Collapse",
2000
- children: /* @__PURE__ */ jsx9(CanvasIcon, { name: collapsed ? "chevron-right" : "chevron-down" })
1583
+ children: /* @__PURE__ */ jsx10(CanvasIcon, { name: collapsed ? "chevron-right" : "chevron-down" })
2001
1584
  }
2002
1585
  ),
2003
- showIcon ? /* @__PURE__ */ jsx9(
1586
+ showIcon ? /* @__PURE__ */ jsx10(
2004
1587
  "img",
2005
1588
  {
2006
1589
  src: data.icon_url,
@@ -2009,8 +1592,8 @@ var ModuleNode = ({ id, data }) => {
2009
1592
  style: { width: ICON_SIZE, height: ICON_SIZE },
2010
1593
  onError: () => setImgFailed(true)
2011
1594
  }
2012
- ) : /* @__PURE__ */ jsx9("span", { className: "lace-module-node__icon-fallback", children: /* @__PURE__ */ jsx9(CanvasIcon, { name: "module" }) }),
2013
- editing ? /* @__PURE__ */ jsx9(
1595
+ ) : /* @__PURE__ */ jsx10("span", { className: "lace-module-node__icon-fallback", children: /* @__PURE__ */ jsx10(CanvasIcon, { name: "module" }) }),
1596
+ editing ? /* @__PURE__ */ jsx10(
2014
1597
  "input",
2015
1598
  {
2016
1599
  ref: inputRef,
@@ -2021,7 +1604,7 @@ var ModuleNode = ({ id, data }) => {
2021
1604
  className: "lace-module-node__rename-input",
2022
1605
  onClick: (e) => e.stopPropagation()
2023
1606
  }
2024
- ) : /* @__PURE__ */ jsx9(
1607
+ ) : /* @__PURE__ */ jsx10(
2025
1608
  "span",
2026
1609
  {
2027
1610
  className: "lace-module-node__label",
@@ -2030,34 +1613,12 @@ var ModuleNode = ({ id, data }) => {
2030
1613
  children: data.label
2031
1614
  }
2032
1615
  ),
2033
- hovered && cardActions.map((action) => {
2034
- const state = actionState(action, ctx, runner.busy(action, ctx, target));
2035
- return /* @__PURE__ */ jsx9(
2036
- Tooltip2,
2037
- {
2038
- name: action.label,
2039
- content: state.disabledReason,
2040
- placement: "bottom-end",
2041
- children: (describedBy) => /* @__PURE__ */ jsx9(
2042
- "button",
2043
- {
2044
- type: "button",
2045
- className: `lace-module-node__action${action.tone === "danger" ? " lace-module-node__action--danger" : ""}`,
2046
- "aria-label": action.label,
2047
- "aria-describedby": describedBy,
2048
- ...inertProps2(isInert(state), runOnCard(action)),
2049
- children: action.icon ? /* @__PURE__ */ jsx9(CanvasIcon, { name: action.icon }) : action.label
2050
- }
2051
- )
2052
- },
2053
- action.id
2054
- );
2055
- })
1616
+ hovered && /* @__PURE__ */ jsx10(CardActions, { target })
2056
1617
  ]
2057
1618
  }
2058
1619
  ),
2059
- /* @__PURE__ */ jsx9(BadgeRow, { badges }),
2060
- data.call_wired && /* @__PURE__ */ jsx9(
1620
+ /* @__PURE__ */ jsx10(BadgeRow, { badges }),
1621
+ data.call_wired && /* @__PURE__ */ jsx10(
2061
1622
  Handle2,
2062
1623
  {
2063
1624
  id: sourceHandleId(""),
@@ -2078,7 +1639,7 @@ var ModuleNode = ({ id, data }) => {
2078
1639
  }
2079
1640
  ),
2080
1641
  !collapsed && /* @__PURE__ */ jsxs4("div", { className: "lace-module-node__body", style: { height: bodyHeight }, children: [
2081
- shownInputs.map((pin, i) => /* @__PURE__ */ jsx9(
1642
+ shownInputs.map((pin, i) => /* @__PURE__ */ jsx10(
2082
1643
  PinRow,
2083
1644
  {
2084
1645
  pin,
@@ -2090,7 +1651,7 @@ var ModuleNode = ({ id, data }) => {
2090
1651
  },
2091
1652
  `in:${pin.name}`
2092
1653
  )),
2093
- outputs.map((pin, i) => /* @__PURE__ */ jsx9(
1654
+ outputs.map((pin, i) => /* @__PURE__ */ jsx10(
2094
1655
  PinRow,
2095
1656
  {
2096
1657
  pin,
@@ -2129,7 +1690,7 @@ var ModuleNode = ({ id, data }) => {
2129
1690
  collapsed && /* @__PURE__ */ jsxs4(Fragment4, { children: [
2130
1691
  inputs.map((pin, i) => {
2131
1692
  const color = pinColor(pin);
2132
- return /* @__PURE__ */ jsx9(
1693
+ return /* @__PURE__ */ jsx10(
2133
1694
  Handle2,
2134
1695
  {
2135
1696
  id: `in:${pin.name}`,
@@ -2153,7 +1714,7 @@ var ModuleNode = ({ id, data }) => {
2153
1714
  }),
2154
1715
  outputs.map((pin, i) => {
2155
1716
  const color = pinColor(pin);
2156
- return /* @__PURE__ */ jsx9(
1717
+ return /* @__PURE__ */ jsx10(
2157
1718
  Handle2,
2158
1719
  {
2159
1720
  id: `out:${pin.name}`,
@@ -2177,7 +1738,7 @@ var ModuleNode = ({ id, data }) => {
2177
1738
  })
2178
1739
  ] }),
2179
1740
  editable && /* @__PURE__ */ jsxs4(Fragment4, { children: [
2180
- /* @__PURE__ */ jsx9(
1741
+ /* @__PURE__ */ jsx10(
2181
1742
  Handle2,
2182
1743
  {
2183
1744
  id: NODE_HANDLE,
@@ -2187,7 +1748,7 @@ var ModuleNode = ({ id, data }) => {
2187
1748
  className: "lace-module-node__grip"
2188
1749
  }
2189
1750
  ),
2190
- /* @__PURE__ */ jsx9(
1751
+ /* @__PURE__ */ jsx10(
2191
1752
  Handle2,
2192
1753
  {
2193
1754
  id: NODE_HANDLE,
@@ -2207,10 +1768,462 @@ var ModuleNode_default = ModuleNode;
2207
1768
 
2208
1769
  // src/components/PaperGrid.tsx
2209
1770
  import "./PaperGrid-JG4GBRDP.css";
2210
- import { jsx as jsx10 } from "react/jsx-runtime";
1771
+ import { jsx as jsx11 } from "react/jsx-runtime";
2211
1772
  function PaperGrid() {
2212
- return /* @__PURE__ */ jsx10("div", { className: "lace-paper-layers lace-canvas-paper", "aria-hidden": "true" });
1773
+ return /* @__PURE__ */ jsx11("div", { className: "lace-paper-layers lace-canvas-paper", "aria-hidden": "true" });
1774
+ }
1775
+
1776
+ // src/core/editor-actions.ts
1777
+ import {
1778
+ boxAt,
1779
+ drawnRect,
1780
+ extentOf,
1781
+ freeSlot,
1782
+ groupBoxSize,
1783
+ groupPins,
1784
+ groupReach,
1785
+ instanceAddress as instanceAddress3,
1786
+ joinPath,
1787
+ keepOrder,
1788
+ localIn as localIn2,
1789
+ originAt,
1790
+ reachRect,
1791
+ splitPath as splitPath2,
1792
+ stepDown
1793
+ } from "@lace-cloud/proto";
1794
+ function emptyApplyResult() {
1795
+ return { success: true, errors: [], created: [], ties: [] };
2213
1796
  }
1797
+ function copySource(env) {
1798
+ return inEntryScope(env.ctx.view, env.ctx.selection.nodes);
1799
+ }
1800
+ function placeCreatedClones(bundle, view, arrangement, created) {
1801
+ const sources = /* @__PURE__ */ new Map();
1802
+ for (const ref of created) {
1803
+ const rect = ref.scope === bundle.entry && ref.sourceId ? reachRect(view, ref.sourceId) : void 0;
1804
+ if (rect) {
1805
+ sources.set(ref.id, {
1806
+ sourceId: ref.sourceId,
1807
+ rect,
1808
+ stored: localIn2(view, ref.sourceId, rect)
1809
+ });
1810
+ }
1811
+ }
1812
+ const first = sources.values().next().value;
1813
+ if (!first) return arrangement;
1814
+ const extent = extentOf([...sources.values()].map((s) => s.rect));
1815
+ const occupied = entryScopeIds(view).flatMap((id) => drawnRect(view, id) ?? []);
1816
+ const slot = freeSlot(extent, occupied);
1817
+ const pinned = withScopesPinned(bundle, view, arrangement, first.sourceId);
1818
+ const scopeEntry = pinned[bundle.entry] ?? {};
1819
+ const placed = {};
1820
+ for (const [id, { stored }] of sources) {
1821
+ placed[id] = { x: slot.x - extent.x + stored.x, y: slot.y - extent.y + stored.y };
1822
+ }
1823
+ return setScopeEntry(pinned, bundle.entry, {
1824
+ ...scopeEntry,
1825
+ nodes: { ...scopeEntry.nodes, ...placed }
1826
+ });
1827
+ }
1828
+ async function saveRun(env) {
1829
+ await env.editor.save();
1830
+ }
1831
+ function generateRun(env) {
1832
+ return env.editor.generate();
1833
+ }
1834
+ async function undoRun(env) {
1835
+ return env.apply([{ undo: {} }]);
1836
+ }
1837
+ async function redoRun(env) {
1838
+ return env.apply([{ redo: {} }]);
1839
+ }
1840
+ async function clearGraphRun(env) {
1841
+ const ids = entryScopeIds(env.ctx.view);
1842
+ if (ids.length === 0) return emptyApplyResult();
1843
+ const scope = env.bundle.entry;
1844
+ return env.apply(ids.map((id) => ({ delete_instance: { scope, instance_id: id } })));
1845
+ }
1846
+ function clipRun(cut2) {
1847
+ return async (env) => {
1848
+ const ids = copySource(env);
1849
+ env.clipboard.set(ids, cut2);
1850
+ env.ctx.ports.presenter.notify(
1851
+ "info",
1852
+ `${cut2 ? "Cut" : "Copied"} ${ids.length} node${ids.length > 1 ? "s" : ""}`
1853
+ );
1854
+ };
1855
+ }
1856
+ async function pasteRun(env) {
1857
+ const clip = env.clipboard.get();
1858
+ if (!clip) {
1859
+ env.ctx.ports.presenter.notify("error", "Clipboard empty \u2014 copy a node first");
1860
+ return emptyApplyResult();
1861
+ }
1862
+ const { ids, cut: cut2 } = clip;
1863
+ const scope = env.bundle.entry;
1864
+ const actions = cut2 ? [
1865
+ { copy_instances: { scope, instance_ids: [...ids] } },
1866
+ ...ids.map((id) => ({ delete_instance: { scope, instance_id: id } }))
1867
+ ] : [{ copy_instances: { scope, instance_ids: [...ids] } }];
1868
+ const result = await env.apply(actions);
1869
+ if (!result.success) return result;
1870
+ const created = result.created.filter((c) => c.sourceId);
1871
+ if (created.length === 0) {
1872
+ if (!cut2) {
1873
+ env.ctx.ports.presenter.notify("error", "Paste produced no new nodes \u2014 nothing pasted");
1874
+ }
1875
+ } else {
1876
+ env.arrangement.update(
1877
+ placeCreatedClones(env.bundle, env.ctx.view, env.arrangement.get(), created)
1878
+ );
1879
+ }
1880
+ if (cut2) env.clipboard.clear();
1881
+ return result;
1882
+ }
1883
+ async function groupRun(env) {
1884
+ const ids = env.ctx.selection.nodes;
1885
+ const addresses = ids.map((id) => instanceAddress3(env.bundle, id));
1886
+ const { scope } = addresses[0];
1887
+ const nodeIds = addresses.map((address) => address.id);
1888
+ const result = await env.apply([{ create_group: { scope, node_ids: nodeIds } }]);
1889
+ if (!result.success) return result;
1890
+ const created = result.created[0];
1891
+ if (!created?.moduleKey) return result;
1892
+ const frame = await currentFrame(env.ctx.ports.source);
1893
+ const minted = frame?.bundle.modules[created.moduleKey];
1894
+ if (!minted) {
1895
+ throw new Error(`Group: the source delivered no module ${created.moduleKey} after the apply`);
1896
+ }
1897
+ const view = env.ctx.view;
1898
+ const before = withScopesPinned(env.bundle, view, env.arrangement.get(), ids[0]);
1899
+ const parentEntry = before[created.scope] ?? {};
1900
+ const drawn = ids.flatMap((id) => {
1901
+ const rect = drawnRect(view, id);
1902
+ return rect ? [{ id, localId: splitPath2(id).localId, rect }] : [];
1903
+ });
1904
+ if (drawn.length === 0) return result;
1905
+ const members = extentOf(drawn.map((m) => m.rect));
1906
+ const origin = { x: members.x, y: members.y };
1907
+ const memberGroups = Object.fromEntries(
1908
+ drawn.flatMap(({ localId }) => {
1909
+ const entry = parentEntry.groups?.[localId];
1910
+ return entry ? [[localId, entry]] : [];
1911
+ })
1912
+ );
1913
+ const next = setScopeEntry(before, created.moduleKey, {
1914
+ nodes: Object.fromEntries(
1915
+ drawn.map(({ id, localId, rect }) => [localId, localIn2(view, id, rect, origin)])
1916
+ ),
1917
+ groups: Object.keys(memberGroups).length > 0 ? memberGroups : void 0
1918
+ });
1919
+ const reach = groupReach(groupPins(minted), groupBoxSize(members));
1920
+ const { parentPath } = splitPath2(ids[0]);
1921
+ const groupPath = joinPath(parentPath, created.id);
1922
+ const declared = new Map(
1923
+ (frame.bundle.modules[created.scope]?.modules ?? []).map((use, i) => [use.id, i])
1924
+ );
1925
+ const keyOf = (id, at) => ({ ...at, declared: declared.get(id) ?? 0 });
1926
+ const selected = new Set(ids);
1927
+ const others = [...view.nodes, ...view.groups].flatMap(({ id }) => {
1928
+ const { parentPath: scopePath, localId } = splitPath2(id);
1929
+ const rect = selected.has(id) || scopePath !== parentPath ? void 0 : drawnRect(view, id);
1930
+ return rect ? [{ rect, key: keyOf(localId, rect) }] : [];
1931
+ });
1932
+ const enclosing = view.groups.find((g) => g.id === parentPath);
1933
+ const wanted = boxAt(origin);
1934
+ let anchor = enclosing ? { x: wanted.x, y: Math.max(wanted.y, originAt(enclosing.position).y) } : wanted;
1935
+ for (let moved = true; moved; ) {
1936
+ const groupKey = keyOf(created.id, anchor);
1937
+ const keptFirst = others.filter((o) => keepOrder(o.key, groupKey) < 0).map((o) => o.rect);
1938
+ const stepped = stepDown(anchor, reach, keptFirst);
1939
+ moved = stepped.y !== anchor.y;
1940
+ anchor = stepped;
1941
+ }
1942
+ const written = setScopeEntry(next, created.scope, {
1943
+ nodes: { ...parentEntry.nodes, [created.id]: localIn2(view, groupPath, anchor) },
1944
+ groups: { ...parentEntry.groups, [created.id]: { collapsed: true } }
1945
+ });
1946
+ env.arrangement.update(written);
1947
+ return result;
1948
+ }
1949
+ function groupTarget(id) {
1950
+ return { nodeId: id, groupId: id };
1951
+ }
1952
+ function ungroupAction(bundle, id) {
1953
+ const { scope, id: group_id } = instanceAddress3(bundle, id);
1954
+ return { ungroup: { scope, group_id } };
1955
+ }
1956
+ async function applyDissolving(env, actions, dissolved) {
1957
+ const result = await env.apply(actions);
1958
+ if (!result.success) return result;
1959
+ const before = env.arrangement.get();
1960
+ const after = dissolved.reduce((arrangement, id) => {
1961
+ const moduleKey = env.ctx.view.groups.find((g) => g.id === id)?.module_key;
1962
+ return moduleKey ? migrateUngroup(env.bundle, env.ctx.view, arrangement, id, moduleKey, result.created) : arrangement;
1963
+ }, before);
1964
+ if (after !== before) env.arrangement.update(after);
1965
+ return result;
1966
+ }
1967
+ async function ungroupRun(env) {
1968
+ const groupId = env.target.groupId;
1969
+ if (!groupId) return emptyApplyResult();
1970
+ return applyDissolving(env, [ungroupAction(env.bundle, groupId)], [groupId]);
1971
+ }
1972
+ async function deleteRun(env, ids) {
1973
+ if (ids.length === 0) return emptyApplyResult();
1974
+ const groups = new Set(env.ctx.view.groups.map((g) => g.id));
1975
+ const calls = ids.filter((id) => !groups.has(id));
1976
+ const dissolved = ids.filter((id) => groups.has(id)).sort((a, b) => b.length - a.length);
1977
+ const deletes = calls.map((id) => {
1978
+ const { scope, id: instance_id } = instanceAddress3(env.bundle, id);
1979
+ return { delete_instance: { scope, instance_id } };
1980
+ });
1981
+ return applyDissolving(
1982
+ env,
1983
+ [...deletes, ...dissolved.map((id) => ungroupAction(env.bundle, id))],
1984
+ dissolved
1985
+ );
1986
+ }
1987
+ async function deleteNodeRun(env) {
1988
+ return deleteRun(env, env.target.nodeId === void 0 ? [] : [env.target.nodeId]);
1989
+ }
1990
+ async function deleteSelectionRun(env) {
1991
+ return deleteRun(env, env.ctx.selection.nodes);
1992
+ }
1993
+ async function conflictKeepRun(env) {
1994
+ const conflict = env.ctx.view.conflict;
1995
+ if (!conflict) return;
1996
+ await env.editor.resolveConflict("keep", conflict.tree_hash);
1997
+ }
1998
+ async function conflictReloadRun(env) {
1999
+ const conflict = env.ctx.view.conflict;
2000
+ if (!conflict) return;
2001
+ await env.editor.resolveConflict("reload", conflict.tree_hash);
2002
+ }
2003
+ var save = { kind: "editor", result: "none", run: saveRun };
2004
+ var generate = { kind: "editor", result: "generate", run: generateRun };
2005
+ var undo = { kind: "editor", result: "apply", run: undoRun };
2006
+ var redo = { kind: "editor", result: "apply", run: redoRun };
2007
+ var clearGraph = {
2008
+ kind: "editor",
2009
+ result: "apply",
2010
+ run: clearGraphRun,
2011
+ confirm: () => ({
2012
+ text: "Clear the graph? Every module call and group on the canvas is deleted; Undo brings them back."
2013
+ })
2014
+ };
2015
+ var copy = { kind: "editor", result: "none", run: clipRun(false) };
2016
+ var cut = { kind: "editor", result: "none", run: clipRun(true) };
2017
+ var paste = { kind: "editor", result: "apply", run: pasteRun };
2018
+ var group = { kind: "editor", result: "apply", run: groupRun };
2019
+ var ungroup = { kind: "editor", result: "apply", run: ungroupRun };
2020
+ var deleteNode = { kind: "editor", result: "apply", run: deleteNodeRun };
2021
+ var deleteSelection = {
2022
+ kind: "editor",
2023
+ result: "apply",
2024
+ run: deleteSelectionRun
2025
+ };
2026
+ var conflictKeep = { kind: "editor", result: "none", run: conflictKeepRun };
2027
+ var conflictReload = {
2028
+ kind: "editor",
2029
+ result: "none",
2030
+ run: conflictReloadRun,
2031
+ confirm: () => ({
2032
+ text: "Reload from the module's .tf files? They replace the canvas's saved and unsaved edits."
2033
+ })
2034
+ };
2035
+ var INSIDE_A_GROUP = "The selection is inside a group \u2014 copy and cut act on top-level nodes and groups";
2036
+ var SPANS_A_GROUP_EDGE = "The selection spans a group\u2019s edge \u2014 group nodes that are all top-level or all inside one group";
2037
+ var CORE_EDITOR_ACTIONS = [
2038
+ {
2039
+ id: "save",
2040
+ label: "Save",
2041
+ icon: "save",
2042
+ section: "write",
2043
+ placement: "toolbar",
2044
+ keys: ["Mod+s"],
2045
+ // Heard at the App root: Save is reachable from an inspector field.
2046
+ keyScope: "app",
2047
+ requiredPorts: ["editor"],
2048
+ requiredContext: ["root", "editable"],
2049
+ binding: save
2050
+ },
2051
+ {
2052
+ id: "generate",
2053
+ label: "Generate",
2054
+ icon: "generate",
2055
+ section: "write",
2056
+ // The toolbar's call to action while the saved IR waits to be
2057
+ // generated; in flight from the click until the engine answers.
2058
+ primary: { when: "ungenerated" },
2059
+ busy: {
2060
+ when: "generating",
2061
+ label: { generating: "Generating\u2026", validating: "Validating the written Terraform\u2026" }
2062
+ },
2063
+ placement: "toolbar",
2064
+ requiredPorts: ["editor"],
2065
+ requiredContext: ["root", "editable"],
2066
+ // Hidden under the lock (requiredContext 'editable') exactly like Save;
2067
+ // shown disabled while editable, positive keys in order: `generateIdle`
2068
+ // (the engine runs one Generate at a time per session, and this one is
2069
+ // running until the engine answers), then `resolved` (no open
2070
+ // Keep/Reload conflict), then `saved` (nothing unsaved).
2071
+ enabledWhen: [
2072
+ { key: "generateIdle", reason: "A Generate is running" },
2073
+ { key: "resolved", reason: "Keep or Reload the conflicting tree first" },
2074
+ { key: "saved", reason: "Save first" }
2075
+ ],
2076
+ binding: generate
2077
+ },
2078
+ {
2079
+ id: "undo",
2080
+ label: "Undo",
2081
+ icon: "undo",
2082
+ section: "history",
2083
+ placement: "toolbar",
2084
+ keys: ["Mod+z"],
2085
+ requiredPorts: ["editor"],
2086
+ requiredContext: ["editable"],
2087
+ enabledWhen: [{ key: "undoable", reason: "Nothing to undo" }],
2088
+ binding: undo
2089
+ },
2090
+ {
2091
+ id: "redo",
2092
+ label: "Redo",
2093
+ icon: "redo",
2094
+ section: "history",
2095
+ placement: "toolbar",
2096
+ keys: ["Mod+Shift+z"],
2097
+ requiredPorts: ["editor"],
2098
+ requiredContext: ["editable"],
2099
+ enabledWhen: [{ key: "redoable", reason: "Nothing to redo" }],
2100
+ binding: redo
2101
+ },
2102
+ {
2103
+ id: "clear-graph",
2104
+ label: "Clear graph",
2105
+ icon: "clear",
2106
+ section: "graph",
2107
+ placement: "toolbar",
2108
+ requiredPorts: ["editor"],
2109
+ requiredContext: ["editable"],
2110
+ binding: clearGraph
2111
+ },
2112
+ {
2113
+ id: "copy",
2114
+ label: "Copy",
2115
+ placement: "node-menu",
2116
+ section: "clipboard",
2117
+ keys: ["Mod+c"],
2118
+ requiredPorts: ["editor"],
2119
+ // Gated on a node selection existing at all — without it, Mod+C never
2120
+ // resolves into the keymap's own action list, so it falls through to
2121
+ // the browser's native copy (selected text in run logs/diagnostics)
2122
+ // instead of hijacking the shortcut for an empty clipboard op.
2123
+ requiredContext: ["editable", "selection.node"],
2124
+ enabledWhen: [{ key: "selection.entryScope", reason: INSIDE_A_GROUP }],
2125
+ binding: copy
2126
+ },
2127
+ {
2128
+ id: "cut",
2129
+ label: "Cut",
2130
+ placement: "node-menu",
2131
+ section: "clipboard",
2132
+ keys: ["Mod+x"],
2133
+ requiredPorts: ["editor"],
2134
+ requiredContext: ["editable", "selection.node"],
2135
+ enabledWhen: [{ key: "selection.entryScope", reason: INSIDE_A_GROUP }],
2136
+ binding: cut
2137
+ },
2138
+ {
2139
+ id: "paste",
2140
+ label: "Paste",
2141
+ // Pastes onto the canvas, not onto a node: the empty canvas's menu.
2142
+ placement: "pane-menu",
2143
+ keys: ["Mod+v"],
2144
+ requiredPorts: ["editor"],
2145
+ requiredContext: ["editable"],
2146
+ binding: paste
2147
+ },
2148
+ {
2149
+ id: "group",
2150
+ label: "Group selected",
2151
+ placement: "node-menu",
2152
+ section: "group",
2153
+ requiredPorts: ["editor"],
2154
+ requiredContext: ["editable", "selection.node"],
2155
+ enabledWhen: [
2156
+ { key: "selection.several", reason: "Select at least two nodes to group" },
2157
+ { key: "selection.oneScope", reason: SPANS_A_GROUP_EDGE }
2158
+ ],
2159
+ binding: group
2160
+ },
2161
+ {
2162
+ id: "ungroup",
2163
+ label: "Ungroup",
2164
+ placement: "node-menu",
2165
+ section: "group",
2166
+ requiredPorts: ["editor"],
2167
+ requiredContext: ["editable"],
2168
+ requiredTarget: ["groupId"],
2169
+ binding: ungroup
2170
+ },
2171
+ // Ungroup on a group card's own controls: the same `ungroup` the node
2172
+ // menu runs, on the card's group.
2173
+ {
2174
+ id: "ungroup-card",
2175
+ label: "Ungroup",
2176
+ icon: "close",
2177
+ placement: "card",
2178
+ requiredPorts: ["editor"],
2179
+ requiredContext: ["editable"],
2180
+ requiredTarget: ["groupId"],
2181
+ binding: ungroup
2182
+ },
2183
+ {
2184
+ id: "delete-node",
2185
+ label: "Delete",
2186
+ icon: "clear",
2187
+ placement: "card",
2188
+ tone: "danger",
2189
+ requiredPorts: ["editor"],
2190
+ requiredContext: ["editable"],
2191
+ requiredTarget: ["nodeId"],
2192
+ binding: deleteNode
2193
+ },
2194
+ {
2195
+ id: "delete-selection",
2196
+ label: "Delete",
2197
+ // The node menu's Delete, over what the menu acts on as Copy, Cut and
2198
+ // Group do; its keys are heard on the canvas's surface, where a field
2199
+ // keeps them for its text.
2200
+ placement: "node-menu",
2201
+ section: "remove",
2202
+ tone: "danger",
2203
+ keys: ["Delete", "Backspace"],
2204
+ requiredPorts: ["editor"],
2205
+ requiredContext: ["editable", "selection.node"],
2206
+ binding: deleteSelection
2207
+ },
2208
+ {
2209
+ id: "conflict-keep",
2210
+ label: "Keep canvas IR",
2211
+ placement: { row: "conflict" },
2212
+ // Hidden under the source-refused lock exactly like Save/Generate —
2213
+ // `editable` gates Keep/Reload the same as every other mutating action.
2214
+ requiredPorts: ["editor"],
2215
+ requiredContext: ["editable"],
2216
+ binding: conflictKeep
2217
+ },
2218
+ {
2219
+ id: "conflict-reload",
2220
+ label: "Reload from tf\u2026",
2221
+ placement: { row: "conflict" },
2222
+ requiredPorts: ["editor"],
2223
+ requiredContext: ["editable"],
2224
+ binding: conflictReload
2225
+ }
2226
+ ];
2214
2227
 
2215
2228
  // src/core/use-action-keys.ts
2216
2229
  import { useEffect as useEffect5 } from "react";
@@ -2300,10 +2313,10 @@ function useActionKeys(actions, ctx, runner, envExtras) {
2300
2313
  }
2301
2314
 
2302
2315
  // src/hooks/useContextMenu.ts
2303
- import { useCallback as useCallback4, useState as useState6 } from "react";
2316
+ import { useCallback as useCallback5, useState as useState6 } from "react";
2304
2317
  function useContextMenu() {
2305
2318
  const [contextMenu, setContextMenu] = useState6(null);
2306
- const showContextMenu = useCallback4((request) => {
2319
+ const showContextMenu = useCallback5((request) => {
2307
2320
  setContextMenu({
2308
2321
  x: request.x,
2309
2322
  y: request.y,
@@ -2311,21 +2324,21 @@ function useContextMenu() {
2311
2324
  groupId: request.groupId
2312
2325
  });
2313
2326
  }, []);
2314
- const dismissContextMenu = useCallback4(() => {
2327
+ const dismissContextMenu = useCallback5(() => {
2315
2328
  setContextMenu(null);
2316
2329
  }, []);
2317
2330
  return { contextMenu, showContextMenu, dismissContextMenu };
2318
2331
  }
2319
2332
 
2320
2333
  // src/hooks/useGroupLogic.ts
2321
- import { useMemo as useMemo2 } from "react";
2334
+ import { useMemo as useMemo4 } from "react";
2322
2335
  function drawnPosition(groups, node) {
2323
2336
  const parent = node.parentId ? groups.find((g) => g.id === node.parentId) : void 0;
2324
2337
  if (!parent) return node.position;
2325
2338
  return { x: parent.position.x + node.position.x, y: parent.position.y + node.position.y };
2326
2339
  }
2327
2340
  function useGroupLogic(nodes, edges, groups, newNodeIds, decorations) {
2328
- return useMemo2(() => {
2341
+ return useMemo4(() => {
2329
2342
  const parentOf = /* @__PURE__ */ new Map();
2330
2343
  for (const g of groups) {
2331
2344
  for (const id of g.node_ids) parentOf.set(id, g);
@@ -2426,7 +2439,7 @@ function renderEdgeToRfEdge(e) {
2426
2439
  }
2427
2440
 
2428
2441
  // src/hooks/useNewNodeTracking.ts
2429
- import { useCallback as useCallback5, useEffect as useEffect6, useRef as useRef6, useState as useState7 } from "react";
2442
+ import { useCallback as useCallback6, useEffect as useEffect6, useRef as useRef6, useState as useState7 } from "react";
2430
2443
  function useNewNodeTracking(view) {
2431
2444
  const [addedIds, setAddedIds] = useState7(/* @__PURE__ */ new Set());
2432
2445
  const [newNodeIds, setNewNodeIds] = useState7(/* @__PURE__ */ new Set());
@@ -2453,7 +2466,7 @@ function useNewNodeTracking(view) {
2453
2466
  setNewNodeIds(track(nodeIds));
2454
2467
  prevCardIdsRef.current = cardIds;
2455
2468
  }, [view]);
2456
- const clearNew = useCallback5((...ids) => {
2469
+ const clearNew = useCallback6((...ids) => {
2457
2470
  setNewNodeIds((s) => {
2458
2471
  const next = new Set(s);
2459
2472
  let changed = false;
@@ -2469,41 +2482,40 @@ function useNewNodeTracking(view) {
2469
2482
  // src/hooks/useViewport.ts
2470
2483
  import { extentOf as extentOf2 } from "@lace-cloud/proto";
2471
2484
  import { useReactFlow as useReactFlow2 } from "@xyflow/react";
2472
- import { useCallback as useCallback6, useEffect as useEffect7, useLayoutEffect as useLayoutEffect2, useMemo as useMemo3, useRef as useRef7 } from "react";
2485
+ import { useCallback as useCallback7, useEffect as useEffect7, useLayoutEffect as useLayoutEffect2, useMemo as useMemo5, useRef as useRef7 } from "react";
2473
2486
  var FIT = { duration: 300, maxZoom: 1 };
2474
2487
  var PAN_MS = 300;
2475
2488
  var RESIZE_MS = 200;
2476
2489
  var REVEAL_MARGIN = 24;
2490
+ var GESTURE_MS = 500;
2477
2491
  var CHROME = ".react-flow__panel";
2478
2492
  function sightOf(pane) {
2479
2493
  const box = pane.getBoundingClientRect();
2480
2494
  const chrome = Array.from(pane.querySelectorAll(CHROME), (el) => el.getBoundingClientRect());
2481
2495
  return { pane: { width: box.width, height: box.height }, visible: visibleArea(box, chrome) };
2482
2496
  }
2483
- function useViewport(paneRef, focusIds) {
2497
+ function useViewport(pane, focusIds) {
2484
2498
  const { fitView, getNode, getNodes, getNodesBounds, getViewport, setViewport } = useReactFlow2();
2485
2499
  const headingRef = useRef7(null);
2486
- const heading = useCallback6(() => {
2500
+ const heading = useCallback7(() => {
2487
2501
  const h = headingRef.current;
2488
2502
  return h && performance.now() < h.until ? h : null;
2489
2503
  }, []);
2490
- const move = useCallback6(
2504
+ const move = useCallback7(
2491
2505
  (viewport, reveals, duration) => {
2492
2506
  headingRef.current = { viewport, reveals, until: performance.now() + duration };
2493
2507
  void setViewport(viewport, { duration });
2494
2508
  },
2495
2509
  [setViewport]
2496
2510
  );
2497
- const fit = useCallback6(() => {
2498
- const pane = paneRef.current;
2511
+ const fit = useCallback7(() => {
2499
2512
  if (!pane) return;
2500
2513
  headingRef.current = null;
2501
2514
  const { pane: size, visible } = sightOf(pane);
2502
2515
  void fitView({ ...FIT, padding: fitPadding(size, visible) });
2503
- }, [paneRef, fitView]);
2504
- const panIntoView = useCallback6(
2516
+ }, [pane, fitView]);
2517
+ const panIntoView = useCallback7(
2505
2518
  (rect) => {
2506
- const pane = paneRef.current;
2507
2519
  if (!pane) return;
2508
2520
  const from = heading()?.viewport ?? getViewport();
2509
2521
  const room = withMargin(rect, REVEAL_MARGIN, from.zoom);
@@ -2511,7 +2523,7 @@ function useViewport(paneRef, focusIds) {
2511
2523
  if (dx === 0 && dy === 0) return;
2512
2524
  move({ x: from.x + dx, y: from.y + dy, zoom: from.zoom }, room, PAN_MS);
2513
2525
  },
2514
- [paneRef, heading, getViewport, move]
2526
+ [pane, heading, getViewport, move]
2515
2527
  );
2516
2528
  const resized = useRef7((_was, _after) => {
2517
2529
  });
@@ -2537,32 +2549,59 @@ function useViewport(paneRef, focusIds) {
2537
2549
  };
2538
2550
  });
2539
2551
  useEffect7(() => {
2540
- const pane = paneRef.current;
2541
2552
  if (!pane || typeof ResizeObserver === "undefined") return;
2542
2553
  let before = sightOf(pane).visible;
2554
+ let judged = before;
2543
2555
  let frame = 0;
2556
+ let held;
2557
+ let pressed = false;
2558
+ let releasedAt = Number.NEGATIVE_INFINITY;
2559
+ const press = () => {
2560
+ pressed = true;
2561
+ };
2562
+ const release = () => {
2563
+ pressed = false;
2564
+ releasedAt = performance.now();
2565
+ };
2566
+ const settle = () => {
2567
+ clearTimeout(held);
2568
+ const wait = pressed ? GESTURE_MS : releasedAt + GESTURE_MS - performance.now();
2569
+ if (wait > 0) {
2570
+ held = setTimeout(settle, wait);
2571
+ return;
2572
+ }
2573
+ const was = judged;
2574
+ judged = before;
2575
+ resized.current(was, before);
2576
+ };
2544
2577
  const keep = () => {
2545
2578
  const after = sightOf(pane).visible;
2546
2579
  if (sameRect(after, before)) return;
2547
- const was = before;
2548
2580
  before = after;
2549
- resized.current(was, after);
2581
+ settle();
2550
2582
  };
2551
2583
  const observer = new ResizeObserver(() => {
2552
2584
  cancelAnimationFrame(frame);
2553
2585
  frame = requestAnimationFrame(keep);
2554
2586
  });
2555
2587
  observer.observe(pane);
2588
+ pane.addEventListener("pointerdown", press, true);
2589
+ window.addEventListener("pointerup", release, true);
2590
+ window.addEventListener("pointercancel", release, true);
2556
2591
  return () => {
2557
2592
  cancelAnimationFrame(frame);
2593
+ clearTimeout(held);
2558
2594
  observer.disconnect();
2595
+ pane.removeEventListener("pointerdown", press, true);
2596
+ window.removeEventListener("pointerup", release, true);
2597
+ window.removeEventListener("pointercancel", release, true);
2559
2598
  };
2560
- }, [paneRef]);
2561
- return useMemo3(() => ({ fit, panIntoView }), [fit, panIntoView]);
2599
+ }, [pane]);
2600
+ return useMemo5(() => ({ fit, panIntoView }), [fit, panIntoView]);
2562
2601
  }
2563
2602
 
2564
2603
  // src/Canvas.tsx
2565
- import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
2604
+ import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
2566
2605
  var nodeTypes = {
2567
2606
  moduleNode: ModuleNode_default,
2568
2607
  groupNode: GroupNode_default
@@ -2588,11 +2627,11 @@ function CompositeEditor({
2588
2627
  layout,
2589
2628
  focusIds,
2590
2629
  selection,
2591
- paneRef,
2630
+ pane,
2592
2631
  decorations
2593
2632
  }) {
2594
2633
  const { getNode, getNodesBounds } = useReactFlow3();
2595
- const viewport = useViewport(paneRef, focusIds);
2634
+ const viewport = useViewport(pane, focusIds);
2596
2635
  const xyflowInitialized = useNodesInitialized();
2597
2636
  const nodesInitialized = xyflowInitialized || view.nodes.length === 0;
2598
2637
  useEffect8(() => {
@@ -2606,10 +2645,10 @@ function CompositeEditor({
2606
2645
  }, [layout, viewport]);
2607
2646
  const firedRef = useRef8(false);
2608
2647
  useEffect8(() => {
2609
- if (firedRef.current || !nodesInitialized || view.nodes.length === 0) return;
2648
+ if (firedRef.current || !pane || !nodesInitialized || view.nodes.length === 0) return;
2610
2649
  firedRef.current = true;
2611
2650
  requestAnimationFrame(viewport.fit);
2612
- }, [nodesInitialized, view.nodes.length, viewport]);
2651
+ }, [pane, nodesInitialized, view.nodes.length, viewport]);
2613
2652
  const groupLogic = useGroupLogic(view.nodes, view.edges, view.groups, newNodeIds, decorations);
2614
2653
  const revealedRef = useRef8(addedIds);
2615
2654
  useEffect8(() => {
@@ -2626,8 +2665,8 @@ function CompositeEditor({
2626
2665
  viewport.panIntoView(extentOf3(shown.map((s) => s.rect)));
2627
2666
  }, [editing, addedIds, groupLogic.rfNodes, view, viewport]);
2628
2667
  const rfEdgesFromView = groupLogic.rfEdges;
2629
- const selectedNodeIds = useMemo4(() => new Set(selection.nodes), [selection.nodes]);
2630
- const selectedEdgeIds = useMemo4(() => new Set(selection.edges), [selection.edges]);
2668
+ const selectedNodeIds = useMemo6(() => new Set(selection.nodes), [selection.nodes]);
2669
+ const selectedEdgeIds = useMemo6(() => new Set(selection.edges), [selection.edges]);
2631
2670
  const [rfEdges, setRfEdges] = useState8(rfEdgesFromView);
2632
2671
  useEffect8(() => {
2633
2672
  setRfEdges((prev) => {
@@ -2637,7 +2676,7 @@ function CompositeEditor({
2637
2676
  );
2638
2677
  });
2639
2678
  }, [rfEdgesFromView, selectedEdgeIds]);
2640
- const onEdgesChange = useCallback7(
2679
+ const onEdgesChange = useCallback8(
2641
2680
  (changes) => {
2642
2681
  setRfEdges((prev) => applyEdgeChanges(changes, prev));
2643
2682
  onSelect("edges", changes);
@@ -2663,14 +2702,14 @@ function CompositeEditor({
2663
2702
  });
2664
2703
  });
2665
2704
  }, [rfNodesFromView, selectedNodeIds]);
2666
- const onNodesChange = useCallback7(
2705
+ const onNodesChange = useCallback8(
2667
2706
  (changes) => {
2668
2707
  setRfNodes((prev) => applyNodeChanges(changes, prev));
2669
2708
  onSelect("nodes", changes);
2670
2709
  },
2671
2710
  [onSelect]
2672
2711
  );
2673
- const onNodeDragStop = useCallback7(
2712
+ const onNodeDragStop = useCallback8(
2674
2713
  (_e, _draggedNode, draggedNodes) => {
2675
2714
  const positions = {};
2676
2715
  for (const n of draggedNodes) {
@@ -2723,9 +2762,9 @@ function CompositeEditor({
2723
2762
  proOptions: { hideAttribution: true },
2724
2763
  style: { background: "var(--lace-color-bg-canvas)" },
2725
2764
  children: [
2726
- /* @__PURE__ */ jsx11(CanvasControls, { onFit: viewport.fit }),
2727
- /* @__PURE__ */ jsx11(PaperGrid, {}),
2728
- nodesInitialized ? /* @__PURE__ */ jsx11("div", { hidden: true, "data-rendered": "" }) : null
2765
+ /* @__PURE__ */ jsx12(CanvasControls, { onFit: viewport.fit }),
2766
+ /* @__PURE__ */ jsx12(PaperGrid, {}),
2767
+ nodesInitialized ? /* @__PURE__ */ jsx12("div", { hidden: true, "data-rendered": "" }) : null
2729
2768
  ]
2730
2769
  }
2731
2770
  );
@@ -2742,10 +2781,11 @@ function Canvas({ height }) {
2742
2781
  updateArrangement,
2743
2782
  selection,
2744
2783
  setSelection,
2745
- layout
2784
+ layout,
2785
+ editing
2746
2786
  } = useCanvas();
2747
2787
  const editor = ctx.ports.editor;
2748
- const makeEnvExtras = useCallback7(
2788
+ const makeEnvExtras = useCallback8(
2749
2789
  () => ({
2750
2790
  bundle,
2751
2791
  arrangement: { get: () => arrangement, update: updateArrangement },
@@ -2753,7 +2793,7 @@ function Canvas({ height }) {
2753
2793
  }),
2754
2794
  [bundle, arrangement, updateArrangement, layout]
2755
2795
  );
2756
- const focusIds = useMemo4(() => {
2796
+ const focusIds = useMemo6(() => {
2757
2797
  const wires = new Set(selection.edges);
2758
2798
  const ends = view.edges.filter((e) => wires.has(e.id)).flatMap((e) => [e.source, e.target]);
2759
2799
  return [.../* @__PURE__ */ new Set([...selection.nodes, ...ends])];
@@ -2763,37 +2803,32 @@ function Canvas({ height }) {
2763
2803
  useEffect8(() => {
2764
2804
  clearNew(...selection.nodes);
2765
2805
  }, [selection.nodes, clearNew]);
2766
- const [editing, setEditing] = useState8(() => runner.editing());
2767
- useEffect8(() => {
2768
- setEditing(runner.editing());
2769
- return runner.onEditingChange(setEditing);
2770
- }, [runner]);
2771
- const paneRef = useRef8(null);
2806
+ const [pane, setPane] = useState8(null);
2772
2807
  const surfaceRef = useRef8(null);
2773
2808
  useEffect8(() => {
2774
2809
  registerKeyTarget(ctx, "surface", surfaceRef.current);
2775
2810
  return () => registerKeyTarget(ctx, "surface", null);
2776
2811
  }, [ctx]);
2777
- const onSurfacePointerDown = useCallback7((e) => {
2812
+ const onSurfacePointerDown = useCallback8((e) => {
2778
2813
  if (isFormTarget(e.target)) return;
2779
2814
  surfaceRef.current?.focus();
2780
2815
  }, []);
2781
2816
  const goToNodeRef = useRef8(null);
2782
- const registerGoToNode = useCallback7((fn) => {
2817
+ const registerGoToNode = useCallback8((fn) => {
2783
2818
  goToNodeRef.current = fn;
2784
2819
  }, []);
2785
2820
  const reported = useRef8(selection);
2786
2821
  useLayoutEffect3(() => {
2787
2822
  reported.current = selection;
2788
2823
  }, [selection]);
2789
- const selectNow = useCallback7(
2824
+ const selectNow = useCallback8(
2790
2825
  (next) => {
2791
2826
  reported.current = next;
2792
2827
  setSelection(next);
2793
2828
  },
2794
2829
  [setSelection]
2795
2830
  );
2796
- const onSelect = useCallback7(
2831
+ const onSelect = useCallback8(
2797
2832
  (side, changes) => {
2798
2833
  const was = reported.current[side];
2799
2834
  const held = new Set(was);
@@ -2809,14 +2844,14 @@ function Canvas({ height }) {
2809
2844
  },
2810
2845
  [selectNow]
2811
2846
  );
2812
- const onOpenNodeConfig = useCallback7(
2847
+ const onOpenNodeConfig = useCallback8(
2813
2848
  (instanceId) => {
2814
2849
  selectNow({ nodes: [instanceId], edges: [] });
2815
2850
  goToNodeRef.current?.(instanceId);
2816
2851
  },
2817
2852
  [selectNow]
2818
2853
  );
2819
- const onDragStop = useCallback7(
2854
+ const onDragStop = useCallback8(
2820
2855
  (positions) => {
2821
2856
  const pinned = Object.keys(positions).reduce(
2822
2857
  (next, id) => withScopesPinned(bundle, view, next, id),
@@ -2826,7 +2861,7 @@ function Canvas({ height }) {
2826
2861
  },
2827
2862
  [bundle, view, arrangement, updateArrangement]
2828
2863
  );
2829
- const onConnect = useCallback7(
2864
+ const onConnect = useCallback8(
2830
2865
  async (conn) => {
2831
2866
  if (!conn.source || !conn.target || !editor) return;
2832
2867
  const source = instanceAddress4(bundle, conn.source);
@@ -2848,16 +2883,16 @@ function Canvas({ height }) {
2848
2883
  },
2849
2884
  [editor, runner, bundle]
2850
2885
  );
2851
- const menuTarget = useMemo4(() => {
2886
+ const menuTarget = useMemo6(() => {
2852
2887
  if (!contextMenu) return NO_ENV_EXTRAS_TARGET;
2853
2888
  if (contextMenu.groupId) return groupTarget(contextMenu.groupId);
2854
2889
  return { nodeId: contextMenu.nodeId ?? void 0 };
2855
2890
  }, [contextMenu]);
2856
- const menuCtx = useMemo4(
2891
+ const menuCtx = useMemo6(
2857
2892
  () => menuContext(ctx, menuTarget.nodeId ?? null),
2858
2893
  [ctx, menuTarget.nodeId]
2859
2894
  );
2860
- const menuActions = useMemo4(() => {
2895
+ const menuActions = useMemo6(() => {
2861
2896
  if (!contextMenu) return [];
2862
2897
  const placement = menuTarget.nodeId === void 0 ? "pane-menu" : "node-menu";
2863
2898
  return resolveContributions(
@@ -2867,17 +2902,17 @@ function Canvas({ height }) {
2867
2902
  menuTarget
2868
2903
  ).actions.filter((a) => a.placement === placement);
2869
2904
  }, [contextMenu, menuCtx, menuTarget]);
2870
- const menuReason = useCallback7(
2905
+ const menuReason = useCallback8(
2871
2906
  (action) => disabledReason(action, menuCtx, runner.busy(action, menuCtx, menuTarget)),
2872
2907
  [runner, menuCtx, menuTarget]
2873
2908
  );
2874
- const runMenuAction = useCallback7(
2909
+ const runMenuAction = useCallback8(
2875
2910
  (action) => {
2876
2911
  void runner.run(action, menuCtx, menuTarget, makeEnvExtras());
2877
2912
  },
2878
2913
  [runner, menuCtx, menuTarget, makeEnvExtras]
2879
2914
  );
2880
- return /* @__PURE__ */ jsx11(NodeConfigBusProvider, { onOpen: onOpenNodeConfig, children: /* @__PURE__ */ jsxs5(
2915
+ return /* @__PURE__ */ jsx12(NodeConfigBusProvider, { onOpen: onOpenNodeConfig, children: /* @__PURE__ */ jsxs5(
2881
2916
  "div",
2882
2917
  {
2883
2918
  ref: surfaceRef,
@@ -2892,7 +2927,7 @@ function Canvas({ height }) {
2892
2927
  outline: "none"
2893
2928
  },
2894
2929
  children: [
2895
- /* @__PURE__ */ jsx11(
2930
+ /* @__PURE__ */ jsx12(
2896
2931
  ContextMenu,
2897
2932
  {
2898
2933
  contextMenu,
@@ -2902,8 +2937,8 @@ function Canvas({ height }) {
2902
2937
  onDismiss: dismissContextMenu
2903
2938
  }
2904
2939
  ),
2905
- /* @__PURE__ */ jsxs5("div", { ref: paneRef, style: { position: "relative", flex: "1 1 auto", minHeight: 0 }, children: [
2906
- /* @__PURE__ */ jsx11(
2940
+ /* @__PURE__ */ jsxs5("div", { ref: setPane, style: { position: "relative", flex: "1 1 auto", minHeight: 0 }, children: [
2941
+ /* @__PURE__ */ jsx12(
2907
2942
  CompositeEditor,
2908
2943
  {
2909
2944
  view,
@@ -2921,11 +2956,11 @@ function Canvas({ height }) {
2921
2956
  layout,
2922
2957
  focusIds,
2923
2958
  selection,
2924
- paneRef,
2959
+ pane,
2925
2960
  decorations
2926
2961
  }
2927
2962
  ),
2928
- view.nodes.length === 0 && view.groups.length === 0 ? /* @__PURE__ */ jsx11(EmptyCanvas, { editable }) : null
2963
+ view.nodes.length === 0 && view.groups.length === 0 ? /* @__PURE__ */ jsx12(EmptyCanvas, { editable }) : null
2929
2964
  ] })
2930
2965
  ]
2931
2966
  }
@@ -2933,7 +2968,7 @@ function Canvas({ height }) {
2933
2968
  }
2934
2969
 
2935
2970
  // src/components/Drawer.tsx
2936
- import { useCallback as useCallback8, useLayoutEffect as useLayoutEffect4, useRef as useRef9, useState as useState9 } from "react";
2971
+ import { useCallback as useCallback9, useLayoutEffect as useLayoutEffect4, useRef as useRef9, useState as useState9 } from "react";
2937
2972
 
2938
2973
  // src/utils/style-vars.ts
2939
2974
  function readTokenPx(el, name) {
@@ -2942,7 +2977,7 @@ function readTokenPx(el, name) {
2942
2977
 
2943
2978
  // src/components/Drawer.tsx
2944
2979
  import "./Drawer-34ZYTEWE.css";
2945
- import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
2980
+ import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
2946
2981
  var KEY_STEP = 16;
2947
2982
  function readDrawerBounds(el) {
2948
2983
  const min = readTokenPx(el, "--lace-size-drawer-min");
@@ -2965,19 +3000,19 @@ function Drawer({ label, children }) {
2965
3000
  useLayoutEffect4(() => {
2966
3001
  if (ref.current) setMeasured(Math.round(ref.current.getBoundingClientRect().width));
2967
3002
  }, [width]);
2968
- const onPointerDown = useCallback8((e) => {
3003
+ const onPointerDown = useCallback9((e) => {
2969
3004
  e.preventDefault();
2970
3005
  e.currentTarget.setPointerCapture(e.pointerId);
2971
3006
  drag.current = { x: e.clientX, width: ref.current?.getBoundingClientRect().width ?? 0 };
2972
3007
  }, []);
2973
- const onPointerMove = useCallback8(
3008
+ const onPointerMove = useCallback9(
2974
3009
  (e) => {
2975
3010
  if (!drag.current) return;
2976
3011
  setWidth(clampWidth(drag.current.width + drag.current.x - e.clientX, bounds));
2977
3012
  },
2978
3013
  [bounds]
2979
3014
  );
2980
- const onPointerUp = useCallback8((e) => {
3015
+ const onPointerUp = useCallback9((e) => {
2981
3016
  drag.current = null;
2982
3017
  e.currentTarget.releasePointerCapture(e.pointerId);
2983
3018
  }, []);
@@ -2989,7 +3024,7 @@ function Drawer({ label, children }) {
2989
3024
  };
2990
3025
  const style = width === null ? void 0 : { "--drawer-width": `${width}px` };
2991
3026
  return /* @__PURE__ */ jsxs6("aside", { ref, className: "lace-app__drawer", "aria-label": label, style, children: [
2992
- /* @__PURE__ */ jsx12(
3027
+ /* @__PURE__ */ jsx13(
2993
3028
  "div",
2994
3029
  {
2995
3030
  className: "lace-app__drawer-handle",
@@ -3006,19 +3041,19 @@ function Drawer({ label, children }) {
3006
3041
  onKeyDown
3007
3042
  }
3008
3043
  ),
3009
- /* @__PURE__ */ jsx12("div", { className: "lace-app__drawer-body", children })
3044
+ /* @__PURE__ */ jsx13("div", { className: "lace-app__drawer-body", children })
3010
3045
  ] });
3011
3046
  }
3012
3047
 
3013
3048
  // src/components/ErrorBoundary.tsx
3014
3049
  import React from "react";
3015
3050
  import "./ErrorBoundary-IXSIVZFH.css";
3016
- import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
3051
+ import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
3017
3052
  function ErrorState({ message }) {
3018
3053
  return /* @__PURE__ */ jsxs7("div", { className: "lace-error-state", role: "alert", children: [
3019
- /* @__PURE__ */ jsx13("h3", { className: "lace-error-state__title", children: "Something went wrong" }),
3020
- /* @__PURE__ */ jsx13("pre", { className: "lace-error-state__message", children: message }),
3021
- /* @__PURE__ */ jsx13(
3054
+ /* @__PURE__ */ jsx14("h3", { className: "lace-error-state__title", children: "Something went wrong" }),
3055
+ /* @__PURE__ */ jsx14("pre", { className: "lace-error-state__message", children: message }),
3056
+ /* @__PURE__ */ jsx14(
3022
3057
  "button",
3023
3058
  {
3024
3059
  type: "button",
@@ -3039,7 +3074,7 @@ var ErrorBoundary = class extends React.Component {
3039
3074
  }
3040
3075
  render() {
3041
3076
  if (this.state.error) {
3042
- return /* @__PURE__ */ jsx13(ErrorState, { message: this.state.error.message });
3077
+ return /* @__PURE__ */ jsx14(ErrorState, { message: this.state.error.message });
3043
3078
  }
3044
3079
  return this.props.children;
3045
3080
  }
@@ -3048,23 +3083,23 @@ var ErrorBoundary = class extends React.Component {
3048
3083
  // src/components/ToolbarAction.tsx
3049
3084
  import { Button, IconButton as IconButton2, Spinner } from "@lace-cloud/ui";
3050
3085
  import "./ToolbarAction-PQNWHJSU.css";
3051
- import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
3086
+ import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
3052
3087
  var TIP = "bottom-start";
3053
3088
  function actionTip(keys, reason) {
3054
3089
  const chord = keys?.[0] ? formatChord(keys[0], isMacPlatform()) : void 0;
3055
3090
  if (!chord && !reason) return void 0;
3056
3091
  return /* @__PURE__ */ jsxs8("span", { className: "lace-action-tip", children: [
3057
- chord ? /* @__PURE__ */ jsx14("kbd", { className: "lace-action-tip__key", children: chord }) : null,
3058
- reason ? /* @__PURE__ */ jsx14("span", { className: "lace-action-tip__reason", children: reason }) : null
3092
+ chord ? /* @__PURE__ */ jsx15("kbd", { className: "lace-action-tip__key", children: chord }) : null,
3093
+ reason ? /* @__PURE__ */ jsx15("span", { className: "lace-action-tip__reason", children: reason }) : null
3059
3094
  ] });
3060
3095
  }
3061
3096
  function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, busyLabel, onRun }) {
3062
3097
  const busy = busyLabel !== void 0;
3063
3098
  const inert = isInert({ disabledReason: disabledReason2, busyLabel });
3064
3099
  const tooltip = actionTip(action.keys, disabledReason2);
3065
- const glyph = action.icon ? /* @__PURE__ */ jsx14(CanvasIcon, { name: action.icon }) : void 0;
3100
+ const glyph = action.icon ? /* @__PURE__ */ jsx15(CanvasIcon, { name: action.icon }) : void 0;
3066
3101
  if (action.primary) {
3067
- return /* @__PURE__ */ jsx14(
3102
+ return /* @__PURE__ */ jsx15(
3068
3103
  Button,
3069
3104
  {
3070
3105
  rung: true,
@@ -3083,10 +3118,10 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
3083
3118
  );
3084
3119
  }
3085
3120
  if (glyph) {
3086
- return /* @__PURE__ */ jsx14(
3121
+ return /* @__PURE__ */ jsx15(
3087
3122
  IconButton2,
3088
3123
  {
3089
- icon: busy ? /* @__PURE__ */ jsx14(Spinner, { size: 14, "aria-hidden": "true" }) : glyph,
3124
+ icon: busy ? /* @__PURE__ */ jsx15(Spinner, { size: 14, "aria-hidden": "true" }) : glyph,
3090
3125
  "aria-label": action.label,
3091
3126
  size: "md",
3092
3127
  "aria-disabled": inert,
@@ -3096,7 +3131,7 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
3096
3131
  }
3097
3132
  );
3098
3133
  }
3099
- return /* @__PURE__ */ jsx14(
3134
+ return /* @__PURE__ */ jsx15(
3100
3135
  Button,
3101
3136
  {
3102
3137
  rung: true,
@@ -3116,10 +3151,7 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
3116
3151
 
3117
3152
  // src/core/CommandArgsForm.tsx
3118
3153
  import { useState as useState10 } from "react";
3119
- import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
3120
- function isCommandPath(path) {
3121
- return path in COMMANDS;
3122
- }
3154
+ import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
3123
3155
  function flagsOf(path) {
3124
3156
  return COMMANDS[path].flags;
3125
3157
  }
@@ -3139,15 +3171,15 @@ function CommandArgsForm({ form }) {
3139
3171
  form.missing.map((key) => {
3140
3172
  const flagType = flags[key]?.type;
3141
3173
  return /* @__PURE__ */ jsxs9("label", { className: "lace-command-args-form__field", children: [
3142
- /* @__PURE__ */ jsx15("span", { children: key }),
3143
- flagType === "bool" ? /* @__PURE__ */ jsx15(
3174
+ /* @__PURE__ */ jsx16("span", { children: key }),
3175
+ flagType === "bool" ? /* @__PURE__ */ jsx16(
3144
3176
  "input",
3145
3177
  {
3146
3178
  type: "checkbox",
3147
3179
  checked: Boolean(values[key]),
3148
3180
  onChange: (e) => setValues((prev) => ({ ...prev, [key]: e.target.checked }))
3149
3181
  }
3150
- ) : /* @__PURE__ */ jsx15(
3182
+ ) : /* @__PURE__ */ jsx16(
3151
3183
  "input",
3152
3184
  {
3153
3185
  type: "text",
@@ -3159,8 +3191,8 @@ function CommandArgsForm({ form }) {
3159
3191
  ] }, key);
3160
3192
  }),
3161
3193
  /* @__PURE__ */ jsxs9("div", { className: "lace-command-args-form__actions", children: [
3162
- /* @__PURE__ */ jsx15("button", { type: "submit", children: "Continue" }),
3163
- /* @__PURE__ */ jsx15("button", { type: "button", onClick: form.cancel, children: "Cancel" })
3194
+ /* @__PURE__ */ jsx16("button", { type: "submit", children: "Continue" }),
3195
+ /* @__PURE__ */ jsx16("button", { type: "button", onClick: form.cancel, children: "Cancel" })
3164
3196
  ] })
3165
3197
  ]
3166
3198
  }
@@ -3171,14 +3203,14 @@ function CommandArgsForm({ form }) {
3171
3203
  import { nodeIdForAddress } from "@lace-cloud/proto";
3172
3204
 
3173
3205
  // src/core/define-overlay.ts
3174
- import { useMemo as useMemo7 } from "react";
3206
+ import { useMemo as useMemo9 } from "react";
3175
3207
 
3176
3208
  // src/core/use-command-read.ts
3177
- import { useEffect as useEffect9, useMemo as useMemo6, useRef as useRef10, useState as useState11 } from "react";
3209
+ import { useEffect as useEffect9, useMemo as useMemo8, useRef as useRef10, useState as useState11 } from "react";
3178
3210
 
3179
3211
  // src/core/panel-scope.tsx
3180
- import { createContext as createContext3, useContext as useContext3, useMemo as useMemo5 } from "react";
3181
- import { jsx as jsx16 } from "react/jsx-runtime";
3212
+ import { createContext as createContext3, useContext as useContext3, useMemo as useMemo7 } from "react";
3213
+ import { jsx as jsx17 } from "react/jsx-runtime";
3182
3214
  var noopReportError = () => {
3183
3215
  };
3184
3216
  var PanelScopeContext = createContext3(null);
@@ -3191,11 +3223,11 @@ function PanelScope({
3191
3223
  children
3192
3224
  }) {
3193
3225
  const reportError = onReadError ?? noopReportError;
3194
- const value = useMemo5(
3226
+ const value = useMemo7(
3195
3227
  () => ({ ctx, target, paths: new Set(paths), tick, reportError }),
3196
3228
  [ctx, target, paths, tick, reportError]
3197
3229
  );
3198
- return /* @__PURE__ */ jsx16(PanelScopeContext.Provider, { value, children });
3230
+ return /* @__PURE__ */ jsx17(PanelScopeContext.Provider, { value, children });
3199
3231
  }
3200
3232
  function usePanelScope() {
3201
3233
  const value = useContext3(PanelScopeContext);
@@ -3244,7 +3276,7 @@ function useCommandRead(read, target) {
3244
3276
  useEffect9(() => {
3245
3277
  inputsRef.current = inputs;
3246
3278
  });
3247
- const request = useMemo6(() => ({ key, tick: scope.tick }), [key, scope.tick]);
3279
+ const request = useMemo8(() => ({ key, tick: scope.tick }), [key, scope.tick]);
3248
3280
  useEffect9(() => {
3249
3281
  const { path, args: args2, commands, reportError } = inputsRef.current;
3250
3282
  const keyChanged = prevKeyRef.current !== request.key;
@@ -3290,7 +3322,7 @@ function defineOverlay(o) {
3290
3322
  useDecorations(ctx) {
3291
3323
  const { data } = useCommandRead(o.read);
3292
3324
  const view = ctx.view;
3293
- return useMemo7(
3325
+ return useMemo9(
3294
3326
  () => data ? o.decorate(view, data) : EMPTY_DECORATIONS2,
3295
3327
  [o.decorate, view, data]
3296
3328
  );
@@ -3316,7 +3348,7 @@ function decorateDescribe(view, data) {
3316
3348
  addBadge(nodeId, {
3317
3349
  id: "resources",
3318
3350
  tone: "neutral",
3319
- label: `${count} resource${count === 1 ? "" : "s"}`
3351
+ label: counted(count, "resource")
3320
3352
  });
3321
3353
  }
3322
3354
  }
@@ -3347,7 +3379,7 @@ import { Button as Button2 } from "@lace-cloud/ui";
3347
3379
 
3348
3380
  // src/components/Banner.tsx
3349
3381
  import "./Banner-4TSIKYLF.css";
3350
- import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
3382
+ import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
3351
3383
  function Banner({ severity, message, className, actions }) {
3352
3384
  return /* @__PURE__ */ jsxs10(
3353
3385
  "div",
@@ -3355,16 +3387,16 @@ function Banner({ severity, message, className, actions }) {
3355
3387
  className: `lace-banner lace-banner--${severity} ${className}`,
3356
3388
  role: severity === "error" ? "alert" : "status",
3357
3389
  children: [
3358
- /* @__PURE__ */ jsx17("span", { className: "lace-banner__icon", children: /* @__PURE__ */ jsx17(CanvasIcon, { name: severity }) }),
3359
- /* @__PURE__ */ jsx17("span", { className: "lace-banner__message", children: message }),
3360
- actions ? /* @__PURE__ */ jsx17("span", { className: "lace-banner__actions", children: actions }) : null
3390
+ /* @__PURE__ */ jsx18("span", { className: "lace-banner__icon", children: /* @__PURE__ */ jsx18(CanvasIcon, { name: severity }) }),
3391
+ /* @__PURE__ */ jsx18("span", { className: "lace-banner__message", children: message }),
3392
+ actions ? /* @__PURE__ */ jsx18("span", { className: "lace-banner__actions", children: actions }) : null
3361
3393
  ]
3362
3394
  }
3363
3395
  );
3364
3396
  }
3365
3397
 
3366
3398
  // src/core/panels/RowActionBanner.tsx
3367
- import { jsx as jsx18 } from "react/jsx-runtime";
3399
+ import { jsx as jsx19 } from "react/jsx-runtime";
3368
3400
  function bannerMessage(opening, actions) {
3369
3401
  return [opening, ...actions.flatMap((action) => action.choice ? [action.choice] : [])].join(
3370
3402
  " "
@@ -3374,7 +3406,7 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
3374
3406
  const { runner } = useCanvas();
3375
3407
  const envExtras = useEditorEnvExtras();
3376
3408
  const actions = rowActionsFor(ctx, panelId);
3377
- return /* @__PURE__ */ jsx18(
3409
+ return /* @__PURE__ */ jsx19(
3378
3410
  Banner,
3379
3411
  {
3380
3412
  severity,
@@ -3382,7 +3414,7 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
3382
3414
  message: bannerMessage(opening, actions),
3383
3415
  actions: actions.length === 0 ? void 0 : actions.map((action) => {
3384
3416
  const state = actionState(action, ctx, runner.busy(action, ctx, {}));
3385
- return /* @__PURE__ */ jsx18(
3417
+ return /* @__PURE__ */ jsx19(
3386
3418
  Button2,
3387
3419
  {
3388
3420
  rung: true,
@@ -3403,9 +3435,9 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
3403
3435
  }
3404
3436
 
3405
3437
  // src/core/panels/ConflictBanner.tsx
3406
- import { jsx as jsx19 } from "react/jsx-runtime";
3438
+ import { jsx as jsx20 } from "react/jsx-runtime";
3407
3439
  function ConflictBanner({ ctx }) {
3408
- return /* @__PURE__ */ jsx19(
3440
+ return /* @__PURE__ */ jsx20(
3409
3441
  RowActionBanner,
3410
3442
  {
3411
3443
  ctx,
@@ -3431,15 +3463,15 @@ import { Button as Button3 } from "@lace-cloud/ui";
3431
3463
  // src/components/Identifier.tsx
3432
3464
  import { Fragment as Fragment5 } from "react";
3433
3465
  import "./Identifier-V6MZ37EG.css";
3434
- import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
3466
+ import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
3435
3467
  function identifierSegments(text) {
3436
3468
  return text.split(/(?<=[_.])/);
3437
3469
  }
3438
3470
  function Identifier({ text, className }) {
3439
- return /* @__PURE__ */ jsx20("span", { className: className ? `lace-identifier ${className}` : "lace-identifier", children: identifierSegments(text).map((segment, i) => (
3471
+ return /* @__PURE__ */ jsx21("span", { className: className ? `lace-identifier ${className}` : "lace-identifier", children: identifierSegments(text).map((segment, i) => (
3440
3472
  // biome-ignore lint/suspicious/noArrayIndexKey: a segment's place in the name is its identity.
3441
3473
  /* @__PURE__ */ jsxs11(Fragment5, { children: [
3442
- i > 0 ? /* @__PURE__ */ jsx20("wbr", {}) : null,
3474
+ i > 0 ? /* @__PURE__ */ jsx21("wbr", {}) : null,
3443
3475
  segment
3444
3476
  ] }, i)
3445
3477
  )) });
@@ -3447,7 +3479,7 @@ function Identifier({ text, className }) {
3447
3479
 
3448
3480
  // src/core/panels/DiagnosticsPanel.tsx
3449
3481
  import "./DiagnosticsPanel-MSK72CGM.css";
3450
- import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
3482
+ import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
3451
3483
  function locationOf(file, line) {
3452
3484
  return line === void 0 ? file : `${file}:${line}`;
3453
3485
  }
@@ -3458,7 +3490,7 @@ function DiagnosticsPanel({ ctx }) {
3458
3490
  const { runner } = useCanvas();
3459
3491
  const envExtras = useEditorEnvExtras();
3460
3492
  const diagnostics = ctx.diagnostics;
3461
- return /* @__PURE__ */ jsx21("ul", { className: "lace-diagnostics-panel", role: "list", children: diagnostics.map((d, index) => {
3493
+ return /* @__PURE__ */ jsx22("ul", { className: "lace-diagnostics-panel", role: "list", children: diagnostics.map((d, index) => {
3462
3494
  const key = rowKey(d, index);
3463
3495
  const target = { diagnostic: d };
3464
3496
  const actions = rowActionsFor(ctx, "diagnostics", target);
@@ -3467,27 +3499,27 @@ function DiagnosticsPanel({ ctx }) {
3467
3499
  {
3468
3500
  className: `lace-diagnostics-panel__row lace-diagnostics-panel__row--${d.severity}`,
3469
3501
  children: [
3470
- /* @__PURE__ */ jsx21("span", { className: "lace-diagnostics-panel__icon", children: /* @__PURE__ */ jsx21(CanvasIcon, { name: d.severity }) }),
3502
+ /* @__PURE__ */ jsx22("span", { className: "lace-diagnostics-panel__icon", children: /* @__PURE__ */ jsx22(CanvasIcon, { name: d.severity }) }),
3471
3503
  /* @__PURE__ */ jsxs12("span", { className: "lace-diagnostics-panel__body", children: [
3472
- /* @__PURE__ */ jsx21("span", { className: "lace-diagnostics-panel__message", children: d.message }),
3473
- d.file !== void 0 && /* @__PURE__ */ jsx21(
3504
+ /* @__PURE__ */ jsx22("span", { className: "lace-diagnostics-panel__message", children: d.message }),
3505
+ d.file !== void 0 && /* @__PURE__ */ jsx22(
3474
3506
  Identifier,
3475
3507
  {
3476
3508
  className: "lace-diagnostics-panel__file",
3477
3509
  text: locationOf(d.file, d.line)
3478
3510
  }
3479
3511
  ),
3480
- d.instance_id !== void 0 && /* @__PURE__ */ jsx21(
3512
+ d.instance_id !== void 0 && /* @__PURE__ */ jsx22(
3481
3513
  Identifier,
3482
3514
  {
3483
3515
  className: "lace-diagnostics-panel__where",
3484
3516
  text: d.input_name ? `${d.instance_id}.${d.input_name}` : d.instance_id
3485
3517
  }
3486
3518
  ),
3487
- d.code !== void 0 && /* @__PURE__ */ jsx21(Identifier, { className: "lace-diagnostics-panel__code", text: d.code }),
3519
+ d.code !== void 0 && /* @__PURE__ */ jsx22(Identifier, { className: "lace-diagnostics-panel__code", text: d.code }),
3488
3520
  actions.map((action) => {
3489
3521
  const state = actionState(action, ctx, runner.busy(action, ctx, target));
3490
- return /* @__PURE__ */ jsx21(
3522
+ return /* @__PURE__ */ jsx22(
3491
3523
  Button3,
3492
3524
  {
3493
3525
  rung: true,
@@ -3530,7 +3562,7 @@ import { createElement } from "react";
3530
3562
  import { callText } from "@lace-cloud/proto";
3531
3563
  import { Button as Button4, Panel } from "@lace-cloud/ui";
3532
3564
  import "./EdgeInspectorPanel-JD6CVUAT.css";
3533
- import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
3565
+ import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
3534
3566
  function EdgeInspectorPanel({
3535
3567
  source,
3536
3568
  target,
@@ -3540,22 +3572,22 @@ function EdgeInspectorPanel({
3540
3572
  onClose
3541
3573
  }) {
3542
3574
  const title = /* @__PURE__ */ jsxs13("div", { children: [
3543
- /* @__PURE__ */ jsx22("div", { className: "lace-edge-panel__title-eyebrow", children: "Connection" }),
3575
+ /* @__PURE__ */ jsx23("div", { className: "lace-edge-panel__title-eyebrow", children: "Connection" }),
3544
3576
  /* @__PURE__ */ jsxs13("div", { className: "lace-edge-panel__title", children: [
3545
- /* @__PURE__ */ jsx22(Identifier, { text: source }),
3577
+ /* @__PURE__ */ jsx23(Identifier, { text: source }),
3546
3578
  " \u2192 ",
3547
- /* @__PURE__ */ jsx22(Identifier, { text: target })
3579
+ /* @__PURE__ */ jsx23(Identifier, { text: target })
3548
3580
  ] })
3549
3581
  ] });
3550
- const footer = onDelete ? /* @__PURE__ */ jsx22(Button4, { rung: true, variant: "danger", fullWidth: true, onClick: onDelete, children: "Delete connection" }) : void 0;
3582
+ const footer = onDelete ? /* @__PURE__ */ jsx23(Button4, { rung: true, variant: "danger", fullWidth: true, onClick: onDelete, children: "Delete connection" }) : void 0;
3551
3583
  return /* @__PURE__ */ jsxs13(Panel, { title, footer, onClose, children: [
3552
- /* @__PURE__ */ jsx22("div", { className: "lace-edge-panel__section-label", children: "Wiring" }),
3584
+ /* @__PURE__ */ jsx23("div", { className: "lace-edge-panel__section-label", children: "Wiring" }),
3553
3585
  /* @__PURE__ */ jsxs13("div", { className: "lace-edge-panel__wiring", children: [
3554
- /* @__PURE__ */ jsx22(Identifier, { text: sourceOutput ? `${source}.outputs.${sourceOutput}` : callText(source) }),
3555
- /* @__PURE__ */ jsx22("div", { className: "lace-edge-panel__wiring-arrow", children: "\u2193" }),
3556
- /* @__PURE__ */ jsx22(Identifier, { text: `${target}.inputs.${targetInput}` })
3586
+ /* @__PURE__ */ jsx23(Identifier, { text: sourceOutput ? `${source}.outputs.${sourceOutput}` : callText(source) }),
3587
+ /* @__PURE__ */ jsx23("div", { className: "lace-edge-panel__wiring-arrow", children: "\u2193" }),
3588
+ /* @__PURE__ */ jsx23(Identifier, { text: `${target}.inputs.${targetInput}` })
3557
3589
  ] }),
3558
- onDelete && /* @__PURE__ */ jsx22("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." })
3590
+ onDelete && /* @__PURE__ */ jsx23("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." })
3559
3591
  ] });
3560
3592
  }
3561
3593
 
@@ -3618,9 +3650,9 @@ var edgeInspectorPanel = {
3618
3650
 
3619
3651
  // src/core/panels/Markers.tsx
3620
3652
  import { Badge } from "@lace-cloud/ui";
3621
- import { jsx as jsx23 } from "react/jsx-runtime";
3653
+ import { jsx as jsx24 } from "react/jsx-runtime";
3622
3654
  function UnsavedMarker() {
3623
- return /* @__PURE__ */ jsx23(Badge, { variant: "warning", dot: true, role: "status", className: "lace-marker lace-marker--unsaved", children: "Unsaved" });
3655
+ return /* @__PURE__ */ jsx24(Badge, { variant: "warning", dot: true, role: "status", className: "lace-marker lace-marker--unsaved", children: "Unsaved" });
3624
3656
  }
3625
3657
  var unsavedMarker = {
3626
3658
  id: "unsaved-marker",
@@ -3632,7 +3664,7 @@ var unsavedMarker = {
3632
3664
  Component: UnsavedMarker
3633
3665
  };
3634
3666
  function UngeneratedMarker() {
3635
- return /* @__PURE__ */ jsx23(Badge, { variant: "neutral", role: "status", className: "lace-marker lace-marker--ungenerated", children: "Not generated" });
3667
+ return /* @__PURE__ */ jsx24(Badge, { variant: "neutral", role: "status", className: "lace-marker lace-marker--ungenerated", children: "Not generated" });
3636
3668
  }
3637
3669
  var ungeneratedMarker = {
3638
3670
  id: "ungenerated-marker",
@@ -3650,7 +3682,7 @@ import { createElement as createElement2 } from "react";
3650
3682
  // src/components/panels/ModuleConfigPanel.tsx
3651
3683
  import { deriveNodeConfig, instanceAddress as instanceAddress6 } from "@lace-cloud/proto";
3652
3684
  import { Button as Button12, IconButton as IconButton9, Input as Input8, ModeToggle, Panel as Panel6, Textarea as Textarea3 } from "@lace-cloud/ui";
3653
- import { useMemo as useMemo9 } from "react";
3685
+ import { useMemo as useMemo11 } from "react";
3654
3686
 
3655
3687
  // src/exhaustive.ts
3656
3688
  function assertNever(value) {
@@ -3661,15 +3693,15 @@ function assertNever(value) {
3661
3693
  import { useState as useState13 } from "react";
3662
3694
 
3663
3695
  // src/hooks/useUpdateState.ts
3664
- import { useCallback as useCallback9, useEffect as useEffect10, useRef as useRef11, useState as useState12 } from "react";
3696
+ import { useCallback as useCallback10, useEffect as useEffect10, useRef as useRef11, useState as useState12 } from "react";
3665
3697
  function useUpdateState(updateFn) {
3666
3698
  const [status, setStatus] = useState12("idle");
3667
3699
  const mountedRef = useRef11(true);
3668
3700
  const resetTimerRef = useRef11(null);
3669
- const safeSetStatus = useCallback9((next) => {
3701
+ const safeSetStatus = useCallback10((next) => {
3670
3702
  if (mountedRef.current) setStatus(next);
3671
3703
  }, []);
3672
- const scheduleReset = useCallback9(
3704
+ const scheduleReset = useCallback10(
3673
3705
  (delay) => {
3674
3706
  if (resetTimerRef.current !== null) clearTimeout(resetTimerRef.current);
3675
3707
  resetTimerRef.current = setTimeout(() => {
@@ -3679,7 +3711,7 @@ function useUpdateState(updateFn) {
3679
3711
  },
3680
3712
  [safeSetStatus]
3681
3713
  );
3682
- const handleUpdate = useCallback9(async () => {
3714
+ const handleUpdate = useCallback10(async () => {
3683
3715
  safeSetStatus("updating");
3684
3716
  try {
3685
3717
  await updateFn();
@@ -3718,11 +3750,12 @@ function useDraft(seed, send) {
3718
3750
  await send(sent2);
3719
3751
  setDrafts((prev) => keeping(prev, (key, draft) => draft !== sent2[key]));
3720
3752
  });
3753
+ const dirty = live.size > 0;
3721
3754
  return {
3722
3755
  value,
3723
- dirty: live.size > 0,
3756
+ dirty,
3724
3757
  set: (key, next) => setDrafts((prev) => new Map(prev).set(key, next)),
3725
- status,
3758
+ status: status === "updated" && dirty ? "idle" : status,
3726
3759
  update: handleUpdate
3727
3760
  };
3728
3761
  }
@@ -3730,7 +3763,7 @@ function useDraft(seed, send) {
3730
3763
  // src/components/AccordionSection.tsx
3731
3764
  import { useState as useState14 } from "react";
3732
3765
  import "./AccordionSection-5X2XWUYY.css";
3733
- import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
3766
+ import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
3734
3767
  function AccordionSection({ title, defaultOpen = false, badge, children }) {
3735
3768
  const [open, setOpen] = useState14(defaultOpen);
3736
3769
  return /* @__PURE__ */ jsxs14("div", { className: `lace-accordion${open ? " lace-accordion--open" : ""}`, children: [
@@ -3742,13 +3775,13 @@ function AccordionSection({ title, defaultOpen = false, badge, children }) {
3742
3775
  onClick: () => setOpen((v) => !v),
3743
3776
  "aria-expanded": open,
3744
3777
  children: [
3745
- /* @__PURE__ */ jsx24("span", { className: "lace-accordion__chevron", children: /* @__PURE__ */ jsx24(CanvasIcon, { name: "chevron-right" }) }),
3746
- /* @__PURE__ */ jsx24("span", { className: "lace-accordion__title", children: title }),
3747
- badge && /* @__PURE__ */ jsx24("span", { className: "lace-accordion__badge", children: badge })
3778
+ /* @__PURE__ */ jsx25("span", { className: "lace-accordion__chevron", children: /* @__PURE__ */ jsx25(CanvasIcon, { name: "chevron-right" }) }),
3779
+ /* @__PURE__ */ jsx25("span", { className: "lace-accordion__title", children: title }),
3780
+ badge && /* @__PURE__ */ jsx25("span", { className: "lace-accordion__badge", children: badge })
3748
3781
  ]
3749
3782
  }
3750
3783
  ),
3751
- /* @__PURE__ */ jsx24("div", { className: "lace-accordion__body", children: /* @__PURE__ */ jsx24("div", { className: "lace-accordion__body-inner", children: /* @__PURE__ */ jsx24("div", { className: "lace-accordion__body-content", children }) }) })
3784
+ /* @__PURE__ */ jsx25("div", { className: "lace-accordion__body", children: /* @__PURE__ */ jsx25("div", { className: "lace-accordion__body-inner", children: /* @__PURE__ */ jsx25("div", { className: "lace-accordion__body-content", children }) }) })
3752
3785
  ] });
3753
3786
  }
3754
3787
 
@@ -3759,7 +3792,7 @@ import "./panels-shared-3HUQC7TC.css";
3759
3792
  // src/components/UpdateButton.tsx
3760
3793
  import { Button as Button5 } from "@lace-cloud/ui";
3761
3794
  import "./UpdateButton-TJKSFVBA.css";
3762
- import { jsx as jsx25 } from "react/jsx-runtime";
3795
+ import { jsx as jsx26 } from "react/jsx-runtime";
3763
3796
  var variantByStatus = {
3764
3797
  updating: "primary",
3765
3798
  updated: "success",
@@ -3775,7 +3808,7 @@ function variantOf({ status, dirty }, blocked) {
3775
3808
  return dirty && blocked === void 0 ? "primary" : "secondary";
3776
3809
  }
3777
3810
  function UpdateButton({ draft, label, blocked }) {
3778
- return /* @__PURE__ */ jsx25("div", { className: "lace-commit-foot", children: /* @__PURE__ */ jsx25(
3811
+ return /* @__PURE__ */ jsx26("div", { className: "lace-commit-foot", children: /* @__PURE__ */ jsx26(
3779
3812
  Button5,
3780
3813
  {
3781
3814
  rung: true,
@@ -3793,13 +3826,13 @@ function UpdateButton({ draft, label, blocked }) {
3793
3826
  // src/components/panels/ModuleDetails.tsx
3794
3827
  import { deriveSettingsConfig } from "@lace-cloud/proto";
3795
3828
  import { Input as Input7 } from "@lace-cloud/ui";
3796
- import { useMemo as useMemo8 } from "react";
3829
+ import { useMemo as useMemo10 } from "react";
3797
3830
 
3798
3831
  // src/components/panels/BlockEditor.tsx
3799
3832
  import { Button as Button6, IconButton as IconButton3, Input } from "@lace-cloud/ui";
3800
3833
  import { useState as useState15 } from "react";
3801
3834
  import "./panels-shared-3HUQC7TC.css";
3802
- import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
3835
+ import { Fragment as Fragment6, jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
3803
3836
  function replaceAt(list, index, item) {
3804
3837
  return list.map((x, i) => i === index ? item : x);
3805
3838
  }
@@ -3808,7 +3841,7 @@ function blockTitle(block) {
3808
3841
  }
3809
3842
  function BlockEditor({ blocks, onChange, editable, templates }) {
3810
3843
  return /* @__PURE__ */ jsxs15(Fragment6, { children: [
3811
- blocks.map((block, i) => /* @__PURE__ */ jsx26(
3844
+ blocks.map((block, i) => /* @__PURE__ */ jsx27(
3812
3845
  BlockCard,
3813
3846
  {
3814
3847
  block,
@@ -3818,7 +3851,7 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
3818
3851
  },
3819
3852
  i
3820
3853
  )),
3821
- editable && (templates ? /* @__PURE__ */ jsx26("div", { className: "lace-panel-row-actions", children: templates.map((t) => /* @__PURE__ */ jsxs15(
3854
+ editable && (templates ? /* @__PURE__ */ jsx27("div", { className: "lace-panel-row-actions", children: templates.map((t) => /* @__PURE__ */ jsxs15(
3822
3855
  Button6,
3823
3856
  {
3824
3857
  variant: "secondary",
@@ -3839,7 +3872,7 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
3839
3872
  ]
3840
3873
  },
3841
3874
  t.type
3842
- )) }) : /* @__PURE__ */ jsx26(
3875
+ )) }) : /* @__PURE__ */ jsx27(
3843
3876
  NewBlockRow,
3844
3877
  {
3845
3878
  onAdd: (type, label) => onChange([
@@ -3854,7 +3887,7 @@ function NewBlockRow({ onAdd }) {
3854
3887
  const [type, setType] = useState15("");
3855
3888
  const [label, setLabel] = useState15("");
3856
3889
  return /* @__PURE__ */ jsxs15("div", { className: "lace-panel-row-actions", children: [
3857
- /* @__PURE__ */ jsx26(
3890
+ /* @__PURE__ */ jsx27(
3858
3891
  Input,
3859
3892
  {
3860
3893
  value: type,
@@ -3864,7 +3897,7 @@ function NewBlockRow({ onAdd }) {
3864
3897
  mono: true
3865
3898
  }
3866
3899
  ),
3867
- /* @__PURE__ */ jsx26(
3900
+ /* @__PURE__ */ jsx27(
3868
3901
  Input,
3869
3902
  {
3870
3903
  value: label,
@@ -3874,7 +3907,7 @@ function NewBlockRow({ onAdd }) {
3874
3907
  mono: true
3875
3908
  }
3876
3909
  ),
3877
- /* @__PURE__ */ jsx26(
3910
+ /* @__PURE__ */ jsx27(
3878
3911
  Button6,
3879
3912
  {
3880
3913
  variant: "secondary",
@@ -3900,11 +3933,11 @@ function BlockCard({ block, editable, onChange, onRemove }) {
3900
3933
  });
3901
3934
  return /* @__PURE__ */ jsxs15("div", { className: "lace-panel-validation-block", children: [
3902
3935
  /* @__PURE__ */ jsxs15("div", { className: "lace-panel-row-actions", children: [
3903
- /* @__PURE__ */ jsx26(Identifier, { className: "lace-panel-row-card__name", text: blockTitle(block) }),
3904
- editable && /* @__PURE__ */ jsx26(
3936
+ /* @__PURE__ */ jsx27(Identifier, { className: "lace-panel-row-card__name", text: blockTitle(block) }),
3937
+ editable && /* @__PURE__ */ jsx27(
3905
3938
  IconButton3,
3906
3939
  {
3907
- icon: /* @__PURE__ */ jsx26(CanvasIcon, { name: "close" }),
3940
+ icon: /* @__PURE__ */ jsx27(CanvasIcon, { name: "close" }),
3908
3941
  "aria-label": `Remove the ${block.type} block`,
3909
3942
  size: "md",
3910
3943
  tooltipPlacement: "bottom-end",
@@ -3915,7 +3948,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
3915
3948
  block.attributes.map((attribute, i) => (
3916
3949
  // biome-ignore lint/suspicious/noArrayIndexKey: attributes are positional; the render keeps their order
3917
3950
  /* @__PURE__ */ jsxs15("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
3918
- /* @__PURE__ */ jsx26(
3951
+ /* @__PURE__ */ jsx27(
3919
3952
  Input,
3920
3953
  {
3921
3954
  value: attribute.name,
@@ -3926,7 +3959,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
3926
3959
  readOnly: !editable
3927
3960
  }
3928
3961
  ),
3929
- /* @__PURE__ */ jsx26(
3962
+ /* @__PURE__ */ jsx27(
3930
3963
  Input,
3931
3964
  {
3932
3965
  value: attribute.value,
@@ -3937,10 +3970,10 @@ function BlockCard({ block, editable, onChange, onRemove }) {
3937
3970
  readOnly: !editable
3938
3971
  }
3939
3972
  ),
3940
- editable && /* @__PURE__ */ jsx26(
3973
+ editable && /* @__PURE__ */ jsx27(
3941
3974
  IconButton3,
3942
3975
  {
3943
- icon: /* @__PURE__ */ jsx26(CanvasIcon, { name: "close" }),
3976
+ icon: /* @__PURE__ */ jsx27(CanvasIcon, { name: "close" }),
3944
3977
  "aria-label": `Remove ${attribute.name || "the argument"}`,
3945
3978
  size: "md",
3946
3979
  tooltipPlacement: "bottom-end",
@@ -3949,7 +3982,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
3949
3982
  )
3950
3983
  ] }, i)
3951
3984
  )),
3952
- editable && /* @__PURE__ */ jsx26(
3985
+ editable && /* @__PURE__ */ jsx27(
3953
3986
  Button6,
3954
3987
  {
3955
3988
  variant: "secondary",
@@ -3958,7 +3991,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
3958
3991
  children: "+ Add argument"
3959
3992
  }
3960
3993
  ),
3961
- (block.blocks.length > 0 || editable) && /* @__PURE__ */ jsx26(
3994
+ (block.blocks.length > 0 || editable) && /* @__PURE__ */ jsx27(
3962
3995
  BlockEditor,
3963
3996
  {
3964
3997
  blocks: block.blocks,
@@ -3994,7 +4027,7 @@ function firstDuplicate(items, keyFn) {
3994
4027
 
3995
4028
  // src/components/panels/LocalsPanel.tsx
3996
4029
  import "./panels-shared-3HUQC7TC.css";
3997
- import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
4030
+ import { Fragment as Fragment7, jsx as jsx28, jsxs as jsxs16 } from "react/jsx-runtime";
3998
4031
  function toRows(locals) {
3999
4032
  return (locals ?? []).map((l) => ({ id: l.name, ...l }));
4000
4033
  }
@@ -4014,7 +4047,7 @@ function LocalsContent({ locals, onSave }) {
4014
4047
  return /* @__PURE__ */ jsxs16(Fragment7, { children: [
4015
4048
  rows.map((row, i) => /* @__PURE__ */ jsxs16("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
4016
4049
  /* @__PURE__ */ jsxs16("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4017
- /* @__PURE__ */ jsx27(
4050
+ /* @__PURE__ */ jsx28(
4018
4051
  Input2,
4019
4052
  {
4020
4053
  value: row.name,
@@ -4027,10 +4060,10 @@ function LocalsContent({ locals, onSave }) {
4027
4060
  readOnly: !editable
4028
4061
  }
4029
4062
  ),
4030
- editable && /* @__PURE__ */ jsx27(
4063
+ editable && /* @__PURE__ */ jsx28(
4031
4064
  IconButton4,
4032
4065
  {
4033
- icon: /* @__PURE__ */ jsx27(CanvasIcon, { name: "close" }),
4066
+ icon: /* @__PURE__ */ jsx28(CanvasIcon, { name: "close" }),
4034
4067
  "aria-label": "Remove local",
4035
4068
  size: "md",
4036
4069
  tooltipPlacement: "bottom-end",
@@ -4038,8 +4071,8 @@ function LocalsContent({ locals, onSave }) {
4038
4071
  }
4039
4072
  )
4040
4073
  ] }),
4041
- nameDupes.has(i) && /* @__PURE__ */ jsx27("div", { className: "lace-panel-row-error", children: "Duplicate local name" }),
4042
- /* @__PURE__ */ jsx27("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx27(
4074
+ nameDupes.has(i) && /* @__PURE__ */ jsx28("div", { className: "lace-panel-row-error", children: "Duplicate local name" }),
4075
+ /* @__PURE__ */ jsx28("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx28(
4043
4076
  Textarea,
4044
4077
  {
4045
4078
  value: row.value,
@@ -4054,7 +4087,7 @@ function LocalsContent({ locals, onSave }) {
4054
4087
  ) })
4055
4088
  ] }, row.id)),
4056
4089
  editable && /* @__PURE__ */ jsxs16(Fragment7, { children: [
4057
- /* @__PURE__ */ jsx27(
4090
+ /* @__PURE__ */ jsx28(
4058
4091
  Button7,
4059
4092
  {
4060
4093
  variant: "secondary",
@@ -4063,7 +4096,7 @@ function LocalsContent({ locals, onSave }) {
4063
4096
  children: "+ Add local"
4064
4097
  }
4065
4098
  ),
4066
- /* @__PURE__ */ jsx27(
4099
+ /* @__PURE__ */ jsx28(
4067
4100
  UpdateButton,
4068
4101
  {
4069
4102
  draft,
@@ -4075,13 +4108,13 @@ function LocalsContent({ locals, onSave }) {
4075
4108
  ] });
4076
4109
  }
4077
4110
  function LocalsPanel({ onClose, ...content }) {
4078
- return /* @__PURE__ */ jsx27(Panel2, { title: "Locals", onClose, children: /* @__PURE__ */ jsx27(LocalsContent, { ...content }) });
4111
+ return /* @__PURE__ */ jsx28(Panel2, { title: "Locals", onClose, children: /* @__PURE__ */ jsx28(LocalsContent, { ...content }) });
4079
4112
  }
4080
4113
 
4081
4114
  // src/components/panels/ModuleInterfacePanel.tsx
4082
4115
  import { Button as Button8, IconButton as IconButton5, Input as Input3, Panel as Panel3, Select, Textarea as Textarea2 } from "@lace-cloud/ui";
4083
4116
  import "./panels-shared-3HUQC7TC.css";
4084
- import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
4117
+ import { Fragment as Fragment8, jsx as jsx29, jsxs as jsxs17 } from "react/jsx-runtime";
4085
4118
  function variablesToRows(variables) {
4086
4119
  return variables.map((v) => ({
4087
4120
  id: v.name,
@@ -4214,12 +4247,12 @@ function ModuleInterfaceContent({ settings, onSave }) {
4214
4247
  const outputDupes = findDuplicateIndices(outputs, (o) => o.name);
4215
4248
  const exposable = settings.call_outputs.filter((text) => !outputs.some((o) => o.value === text));
4216
4249
  return /* @__PURE__ */ jsxs17(Fragment8, { children: [
4217
- /* @__PURE__ */ jsx28("div", { className: "lace-panel-hint", children: "The module's public surface: the variables its callers set and the outputs they read." }),
4218
- /* @__PURE__ */ jsx28("h4", { className: "lace-panel-section-title", children: "Inputs" }),
4219
- variables.length === 0 && /* @__PURE__ */ jsx28("div", { className: "lace-panel-hint", children: "No variables." }),
4250
+ /* @__PURE__ */ jsx29("div", { className: "lace-panel-hint", children: "The module's public surface: the variables its callers set and the outputs they read." }),
4251
+ /* @__PURE__ */ jsx29("h4", { className: "lace-panel-section-title", children: "Inputs" }),
4252
+ variables.length === 0 && /* @__PURE__ */ jsx29("div", { className: "lace-panel-hint", children: "No variables." }),
4220
4253
  variables.map((v, i) => /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
4221
4254
  /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4222
- v.added ? /* @__PURE__ */ jsx28(
4255
+ v.added ? /* @__PURE__ */ jsx29(
4223
4256
  Input3,
4224
4257
  {
4225
4258
  label: "Name",
@@ -4230,11 +4263,11 @@ function ModuleInterfaceContent({ settings, onSave }) {
4230
4263
  mono: true,
4231
4264
  error: variableDupes.has(i)
4232
4265
  }
4233
- ) : /* @__PURE__ */ jsx28(Identifier, { className: "lace-panel-row-card__name", text: v.name }),
4234
- editable && /* @__PURE__ */ jsx28(
4266
+ ) : /* @__PURE__ */ jsx29(Identifier, { className: "lace-panel-row-card__name", text: v.name }),
4267
+ editable && /* @__PURE__ */ jsx29(
4235
4268
  IconButton5,
4236
4269
  {
4237
- icon: /* @__PURE__ */ jsx28(CanvasIcon, { name: "close" }),
4270
+ icon: /* @__PURE__ */ jsx29(CanvasIcon, { name: "close" }),
4238
4271
  "aria-label": `Remove variable ${v.name}`,
4239
4272
  size: "md",
4240
4273
  tooltipPlacement: "bottom-end",
@@ -4242,8 +4275,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
4242
4275
  }
4243
4276
  )
4244
4277
  ] }),
4245
- variableDupes.has(i) && /* @__PURE__ */ jsx28("div", { className: "lace-panel-row-error", children: "Duplicate variable name" }),
4246
- /* @__PURE__ */ jsx28("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx28(
4278
+ variableDupes.has(i) && /* @__PURE__ */ jsx29("div", { className: "lace-panel-row-error", children: "Duplicate variable name" }),
4279
+ /* @__PURE__ */ jsx29("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx29(
4247
4280
  Input3,
4248
4281
  {
4249
4282
  label: "Type",
@@ -4255,8 +4288,8 @@ function ModuleInterfaceContent({ settings, onSave }) {
4255
4288
  readOnly: !editable
4256
4289
  }
4257
4290
  ) }),
4258
- v.defaultText && /* @__PURE__ */ jsx28("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx28(Input3, { label: "Default", value: v.defaultText, fullWidth: true, mono: true, readOnly: true }) }),
4259
- /* @__PURE__ */ jsx28("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx28(
4291
+ v.defaultText && /* @__PURE__ */ jsx29("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx29(Input3, { label: "Default", value: v.defaultText, fullWidth: true, mono: true, readOnly: true }) }),
4292
+ /* @__PURE__ */ jsx29("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx29(
4260
4293
  Textarea2,
4261
4294
  {
4262
4295
  label: "Description",
@@ -4270,7 +4303,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
4270
4303
  ) }),
4271
4304
  /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-actions", children: [
4272
4305
  /* @__PURE__ */ jsxs17("label", { className: "lace-panel-checkbox-row", children: [
4273
- /* @__PURE__ */ jsx28(
4306
+ /* @__PURE__ */ jsx29(
4274
4307
  "input",
4275
4308
  {
4276
4309
  type: "checkbox",
@@ -4279,10 +4312,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
4279
4312
  disabled: !editable
4280
4313
  }
4281
4314
  ),
4282
- /* @__PURE__ */ jsx28("span", { children: "Required" })
4315
+ /* @__PURE__ */ jsx29("span", { children: "Required" })
4283
4316
  ] }),
4284
4317
  /* @__PURE__ */ jsxs17("label", { className: "lace-panel-checkbox-row", children: [
4285
- /* @__PURE__ */ jsx28(
4318
+ /* @__PURE__ */ jsx29(
4286
4319
  "input",
4287
4320
  {
4288
4321
  type: "checkbox",
@@ -4291,10 +4324,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
4291
4324
  disabled: !editable
4292
4325
  }
4293
4326
  ),
4294
- /* @__PURE__ */ jsx28("span", { children: "Ephemeral" })
4327
+ /* @__PURE__ */ jsx29("span", { children: "Ephemeral" })
4295
4328
  ] }),
4296
4329
  /* @__PURE__ */ jsxs17("label", { className: "lace-panel-checkbox-row", children: [
4297
- /* @__PURE__ */ jsx28(
4330
+ /* @__PURE__ */ jsx29(
4298
4331
  "input",
4299
4332
  {
4300
4333
  type: "checkbox",
@@ -4303,10 +4336,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
4303
4336
  disabled: !editable
4304
4337
  }
4305
4338
  ),
4306
- /* @__PURE__ */ jsx28("span", { children: "Sensitive" })
4339
+ /* @__PURE__ */ jsx29("span", { children: "Sensitive" })
4307
4340
  ] }),
4308
4341
  /* @__PURE__ */ jsxs17("label", { className: "lace-panel-checkbox-row", children: [
4309
- /* @__PURE__ */ jsx28(
4342
+ /* @__PURE__ */ jsx29(
4310
4343
  "input",
4311
4344
  {
4312
4345
  type: "checkbox",
@@ -4315,13 +4348,13 @@ function ModuleInterfaceContent({ settings, onSave }) {
4315
4348
  disabled: !editable
4316
4349
  }
4317
4350
  ),
4318
- /* @__PURE__ */ jsx28("span", { children: "Nullable" })
4351
+ /* @__PURE__ */ jsx29("span", { children: "Nullable" })
4319
4352
  ] })
4320
4353
  ] }),
4321
4354
  (v.validation.length > 0 || editable) && /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-content", children: [
4322
- /* @__PURE__ */ jsx28("div", { className: "lace-panel-subsection-label", children: "Validation" }),
4355
+ /* @__PURE__ */ jsx29("div", { className: "lace-panel-subsection-label", children: "Validation" }),
4323
4356
  v.validation.map((block, j) => /* @__PURE__ */ jsxs17("div", { className: "lace-panel-validation-block", children: [
4324
- /* @__PURE__ */ jsx28(
4357
+ /* @__PURE__ */ jsx29(
4325
4358
  Input3,
4326
4359
  {
4327
4360
  value: block.condition,
@@ -4333,7 +4366,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
4333
4366
  readOnly: !editable
4334
4367
  }
4335
4368
  ),
4336
- /* @__PURE__ */ jsx28(
4369
+ /* @__PURE__ */ jsx29(
4337
4370
  Input3,
4338
4371
  {
4339
4372
  value: block.error_message,
@@ -4344,10 +4377,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
4344
4377
  readOnly: !editable
4345
4378
  }
4346
4379
  ),
4347
- editable && /* @__PURE__ */ jsx28(
4380
+ editable && /* @__PURE__ */ jsx29(
4348
4381
  IconButton5,
4349
4382
  {
4350
- icon: /* @__PURE__ */ jsx28(CanvasIcon, { name: "close" }),
4383
+ icon: /* @__PURE__ */ jsx29(CanvasIcon, { name: "close" }),
4351
4384
  "aria-label": "Remove validation rule",
4352
4385
  size: "md",
4353
4386
  tooltipPlacement: "bottom-end",
@@ -4355,15 +4388,15 @@ function ModuleInterfaceContent({ settings, onSave }) {
4355
4388
  }
4356
4389
  )
4357
4390
  ] }, block.id)),
4358
- editable && /* @__PURE__ */ jsx28(Button8, { variant: "secondary", size: "sm", onClick: () => addValidation(i), children: "+ Add validation rule" })
4391
+ editable && /* @__PURE__ */ jsx29(Button8, { variant: "secondary", size: "sm", onClick: () => addValidation(i), children: "+ Add validation rule" })
4359
4392
  ] })
4360
4393
  ] }, v.id)),
4361
- editable && /* @__PURE__ */ jsx28(Button8, { variant: "secondary", size: "sm", onClick: addVariable, children: "+ Add variable" }),
4362
- /* @__PURE__ */ jsx28("h4", { className: "lace-panel-section-title", children: "Outputs" }),
4363
- outputs.length === 0 && /* @__PURE__ */ jsx28("div", { className: "lace-panel-hint", children: "No outputs." }),
4394
+ editable && /* @__PURE__ */ jsx29(Button8, { variant: "secondary", size: "sm", onClick: addVariable, children: "+ Add variable" }),
4395
+ /* @__PURE__ */ jsx29("h4", { className: "lace-panel-section-title", children: "Outputs" }),
4396
+ outputs.length === 0 && /* @__PURE__ */ jsx29("div", { className: "lace-panel-hint", children: "No outputs." }),
4364
4397
  outputs.map((o, i) => /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
4365
4398
  /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4366
- /* @__PURE__ */ jsx28(
4399
+ /* @__PURE__ */ jsx29(
4367
4400
  Input3,
4368
4401
  {
4369
4402
  label: "Name",
@@ -4376,10 +4409,10 @@ function ModuleInterfaceContent({ settings, onSave }) {
4376
4409
  error: outputDupes.has(i) || editable && !o.name.trim()
4377
4410
  }
4378
4411
  ),
4379
- editable && /* @__PURE__ */ jsx28(
4412
+ editable && /* @__PURE__ */ jsx29(
4380
4413
  IconButton5,
4381
4414
  {
4382
- icon: /* @__PURE__ */ jsx28(CanvasIcon, { name: "close" }),
4415
+ icon: /* @__PURE__ */ jsx29(CanvasIcon, { name: "close" }),
4383
4416
  "aria-label": `Remove output ${o.name}`,
4384
4417
  size: "md",
4385
4418
  tooltipPlacement: "bottom-end",
@@ -4387,7 +4420,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
4387
4420
  }
4388
4421
  )
4389
4422
  ] }),
4390
- /* @__PURE__ */ jsx28("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx28(
4423
+ /* @__PURE__ */ jsx29("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx29(
4391
4424
  Input3,
4392
4425
  {
4393
4426
  label: "Value",
@@ -4400,7 +4433,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
4400
4433
  error: editable && !o.value.trim()
4401
4434
  }
4402
4435
  ) }),
4403
- /* @__PURE__ */ jsx28("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx28(
4436
+ /* @__PURE__ */ jsx29("div", { className: "lace-panel-row-content", children: /* @__PURE__ */ jsx29(
4404
4437
  Textarea2,
4405
4438
  {
4406
4439
  label: "Description",
@@ -4413,7 +4446,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
4413
4446
  }
4414
4447
  ) }),
4415
4448
  /* @__PURE__ */ jsxs17("label", { className: "lace-panel-checkbox-row", children: [
4416
- /* @__PURE__ */ jsx28(
4449
+ /* @__PURE__ */ jsx29(
4417
4450
  "input",
4418
4451
  {
4419
4452
  type: "checkbox",
@@ -4422,12 +4455,12 @@ function ModuleInterfaceContent({ settings, onSave }) {
4422
4455
  disabled: !editable
4423
4456
  }
4424
4457
  ),
4425
- /* @__PURE__ */ jsx28("span", { children: "Sensitive" })
4458
+ /* @__PURE__ */ jsx29("span", { children: "Sensitive" })
4426
4459
  ] }),
4427
4460
  (o.depends_on.length > 0 || editable && settings.dependency_options.length > 0) && /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-content", children: [
4428
- /* @__PURE__ */ jsx28("div", { className: "lace-panel-subsection-label", children: "Depends on" }),
4429
- !editable ? o.depends_on.map((dep) => /* @__PURE__ */ jsx28("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx28(Identifier, { text: dep }) }, dep)) : settings.dependency_options.map((dep) => /* @__PURE__ */ jsxs17("label", { className: "lace-panel-checkbox-row", children: [
4430
- /* @__PURE__ */ jsx28(
4461
+ /* @__PURE__ */ jsx29("div", { className: "lace-panel-subsection-label", children: "Depends on" }),
4462
+ !editable ? o.depends_on.map((dep) => /* @__PURE__ */ jsx29("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx29(Identifier, { text: dep }) }, dep)) : settings.dependency_options.map((dep) => /* @__PURE__ */ jsxs17("label", { className: "lace-panel-checkbox-row", children: [
4463
+ /* @__PURE__ */ jsx29(
4431
4464
  "input",
4432
4465
  {
4433
4466
  type: "checkbox",
@@ -4435,14 +4468,14 @@ function ModuleInterfaceContent({ settings, onSave }) {
4435
4468
  onChange: () => toggleDependsOn(i, dep)
4436
4469
  }
4437
4470
  ),
4438
- /* @__PURE__ */ jsx28(Identifier, { text: dep })
4471
+ /* @__PURE__ */ jsx29(Identifier, { text: dep })
4439
4472
  ] }, dep))
4440
4473
  ] }),
4441
- outputDupes.has(i) && /* @__PURE__ */ jsx28("div", { className: "lace-panel-row-error", children: "Output names must be unique." })
4474
+ outputDupes.has(i) && /* @__PURE__ */ jsx29("div", { className: "lace-panel-row-error", children: "Output names must be unique." })
4442
4475
  ] }, o.id)),
4443
4476
  editable && /* @__PURE__ */ jsxs17("div", { className: "lace-panel-row-actions", children: [
4444
- /* @__PURE__ */ jsx28(Button8, { variant: "secondary", size: "sm", onClick: () => addOutput("", ""), children: "+ Add output" }),
4445
- exposable.length > 0 && /* @__PURE__ */ jsx28(
4477
+ /* @__PURE__ */ jsx29(Button8, { variant: "secondary", size: "sm", onClick: () => addOutput("", ""), children: "+ Add output" }),
4478
+ exposable.length > 0 && /* @__PURE__ */ jsx29(
4446
4479
  Select,
4447
4480
  {
4448
4481
  "aria-label": "Expose a call's output",
@@ -4458,7 +4491,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
4458
4491
  }
4459
4492
  )
4460
4493
  ] }),
4461
- editable && /* @__PURE__ */ jsx28(
4494
+ editable && /* @__PURE__ */ jsx29(
4462
4495
  UpdateButton,
4463
4496
  {
4464
4497
  draft,
@@ -4469,7 +4502,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
4469
4502
  ] });
4470
4503
  }
4471
4504
  function ModuleInterfacePanel({ onClose, ...content }) {
4472
- return /* @__PURE__ */ jsx28(Panel3, { title: "Module Interface", onClose, children: /* @__PURE__ */ jsx28(ModuleInterfaceContent, { ...content }) });
4505
+ return /* @__PURE__ */ jsx29(Panel3, { title: "Module Interface", onClose, children: /* @__PURE__ */ jsx29(ModuleInterfaceContent, { ...content }) });
4473
4506
  }
4474
4507
 
4475
4508
  // src/components/panels/module-actions.ts
@@ -4588,7 +4621,7 @@ import "./panels-shared-3HUQC7TC.css";
4588
4621
  // src/components/panels/ProvidersPanel.tsx
4589
4622
  import { Button as Button9, IconButton as IconButton6, Input as Input4, Panel as Panel4 } from "@lace-cloud/ui";
4590
4623
  import "./panels-shared-3HUQC7TC.css";
4591
- import { Fragment as Fragment9, jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
4624
+ import { Fragment as Fragment9, jsx as jsx30, jsxs as jsxs18 } from "react/jsx-runtime";
4592
4625
  function toRows2(providers) {
4593
4626
  if (!providers || providers.length === 0) return [];
4594
4627
  return providers.map((p) => ({
@@ -4642,7 +4675,7 @@ function ProvidersContent({ providers, onSave }) {
4642
4675
  return /* @__PURE__ */ jsxs18(Fragment9, { children: [
4643
4676
  rows.map((row, pi) => /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
4644
4677
  /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4645
- /* @__PURE__ */ jsx29(
4678
+ /* @__PURE__ */ jsx30(
4646
4679
  Input4,
4647
4680
  {
4648
4681
  value: row.name,
@@ -4652,7 +4685,7 @@ function ProvidersContent({ providers, onSave }) {
4652
4685
  readOnly: !editable
4653
4686
  }
4654
4687
  ),
4655
- /* @__PURE__ */ jsx29(
4688
+ /* @__PURE__ */ jsx30(
4656
4689
  Input4,
4657
4690
  {
4658
4691
  value: row.alias,
@@ -4662,10 +4695,10 @@ function ProvidersContent({ providers, onSave }) {
4662
4695
  readOnly: !editable
4663
4696
  }
4664
4697
  ),
4665
- editable && /* @__PURE__ */ jsx29(
4698
+ editable && /* @__PURE__ */ jsx30(
4666
4699
  IconButton6,
4667
4700
  {
4668
- icon: /* @__PURE__ */ jsx29(CanvasIcon, { name: "close" }),
4701
+ icon: /* @__PURE__ */ jsx30(CanvasIcon, { name: "close" }),
4669
4702
  "aria-label": "Remove provider",
4670
4703
  size: "md",
4671
4704
  tooltipPlacement: "bottom-end",
@@ -4673,9 +4706,9 @@ function ProvidersContent({ providers, onSave }) {
4673
4706
  }
4674
4707
  )
4675
4708
  ] }),
4676
- /* @__PURE__ */ jsx29("div", { className: "lace-panel-row-sublabel", children: "Config" }),
4709
+ /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-sublabel", children: "Config" }),
4677
4710
  row.configEntries.map((entry, ei) => /* @__PURE__ */ jsxs18("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4678
- /* @__PURE__ */ jsx29(
4711
+ /* @__PURE__ */ jsx30(
4679
4712
  Input4,
4680
4713
  {
4681
4714
  value: entry.key,
@@ -4685,7 +4718,7 @@ function ProvidersContent({ providers, onSave }) {
4685
4718
  readOnly: !editable
4686
4719
  }
4687
4720
  ),
4688
- /* @__PURE__ */ jsx29(
4721
+ /* @__PURE__ */ jsx30(
4689
4722
  Input4,
4690
4723
  {
4691
4724
  value: entry.value,
@@ -4695,10 +4728,10 @@ function ProvidersContent({ providers, onSave }) {
4695
4728
  readOnly: !editable
4696
4729
  }
4697
4730
  ),
4698
- editable && /* @__PURE__ */ jsx29(
4731
+ editable && /* @__PURE__ */ jsx30(
4699
4732
  IconButton6,
4700
4733
  {
4701
- icon: /* @__PURE__ */ jsx29(CanvasIcon, { name: "close" }),
4734
+ icon: /* @__PURE__ */ jsx30(CanvasIcon, { name: "close" }),
4702
4735
  "aria-label": "Remove config key",
4703
4736
  size: "md",
4704
4737
  tooltipPlacement: "bottom-end",
@@ -4709,7 +4742,7 @@ function ProvidersContent({ providers, onSave }) {
4709
4742
  }
4710
4743
  )
4711
4744
  ] }, entry.id)),
4712
- editable && /* @__PURE__ */ jsx29(
4745
+ editable && /* @__PURE__ */ jsx30(
4713
4746
  Button9,
4714
4747
  {
4715
4748
  variant: "secondary",
@@ -4722,8 +4755,8 @@ function ProvidersContent({ providers, onSave }) {
4722
4755
  }
4723
4756
  ),
4724
4757
  (row.blocks.length > 0 || editable) && /* @__PURE__ */ jsxs18(Fragment9, { children: [
4725
- /* @__PURE__ */ jsx29("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
4726
- /* @__PURE__ */ jsx29(
4758
+ /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
4759
+ /* @__PURE__ */ jsx30(
4727
4760
  BlockEditor,
4728
4761
  {
4729
4762
  blocks: row.blocks,
@@ -4734,20 +4767,20 @@ function ProvidersContent({ providers, onSave }) {
4734
4767
  ] })
4735
4768
  ] }, row.id)),
4736
4769
  editable && /* @__PURE__ */ jsxs18(Fragment9, { children: [
4737
- /* @__PURE__ */ jsx29(Button9, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
4738
- /* @__PURE__ */ jsx29(UpdateButton, { draft, label: "Update providers" })
4770
+ /* @__PURE__ */ jsx30(Button9, { variant: "secondary", size: "sm", onClick: addProvider, children: "+ Add provider" }),
4771
+ /* @__PURE__ */ jsx30(UpdateButton, { draft, label: "Update providers" })
4739
4772
  ] })
4740
4773
  ] });
4741
4774
  }
4742
4775
  function ProvidersPanel({ providers, onSave, onClose }) {
4743
- return /* @__PURE__ */ jsx29(Panel4, { title: "Providers", onClose, children: /* @__PURE__ */ jsx29(ProvidersContent, { providers, onSave }) });
4776
+ return /* @__PURE__ */ jsx30(Panel4, { title: "Providers", onClose, children: /* @__PURE__ */ jsx30(ProvidersContent, { providers, onSave }) });
4744
4777
  }
4745
4778
 
4746
4779
  // src/components/panels/ResourcesPanel.tsx
4747
4780
  import { Badge as Badge2, Button as Button10, IconButton as IconButton7, Input as Input5, Select as Select2 } from "@lace-cloud/ui";
4748
4781
  import { useState as useState16 } from "react";
4749
4782
  import "./panels-shared-3HUQC7TC.css";
4750
- import { Fragment as Fragment10, jsx as jsx30, jsxs as jsxs19 } from "react/jsx-runtime";
4783
+ import { Fragment as Fragment10, jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
4751
4784
  function ResourcesContent({
4752
4785
  resources,
4753
4786
  dependencyOptions,
@@ -4758,8 +4791,8 @@ function ResourcesContent({
4758
4791
  }) {
4759
4792
  const { editable } = useCanvas();
4760
4793
  return /* @__PURE__ */ jsxs19(Fragment10, { children: [
4761
- resources.length === 0 && /* @__PURE__ */ jsx30("div", { className: "lace-panel-hint", children: "No resources or data sources." }),
4762
- resources.map((resource) => /* @__PURE__ */ jsx30(
4794
+ resources.length === 0 && /* @__PURE__ */ jsx31("div", { className: "lace-panel-hint", children: "No resources or data sources." }),
4795
+ resources.map((resource) => /* @__PURE__ */ jsx31(
4763
4796
  ResourceCard,
4764
4797
  {
4765
4798
  resource,
@@ -4772,7 +4805,7 @@ function ResourcesContent({
4772
4805
  },
4773
4806
  resource.id
4774
4807
  )),
4775
- editable && /* @__PURE__ */ jsx30(NewResourceRow, { managed, onAdd })
4808
+ editable && /* @__PURE__ */ jsx31(NewResourceRow, { managed, onAdd })
4776
4809
  ] });
4777
4810
  }
4778
4811
  var MANAGED_OPTION = { value: "resource", label: "Resource" };
@@ -4787,9 +4820,9 @@ function NewResourceRow({
4787
4820
  const [type, setType] = useState16("");
4788
4821
  const [name, setName] = useState16("");
4789
4822
  return /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-card", children: [
4790
- /* @__PURE__ */ jsx30("div", { className: "lace-panel-subsection-label", children: "Add a resource" }),
4823
+ /* @__PURE__ */ jsx31("div", { className: "lace-panel-subsection-label", children: "Add a resource" }),
4791
4824
  /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-actions", children: [
4792
- /* @__PURE__ */ jsx30(
4825
+ /* @__PURE__ */ jsx31(
4793
4826
  Select2,
4794
4827
  {
4795
4828
  "aria-label": "New resource kind",
@@ -4798,7 +4831,7 @@ function NewResourceRow({
4798
4831
  onChange: (e) => setChosen(e.target.value === "data" ? "data" : "resource")
4799
4832
  }
4800
4833
  ),
4801
- /* @__PURE__ */ jsx30(
4834
+ /* @__PURE__ */ jsx31(
4802
4835
  Input5,
4803
4836
  {
4804
4837
  value: type,
@@ -4808,7 +4841,7 @@ function NewResourceRow({
4808
4841
  mono: true
4809
4842
  }
4810
4843
  ),
4811
- /* @__PURE__ */ jsx30(
4844
+ /* @__PURE__ */ jsx31(
4812
4845
  Input5,
4813
4846
  {
4814
4847
  value: name,
@@ -4818,7 +4851,7 @@ function NewResourceRow({
4818
4851
  mono: true
4819
4852
  }
4820
4853
  ),
4821
- /* @__PURE__ */ jsx30(
4854
+ /* @__PURE__ */ jsx31(
4822
4855
  Button10,
4823
4856
  {
4824
4857
  variant: "secondary",
@@ -4856,18 +4889,18 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
4856
4889
  ];
4857
4890
  return /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
4858
4891
  /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-actions", children: [
4859
- /* @__PURE__ */ jsx30(Badge2, { variant: resource.kind === "data" ? "info" : "neutral", children: resource.kind === "data" ? "data" : "resource" }),
4860
- /* @__PURE__ */ jsx30(
4892
+ /* @__PURE__ */ jsx31(Badge2, { variant: resource.kind === "data" ? "info" : "neutral", children: resource.kind === "data" ? "data" : "resource" }),
4893
+ /* @__PURE__ */ jsx31(
4861
4894
  Identifier,
4862
4895
  {
4863
4896
  className: "lace-panel-row-card__name",
4864
4897
  text: `${resource.type}.${resource.name}`
4865
4898
  }
4866
4899
  ),
4867
- editable && /* @__PURE__ */ jsx30(
4900
+ editable && /* @__PURE__ */ jsx31(
4868
4901
  IconButton7,
4869
4902
  {
4870
- icon: /* @__PURE__ */ jsx30(CanvasIcon, { name: "close" }),
4903
+ icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
4871
4904
  "aria-label": `Remove ${resource.type}.${resource.name}`,
4872
4905
  size: "md",
4873
4906
  tooltipPlacement: "bottom-end",
@@ -4876,7 +4909,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
4876
4909
  )
4877
4910
  ] }),
4878
4911
  metaArguments.map(
4879
- ({ field, placeholder }) => draft[field] || editable ? /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx30(
4912
+ ({ field, placeholder }) => draft[field] || editable ? /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx31(
4880
4913
  Input5,
4881
4914
  {
4882
4915
  label: field,
@@ -4889,11 +4922,11 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
4889
4922
  }
4890
4923
  ) }, field) : null
4891
4924
  ),
4892
- /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-sublabel", children: "Arguments" }),
4925
+ /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-sublabel", children: "Arguments" }),
4893
4926
  draft.arguments.map((argument, i) => (
4894
4927
  // biome-ignore lint/suspicious/noArrayIndexKey: argument rows are positional while edited
4895
4928
  /* @__PURE__ */ jsxs19("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
4896
- /* @__PURE__ */ jsx30(
4929
+ /* @__PURE__ */ jsx31(
4897
4930
  Input5,
4898
4931
  {
4899
4932
  value: argument.name,
@@ -4905,7 +4938,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
4905
4938
  error: argumentDupes.has(i)
4906
4939
  }
4907
4940
  ),
4908
- /* @__PURE__ */ jsx30(
4941
+ /* @__PURE__ */ jsx31(
4909
4942
  Input5,
4910
4943
  {
4911
4944
  value: argument.value,
@@ -4916,10 +4949,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
4916
4949
  readOnly: !editable
4917
4950
  }
4918
4951
  ),
4919
- editable && /* @__PURE__ */ jsx30(
4952
+ editable && /* @__PURE__ */ jsx31(
4920
4953
  IconButton7,
4921
4954
  {
4922
- icon: /* @__PURE__ */ jsx30(CanvasIcon, { name: "close" }),
4955
+ icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
4923
4956
  "aria-label": `Remove ${argument.name || "the argument"}`,
4924
4957
  size: "md",
4925
4958
  tooltipPlacement: "bottom-end",
@@ -4931,7 +4964,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
4931
4964
  )
4932
4965
  ] }, i)
4933
4966
  )),
4934
- editable && /* @__PURE__ */ jsx30(
4967
+ editable && /* @__PURE__ */ jsx31(
4935
4968
  Button10,
4936
4969
  {
4937
4970
  variant: "secondary",
@@ -4941,8 +4974,8 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
4941
4974
  }
4942
4975
  ),
4943
4976
  (draft.blocks.length > 0 || editable) && /* @__PURE__ */ jsxs19(Fragment10, { children: [
4944
- /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
4945
- /* @__PURE__ */ jsx30(
4977
+ /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-sublabel", children: "Nested blocks" }),
4978
+ /* @__PURE__ */ jsx31(
4946
4979
  BlockEditor,
4947
4980
  {
4948
4981
  blocks: draft.blocks,
@@ -4952,9 +4985,9 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
4952
4985
  )
4953
4986
  ] }),
4954
4987
  (draft.depends_on.length > 0 || editable && dependencyOptions.length > 0) && /* @__PURE__ */ jsxs19(Fragment10, { children: [
4955
- /* @__PURE__ */ jsx30("div", { className: "lace-panel-row-sublabel", children: "Depends on" }),
4956
- !editable ? draft.depends_on.map((dep) => /* @__PURE__ */ jsx30("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx30(Identifier, { text: dep }) }, dep)) : dependencyOptions.map((dep) => /* @__PURE__ */ jsxs19("label", { className: "lace-panel-checkbox-row", children: [
4957
- /* @__PURE__ */ jsx30(
4988
+ /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-sublabel", children: "Depends on" }),
4989
+ !editable ? draft.depends_on.map((dep) => /* @__PURE__ */ jsx31("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx31(Identifier, { text: dep }) }, dep)) : dependencyOptions.map((dep) => /* @__PURE__ */ jsxs19("label", { className: "lace-panel-checkbox-row", children: [
4990
+ /* @__PURE__ */ jsx31(
4958
4991
  "input",
4959
4992
  {
4960
4993
  type: "checkbox",
@@ -4965,10 +4998,10 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
4965
4998
  )
4966
4999
  }
4967
5000
  ),
4968
- /* @__PURE__ */ jsx30(Identifier, { text: dep })
5001
+ /* @__PURE__ */ jsx31(Identifier, { text: dep })
4969
5002
  ] }, dep))
4970
5003
  ] }),
4971
- editable && /* @__PURE__ */ jsx30(
5004
+ editable && /* @__PURE__ */ jsx31(
4972
5005
  UpdateButton,
4973
5006
  {
4974
5007
  draft: card,
@@ -4982,7 +5015,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
4982
5015
  // src/components/panels/TerraformConfigPanel.tsx
4983
5016
  import { Button as Button11, IconButton as IconButton8, Input as Input6, Panel as Panel5 } from "@lace-cloud/ui";
4984
5017
  import "./panels-shared-3HUQC7TC.css";
4985
- import { Fragment as Fragment11, jsx as jsx31, jsxs as jsxs20 } from "react/jsx-runtime";
5018
+ import { Fragment as Fragment11, jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
4986
5019
  function toRows3(terraform) {
4987
5020
  return (terraform?.required_providers ?? []).map((req) => ({
4988
5021
  id: req.name,
@@ -5015,8 +5048,8 @@ function TerraformConfigContent({ terraform, onSave }) {
5015
5048
  const setProviders2 = (next) => draft.set("providers", next);
5016
5049
  const updateProvider = (index, field, value) => setProviders2(providers.map((p, i) => i === index ? { ...p, [field]: value } : p));
5017
5050
  return /* @__PURE__ */ jsxs20(Fragment11, { children: [
5018
- /* @__PURE__ */ jsx31("h4", { className: "lace-panel-section-title", children: "Required Version" }),
5019
- /* @__PURE__ */ jsx31("div", { className: "lace-panel-field", children: /* @__PURE__ */ jsx31(
5051
+ /* @__PURE__ */ jsx32("h4", { className: "lace-panel-section-title", children: "Required Version" }),
5052
+ /* @__PURE__ */ jsx32("div", { className: "lace-panel-field", children: /* @__PURE__ */ jsx32(
5020
5053
  Input6,
5021
5054
  {
5022
5055
  value: requiredVersion,
@@ -5026,10 +5059,10 @@ function TerraformConfigContent({ terraform, onSave }) {
5026
5059
  readOnly: !editable
5027
5060
  }
5028
5061
  ) }),
5029
- /* @__PURE__ */ jsx31("h4", { className: "lace-panel-section-title", children: "Required Providers" }),
5062
+ /* @__PURE__ */ jsx32("h4", { className: "lace-panel-section-title", children: "Required Providers" }),
5030
5063
  providers.map((p, i) => /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-card lace-panel-row-card--with-footer", children: [
5031
5064
  /* @__PURE__ */ jsxs20("div", { className: "lace-panel-row-actions lace-panel-row-actions--field", children: [
5032
- /* @__PURE__ */ jsx31(
5065
+ /* @__PURE__ */ jsx32(
5033
5066
  Input6,
5034
5067
  {
5035
5068
  value: p.name,
@@ -5039,10 +5072,10 @@ function TerraformConfigContent({ terraform, onSave }) {
5039
5072
  readOnly: !editable
5040
5073
  }
5041
5074
  ),
5042
- editable && /* @__PURE__ */ jsx31(
5075
+ editable && /* @__PURE__ */ jsx32(
5043
5076
  IconButton8,
5044
5077
  {
5045
- icon: /* @__PURE__ */ jsx31(CanvasIcon, { name: "close" }),
5078
+ icon: /* @__PURE__ */ jsx32(CanvasIcon, { name: "close" }),
5046
5079
  "aria-label": "Remove provider",
5047
5080
  size: "md",
5048
5081
  tooltipPlacement: "bottom-end",
@@ -5050,7 +5083,7 @@ function TerraformConfigContent({ terraform, onSave }) {
5050
5083
  }
5051
5084
  )
5052
5085
  ] }),
5053
- /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx31(
5086
+ /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx32(
5054
5087
  Input6,
5055
5088
  {
5056
5089
  value: p.source,
@@ -5060,7 +5093,7 @@ function TerraformConfigContent({ terraform, onSave }) {
5060
5093
  readOnly: !editable
5061
5094
  }
5062
5095
  ) }),
5063
- /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx31(
5096
+ /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx32(
5064
5097
  Input6,
5065
5098
  {
5066
5099
  value: p.version,
@@ -5070,7 +5103,7 @@ function TerraformConfigContent({ terraform, onSave }) {
5070
5103
  readOnly: !editable
5071
5104
  }
5072
5105
  ) }),
5073
- (p.aliases || editable) && /* @__PURE__ */ jsx31("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx31(
5106
+ (p.aliases || editable) && /* @__PURE__ */ jsx32("div", { className: "lace-panel-row-actions", children: /* @__PURE__ */ jsx32(
5074
5107
  Input6,
5075
5108
  {
5076
5109
  value: p.aliases,
@@ -5083,7 +5116,7 @@ function TerraformConfigContent({ terraform, onSave }) {
5083
5116
  }
5084
5117
  ) })
5085
5118
  ] }, p.id)),
5086
- editable && /* @__PURE__ */ jsx31(
5119
+ editable && /* @__PURE__ */ jsx32(
5087
5120
  Button11,
5088
5121
  {
5089
5122
  variant: "secondary",
@@ -5095,37 +5128,37 @@ function TerraformConfigContent({ terraform, onSave }) {
5095
5128
  children: "+ Add provider"
5096
5129
  }
5097
5130
  ),
5098
- /* @__PURE__ */ jsx31("h4", { className: "lace-panel-section-title", children: "Backend" }),
5099
- /* @__PURE__ */ jsx31("div", { className: "lace-panel-hint", children: "Terraform state is managed by Lace Cloud. The HTTP backend is configured automatically during generation." }),
5100
- editable && /* @__PURE__ */ jsx31(UpdateButton, { draft, label: "Update terraform block" })
5131
+ /* @__PURE__ */ jsx32("h4", { className: "lace-panel-section-title", children: "Backend" }),
5132
+ /* @__PURE__ */ jsx32("div", { className: "lace-panel-hint", children: "Terraform state is managed by Lace Cloud. The HTTP backend is configured automatically during generation." }),
5133
+ editable && /* @__PURE__ */ jsx32(UpdateButton, { draft, label: "Update terraform block" })
5101
5134
  ] });
5102
5135
  }
5103
5136
  function TerraformConfigPanel({ terraform, onSave, onClose }) {
5104
- return /* @__PURE__ */ jsx31(Panel5, { title: "Terraform Configuration", onClose, children: /* @__PURE__ */ jsx31(TerraformConfigContent, { terraform, onSave }) });
5137
+ return /* @__PURE__ */ jsx32(Panel5, { title: "Terraform Configuration", onClose, children: /* @__PURE__ */ jsx32(TerraformConfigContent, { terraform, onSave }) });
5105
5138
  }
5106
5139
 
5107
5140
  // src/components/panels/ModuleDetails.tsx
5108
- import { Fragment as Fragment12, jsx as jsx32, jsxs as jsxs21 } from "react/jsx-runtime";
5141
+ import { Fragment as Fragment12, jsx as jsx33, jsxs as jsxs21 } from "react/jsx-runtime";
5109
5142
  function assertApplied(result) {
5110
5143
  if (!result?.success) throw new Error("apply failed");
5111
5144
  }
5112
5145
  var sectionKey = (moduleKey, section) => `${moduleKey}:${section}`;
5113
5146
  function ModuleDetails({ moduleKey, open = [] }) {
5114
5147
  const { bundle, runner } = useCanvas();
5115
- const settings = useMemo8(() => deriveSettingsConfig(bundle, moduleKey), [bundle, moduleKey]);
5148
+ const settings = useMemo10(() => deriveSettingsConfig(bundle, moduleKey), [bundle, moduleKey]);
5116
5149
  if (!settings) return null;
5117
- if (settings.reference) return /* @__PURE__ */ jsx32(ReferenceDetails, { settings });
5150
+ if (settings.reference) return /* @__PURE__ */ jsx33(ReferenceDetails, { settings });
5118
5151
  const apply = async (actions) => {
5119
5152
  assertApplied(await runner.apply(actions));
5120
5153
  };
5121
5154
  return /* @__PURE__ */ jsxs21(Fragment12, { children: [
5122
- /* @__PURE__ */ jsx32(
5155
+ /* @__PURE__ */ jsx33(
5123
5156
  AccordionSection,
5124
5157
  {
5125
5158
  title: "Resources",
5126
5159
  defaultOpen: open.includes("Resources"),
5127
5160
  badge: `(${settings.resources.length})`,
5128
- children: /* @__PURE__ */ jsx32(
5161
+ children: /* @__PURE__ */ jsx33(
5129
5162
  ResourcesContent,
5130
5163
  {
5131
5164
  resources: settings.resources,
@@ -5139,7 +5172,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
5139
5172
  )
5140
5173
  }
5141
5174
  ),
5142
- /* @__PURE__ */ jsx32(AccordionSection, { title: "Interface", defaultOpen: open.includes("Interface"), children: /* @__PURE__ */ jsx32(
5175
+ /* @__PURE__ */ jsx33(AccordionSection, { title: "Interface", defaultOpen: open.includes("Interface"), children: /* @__PURE__ */ jsx33(
5143
5176
  ModuleInterfaceContent,
5144
5177
  {
5145
5178
  settings,
@@ -5147,13 +5180,13 @@ function ModuleDetails({ moduleKey, open = [] }) {
5147
5180
  },
5148
5181
  sectionKey(moduleKey, "Interface")
5149
5182
  ) }),
5150
- /* @__PURE__ */ jsx32(
5183
+ /* @__PURE__ */ jsx33(
5151
5184
  AccordionSection,
5152
5185
  {
5153
5186
  title: "Moved and import blocks",
5154
5187
  defaultOpen: open.includes("Moved and import blocks"),
5155
5188
  badge: settings.directives.length > 0 ? `(${settings.directives.length})` : void 0,
5156
- children: /* @__PURE__ */ jsx32(
5189
+ children: /* @__PURE__ */ jsx33(
5157
5190
  DirectivesContent,
5158
5191
  {
5159
5192
  directives: settings.directives,
@@ -5163,7 +5196,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
5163
5196
  )
5164
5197
  }
5165
5198
  ),
5166
- /* @__PURE__ */ jsx32(AccordionSection, { title: "Locals", defaultOpen: open.includes("Locals"), children: /* @__PURE__ */ jsx32(
5199
+ /* @__PURE__ */ jsx33(AccordionSection, { title: "Locals", defaultOpen: open.includes("Locals"), children: /* @__PURE__ */ jsx33(
5167
5200
  LocalsContent,
5168
5201
  {
5169
5202
  locals: settings.locals,
@@ -5171,7 +5204,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
5171
5204
  },
5172
5205
  sectionKey(moduleKey, "Locals")
5173
5206
  ) }),
5174
- /* @__PURE__ */ jsx32(AccordionSection, { title: "Providers", defaultOpen: open.includes("Providers"), children: /* @__PURE__ */ jsx32(
5207
+ /* @__PURE__ */ jsx33(AccordionSection, { title: "Providers", defaultOpen: open.includes("Providers"), children: /* @__PURE__ */ jsx33(
5175
5208
  ProvidersContent,
5176
5209
  {
5177
5210
  providers: settings.providers,
@@ -5179,7 +5212,7 @@ function ModuleDetails({ moduleKey, open = [] }) {
5179
5212
  },
5180
5213
  sectionKey(moduleKey, "Providers")
5181
5214
  ) }),
5182
- /* @__PURE__ */ jsx32(AccordionSection, { title: "Terraform Config", defaultOpen: open.includes("Terraform Config"), children: /* @__PURE__ */ jsx32(
5215
+ /* @__PURE__ */ jsx33(AccordionSection, { title: "Terraform Config", defaultOpen: open.includes("Terraform Config"), children: /* @__PURE__ */ jsx33(
5183
5216
  TerraformConfigContent,
5184
5217
  {
5185
5218
  terraform: settings.terraform,
@@ -5197,8 +5230,8 @@ function DirectivesContent({
5197
5230
  const draft = useDraft({ blocks: directives }, ({ blocks: blocks2 }) => onSave(blocks2));
5198
5231
  const { blocks } = draft.value;
5199
5232
  return /* @__PURE__ */ jsxs21(Fragment12, { children: [
5200
- blocks.length === 0 && /* @__PURE__ */ jsx32("div", { className: "lace-panel-hint", children: "No moved or import blocks." }),
5201
- /* @__PURE__ */ jsx32(
5233
+ blocks.length === 0 && /* @__PURE__ */ jsx33("div", { className: "lace-panel-hint", children: "No moved or import blocks." }),
5234
+ /* @__PURE__ */ jsx33(
5202
5235
  BlockEditor,
5203
5236
  {
5204
5237
  blocks,
@@ -5210,7 +5243,7 @@ function DirectivesContent({
5210
5243
  ]
5211
5244
  }
5212
5245
  ),
5213
- editable && /* @__PURE__ */ jsx32(UpdateButton, { draft, label: "Update moved and import blocks" })
5246
+ editable && /* @__PURE__ */ jsx33(UpdateButton, { draft, label: "Update moved and import blocks" })
5214
5247
  ] });
5215
5248
  }
5216
5249
  function ReferenceDetails({ settings }) {
@@ -5218,24 +5251,24 @@ function ReferenceDetails({ settings }) {
5218
5251
  if (!reference) return null;
5219
5252
  return /* @__PURE__ */ jsxs21(Fragment12, { children: [
5220
5253
  /* @__PURE__ */ jsxs21(AccordionSection, { title: "Source", defaultOpen: true, children: [
5221
- /* @__PURE__ */ jsx32("div", { className: "lace-panel-hint", children: "A reference: Lace reads it where its source points and never edits it." }),
5254
+ /* @__PURE__ */ jsx33("div", { className: "lace-panel-hint", children: "A reference: Lace reads it where its source points and never edits it." }),
5222
5255
  /* @__PURE__ */ jsxs21("div", { className: "lace-panel-row-actions lace-panel-row-actions--stacked", children: [
5223
- /* @__PURE__ */ jsx32(Input7, { label: "Source", value: reference.source, fullWidth: true, mono: true, readOnly: true }),
5224
- /* @__PURE__ */ jsx32(Input7, { label: "Version", value: reference.version, fullWidth: true, mono: true, readOnly: true })
5256
+ /* @__PURE__ */ jsx33(Input7, { label: "Source", value: reference.source, fullWidth: true, mono: true, readOnly: true }),
5257
+ /* @__PURE__ */ jsx33(Input7, { label: "Version", value: reference.version, fullWidth: true, mono: true, readOnly: true })
5225
5258
  ] })
5226
5259
  ] }),
5227
5260
  /* @__PURE__ */ jsxs21(AccordionSection, { title: "Interface", defaultOpen: true, children: [
5228
- /* @__PURE__ */ jsx32("h4", { className: "lace-panel-section-title", children: "Inputs" }),
5229
- settings.variables.length === 0 && /* @__PURE__ */ jsx32("div", { className: "lace-panel-hint", children: "The IR holds no interface for this reference." }),
5230
- settings.variables.map((v) => /* @__PURE__ */ jsx32("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx32(Identifier, { text: `${typedName(v.name, v.type)}${v.required ? " (required)" : ""}` }) }, v.name)),
5231
- /* @__PURE__ */ jsx32("h4", { className: "lace-panel-section-title", children: "Outputs" }),
5232
- settings.outputs.map((o) => /* @__PURE__ */ jsx32("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx32(Identifier, { text: typedName(o.name, o.type) }) }, o.name))
5261
+ /* @__PURE__ */ jsx33("h4", { className: "lace-panel-section-title", children: "Inputs" }),
5262
+ settings.variables.length === 0 && /* @__PURE__ */ jsx33("div", { className: "lace-panel-hint", children: "The IR holds no interface for this reference." }),
5263
+ settings.variables.map((v) => /* @__PURE__ */ jsx33("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx33(Identifier, { text: `${typedName(v.name, v.type)}${v.required ? " (required)" : ""}` }) }, v.name)),
5264
+ /* @__PURE__ */ jsx33("h4", { className: "lace-panel-section-title", children: "Outputs" }),
5265
+ settings.outputs.map((o) => /* @__PURE__ */ jsx33("div", { className: "lace-panel-depends-item", children: /* @__PURE__ */ jsx33(Identifier, { text: typedName(o.name, o.type) }) }, o.name))
5233
5266
  ] })
5234
5267
  ] });
5235
5268
  }
5236
5269
 
5237
5270
  // src/components/panels/ModuleConfigPanel.tsx
5238
- import { Fragment as Fragment13, jsx as jsx33, jsxs as jsxs22 } from "react/jsx-runtime";
5271
+ import { Fragment as Fragment13, jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
5239
5272
  var MODE_ITEMS = [
5240
5273
  { value: "empty", label: "Unset" },
5241
5274
  { value: "literal", label: "Lit" },
@@ -5339,12 +5372,12 @@ function callActions(config, address, fields) {
5339
5372
  }
5340
5373
  function ModuleConfigPanel({ instance_id, onClose }) {
5341
5374
  const { editable, bundle, runner } = useCanvas();
5342
- const config = useMemo9(
5375
+ const config = useMemo11(
5343
5376
  () => deriveNodeConfig(bundle, instance_id),
5344
5377
  [bundle, instance_id]
5345
5378
  );
5346
- const address = useMemo9(() => instanceAddress6(bundle, instance_id), [bundle, instance_id]);
5347
- const seed = useMemo9(() => callFields(config), [config]);
5379
+ const address = useMemo11(() => instanceAddress6(bundle, instance_id), [bundle, instance_id]);
5380
+ const seed = useMemo11(() => callFields(config), [config]);
5348
5381
  const draft = useDraft(seed, async (fields2) => {
5349
5382
  if (!config) throw new Error(`no instance ${instance_id} to update`);
5350
5383
  const result = await runner.apply(callActions(config, address, fields2));
@@ -5364,7 +5397,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5364
5397
  value: mode === "literal" ? current.value ?? blankLiteral(input) : current.value
5365
5398
  });
5366
5399
  };
5367
- const { requiredInputs, optionalInputs } = useMemo9(
5400
+ const { requiredInputs, optionalInputs } = useMemo11(
5368
5401
  () => ({
5369
5402
  requiredInputs: (config?.inputs ?? []).filter((i) => i.required),
5370
5403
  optionalInputs: (config?.inputs ?? []).filter((i) => !i.required)
@@ -5380,7 +5413,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5380
5413
  ...m,
5381
5414
  disabled: !editable || m.value === "wired" || currentMode === "wired"
5382
5415
  }));
5383
- return /* @__PURE__ */ jsx33(
5416
+ return /* @__PURE__ */ jsx34(
5384
5417
  ModeToggle,
5385
5418
  {
5386
5419
  value: currentMode,
@@ -5394,8 +5427,8 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5394
5427
  const currentMode = binding(input)?.mode ?? input.mode;
5395
5428
  return /* @__PURE__ */ jsxs22("div", { className: "lace-panel-field", children: [
5396
5429
  /* @__PURE__ */ jsxs22("label", { className: "lace-panel-row-label", children: [
5397
- /* @__PURE__ */ jsx33(Identifier, { text: input.name }),
5398
- input.required && /* @__PURE__ */ jsx33("span", { className: "lace-mcp__required-star", children: "*" })
5430
+ /* @__PURE__ */ jsx34(Identifier, { text: input.name }),
5431
+ input.required && /* @__PURE__ */ jsx34("span", { className: "lace-mcp__required-star", children: "*" })
5399
5432
  ] }),
5400
5433
  renderModeSelector(input),
5401
5434
  /* @__PURE__ */ jsxs22("div", { className: "lace-panel-row-content", children: [
@@ -5404,17 +5437,17 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5404
5437
  currentMode === "expression" && renderExpressionEditor(input),
5405
5438
  currentMode === "literal" && renderLiteralEditor(input)
5406
5439
  ] }),
5407
- input.description && /* @__PURE__ */ jsx33("div", { className: "lace-panel-field__description", children: input.description })
5440
+ input.description && /* @__PURE__ */ jsx34("div", { className: "lace-panel-field__description", children: input.description })
5408
5441
  ] }, input.name);
5409
5442
  }
5410
5443
  function renderWiredEditor(input) {
5411
5444
  const label = input.wired_source ?? "Not wired";
5412
5445
  return /* @__PURE__ */ jsxs22("div", { className: "lace-mcp__wired-row", children: [
5413
- /* @__PURE__ */ jsx33("div", { className: "lace-mcp__wired-input", children: /* @__PURE__ */ jsx33(Input8, { value: label, readOnly: true, fullWidth: true, mono: true }) }),
5414
- editable && /* @__PURE__ */ jsx33(
5446
+ /* @__PURE__ */ jsx34("div", { className: "lace-mcp__wired-input", children: /* @__PURE__ */ jsx34(Input8, { value: label, readOnly: true, fullWidth: true, mono: true }) }),
5447
+ editable && /* @__PURE__ */ jsx34(
5415
5448
  IconButton9,
5416
5449
  {
5417
- icon: /* @__PURE__ */ jsx33(CanvasIcon, { name: "close" }),
5450
+ icon: /* @__PURE__ */ jsx34(CanvasIcon, { name: "close" }),
5418
5451
  "aria-label": "Disconnect this input",
5419
5452
  size: "md",
5420
5453
  tooltipPlacement: "bottom-end",
@@ -5424,7 +5457,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5424
5457
  ] });
5425
5458
  }
5426
5459
  function renderVariableEditor(input) {
5427
- return /* @__PURE__ */ jsx33(
5460
+ return /* @__PURE__ */ jsx34(
5428
5461
  Input8,
5429
5462
  {
5430
5463
  value: binding(input)?.variable ?? "",
@@ -5440,7 +5473,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5440
5473
  );
5441
5474
  }
5442
5475
  function renderExpressionEditor(input) {
5443
- return /* @__PURE__ */ jsx33(
5476
+ return /* @__PURE__ */ jsx34(
5444
5477
  Textarea3,
5445
5478
  {
5446
5479
  value: binding(input)?.expression ?? "",
@@ -5466,14 +5499,14 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5466
5499
  onChange: (e) => updateValue(e.target.value === "true"),
5467
5500
  disabled: !editable,
5468
5501
  children: [
5469
- /* @__PURE__ */ jsx33("option", { value: "true", children: "True" }),
5470
- /* @__PURE__ */ jsx33("option", { value: "false", children: "False" })
5502
+ /* @__PURE__ */ jsx34("option", { value: "true", children: "True" }),
5503
+ /* @__PURE__ */ jsx34("option", { value: "false", children: "False" })
5471
5504
  ]
5472
5505
  }
5473
5506
  );
5474
5507
  }
5475
5508
  if (kind === "number") {
5476
- return /* @__PURE__ */ jsx33(
5509
+ return /* @__PURE__ */ jsx34(
5477
5510
  Input8,
5478
5511
  {
5479
5512
  type: "number",
@@ -5486,7 +5519,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5486
5519
  }
5487
5520
  if (kind === "collection") {
5488
5521
  const jsonStr = typeof value === "string" ? value : JSON.stringify(value ?? null, null, 2);
5489
- return /* @__PURE__ */ jsx33(
5522
+ return /* @__PURE__ */ jsx34(
5490
5523
  Textarea3,
5491
5524
  {
5492
5525
  value: jsonStr,
@@ -5504,7 +5537,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5504
5537
  }
5505
5538
  );
5506
5539
  }
5507
- return /* @__PURE__ */ jsx33(
5540
+ return /* @__PURE__ */ jsx34(
5508
5541
  Input8,
5509
5542
  {
5510
5543
  value: String(value ?? ""),
@@ -5527,28 +5560,28 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5527
5560
  instance_id,
5528
5561
  '":'
5529
5562
  ] }),
5530
- /* @__PURE__ */ jsx33("div", { className: "lace-mcp__error-detail", children: "Instance not found in the current Bundle." })
5563
+ /* @__PURE__ */ jsx34("div", { className: "lace-mcp__error-detail", children: "Instance not found in the current Bundle." })
5531
5564
  ] });
5532
5565
  }
5533
5566
  const dependsOn = fields.depends_on;
5534
5567
  const setProviders2 = (next) => draft.set("providers", next);
5535
5568
  const title = /* @__PURE__ */ jsxs22("div", { className: "lace-mcp__title", children: [
5536
- /* @__PURE__ */ jsx33("div", { className: "lace-mcp__title-eyebrow", children: "Module" }),
5537
- /* @__PURE__ */ jsx33("h3", { className: "lace-mcp__title-id", children: /* @__PURE__ */ jsx33(Identifier, { text: instance_id }) })
5569
+ /* @__PURE__ */ jsx34("div", { className: "lace-mcp__title-eyebrow", children: "Module" }),
5570
+ /* @__PURE__ */ jsx34("h3", { className: "lace-mcp__title-id", children: /* @__PURE__ */ jsx34(Identifier, { text: instance_id }) })
5538
5571
  ] });
5539
- const footer = editable ? /* @__PURE__ */ jsx33(UpdateButton, { draft, label: "Update configuration" }) : void 0;
5572
+ const footer = editable ? /* @__PURE__ */ jsx34(UpdateButton, { draft, label: "Update configuration" }) : void 0;
5540
5573
  return /* @__PURE__ */ jsxs22(Panel6, { title, footer, flush: true, onClose, children: [
5541
- requiredInputs.length > 0 && /* @__PURE__ */ jsx33(AccordionSection, { title: "Required Inputs", defaultOpen: true, badge: `(${requiredInputs.length})`, children: requiredInputs.map(renderInputField) }),
5542
- optionalInputs.length > 0 && /* @__PURE__ */ jsx33(AccordionSection, { title: "Optional Inputs", defaultOpen: true, badge: `(${optionalInputs.length})`, children: optionalInputs.map(renderInputField) }),
5574
+ requiredInputs.length > 0 && /* @__PURE__ */ jsx34(AccordionSection, { title: "Required Inputs", defaultOpen: true, badge: `(${requiredInputs.length})`, children: requiredInputs.map(renderInputField) }),
5575
+ optionalInputs.length > 0 && /* @__PURE__ */ jsx34(AccordionSection, { title: "Optional Inputs", defaultOpen: true, badge: `(${optionalInputs.length})`, children: optionalInputs.map(renderInputField) }),
5543
5576
  config.dependency_options.length > 0 && /* @__PURE__ */ jsxs22(
5544
5577
  AccordionSection,
5545
5578
  {
5546
5579
  title: "Depends On",
5547
5580
  badge: dependsOn.length > 0 ? `(${dependsOn.length})` : void 0,
5548
5581
  children: [
5549
- /* @__PURE__ */ jsx33("div", { className: "lace-mcp__depends-hint", children: "Select sibling instances this module depends on." }),
5582
+ /* @__PURE__ */ jsx34("div", { className: "lace-mcp__depends-hint", children: "Select sibling instances this module depends on." }),
5550
5583
  config.dependency_options.map((option) => /* @__PURE__ */ jsxs22("label", { className: "lace-mcp__depends-item", children: [
5551
- /* @__PURE__ */ jsx33(
5584
+ /* @__PURE__ */ jsx34(
5552
5585
  "input",
5553
5586
  {
5554
5587
  type: "checkbox",
@@ -5561,7 +5594,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5561
5594
  )
5562
5595
  }
5563
5596
  ),
5564
- /* @__PURE__ */ jsx33(Identifier, { className: "lace-mcp__depends-label", text: option })
5597
+ /* @__PURE__ */ jsx34(Identifier, { className: "lace-mcp__depends-label", text: option })
5565
5598
  ] }, option))
5566
5599
  ]
5567
5600
  }
@@ -5575,15 +5608,15 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5575
5608
  /* @__PURE__ */ jsxs22("div", { className: "lace-mcp__depends-hint", children: [
5576
5609
  "Map each child-local provider name to the root provider reference passed down (e.g.",
5577
5610
  " ",
5578
- /* @__PURE__ */ jsx33("code", { children: "aws" }),
5611
+ /* @__PURE__ */ jsx34("code", { children: "aws" }),
5579
5612
  " \u2192 ",
5580
- /* @__PURE__ */ jsx33("code", { children: "aws.west" }),
5613
+ /* @__PURE__ */ jsx34("code", { children: "aws.west" }),
5581
5614
  ")."
5582
5615
  ] }),
5583
5616
  fields.providers.map((row, i) => (
5584
5617
  // biome-ignore lint/suspicious/noArrayIndexKey: rows are positional and freely editable
5585
5618
  /* @__PURE__ */ jsxs22("div", { className: "lace-mcp__provider-row", children: [
5586
- /* @__PURE__ */ jsx33(
5619
+ /* @__PURE__ */ jsx34(
5587
5620
  Input8,
5588
5621
  {
5589
5622
  value: row.key,
@@ -5595,8 +5628,8 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5595
5628
  readOnly: !editable
5596
5629
  }
5597
5630
  ),
5598
- /* @__PURE__ */ jsx33("span", { className: "lace-mcp__provider-arrow", children: "=" }),
5599
- /* @__PURE__ */ jsx33(
5631
+ /* @__PURE__ */ jsx34("span", { className: "lace-mcp__provider-arrow", children: "=" }),
5632
+ /* @__PURE__ */ jsx34(
5600
5633
  Input8,
5601
5634
  {
5602
5635
  value: row.value,
@@ -5608,10 +5641,10 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5608
5641
  readOnly: !editable
5609
5642
  }
5610
5643
  ),
5611
- editable && /* @__PURE__ */ jsx33(
5644
+ editable && /* @__PURE__ */ jsx34(
5612
5645
  IconButton9,
5613
5646
  {
5614
- icon: /* @__PURE__ */ jsx33(CanvasIcon, { name: "close" }),
5647
+ icon: /* @__PURE__ */ jsx34(CanvasIcon, { name: "close" }),
5615
5648
  "aria-label": "Remove this provider mapping",
5616
5649
  size: "md",
5617
5650
  tooltipPlacement: "bottom-end",
@@ -5620,7 +5653,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5620
5653
  )
5621
5654
  ] }, i)
5622
5655
  )),
5623
- editable && /* @__PURE__ */ jsx33(
5656
+ editable && /* @__PURE__ */ jsx34(
5624
5657
  Button12,
5625
5658
  {
5626
5659
  variant: "secondary",
@@ -5635,12 +5668,12 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5635
5668
  (fields.count || fields.for_each || editable) && /* @__PURE__ */ jsxs22(AccordionSection, { title: "Repetition", children: [
5636
5669
  /* @__PURE__ */ jsxs22("div", { className: "lace-mcp__depends-hint", children: [
5637
5670
  "The call's ",
5638
- /* @__PURE__ */ jsx33("code", { children: "count" }),
5671
+ /* @__PURE__ */ jsx34("code", { children: "count" }),
5639
5672
  " or ",
5640
- /* @__PURE__ */ jsx33("code", { children: "for_each" }),
5673
+ /* @__PURE__ */ jsx34("code", { children: "for_each" }),
5641
5674
  ": one module, called once per instance."
5642
5675
  ] }),
5643
- /* @__PURE__ */ jsx33(
5676
+ /* @__PURE__ */ jsx34(
5644
5677
  Input8,
5645
5678
  {
5646
5679
  label: "count",
@@ -5652,7 +5685,7 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5652
5685
  readOnly: !editable
5653
5686
  }
5654
5687
  ),
5655
- /* @__PURE__ */ jsx33(
5688
+ /* @__PURE__ */ jsx34(
5656
5689
  Input8,
5657
5690
  {
5658
5691
  label: "for_each",
@@ -5665,26 +5698,26 @@ function ModuleConfigPanel({ instance_id, onClose }) {
5665
5698
  }
5666
5699
  )
5667
5700
  ] }),
5668
- config.outputs.length > 0 && /* @__PURE__ */ jsx33(AccordionSection, { title: "Outputs", badge: `(${config.outputs.length})`, children: config.outputs.map((o) => /* @__PURE__ */ jsxs22("div", { className: "lace-mcp__output-card", children: [
5701
+ config.outputs.length > 0 && /* @__PURE__ */ jsx34(AccordionSection, { title: "Outputs", badge: `(${config.outputs.length})`, children: config.outputs.map((o) => /* @__PURE__ */ jsxs22("div", { className: "lace-mcp__output-card", children: [
5669
5702
  /* @__PURE__ */ jsxs22("div", { className: "lace-mcp__output-header", children: [
5670
- /* @__PURE__ */ jsx33(Identifier, { className: "lace-mcp__output-name", text: o.name }),
5671
- /* @__PURE__ */ jsx33(Identifier, { className: "lace-mcp__output-type", text: o.type ?? "" })
5703
+ /* @__PURE__ */ jsx34(Identifier, { className: "lace-mcp__output-name", text: o.name }),
5704
+ /* @__PURE__ */ jsx34(Identifier, { className: "lace-mcp__output-type", text: o.type ?? "" })
5672
5705
  ] }),
5673
- o.description && /* @__PURE__ */ jsx33("div", { className: "lace-mcp__output-description", children: o.description }),
5674
- o.sensitive && /* @__PURE__ */ jsx33("div", { className: "lace-mcp__output-sensitive", children: "sensitive" })
5706
+ o.description && /* @__PURE__ */ jsx34("div", { className: "lace-mcp__output-description", children: o.description }),
5707
+ o.sensitive && /* @__PURE__ */ jsx34("div", { className: "lace-mcp__output-sensitive", children: "sensitive" })
5675
5708
  ] }, o.name)) }),
5676
5709
  config.module_key && /* @__PURE__ */ jsxs22(Fragment13, { children: [
5677
5710
  /* @__PURE__ */ jsxs22("div", { className: "lace-mcp__module-heading", children: [
5678
- /* @__PURE__ */ jsx33("div", { className: "lace-mcp__title-eyebrow", children: "Called module" }),
5711
+ /* @__PURE__ */ jsx34("div", { className: "lace-mcp__title-eyebrow", children: "Called module" }),
5679
5712
  /* @__PURE__ */ jsxs22("div", { children: [
5680
- /* @__PURE__ */ jsx33(Identifier, { text: config.module_key }),
5713
+ /* @__PURE__ */ jsx34(Identifier, { text: config.module_key }),
5681
5714
  config.source && /* @__PURE__ */ jsxs22("span", { className: "lace-mcp__module-source", children: [
5682
5715
  " \xB7 ",
5683
- /* @__PURE__ */ jsx33(Identifier, { text: config.source })
5716
+ /* @__PURE__ */ jsx34(Identifier, { text: config.source })
5684
5717
  ] })
5685
5718
  ] })
5686
5719
  ] }),
5687
- /* @__PURE__ */ jsx33(ModuleDetails, { moduleKey: config.module_key }, config.module_key)
5720
+ /* @__PURE__ */ jsx34(ModuleDetails, { moduleKey: config.module_key }, config.module_key)
5688
5721
  ] })
5689
5722
  ] });
5690
5723
  }
@@ -5710,11 +5743,11 @@ var moduleConfigPanel = {
5710
5743
  };
5711
5744
 
5712
5745
  // src/core/panels/SourceRefusedBanner.tsx
5713
- import { jsx as jsx34 } from "react/jsx-runtime";
5746
+ import { jsx as jsx35 } from "react/jsx-runtime";
5714
5747
  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.";
5715
5748
  var OUT_OF_LACE_SHAPE = "This Terraform is not in lace shape yet, so the canvas shows it read-only.";
5716
5749
  function SourceRefusedBanner({ ctx }) {
5717
- return /* @__PURE__ */ jsx34(
5750
+ return /* @__PURE__ */ jsx35(
5718
5751
  RowActionBanner,
5719
5752
  {
5720
5753
  ctx,
@@ -5741,10 +5774,10 @@ import { createElement as createElement3 } from "react";
5741
5774
  // src/components/panels/UnifiedSettingsPanel.tsx
5742
5775
  import { Panel as Panel7 } from "@lace-cloud/ui";
5743
5776
  import "./panels-shared-3HUQC7TC.css";
5744
- import { jsx as jsx35 } from "react/jsx-runtime";
5777
+ import { jsx as jsx36 } from "react/jsx-runtime";
5745
5778
  function UnifiedSettingsPanel({ onClose }) {
5746
5779
  const { bundle } = useCanvas();
5747
- return /* @__PURE__ */ jsx35(Panel7, { title: "Settings", flush: true, onClose, children: /* @__PURE__ */ jsx35(ModuleDetails, { moduleKey: bundle.entry, open: ["Interface"] }, bundle.entry) });
5780
+ return /* @__PURE__ */ jsx36(Panel7, { title: "Settings", flush: true, onClose, children: /* @__PURE__ */ jsx36(ModuleDetails, { moduleKey: bundle.entry, open: ["Interface"] }, bundle.entry) });
5748
5781
  }
5749
5782
 
5750
5783
  // src/core/panels/settings.ts
@@ -5801,7 +5834,7 @@ var CORE_CONTRIBUTIONS = {
5801
5834
  };
5802
5835
 
5803
5836
  // src/App.tsx
5804
- import { jsx as jsx36, jsxs as jsxs23 } from "react/jsx-runtime";
5837
+ import { jsx as jsx37, jsxs as jsxs23 } from "react/jsx-runtime";
5805
5838
  var EMPTY_CONTRIBUTIONS = { overlays: [], panels: [], actions: [] };
5806
5839
  var NO_TARGET = {};
5807
5840
  function OverlayRunner({
@@ -5811,7 +5844,7 @@ function OverlayRunner({
5811
5844
  onDecorations
5812
5845
  }) {
5813
5846
  const lastErrorRef = useRef12(/* @__PURE__ */ new Map());
5814
- const onReadError = useCallback10(
5847
+ const onReadError = useCallback11(
5815
5848
  (path, error) => {
5816
5849
  const next = error?.message ?? null;
5817
5850
  if (lastErrorRef.current.get(path) === next) return;
@@ -5820,7 +5853,7 @@ function OverlayRunner({
5820
5853
  },
5821
5854
  [ctx.ports.presenter]
5822
5855
  );
5823
- return /* @__PURE__ */ jsx36(PanelScope, { ctx, paths: overlay.paths, tick, onReadError, children: /* @__PURE__ */ jsx36(OverlayDecorations, { overlay, ctx, onDecorations }) });
5856
+ return /* @__PURE__ */ jsx37(PanelScope, { ctx, paths: overlay.paths, tick, onReadError, children: /* @__PURE__ */ jsx37(OverlayDecorations, { overlay, ctx, onDecorations }) });
5824
5857
  }
5825
5858
  function OverlayDecorations({
5826
5859
  overlay,
@@ -5836,7 +5869,7 @@ function OverlayDecorations({
5836
5869
  }
5837
5870
  function PanelSlot({ panel, ctx, tick }) {
5838
5871
  const [readErrors, setReadErrors] = useState17(/* @__PURE__ */ new Map());
5839
- const onReadError = useCallback10((path, error) => {
5872
+ const onReadError = useCallback11((path, error) => {
5840
5873
  setReadErrors((prev) => {
5841
5874
  if (error === null) {
5842
5875
  if (!prev.has(path)) return prev;
@@ -5863,7 +5896,7 @@ function PanelSlot({ panel, ctx, tick }) {
5863
5896
  ": ",
5864
5897
  error.message
5865
5898
  ] }, path)),
5866
- /* @__PURE__ */ jsx36(panel.Component, { ctx })
5899
+ /* @__PURE__ */ jsx37(panel.Component, { ctx })
5867
5900
  ]
5868
5901
  }
5869
5902
  );
@@ -5878,7 +5911,7 @@ function BottomTabs({
5878
5911
  const active = manual ?? panels[0] ?? null;
5879
5912
  if (panels.length === 0) return null;
5880
5913
  return /* @__PURE__ */ jsxs23("div", { className: "lace-app__bottom", children: [
5881
- /* @__PURE__ */ jsx36("div", { className: "lace-app__bottom-tabs", role: "tablist", children: panels.map((panel) => /* @__PURE__ */ jsx36(
5914
+ /* @__PURE__ */ jsx37("div", { className: "lace-app__bottom-tabs", role: "tablist", children: panels.map((panel) => /* @__PURE__ */ jsx37(
5882
5915
  "button",
5883
5916
  {
5884
5917
  type: "button",
@@ -5890,7 +5923,7 @@ function BottomTabs({
5890
5923
  },
5891
5924
  panel.id
5892
5925
  )) }),
5893
- /* @__PURE__ */ jsx36("div", { className: "lace-app__bottom-content", children: active && /* @__PURE__ */ jsx36(PanelSlot, { panel: active, ctx, tick }) })
5926
+ /* @__PURE__ */ jsx37("div", { className: "lace-app__bottom-content", children: active && /* @__PURE__ */ jsx37(PanelSlot, { panel: active, ctx, tick }) })
5894
5927
  ] });
5895
5928
  }
5896
5929
  function endMessage(end) {
@@ -5902,8 +5935,8 @@ function App({
5902
5935
  height = "100vh",
5903
5936
  results: hostResults
5904
5937
  }) {
5905
- const results = useMemo10(() => hostResults ?? createResultStore(), [hostResults]);
5906
- const writeReport = useCallback10(
5938
+ const results = useMemo12(() => hostResults ?? createResultStore(), [hostResults]);
5939
+ const writeReport = useCallback11(
5907
5940
  (result, session2) => {
5908
5941
  try {
5909
5942
  results.write("report", session2, result, { stack: void 0 });
@@ -5914,13 +5947,13 @@ function App({
5914
5947
  },
5915
5948
  [results, ports.presenter]
5916
5949
  );
5917
- const dropReport = useCallback10((session2) => results.detach("report", session2), [results]);
5950
+ const dropReport = useCallback11((session2) => results.detach("report", session2), [results]);
5918
5951
  const { source, end, session } = useCanvasSource(ports.source, writeReport, dropReport);
5919
5952
  const [arrangement, setArrangement] = useState17(() => ports.viewState.load());
5920
5953
  const stack = ports.context.stack;
5921
5954
  const [selection, setSelection] = useState17(NO_SELECTION);
5922
5955
  const [settingsOpen, setSettingsOpen] = useState17(false);
5923
- const select = useCallback10((next) => {
5956
+ const select = useCallback11((next) => {
5924
5957
  setSelection(next);
5925
5958
  if (next.nodes.length > 0 || next.edges.length > 0) setSettingsOpen(false);
5926
5959
  }, []);
@@ -5929,7 +5962,7 @@ function App({
5929
5962
  const layoutRef = useRef12({ panIntoView: () => {
5930
5963
  } });
5931
5964
  const { commands, presenter, editor } = ports;
5932
- const runner = useMemo10(
5965
+ const runner = useMemo12(
5933
5966
  () => createActionRunner({ commands, presenter, editor }, results, {
5934
5967
  onPendingFormChange: setPendingForm
5935
5968
  }),
@@ -5941,7 +5974,8 @@ function App({
5941
5974
  };
5942
5975
  }, [runner]);
5943
5976
  const tick = useSyncExternalStore(results.subscribe, results.getTick);
5944
- const updateArrangement = useCallback10(
5977
+ const editing = useSyncExternalStore(runner.onEditingChange, runner.editing);
5978
+ const updateArrangement = useCallback11(
5945
5979
  (next) => {
5946
5980
  setArrangement(next);
5947
5981
  ports.viewState.save(next);
@@ -5959,7 +5993,7 @@ function App({
5959
5993
  });
5960
5994
  }
5961
5995
  }
5962
- const view = useMemo10(
5996
+ const view = useMemo12(
5963
5997
  () => source ? projectFrame(source, arrangement) : null,
5964
5998
  [source, arrangement]
5965
5999
  );
@@ -5970,7 +6004,7 @@ function App({
5970
6004
  setSelection((current) => reconcileSelection(view, current));
5971
6005
  }, [source, view]);
5972
6006
  const editable = ports.editor !== void 0 && !source?.sourceRefused;
5973
- const merged = useMemo10(
6007
+ const merged = useMemo12(
5974
6008
  () => ({
5975
6009
  overlays: [...CORE_CONTRIBUTIONS.overlays, ...contributions.overlays],
5976
6010
  panels: [...CORE_CONTRIBUTIONS.panels, ...contributions.panels],
@@ -5980,15 +6014,15 @@ function App({
5980
6014
  );
5981
6015
  const resultSlots = useSyncExternalStore(results.subscribe, results.getSnapshot);
5982
6016
  const stackId = stack?.id;
5983
- const live = useMemo10(
6017
+ const live = useMemo12(
5984
6018
  () => source && session ? liveSlots(resultSlots, { session, treeHash: source.treeHash, stack: stackId }) : null,
5985
6019
  [resultSlots, source, session, stackId]
5986
6020
  );
5987
- const diagnostics = useMemo10(
6021
+ const diagnostics = useMemo12(
5988
6022
  () => source && live ? diagnosticsOf(source.diagnostics, live.report ? reportDiagnostics(live.report) : []) : [],
5989
6023
  [source, live]
5990
6024
  );
5991
- const ctx = useMemo10(() => {
6025
+ const ctx = useMemo12(() => {
5992
6026
  if (!source || !view) return null;
5993
6027
  return {
5994
6028
  ports,
@@ -6005,11 +6039,11 @@ function App({
6005
6039
  contributions: merged
6006
6040
  };
6007
6041
  }, [ports, source, view, stack, selection, settingsOpen, merged, diagnostics, editable]);
6008
- const resolved = useMemo10(() => {
6042
+ const resolved = useMemo12(() => {
6009
6043
  if (!ctx) return EMPTY_CONTRIBUTIONS;
6010
6044
  return resolveContributions(merged, ports, ctx, NO_TARGET);
6011
6045
  }, [merged, ports, ctx]);
6012
- const setOverlayDecoration = useCallback10((id, next) => {
6046
+ const setOverlayDecoration = useCallback11((id, next) => {
6013
6047
  setOverlayDecorations((prev) => {
6014
6048
  if (next === null) {
6015
6049
  if (!(id in prev)) return prev;
@@ -6019,11 +6053,11 @@ function App({
6019
6053
  return prev[id] === next ? prev : { ...prev, [id]: next };
6020
6054
  });
6021
6055
  }, []);
6022
- const decorations = useMemo10(() => {
6056
+ const decorations = useMemo12(() => {
6023
6057
  if (!view || !source) return { nodes: {} };
6024
6058
  return decorate(view, Object.values(overlayDecorations), diagnostics);
6025
6059
  }, [view, source, overlayDecorations, diagnostics]);
6026
- const envExtras = useMemo10(() => {
6060
+ const envExtras = useMemo12(() => {
6027
6061
  if (!source) return null;
6028
6062
  return {
6029
6063
  bundle: source.bundle,
@@ -6044,7 +6078,7 @@ function App({
6044
6078
  useFocusWhenNoneHeld(rootRef, Boolean(ctx && view && source && envExtras));
6045
6079
  useActionKeys(ctx && envExtras ? resolved.actions : [], ctx, runner, envExtras);
6046
6080
  if (!ctx || !view || !source || !envExtras) {
6047
- return end ? /* @__PURE__ */ jsx36(ErrorState, { message: endMessage(end) }) : null;
6081
+ return end ? /* @__PURE__ */ jsx37(ErrorState, { message: endMessage(end) }) : null;
6048
6082
  }
6049
6083
  const contextValue = {
6050
6084
  ports,
@@ -6058,6 +6092,7 @@ function App({
6058
6092
  selection,
6059
6093
  setSelection: select,
6060
6094
  runner,
6095
+ editing,
6061
6096
  layout: layoutRef.current,
6062
6097
  setSettingsOpen
6063
6098
  };
@@ -6065,7 +6100,7 @@ function App({
6065
6100
  const bottomPanels = resolved.panels.filter((panel) => panel.slot === "bottom");
6066
6101
  const drawerPanel = resolved.panels.find((panel) => panel.slot === "drawer");
6067
6102
  return /* @__PURE__ */ jsxs23(ErrorBoundary, { children: [
6068
- resolved.overlays.map((overlay) => /* @__PURE__ */ jsx36(
6103
+ resolved.overlays.map((overlay) => /* @__PURE__ */ jsx37(
6069
6104
  OverlayRunner,
6070
6105
  {
6071
6106
  overlay,
@@ -6075,15 +6110,15 @@ function App({
6075
6110
  },
6076
6111
  overlay.id
6077
6112
  )),
6078
- /* @__PURE__ */ jsx36(CanvasContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs23("div", { ref: rootRef, className: "lace-app", style: { height }, tabIndex: -1, children: [
6113
+ /* @__PURE__ */ jsx37(CanvasContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs23("div", { ref: rootRef, className: "lace-app", style: { height }, tabIndex: -1, children: [
6079
6114
  (toolbar.sections.length > 0 || toolbar.trailing.length > 0) && /* @__PURE__ */ jsxs23("div", { className: "lace-app__toolbar", children: [
6080
6115
  toolbar.sections.map((section, index) => /* @__PURE__ */ jsxs23(Fragment14, { children: [
6081
- index > 0 ? /* @__PURE__ */ jsx36("span", { className: "lace-app__toolbar-separator", "aria-hidden": "true" }) : null,
6116
+ index > 0 ? /* @__PURE__ */ jsx37("span", { className: "lace-app__toolbar-separator", "aria-hidden": "true" }) : null,
6082
6117
  /* @__PURE__ */ jsxs23("div", { className: "lace-app__toolbar-section", children: [
6083
6118
  section.actions.map((action) => (
6084
6119
  // `runner.busy` reads the store, whose every write
6085
6120
  // re-renders App (`resultSlots`).
6086
- /* @__PURE__ */ jsx36(
6121
+ /* @__PURE__ */ jsx37(
6087
6122
  ToolbarAction,
6088
6123
  {
6089
6124
  action,
@@ -6094,20 +6129,20 @@ function App({
6094
6129
  action.id
6095
6130
  )
6096
6131
  )),
6097
- section.panels.map((panel) => /* @__PURE__ */ jsx36(PanelSlot, { panel, ctx, tick }, panel.id))
6132
+ section.panels.map((panel) => /* @__PURE__ */ jsx37(PanelSlot, { panel, ctx, tick }, panel.id))
6098
6133
  ] })
6099
6134
  ] }, section.key ?? "")),
6100
- toolbar.trailing.length > 0 && /* @__PURE__ */ jsx36("div", { className: "lace-app__toolbar-end", children: toolbar.trailing.map((panel) => /* @__PURE__ */ jsx36(PanelSlot, { panel, ctx, tick }, panel.id)) })
6135
+ toolbar.trailing.length > 0 && /* @__PURE__ */ jsx37("div", { className: "lace-app__toolbar-end", children: toolbar.trailing.map((panel) => /* @__PURE__ */ jsx37(PanelSlot, { panel, ctx, tick }, panel.id)) })
6101
6136
  ] }),
6102
- /* @__PURE__ */ jsx36("div", { className: "lace-app__banners", children: bannerPanels.map((panel) => /* @__PURE__ */ jsx36(PanelSlot, { panel, ctx, tick }, panel.id)) }),
6137
+ /* @__PURE__ */ jsx37("div", { className: "lace-app__banners", children: bannerPanels.map((panel) => /* @__PURE__ */ jsx37(PanelSlot, { panel, ctx, tick }, panel.id)) }),
6103
6138
  /* @__PURE__ */ jsxs23("div", { className: "lace-app__body", children: [
6104
6139
  /* @__PURE__ */ jsxs23("div", { className: "lace-app__main", children: [
6105
- /* @__PURE__ */ jsx36("div", { className: "lace-app__canvas", children: /* @__PURE__ */ jsx36(ReactFlowProvider, { children: /* @__PURE__ */ jsx36(Canvas, { height: "100%" }) }) }),
6106
- /* @__PURE__ */ jsx36(BottomTabs, { panels: bottomPanels, ctx, tick })
6140
+ /* @__PURE__ */ jsx37("div", { className: "lace-app__canvas", children: /* @__PURE__ */ jsx37(ReactFlowProvider, { children: /* @__PURE__ */ jsx37(Canvas, { height: "100%" }) }) }),
6141
+ /* @__PURE__ */ jsx37(BottomTabs, { panels: bottomPanels, ctx, tick })
6107
6142
  ] }),
6108
- drawerPanel && /* @__PURE__ */ jsx36(Drawer, { label: drawerPanel.title, children: /* @__PURE__ */ jsx36(PanelSlot, { panel: drawerPanel, ctx, tick }, drawerPanel.id) })
6143
+ drawerPanel && /* @__PURE__ */ jsx37(Drawer, { label: drawerPanel.title, children: /* @__PURE__ */ jsx37(PanelSlot, { panel: drawerPanel, ctx, tick }, drawerPanel.id) })
6109
6144
  ] }),
6110
- /* @__PURE__ */ jsx36(CommandArgsForm, { form: pendingForm })
6145
+ /* @__PURE__ */ jsx37(CommandArgsForm, { form: pendingForm })
6111
6146
  ] }) })
6112
6147
  ] });
6113
6148
  }
@@ -6213,6 +6248,7 @@ export {
6213
6248
  answering,
6214
6249
  bridgeCaller,
6215
6250
  carriesFailure,
6251
+ commandPathOf,
6216
6252
  commandUnderWay,
6217
6253
  conflictPanel,
6218
6254
  connectCaller,