@lace-cloud/proto 0.36.0 → 0.37.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -149,6 +149,8 @@ type RenderEdge$1 = {
149
149
  target: string;
150
150
  source_output: string;
151
151
  target_input: string;
152
+ source_pin?: boolean;
153
+ target_pin?: boolean;
152
154
  };
153
155
  type RenderInput = {
154
156
  name: string;
@@ -324,7 +326,7 @@ declare enum Reason {
324
326
  /** REASON_CONFLICT - Generate: the tree moved under the session's base; Keep or Reload first. */
325
327
  REASON_CONFLICT = 6,
326
328
  /**
327
- * REASON_SOURCE_REFUSED - Every mutation, save and generate: the session's source tf is refused
329
+ * REASON_SOURCE_REFUSED - Every mutation, save, discard and generate: the session's source tf is refused
328
330
  * (`BundleState.source_refused`).
329
331
  * module convert and module import: the tree's tf does not parse, has a
330
332
  * non-empty residual report, or its Bundle fails its own validation.
@@ -415,6 +417,16 @@ declare enum Reason {
415
417
  * `.terraform.lock.hcl`; `lace module lock` writes it.
416
418
  */
417
419
  REASON_NO_LOCKFILE = 22,
420
+ /** REASON_NO_COMMIT - stack create --source: the directory's repository has no commit yet. */
421
+ REASON_NO_COMMIT = 23,
422
+ /**
423
+ * REASON_STALE_WORKING_STATE - Discard and Restore: the session's working IR is no longer the one the
424
+ * caller showed the developer (`BundleState.working_digest`) -- another
425
+ * holder edited, undid or redid since. Restore also: the saved IR or source
426
+ * tree is no longer the one the backup was captured against. Nothing was
427
+ * discarded or restored; re-read the state and ask again.
428
+ */
429
+ REASON_STALE_WORKING_STATE = 24,
418
430
  UNRECOGNIZED = -1
419
431
  }
420
432
 
@@ -1033,6 +1045,7 @@ declare function splitPath(canvasPath: string): {
1033
1045
  localId: string;
1034
1046
  };
1035
1047
  declare function callText(sourcePath: string): string;
1048
+ declare function groupPinText(group: string, end: 'source' | 'target', pin: string): string;
1036
1049
 
1037
1050
  type ParsedModuleKey = {
1038
1051
  id: string;
@@ -1062,5 +1075,5 @@ declare function resolveScopePath(bundle: Bundle, path: string): string | null;
1062
1075
 
1063
1076
  declare const CanvasViewProto: MessageFns<CanvasView>;
1064
1077
 
1065
- export { BRIDGE_METHODS, Bundle, COLLAPSED_GROUP_WIDTH, CONNECT_CODE_NAMES, CanvasViewProto, EMPTY_BUNDLE, ENGINE_CONTRACT, ENGINE_METHODS, ENGINE_PROTOCOL_VERSION, ENGINE_STREAM_METHODS, EngineIdentityMismatchError, GROUP_HEADER_HEIGHT, GROUP_PADDING, HOST_ONLY_METHODS, META_ARGUMENTS, NODE_HEADER_HEIGHT, NODE_ROW_HEIGHT, NODE_WIDTH, apiFields, boxAt, callText, checkEngineIdentity, collapsedGroupSize, convertDiagnostic, deriveNodeConfig, deriveSettingsConfig, drawnAt, drawnRect, extentOf, frameOf, freeSlot, groupBoxSize, groupFootprint, groupInputPinY, groupPinY, groupPins, groupReach, inputPinY, instanceAddress, joinPath, keepOrder, layoutByDepth, localIn, nodeIdForAddress, nodeIdForDiagnostic, nodeRows, nodeSize, originAt, parseModuleKey, projectCanvasView, reachRect, resolveInstance, resolveScopePath, resolveScopePositionsByDepth, splitPath, stepDown, visibleInputs };
1078
+ export { BRIDGE_METHODS, Bundle, COLLAPSED_GROUP_WIDTH, CONNECT_CODE_NAMES, CanvasViewProto, EMPTY_BUNDLE, ENGINE_CONTRACT, ENGINE_METHODS, ENGINE_PROTOCOL_VERSION, ENGINE_STREAM_METHODS, EngineIdentityMismatchError, GROUP_HEADER_HEIGHT, GROUP_PADDING, HOST_ONLY_METHODS, META_ARGUMENTS, NODE_HEADER_HEIGHT, NODE_ROW_HEIGHT, NODE_WIDTH, apiFields, boxAt, callText, checkEngineIdentity, collapsedGroupSize, convertDiagnostic, deriveNodeConfig, deriveSettingsConfig, drawnAt, drawnRect, extentOf, frameOf, freeSlot, groupBoxSize, groupFootprint, groupInputPinY, groupPinText, groupPinY, groupPins, groupReach, inputPinY, instanceAddress, joinPath, keepOrder, layoutByDepth, localIn, nodeIdForAddress, nodeIdForDiagnostic, nodeRows, nodeSize, originAt, parseModuleKey, projectCanvasView, reachRect, resolveInstance, resolveScopePath, resolveScopePositionsByDepth, splitPath, stepDown, visibleInputs };
1066
1079
  export type { BlockConfig, BridgeMethod, BridgeRequest, BridgeResponse, CanvasArrangement, CanvasView$1 as CanvasView, Conflict, DeepPartial$1 as DeepPartial, Diagnostic, EngineIdentity, EngineMethod, EngineStreamMethod, HostOnlyMethod, InstanceAddress, InstanceChild, KeepKey, LayoutEdge, LayoutItem, MessageBridge, MetaArgument, NodeConfig, NodePin$1 as NodePin, ParsedModuleKey, ProjectionMeta, ProtoDiagnosticLike, Rect, RenderEdge$1 as RenderEdge, RenderGroup$1 as RenderGroup, RenderInput, RenderNode$1 as RenderNode, RenderOutput, ResourceConfig, ScopedInstance, SettingsConfig, Size, ViewportIntent, XY };
package/dist/index.d.ts CHANGED
@@ -149,6 +149,8 @@ type RenderEdge$1 = {
149
149
  target: string;
150
150
  source_output: string;
151
151
  target_input: string;
152
+ source_pin?: boolean;
153
+ target_pin?: boolean;
152
154
  };
153
155
  type RenderInput = {
154
156
  name: string;
@@ -324,7 +326,7 @@ declare enum Reason {
324
326
  /** REASON_CONFLICT - Generate: the tree moved under the session's base; Keep or Reload first. */
325
327
  REASON_CONFLICT = 6,
326
328
  /**
327
- * REASON_SOURCE_REFUSED - Every mutation, save and generate: the session's source tf is refused
329
+ * REASON_SOURCE_REFUSED - Every mutation, save, discard and generate: the session's source tf is refused
328
330
  * (`BundleState.source_refused`).
329
331
  * module convert and module import: the tree's tf does not parse, has a
330
332
  * non-empty residual report, or its Bundle fails its own validation.
@@ -415,6 +417,16 @@ declare enum Reason {
415
417
  * `.terraform.lock.hcl`; `lace module lock` writes it.
416
418
  */
417
419
  REASON_NO_LOCKFILE = 22,
420
+ /** REASON_NO_COMMIT - stack create --source: the directory's repository has no commit yet. */
421
+ REASON_NO_COMMIT = 23,
422
+ /**
423
+ * REASON_STALE_WORKING_STATE - Discard and Restore: the session's working IR is no longer the one the
424
+ * caller showed the developer (`BundleState.working_digest`) -- another
425
+ * holder edited, undid or redid since. Restore also: the saved IR or source
426
+ * tree is no longer the one the backup was captured against. Nothing was
427
+ * discarded or restored; re-read the state and ask again.
428
+ */
429
+ REASON_STALE_WORKING_STATE = 24,
418
430
  UNRECOGNIZED = -1
419
431
  }
420
432
 
@@ -1033,6 +1045,7 @@ declare function splitPath(canvasPath: string): {
1033
1045
  localId: string;
1034
1046
  };
1035
1047
  declare function callText(sourcePath: string): string;
1048
+ declare function groupPinText(group: string, end: 'source' | 'target', pin: string): string;
1036
1049
 
1037
1050
  type ParsedModuleKey = {
1038
1051
  id: string;
@@ -1062,5 +1075,5 @@ declare function resolveScopePath(bundle: Bundle, path: string): string | null;
1062
1075
 
1063
1076
  declare const CanvasViewProto: MessageFns<CanvasView>;
1064
1077
 
1065
- export { BRIDGE_METHODS, Bundle, COLLAPSED_GROUP_WIDTH, CONNECT_CODE_NAMES, CanvasViewProto, EMPTY_BUNDLE, ENGINE_CONTRACT, ENGINE_METHODS, ENGINE_PROTOCOL_VERSION, ENGINE_STREAM_METHODS, EngineIdentityMismatchError, GROUP_HEADER_HEIGHT, GROUP_PADDING, HOST_ONLY_METHODS, META_ARGUMENTS, NODE_HEADER_HEIGHT, NODE_ROW_HEIGHT, NODE_WIDTH, apiFields, boxAt, callText, checkEngineIdentity, collapsedGroupSize, convertDiagnostic, deriveNodeConfig, deriveSettingsConfig, drawnAt, drawnRect, extentOf, frameOf, freeSlot, groupBoxSize, groupFootprint, groupInputPinY, groupPinY, groupPins, groupReach, inputPinY, instanceAddress, joinPath, keepOrder, layoutByDepth, localIn, nodeIdForAddress, nodeIdForDiagnostic, nodeRows, nodeSize, originAt, parseModuleKey, projectCanvasView, reachRect, resolveInstance, resolveScopePath, resolveScopePositionsByDepth, splitPath, stepDown, visibleInputs };
1078
+ export { BRIDGE_METHODS, Bundle, COLLAPSED_GROUP_WIDTH, CONNECT_CODE_NAMES, CanvasViewProto, EMPTY_BUNDLE, ENGINE_CONTRACT, ENGINE_METHODS, ENGINE_PROTOCOL_VERSION, ENGINE_STREAM_METHODS, EngineIdentityMismatchError, GROUP_HEADER_HEIGHT, GROUP_PADDING, HOST_ONLY_METHODS, META_ARGUMENTS, NODE_HEADER_HEIGHT, NODE_ROW_HEIGHT, NODE_WIDTH, apiFields, boxAt, callText, checkEngineIdentity, collapsedGroupSize, convertDiagnostic, deriveNodeConfig, deriveSettingsConfig, drawnAt, drawnRect, extentOf, frameOf, freeSlot, groupBoxSize, groupFootprint, groupInputPinY, groupPinText, groupPinY, groupPins, groupReach, inputPinY, instanceAddress, joinPath, keepOrder, layoutByDepth, localIn, nodeIdForAddress, nodeIdForDiagnostic, nodeRows, nodeSize, originAt, parseModuleKey, projectCanvasView, reachRect, resolveInstance, resolveScopePath, resolveScopePositionsByDepth, splitPath, stepDown, visibleInputs };
1066
1079
  export type { BlockConfig, BridgeMethod, BridgeRequest, BridgeResponse, CanvasArrangement, CanvasView$1 as CanvasView, Conflict, DeepPartial$1 as DeepPartial, Diagnostic, EngineIdentity, EngineMethod, EngineStreamMethod, HostOnlyMethod, InstanceAddress, InstanceChild, KeepKey, LayoutEdge, LayoutItem, MessageBridge, MetaArgument, NodeConfig, NodePin$1 as NodePin, ParsedModuleKey, ProjectionMeta, ProtoDiagnosticLike, Rect, RenderEdge$1 as RenderEdge, RenderGroup$1 as RenderGroup, RenderInput, RenderNode$1 as RenderNode, RenderOutput, ResourceConfig, ScopedInstance, SettingsConfig, Size, ViewportIntent, XY };
package/dist/index.mjs CHANGED
@@ -72,7 +72,7 @@ var CONNECT_CODE_NAMES = [
72
72
  ];
73
73
 
74
74
  // src/engine-contract.gen.ts
75
- var GENERATED_ENGINE_CONTRACT = "d4f8d2cadfe5474a806c09f6b35ec43b0d1e4ae752426ac0469489053094765e";
75
+ var GENERATED_ENGINE_CONTRACT = "109ee79179d90a6e2f31f1d52f9221f7f05b105afb6477c45507f2b969d8cc30";
76
76
 
77
77
  // src/generated/service.ts
78
78
  import { BinaryReader as BinaryReader3, BinaryWriter as BinaryWriter3 } from "@bufbuild/protobuf/wire";
@@ -4099,7 +4099,7 @@ function isSet3(value) {
4099
4099
  }
4100
4100
 
4101
4101
  // src/engine-identity.ts
4102
- var ENGINE_PROTOCOL_VERSION = String(9 /* PROTOCOL_VERSION_CURRENT */);
4102
+ var ENGINE_PROTOCOL_VERSION = String(11 /* PROTOCOL_VERSION_CURRENT */);
4103
4103
  var ENGINE_CONTRACT = GENERATED_ENGINE_CONTRACT;
4104
4104
  var EngineIdentityMismatchError = class extends Error {
4105
4105
  constructor(engine, required) {
@@ -4137,6 +4137,15 @@ function checkEngineIdentity(engine) {
4137
4137
  // src/render.ts
4138
4138
  var META_ARGUMENTS = ["count", "for_each"];
4139
4139
 
4140
+ // src/projection/classify-child.ts
4141
+ function isGroupUse(bundle, use) {
4142
+ const target = bundle.modules[use.module];
4143
+ return target !== void 0 && isGroupModule(target);
4144
+ }
4145
+ function isGroupModule(mod) {
4146
+ return (mod.modules?.length ?? 0) > 0;
4147
+ }
4148
+
4140
4149
  // src/projection/derive-edges.ts
4141
4150
  function emitEdgesFromBinding(binding, targetId, toInput, useIds, seen, edges) {
4142
4151
  if (binding.out?.module && binding.out.name) {
@@ -4178,17 +4187,72 @@ function deriveEdges(uses) {
4178
4187
  }
4179
4188
  return edges;
4180
4189
  }
4190
+ function addPin(index, call, pin) {
4191
+ if (!index.has(call)) index.set(call, /* @__PURE__ */ new Set());
4192
+ index.get(call).add(pin);
4193
+ }
4181
4194
  function indexWires(edges) {
4182
4195
  const inputs = /* @__PURE__ */ new Map();
4183
4196
  const outputs = /* @__PURE__ */ new Map();
4184
4197
  for (const e of edges) {
4185
- if (!inputs.has(e.target_instance)) inputs.set(e.target_instance, /* @__PURE__ */ new Set());
4186
- inputs.get(e.target_instance).add(e.to_input);
4187
- if (!outputs.has(e.source_instance)) outputs.set(e.source_instance, /* @__PURE__ */ new Set());
4188
- outputs.get(e.source_instance).add(e.from_output);
4198
+ addPin(inputs, e.target_instance, e.to_input);
4199
+ addPin(outputs, e.source_instance, e.from_output);
4189
4200
  }
4190
4201
  return { inputs, outputs };
4191
4202
  }
4203
+ function deriveInterfaceEdges(mod) {
4204
+ const uses = mod.modules ?? [];
4205
+ const useIds = new Set(uses.map((u) => u.id));
4206
+ const declaredIn = new Set((mod.interface?.inputs ?? []).map((i) => i.name));
4207
+ const declaredOut = new Set((mod.interface?.outputs ?? []).map((o) => o.name));
4208
+ const edges = [];
4209
+ const fromInput = (pin, target, toInput) => {
4210
+ if (!pin || !declaredIn.has(pin)) return;
4211
+ edges.push({
4212
+ source_instance: "",
4213
+ target_instance: target,
4214
+ from_output: pin,
4215
+ to_input: toInput,
4216
+ source_pin: true
4217
+ });
4218
+ };
4219
+ for (const use of uses) {
4220
+ for (const [name, binding] of Object.entries(use.inputs ?? {})) {
4221
+ fromInput(binding.var ?? "", use.id, name);
4222
+ }
4223
+ for (const meta of META_ARGUMENTS) fromInput(use[meta]?.var ?? "", use.id, meta);
4224
+ }
4225
+ const seen = /* @__PURE__ */ new Set();
4226
+ for (const [name, exported] of Object.entries(mod.exports?.outputs ?? {})) {
4227
+ if (!declaredOut.has(name)) continue;
4228
+ const read = [];
4229
+ emitEdgesFromBinding(exported, "", name, useIds, seen, read);
4230
+ for (const edge of read) {
4231
+ if (useIds.has(edge.source_instance)) edges.push({ ...edge, target_pin: true });
4232
+ }
4233
+ if (exported.var && declaredIn.has(exported.var)) {
4234
+ edges.push({
4235
+ source_instance: "",
4236
+ target_instance: "",
4237
+ from_output: exported.var,
4238
+ to_input: name,
4239
+ source_pin: true,
4240
+ target_pin: true
4241
+ });
4242
+ }
4243
+ }
4244
+ return edges;
4245
+ }
4246
+ function scopeWires(mod, entry) {
4247
+ const derived = deriveEdges(mod.modules ?? []);
4248
+ const interfaceEdges = !entry && isGroupModule(mod) ? deriveInterfaceEdges(mod) : [];
4249
+ const { inputs, outputs } = indexWires(derived);
4250
+ for (const e of interfaceEdges) {
4251
+ if (!e.target_pin) addPin(inputs, e.target_instance, e.to_input);
4252
+ if (!e.source_pin) addPin(outputs, e.source_instance, e.from_output);
4253
+ }
4254
+ return { derived, interfaceEdges, inputs, outputs };
4255
+ }
4192
4256
  function callWires(wiredIn, wiredOut) {
4193
4257
  return {
4194
4258
  call_wired: wiredOut.has(""),
@@ -4321,7 +4385,7 @@ function deriveNodeConfig(bundle, instanceId) {
4321
4385
  const resolved = resolveInstance(bundle, instanceId);
4322
4386
  if (!resolved) return null;
4323
4387
  const { scope, child } = resolved;
4324
- const readOutputs = indexWires(deriveEdges(scope.modules ?? [])).outputs.get(child.id) ?? [];
4388
+ const readOutputs = scopeWires(scope, resolved.scopeKey === bundle.entry).outputs.get(child.id) ?? [];
4325
4389
  const schema = child.use ? resolveSchema(bundle, child.use, readOutputs) : { inputs: [], outputs: [] };
4326
4390
  const schemaInputs = schema.inputs;
4327
4391
  const schemaOutputs = schema.outputs;
@@ -4477,7 +4541,7 @@ function deriveSettingsConfig(bundle, moduleKey) {
4477
4541
  sensitive: o.sensitive || void 0,
4478
4542
  depends_on: o.depends_on
4479
4543
  }));
4480
- const read = indexWires(deriveEdges(mod.modules ?? [])).outputs;
4544
+ const read = scopeWires(mod, moduleKey === bundle.entry).outputs;
4481
4545
  const callOutputs = (mod.modules ?? []).flatMap(
4482
4546
  (use) => resolveSchema(bundle, use, read.get(use.id) ?? []).outputs.map(
4483
4547
  (o) => `module.${use.id}.${o.name}`
@@ -4516,6 +4580,9 @@ function splitPath(canvasPath) {
4516
4580
  function callText(sourcePath) {
4517
4581
  return `module.${splitPath(sourcePath).localId}`;
4518
4582
  }
4583
+ function groupPinText(group, end, pin) {
4584
+ return `${group}.${end === "source" ? "inputs" : "outputs"}.${pin}`;
4585
+ }
4519
4586
 
4520
4587
  // src/projection/node-for-address.ts
4521
4588
  var INSTANCE_KEY = /\[[^\]]*\]$/;
@@ -4686,13 +4753,6 @@ function parseModuleKey(key) {
4686
4753
  return { id: key.slice(0, at), version: key.slice(at + 1) };
4687
4754
  }
4688
4755
 
4689
- // src/projection/classify-child.ts
4690
- function isGroupUse(bundle, use) {
4691
- const target = bundle.modules[use.module];
4692
- if (!target) return false;
4693
- return (target.modules?.length ?? 0) > 0;
4694
- }
4695
-
4696
4756
  // src/projection/compute-layout.ts
4697
4757
  var SPACING_X = 260;
4698
4758
  var SPACING_Y = 180;
@@ -4935,8 +4995,12 @@ function projectNode(bundle, use, fullId, wiredIn, wiredOut) {
4935
4995
  // src/projection/project-scope.ts
4936
4996
  function projectScope(bundle, mod, use, path, arrangement, children) {
4937
4997
  const uses = mod.modules ?? [];
4938
- const derived = deriveEdges(uses);
4939
- const { inputs: wiredIn, outputs: wiredOut } = indexWires(derived);
4998
+ const {
4999
+ derived,
5000
+ interfaceEdges,
5001
+ inputs: wiredIn,
5002
+ outputs: wiredOut
5003
+ } = scopeWires(mod, use === null);
4940
5004
  const scopeArrangement = arrangement?.[use ? use.module : bundle.entry];
4941
5005
  const cards = [];
4942
5006
  const groups = [];
@@ -4992,15 +5056,19 @@ function projectScope(bundle, mod, use, path, arrangement, children) {
4992
5056
  { x: 0, y: 0, width: 0, height: 0 },
4993
5057
  ...items.map((item) => ({ ...placedAt(item.id), ...item.size }))
4994
5058
  ]);
4995
- const edges = derived.map((de) => {
4996
- const sourceId = joinPath(path, de.source_instance);
4997
- const targetId = joinPath(path, de.target_instance);
5059
+ const wires = [...derived, ...interfaceEdges];
5060
+ const edges = wires.map((de) => {
5061
+ const { source_pin, target_pin } = de;
5062
+ const sourceId = source_pin ? path : joinPath(path, de.source_instance);
5063
+ const targetId = target_pin ? path : joinPath(path, de.target_instance);
4998
5064
  return {
4999
5065
  id: `${sourceId}-${targetId}-${de.from_output}-${de.to_input}`,
5000
5066
  source: sourceId,
5001
5067
  target: targetId,
5002
5068
  source_output: de.from_output,
5003
- target_input: de.to_input
5069
+ target_input: de.to_input,
5070
+ source_pin,
5071
+ target_pin
5004
5072
  };
5005
5073
  });
5006
5074
  return {
@@ -5119,6 +5187,7 @@ export {
5119
5187
  groupBoxSize,
5120
5188
  groupFootprint,
5121
5189
  groupInputPinY,
5190
+ groupPinText,
5122
5191
  groupPinY,
5123
5192
  groupPins,
5124
5193
  groupReach,