@lace-cloud/proto 0.36.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -54,6 +54,7 @@ __export(index_exports, {
54
54
  groupBoxSize: () => groupBoxSize,
55
55
  groupFootprint: () => groupFootprint,
56
56
  groupInputPinY: () => groupInputPinY,
57
+ groupPinText: () => groupPinText,
57
58
  groupPinY: () => groupPinY,
58
59
  groupPins: () => groupPins,
59
60
  groupReach: () => groupReach,
@@ -154,7 +155,7 @@ var CONNECT_CODE_NAMES = [
154
155
  ];
155
156
 
156
157
  // src/engine-contract.gen.ts
157
- var GENERATED_ENGINE_CONTRACT = "d4f8d2cadfe5474a806c09f6b35ec43b0d1e4ae752426ac0469489053094765e";
158
+ var GENERATED_ENGINE_CONTRACT = "1cb0669ae6ff4b61580feed0bab111b8d54fdfffb2fe54d6fb22f5fe9c33a3d5";
158
159
 
159
160
  // src/generated/service.ts
160
161
  var import_wire3 = require("@bufbuild/protobuf/wire");
@@ -4181,7 +4182,7 @@ function isSet3(value) {
4181
4182
  }
4182
4183
 
4183
4184
  // src/engine-identity.ts
4184
- var ENGINE_PROTOCOL_VERSION = String(9 /* PROTOCOL_VERSION_CURRENT */);
4185
+ var ENGINE_PROTOCOL_VERSION = String(10 /* PROTOCOL_VERSION_CURRENT */);
4185
4186
  var ENGINE_CONTRACT = GENERATED_ENGINE_CONTRACT;
4186
4187
  var EngineIdentityMismatchError = class extends Error {
4187
4188
  constructor(engine, required) {
@@ -4219,6 +4220,15 @@ function checkEngineIdentity(engine) {
4219
4220
  // src/render.ts
4220
4221
  var META_ARGUMENTS = ["count", "for_each"];
4221
4222
 
4223
+ // src/projection/classify-child.ts
4224
+ function isGroupUse(bundle, use) {
4225
+ const target = bundle.modules[use.module];
4226
+ return target !== void 0 && isGroupModule(target);
4227
+ }
4228
+ function isGroupModule(mod) {
4229
+ return (mod.modules?.length ?? 0) > 0;
4230
+ }
4231
+
4222
4232
  // src/projection/derive-edges.ts
4223
4233
  function emitEdgesFromBinding(binding, targetId, toInput, useIds, seen, edges) {
4224
4234
  if (binding.out?.module && binding.out.name) {
@@ -4260,17 +4270,72 @@ function deriveEdges(uses) {
4260
4270
  }
4261
4271
  return edges;
4262
4272
  }
4273
+ function addPin(index, call, pin) {
4274
+ if (!index.has(call)) index.set(call, /* @__PURE__ */ new Set());
4275
+ index.get(call).add(pin);
4276
+ }
4263
4277
  function indexWires(edges) {
4264
4278
  const inputs = /* @__PURE__ */ new Map();
4265
4279
  const outputs = /* @__PURE__ */ new Map();
4266
4280
  for (const e of edges) {
4267
- if (!inputs.has(e.target_instance)) inputs.set(e.target_instance, /* @__PURE__ */ new Set());
4268
- inputs.get(e.target_instance).add(e.to_input);
4269
- if (!outputs.has(e.source_instance)) outputs.set(e.source_instance, /* @__PURE__ */ new Set());
4270
- outputs.get(e.source_instance).add(e.from_output);
4281
+ addPin(inputs, e.target_instance, e.to_input);
4282
+ addPin(outputs, e.source_instance, e.from_output);
4271
4283
  }
4272
4284
  return { inputs, outputs };
4273
4285
  }
4286
+ function deriveInterfaceEdges(mod) {
4287
+ const uses = mod.modules ?? [];
4288
+ const useIds = new Set(uses.map((u) => u.id));
4289
+ const declaredIn = new Set((mod.interface?.inputs ?? []).map((i) => i.name));
4290
+ const declaredOut = new Set((mod.interface?.outputs ?? []).map((o) => o.name));
4291
+ const edges = [];
4292
+ const fromInput = (pin, target, toInput) => {
4293
+ if (!pin || !declaredIn.has(pin)) return;
4294
+ edges.push({
4295
+ source_instance: "",
4296
+ target_instance: target,
4297
+ from_output: pin,
4298
+ to_input: toInput,
4299
+ source_pin: true
4300
+ });
4301
+ };
4302
+ for (const use of uses) {
4303
+ for (const [name, binding] of Object.entries(use.inputs ?? {})) {
4304
+ fromInput(binding.var ?? "", use.id, name);
4305
+ }
4306
+ for (const meta of META_ARGUMENTS) fromInput(use[meta]?.var ?? "", use.id, meta);
4307
+ }
4308
+ const seen = /* @__PURE__ */ new Set();
4309
+ for (const [name, exported] of Object.entries(mod.exports?.outputs ?? {})) {
4310
+ if (!declaredOut.has(name)) continue;
4311
+ const read = [];
4312
+ emitEdgesFromBinding(exported, "", name, useIds, seen, read);
4313
+ for (const edge of read) {
4314
+ if (useIds.has(edge.source_instance)) edges.push({ ...edge, target_pin: true });
4315
+ }
4316
+ if (exported.var && declaredIn.has(exported.var)) {
4317
+ edges.push({
4318
+ source_instance: "",
4319
+ target_instance: "",
4320
+ from_output: exported.var,
4321
+ to_input: name,
4322
+ source_pin: true,
4323
+ target_pin: true
4324
+ });
4325
+ }
4326
+ }
4327
+ return edges;
4328
+ }
4329
+ function scopeWires(mod, entry) {
4330
+ const derived = deriveEdges(mod.modules ?? []);
4331
+ const interfaceEdges = !entry && isGroupModule(mod) ? deriveInterfaceEdges(mod) : [];
4332
+ const { inputs, outputs } = indexWires(derived);
4333
+ for (const e of interfaceEdges) {
4334
+ if (!e.target_pin) addPin(inputs, e.target_instance, e.to_input);
4335
+ if (!e.source_pin) addPin(outputs, e.source_instance, e.from_output);
4336
+ }
4337
+ return { derived, interfaceEdges, inputs, outputs };
4338
+ }
4274
4339
  function callWires(wiredIn, wiredOut) {
4275
4340
  return {
4276
4341
  call_wired: wiredOut.has(""),
@@ -4403,7 +4468,7 @@ function deriveNodeConfig(bundle, instanceId) {
4403
4468
  const resolved = resolveInstance(bundle, instanceId);
4404
4469
  if (!resolved) return null;
4405
4470
  const { scope, child } = resolved;
4406
- const readOutputs = indexWires(deriveEdges(scope.modules ?? [])).outputs.get(child.id) ?? [];
4471
+ const readOutputs = scopeWires(scope, resolved.scopeKey === bundle.entry).outputs.get(child.id) ?? [];
4407
4472
  const schema = child.use ? resolveSchema(bundle, child.use, readOutputs) : { inputs: [], outputs: [] };
4408
4473
  const schemaInputs = schema.inputs;
4409
4474
  const schemaOutputs = schema.outputs;
@@ -4559,7 +4624,7 @@ function deriveSettingsConfig(bundle, moduleKey) {
4559
4624
  sensitive: o.sensitive || void 0,
4560
4625
  depends_on: o.depends_on
4561
4626
  }));
4562
- const read = indexWires(deriveEdges(mod.modules ?? [])).outputs;
4627
+ const read = scopeWires(mod, moduleKey === bundle.entry).outputs;
4563
4628
  const callOutputs = (mod.modules ?? []).flatMap(
4564
4629
  (use) => resolveSchema(bundle, use, read.get(use.id) ?? []).outputs.map(
4565
4630
  (o) => `module.${use.id}.${o.name}`
@@ -4598,6 +4663,9 @@ function splitPath(canvasPath) {
4598
4663
  function callText(sourcePath) {
4599
4664
  return `module.${splitPath(sourcePath).localId}`;
4600
4665
  }
4666
+ function groupPinText(group, end, pin) {
4667
+ return `${group}.${end === "source" ? "inputs" : "outputs"}.${pin}`;
4668
+ }
4601
4669
 
4602
4670
  // src/projection/node-for-address.ts
4603
4671
  var INSTANCE_KEY = /\[[^\]]*\]$/;
@@ -4768,13 +4836,6 @@ function parseModuleKey(key) {
4768
4836
  return { id: key.slice(0, at), version: key.slice(at + 1) };
4769
4837
  }
4770
4838
 
4771
- // src/projection/classify-child.ts
4772
- function isGroupUse(bundle, use) {
4773
- const target = bundle.modules[use.module];
4774
- if (!target) return false;
4775
- return (target.modules?.length ?? 0) > 0;
4776
- }
4777
-
4778
4839
  // src/projection/compute-layout.ts
4779
4840
  var SPACING_X = 260;
4780
4841
  var SPACING_Y = 180;
@@ -5017,8 +5078,12 @@ function projectNode(bundle, use, fullId, wiredIn, wiredOut) {
5017
5078
  // src/projection/project-scope.ts
5018
5079
  function projectScope(bundle, mod, use, path, arrangement, children) {
5019
5080
  const uses = mod.modules ?? [];
5020
- const derived = deriveEdges(uses);
5021
- const { inputs: wiredIn, outputs: wiredOut } = indexWires(derived);
5081
+ const {
5082
+ derived,
5083
+ interfaceEdges,
5084
+ inputs: wiredIn,
5085
+ outputs: wiredOut
5086
+ } = scopeWires(mod, use === null);
5022
5087
  const scopeArrangement = arrangement?.[use ? use.module : bundle.entry];
5023
5088
  const cards = [];
5024
5089
  const groups = [];
@@ -5074,15 +5139,19 @@ function projectScope(bundle, mod, use, path, arrangement, children) {
5074
5139
  { x: 0, y: 0, width: 0, height: 0 },
5075
5140
  ...items.map((item) => ({ ...placedAt(item.id), ...item.size }))
5076
5141
  ]);
5077
- const edges = derived.map((de) => {
5078
- const sourceId = joinPath(path, de.source_instance);
5079
- const targetId = joinPath(path, de.target_instance);
5142
+ const wires = [...derived, ...interfaceEdges];
5143
+ const edges = wires.map((de) => {
5144
+ const { source_pin, target_pin } = de;
5145
+ const sourceId = source_pin ? path : joinPath(path, de.source_instance);
5146
+ const targetId = target_pin ? path : joinPath(path, de.target_instance);
5080
5147
  return {
5081
5148
  id: `${sourceId}-${targetId}-${de.from_output}-${de.to_input}`,
5082
5149
  source: sourceId,
5083
5150
  target: targetId,
5084
5151
  source_output: de.from_output,
5085
- target_input: de.to_input
5152
+ target_input: de.to_input,
5153
+ source_pin,
5154
+ target_pin
5086
5155
  };
5087
5156
  });
5088
5157
  return {
@@ -5202,6 +5271,7 @@ var CanvasViewProto = CanvasView;
5202
5271
  groupBoxSize,
5203
5272
  groupFootprint,
5204
5273
  groupInputPinY,
5274
+ groupPinText,
5205
5275
  groupPinY,
5206
5276
  groupPins,
5207
5277
  groupReach,