@lace-cloud/canvas 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/README.md CHANGED
@@ -156,7 +156,12 @@ const { ports, close } = await openEngineSession(caller, { root: '/path/to/autho
156
156
  `Initialize` once, `Invoke` per command, no session and no Subscribe.
157
157
  - Both mappings name the protocol version this package speaks
158
158
  (`ENGINE_PROTOCOL_VERSION`, `@lace-cloud/proto`) on `Initialize`; an
159
- engine that speaks another refuses the call.
159
+ engine that speaks another refuses the call. Each checks the answer's
160
+ protocol version and contract against `ENGINE_PROTOCOL_VERSION` and
161
+ `ENGINE_CONTRACT` (`checkEngineIdentity`) and rejects with
162
+ `EngineIdentityMismatchError` before any other call when either differs,
163
+ so an engine built from another tree is refused before a command path is
164
+ bound or a document parsed.
160
165
  - Every `Invoke` names the one working directory its command runs in, as
161
166
  a terminal invocation has one, and no session: the engine takes the
162
167
  Workspace of the session it holds open on that directory when there is
@@ -3702,7 +3702,7 @@ var InitializeRequest = {
3702
3702
  }
3703
3703
  };
3704
3704
  function createBaseInitializeResponse() {
3705
- return { server_version: "", protocol_version: "", supported_protocols: [], command_paths: [] };
3705
+ return { server_version: "", protocol_version: "", supported_protocols: [], command_paths: [], contract: "" };
3706
3706
  }
3707
3707
  var InitializeResponse = {
3708
3708
  encode(message, writer = new BinaryWriter4()) {
@@ -3718,6 +3718,9 @@ var InitializeResponse = {
3718
3718
  for (const v of message.command_paths) {
3719
3719
  writer.uint32(42).string(v);
3720
3720
  }
3721
+ if (message.contract !== "") {
3722
+ writer.uint32(50).string(message.contract);
3723
+ }
3721
3724
  return writer;
3722
3725
  },
3723
3726
  decode(input, length) {
@@ -3755,6 +3758,13 @@ var InitializeResponse = {
3755
3758
  message.command_paths.push(reader.string());
3756
3759
  continue;
3757
3760
  }
3761
+ case 6: {
3762
+ if (tag !== 50) {
3763
+ break;
3764
+ }
3765
+ message.contract = reader.string();
3766
+ continue;
3767
+ }
3758
3768
  }
3759
3769
  if ((tag & 7) === 4 || tag === 0) {
3760
3770
  break;
@@ -3768,7 +3778,8 @@ var InitializeResponse = {
3768
3778
  server_version: isSet3(object.serverVersion) ? globalThis.String(object.serverVersion) : isSet3(object.server_version) ? globalThis.String(object.server_version) : "",
3769
3779
  protocol_version: isSet3(object.protocolVersion) ? globalThis.String(object.protocolVersion) : isSet3(object.protocol_version) ? globalThis.String(object.protocol_version) : "",
3770
3780
  supported_protocols: globalThis.Array.isArray(object?.supportedProtocols) ? object.supportedProtocols.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.supported_protocols) ? object.supported_protocols.map((e) => globalThis.String(e)) : [],
3771
- command_paths: globalThis.Array.isArray(object?.commandPaths) ? object.commandPaths.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.command_paths) ? object.command_paths.map((e) => globalThis.String(e)) : []
3781
+ command_paths: globalThis.Array.isArray(object?.commandPaths) ? object.commandPaths.map((e) => globalThis.String(e)) : globalThis.Array.isArray(object?.command_paths) ? object.command_paths.map((e) => globalThis.String(e)) : [],
3782
+ contract: isSet3(object.contract) ? globalThis.String(object.contract) : ""
3772
3783
  };
3773
3784
  },
3774
3785
  toJSON(message) {
@@ -3785,6 +3796,9 @@ var InitializeResponse = {
3785
3796
  if (message.command_paths?.length) {
3786
3797
  obj.commandPaths = message.command_paths;
3787
3798
  }
3799
+ if (message.contract !== "") {
3800
+ obj.contract = message.contract;
3801
+ }
3788
3802
  return obj;
3789
3803
  },
3790
3804
  create(base) {
@@ -3796,6 +3810,7 @@ var InitializeResponse = {
3796
3810
  message.protocol_version = object.protocol_version ?? "";
3797
3811
  message.supported_protocols = object.supported_protocols?.map((e) => e) || [];
3798
3812
  message.command_paths = object.command_paths?.map((e) => e) || [];
3813
+ message.contract = object.contract ?? "";
3799
3814
  return message;
3800
3815
  }
3801
3816
  };
@@ -10946,7 +10961,7 @@ function bridgeCaller(bridge) {
10946
10961
 
10947
10962
  // src/adapters/engine/mapping.ts
10948
10963
  import {
10949
- checkEngineProtocol,
10964
+ checkEngineIdentity,
10950
10965
  convertDiagnostic,
10951
10966
  EMPTY_BUNDLE,
10952
10967
  ENGINE_PROTOCOL_VERSION
@@ -11689,6 +11704,13 @@ var COMMANDS = {
11689
11704
  },
11690
11705
  "readme": {
11691
11706
  "type": "string"
11707
+ },
11708
+ "visibility": {
11709
+ "type": "string",
11710
+ "values": [
11711
+ "public",
11712
+ "org_private"
11713
+ ]
11692
11714
  }
11693
11715
  },
11694
11716
  "effect": "read",
@@ -12462,7 +12484,6 @@ var commandFailureSchema = z.strictObject({
12462
12484
  var moduleValidateDeviationSchema = z.object({
12463
12485
  notCompositional: z.boolean(),
12464
12486
  clusters: z.array(z.unknown()),
12465
- residuals: z.array(z.unknown()),
12466
12487
  hasManagedBackend: z.boolean(),
12467
12488
  backendFindings: z.array(z.object({ file: z.string(), line: z.number(), kind: z.string() })),
12468
12489
  sharedLocalSource: z.boolean(),
@@ -12558,7 +12579,8 @@ var registryListSchema = z.object({
12558
12579
  })
12559
12580
  ),
12560
12581
  truncated: z.boolean(),
12561
- publishingGuideUrl: z.string()
12582
+ publishingGuideUrl: z.string(),
12583
+ scopeNotice: z.string().optional()
12562
12584
  });
12563
12585
  var registryManifestSchema = z.object({
12564
12586
  id: z.string(),
@@ -13136,7 +13158,11 @@ async function initialize(caller) {
13136
13158
  client_version: "@lace-cloud/canvas",
13137
13159
  protocol_version: ENGINE_PROTOCOL_VERSION
13138
13160
  });
13139
- checkEngineProtocol(initialize2.server_version, initialize2.protocol_version);
13161
+ checkEngineIdentity({
13162
+ version: initialize2.server_version,
13163
+ protocol: initialize2.protocol_version,
13164
+ contract: initialize2.contract
13165
+ });
13140
13166
  return new Set(initialize2.command_paths);
13141
13167
  }
13142
13168
  async function openEngineCommands(caller, { cwd }) {
@@ -13578,7 +13604,11 @@ function diagnosticsOfDocument(document) {
13578
13604
  }));
13579
13605
  }
13580
13606
  function diagnosticsOfEntry(entry) {
13581
- return entry.kind === "failure" ? [{ severity: "error", message: entry.failure.message }] : diagnosticsOfDocument(entry.document);
13607
+ if (entry.kind === "failure") return [{ severity: "error", message: entry.failure.message }];
13608
+ const found = diagnosticsOfDocument(entry.document);
13609
+ if (entry.path !== "module validate") return found;
13610
+ const { failure } = entry.document;
13611
+ return failure && !found.some((d) => d.severity === "error") ? [...found, { severity: "error", message: failure.message }] : found;
13582
13612
  }
13583
13613
  function reportDiagnostics(fold) {
13584
13614
  return uniqueDiagnostics(
@@ -14062,6 +14092,13 @@ function validateNotice(v) {
14062
14092
  const why = whyNotValid(v);
14063
14093
  return ["warn", why === void 0 ? "Not valid for Lace" : `Not valid: ${why}`];
14064
14094
  }
14095
+ function generateNotice(e) {
14096
+ if (e.validate.exitClass === "ok") return void 0;
14097
+ const tree = generatedTree(e);
14098
+ const count = tree.changed.length + tree.unchanged;
14099
+ const generated2 = count === 0 ? "Generated \u2014 nothing to write" : `Generated \u2014 ${counted(count, "file")} written`;
14100
+ return ["warn", `${generated2}. ${didNotValidate(e.validate)}`, ...beside(e.validate)];
14101
+ }
14065
14102
  function convertNotice(e) {
14066
14103
  const locked = e.lock === null ? "" : `, locking ${lockedIn(e.lock)}`;
14067
14104
  const converted = e.changed ? `Converted \u2014 ${e.written.length} file(s) written${locked}` : "Already lace-style \u2014 nothing to write";
@@ -14688,6 +14725,10 @@ function createActionRunner(ports, store, options = {}) {
14688
14725
  if (binding.result === "generate") {
14689
14726
  for await (const event of binding.run(env)) {
14690
14727
  if (event.type === "error") ports.presenter.notify("error", event.message);
14728
+ if (event.type === "success") {
14729
+ const notice = generateNotice(event);
14730
+ if (notice) ports.presenter.notify(...notice);
14731
+ }
14691
14732
  }
14692
14733
  return;
14693
14734
  }
@@ -14952,4 +14993,4 @@ export {
14952
14993
  AutosaveEndedError,
14953
14994
  autosave
14954
14995
  };
14955
- //# sourceMappingURL=chunk-O3I4KLND.mjs.map
14996
+ //# sourceMappingURL=chunk-XPHDFIKV.mjs.map