@lace-cloud/proto 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -22,20 +22,29 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  BRIDGE_METHODS: () => BRIDGE_METHODS,
24
24
  Bundle: () => Bundle,
25
+ CONNECT_CODE_NAMES: () => CONNECT_CODE_NAMES,
25
26
  CanvasViewProto: () => CanvasViewProto,
26
27
  EMPTY_BUNDLE: () => EMPTY_BUNDLE,
27
28
  ENGINE_METHODS: () => ENGINE_METHODS,
29
+ ENGINE_PROTOCOL_VERSION: () => ENGINE_PROTOCOL_VERSION,
28
30
  ENGINE_STREAM_METHODS: () => ENGINE_STREAM_METHODS,
31
+ EngineProtocolMismatchError: () => EngineProtocolMismatchError,
32
+ HOST_ONLY_METHODS: () => HOST_ONLY_METHODS,
33
+ callText: () => callText,
34
+ checkEngineProtocol: () => checkEngineProtocol,
29
35
  convertDiagnostic: () => convertDiagnostic,
30
36
  deriveNodeConfig: () => deriveNodeConfig,
31
37
  deriveSettingsConfig: () => deriveSettingsConfig,
38
+ instanceAddress: () => instanceAddress,
32
39
  nodeIdForAddress: () => nodeIdForAddress,
33
40
  nodeIdForDiagnostic: () => nodeIdForDiagnostic,
34
41
  parseModuleKey: () => parseModuleKey,
35
42
  projectCanvasView: () => projectCanvasView,
43
+ resolveInstance: () => resolveInstance,
36
44
  resolveScopePath: () => resolveScopePath,
37
45
  resolveScopePositions: () => resolveScopePositions,
38
- resolveScopePositionsByDepth: () => resolveScopePositionsByDepth
46
+ resolveScopePositionsByDepth: () => resolveScopePositionsByDepth,
47
+ splitPath: () => splitPath
39
48
  });
40
49
  module.exports = __toCommonJS(index_exports);
41
50
 
@@ -56,6 +65,7 @@ function convertDiagnostic(d) {
56
65
  }
57
66
  return {
58
67
  severity,
68
+ code: d.code || void 0,
59
69
  message: d.message,
60
70
  module_key: d.module_key || void 0,
61
71
  instance_id: d.instance_id || void 0,
@@ -69,6 +79,7 @@ function convertDiagnostic(d) {
69
79
  // src/engine-bridge.ts
70
80
  var ENGINE_METHODS = [
71
81
  "Initialize",
82
+ "ReadCredential",
72
83
  "SessionOpen",
73
84
  "TestSessionOpen",
74
85
  "SessionSave",
@@ -76,12 +87,37 @@ var ENGINE_METHODS = [
76
87
  "SessionGenerate",
77
88
  "SessionResolveConflict",
78
89
  "ApplyAction",
90
+ "ReadWiringCandidates",
79
91
  "CancelInvoke"
80
92
  ];
81
93
  var ENGINE_STREAM_METHODS = ["Subscribe", "Invoke"];
94
+ var HOST_ONLY_METHODS = [
95
+ "TestSessionOpen",
96
+ "ReadCredential"
97
+ ];
98
+ var HOST_ONLY_METHOD_NAMES = HOST_ONLY_METHODS;
82
99
  var BRIDGE_METHODS = ENGINE_METHODS.filter(
83
- (m) => m !== "TestSessionOpen"
100
+ (m) => !HOST_ONLY_METHOD_NAMES.includes(m)
84
101
  );
102
+ var CONNECT_CODE_NAMES = [
103
+ "ok",
104
+ "canceled",
105
+ "unknown",
106
+ "invalid_argument",
107
+ "deadline_exceeded",
108
+ "not_found",
109
+ "already_exists",
110
+ "permission_denied",
111
+ "resource_exhausted",
112
+ "failed_precondition",
113
+ "aborted",
114
+ "out_of_range",
115
+ "unimplemented",
116
+ "internal",
117
+ "unavailable",
118
+ "data_loss",
119
+ "unauthenticated"
120
+ ];
85
121
 
86
122
  // src/generated/state.ts
87
123
  var import_wire2 = require("@bufbuild/protobuf/wire");
@@ -2689,7 +2725,7 @@ var OutputRef = {
2689
2725
  }
2690
2726
  };
2691
2727
  function createBaseExpression() {
2692
- return { lang: "", value: "" };
2728
+ return { lang: "", value: "", module_references: [] };
2693
2729
  }
2694
2730
  var Expression = {
2695
2731
  encode(message, writer = new import_wire2.BinaryWriter()) {
@@ -2699,6 +2735,9 @@ var Expression = {
2699
2735
  if (message.value !== "") {
2700
2736
  writer.uint32(18).string(message.value);
2701
2737
  }
2738
+ for (const v of message.module_references) {
2739
+ ModuleReference.encode(v, writer.uint32(26).fork()).join();
2740
+ }
2702
2741
  return writer;
2703
2742
  },
2704
2743
  decode(input, length) {
@@ -2722,6 +2761,13 @@ var Expression = {
2722
2761
  message.value = reader.string();
2723
2762
  continue;
2724
2763
  }
2764
+ case 3: {
2765
+ if (tag !== 26) {
2766
+ break;
2767
+ }
2768
+ message.module_references.push(ModuleReference.decode(reader, reader.uint32()));
2769
+ continue;
2770
+ }
2725
2771
  }
2726
2772
  if ((tag & 7) === 4 || tag === 0) {
2727
2773
  break;
@@ -2733,7 +2779,8 @@ var Expression = {
2733
2779
  fromJSON(object) {
2734
2780
  return {
2735
2781
  lang: isSet2(object.lang) ? globalThis.String(object.lang) : "",
2736
- value: isSet2(object.value) ? globalThis.String(object.value) : ""
2782
+ value: isSet2(object.value) ? globalThis.String(object.value) : "",
2783
+ module_references: globalThis.Array.isArray(object?.moduleReferences) ? object.moduleReferences.map((e) => ModuleReference.fromJSON(e)) : globalThis.Array.isArray(object?.module_references) ? object.module_references.map((e) => ModuleReference.fromJSON(e)) : []
2737
2784
  };
2738
2785
  },
2739
2786
  toJSON(message) {
@@ -2744,6 +2791,9 @@ var Expression = {
2744
2791
  if (message.value !== "") {
2745
2792
  obj.value = message.value;
2746
2793
  }
2794
+ if (message.module_references?.length) {
2795
+ obj.moduleReferences = message.module_references.map((e) => ModuleReference.toJSON(e));
2796
+ }
2747
2797
  return obj;
2748
2798
  },
2749
2799
  create(base) {
@@ -2753,6 +2803,105 @@ var Expression = {
2753
2803
  const message = createBaseExpression();
2754
2804
  message.lang = object.lang ?? "";
2755
2805
  message.value = object.value ?? "";
2806
+ message.module_references = object.module_references?.map((e) => ModuleReference.fromPartial(e)) || [];
2807
+ return message;
2808
+ }
2809
+ };
2810
+ function createBaseModuleReference() {
2811
+ return { call: "", output: void 0, instance_key: false, splat: false };
2812
+ }
2813
+ var ModuleReference = {
2814
+ encode(message, writer = new import_wire2.BinaryWriter()) {
2815
+ if (message.call !== "") {
2816
+ writer.uint32(10).string(message.call);
2817
+ }
2818
+ if (message.output !== void 0) {
2819
+ writer.uint32(18).string(message.output);
2820
+ }
2821
+ if (message.instance_key !== false) {
2822
+ writer.uint32(24).bool(message.instance_key);
2823
+ }
2824
+ if (message.splat !== false) {
2825
+ writer.uint32(32).bool(message.splat);
2826
+ }
2827
+ return writer;
2828
+ },
2829
+ decode(input, length) {
2830
+ const reader = input instanceof import_wire2.BinaryReader ? input : new import_wire2.BinaryReader(input);
2831
+ const end = length === void 0 ? reader.len : reader.pos + length;
2832
+ const message = createBaseModuleReference();
2833
+ while (reader.pos < end) {
2834
+ const tag = reader.uint32();
2835
+ switch (tag >>> 3) {
2836
+ case 1: {
2837
+ if (tag !== 10) {
2838
+ break;
2839
+ }
2840
+ message.call = reader.string();
2841
+ continue;
2842
+ }
2843
+ case 2: {
2844
+ if (tag !== 18) {
2845
+ break;
2846
+ }
2847
+ message.output = reader.string();
2848
+ continue;
2849
+ }
2850
+ case 3: {
2851
+ if (tag !== 24) {
2852
+ break;
2853
+ }
2854
+ message.instance_key = reader.bool();
2855
+ continue;
2856
+ }
2857
+ case 4: {
2858
+ if (tag !== 32) {
2859
+ break;
2860
+ }
2861
+ message.splat = reader.bool();
2862
+ continue;
2863
+ }
2864
+ }
2865
+ if ((tag & 7) === 4 || tag === 0) {
2866
+ break;
2867
+ }
2868
+ reader.skip(tag & 7);
2869
+ }
2870
+ return message;
2871
+ },
2872
+ fromJSON(object) {
2873
+ return {
2874
+ call: isSet2(object.call) ? globalThis.String(object.call) : "",
2875
+ output: isSet2(object.output) ? globalThis.String(object.output) : void 0,
2876
+ instance_key: isSet2(object.instanceKey) ? globalThis.Boolean(object.instanceKey) : isSet2(object.instance_key) ? globalThis.Boolean(object.instance_key) : false,
2877
+ splat: isSet2(object.splat) ? globalThis.Boolean(object.splat) : false
2878
+ };
2879
+ },
2880
+ toJSON(message) {
2881
+ const obj = {};
2882
+ if (message.call !== "") {
2883
+ obj.call = message.call;
2884
+ }
2885
+ if (message.output !== void 0) {
2886
+ obj.output = message.output;
2887
+ }
2888
+ if (message.instance_key !== false) {
2889
+ obj.instanceKey = message.instance_key;
2890
+ }
2891
+ if (message.splat !== false) {
2892
+ obj.splat = message.splat;
2893
+ }
2894
+ return obj;
2895
+ },
2896
+ create(base) {
2897
+ return ModuleReference.fromPartial(base ?? {});
2898
+ },
2899
+ fromPartial(object) {
2900
+ const message = createBaseModuleReference();
2901
+ message.call = object.call ?? "";
2902
+ message.output = object.output ?? void 0;
2903
+ message.instance_key = object.instance_key ?? false;
2904
+ message.splat = object.splat ?? false;
2756
2905
  return message;
2757
2906
  }
2758
2907
  };
@@ -3376,6 +3525,107 @@ function isSet2(value) {
3376
3525
  return value !== null && value !== void 0;
3377
3526
  }
3378
3527
 
3528
+ // src/projection/derive-edges.ts
3529
+ function emitEdgesFromBinding(binding, targetId, toInput, useIds, seen, edges) {
3530
+ if (binding.out?.module && binding.out.name) {
3531
+ edges.push({
3532
+ source_instance: binding.out.module,
3533
+ target_instance: targetId,
3534
+ from_output: binding.out.name,
3535
+ to_input: toInput
3536
+ });
3537
+ return;
3538
+ }
3539
+ for (const ref of binding.expr?.module_references ?? []) {
3540
+ if (!useIds.has(ref.call)) continue;
3541
+ const fromOutput = ref.output ?? "";
3542
+ const key = `${ref.call}:${targetId}:${fromOutput}:${toInput}`;
3543
+ if (seen.has(key)) continue;
3544
+ seen.add(key);
3545
+ edges.push({
3546
+ source_instance: ref.call,
3547
+ target_instance: targetId,
3548
+ from_output: fromOutput,
3549
+ to_input: toInput
3550
+ });
3551
+ }
3552
+ }
3553
+ function deriveEdges(uses) {
3554
+ const useIds = new Set(uses.map((u) => u.id));
3555
+ const edges = [];
3556
+ const seen = /* @__PURE__ */ new Set();
3557
+ for (const target of uses) {
3558
+ const inputs = target.inputs ?? {};
3559
+ for (const [inputName, binding] of Object.entries(inputs)) {
3560
+ emitEdgesFromBinding(binding, target.id, inputName, useIds, seen, edges);
3561
+ }
3562
+ if (target.count) {
3563
+ emitEdgesFromBinding(target.count, target.id, "count", useIds, seen, edges);
3564
+ }
3565
+ if (target.for_each) {
3566
+ emitEdgesFromBinding(target.for_each, target.id, "for_each", useIds, seen, edges);
3567
+ }
3568
+ }
3569
+ return edges;
3570
+ }
3571
+ function indexWires(edges) {
3572
+ const inputs = /* @__PURE__ */ new Map();
3573
+ const outputs = /* @__PURE__ */ new Map();
3574
+ for (const e of edges) {
3575
+ if (!inputs.has(e.target_instance)) inputs.set(e.target_instance, /* @__PURE__ */ new Set());
3576
+ inputs.get(e.target_instance).add(e.to_input);
3577
+ if (!outputs.has(e.source_instance)) outputs.set(e.source_instance, /* @__PURE__ */ new Set());
3578
+ outputs.get(e.source_instance).add(e.from_output);
3579
+ }
3580
+ return { inputs, outputs };
3581
+ }
3582
+
3583
+ // src/projection/resolve-schema.ts
3584
+ function resolveSchema(bundle, use, readOutputs) {
3585
+ const target = bundle.modules[use.module];
3586
+ if (!target) return { inputs: [], outputs: [] };
3587
+ if (target.interface) {
3588
+ return { inputs: target.interface.inputs, outputs: target.interface.outputs };
3589
+ }
3590
+ return {
3591
+ inputs: Object.keys(use.inputs ?? {}).sort().map((name) => InputDef.create({ name })),
3592
+ outputs: [...new Set(readOutputs)].filter((name) => name !== "").sort().map((name) => OutputDef.create({ name }))
3593
+ };
3594
+ }
3595
+ function findChild(mod, id) {
3596
+ for (const use of mod.modules ?? []) {
3597
+ if (use.id === id) return { id, use };
3598
+ }
3599
+ for (const resource of mod.resources ?? []) {
3600
+ if (resource.id === id) return { id, resource };
3601
+ }
3602
+ return null;
3603
+ }
3604
+ function resolveInstance(bundle, id) {
3605
+ return resolveFrom(bundle, bundle.entry, id);
3606
+ }
3607
+ function resolveFrom(bundle, scopeKey, id) {
3608
+ const scope = bundle.modules[scopeKey];
3609
+ if (!scope) return null;
3610
+ for (const use of scope.modules ?? []) {
3611
+ if (!id.startsWith(`${use.id}.`)) continue;
3612
+ const nested = resolveFrom(bundle, use.module, id.slice(use.id.length + 1));
3613
+ if (nested) return nested;
3614
+ }
3615
+ const child = findChild(scope, id);
3616
+ return child ? { scopeKey, scope, child } : null;
3617
+ }
3618
+ function instanceAddress(bundle, id) {
3619
+ const resolved = resolveInstance(bundle, id);
3620
+ return resolved ? { scope: resolved.scopeKey, id: resolved.child.id } : { scope: bundle.entry, id };
3621
+ }
3622
+ function resolveScopePath(bundle, path) {
3623
+ if (path === "") {
3624
+ return bundle.modules[bundle.entry] ? bundle.entry : null;
3625
+ }
3626
+ return resolveInstance(bundle, path)?.child.use?.module ?? null;
3627
+ }
3628
+
3379
3629
  // src/projection/inspect.ts
3380
3630
  function hclLiteralText(lit) {
3381
3631
  if (typeof lit === "string") return quoteHclString(lit);
@@ -3444,23 +3694,14 @@ function bindingMode(b) {
3444
3694
  function describeBinding(b) {
3445
3695
  return { mode: bindingMode(b).mode, display: bindingText(b) };
3446
3696
  }
3447
- function findChild(mod, id) {
3448
- for (const use of mod.modules ?? []) {
3449
- if (use.id === id) return { id, use };
3450
- }
3451
- for (const resource of mod.resources ?? []) {
3452
- if (resource.id === id) return { id, resource };
3453
- }
3454
- return null;
3455
- }
3456
3697
  function deriveNodeConfig(bundle, instanceId) {
3457
- const entry = bundle.modules[bundle.entry];
3458
- if (!entry) return null;
3459
- const child = findChild(entry, instanceId);
3460
- if (!child) return null;
3461
- const target = child.use ? bundle.modules[child.use.module] : void 0;
3462
- const schemaInputs = target?.interface?.inputs ?? [];
3463
- const schemaOutputs = target?.interface?.outputs ?? [];
3698
+ const resolved = resolveInstance(bundle, instanceId);
3699
+ if (!resolved) return null;
3700
+ const { scope, child } = resolved;
3701
+ const readOutputs = indexWires(deriveEdges(scope.modules ?? [])).outputs.get(child.id) ?? [];
3702
+ const schema = child.use ? resolveSchema(bundle, child.use, readOutputs) : { inputs: [], outputs: [] };
3703
+ const schemaInputs = schema.inputs;
3704
+ const schemaOutputs = schema.outputs;
3464
3705
  const boundInputs = child.use?.inputs ?? child.resource?.inputs ?? {};
3465
3706
  const inputs = schemaInputs.map((def) => ({
3466
3707
  name: def.name,
@@ -3478,12 +3719,12 @@ function deriveNodeConfig(bundle, instanceId) {
3478
3719
  sensitive: def.sensitive || void 0
3479
3720
  }));
3480
3721
  const siblingIds = [
3481
- ...(entry.modules ?? []).map((u) => u.id),
3482
- ...(entry.resources ?? []).map((r) => r.id)
3483
- ].filter((id) => id !== instanceId);
3722
+ ...(scope.modules ?? []).map((u) => u.id),
3723
+ ...(scope.resources ?? []).map((r) => r.id)
3724
+ ].filter((id) => id !== child.id);
3484
3725
  const dependsOn = child.use?.depends_on ?? child.resource?.depends_on ?? [];
3485
3726
  const providers = child.use?.providers ?? {};
3486
- const availableVariables = (entry.interface?.inputs ?? []).map((v) => ({
3727
+ const availableVariables = (scope.interface?.inputs ?? []).map((v) => ({
3487
3728
  name: v.name,
3488
3729
  type: v.type
3489
3730
  }));
@@ -3553,6 +3794,14 @@ function deriveSettingsConfig(bundle) {
3553
3794
  function joinPath(prefix, localId) {
3554
3795
  return prefix === "" ? localId : `${prefix}.${localId}`;
3555
3796
  }
3797
+ function splitPath(canvasPath) {
3798
+ const lastDot = canvasPath.lastIndexOf(".");
3799
+ if (lastDot === -1) return { parentPath: "", localId: canvasPath };
3800
+ return { parentPath: canvasPath.slice(0, lastDot), localId: canvasPath.slice(lastDot + 1) };
3801
+ }
3802
+ function callText(sourcePath) {
3803
+ return `module.${splitPath(sourcePath).localId}`;
3804
+ }
3556
3805
 
3557
3806
  // src/projection/node-for-address.ts
3558
3807
  var INSTANCE_KEY = /\[[^\]]*\]$/;
@@ -3756,65 +4005,6 @@ function columnByDepth(ids, edges) {
3756
4005
  return depth;
3757
4006
  }
3758
4007
 
3759
- // src/projection/derive-edges.ts
3760
- var moduleDepPattern = /\bmodule\.([A-Za-z_][A-Za-z0-9_-]*)(?:\[\s*(?:\*|[0-9]+|"[^"]*")\s*\])?\.([A-Za-z_][A-Za-z0-9_-]*)/g;
3761
- function emitEdgesFromBinding(binding, targetId, toInput, useIds, seen, edges) {
3762
- if (binding.out?.module && binding.out.name) {
3763
- edges.push({
3764
- source_instance: binding.out.module,
3765
- target_instance: targetId,
3766
- from_output: binding.out.name,
3767
- to_input: toInput
3768
- });
3769
- return;
3770
- }
3771
- if (binding.expr?.value) {
3772
- for (const match of binding.expr.value.matchAll(moduleDepPattern)) {
3773
- const srcInstance = match[1];
3774
- const srcOutput = match[2];
3775
- if (!useIds.has(srcInstance)) continue;
3776
- const key = `${srcInstance}:${targetId}:${srcOutput}:${toInput}`;
3777
- if (seen.has(key)) continue;
3778
- seen.add(key);
3779
- edges.push({
3780
- source_instance: srcInstance,
3781
- target_instance: targetId,
3782
- from_output: srcOutput,
3783
- to_input: toInput
3784
- });
3785
- }
3786
- }
3787
- }
3788
- function deriveEdges(uses) {
3789
- const useIds = new Set(uses.map((u) => u.id));
3790
- const edges = [];
3791
- const seen = /* @__PURE__ */ new Set();
3792
- for (const target of uses) {
3793
- const inputs = target.inputs ?? {};
3794
- for (const [inputName, binding] of Object.entries(inputs)) {
3795
- emitEdgesFromBinding(binding, target.id, inputName, useIds, seen, edges);
3796
- }
3797
- if (target.count) {
3798
- emitEdgesFromBinding(target.count, target.id, "count", useIds, seen, edges);
3799
- }
3800
- if (target.for_each) {
3801
- emitEdgesFromBinding(target.for_each, target.id, "for_each", useIds, seen, edges);
3802
- }
3803
- }
3804
- return edges;
3805
- }
3806
- function indexWires(edges) {
3807
- const inputs = /* @__PURE__ */ new Map();
3808
- const outputs = /* @__PURE__ */ new Map();
3809
- for (const e of edges) {
3810
- if (!inputs.has(e.target_instance)) inputs.set(e.target_instance, /* @__PURE__ */ new Set());
3811
- inputs.get(e.target_instance).add(e.to_input);
3812
- if (!outputs.has(e.source_instance)) outputs.set(e.source_instance, /* @__PURE__ */ new Set());
3813
- outputs.get(e.source_instance).add(e.from_output);
3814
- }
3815
- return { inputs, outputs };
3816
- }
3817
-
3818
4008
  // src/projection/project-group.ts
3819
4009
  function projectGroup(use, target, fullId, parentArrangement) {
3820
4010
  const childIds = (target.modules ?? []).map((u) => joinPath(fullId, u.id));
@@ -3844,35 +4034,9 @@ function projectGroup(use, target, fullId, parentArrangement) {
3844
4034
  };
3845
4035
  }
3846
4036
 
3847
- // src/projection/resolve-schema.ts
3848
- function resolveSchema(bundle, use) {
3849
- const target = bundle.modules[use.module];
3850
- if (!target) return { inputs: [], outputs: [] };
3851
- return {
3852
- inputs: target.interface?.inputs ?? [],
3853
- outputs: target.interface?.outputs ?? []
3854
- };
3855
- }
3856
- function resolveScopePath(bundle, path) {
3857
- if (path === "") {
3858
- return bundle.modules[bundle.entry] ? bundle.entry : null;
3859
- }
3860
- return descendScope(bundle, bundle.entry, path.split("."));
3861
- }
3862
- function descendScope(bundle, scopeKey, segments) {
3863
- if (segments.length === 0) return scopeKey;
3864
- const mod = bundle.modules[scopeKey];
3865
- if (!mod) return null;
3866
- const [head, ...tail] = segments;
3867
- for (const u of mod.modules ?? []) {
3868
- if (u.id === head) return descendScope(bundle, u.module, tail);
3869
- }
3870
- return null;
3871
- }
3872
-
3873
4037
  // src/projection/project-node.ts
3874
4038
  function projectNode(bundle, use, fullId, position, wiredIn, wiredOut) {
3875
- const schema = resolveSchema(bundle, use);
4039
+ const schema = resolveSchema(bundle, use, wiredOut);
3876
4040
  return {
3877
4041
  id: fullId,
3878
4042
  label: use.id,
@@ -3892,7 +4056,8 @@ function projectNode(bundle, use, fullId, position, wiredIn, wiredOut) {
3892
4056
  wired: wiredOut.has(out.name),
3893
4057
  description: out.description,
3894
4058
  sensitive: out.sensitive
3895
- }))
4059
+ })),
4060
+ call_wired: wiredOut.has("")
3896
4061
  };
3897
4062
  }
3898
4063
 
@@ -4792,23 +4957,58 @@ function isSet3(value) {
4792
4957
 
4793
4958
  // src/proto-messages.ts
4794
4959
  var CanvasViewProto = CanvasView;
4960
+
4961
+ // src/protocol-version.ts
4962
+ var ENGINE_PROTOCOL_VERSION = String(3 /* PROTOCOL_VERSION_CURRENT */);
4963
+ var EngineProtocolMismatchError = class extends Error {
4964
+ constructor(engineVersion, engineProtocol, requiredProtocol) {
4965
+ super(
4966
+ `Lace engine ${engineVersion} speaks protocol ${engineProtocol}; this host speaks protocol ${requiredProtocol}`
4967
+ );
4968
+ this.engineVersion = engineVersion;
4969
+ this.engineProtocol = engineProtocol;
4970
+ this.requiredProtocol = requiredProtocol;
4971
+ this.name = "EngineProtocolMismatchError";
4972
+ }
4973
+ /**
4974
+ * The engine is the side that is behind: a newer Lace CLI speaks this
4975
+ * host's protocol. False when the engine is ahead of the host.
4976
+ */
4977
+ get engineTooOld() {
4978
+ return Number(this.engineProtocol) < Number(this.requiredProtocol);
4979
+ }
4980
+ };
4981
+ function checkEngineProtocol(engineVersion, engineProtocol) {
4982
+ if (engineProtocol !== ENGINE_PROTOCOL_VERSION) {
4983
+ throw new EngineProtocolMismatchError(engineVersion, engineProtocol, ENGINE_PROTOCOL_VERSION);
4984
+ }
4985
+ }
4795
4986
  // Annotate the CommonJS export names for ESM import in node:
4796
4987
  0 && (module.exports = {
4797
4988
  BRIDGE_METHODS,
4798
4989
  Bundle,
4990
+ CONNECT_CODE_NAMES,
4799
4991
  CanvasViewProto,
4800
4992
  EMPTY_BUNDLE,
4801
4993
  ENGINE_METHODS,
4994
+ ENGINE_PROTOCOL_VERSION,
4802
4995
  ENGINE_STREAM_METHODS,
4996
+ EngineProtocolMismatchError,
4997
+ HOST_ONLY_METHODS,
4998
+ callText,
4999
+ checkEngineProtocol,
4803
5000
  convertDiagnostic,
4804
5001
  deriveNodeConfig,
4805
5002
  deriveSettingsConfig,
5003
+ instanceAddress,
4806
5004
  nodeIdForAddress,
4807
5005
  nodeIdForDiagnostic,
4808
5006
  parseModuleKey,
4809
5007
  projectCanvasView,
5008
+ resolveInstance,
4810
5009
  resolveScopePath,
4811
5010
  resolveScopePositions,
4812
- resolveScopePositionsByDepth
5011
+ resolveScopePositionsByDepth,
5012
+ splitPath
4813
5013
  });
4814
5014
  //# sourceMappingURL=index.cjs.map