@lace-cloud/proto 0.35.0 → 0.36.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
@@ -71,8 +71,11 @@ var CONNECT_CODE_NAMES = [
71
71
  "unauthenticated"
72
72
  ];
73
73
 
74
- // src/generated/state.ts
75
- import { BinaryReader as BinaryReader2, BinaryWriter as BinaryWriter2 } from "@bufbuild/protobuf/wire";
74
+ // src/engine-contract.gen.ts
75
+ var GENERATED_ENGINE_CONTRACT = "d4f8d2cadfe5474a806c09f6b35ec43b0d1e4ae752426ac0469489053094765e";
76
+
77
+ // src/generated/service.ts
78
+ import { BinaryReader as BinaryReader3, BinaryWriter as BinaryWriter3 } from "@bufbuild/protobuf/wire";
76
79
 
77
80
  // src/generated/google/protobuf/struct.ts
78
81
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
@@ -501,6 +504,7 @@ function isSet(value) {
501
504
  }
502
505
 
503
506
  // src/generated/state.ts
507
+ import { BinaryReader as BinaryReader2, BinaryWriter as BinaryWriter2 } from "@bufbuild/protobuf/wire";
504
508
  function createBaseBundle() {
505
509
  return { schema_version: "", kind: "", entry: "", modules: {} };
506
510
  }
@@ -3301,1023 +3305,515 @@ function isSet2(value) {
3301
3305
  return value !== null && value !== void 0;
3302
3306
  }
3303
3307
 
3304
- // src/render.ts
3305
- var META_ARGUMENTS = ["count", "for_each"];
3306
-
3307
- // src/projection/derive-edges.ts
3308
- function emitEdgesFromBinding(binding, targetId, toInput, useIds, seen, edges) {
3309
- if (binding.out?.module && binding.out.name) {
3310
- edges.push({
3311
- source_instance: binding.out.module,
3312
- target_instance: targetId,
3313
- from_output: binding.out.name,
3314
- to_input: toInput
3315
- });
3316
- return;
3317
- }
3318
- for (const ref of binding.expr?.module_references ?? []) {
3319
- if (!useIds.has(ref.call)) continue;
3320
- const fromOutput = ref.output ?? "";
3321
- const key = `${ref.call}:${targetId}:${fromOutput}:${toInput}`;
3322
- if (seen.has(key)) continue;
3323
- seen.add(key);
3324
- edges.push({
3325
- source_instance: ref.call,
3326
- target_instance: targetId,
3327
- from_output: fromOutput,
3328
- to_input: toInput
3329
- });
3330
- }
3331
- }
3332
- function deriveEdges(uses) {
3333
- const useIds = new Set(uses.map((u) => u.id));
3334
- const edges = [];
3335
- const seen = /* @__PURE__ */ new Set();
3336
- for (const target of uses) {
3337
- const inputs = target.inputs ?? {};
3338
- for (const [inputName, binding] of Object.entries(inputs)) {
3339
- emitEdgesFromBinding(binding, target.id, inputName, useIds, seen, edges);
3340
- }
3341
- for (const meta of META_ARGUMENTS) {
3342
- const binding = target[meta];
3343
- if (binding) emitEdgesFromBinding(binding, target.id, meta, useIds, seen, edges);
3344
- }
3308
+ // src/generated/service.ts
3309
+ function nodeKindFromJSON(object) {
3310
+ switch (object) {
3311
+ case 0:
3312
+ case "NODE_KIND_UNSPECIFIED":
3313
+ return 0 /* NODE_KIND_UNSPECIFIED */;
3314
+ case 1:
3315
+ case "NODE_KIND_MODULE":
3316
+ return 1 /* NODE_KIND_MODULE */;
3317
+ case 2:
3318
+ case "NODE_KIND_RESOURCE":
3319
+ return 2 /* NODE_KIND_RESOURCE */;
3320
+ case 3:
3321
+ case "NODE_KIND_DATA":
3322
+ return 3 /* NODE_KIND_DATA */;
3323
+ case -1:
3324
+ case "UNRECOGNIZED":
3325
+ default:
3326
+ return -1 /* UNRECOGNIZED */;
3345
3327
  }
3346
- return edges;
3347
3328
  }
3348
- function indexWires(edges) {
3349
- const inputs = /* @__PURE__ */ new Map();
3350
- const outputs = /* @__PURE__ */ new Map();
3351
- for (const e of edges) {
3352
- if (!inputs.has(e.target_instance)) inputs.set(e.target_instance, /* @__PURE__ */ new Set());
3353
- inputs.get(e.target_instance).add(e.to_input);
3354
- if (!outputs.has(e.source_instance)) outputs.set(e.source_instance, /* @__PURE__ */ new Set());
3355
- outputs.get(e.source_instance).add(e.from_output);
3329
+ function nodeKindToJSON(object) {
3330
+ switch (object) {
3331
+ case 0 /* NODE_KIND_UNSPECIFIED */:
3332
+ return "NODE_KIND_UNSPECIFIED";
3333
+ case 1 /* NODE_KIND_MODULE */:
3334
+ return "NODE_KIND_MODULE";
3335
+ case 2 /* NODE_KIND_RESOURCE */:
3336
+ return "NODE_KIND_RESOURCE";
3337
+ case 3 /* NODE_KIND_DATA */:
3338
+ return "NODE_KIND_DATA";
3339
+ case -1 /* UNRECOGNIZED */:
3340
+ default:
3341
+ return "UNRECOGNIZED";
3356
3342
  }
3357
- return { inputs, outputs };
3358
3343
  }
3359
- function callWires(wiredIn, wiredOut) {
3360
- return {
3361
- call_wired: wiredOut.has(""),
3362
- meta_wired: META_ARGUMENTS.filter((meta) => wiredIn.has(meta))
3363
- };
3344
+ function createBaseCanvasView() {
3345
+ return { module_name: "", nodes: [], edges: [], can_undo: false, can_redo: false, unsaved: false, groups: [] };
3364
3346
  }
3365
-
3366
- // src/projection/resolve-schema.ts
3367
- function resolveSchema(bundle, use, readOutputs) {
3368
- const target = bundle.modules[use.module];
3369
- if (!target) return { inputs: [], outputs: [] };
3370
- if (target.interface) {
3371
- return { inputs: target.interface.inputs, outputs: target.interface.outputs };
3347
+ var CanvasView = {
3348
+ encode(message, writer = new BinaryWriter3()) {
3349
+ if (message.module_name !== "") {
3350
+ writer.uint32(10).string(message.module_name);
3351
+ }
3352
+ for (const v of message.nodes) {
3353
+ RenderNode.encode(v, writer.uint32(18).fork()).join();
3354
+ }
3355
+ for (const v of message.edges) {
3356
+ RenderEdge.encode(v, writer.uint32(26).fork()).join();
3357
+ }
3358
+ if (message.can_undo !== false) {
3359
+ writer.uint32(40).bool(message.can_undo);
3360
+ }
3361
+ if (message.can_redo !== false) {
3362
+ writer.uint32(48).bool(message.can_redo);
3363
+ }
3364
+ if (message.unsaved !== false) {
3365
+ writer.uint32(56).bool(message.unsaved);
3366
+ }
3367
+ for (const v of message.groups) {
3368
+ RenderGroup.encode(v, writer.uint32(66).fork()).join();
3369
+ }
3370
+ return writer;
3371
+ },
3372
+ decode(input, length) {
3373
+ const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
3374
+ const end = length === void 0 ? reader.len : reader.pos + length;
3375
+ const message = createBaseCanvasView();
3376
+ while (reader.pos < end) {
3377
+ const tag = reader.uint32();
3378
+ switch (tag >>> 3) {
3379
+ case 1: {
3380
+ if (tag !== 10) {
3381
+ break;
3382
+ }
3383
+ message.module_name = reader.string();
3384
+ continue;
3385
+ }
3386
+ case 2: {
3387
+ if (tag !== 18) {
3388
+ break;
3389
+ }
3390
+ message.nodes.push(RenderNode.decode(reader, reader.uint32()));
3391
+ continue;
3392
+ }
3393
+ case 3: {
3394
+ if (tag !== 26) {
3395
+ break;
3396
+ }
3397
+ message.edges.push(RenderEdge.decode(reader, reader.uint32()));
3398
+ continue;
3399
+ }
3400
+ case 5: {
3401
+ if (tag !== 40) {
3402
+ break;
3403
+ }
3404
+ message.can_undo = reader.bool();
3405
+ continue;
3406
+ }
3407
+ case 6: {
3408
+ if (tag !== 48) {
3409
+ break;
3410
+ }
3411
+ message.can_redo = reader.bool();
3412
+ continue;
3413
+ }
3414
+ case 7: {
3415
+ if (tag !== 56) {
3416
+ break;
3417
+ }
3418
+ message.unsaved = reader.bool();
3419
+ continue;
3420
+ }
3421
+ case 8: {
3422
+ if (tag !== 66) {
3423
+ break;
3424
+ }
3425
+ message.groups.push(RenderGroup.decode(reader, reader.uint32()));
3426
+ continue;
3427
+ }
3428
+ }
3429
+ if ((tag & 7) === 4 || tag === 0) {
3430
+ break;
3431
+ }
3432
+ reader.skip(tag & 7);
3433
+ }
3434
+ return message;
3435
+ },
3436
+ fromJSON(object) {
3437
+ return {
3438
+ module_name: isSet3(object.moduleName) ? globalThis.String(object.moduleName) : isSet3(object.module_name) ? globalThis.String(object.module_name) : "",
3439
+ nodes: globalThis.Array.isArray(object?.nodes) ? object.nodes.map((e) => RenderNode.fromJSON(e)) : [],
3440
+ edges: globalThis.Array.isArray(object?.edges) ? object.edges.map((e) => RenderEdge.fromJSON(e)) : [],
3441
+ can_undo: isSet3(object.canUndo) ? globalThis.Boolean(object.canUndo) : isSet3(object.can_undo) ? globalThis.Boolean(object.can_undo) : false,
3442
+ can_redo: isSet3(object.canRedo) ? globalThis.Boolean(object.canRedo) : isSet3(object.can_redo) ? globalThis.Boolean(object.can_redo) : false,
3443
+ unsaved: isSet3(object.unsaved) ? globalThis.Boolean(object.unsaved) : false,
3444
+ groups: globalThis.Array.isArray(object?.groups) ? object.groups.map((e) => RenderGroup.fromJSON(e)) : []
3445
+ };
3446
+ },
3447
+ toJSON(message) {
3448
+ const obj = {};
3449
+ if (message.module_name !== "") {
3450
+ obj.moduleName = message.module_name;
3451
+ }
3452
+ if (message.nodes?.length) {
3453
+ obj.nodes = message.nodes.map((e) => RenderNode.toJSON(e));
3454
+ }
3455
+ if (message.edges?.length) {
3456
+ obj.edges = message.edges.map((e) => RenderEdge.toJSON(e));
3457
+ }
3458
+ if (message.can_undo !== false) {
3459
+ obj.canUndo = message.can_undo;
3460
+ }
3461
+ if (message.can_redo !== false) {
3462
+ obj.canRedo = message.can_redo;
3463
+ }
3464
+ if (message.unsaved !== false) {
3465
+ obj.unsaved = message.unsaved;
3466
+ }
3467
+ if (message.groups?.length) {
3468
+ obj.groups = message.groups.map((e) => RenderGroup.toJSON(e));
3469
+ }
3470
+ return obj;
3471
+ },
3472
+ create(base) {
3473
+ return CanvasView.fromPartial(base ?? {});
3474
+ },
3475
+ fromPartial(object) {
3476
+ const message = createBaseCanvasView();
3477
+ message.module_name = object.module_name ?? "";
3478
+ message.nodes = object.nodes?.map((e) => RenderNode.fromPartial(e)) || [];
3479
+ message.edges = object.edges?.map((e) => RenderEdge.fromPartial(e)) || [];
3480
+ message.can_undo = object.can_undo ?? false;
3481
+ message.can_redo = object.can_redo ?? false;
3482
+ message.unsaved = object.unsaved ?? false;
3483
+ message.groups = object.groups?.map((e) => RenderGroup.fromPartial(e)) || [];
3484
+ return message;
3372
3485
  }
3373
- return {
3374
- inputs: Object.keys(use.inputs ?? {}).sort().map((name) => InputDef.create({ name })),
3375
- outputs: [...new Set(readOutputs)].filter((name) => name !== "").sort().map((name) => OutputDef.create({ name }))
3376
- };
3486
+ };
3487
+ function createBaseRenderGroup() {
3488
+ return { id: "", label: "", node_ids: [], collapsed: false, module_key: "", inputs: [], outputs: [] };
3377
3489
  }
3378
- function findChild(mod, id) {
3379
- for (const use of mod.modules ?? []) {
3380
- if (use.id === id) return { id, use };
3381
- }
3382
- for (const resource of mod.resources ?? []) {
3383
- if (resource.id === id) return { id, resource };
3384
- }
3385
- return null;
3386
- }
3387
- function resolveInstance(bundle, id) {
3388
- return resolveFrom(bundle, bundle.entry, id);
3389
- }
3390
- function resolveFrom(bundle, scopeKey, id) {
3391
- const scope = bundle.modules[scopeKey];
3392
- if (!scope) return null;
3393
- for (const use of scope.modules ?? []) {
3394
- if (!id.startsWith(`${use.id}.`)) continue;
3395
- const nested = resolveFrom(bundle, use.module, id.slice(use.id.length + 1));
3396
- if (nested) return nested;
3397
- }
3398
- const child = findChild(scope, id);
3399
- return child ? { scopeKey, scope, child } : null;
3400
- }
3401
- function instanceAddress(bundle, id) {
3402
- const resolved = resolveInstance(bundle, id);
3403
- return resolved ? { scope: resolved.scopeKey, id: resolved.child.id } : { scope: bundle.entry, id };
3404
- }
3405
- function resolveScopePath(bundle, path) {
3406
- if (path === "") {
3407
- return bundle.modules[bundle.entry] ? bundle.entry : null;
3408
- }
3409
- return resolveInstance(bundle, path)?.child.use?.module ?? null;
3410
- }
3411
-
3412
- // src/projection/inspect.ts
3413
- function hclLiteralText(lit) {
3414
- if (typeof lit === "string") return quoteHclString(lit);
3415
- if (typeof lit === "number" || typeof lit === "boolean") return String(lit);
3416
- if (Array.isArray(lit)) return `[${lit.map(hclLiteralText).join(", ")}]`;
3417
- if (lit !== null && typeof lit === "object") {
3418
- return hclObjectText(lit);
3419
- }
3420
- return String(lit);
3421
- }
3422
- function quoteHclString(s) {
3423
- let out = "";
3424
- for (let i = 0; i < s.length; i++) {
3425
- const c = s[i];
3426
- switch (c) {
3427
- case "\\":
3428
- out += "\\\\";
3429
- break;
3430
- case '"':
3431
- out += '\\"';
3432
- break;
3433
- case "\n":
3434
- out += "\\n";
3435
- break;
3436
- case "\r":
3437
- out += "\\r";
3438
- break;
3439
- case " ":
3440
- out += "\\t";
3441
- break;
3442
- case "$":
3443
- case "%":
3444
- out += s[i + 1] === "{" ? c + c : c;
3490
+ var RenderGroup = {
3491
+ encode(message, writer = new BinaryWriter3()) {
3492
+ if (message.id !== "") {
3493
+ writer.uint32(10).string(message.id);
3494
+ }
3495
+ if (message.label !== "") {
3496
+ writer.uint32(18).string(message.label);
3497
+ }
3498
+ for (const v of message.node_ids) {
3499
+ writer.uint32(26).string(v);
3500
+ }
3501
+ if (message.collapsed !== false) {
3502
+ writer.uint32(32).bool(message.collapsed);
3503
+ }
3504
+ if (message.module_key !== "") {
3505
+ writer.uint32(42).string(message.module_key);
3506
+ }
3507
+ for (const v of message.inputs) {
3508
+ NodePin.encode(v, writer.uint32(50).fork()).join();
3509
+ }
3510
+ for (const v of message.outputs) {
3511
+ NodePin.encode(v, writer.uint32(58).fork()).join();
3512
+ }
3513
+ return writer;
3514
+ },
3515
+ decode(input, length) {
3516
+ const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
3517
+ const end = length === void 0 ? reader.len : reader.pos + length;
3518
+ const message = createBaseRenderGroup();
3519
+ while (reader.pos < end) {
3520
+ const tag = reader.uint32();
3521
+ switch (tag >>> 3) {
3522
+ case 1: {
3523
+ if (tag !== 10) {
3524
+ break;
3525
+ }
3526
+ message.id = reader.string();
3527
+ continue;
3528
+ }
3529
+ case 2: {
3530
+ if (tag !== 18) {
3531
+ break;
3532
+ }
3533
+ message.label = reader.string();
3534
+ continue;
3535
+ }
3536
+ case 3: {
3537
+ if (tag !== 26) {
3538
+ break;
3539
+ }
3540
+ message.node_ids.push(reader.string());
3541
+ continue;
3542
+ }
3543
+ case 4: {
3544
+ if (tag !== 32) {
3545
+ break;
3546
+ }
3547
+ message.collapsed = reader.bool();
3548
+ continue;
3549
+ }
3550
+ case 5: {
3551
+ if (tag !== 42) {
3552
+ break;
3553
+ }
3554
+ message.module_key = reader.string();
3555
+ continue;
3556
+ }
3557
+ case 6: {
3558
+ if (tag !== 50) {
3559
+ break;
3560
+ }
3561
+ message.inputs.push(NodePin.decode(reader, reader.uint32()));
3562
+ continue;
3563
+ }
3564
+ case 7: {
3565
+ if (tag !== 58) {
3566
+ break;
3567
+ }
3568
+ message.outputs.push(NodePin.decode(reader, reader.uint32()));
3569
+ continue;
3570
+ }
3571
+ }
3572
+ if ((tag & 7) === 4 || tag === 0) {
3445
3573
  break;
3446
- default:
3447
- out += c;
3574
+ }
3575
+ reader.skip(tag & 7);
3576
+ }
3577
+ return message;
3578
+ },
3579
+ fromJSON(object) {
3580
+ return {
3581
+ id: isSet3(object.id) ? globalThis.String(object.id) : "",
3582
+ label: isSet3(object.label) ? globalThis.String(object.label) : "",
3583
+ node_ids: globalThis.Array.isArray(object?.nodeIds) ? object.nodeIds.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.node_ids) ? object.node_ids.map((e) => globalThis.String(e)) : [],
3584
+ collapsed: isSet3(object.collapsed) ? globalThis.Boolean(object.collapsed) : false,
3585
+ module_key: isSet3(object.moduleKey) ? globalThis.String(object.moduleKey) : isSet3(object.module_key) ? globalThis.String(object.module_key) : "",
3586
+ inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => NodePin.fromJSON(e)) : [],
3587
+ outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e) => NodePin.fromJSON(e)) : []
3588
+ };
3589
+ },
3590
+ toJSON(message) {
3591
+ const obj = {};
3592
+ if (message.id !== "") {
3593
+ obj.id = message.id;
3594
+ }
3595
+ if (message.label !== "") {
3596
+ obj.label = message.label;
3597
+ }
3598
+ if (message.node_ids?.length) {
3599
+ obj.nodeIds = message.node_ids;
3600
+ }
3601
+ if (message.collapsed !== false) {
3602
+ obj.collapsed = message.collapsed;
3603
+ }
3604
+ if (message.module_key !== "") {
3605
+ obj.moduleKey = message.module_key;
3448
3606
  }
3607
+ if (message.inputs?.length) {
3608
+ obj.inputs = message.inputs.map((e) => NodePin.toJSON(e));
3609
+ }
3610
+ if (message.outputs?.length) {
3611
+ obj.outputs = message.outputs.map((e) => NodePin.toJSON(e));
3612
+ }
3613
+ return obj;
3614
+ },
3615
+ create(base) {
3616
+ return RenderGroup.fromPartial(base ?? {});
3617
+ },
3618
+ fromPartial(object) {
3619
+ const message = createBaseRenderGroup();
3620
+ message.id = object.id ?? "";
3621
+ message.label = object.label ?? "";
3622
+ message.node_ids = object.node_ids?.map((e) => e) || [];
3623
+ message.collapsed = object.collapsed ?? false;
3624
+ message.module_key = object.module_key ?? "";
3625
+ message.inputs = object.inputs?.map((e) => NodePin.fromPartial(e)) || [];
3626
+ message.outputs = object.outputs?.map((e) => NodePin.fromPartial(e)) || [];
3627
+ return message;
3449
3628
  }
3450
- return `"${out}"`;
3451
- }
3452
- function hclObjectText(obj) {
3453
- const entries = Object.entries(obj).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
3454
- if (entries.length === 0) return "{}";
3455
- const width = Math.max(...entries.map(([k]) => k.length)) + 1;
3456
- const lines = entries.map(([k, v]) => ` ${k.padEnd(width)}= ${hclLiteralText(v)}`);
3457
- return `{
3458
- ${lines.join("\n")}
3459
- }`;
3460
- }
3461
- function bindingText(b) {
3462
- if (!b) return "";
3463
- if (b.lit !== void 0 && b.lit !== null) return hclLiteralText(b.lit);
3464
- if (b.var) return `var.${b.var}`;
3465
- if (b.out) return `module.${b.out.module}.${b.out.name}`;
3466
- if (b.expr) return b.expr.value;
3467
- return "";
3468
- }
3469
- function exportText(e) {
3470
- if (!e) return "";
3471
- if (e.out) return `${childReference(e.out.module)}.${e.out.name}`;
3472
- return bindingText({ lit: e.lit, var: e.var, out: void 0, expr: e.expr });
3473
- }
3474
- function childReference(id) {
3475
- if (id.startsWith("resource.")) return id.slice("resource.".length);
3476
- if (id.startsWith("data.")) return id;
3477
- return `module.${id}`;
3478
- }
3479
- function bindingMode(b) {
3480
- if (!b) return { mode: "empty" };
3481
- if (b.out) return { mode: "wired", wired_source: bindingText(b) };
3482
- if (b.var) return { mode: "variable", variable: b.var };
3483
- if (b.expr) return { mode: "expression", expression: b.expr.value };
3484
- if (b.lit !== void 0 && b.lit !== null) return { mode: "literal", value: b.lit };
3485
- return { mode: "empty" };
3629
+ };
3630
+ function createBaseRenderNode() {
3631
+ return { id: "", label: "", kind: 0, module_key: "", icon_url: "", position: void 0, inputs: [], outputs: [] };
3486
3632
  }
3487
- function deriveNodeConfig(bundle, instanceId) {
3488
- const resolved = resolveInstance(bundle, instanceId);
3489
- if (!resolved) return null;
3490
- const { scope, child } = resolved;
3491
- const readOutputs = indexWires(deriveEdges(scope.modules ?? [])).outputs.get(child.id) ?? [];
3492
- const schema = child.use ? resolveSchema(bundle, child.use, readOutputs) : { inputs: [], outputs: [] };
3493
- const schemaInputs = schema.inputs;
3494
- const schemaOutputs = schema.outputs;
3495
- const boundInputs = child.use?.inputs ?? child.resource?.inputs ?? {};
3496
- const inputs = schemaInputs.map((def) => ({
3497
- name: def.name,
3498
- type: def.type,
3499
- required: def.required,
3500
- description: def.description || void 0,
3501
- default_value: def.default_value,
3502
- validation: def.validation?.[0] ? { condition: def.validation[0].condition, error_message: def.validation[0].error_message } : void 0,
3503
- ...bindingMode(boundInputs[def.name])
3504
- }));
3505
- const outputs = schemaOutputs.map((def) => ({
3506
- name: def.name,
3507
- type: def.type,
3508
- description: def.description || void 0,
3509
- sensitive: def.sensitive || void 0
3510
- }));
3511
- const dependencyOptions = [
3512
- ...(scope.modules ?? []).map((u) => u.id),
3513
- ...(scope.resources ?? []).map((r) => r.id)
3514
- ].filter((id) => id !== child.id).map(childReference);
3515
- const dependsOn = child.use?.depends_on ?? child.resource?.depends_on ?? [];
3516
- const providers = child.use?.providers ?? {};
3517
- const meta = child.use ?? child.resource;
3518
- const availableVariables = (scope.interface?.inputs ?? []).map((v) => ({
3519
- name: v.name,
3520
- type: v.type
3521
- }));
3522
- return {
3523
- instance_id: instanceId,
3524
- module_key: child.use?.module,
3525
- source: child.use ? callSource(bundle, resolved.scopeKey, child.use.module) : void 0,
3526
- inputs,
3527
- outputs,
3528
- dependency_options: dependencyOptions,
3529
- depends_on: dependsOn,
3530
- providers,
3531
- count: bindingText(meta?.count),
3532
- for_each: bindingText(meta?.for_each),
3533
- available_variables: availableVariables
3534
- };
3535
- }
3536
- function callSource(bundle, scopeKey, moduleKey) {
3537
- const from = dirOf(bundle, scopeKey);
3538
- const to = sourceDir(bundle, moduleKey);
3539
- if (from !== void 0 && to !== void 0) return memberSourcePath(from, to);
3540
- const source = bundle.modules[moduleKey]?.source;
3541
- return source ? sourceText(source) : "";
3542
- }
3543
- function isMemberDir(id) {
3544
- return id !== "" && id !== "." && id !== ".." && !id.startsWith("./") && !id.startsWith("../") && !id.startsWith("/");
3545
- }
3546
- function dirOf(bundle, key) {
3547
- if (key === bundle.entry) return "";
3548
- const mod = bundle.modules[key];
3549
- if (!mod || mod.source || !isMemberDir(mod.id)) return void 0;
3550
- return mod.id;
3551
- }
3552
- function sourceDir(bundle, key) {
3553
- const dir = dirOf(bundle, key);
3554
- if (dir !== void 0) return dir;
3555
- const mod = bundle.modules[key];
3556
- return mod?.source?.kind === "local" && isMemberDir(mod.id) ? mod.id : void 0;
3557
- }
3558
- function memberSourcePath(from, to) {
3559
- const base = from === "" ? [] : from.split("/");
3560
- const target = to.split("/");
3561
- let shared = 0;
3562
- while (shared < base.length && shared < target.length && base[shared] === target[shared]) {
3563
- shared++;
3564
- }
3565
- const rel = [...base.slice(shared).map(() => ".."), ...target.slice(shared)].join("/") || ".";
3566
- return rel.startsWith("../") ? rel : `./${rel}`;
3567
- }
3568
- function sourceText(source) {
3569
- if (source.kind === "git") {
3570
- const subdir = source.subdir ? `//${source.subdir}` : "";
3571
- const ref = source.ref ? `?ref=${source.ref}` : "";
3572
- return `git::${source.repo}${subdir}${ref}`;
3573
- }
3574
- return source.kind === "local" ? source.subdir : source.ref;
3575
- }
3576
- function defaultText(value) {
3577
- return value === void 0 || value === null ? "null" : hclLiteralText(value);
3578
- }
3579
- function blockConfigs(blocks) {
3580
- return (blocks ?? []).map((b) => ({
3581
- type: b.type,
3582
- labels: [...b.labels],
3583
- attributes: b.attributes.map((a) => ({ name: a.name, value: bindingText(a.value) })),
3584
- blocks: blockConfigs(b.blocks)
3585
- }));
3586
- }
3587
- function resourceConfig(r) {
3588
- const kind = r.kind === "data" ? "data" : "resource";
3589
- return {
3590
- id: r.id,
3591
- kind,
3592
- type: r.type,
3593
- name: r.id.slice(`${kind}.${r.type}.`.length),
3594
- arguments: Object.keys(r.inputs ?? {}).sort().map((name) => ({ name, value: bindingText(r.inputs[name]) })),
3595
- blocks: blockConfigs(r.blocks),
3596
- count: bindingText(r.count),
3597
- for_each: bindingText(r.for_each),
3598
- provider: r.provider_ref,
3599
- depends_on: [...r.depends_on ?? []]
3600
- };
3601
- }
3602
- function deriveSettingsConfig(bundle, moduleKey) {
3603
- const mod = bundle.modules[moduleKey];
3604
- if (!mod) return null;
3605
- const terraform = mod.terraform ? {
3606
- required_version: mod.terraform.required_version,
3607
- required_providers: Object.entries(mod.terraform.required_providers ?? {}).map(
3608
- ([name, req]) => ({
3609
- name,
3610
- source: req.source,
3611
- version: req.version,
3612
- configuration_aliases: req.configuration_aliases
3613
- })
3614
- )
3615
- } : { required_version: "", required_providers: [] };
3616
- const providers = (mod.providers ?? []).map((p) => {
3617
- const config = {};
3618
- for (const [k, v] of Object.entries(p.config ?? {})) {
3619
- config[k] = bindingText(v);
3633
+ var RenderNode = {
3634
+ encode(message, writer = new BinaryWriter3()) {
3635
+ if (message.id !== "") {
3636
+ writer.uint32(10).string(message.id);
3620
3637
  }
3621
- return { name: p.name, alias: p.alias, config, blocks: blockConfigs(p.blocks) };
3622
- });
3623
- const locals = (mod.locals ?? []).map((l) => ({ name: l.name, value: bindingText(l.value) }));
3624
- const variables = (mod.interface?.inputs ?? []).map((v) => ({
3625
- name: v.name,
3626
- type: v.type,
3627
- required: v.required,
3628
- description: v.description || void 0,
3629
- default_value: v.default_value,
3630
- validation: v.validation?.map((b) => ({
3631
- condition: b.condition,
3632
- error_message: b.error_message
3633
- })),
3634
- ephemeral: v.ephemeral,
3635
- sensitive: v.sensitive || void 0,
3636
- nullable: v.nullable,
3637
- default: v.required ? "" : defaultText(v.default_value)
3638
- }));
3639
- const outputs = (mod.interface?.outputs ?? []).map((o) => ({
3640
- name: o.name,
3641
- type: o.type,
3642
- value: exportText(mod.exports?.outputs?.[o.name]),
3643
- description: o.description || void 0,
3644
- sensitive: o.sensitive || void 0,
3645
- depends_on: o.depends_on
3646
- }));
3647
- const read = indexWires(deriveEdges(mod.modules ?? [])).outputs;
3648
- const callOutputs = (mod.modules ?? []).flatMap(
3649
- (use) => resolveSchema(bundle, use, read.get(use.id) ?? []).outputs.map(
3650
- (o) => `module.${use.id}.${o.name}`
3651
- )
3652
- );
3653
- const resources = (mod.resources ?? []).map(resourceConfig);
3654
- const leaf = !mod.source && moduleKey !== bundle.entry && (mod.modules ?? []).length === 0;
3655
- return {
3656
- module_key: moduleKey,
3657
- reference: mod.source ? { source: sourceText(mod.source), version: mod.version } : void 0,
3658
- terraform,
3659
- providers,
3660
- locals,
3661
- variables,
3662
- outputs,
3663
- resources,
3664
- holds_managed_resources: resources.some((r) => r.kind === "resource") || leaf,
3665
- directives: blockConfigs(mod.top_level_blocks),
3666
- call_outputs: callOutputs,
3667
- dependency_options: [
3668
- ...(mod.modules ?? []).map((u) => childReference(u.id)),
3669
- ...(mod.resources ?? []).map((r) => childReference(r.id))
3670
- ]
3671
- };
3672
- }
3673
-
3674
- // src/projection/join-path.ts
3675
- function joinPath(prefix, localId) {
3676
- return prefix === "" ? localId : `${prefix}.${localId}`;
3677
- }
3678
- function splitPath(canvasPath) {
3679
- const lastDot = canvasPath.lastIndexOf(".");
3680
- if (lastDot === -1) return { parentPath: "", localId: canvasPath };
3681
- return { parentPath: canvasPath.slice(0, lastDot), localId: canvasPath.slice(lastDot + 1) };
3682
- }
3683
- function callText(sourcePath) {
3684
- return `module.${splitPath(sourcePath).localId}`;
3685
- }
3686
-
3687
- // src/projection/node-for-address.ts
3688
- var INSTANCE_KEY = /\[[^\]]*\]$/;
3689
- function tokenizeAddress(address) {
3690
- const tokens = [];
3691
- let current = "";
3692
- let depth = 0;
3693
- for (const ch of address) {
3694
- if (ch === "[") depth++;
3695
- else if (ch === "]") depth--;
3696
- if (ch === "." && depth === 0) {
3697
- tokens.push(current);
3698
- current = "";
3699
- } else {
3700
- current += ch;
3638
+ if (message.label !== "") {
3639
+ writer.uint32(18).string(message.label);
3701
3640
  }
3702
- }
3703
- tokens.push(current);
3704
- return tokens;
3705
- }
3706
- function nodeIdForAddress(view, address) {
3707
- const tokens = tokenizeAddress(address);
3708
- const moduleNames = [];
3709
- let i = 0;
3710
- while (i + 1 < tokens.length && tokens[i] === "module") {
3711
- moduleNames.push(tokens[i + 1].replace(INSTANCE_KEY, ""));
3712
- i += 2;
3713
- }
3714
- if (moduleNames.length === 0) return null;
3715
- const known = /* @__PURE__ */ new Set();
3716
- for (const n of view.nodes) known.add(n.id);
3717
- for (const g of view.groups) known.add(g.id);
3718
- for (let k = moduleNames.length; k >= 1; k--) {
3719
- let path = "";
3720
- for (let j = 0; j < k; j++) path = joinPath(path, moduleNames[j]);
3721
- if (known.has(path)) return path;
3722
- }
3723
- return null;
3724
- }
3725
-
3726
- // src/projection/node-for-diagnostic.ts
3727
- function buildScopeIndex(view) {
3728
- const byModuleKey = /* @__PURE__ */ new Map();
3729
- const known = /* @__PURE__ */ new Set();
3730
- for (const n of view.nodes) known.add(n.id);
3731
- for (const g of view.groups) {
3732
- known.add(g.id);
3733
- if (g.module_key) {
3734
- const ids = byModuleKey.get(g.module_key);
3735
- if (ids) ids.push(g.id);
3736
- else byModuleKey.set(g.module_key, [g.id]);
3641
+ if (message.kind !== 0) {
3642
+ writer.uint32(24).int32(message.kind);
3737
3643
  }
3738
- }
3739
- return { byModuleKey, known };
3740
- }
3741
- function nodeIdForDiagnostic(view, diagnostic) {
3742
- if (diagnostic.address) return nodeIdForAddress(view, diagnostic.address);
3743
- if (!diagnostic.instance_id) return null;
3744
- const index = buildScopeIndex(view);
3745
- const scopeIds = diagnostic.module_key ? index.byModuleKey.get(diagnostic.module_key) : void 0;
3746
- if (!scopeIds || scopeIds.length === 0) {
3747
- return index.known.has(diagnostic.instance_id) ? diagnostic.instance_id : null;
3748
- }
3749
- if (scopeIds.length > 1) return null;
3750
- const nodeId = `${scopeIds[0]}.${diagnostic.instance_id}`;
3751
- return index.known.has(nodeId) ? nodeId : null;
3752
- }
3753
-
3754
- // src/projection/geometry.ts
3755
- var NODE_WIDTH = 200;
3756
- var NODE_HEADER_HEIGHT = 28;
3757
- var NODE_ROW_HEIGHT = 22;
3758
- var GROUP_PADDING = { x: 40, top: 60, bottom: 20 };
3759
- var GROUP_HEADER_HEIGHT = 32;
3760
- var COLLAPSED_GROUP_WIDTH = 220;
3761
- function visibleInputs(inputs) {
3762
- return inputs.filter((pin) => pin.required || pin.wired);
3763
- }
3764
- function nodeRows(node) {
3765
- const shown = visibleInputs(node.inputs);
3766
- const folded = node.inputs.length > shown.length ? 1 : 0;
3767
- return Math.max(shown.length + folded, node.outputs.length);
3768
- }
3769
- function nodeSize(node) {
3770
- return { width: NODE_WIDTH, height: NODE_HEADER_HEIGHT + nodeRows(node) * NODE_ROW_HEIGHT };
3771
- }
3772
- function inputPinY(node, name) {
3773
- const row = visibleInputs(node.inputs).findIndex((pin) => pin.name === name);
3774
- return row < 0 ? NODE_HEADER_HEIGHT / 2 : NODE_HEADER_HEIGHT + (row + 0.5) * NODE_ROW_HEIGHT;
3775
- }
3776
- function extentOf(rects) {
3777
- if (rects.length === 0) return { x: 0, y: 0, width: 0, height: 0 };
3778
- const x = Math.min(...rects.map((r) => r.x));
3779
- const y = Math.min(...rects.map((r) => r.y));
3780
- return {
3781
- x,
3782
- y,
3783
- width: Math.max(...rects.map((r) => r.x + r.width)) - x,
3784
- height: Math.max(...rects.map((r) => r.y + r.height)) - y
3785
- };
3786
- }
3787
- function groupBoxSize(content) {
3788
- return {
3789
- width: content.width + 2 * GROUP_PADDING.x,
3790
- height: GROUP_PADDING.top + content.height + GROUP_PADDING.bottom
3791
- };
3792
- }
3793
- function collapsedGroupSize(pins) {
3794
- const rows = Math.max(pins.inputs?.length ?? 0, pins.outputs?.length ?? 0);
3795
- return { width: COLLAPSED_GROUP_WIDTH, height: GROUP_HEADER_HEIGHT + rows * NODE_ROW_HEIGHT };
3796
- }
3797
- function groupPinY(row) {
3798
- return GROUP_HEADER_HEIGHT + (row + 0.5) * NODE_ROW_HEIGHT;
3799
- }
3800
- function groupInputPinY(group, name) {
3801
- const row = (group.inputs ?? []).findIndex((pin) => pin.name === name);
3802
- return row < 0 ? GROUP_HEADER_HEIGHT / 2 : groupPinY(row);
3803
- }
3804
- function groupFootprint(group, box) {
3805
- return group.collapsed ? collapsedGroupSize(group) : box;
3806
- }
3807
- function groupReach(pins, box) {
3808
- const card = collapsedGroupSize(pins);
3809
- return { width: Math.max(card.width, box.width), height: Math.max(card.height, box.height) };
3810
- }
3811
-
3812
- // src/projection/frames.ts
3813
- var ZERO = { x: 0, y: 0 };
3814
- function boxAt(origin, min = ZERO) {
3815
- return { x: origin.x + min.x - GROUP_PADDING.x, y: origin.y + min.y - GROUP_PADDING.top };
3816
- }
3817
- function originAt(box, min = ZERO) {
3818
- return { x: box.x - min.x + GROUP_PADDING.x, y: box.y - min.y + GROUP_PADDING.top };
3819
- }
3820
- function drawnAt(view, canvasPath) {
3821
- return view.nodes.find((n) => n.id === canvasPath)?.position ?? view.groups.find((g) => g.id === canvasPath)?.position;
3822
- }
3823
- function drawnRect(view, canvasPath) {
3824
- const node = view.nodes.find((n) => n.id === canvasPath);
3825
- if (node) return { ...node.position, ...nodeSize(node) };
3826
- const group = view.groups.find((g) => g.id === canvasPath);
3827
- return group ? { ...group.position, ...groupFootprint(group, group.size) } : void 0;
3828
- }
3829
- function reachRect(view, canvasPath) {
3830
- const group = view.groups.find((g) => g.id === canvasPath);
3831
- if (!group) return drawnRect(view, canvasPath);
3832
- return { ...group.position, ...groupReach(group, group.size) };
3833
- }
3834
- function frameOf(view, canvasPath) {
3835
- const { parentPath } = splitPath(canvasPath);
3836
- if (parentPath === "") return ZERO;
3837
- return view.groups.find((g) => g.id === parentPath)?.origin ?? ZERO;
3838
- }
3839
- function localIn(view, canvasPath, drawn, frame = frameOf(view, canvasPath)) {
3840
- const group = view.groups.find((g) => g.id === canvasPath);
3841
- if (!group) return { x: drawn.x - frame.x, y: drawn.y - frame.y };
3842
- const anchor = boxAt(group.origin);
3843
- return {
3844
- x: drawn.x - (group.position.x - anchor.x) - frame.x,
3845
- y: drawn.y - (group.position.y - anchor.y) - frame.y
3846
- };
3847
- }
3848
-
3849
- // src/projection/parse-module-key.ts
3850
- function parseModuleKey(key) {
3851
- const at = key.lastIndexOf("@");
3852
- if (at < 0) return { id: key, version: "" };
3853
- return { id: key.slice(0, at), version: key.slice(at + 1) };
3854
- }
3855
-
3856
- // src/projection/classify-child.ts
3857
- function isGroupUse(bundle, use) {
3858
- const target = bundle.modules[use.module];
3859
- if (!target) return false;
3860
- return (target.modules?.length ?? 0) > 0;
3861
- }
3862
-
3863
- // src/projection/compute-layout.ts
3864
- var SPACING_X = 260;
3865
- var SPACING_Y = 180;
3866
- var GAP_X = 60;
3867
- var GAP_Y = 40;
3868
- var ORDINARY = { width: NODE_WIDTH, height: SPACING_Y - GAP_Y };
3869
- function slotOf(size) {
3870
- return {
3871
- width: Math.max(SPACING_X, size.width + GAP_X),
3872
- height: Math.max(SPACING_Y, size.height + GAP_Y)
3873
- };
3874
- }
3875
- function overlaps(a, b) {
3876
- return a.x < b.x + b.width && a.x + a.width > b.x && a.y < b.y + b.height && a.y + a.height > b.y;
3877
- }
3878
- function stepDown(at, size, taken) {
3879
- let candidate = at;
3880
- const blocking = () => taken.filter((r) => overlaps({ ...candidate, ...size }, r));
3881
- for (let inWay = blocking(); inWay.length > 0; inWay = blocking()) {
3882
- candidate = { x: candidate.x, y: Math.max(...inWay.map((r) => r.y + r.height)) };
3883
- }
3884
- return candidate;
3885
- }
3886
- function keepOrder(a, b) {
3887
- return a.y - b.y || a.x - b.x || a.declared - b.declared;
3888
- }
3889
- function freeSlot(extent, occupied) {
3890
- return stepDown(
3891
- { x: 0, y: 0 },
3892
- slotOf(extent),
3893
- occupied.map((r) => ({ x: r.x, y: r.y, ...slotOf(r) }))
3894
- );
3895
- }
3896
- function resolveScopePositionsByDepth(ids, arrangementNodes, edges) {
3897
- const stored = /* @__PURE__ */ new Map();
3898
- for (const id of ids) {
3899
- const at = arrangementNodes?.[id];
3900
- if (at) stored.set(id, at);
3901
- }
3902
- return layoutByDepth(
3903
- ids.map((id) => ({ id, size: ORDINARY })),
3904
- stored,
3905
- edges
3906
- );
3907
- }
3908
- function layoutByDepth(items, stored, edges) {
3909
- const byId = new Map(items.map((item) => [item.id, item]));
3910
- const ids = items.map((item) => item.id);
3911
- const slots = new Map(items.map((item) => [item.id, slotOf(item.size)]));
3912
- const slotOfId = (id) => slots.get(id) ?? slotOf(ORDINARY);
3913
- const declared = new Map(ids.map((id, i) => [id, i]));
3914
- const keyOf = (id, at) => ({ ...at, declared: declared.get(id) ?? 0 });
3915
- const inOrder = [...stored].sort(([p, a], [q, b]) => keepOrder(keyOf(p, a), keyOf(q, b)));
3916
- const kept = /* @__PURE__ */ new Map();
3917
- const keptRects = [];
3918
- const keptSlots = [];
3919
- for (const [id, wanted] of inOrder) {
3920
- const item = byId.get(id);
3921
- if (!item) continue;
3922
- const slot = slotOfId(id);
3923
- const clear = !keptRects.some((r) => overlaps({ ...wanted, ...item.size }, r));
3924
- const at = clear ? wanted : stepDown(wanted, slot, keptSlots);
3925
- kept.set(id, at);
3926
- keptRects.push({ ...at, ...item.size });
3927
- keptSlots.push({ ...at, ...slot });
3928
- }
3929
- const columns = columnByDepth(ids, edges);
3930
- const columnX = /* @__PURE__ */ new Map();
3931
- {
3932
- const widths = /* @__PURE__ */ new Map();
3933
- for (const id of ids) {
3934
- const c = columns.get(id) ?? 0;
3935
- widths.set(c, Math.max(widths.get(c) ?? SPACING_X, slotOfId(id).width));
3644
+ if (message.module_key !== "") {
3645
+ writer.uint32(34).string(message.module_key);
3936
3646
  }
3937
- const last = Math.max(0, ...widths.keys());
3938
- let x = 0;
3939
- for (let c = 0; c <= last; c += 1) {
3940
- columnX.set(c, x);
3941
- x += widths.get(c) ?? SPACING_X;
3647
+ if (message.icon_url !== "") {
3648
+ writer.uint32(42).string(message.icon_url);
3942
3649
  }
3943
- }
3944
- const feeders = /* @__PURE__ */ new Map();
3945
- const fed = /* @__PURE__ */ new Map();
3946
- for (const edge of edges) {
3947
- if (edge.source_instance === edge.target_instance) continue;
3948
- if (!byId.has(edge.source_instance) || !byId.has(edge.target_instance)) continue;
3949
- feeders.set(edge.target_instance, [
3950
- ...feeders.get(edge.target_instance) ?? [],
3951
- edge.source_instance
3952
- ]);
3953
- fed.set(edge.source_instance, [...fed.get(edge.source_instance) ?? [], edge]);
3954
- }
3955
- const byColumn = /* @__PURE__ */ new Map();
3956
- for (const id of ids) {
3957
- if (kept.has(id)) continue;
3958
- const column = columns.get(id) ?? 0;
3959
- byColumn.set(column, [...byColumn.get(column) ?? [], id]);
3960
- }
3961
- const heightOf = (id) => byId.get(id)?.size.height ?? 0;
3962
- const mean = (values) => values.reduce((sum, v) => sum + v, 0) / values.length;
3963
- const place = (unfedOrder2) => {
3964
- const rank = new Map(unfedOrder2.map((id, i) => [id, i]));
3965
- const positions = new Map(kept);
3966
- const taken = [...keptSlots];
3967
- for (const column of [...byColumn.keys()].sort((p, q) => p - q)) {
3968
- const members = [...byColumn.get(column) ?? []].sort(
3969
- (p, q) => (rank.get(p) ?? 0) - (rank.get(q) ?? 0)
3970
- );
3971
- const tops = /* @__PURE__ */ new Map();
3972
- let stacked = 0;
3973
- for (const id of members) {
3974
- const from = (feeders.get(id) ?? []).flatMap((f) => {
3975
- const at = positions.get(f);
3976
- return at ? [at.y + heightOf(f) / 2] : [];
3977
- });
3978
- if (from.length > 0) {
3979
- tops.set(id, mean(from) - heightOf(id) / 2);
3980
- } else {
3981
- tops.set(id, stacked);
3982
- stacked += slotOfId(id).height;
3983
- }
3984
- }
3985
- const sorted = [...members].sort((p, q) => (tops.get(p) ?? 0) - (tops.get(q) ?? 0));
3986
- if (sorted.length > 1) {
3987
- const offsets = [];
3988
- let run = 0;
3989
- for (const id of sorted) {
3990
- offsets.push(run);
3991
- run += slotOfId(id).height;
3992
- }
3993
- const first = mean(sorted.map((id) => tops.get(id) ?? 0)) - mean(offsets);
3994
- for (const [i, id] of sorted.entries()) tops.set(id, first + offsets[i]);
3995
- }
3996
- const x = columnX.get(column) ?? 0;
3997
- for (const id of sorted) {
3998
- const slot = slotOfId(id);
3999
- const at = stepDown({ x, y: tops.get(id) ?? 0 }, slot, taken);
4000
- positions.set(id, at);
4001
- taken.push({ ...at, ...slot });
4002
- }
3650
+ if (message.position !== void 0) {
3651
+ Position.encode(message.position, writer.uint32(50).fork()).join();
4003
3652
  }
4004
- return positions;
4005
- };
4006
- const provisional = place(ids);
4007
- const landing = (id) => {
4008
- const out = fed.get(id) ?? [];
4009
- const at = provisional.get(id);
4010
- if (out.length === 0) return (at?.y ?? 0) + slotOfId(id).height / 2;
4011
- const ys = out.map((edge) => {
4012
- const target = byId.get(edge.target_instance);
4013
- const top = provisional.get(edge.target_instance)?.y ?? 0;
4014
- const pin = target?.pinY && edge.to_input !== void 0 ? target.pinY(edge.to_input) : 0;
4015
- return top + pin;
4016
- });
4017
- return mean(ys);
4018
- };
4019
- const unfedOrder = [...ids].sort(
4020
- (p, q) => landing(p) - landing(q) || (declared.get(p) ?? 0) - (declared.get(q) ?? 0)
4021
- );
4022
- return place(unfedOrder);
4023
- }
4024
- function columnByDepth(ids, edges) {
4025
- const present = new Set(ids);
4026
- const real = edges.filter(
4027
- (e) => e.source_instance !== e.target_instance && present.has(e.source_instance) && present.has(e.target_instance)
4028
- );
4029
- const depth = new Map(ids.map((id) => [id, 0]));
4030
- for (let round = 0; round < ids.length; round += 1) {
4031
- let moved = false;
4032
- for (const e of real) {
4033
- const want = (depth.get(e.source_instance) ?? 0) + 1;
4034
- if (want > (depth.get(e.target_instance) ?? 0)) {
4035
- depth.set(e.target_instance, want);
4036
- moved = true;
3653
+ for (const v of message.inputs) {
3654
+ NodePin.encode(v, writer.uint32(74).fork()).join();
3655
+ }
3656
+ for (const v of message.outputs) {
3657
+ NodePin.encode(v, writer.uint32(82).fork()).join();
3658
+ }
3659
+ return writer;
3660
+ },
3661
+ decode(input, length) {
3662
+ const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
3663
+ const end = length === void 0 ? reader.len : reader.pos + length;
3664
+ const message = createBaseRenderNode();
3665
+ while (reader.pos < end) {
3666
+ const tag = reader.uint32();
3667
+ switch (tag >>> 3) {
3668
+ case 1: {
3669
+ if (tag !== 10) {
3670
+ break;
3671
+ }
3672
+ message.id = reader.string();
3673
+ continue;
3674
+ }
3675
+ case 2: {
3676
+ if (tag !== 18) {
3677
+ break;
3678
+ }
3679
+ message.label = reader.string();
3680
+ continue;
3681
+ }
3682
+ case 3: {
3683
+ if (tag !== 24) {
3684
+ break;
3685
+ }
3686
+ message.kind = reader.int32();
3687
+ continue;
3688
+ }
3689
+ case 4: {
3690
+ if (tag !== 34) {
3691
+ break;
3692
+ }
3693
+ message.module_key = reader.string();
3694
+ continue;
3695
+ }
3696
+ case 5: {
3697
+ if (tag !== 42) {
3698
+ break;
3699
+ }
3700
+ message.icon_url = reader.string();
3701
+ continue;
3702
+ }
3703
+ case 6: {
3704
+ if (tag !== 50) {
3705
+ break;
3706
+ }
3707
+ message.position = Position.decode(reader, reader.uint32());
3708
+ continue;
3709
+ }
3710
+ case 9: {
3711
+ if (tag !== 74) {
3712
+ break;
3713
+ }
3714
+ message.inputs.push(NodePin.decode(reader, reader.uint32()));
3715
+ continue;
3716
+ }
3717
+ case 10: {
3718
+ if (tag !== 82) {
3719
+ break;
3720
+ }
3721
+ message.outputs.push(NodePin.decode(reader, reader.uint32()));
3722
+ continue;
3723
+ }
3724
+ }
3725
+ if ((tag & 7) === 4 || tag === 0) {
3726
+ break;
4037
3727
  }
3728
+ reader.skip(tag & 7);
4038
3729
  }
4039
- if (!moved) break;
3730
+ return message;
3731
+ },
3732
+ fromJSON(object) {
3733
+ return {
3734
+ id: isSet3(object.id) ? globalThis.String(object.id) : "",
3735
+ label: isSet3(object.label) ? globalThis.String(object.label) : "",
3736
+ kind: isSet3(object.kind) ? nodeKindFromJSON(object.kind) : 0,
3737
+ module_key: isSet3(object.moduleKey) ? globalThis.String(object.moduleKey) : isSet3(object.module_key) ? globalThis.String(object.module_key) : "",
3738
+ icon_url: isSet3(object.iconUrl) ? globalThis.String(object.iconUrl) : isSet3(object.icon_url) ? globalThis.String(object.icon_url) : "",
3739
+ position: isSet3(object.position) ? Position.fromJSON(object.position) : void 0,
3740
+ inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => NodePin.fromJSON(e)) : [],
3741
+ outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e) => NodePin.fromJSON(e)) : []
3742
+ };
3743
+ },
3744
+ toJSON(message) {
3745
+ const obj = {};
3746
+ if (message.id !== "") {
3747
+ obj.id = message.id;
3748
+ }
3749
+ if (message.label !== "") {
3750
+ obj.label = message.label;
3751
+ }
3752
+ if (message.kind !== 0) {
3753
+ obj.kind = nodeKindToJSON(message.kind);
3754
+ }
3755
+ if (message.module_key !== "") {
3756
+ obj.moduleKey = message.module_key;
3757
+ }
3758
+ if (message.icon_url !== "") {
3759
+ obj.iconUrl = message.icon_url;
3760
+ }
3761
+ if (message.position !== void 0) {
3762
+ obj.position = Position.toJSON(message.position);
3763
+ }
3764
+ if (message.inputs?.length) {
3765
+ obj.inputs = message.inputs.map((e) => NodePin.toJSON(e));
3766
+ }
3767
+ if (message.outputs?.length) {
3768
+ obj.outputs = message.outputs.map((e) => NodePin.toJSON(e));
3769
+ }
3770
+ return obj;
3771
+ },
3772
+ create(base) {
3773
+ return RenderNode.fromPartial(base ?? {});
3774
+ },
3775
+ fromPartial(object) {
3776
+ const message = createBaseRenderNode();
3777
+ message.id = object.id ?? "";
3778
+ message.label = object.label ?? "";
3779
+ message.kind = object.kind ?? 0;
3780
+ message.module_key = object.module_key ?? "";
3781
+ message.icon_url = object.icon_url ?? "";
3782
+ message.position = object.position !== void 0 && object.position !== null ? Position.fromPartial(object.position) : void 0;
3783
+ message.inputs = object.inputs?.map((e) => NodePin.fromPartial(e)) || [];
3784
+ message.outputs = object.outputs?.map((e) => NodePin.fromPartial(e)) || [];
3785
+ return message;
4040
3786
  }
4041
- return depth;
4042
- }
4043
-
4044
- // src/projection/project-group.ts
4045
- function projectGroup(use, target, fullId, parentArrangement, wiredIn, wiredOut) {
4046
- const childIds = (target.modules ?? []).map((u) => joinPath(fullId, u.id));
4047
- const parentGroup = parentArrangement?.groups?.[use.id];
4048
- const collapsed = parentGroup ? parentGroup.collapsed : true;
4049
- return {
4050
- id: fullId,
4051
- label: use.id,
4052
- node_ids: childIds,
4053
- collapsed,
4054
- module_key: use.module,
4055
- ...groupPins(target),
4056
- ...callWires(wiredIn, wiredOut)
4057
- };
4058
- }
4059
- function groupPins(target) {
4060
- return {
4061
- inputs: (target.interface?.inputs ?? []).map((in_) => ({
4062
- name: in_.name,
4063
- type: in_.type,
4064
- required: in_.required,
4065
- description: in_.description
4066
- })),
4067
- outputs: (target.interface?.outputs ?? []).map((out) => ({
4068
- name: out.name,
4069
- type: out.type,
4070
- description: out.description,
4071
- sensitive: out.sensitive
4072
- }))
4073
- };
4074
- }
4075
-
4076
- // src/projection/project-node.ts
4077
- function projectNode(bundle, use, fullId, wiredIn, wiredOut) {
4078
- const schema = resolveSchema(bundle, use, wiredOut);
4079
- return {
4080
- id: fullId,
4081
- label: use.id,
4082
- kind: "module",
4083
- module_key: use.module,
4084
- inputs: schema.inputs.map((in_) => ({
4085
- name: in_.name,
4086
- type: in_.type,
4087
- required: in_.required,
4088
- wired: wiredIn.has(in_.name),
4089
- description: in_.description
4090
- })),
4091
- outputs: schema.outputs.map((out) => ({
4092
- name: out.name,
4093
- type: out.type,
4094
- wired: wiredOut.has(out.name),
4095
- description: out.description,
4096
- sensitive: out.sensitive
4097
- })),
4098
- ...callWires(wiredIn, wiredOut)
4099
- };
3787
+ };
3788
+ function createBaseNodePin() {
3789
+ return { name: "", type: "", required: false, wired: false, description: "", sensitive: false };
4100
3790
  }
4101
-
4102
- // src/projection/project-scope.ts
4103
- function projectScope(bundle, mod, use, path, arrangement, children) {
4104
- const uses = mod.modules ?? [];
4105
- const derived = deriveEdges(uses);
4106
- const { inputs: wiredIn, outputs: wiredOut } = indexWires(derived);
4107
- const scopeArrangement = arrangement?.[use ? use.module : bundle.entry];
4108
- const cards = [];
4109
- const groups = [];
4110
- const items = [];
4111
- const boxMin = /* @__PURE__ */ new Map();
4112
- for (const child of uses) {
4113
- const fullId = joinPath(path, child.id);
4114
- if (isGroupUse(bundle, child)) {
4115
- const group = projectGroup(
4116
- child,
4117
- bundle.modules[child.module],
4118
- fullId,
4119
- scopeArrangement,
4120
- wiredIn.get(child.id) ?? /* @__PURE__ */ new Set(),
4121
- wiredOut.get(child.id) ?? /* @__PURE__ */ new Set()
4122
- );
4123
- const content = children.get(fullId);
4124
- if (!content) throw new Error(`projectScope: no layout for group "${fullId}"`);
4125
- groups.push(group);
4126
- boxMin.set(child.id, content.min);
4127
- items.push({
4128
- id: child.id,
4129
- size: groupFootprint(group, content.box),
4130
- pinY: (input) => groupInputPinY(group, input)
4131
- });
4132
- continue;
3791
+ var NodePin = {
3792
+ encode(message, writer = new BinaryWriter3()) {
3793
+ if (message.name !== "") {
3794
+ writer.uint32(10).string(message.name);
4133
3795
  }
4134
- const node = projectNode(
4135
- bundle,
4136
- child,
4137
- fullId,
4138
- wiredIn.get(child.id) ?? /* @__PURE__ */ new Set(),
4139
- wiredOut.get(child.id) ?? /* @__PURE__ */ new Set()
4140
- );
4141
- cards.push(node);
4142
- items.push({ id: child.id, size: nodeSize(node), pinY: (input) => inputPinY(node, input) });
4143
- }
4144
- const stored = /* @__PURE__ */ new Map();
4145
- for (const child of uses) {
4146
- const at = scopeArrangement?.nodes?.[child.id];
4147
- if (!at) continue;
4148
- const min = boxMin.get(child.id);
4149
- stored.set(child.id, min ? boxAt(originAt(at), min) : at);
4150
- }
4151
- const local = layoutByDepth(items, stored, derived);
4152
- const placedAt = (useId) => {
4153
- const at = local.get(useId);
4154
- if (!at) throw new Error(`projectScope: no position for "${joinPath(path, useId)}"`);
4155
- return at;
4156
- };
4157
- const nodes = cards.map((card) => ({ ...card, position: placedAt(splitPath(card.id).localId) }));
4158
- const extent = extentOf([
4159
- { x: 0, y: 0, width: 0, height: 0 },
4160
- ...items.map((item) => ({ ...placedAt(item.id), ...item.size }))
4161
- ]);
4162
- const edges = derived.map((de) => {
4163
- const sourceId = joinPath(path, de.source_instance);
4164
- const targetId = joinPath(path, de.target_instance);
4165
- return {
4166
- id: `${sourceId}-${targetId}-${de.from_output}-${de.to_input}`,
4167
- source: sourceId,
4168
- target: targetId,
4169
- source_output: de.from_output,
4170
- target_input: de.to_input
4171
- };
4172
- });
4173
- return {
4174
- nodes,
4175
- groups,
4176
- edges,
4177
- local,
4178
- min: { x: extent.x, y: extent.y },
4179
- box: groupBoxSize(extent)
4180
- };
4181
- }
4182
-
4183
- // src/projection/walk-modules.ts
4184
- function walk(bundle, visit) {
4185
- if (!bundle) return;
4186
- const entry = bundle.modules[bundle.entry];
4187
- if (!entry) return;
4188
- walkFrom(bundle, entry, null, "", visit);
4189
- }
4190
- function walkFrom(bundle, mod, use, path, visit) {
4191
- visit(mod, use, path);
4192
- for (const u of mod.modules ?? []) {
4193
- const child = bundle.modules[u.module];
4194
- if (!child) continue;
4195
- walkFrom(bundle, child, u, joinPath(path, u.id), visit);
4196
- }
4197
- }
4198
-
4199
- // src/projection/project.ts
4200
- var EMPTY_BUNDLE = Bundle.fromPartial({
4201
- entry: "root@v1",
4202
- modules: { "root@v1": { id: "root", version: "v1.0.0" } }
4203
- });
4204
- function projectCanvasView(bundle, arrangement, meta) {
4205
- const scopes = [];
4206
- walk(bundle, (mod, use, path) => {
4207
- scopes.push({ mod, use, path });
4208
- });
4209
- const layouts = /* @__PURE__ */ new Map();
4210
- for (const { mod, use, path } of [...scopes].reverse()) {
4211
- layouts.set(path, projectScope(bundle, mod, use, path, arrangement, layouts));
4212
- }
4213
- const nodes = [];
4214
- const edges = [];
4215
- const groups = [];
4216
- const origins = /* @__PURE__ */ new Map([["", { x: 0, y: 0 }]]);
4217
- for (const { path } of scopes) {
4218
- const layout = layouts.get(path);
4219
- const origin = origins.get(path);
4220
- if (!layout || !origin) continue;
4221
- const at = (local) => ({ x: origin.x + local.x, y: origin.y + local.y });
4222
- for (const node of layout.nodes) nodes.push({ ...node, position: at(node.position) });
4223
- for (const group of layout.groups) {
4224
- const content = layouts.get(group.id);
4225
- const box = layout.local.get(splitPath(group.id).localId);
4226
- if (!content || !box)
4227
- throw new Error(`projectCanvasView: group "${group.id}" was not laid out`);
4228
- const position = at(box);
4229
- const membersAt = originAt(position, content.min);
4230
- origins.set(group.id, membersAt);
4231
- groups.push({ ...group, position, size: content.box, origin: membersAt });
4232
- }
4233
- edges.push(...layout.edges);
4234
- }
4235
- const moduleName = meta.moduleName ?? parseModuleKey(bundle.entry).id;
4236
- return {
4237
- module_name: moduleName,
4238
- nodes,
4239
- edges,
4240
- can_undo: meta.canUndo,
4241
- can_redo: meta.canRedo,
4242
- unsaved: meta.unsaved,
4243
- conflict: meta.conflict,
4244
- ungenerated: meta.ungenerated ?? false,
4245
- // Every group is a Use whose target has sub-Uses (CreateGroupAction
4246
- // mints a module); emission order already mirrors Use declaration order
4247
- // via the walk, so no separate user-group sort is needed.
4248
- groups
4249
- };
4250
- }
4251
-
4252
- // src/generated/service.ts
4253
- import { BinaryReader as BinaryReader3, BinaryWriter as BinaryWriter3 } from "@bufbuild/protobuf/wire";
4254
- function nodeKindFromJSON(object) {
4255
- switch (object) {
4256
- case 0:
4257
- case "NODE_KIND_UNSPECIFIED":
4258
- return 0 /* NODE_KIND_UNSPECIFIED */;
4259
- case 1:
4260
- case "NODE_KIND_MODULE":
4261
- return 1 /* NODE_KIND_MODULE */;
4262
- case 2:
4263
- case "NODE_KIND_RESOURCE":
4264
- return 2 /* NODE_KIND_RESOURCE */;
4265
- case 3:
4266
- case "NODE_KIND_DATA":
4267
- return 3 /* NODE_KIND_DATA */;
4268
- case -1:
4269
- case "UNRECOGNIZED":
4270
- default:
4271
- return -1 /* UNRECOGNIZED */;
4272
- }
4273
- }
4274
- function nodeKindToJSON(object) {
4275
- switch (object) {
4276
- case 0 /* NODE_KIND_UNSPECIFIED */:
4277
- return "NODE_KIND_UNSPECIFIED";
4278
- case 1 /* NODE_KIND_MODULE */:
4279
- return "NODE_KIND_MODULE";
4280
- case 2 /* NODE_KIND_RESOURCE */:
4281
- return "NODE_KIND_RESOURCE";
4282
- case 3 /* NODE_KIND_DATA */:
4283
- return "NODE_KIND_DATA";
4284
- case -1 /* UNRECOGNIZED */:
4285
- default:
4286
- return "UNRECOGNIZED";
4287
- }
4288
- }
4289
- function createBaseCanvasView() {
4290
- return { module_name: "", nodes: [], edges: [], can_undo: false, can_redo: false, unsaved: false, groups: [] };
4291
- }
4292
- var CanvasView = {
4293
- encode(message, writer = new BinaryWriter3()) {
4294
- if (message.module_name !== "") {
4295
- writer.uint32(10).string(message.module_name);
4296
- }
4297
- for (const v of message.nodes) {
4298
- RenderNode.encode(v, writer.uint32(18).fork()).join();
4299
- }
4300
- for (const v of message.edges) {
4301
- RenderEdge.encode(v, writer.uint32(26).fork()).join();
3796
+ if (message.type !== "") {
3797
+ writer.uint32(18).string(message.type);
4302
3798
  }
4303
- if (message.can_undo !== false) {
4304
- writer.uint32(40).bool(message.can_undo);
3799
+ if (message.required !== false) {
3800
+ writer.uint32(24).bool(message.required);
4305
3801
  }
4306
- if (message.can_redo !== false) {
4307
- writer.uint32(48).bool(message.can_redo);
3802
+ if (message.wired !== false) {
3803
+ writer.uint32(32).bool(message.wired);
4308
3804
  }
4309
- if (message.unsaved !== false) {
4310
- writer.uint32(56).bool(message.unsaved);
3805
+ if (message.description !== "") {
3806
+ writer.uint32(42).string(message.description);
4311
3807
  }
4312
- for (const v of message.groups) {
4313
- RenderGroup.encode(v, writer.uint32(66).fork()).join();
3808
+ if (message.sensitive !== false) {
3809
+ writer.uint32(48).bool(message.sensitive);
4314
3810
  }
4315
3811
  return writer;
4316
3812
  },
4317
3813
  decode(input, length) {
4318
3814
  const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
4319
3815
  const end = length === void 0 ? reader.len : reader.pos + length;
4320
- const message = createBaseCanvasView();
3816
+ const message = createBaseNodePin();
4321
3817
  while (reader.pos < end) {
4322
3818
  const tag = reader.uint32();
4323
3819
  switch (tag >>> 3) {
@@ -4325,49 +3821,42 @@ var CanvasView = {
4325
3821
  if (tag !== 10) {
4326
3822
  break;
4327
3823
  }
4328
- message.module_name = reader.string();
3824
+ message.name = reader.string();
4329
3825
  continue;
4330
3826
  }
4331
3827
  case 2: {
4332
3828
  if (tag !== 18) {
4333
3829
  break;
4334
3830
  }
4335
- message.nodes.push(RenderNode.decode(reader, reader.uint32()));
3831
+ message.type = reader.string();
4336
3832
  continue;
4337
3833
  }
4338
3834
  case 3: {
4339
- if (tag !== 26) {
4340
- break;
4341
- }
4342
- message.edges.push(RenderEdge.decode(reader, reader.uint32()));
4343
- continue;
4344
- }
4345
- case 5: {
4346
- if (tag !== 40) {
3835
+ if (tag !== 24) {
4347
3836
  break;
4348
3837
  }
4349
- message.can_undo = reader.bool();
3838
+ message.required = reader.bool();
4350
3839
  continue;
4351
3840
  }
4352
- case 6: {
4353
- if (tag !== 48) {
3841
+ case 4: {
3842
+ if (tag !== 32) {
4354
3843
  break;
4355
3844
  }
4356
- message.can_redo = reader.bool();
3845
+ message.wired = reader.bool();
4357
3846
  continue;
4358
3847
  }
4359
- case 7: {
4360
- if (tag !== 56) {
3848
+ case 5: {
3849
+ if (tag !== 42) {
4361
3850
  break;
4362
3851
  }
4363
- message.unsaved = reader.bool();
3852
+ message.description = reader.string();
4364
3853
  continue;
4365
3854
  }
4366
- case 8: {
4367
- if (tag !== 66) {
3855
+ case 6: {
3856
+ if (tag !== 48) {
4368
3857
  break;
4369
3858
  }
4370
- message.groups.push(RenderGroup.decode(reader, reader.uint32()));
3859
+ message.sensitive = reader.bool();
4371
3860
  continue;
4372
3861
  }
4373
3862
  }
@@ -4380,87 +3869,76 @@ var CanvasView = {
4380
3869
  },
4381
3870
  fromJSON(object) {
4382
3871
  return {
4383
- module_name: isSet3(object.moduleName) ? globalThis.String(object.moduleName) : isSet3(object.module_name) ? globalThis.String(object.module_name) : "",
4384
- nodes: globalThis.Array.isArray(object?.nodes) ? object.nodes.map((e) => RenderNode.fromJSON(e)) : [],
4385
- edges: globalThis.Array.isArray(object?.edges) ? object.edges.map((e) => RenderEdge.fromJSON(e)) : [],
4386
- can_undo: isSet3(object.canUndo) ? globalThis.Boolean(object.canUndo) : isSet3(object.can_undo) ? globalThis.Boolean(object.can_undo) : false,
4387
- can_redo: isSet3(object.canRedo) ? globalThis.Boolean(object.canRedo) : isSet3(object.can_redo) ? globalThis.Boolean(object.can_redo) : false,
4388
- unsaved: isSet3(object.unsaved) ? globalThis.Boolean(object.unsaved) : false,
4389
- groups: globalThis.Array.isArray(object?.groups) ? object.groups.map((e) => RenderGroup.fromJSON(e)) : []
3872
+ name: isSet3(object.name) ? globalThis.String(object.name) : "",
3873
+ type: isSet3(object.type) ? globalThis.String(object.type) : "",
3874
+ required: isSet3(object.required) ? globalThis.Boolean(object.required) : false,
3875
+ wired: isSet3(object.wired) ? globalThis.Boolean(object.wired) : false,
3876
+ description: isSet3(object.description) ? globalThis.String(object.description) : "",
3877
+ sensitive: isSet3(object.sensitive) ? globalThis.Boolean(object.sensitive) : false
4390
3878
  };
4391
3879
  },
4392
3880
  toJSON(message) {
4393
3881
  const obj = {};
4394
- if (message.module_name !== "") {
4395
- obj.moduleName = message.module_name;
3882
+ if (message.name !== "") {
3883
+ obj.name = message.name;
4396
3884
  }
4397
- if (message.nodes?.length) {
4398
- obj.nodes = message.nodes.map((e) => RenderNode.toJSON(e));
3885
+ if (message.type !== "") {
3886
+ obj.type = message.type;
4399
3887
  }
4400
- if (message.edges?.length) {
4401
- obj.edges = message.edges.map((e) => RenderEdge.toJSON(e));
3888
+ if (message.required !== false) {
3889
+ obj.required = message.required;
4402
3890
  }
4403
- if (message.can_undo !== false) {
4404
- obj.canUndo = message.can_undo;
3891
+ if (message.wired !== false) {
3892
+ obj.wired = message.wired;
4405
3893
  }
4406
- if (message.can_redo !== false) {
4407
- obj.canRedo = message.can_redo;
3894
+ if (message.description !== "") {
3895
+ obj.description = message.description;
4408
3896
  }
4409
- if (message.unsaved !== false) {
4410
- obj.unsaved = message.unsaved;
4411
- }
4412
- if (message.groups?.length) {
4413
- obj.groups = message.groups.map((e) => RenderGroup.toJSON(e));
3897
+ if (message.sensitive !== false) {
3898
+ obj.sensitive = message.sensitive;
4414
3899
  }
4415
3900
  return obj;
4416
3901
  },
4417
3902
  create(base) {
4418
- return CanvasView.fromPartial(base ?? {});
3903
+ return NodePin.fromPartial(base ?? {});
4419
3904
  },
4420
3905
  fromPartial(object) {
4421
- const message = createBaseCanvasView();
4422
- message.module_name = object.module_name ?? "";
4423
- message.nodes = object.nodes?.map((e) => RenderNode.fromPartial(e)) || [];
4424
- message.edges = object.edges?.map((e) => RenderEdge.fromPartial(e)) || [];
4425
- message.can_undo = object.can_undo ?? false;
4426
- message.can_redo = object.can_redo ?? false;
4427
- message.unsaved = object.unsaved ?? false;
4428
- message.groups = object.groups?.map((e) => RenderGroup.fromPartial(e)) || [];
3906
+ const message = createBaseNodePin();
3907
+ message.name = object.name ?? "";
3908
+ message.type = object.type ?? "";
3909
+ message.required = object.required ?? false;
3910
+ message.wired = object.wired ?? false;
3911
+ message.description = object.description ?? "";
3912
+ message.sensitive = object.sensitive ?? false;
4429
3913
  return message;
4430
3914
  }
4431
3915
  };
4432
- function createBaseRenderGroup() {
4433
- return { id: "", label: "", node_ids: [], collapsed: false, module_key: "", inputs: [], outputs: [] };
3916
+ function createBaseRenderEdge() {
3917
+ return { id: "", source: "", target: "", source_output: "", target_input: "" };
4434
3918
  }
4435
- var RenderGroup = {
3919
+ var RenderEdge = {
4436
3920
  encode(message, writer = new BinaryWriter3()) {
4437
3921
  if (message.id !== "") {
4438
3922
  writer.uint32(10).string(message.id);
4439
3923
  }
4440
- if (message.label !== "") {
4441
- writer.uint32(18).string(message.label);
4442
- }
4443
- for (const v of message.node_ids) {
4444
- writer.uint32(26).string(v);
4445
- }
4446
- if (message.collapsed !== false) {
4447
- writer.uint32(32).bool(message.collapsed);
3924
+ if (message.source !== "") {
3925
+ writer.uint32(18).string(message.source);
4448
3926
  }
4449
- if (message.module_key !== "") {
4450
- writer.uint32(42).string(message.module_key);
3927
+ if (message.target !== "") {
3928
+ writer.uint32(26).string(message.target);
4451
3929
  }
4452
- for (const v of message.inputs) {
4453
- NodePin.encode(v, writer.uint32(50).fork()).join();
3930
+ if (message.source_output !== "") {
3931
+ writer.uint32(34).string(message.source_output);
4454
3932
  }
4455
- for (const v of message.outputs) {
4456
- NodePin.encode(v, writer.uint32(58).fork()).join();
3933
+ if (message.target_input !== "") {
3934
+ writer.uint32(42).string(message.target_input);
4457
3935
  }
4458
3936
  return writer;
4459
3937
  },
4460
3938
  decode(input, length) {
4461
3939
  const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
4462
3940
  const end = length === void 0 ? reader.len : reader.pos + length;
4463
- const message = createBaseRenderGroup();
3941
+ const message = createBaseRenderEdge();
4464
3942
  while (reader.pos < end) {
4465
3943
  const tag = reader.uint32();
4466
3944
  switch (tag >>> 3) {
@@ -4475,42 +3953,28 @@ var RenderGroup = {
4475
3953
  if (tag !== 18) {
4476
3954
  break;
4477
3955
  }
4478
- message.label = reader.string();
3956
+ message.source = reader.string();
4479
3957
  continue;
4480
3958
  }
4481
3959
  case 3: {
4482
3960
  if (tag !== 26) {
4483
3961
  break;
4484
3962
  }
4485
- message.node_ids.push(reader.string());
3963
+ message.target = reader.string();
4486
3964
  continue;
4487
3965
  }
4488
3966
  case 4: {
4489
- if (tag !== 32) {
3967
+ if (tag !== 34) {
4490
3968
  break;
4491
3969
  }
4492
- message.collapsed = reader.bool();
3970
+ message.source_output = reader.string();
4493
3971
  continue;
4494
3972
  }
4495
3973
  case 5: {
4496
3974
  if (tag !== 42) {
4497
3975
  break;
4498
3976
  }
4499
- message.module_key = reader.string();
4500
- continue;
4501
- }
4502
- case 6: {
4503
- if (tag !== 50) {
4504
- break;
4505
- }
4506
- message.inputs.push(NodePin.decode(reader, reader.uint32()));
4507
- continue;
4508
- }
4509
- case 7: {
4510
- if (tag !== 58) {
4511
- break;
4512
- }
4513
- message.outputs.push(NodePin.decode(reader, reader.uint32()));
3977
+ message.target_input = reader.string();
4514
3978
  continue;
4515
3979
  }
4516
3980
  }
@@ -4524,12 +3988,10 @@ var RenderGroup = {
4524
3988
  fromJSON(object) {
4525
3989
  return {
4526
3990
  id: isSet3(object.id) ? globalThis.String(object.id) : "",
4527
- label: isSet3(object.label) ? globalThis.String(object.label) : "",
4528
- node_ids: globalThis.Array.isArray(object?.nodeIds) ? object.nodeIds.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.node_ids) ? object.node_ids.map((e) => globalThis.String(e)) : [],
4529
- collapsed: isSet3(object.collapsed) ? globalThis.Boolean(object.collapsed) : false,
4530
- module_key: isSet3(object.moduleKey) ? globalThis.String(object.moduleKey) : isSet3(object.module_key) ? globalThis.String(object.module_key) : "",
4531
- inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => NodePin.fromJSON(e)) : [],
4532
- outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e) => NodePin.fromJSON(e)) : []
3991
+ source: isSet3(object.source) ? globalThis.String(object.source) : "",
3992
+ target: isSet3(object.target) ? globalThis.String(object.target) : "",
3993
+ source_output: isSet3(object.sourceOutput) ? globalThis.String(object.sourceOutput) : isSet3(object.source_output) ? globalThis.String(object.source_output) : "",
3994
+ target_input: isSet3(object.targetInput) ? globalThis.String(object.targetInput) : isSet3(object.target_input) ? globalThis.String(object.target_input) : ""
4533
3995
  };
4534
3996
  },
4535
3997
  toJSON(message) {
@@ -4537,133 +3999,65 @@ var RenderGroup = {
4537
3999
  if (message.id !== "") {
4538
4000
  obj.id = message.id;
4539
4001
  }
4540
- if (message.label !== "") {
4541
- obj.label = message.label;
4542
- }
4543
- if (message.node_ids?.length) {
4544
- obj.nodeIds = message.node_ids;
4545
- }
4546
- if (message.collapsed !== false) {
4547
- obj.collapsed = message.collapsed;
4002
+ if (message.source !== "") {
4003
+ obj.source = message.source;
4548
4004
  }
4549
- if (message.module_key !== "") {
4550
- obj.moduleKey = message.module_key;
4005
+ if (message.target !== "") {
4006
+ obj.target = message.target;
4551
4007
  }
4552
- if (message.inputs?.length) {
4553
- obj.inputs = message.inputs.map((e) => NodePin.toJSON(e));
4008
+ if (message.source_output !== "") {
4009
+ obj.sourceOutput = message.source_output;
4554
4010
  }
4555
- if (message.outputs?.length) {
4556
- obj.outputs = message.outputs.map((e) => NodePin.toJSON(e));
4011
+ if (message.target_input !== "") {
4012
+ obj.targetInput = message.target_input;
4557
4013
  }
4558
4014
  return obj;
4559
4015
  },
4560
4016
  create(base) {
4561
- return RenderGroup.fromPartial(base ?? {});
4017
+ return RenderEdge.fromPartial(base ?? {});
4562
4018
  },
4563
4019
  fromPartial(object) {
4564
- const message = createBaseRenderGroup();
4020
+ const message = createBaseRenderEdge();
4565
4021
  message.id = object.id ?? "";
4566
- message.label = object.label ?? "";
4567
- message.node_ids = object.node_ids?.map((e) => e) || [];
4568
- message.collapsed = object.collapsed ?? false;
4569
- message.module_key = object.module_key ?? "";
4570
- message.inputs = object.inputs?.map((e) => NodePin.fromPartial(e)) || [];
4571
- message.outputs = object.outputs?.map((e) => NodePin.fromPartial(e)) || [];
4022
+ message.source = object.source ?? "";
4023
+ message.target = object.target ?? "";
4024
+ message.source_output = object.source_output ?? "";
4025
+ message.target_input = object.target_input ?? "";
4572
4026
  return message;
4573
4027
  }
4574
4028
  };
4575
- function createBaseRenderNode() {
4576
- return { id: "", label: "", kind: 0, module_key: "", icon_url: "", position: void 0, inputs: [], outputs: [] };
4029
+ function createBasePosition() {
4030
+ return { x: 0, y: 0 };
4577
4031
  }
4578
- var RenderNode = {
4032
+ var Position = {
4579
4033
  encode(message, writer = new BinaryWriter3()) {
4580
- if (message.id !== "") {
4581
- writer.uint32(10).string(message.id);
4582
- }
4583
- if (message.label !== "") {
4584
- writer.uint32(18).string(message.label);
4585
- }
4586
- if (message.kind !== 0) {
4587
- writer.uint32(24).int32(message.kind);
4588
- }
4589
- if (message.module_key !== "") {
4590
- writer.uint32(34).string(message.module_key);
4591
- }
4592
- if (message.icon_url !== "") {
4593
- writer.uint32(42).string(message.icon_url);
4594
- }
4595
- if (message.position !== void 0) {
4596
- Position.encode(message.position, writer.uint32(50).fork()).join();
4597
- }
4598
- for (const v of message.inputs) {
4599
- NodePin.encode(v, writer.uint32(74).fork()).join();
4034
+ if (message.x !== 0) {
4035
+ writer.uint32(9).double(message.x);
4600
4036
  }
4601
- for (const v of message.outputs) {
4602
- NodePin.encode(v, writer.uint32(82).fork()).join();
4037
+ if (message.y !== 0) {
4038
+ writer.uint32(17).double(message.y);
4603
4039
  }
4604
4040
  return writer;
4605
4041
  },
4606
4042
  decode(input, length) {
4607
4043
  const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
4608
4044
  const end = length === void 0 ? reader.len : reader.pos + length;
4609
- const message = createBaseRenderNode();
4045
+ const message = createBasePosition();
4610
4046
  while (reader.pos < end) {
4611
4047
  const tag = reader.uint32();
4612
4048
  switch (tag >>> 3) {
4613
4049
  case 1: {
4614
- if (tag !== 10) {
4050
+ if (tag !== 9) {
4615
4051
  break;
4616
4052
  }
4617
- message.id = reader.string();
4053
+ message.x = reader.double();
4618
4054
  continue;
4619
4055
  }
4620
4056
  case 2: {
4621
- if (tag !== 18) {
4622
- break;
4623
- }
4624
- message.label = reader.string();
4625
- continue;
4626
- }
4627
- case 3: {
4628
- if (tag !== 24) {
4629
- break;
4630
- }
4631
- message.kind = reader.int32();
4632
- continue;
4633
- }
4634
- case 4: {
4635
- if (tag !== 34) {
4636
- break;
4637
- }
4638
- message.module_key = reader.string();
4639
- continue;
4640
- }
4641
- case 5: {
4642
- if (tag !== 42) {
4643
- break;
4644
- }
4645
- message.icon_url = reader.string();
4646
- continue;
4647
- }
4648
- case 6: {
4649
- if (tag !== 50) {
4650
- break;
4651
- }
4652
- message.position = Position.decode(reader, reader.uint32());
4653
- continue;
4654
- }
4655
- case 9: {
4656
- if (tag !== 74) {
4657
- break;
4658
- }
4659
- message.inputs.push(NodePin.decode(reader, reader.uint32()));
4660
- continue;
4661
- }
4662
- case 10: {
4663
- if (tag !== 82) {
4057
+ if (tag !== 17) {
4664
4058
  break;
4665
4059
  }
4666
- message.outputs.push(NodePin.decode(reader, reader.uint32()));
4060
+ message.y = reader.double();
4667
4061
  continue;
4668
4062
  }
4669
4063
  }
@@ -4676,401 +4070,1020 @@ var RenderNode = {
4676
4070
  },
4677
4071
  fromJSON(object) {
4678
4072
  return {
4679
- id: isSet3(object.id) ? globalThis.String(object.id) : "",
4680
- label: isSet3(object.label) ? globalThis.String(object.label) : "",
4681
- kind: isSet3(object.kind) ? nodeKindFromJSON(object.kind) : 0,
4682
- module_key: isSet3(object.moduleKey) ? globalThis.String(object.moduleKey) : isSet3(object.module_key) ? globalThis.String(object.module_key) : "",
4683
- icon_url: isSet3(object.iconUrl) ? globalThis.String(object.iconUrl) : isSet3(object.icon_url) ? globalThis.String(object.icon_url) : "",
4684
- position: isSet3(object.position) ? Position.fromJSON(object.position) : void 0,
4685
- inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e) => NodePin.fromJSON(e)) : [],
4686
- outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e) => NodePin.fromJSON(e)) : []
4073
+ x: isSet3(object.x) ? globalThis.Number(object.x) : 0,
4074
+ y: isSet3(object.y) ? globalThis.Number(object.y) : 0
4687
4075
  };
4688
4076
  },
4689
4077
  toJSON(message) {
4690
4078
  const obj = {};
4691
- if (message.id !== "") {
4692
- obj.id = message.id;
4693
- }
4694
- if (message.label !== "") {
4695
- obj.label = message.label;
4696
- }
4697
- if (message.kind !== 0) {
4698
- obj.kind = nodeKindToJSON(message.kind);
4699
- }
4700
- if (message.module_key !== "") {
4701
- obj.moduleKey = message.module_key;
4702
- }
4703
- if (message.icon_url !== "") {
4704
- obj.iconUrl = message.icon_url;
4705
- }
4706
- if (message.position !== void 0) {
4707
- obj.position = Position.toJSON(message.position);
4708
- }
4709
- if (message.inputs?.length) {
4710
- obj.inputs = message.inputs.map((e) => NodePin.toJSON(e));
4079
+ if (message.x !== 0) {
4080
+ obj.x = message.x;
4711
4081
  }
4712
- if (message.outputs?.length) {
4713
- obj.outputs = message.outputs.map((e) => NodePin.toJSON(e));
4082
+ if (message.y !== 0) {
4083
+ obj.y = message.y;
4714
4084
  }
4715
4085
  return obj;
4716
4086
  },
4717
4087
  create(base) {
4718
- return RenderNode.fromPartial(base ?? {});
4088
+ return Position.fromPartial(base ?? {});
4719
4089
  },
4720
4090
  fromPartial(object) {
4721
- const message = createBaseRenderNode();
4722
- message.id = object.id ?? "";
4723
- message.label = object.label ?? "";
4724
- message.kind = object.kind ?? 0;
4725
- message.module_key = object.module_key ?? "";
4726
- message.icon_url = object.icon_url ?? "";
4727
- message.position = object.position !== void 0 && object.position !== null ? Position.fromPartial(object.position) : void 0;
4728
- message.inputs = object.inputs?.map((e) => NodePin.fromPartial(e)) || [];
4729
- message.outputs = object.outputs?.map((e) => NodePin.fromPartial(e)) || [];
4091
+ const message = createBasePosition();
4092
+ message.x = object.x ?? 0;
4093
+ message.y = object.y ?? 0;
4730
4094
  return message;
4731
4095
  }
4732
4096
  };
4733
- function createBaseNodePin() {
4734
- return { name: "", type: "", required: false, wired: false, description: "", sensitive: false };
4097
+ function isSet3(value) {
4098
+ return value !== null && value !== void 0;
4735
4099
  }
4736
- var NodePin = {
4737
- encode(message, writer = new BinaryWriter3()) {
4738
- if (message.name !== "") {
4739
- writer.uint32(10).string(message.name);
4740
- }
4741
- if (message.type !== "") {
4742
- writer.uint32(18).string(message.type);
4743
- }
4744
- if (message.required !== false) {
4745
- writer.uint32(24).bool(message.required);
4746
- }
4747
- if (message.wired !== false) {
4748
- writer.uint32(32).bool(message.wired);
4749
- }
4750
- if (message.description !== "") {
4751
- writer.uint32(42).string(message.description);
4100
+
4101
+ // src/engine-identity.ts
4102
+ var ENGINE_PROTOCOL_VERSION = String(9 /* PROTOCOL_VERSION_CURRENT */);
4103
+ var ENGINE_CONTRACT = GENERATED_ENGINE_CONTRACT;
4104
+ var EngineIdentityMismatchError = class extends Error {
4105
+ constructor(engine, required) {
4106
+ const behind = engine.protocol === required.protocol ? void 0 : Number(engine.protocol) < Number(required.protocol) ? "engine" : "host";
4107
+ super(mismatchMessage(engine, required, behind));
4108
+ this.name = "EngineIdentityMismatchError";
4109
+ this.engineVersion = engine.version;
4110
+ this.engineProtocol = engine.protocol;
4111
+ this.engineContract = engine.contract;
4112
+ this.requiredProtocol = required.protocol;
4113
+ this.requiredContract = required.contract;
4114
+ this.behind = behind;
4115
+ }
4116
+ };
4117
+ function mismatchMessage(engine, required, behind) {
4118
+ const protocols = `Lace engine ${engine.version} speaks protocol ${engine.protocol}; this host speaks protocol ${required.protocol}`;
4119
+ switch (behind) {
4120
+ case "engine":
4121
+ return `${protocols}: update the Lace CLI`;
4122
+ case "host":
4123
+ return `${protocols}: update this host`;
4124
+ case void 0:
4125
+ return `this host and Lace engine ${engine.version} were built from different trees of protocol ${required.protocol}: rebuild both from one checkout, or install the Lace CLI release that matches this host`;
4126
+ }
4127
+ }
4128
+ function checkEngineIdentity(engine) {
4129
+ if (engine.protocol !== ENGINE_PROTOCOL_VERSION || engine.contract !== ENGINE_CONTRACT) {
4130
+ throw new EngineIdentityMismatchError(engine, {
4131
+ protocol: ENGINE_PROTOCOL_VERSION,
4132
+ contract: ENGINE_CONTRACT
4133
+ });
4134
+ }
4135
+ }
4136
+
4137
+ // src/render.ts
4138
+ var META_ARGUMENTS = ["count", "for_each"];
4139
+
4140
+ // src/projection/derive-edges.ts
4141
+ function emitEdgesFromBinding(binding, targetId, toInput, useIds, seen, edges) {
4142
+ if (binding.out?.module && binding.out.name) {
4143
+ edges.push({
4144
+ source_instance: binding.out.module,
4145
+ target_instance: targetId,
4146
+ from_output: binding.out.name,
4147
+ to_input: toInput
4148
+ });
4149
+ return;
4150
+ }
4151
+ for (const ref of binding.expr?.module_references ?? []) {
4152
+ if (!useIds.has(ref.call)) continue;
4153
+ const fromOutput = ref.output ?? "";
4154
+ const key = `${ref.call}:${targetId}:${fromOutput}:${toInput}`;
4155
+ if (seen.has(key)) continue;
4156
+ seen.add(key);
4157
+ edges.push({
4158
+ source_instance: ref.call,
4159
+ target_instance: targetId,
4160
+ from_output: fromOutput,
4161
+ to_input: toInput
4162
+ });
4163
+ }
4164
+ }
4165
+ function deriveEdges(uses) {
4166
+ const useIds = new Set(uses.map((u) => u.id));
4167
+ const edges = [];
4168
+ const seen = /* @__PURE__ */ new Set();
4169
+ for (const target of uses) {
4170
+ const inputs = target.inputs ?? {};
4171
+ for (const [inputName, binding] of Object.entries(inputs)) {
4172
+ emitEdgesFromBinding(binding, target.id, inputName, useIds, seen, edges);
4752
4173
  }
4753
- if (message.sensitive !== false) {
4754
- writer.uint32(48).bool(message.sensitive);
4174
+ for (const meta of META_ARGUMENTS) {
4175
+ const binding = target[meta];
4176
+ if (binding) emitEdgesFromBinding(binding, target.id, meta, useIds, seen, edges);
4755
4177
  }
4756
- return writer;
4757
- },
4758
- decode(input, length) {
4759
- const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
4760
- const end = length === void 0 ? reader.len : reader.pos + length;
4761
- const message = createBaseNodePin();
4762
- while (reader.pos < end) {
4763
- const tag = reader.uint32();
4764
- switch (tag >>> 3) {
4765
- case 1: {
4766
- if (tag !== 10) {
4767
- break;
4768
- }
4769
- message.name = reader.string();
4770
- continue;
4771
- }
4772
- case 2: {
4773
- if (tag !== 18) {
4774
- break;
4775
- }
4776
- message.type = reader.string();
4777
- continue;
4778
- }
4779
- case 3: {
4780
- if (tag !== 24) {
4781
- break;
4782
- }
4783
- message.required = reader.bool();
4784
- continue;
4785
- }
4786
- case 4: {
4787
- if (tag !== 32) {
4788
- break;
4789
- }
4790
- message.wired = reader.bool();
4791
- continue;
4792
- }
4793
- case 5: {
4794
- if (tag !== 42) {
4795
- break;
4796
- }
4797
- message.description = reader.string();
4798
- continue;
4799
- }
4800
- case 6: {
4801
- if (tag !== 48) {
4802
- break;
4803
- }
4804
- message.sensitive = reader.bool();
4805
- continue;
4806
- }
4807
- }
4808
- if ((tag & 7) === 4 || tag === 0) {
4178
+ }
4179
+ return edges;
4180
+ }
4181
+ function indexWires(edges) {
4182
+ const inputs = /* @__PURE__ */ new Map();
4183
+ const outputs = /* @__PURE__ */ new Map();
4184
+ 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);
4189
+ }
4190
+ return { inputs, outputs };
4191
+ }
4192
+ function callWires(wiredIn, wiredOut) {
4193
+ return {
4194
+ call_wired: wiredOut.has(""),
4195
+ meta_wired: META_ARGUMENTS.filter((meta) => wiredIn.has(meta))
4196
+ };
4197
+ }
4198
+
4199
+ // src/projection/resolve-schema.ts
4200
+ function resolveSchema(bundle, use, readOutputs) {
4201
+ const target = bundle.modules[use.module];
4202
+ if (!target) return { inputs: [], outputs: [] };
4203
+ if (target.interface) {
4204
+ return { inputs: target.interface.inputs, outputs: target.interface.outputs };
4205
+ }
4206
+ return {
4207
+ inputs: Object.keys(use.inputs ?? {}).sort().map((name) => InputDef.create({ name })),
4208
+ outputs: [...new Set(readOutputs)].filter((name) => name !== "").sort().map((name) => OutputDef.create({ name }))
4209
+ };
4210
+ }
4211
+ function findChild(mod, id) {
4212
+ for (const use of mod.modules ?? []) {
4213
+ if (use.id === id) return { id, use };
4214
+ }
4215
+ for (const resource of mod.resources ?? []) {
4216
+ if (resource.id === id) return { id, resource };
4217
+ }
4218
+ return null;
4219
+ }
4220
+ function resolveInstance(bundle, id) {
4221
+ return resolveFrom(bundle, bundle.entry, id);
4222
+ }
4223
+ function resolveFrom(bundle, scopeKey, id) {
4224
+ const scope = bundle.modules[scopeKey];
4225
+ if (!scope) return null;
4226
+ for (const use of scope.modules ?? []) {
4227
+ if (!id.startsWith(`${use.id}.`)) continue;
4228
+ const nested = resolveFrom(bundle, use.module, id.slice(use.id.length + 1));
4229
+ if (nested) return nested;
4230
+ }
4231
+ const child = findChild(scope, id);
4232
+ return child ? { scopeKey, scope, child } : null;
4233
+ }
4234
+ function instanceAddress(bundle, id) {
4235
+ const resolved = resolveInstance(bundle, id);
4236
+ return resolved ? { scope: resolved.scopeKey, id: resolved.child.id } : { scope: bundle.entry, id };
4237
+ }
4238
+ function resolveScopePath(bundle, path) {
4239
+ if (path === "") {
4240
+ return bundle.modules[bundle.entry] ? bundle.entry : null;
4241
+ }
4242
+ return resolveInstance(bundle, path)?.child.use?.module ?? null;
4243
+ }
4244
+
4245
+ // src/projection/inspect.ts
4246
+ function hclLiteralText(lit) {
4247
+ if (typeof lit === "string") return quoteHclString(lit);
4248
+ if (typeof lit === "number" || typeof lit === "boolean") return String(lit);
4249
+ if (Array.isArray(lit)) return `[${lit.map(hclLiteralText).join(", ")}]`;
4250
+ if (lit !== null && typeof lit === "object") {
4251
+ return hclObjectText(lit);
4252
+ }
4253
+ return String(lit);
4254
+ }
4255
+ function quoteHclString(s) {
4256
+ let out = "";
4257
+ for (let i = 0; i < s.length; i++) {
4258
+ const c = s[i];
4259
+ switch (c) {
4260
+ case "\\":
4261
+ out += "\\\\";
4809
4262
  break;
4810
- }
4811
- reader.skip(tag & 7);
4812
- }
4813
- return message;
4814
- },
4815
- fromJSON(object) {
4816
- return {
4817
- name: isSet3(object.name) ? globalThis.String(object.name) : "",
4818
- type: isSet3(object.type) ? globalThis.String(object.type) : "",
4819
- required: isSet3(object.required) ? globalThis.Boolean(object.required) : false,
4820
- wired: isSet3(object.wired) ? globalThis.Boolean(object.wired) : false,
4821
- description: isSet3(object.description) ? globalThis.String(object.description) : "",
4822
- sensitive: isSet3(object.sensitive) ? globalThis.Boolean(object.sensitive) : false
4823
- };
4824
- },
4825
- toJSON(message) {
4826
- const obj = {};
4827
- if (message.name !== "") {
4828
- obj.name = message.name;
4829
- }
4830
- if (message.type !== "") {
4831
- obj.type = message.type;
4832
- }
4833
- if (message.required !== false) {
4834
- obj.required = message.required;
4835
- }
4836
- if (message.wired !== false) {
4837
- obj.wired = message.wired;
4838
- }
4839
- if (message.description !== "") {
4840
- obj.description = message.description;
4263
+ case '"':
4264
+ out += '\\"';
4265
+ break;
4266
+ case "\n":
4267
+ out += "\\n";
4268
+ break;
4269
+ case "\r":
4270
+ out += "\\r";
4271
+ break;
4272
+ case " ":
4273
+ out += "\\t";
4274
+ break;
4275
+ case "$":
4276
+ case "%":
4277
+ out += s[i + 1] === "{" ? c + c : c;
4278
+ break;
4279
+ default:
4280
+ out += c;
4841
4281
  }
4842
- if (message.sensitive !== false) {
4843
- obj.sensitive = message.sensitive;
4282
+ }
4283
+ return `"${out}"`;
4284
+ }
4285
+ function hclObjectText(obj) {
4286
+ const entries = Object.entries(obj).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
4287
+ if (entries.length === 0) return "{}";
4288
+ const width = Math.max(...entries.map(([k]) => k.length)) + 1;
4289
+ const lines = entries.map(([k, v]) => ` ${k.padEnd(width)}= ${hclLiteralText(v)}`);
4290
+ return `{
4291
+ ${lines.join("\n")}
4292
+ }`;
4293
+ }
4294
+ function bindingText(b) {
4295
+ if (!b) return "";
4296
+ if (b.lit !== void 0 && b.lit !== null) return hclLiteralText(b.lit);
4297
+ if (b.var) return `var.${b.var}`;
4298
+ if (b.out) return `module.${b.out.module}.${b.out.name}`;
4299
+ if (b.expr) return b.expr.value;
4300
+ return "";
4301
+ }
4302
+ function exportText(e) {
4303
+ if (!e) return "";
4304
+ if (e.out) return `${childReference(e.out.module)}.${e.out.name}`;
4305
+ return bindingText({ lit: e.lit, var: e.var, out: void 0, expr: e.expr });
4306
+ }
4307
+ function childReference(id) {
4308
+ if (id.startsWith("resource.")) return id.slice("resource.".length);
4309
+ if (id.startsWith("data.")) return id;
4310
+ return `module.${id}`;
4311
+ }
4312
+ function bindingMode(b) {
4313
+ if (!b) return { mode: "empty" };
4314
+ if (b.out) return { mode: "wired", wired_source: bindingText(b) };
4315
+ if (b.var) return { mode: "variable", variable: b.var };
4316
+ if (b.expr) return { mode: "expression", expression: b.expr.value };
4317
+ if (b.lit !== void 0 && b.lit !== null) return { mode: "literal", value: b.lit };
4318
+ return { mode: "empty" };
4319
+ }
4320
+ function deriveNodeConfig(bundle, instanceId) {
4321
+ const resolved = resolveInstance(bundle, instanceId);
4322
+ if (!resolved) return null;
4323
+ const { scope, child } = resolved;
4324
+ const readOutputs = indexWires(deriveEdges(scope.modules ?? [])).outputs.get(child.id) ?? [];
4325
+ const schema = child.use ? resolveSchema(bundle, child.use, readOutputs) : { inputs: [], outputs: [] };
4326
+ const schemaInputs = schema.inputs;
4327
+ const schemaOutputs = schema.outputs;
4328
+ const boundInputs = child.use?.inputs ?? child.resource?.inputs ?? {};
4329
+ const inputs = schemaInputs.map((def) => ({
4330
+ name: def.name,
4331
+ type: def.type,
4332
+ required: def.required,
4333
+ description: def.description || void 0,
4334
+ default_value: def.default_value,
4335
+ validation: def.validation?.[0] ? { condition: def.validation[0].condition, error_message: def.validation[0].error_message } : void 0,
4336
+ ...bindingMode(boundInputs[def.name])
4337
+ }));
4338
+ const outputs = schemaOutputs.map((def) => ({
4339
+ name: def.name,
4340
+ type: def.type,
4341
+ description: def.description || void 0,
4342
+ sensitive: def.sensitive || void 0
4343
+ }));
4344
+ const dependencyOptions = [
4345
+ ...(scope.modules ?? []).map((u) => u.id),
4346
+ ...(scope.resources ?? []).map((r) => r.id)
4347
+ ].filter((id) => id !== child.id).map(childReference);
4348
+ const dependsOn = child.use?.depends_on ?? child.resource?.depends_on ?? [];
4349
+ const providers = child.use?.providers ?? {};
4350
+ const meta = child.use ?? child.resource;
4351
+ const availableVariables = (scope.interface?.inputs ?? []).map((v) => ({
4352
+ name: v.name,
4353
+ type: v.type
4354
+ }));
4355
+ return {
4356
+ instance_id: instanceId,
4357
+ module_key: child.use?.module,
4358
+ source: child.use ? callSource(bundle, resolved.scopeKey, child.use.module) : void 0,
4359
+ inputs,
4360
+ outputs,
4361
+ dependency_options: dependencyOptions,
4362
+ depends_on: dependsOn,
4363
+ providers,
4364
+ count: bindingText(meta?.count),
4365
+ for_each: bindingText(meta?.for_each),
4366
+ available_variables: availableVariables
4367
+ };
4368
+ }
4369
+ function callSource(bundle, scopeKey, moduleKey) {
4370
+ const from = dirOf(bundle, scopeKey);
4371
+ const to = sourceDir(bundle, moduleKey);
4372
+ if (from !== void 0 && to !== void 0) return memberSourcePath(from, to);
4373
+ const source = bundle.modules[moduleKey]?.source;
4374
+ return source ? sourceText(source) : "";
4375
+ }
4376
+ function isMemberDir(id) {
4377
+ return id !== "" && id !== "." && id !== ".." && !id.startsWith("./") && !id.startsWith("../") && !id.startsWith("/");
4378
+ }
4379
+ function dirOf(bundle, key) {
4380
+ if (key === bundle.entry) return "";
4381
+ const mod = bundle.modules[key];
4382
+ if (!mod || mod.source || !isMemberDir(mod.id)) return void 0;
4383
+ return mod.id;
4384
+ }
4385
+ function sourceDir(bundle, key) {
4386
+ const dir = dirOf(bundle, key);
4387
+ if (dir !== void 0) return dir;
4388
+ const mod = bundle.modules[key];
4389
+ return mod?.source?.kind === "local" && isMemberDir(mod.id) ? mod.id : void 0;
4390
+ }
4391
+ function memberSourcePath(from, to) {
4392
+ const base = from === "" ? [] : from.split("/");
4393
+ const target = to.split("/");
4394
+ let shared = 0;
4395
+ while (shared < base.length && shared < target.length && base[shared] === target[shared]) {
4396
+ shared++;
4397
+ }
4398
+ const rel = [...base.slice(shared).map(() => ".."), ...target.slice(shared)].join("/") || ".";
4399
+ return rel.startsWith("../") ? rel : `./${rel}`;
4400
+ }
4401
+ function sourceText(source) {
4402
+ if (source.kind === "git") {
4403
+ const subdir = source.subdir ? `//${source.subdir}` : "";
4404
+ const ref = source.ref ? `?ref=${source.ref}` : "";
4405
+ return `git::${source.repo}${subdir}${ref}`;
4406
+ }
4407
+ return source.kind === "local" ? source.subdir : source.ref;
4408
+ }
4409
+ function defaultText(value) {
4410
+ return value === void 0 || value === null ? "null" : hclLiteralText(value);
4411
+ }
4412
+ function blockConfigs(blocks) {
4413
+ return (blocks ?? []).map((b) => ({
4414
+ type: b.type,
4415
+ labels: [...b.labels],
4416
+ attributes: b.attributes.map((a) => ({ name: a.name, value: bindingText(a.value) })),
4417
+ blocks: blockConfigs(b.blocks)
4418
+ }));
4419
+ }
4420
+ function resourceConfig(r) {
4421
+ const kind = r.kind === "data" ? "data" : "resource";
4422
+ return {
4423
+ id: r.id,
4424
+ kind,
4425
+ type: r.type,
4426
+ name: r.id.slice(`${kind}.${r.type}.`.length),
4427
+ arguments: Object.keys(r.inputs ?? {}).sort().map((name) => ({ name, value: bindingText(r.inputs[name]) })),
4428
+ blocks: blockConfigs(r.blocks),
4429
+ count: bindingText(r.count),
4430
+ for_each: bindingText(r.for_each),
4431
+ provider: r.provider_ref,
4432
+ depends_on: [...r.depends_on ?? []]
4433
+ };
4434
+ }
4435
+ function deriveSettingsConfig(bundle, moduleKey) {
4436
+ const mod = bundle.modules[moduleKey];
4437
+ if (!mod) return null;
4438
+ const terraform = mod.terraform ? {
4439
+ required_version: mod.terraform.required_version,
4440
+ required_providers: Object.entries(mod.terraform.required_providers ?? {}).map(
4441
+ ([name, req]) => ({
4442
+ name,
4443
+ source: req.source,
4444
+ version: req.version,
4445
+ configuration_aliases: req.configuration_aliases
4446
+ })
4447
+ )
4448
+ } : { required_version: "", required_providers: [] };
4449
+ const providers = (mod.providers ?? []).map((p) => {
4450
+ const config = {};
4451
+ for (const [k, v] of Object.entries(p.config ?? {})) {
4452
+ config[k] = bindingText(v);
4844
4453
  }
4845
- return obj;
4846
- },
4847
- create(base) {
4848
- return NodePin.fromPartial(base ?? {});
4849
- },
4850
- fromPartial(object) {
4851
- const message = createBaseNodePin();
4852
- message.name = object.name ?? "";
4853
- message.type = object.type ?? "";
4854
- message.required = object.required ?? false;
4855
- message.wired = object.wired ?? false;
4856
- message.description = object.description ?? "";
4857
- message.sensitive = object.sensitive ?? false;
4858
- return message;
4454
+ return { name: p.name, alias: p.alias, config, blocks: blockConfigs(p.blocks) };
4455
+ });
4456
+ const locals = (mod.locals ?? []).map((l) => ({ name: l.name, value: bindingText(l.value) }));
4457
+ const variables = (mod.interface?.inputs ?? []).map((v) => ({
4458
+ name: v.name,
4459
+ type: v.type,
4460
+ required: v.required,
4461
+ description: v.description || void 0,
4462
+ default_value: v.default_value,
4463
+ validation: v.validation?.map((b) => ({
4464
+ condition: b.condition,
4465
+ error_message: b.error_message
4466
+ })),
4467
+ ephemeral: v.ephemeral,
4468
+ sensitive: v.sensitive || void 0,
4469
+ nullable: v.nullable,
4470
+ default: v.required ? "" : defaultText(v.default_value)
4471
+ }));
4472
+ const outputs = (mod.interface?.outputs ?? []).map((o) => ({
4473
+ name: o.name,
4474
+ type: o.type,
4475
+ value: exportText(mod.exports?.outputs?.[o.name]),
4476
+ description: o.description || void 0,
4477
+ sensitive: o.sensitive || void 0,
4478
+ depends_on: o.depends_on
4479
+ }));
4480
+ const read = indexWires(deriveEdges(mod.modules ?? [])).outputs;
4481
+ const callOutputs = (mod.modules ?? []).flatMap(
4482
+ (use) => resolveSchema(bundle, use, read.get(use.id) ?? []).outputs.map(
4483
+ (o) => `module.${use.id}.${o.name}`
4484
+ )
4485
+ );
4486
+ const resources = (mod.resources ?? []).map(resourceConfig);
4487
+ const leaf = !mod.source && moduleKey !== bundle.entry && (mod.modules ?? []).length === 0;
4488
+ return {
4489
+ module_key: moduleKey,
4490
+ reference: mod.source ? { source: sourceText(mod.source), version: mod.version } : void 0,
4491
+ terraform,
4492
+ providers,
4493
+ locals,
4494
+ variables,
4495
+ outputs,
4496
+ resources,
4497
+ holds_managed_resources: resources.some((r) => r.kind === "resource") || leaf,
4498
+ directives: blockConfigs(mod.top_level_blocks),
4499
+ call_outputs: callOutputs,
4500
+ dependency_options: [
4501
+ ...(mod.modules ?? []).map((u) => childReference(u.id)),
4502
+ ...(mod.resources ?? []).map((r) => childReference(r.id))
4503
+ ]
4504
+ };
4505
+ }
4506
+
4507
+ // src/projection/join-path.ts
4508
+ function joinPath(prefix, localId) {
4509
+ return prefix === "" ? localId : `${prefix}.${localId}`;
4510
+ }
4511
+ function splitPath(canvasPath) {
4512
+ const lastDot = canvasPath.lastIndexOf(".");
4513
+ if (lastDot === -1) return { parentPath: "", localId: canvasPath };
4514
+ return { parentPath: canvasPath.slice(0, lastDot), localId: canvasPath.slice(lastDot + 1) };
4515
+ }
4516
+ function callText(sourcePath) {
4517
+ return `module.${splitPath(sourcePath).localId}`;
4518
+ }
4519
+
4520
+ // src/projection/node-for-address.ts
4521
+ var INSTANCE_KEY = /\[[^\]]*\]$/;
4522
+ function tokenizeAddress(address) {
4523
+ const tokens = [];
4524
+ let current = "";
4525
+ let depth = 0;
4526
+ for (const ch of address) {
4527
+ if (ch === "[") depth++;
4528
+ else if (ch === "]") depth--;
4529
+ if (ch === "." && depth === 0) {
4530
+ tokens.push(current);
4531
+ current = "";
4532
+ } else {
4533
+ current += ch;
4534
+ }
4535
+ }
4536
+ tokens.push(current);
4537
+ return tokens;
4538
+ }
4539
+ function nodeIdForAddress(view, address) {
4540
+ const tokens = tokenizeAddress(address);
4541
+ const moduleNames = [];
4542
+ let i = 0;
4543
+ while (i + 1 < tokens.length && tokens[i] === "module") {
4544
+ moduleNames.push(tokens[i + 1].replace(INSTANCE_KEY, ""));
4545
+ i += 2;
4546
+ }
4547
+ if (moduleNames.length === 0) return null;
4548
+ const known = /* @__PURE__ */ new Set();
4549
+ for (const n of view.nodes) known.add(n.id);
4550
+ for (const g of view.groups) known.add(g.id);
4551
+ for (let k = moduleNames.length; k >= 1; k--) {
4552
+ let path = "";
4553
+ for (let j = 0; j < k; j++) path = joinPath(path, moduleNames[j]);
4554
+ if (known.has(path)) return path;
4555
+ }
4556
+ return null;
4557
+ }
4558
+
4559
+ // src/projection/node-for-diagnostic.ts
4560
+ function buildScopeIndex(view) {
4561
+ const byModuleKey = /* @__PURE__ */ new Map();
4562
+ const known = /* @__PURE__ */ new Set();
4563
+ for (const n of view.nodes) known.add(n.id);
4564
+ for (const g of view.groups) {
4565
+ known.add(g.id);
4566
+ if (g.module_key) {
4567
+ const ids = byModuleKey.get(g.module_key);
4568
+ if (ids) ids.push(g.id);
4569
+ else byModuleKey.set(g.module_key, [g.id]);
4570
+ }
4571
+ }
4572
+ return { byModuleKey, known };
4573
+ }
4574
+ function nodeIdForDiagnostic(view, diagnostic) {
4575
+ if (diagnostic.address) return nodeIdForAddress(view, diagnostic.address);
4576
+ if (!diagnostic.instance_id) return null;
4577
+ const index = buildScopeIndex(view);
4578
+ const scopeIds = diagnostic.module_key ? index.byModuleKey.get(diagnostic.module_key) : void 0;
4579
+ if (!scopeIds || scopeIds.length === 0) {
4580
+ return index.known.has(diagnostic.instance_id) ? diagnostic.instance_id : null;
4581
+ }
4582
+ if (scopeIds.length > 1) return null;
4583
+ const nodeId = `${scopeIds[0]}.${diagnostic.instance_id}`;
4584
+ return index.known.has(nodeId) ? nodeId : null;
4585
+ }
4586
+
4587
+ // src/projection/geometry.ts
4588
+ var NODE_WIDTH = 200;
4589
+ var NODE_HEADER_HEIGHT = 28;
4590
+ var NODE_ROW_HEIGHT = 22;
4591
+ var GROUP_PADDING = { x: 40, top: 60, bottom: 20 };
4592
+ var GROUP_HEADER_HEIGHT = 32;
4593
+ var COLLAPSED_GROUP_WIDTH = 220;
4594
+ function visibleInputs(inputs) {
4595
+ return inputs.filter((pin) => pin.required || pin.wired);
4596
+ }
4597
+ function nodeRows(node) {
4598
+ const shown = visibleInputs(node.inputs);
4599
+ const folded = node.inputs.length > shown.length ? 1 : 0;
4600
+ return Math.max(shown.length + folded, node.outputs.length);
4601
+ }
4602
+ function nodeSize(node) {
4603
+ return { width: NODE_WIDTH, height: NODE_HEADER_HEIGHT + nodeRows(node) * NODE_ROW_HEIGHT };
4604
+ }
4605
+ function inputPinY(node, name) {
4606
+ const row = visibleInputs(node.inputs).findIndex((pin) => pin.name === name);
4607
+ return row < 0 ? NODE_HEADER_HEIGHT / 2 : NODE_HEADER_HEIGHT + (row + 0.5) * NODE_ROW_HEIGHT;
4608
+ }
4609
+ function extentOf(rects) {
4610
+ if (rects.length === 0) return { x: 0, y: 0, width: 0, height: 0 };
4611
+ const x = Math.min(...rects.map((r) => r.x));
4612
+ const y = Math.min(...rects.map((r) => r.y));
4613
+ return {
4614
+ x,
4615
+ y,
4616
+ width: Math.max(...rects.map((r) => r.x + r.width)) - x,
4617
+ height: Math.max(...rects.map((r) => r.y + r.height)) - y
4618
+ };
4619
+ }
4620
+ function groupBoxSize(content) {
4621
+ return {
4622
+ width: content.width + 2 * GROUP_PADDING.x,
4623
+ height: GROUP_PADDING.top + content.height + GROUP_PADDING.bottom
4624
+ };
4625
+ }
4626
+ function collapsedGroupSize(pins) {
4627
+ const rows = Math.max(pins.inputs?.length ?? 0, pins.outputs?.length ?? 0);
4628
+ return { width: COLLAPSED_GROUP_WIDTH, height: GROUP_HEADER_HEIGHT + rows * NODE_ROW_HEIGHT };
4629
+ }
4630
+ function groupPinY(row) {
4631
+ return GROUP_HEADER_HEIGHT + (row + 0.5) * NODE_ROW_HEIGHT;
4632
+ }
4633
+ function groupInputPinY(group, name) {
4634
+ const row = (group.inputs ?? []).findIndex((pin) => pin.name === name);
4635
+ return row < 0 ? GROUP_HEADER_HEIGHT / 2 : groupPinY(row);
4636
+ }
4637
+ function groupFootprint(group, box) {
4638
+ return group.collapsed ? collapsedGroupSize(group) : box;
4639
+ }
4640
+ function groupReach(pins, box) {
4641
+ const card = collapsedGroupSize(pins);
4642
+ return { width: Math.max(card.width, box.width), height: Math.max(card.height, box.height) };
4643
+ }
4644
+
4645
+ // src/projection/frames.ts
4646
+ var ZERO = { x: 0, y: 0 };
4647
+ function boxAt(origin, min = ZERO) {
4648
+ return { x: origin.x + min.x - GROUP_PADDING.x, y: origin.y + min.y - GROUP_PADDING.top };
4649
+ }
4650
+ function originAt(box, min = ZERO) {
4651
+ return { x: box.x - min.x + GROUP_PADDING.x, y: box.y - min.y + GROUP_PADDING.top };
4652
+ }
4653
+ function drawnAt(view, canvasPath) {
4654
+ return view.nodes.find((n) => n.id === canvasPath)?.position ?? view.groups.find((g) => g.id === canvasPath)?.position;
4655
+ }
4656
+ function drawnRect(view, canvasPath) {
4657
+ const node = view.nodes.find((n) => n.id === canvasPath);
4658
+ if (node) return { ...node.position, ...nodeSize(node) };
4659
+ const group = view.groups.find((g) => g.id === canvasPath);
4660
+ return group ? { ...group.position, ...groupFootprint(group, group.size) } : void 0;
4661
+ }
4662
+ function reachRect(view, canvasPath) {
4663
+ const group = view.groups.find((g) => g.id === canvasPath);
4664
+ if (!group) return drawnRect(view, canvasPath);
4665
+ return { ...group.position, ...groupReach(group, group.size) };
4666
+ }
4667
+ function frameOf(view, canvasPath) {
4668
+ const { parentPath } = splitPath(canvasPath);
4669
+ if (parentPath === "") return ZERO;
4670
+ return view.groups.find((g) => g.id === parentPath)?.origin ?? ZERO;
4671
+ }
4672
+ function localIn(view, canvasPath, drawn, frame = frameOf(view, canvasPath)) {
4673
+ const group = view.groups.find((g) => g.id === canvasPath);
4674
+ if (!group) return { x: drawn.x - frame.x, y: drawn.y - frame.y };
4675
+ const anchor = boxAt(group.origin);
4676
+ return {
4677
+ x: drawn.x - (group.position.x - anchor.x) - frame.x,
4678
+ y: drawn.y - (group.position.y - anchor.y) - frame.y
4679
+ };
4680
+ }
4681
+
4682
+ // src/projection/parse-module-key.ts
4683
+ function parseModuleKey(key) {
4684
+ const at = key.lastIndexOf("@");
4685
+ if (at < 0) return { id: key, version: "" };
4686
+ return { id: key.slice(0, at), version: key.slice(at + 1) };
4687
+ }
4688
+
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
+ // src/projection/compute-layout.ts
4697
+ var SPACING_X = 260;
4698
+ var SPACING_Y = 180;
4699
+ var GAP_X = 60;
4700
+ var GAP_Y = 40;
4701
+ var ORDINARY = { width: NODE_WIDTH, height: SPACING_Y - GAP_Y };
4702
+ function slotOf(size) {
4703
+ return {
4704
+ width: Math.max(SPACING_X, size.width + GAP_X),
4705
+ height: Math.max(SPACING_Y, size.height + GAP_Y)
4706
+ };
4707
+ }
4708
+ function overlaps(a, b) {
4709
+ return a.x < b.x + b.width && a.x + a.width > b.x && a.y < b.y + b.height && a.y + a.height > b.y;
4710
+ }
4711
+ function stepDown(at, size, taken) {
4712
+ let candidate = at;
4713
+ const blocking = () => taken.filter((r) => overlaps({ ...candidate, ...size }, r));
4714
+ for (let inWay = blocking(); inWay.length > 0; inWay = blocking()) {
4715
+ candidate = { x: candidate.x, y: Math.max(...inWay.map((r) => r.y + r.height)) };
4716
+ }
4717
+ return candidate;
4718
+ }
4719
+ function keepOrder(a, b) {
4720
+ return a.y - b.y || a.x - b.x || a.declared - b.declared;
4721
+ }
4722
+ function freeSlot(extent, occupied) {
4723
+ return stepDown(
4724
+ { x: 0, y: 0 },
4725
+ slotOf(extent),
4726
+ occupied.map((r) => ({ x: r.x, y: r.y, ...slotOf(r) }))
4727
+ );
4728
+ }
4729
+ function resolveScopePositionsByDepth(ids, arrangementNodes, edges) {
4730
+ const stored = /* @__PURE__ */ new Map();
4731
+ for (const id of ids) {
4732
+ const at = arrangementNodes?.[id];
4733
+ if (at) stored.set(id, at);
4859
4734
  }
4860
- };
4861
- function createBaseRenderEdge() {
4862
- return { id: "", source: "", target: "", source_output: "", target_input: "" };
4735
+ return layoutByDepth(
4736
+ ids.map((id) => ({ id, size: ORDINARY })),
4737
+ stored,
4738
+ edges
4739
+ );
4863
4740
  }
4864
- var RenderEdge = {
4865
- encode(message, writer = new BinaryWriter3()) {
4866
- if (message.id !== "") {
4867
- writer.uint32(10).string(message.id);
4868
- }
4869
- if (message.source !== "") {
4870
- writer.uint32(18).string(message.source);
4871
- }
4872
- if (message.target !== "") {
4873
- writer.uint32(26).string(message.target);
4874
- }
4875
- if (message.source_output !== "") {
4876
- writer.uint32(34).string(message.source_output);
4741
+ function layoutByDepth(items, stored, edges) {
4742
+ const byId = new Map(items.map((item) => [item.id, item]));
4743
+ const ids = items.map((item) => item.id);
4744
+ const slots = new Map(items.map((item) => [item.id, slotOf(item.size)]));
4745
+ const slotOfId = (id) => slots.get(id) ?? slotOf(ORDINARY);
4746
+ const declared = new Map(ids.map((id, i) => [id, i]));
4747
+ const keyOf = (id, at) => ({ ...at, declared: declared.get(id) ?? 0 });
4748
+ const inOrder = [...stored].sort(([p, a], [q, b]) => keepOrder(keyOf(p, a), keyOf(q, b)));
4749
+ const kept = /* @__PURE__ */ new Map();
4750
+ const keptRects = [];
4751
+ const keptSlots = [];
4752
+ for (const [id, wanted] of inOrder) {
4753
+ const item = byId.get(id);
4754
+ if (!item) continue;
4755
+ const slot = slotOfId(id);
4756
+ const clear = !keptRects.some((r) => overlaps({ ...wanted, ...item.size }, r));
4757
+ const at = clear ? wanted : stepDown(wanted, slot, keptSlots);
4758
+ kept.set(id, at);
4759
+ keptRects.push({ ...at, ...item.size });
4760
+ keptSlots.push({ ...at, ...slot });
4761
+ }
4762
+ const columns = columnByDepth(ids, edges);
4763
+ const columnX = /* @__PURE__ */ new Map();
4764
+ {
4765
+ const widths = /* @__PURE__ */ new Map();
4766
+ for (const id of ids) {
4767
+ const c = columns.get(id) ?? 0;
4768
+ widths.set(c, Math.max(widths.get(c) ?? SPACING_X, slotOfId(id).width));
4877
4769
  }
4878
- if (message.target_input !== "") {
4879
- writer.uint32(42).string(message.target_input);
4770
+ const last = Math.max(0, ...widths.keys());
4771
+ let x = 0;
4772
+ for (let c = 0; c <= last; c += 1) {
4773
+ columnX.set(c, x);
4774
+ x += widths.get(c) ?? SPACING_X;
4880
4775
  }
4881
- return writer;
4882
- },
4883
- decode(input, length) {
4884
- const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
4885
- const end = length === void 0 ? reader.len : reader.pos + length;
4886
- const message = createBaseRenderEdge();
4887
- while (reader.pos < end) {
4888
- const tag = reader.uint32();
4889
- switch (tag >>> 3) {
4890
- case 1: {
4891
- if (tag !== 10) {
4892
- break;
4893
- }
4894
- message.id = reader.string();
4895
- continue;
4896
- }
4897
- case 2: {
4898
- if (tag !== 18) {
4899
- break;
4900
- }
4901
- message.source = reader.string();
4902
- continue;
4903
- }
4904
- case 3: {
4905
- if (tag !== 26) {
4906
- break;
4907
- }
4908
- message.target = reader.string();
4909
- continue;
4910
- }
4911
- case 4: {
4912
- if (tag !== 34) {
4913
- break;
4914
- }
4915
- message.source_output = reader.string();
4916
- continue;
4776
+ }
4777
+ const feeders = /* @__PURE__ */ new Map();
4778
+ const fed = /* @__PURE__ */ new Map();
4779
+ for (const edge of edges) {
4780
+ if (edge.source_instance === edge.target_instance) continue;
4781
+ if (!byId.has(edge.source_instance) || !byId.has(edge.target_instance)) continue;
4782
+ feeders.set(edge.target_instance, [
4783
+ ...feeders.get(edge.target_instance) ?? [],
4784
+ edge.source_instance
4785
+ ]);
4786
+ fed.set(edge.source_instance, [...fed.get(edge.source_instance) ?? [], edge]);
4787
+ }
4788
+ const byColumn = /* @__PURE__ */ new Map();
4789
+ for (const id of ids) {
4790
+ if (kept.has(id)) continue;
4791
+ const column = columns.get(id) ?? 0;
4792
+ byColumn.set(column, [...byColumn.get(column) ?? [], id]);
4793
+ }
4794
+ const heightOf = (id) => byId.get(id)?.size.height ?? 0;
4795
+ const mean = (values) => values.reduce((sum, v) => sum + v, 0) / values.length;
4796
+ const place = (unfedOrder2) => {
4797
+ const rank = new Map(unfedOrder2.map((id, i) => [id, i]));
4798
+ const positions = new Map(kept);
4799
+ const taken = [...keptSlots];
4800
+ for (const column of [...byColumn.keys()].sort((p, q) => p - q)) {
4801
+ const members = [...byColumn.get(column) ?? []].sort(
4802
+ (p, q) => (rank.get(p) ?? 0) - (rank.get(q) ?? 0)
4803
+ );
4804
+ const tops = /* @__PURE__ */ new Map();
4805
+ let stacked = 0;
4806
+ for (const id of members) {
4807
+ const from = (feeders.get(id) ?? []).flatMap((f) => {
4808
+ const at = positions.get(f);
4809
+ return at ? [at.y + heightOf(f) / 2] : [];
4810
+ });
4811
+ if (from.length > 0) {
4812
+ tops.set(id, mean(from) - heightOf(id) / 2);
4813
+ } else {
4814
+ tops.set(id, stacked);
4815
+ stacked += slotOfId(id).height;
4917
4816
  }
4918
- case 5: {
4919
- if (tag !== 42) {
4920
- break;
4921
- }
4922
- message.target_input = reader.string();
4923
- continue;
4817
+ }
4818
+ const sorted = [...members].sort((p, q) => (tops.get(p) ?? 0) - (tops.get(q) ?? 0));
4819
+ if (sorted.length > 1) {
4820
+ const offsets = [];
4821
+ let run = 0;
4822
+ for (const id of sorted) {
4823
+ offsets.push(run);
4824
+ run += slotOfId(id).height;
4924
4825
  }
4826
+ const first = mean(sorted.map((id) => tops.get(id) ?? 0)) - mean(offsets);
4827
+ for (const [i, id] of sorted.entries()) tops.set(id, first + offsets[i]);
4925
4828
  }
4926
- if ((tag & 7) === 4 || tag === 0) {
4927
- break;
4829
+ const x = columnX.get(column) ?? 0;
4830
+ for (const id of sorted) {
4831
+ const slot = slotOfId(id);
4832
+ const at = stepDown({ x, y: tops.get(id) ?? 0 }, slot, taken);
4833
+ positions.set(id, at);
4834
+ taken.push({ ...at, ...slot });
4928
4835
  }
4929
- reader.skip(tag & 7);
4930
- }
4931
- return message;
4932
- },
4933
- fromJSON(object) {
4934
- return {
4935
- id: isSet3(object.id) ? globalThis.String(object.id) : "",
4936
- source: isSet3(object.source) ? globalThis.String(object.source) : "",
4937
- target: isSet3(object.target) ? globalThis.String(object.target) : "",
4938
- source_output: isSet3(object.sourceOutput) ? globalThis.String(object.sourceOutput) : isSet3(object.source_output) ? globalThis.String(object.source_output) : "",
4939
- target_input: isSet3(object.targetInput) ? globalThis.String(object.targetInput) : isSet3(object.target_input) ? globalThis.String(object.target_input) : ""
4940
- };
4941
- },
4942
- toJSON(message) {
4943
- const obj = {};
4944
- if (message.id !== "") {
4945
- obj.id = message.id;
4946
- }
4947
- if (message.source !== "") {
4948
- obj.source = message.source;
4949
- }
4950
- if (message.target !== "") {
4951
- obj.target = message.target;
4952
- }
4953
- if (message.source_output !== "") {
4954
- obj.sourceOutput = message.source_output;
4955
- }
4956
- if (message.target_input !== "") {
4957
- obj.targetInput = message.target_input;
4958
- }
4959
- return obj;
4960
- },
4961
- create(base) {
4962
- return RenderEdge.fromPartial(base ?? {});
4963
- },
4964
- fromPartial(object) {
4965
- const message = createBaseRenderEdge();
4966
- message.id = object.id ?? "";
4967
- message.source = object.source ?? "";
4968
- message.target = object.target ?? "";
4969
- message.source_output = object.source_output ?? "";
4970
- message.target_input = object.target_input ?? "";
4971
- return message;
4972
- }
4973
- };
4974
- function createBasePosition() {
4975
- return { x: 0, y: 0 };
4976
- }
4977
- var Position = {
4978
- encode(message, writer = new BinaryWriter3()) {
4979
- if (message.x !== 0) {
4980
- writer.uint32(9).double(message.x);
4981
- }
4982
- if (message.y !== 0) {
4983
- writer.uint32(17).double(message.y);
4984
4836
  }
4985
- return writer;
4986
- },
4987
- decode(input, length) {
4988
- const reader = input instanceof BinaryReader3 ? input : new BinaryReader3(input);
4989
- const end = length === void 0 ? reader.len : reader.pos + length;
4990
- const message = createBasePosition();
4991
- while (reader.pos < end) {
4992
- const tag = reader.uint32();
4993
- switch (tag >>> 3) {
4994
- case 1: {
4995
- if (tag !== 9) {
4996
- break;
4997
- }
4998
- message.x = reader.double();
4999
- continue;
5000
- }
5001
- case 2: {
5002
- if (tag !== 17) {
5003
- break;
5004
- }
5005
- message.y = reader.double();
5006
- continue;
5007
- }
5008
- }
5009
- if ((tag & 7) === 4 || tag === 0) {
5010
- break;
4837
+ return positions;
4838
+ };
4839
+ const provisional = place(ids);
4840
+ const landing = (id) => {
4841
+ const out = fed.get(id) ?? [];
4842
+ const at = provisional.get(id);
4843
+ if (out.length === 0) return (at?.y ?? 0) + slotOfId(id).height / 2;
4844
+ const ys = out.map((edge) => {
4845
+ const target = byId.get(edge.target_instance);
4846
+ const top = provisional.get(edge.target_instance)?.y ?? 0;
4847
+ const pin = target?.pinY && edge.to_input !== void 0 ? target.pinY(edge.to_input) : 0;
4848
+ return top + pin;
4849
+ });
4850
+ return mean(ys);
4851
+ };
4852
+ const unfedOrder = [...ids].sort(
4853
+ (p, q) => landing(p) - landing(q) || (declared.get(p) ?? 0) - (declared.get(q) ?? 0)
4854
+ );
4855
+ return place(unfedOrder);
4856
+ }
4857
+ function columnByDepth(ids, edges) {
4858
+ const present = new Set(ids);
4859
+ const real = edges.filter(
4860
+ (e) => e.source_instance !== e.target_instance && present.has(e.source_instance) && present.has(e.target_instance)
4861
+ );
4862
+ const depth = new Map(ids.map((id) => [id, 0]));
4863
+ for (let round = 0; round < ids.length; round += 1) {
4864
+ let moved = false;
4865
+ for (const e of real) {
4866
+ const want = (depth.get(e.source_instance) ?? 0) + 1;
4867
+ if (want > (depth.get(e.target_instance) ?? 0)) {
4868
+ depth.set(e.target_instance, want);
4869
+ moved = true;
5011
4870
  }
5012
- reader.skip(tag & 7);
5013
- }
5014
- return message;
5015
- },
5016
- fromJSON(object) {
5017
- return {
5018
- x: isSet3(object.x) ? globalThis.Number(object.x) : 0,
5019
- y: isSet3(object.y) ? globalThis.Number(object.y) : 0
5020
- };
5021
- },
5022
- toJSON(message) {
5023
- const obj = {};
5024
- if (message.x !== 0) {
5025
- obj.x = message.x;
5026
- }
5027
- if (message.y !== 0) {
5028
- obj.y = message.y;
5029
4871
  }
5030
- return obj;
5031
- },
5032
- create(base) {
5033
- return Position.fromPartial(base ?? {});
5034
- },
5035
- fromPartial(object) {
5036
- const message = createBasePosition();
5037
- message.x = object.x ?? 0;
5038
- message.y = object.y ?? 0;
5039
- return message;
4872
+ if (!moved) break;
5040
4873
  }
5041
- };
5042
- function isSet3(value) {
5043
- return value !== null && value !== void 0;
4874
+ return depth;
5044
4875
  }
5045
4876
 
5046
- // src/proto-messages.ts
5047
- var CanvasViewProto = CanvasView;
4877
+ // src/projection/project-group.ts
4878
+ function projectGroup(use, target, fullId, parentArrangement, wiredIn, wiredOut) {
4879
+ const childIds = (target.modules ?? []).map((u) => joinPath(fullId, u.id));
4880
+ const parentGroup = parentArrangement?.groups?.[use.id];
4881
+ const collapsed = parentGroup ? parentGroup.collapsed : true;
4882
+ return {
4883
+ id: fullId,
4884
+ label: use.id,
4885
+ node_ids: childIds,
4886
+ collapsed,
4887
+ module_key: use.module,
4888
+ ...groupPins(target),
4889
+ ...callWires(wiredIn, wiredOut)
4890
+ };
4891
+ }
4892
+ function groupPins(target) {
4893
+ return {
4894
+ inputs: (target.interface?.inputs ?? []).map((in_) => ({
4895
+ name: in_.name,
4896
+ type: in_.type,
4897
+ required: in_.required,
4898
+ description: in_.description
4899
+ })),
4900
+ outputs: (target.interface?.outputs ?? []).map((out) => ({
4901
+ name: out.name,
4902
+ type: out.type,
4903
+ description: out.description,
4904
+ sensitive: out.sensitive
4905
+ }))
4906
+ };
4907
+ }
4908
+
4909
+ // src/projection/project-node.ts
4910
+ function projectNode(bundle, use, fullId, wiredIn, wiredOut) {
4911
+ const schema = resolveSchema(bundle, use, wiredOut);
4912
+ return {
4913
+ id: fullId,
4914
+ label: use.id,
4915
+ kind: "module",
4916
+ module_key: use.module,
4917
+ inputs: schema.inputs.map((in_) => ({
4918
+ name: in_.name,
4919
+ type: in_.type,
4920
+ required: in_.required,
4921
+ wired: wiredIn.has(in_.name),
4922
+ description: in_.description
4923
+ })),
4924
+ outputs: schema.outputs.map((out) => ({
4925
+ name: out.name,
4926
+ type: out.type,
4927
+ wired: wiredOut.has(out.name),
4928
+ description: out.description,
4929
+ sensitive: out.sensitive
4930
+ })),
4931
+ ...callWires(wiredIn, wiredOut)
4932
+ };
4933
+ }
5048
4934
 
5049
- // src/protocol-version.ts
5050
- var ENGINE_PROTOCOL_VERSION = String(8 /* PROTOCOL_VERSION_CURRENT */);
5051
- var EngineProtocolMismatchError = class extends Error {
5052
- constructor(engineVersion, engineProtocol, requiredProtocol) {
5053
- super(
5054
- `Lace engine ${engineVersion} speaks protocol ${engineProtocol}; this host speaks protocol ${requiredProtocol}`
4935
+ // src/projection/project-scope.ts
4936
+ function projectScope(bundle, mod, use, path, arrangement, children) {
4937
+ const uses = mod.modules ?? [];
4938
+ const derived = deriveEdges(uses);
4939
+ const { inputs: wiredIn, outputs: wiredOut } = indexWires(derived);
4940
+ const scopeArrangement = arrangement?.[use ? use.module : bundle.entry];
4941
+ const cards = [];
4942
+ const groups = [];
4943
+ const items = [];
4944
+ const boxMin = /* @__PURE__ */ new Map();
4945
+ for (const child of uses) {
4946
+ const fullId = joinPath(path, child.id);
4947
+ if (isGroupUse(bundle, child)) {
4948
+ const group = projectGroup(
4949
+ child,
4950
+ bundle.modules[child.module],
4951
+ fullId,
4952
+ scopeArrangement,
4953
+ wiredIn.get(child.id) ?? /* @__PURE__ */ new Set(),
4954
+ wiredOut.get(child.id) ?? /* @__PURE__ */ new Set()
4955
+ );
4956
+ const content = children.get(fullId);
4957
+ if (!content) throw new Error(`projectScope: no layout for group "${fullId}"`);
4958
+ groups.push(group);
4959
+ boxMin.set(child.id, content.min);
4960
+ items.push({
4961
+ id: child.id,
4962
+ size: groupFootprint(group, content.box),
4963
+ pinY: (input) => groupInputPinY(group, input)
4964
+ });
4965
+ continue;
4966
+ }
4967
+ const node = projectNode(
4968
+ bundle,
4969
+ child,
4970
+ fullId,
4971
+ wiredIn.get(child.id) ?? /* @__PURE__ */ new Set(),
4972
+ wiredOut.get(child.id) ?? /* @__PURE__ */ new Set()
5055
4973
  );
5056
- this.engineVersion = engineVersion;
5057
- this.engineProtocol = engineProtocol;
5058
- this.requiredProtocol = requiredProtocol;
5059
- this.name = "EngineProtocolMismatchError";
4974
+ cards.push(node);
4975
+ items.push({ id: child.id, size: nodeSize(node), pinY: (input) => inputPinY(node, input) });
5060
4976
  }
5061
- /**
5062
- * The engine is the side that is behind: a newer Lace CLI speaks this
5063
- * host's protocol. False when the engine is ahead of the host.
5064
- */
5065
- get engineTooOld() {
5066
- return Number(this.engineProtocol) < Number(this.requiredProtocol);
4977
+ const stored = /* @__PURE__ */ new Map();
4978
+ for (const child of uses) {
4979
+ const at = scopeArrangement?.nodes?.[child.id];
4980
+ if (!at) continue;
4981
+ const min = boxMin.get(child.id);
4982
+ stored.set(child.id, min ? boxAt(originAt(at), min) : at);
5067
4983
  }
5068
- };
5069
- function checkEngineProtocol(engineVersion, engineProtocol) {
5070
- if (engineProtocol !== ENGINE_PROTOCOL_VERSION) {
5071
- throw new EngineProtocolMismatchError(engineVersion, engineProtocol, ENGINE_PROTOCOL_VERSION);
4984
+ const local = layoutByDepth(items, stored, derived);
4985
+ const placedAt = (useId) => {
4986
+ const at = local.get(useId);
4987
+ if (!at) throw new Error(`projectScope: no position for "${joinPath(path, useId)}"`);
4988
+ return at;
4989
+ };
4990
+ const nodes = cards.map((card) => ({ ...card, position: placedAt(splitPath(card.id).localId) }));
4991
+ const extent = extentOf([
4992
+ { x: 0, y: 0, width: 0, height: 0 },
4993
+ ...items.map((item) => ({ ...placedAt(item.id), ...item.size }))
4994
+ ]);
4995
+ const edges = derived.map((de) => {
4996
+ const sourceId = joinPath(path, de.source_instance);
4997
+ const targetId = joinPath(path, de.target_instance);
4998
+ return {
4999
+ id: `${sourceId}-${targetId}-${de.from_output}-${de.to_input}`,
5000
+ source: sourceId,
5001
+ target: targetId,
5002
+ source_output: de.from_output,
5003
+ target_input: de.to_input
5004
+ };
5005
+ });
5006
+ return {
5007
+ nodes,
5008
+ groups,
5009
+ edges,
5010
+ local,
5011
+ min: { x: extent.x, y: extent.y },
5012
+ box: groupBoxSize(extent)
5013
+ };
5014
+ }
5015
+
5016
+ // src/projection/walk-modules.ts
5017
+ function walk(bundle, visit) {
5018
+ if (!bundle) return;
5019
+ const entry = bundle.modules[bundle.entry];
5020
+ if (!entry) return;
5021
+ walkFrom(bundle, entry, null, "", visit);
5022
+ }
5023
+ function walkFrom(bundle, mod, use, path, visit) {
5024
+ visit(mod, use, path);
5025
+ for (const u of mod.modules ?? []) {
5026
+ const child = bundle.modules[u.module];
5027
+ if (!child) continue;
5028
+ walkFrom(bundle, child, u, joinPath(path, u.id), visit);
5029
+ }
5030
+ }
5031
+
5032
+ // src/projection/project.ts
5033
+ var EMPTY_BUNDLE = Bundle.fromPartial({
5034
+ entry: "root@v1",
5035
+ modules: { "root@v1": { id: "root", version: "v1.0.0" } }
5036
+ });
5037
+ function projectCanvasView(bundle, arrangement, meta) {
5038
+ const scopes = [];
5039
+ walk(bundle, (mod, use, path) => {
5040
+ scopes.push({ mod, use, path });
5041
+ });
5042
+ const layouts = /* @__PURE__ */ new Map();
5043
+ for (const { mod, use, path } of [...scopes].reverse()) {
5044
+ layouts.set(path, projectScope(bundle, mod, use, path, arrangement, layouts));
5045
+ }
5046
+ const nodes = [];
5047
+ const edges = [];
5048
+ const groups = [];
5049
+ const origins = /* @__PURE__ */ new Map([["", { x: 0, y: 0 }]]);
5050
+ for (const { path } of scopes) {
5051
+ const layout = layouts.get(path);
5052
+ const origin = origins.get(path);
5053
+ if (!layout || !origin) continue;
5054
+ const at = (local) => ({ x: origin.x + local.x, y: origin.y + local.y });
5055
+ for (const node of layout.nodes) nodes.push({ ...node, position: at(node.position) });
5056
+ for (const group of layout.groups) {
5057
+ const content = layouts.get(group.id);
5058
+ const box = layout.local.get(splitPath(group.id).localId);
5059
+ if (!content || !box)
5060
+ throw new Error(`projectCanvasView: group "${group.id}" was not laid out`);
5061
+ const position = at(box);
5062
+ const membersAt = originAt(position, content.min);
5063
+ origins.set(group.id, membersAt);
5064
+ groups.push({ ...group, position, size: content.box, origin: membersAt });
5065
+ }
5066
+ edges.push(...layout.edges);
5072
5067
  }
5068
+ const moduleName = meta.moduleName ?? parseModuleKey(bundle.entry).id;
5069
+ return {
5070
+ module_name: moduleName,
5071
+ nodes,
5072
+ edges,
5073
+ can_undo: meta.canUndo,
5074
+ can_redo: meta.canRedo,
5075
+ unsaved: meta.unsaved,
5076
+ conflict: meta.conflict,
5077
+ ungenerated: meta.ungenerated ?? false,
5078
+ // Every group is a Use whose target has sub-Uses (CreateGroupAction
5079
+ // mints a module); emission order already mirrors Use declaration order
5080
+ // via the walk, so no separate user-group sort is needed.
5081
+ groups
5082
+ };
5073
5083
  }
5084
+
5085
+ // src/proto-messages.ts
5086
+ var CanvasViewProto = CanvasView;
5074
5087
  export {
5075
5088
  BRIDGE_METHODS,
5076
5089
  Bundle,
@@ -5078,10 +5091,11 @@ export {
5078
5091
  CONNECT_CODE_NAMES,
5079
5092
  CanvasViewProto,
5080
5093
  EMPTY_BUNDLE,
5094
+ ENGINE_CONTRACT,
5081
5095
  ENGINE_METHODS,
5082
5096
  ENGINE_PROTOCOL_VERSION,
5083
5097
  ENGINE_STREAM_METHODS,
5084
- EngineProtocolMismatchError,
5098
+ EngineIdentityMismatchError,
5085
5099
  GROUP_HEADER_HEIGHT,
5086
5100
  GROUP_PADDING,
5087
5101
  HOST_ONLY_METHODS,
@@ -5092,7 +5106,7 @@ export {
5092
5106
  apiFields,
5093
5107
  boxAt,
5094
5108
  callText,
5095
- checkEngineProtocol,
5109
+ checkEngineIdentity,
5096
5110
  collapsedGroupSize,
5097
5111
  convertDiagnostic,
5098
5112
  deriveNodeConfig,