figma-relai 0.7.4 → 0.7.5

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.
@@ -10,13 +10,16 @@ import {
10
10
  __export
11
11
  } from "./chunk-2H7UOFLK.js";
12
12
 
13
+ // src/version.ts
14
+ var VERSION = "0.7.5";
15
+
13
16
  // src/server.ts
14
17
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
15
18
  function createServer() {
16
19
  return new McpServer(
17
20
  {
18
21
  name: "Relai",
19
- version: "0.7.4"
22
+ version: VERSION
20
23
  },
21
24
  {
22
25
  instructions: `
@@ -866,10 +869,12 @@ var FileIdentityError = class extends Error {
866
869
  };
867
870
  async function resolveFileIdentity(sendCommand) {
868
871
  const probe = await sendCommand("get_file_identity", {});
869
- if (probe?.identity?.fileKey) return probe.identity;
872
+ const cached = probe?.identity?.fileKey ? probe.identity : null;
873
+ if (cached && cached.by === VERSION) return cached;
870
874
  const rootName = probe?.rootName ?? "";
871
875
  const candidates = probe?.candidates ?? [];
872
876
  if (candidates.length === 0) {
877
+ if (cached) return cached;
873
878
  throw new FileIdentityError(
874
879
  "This file publishes no components, so its key cannot be resolved from the plugin (figma.fileKey is private-plugin-only)."
875
880
  );
@@ -904,7 +909,8 @@ async function resolveFileIdentity(sendCommand) {
904
909
  const file = await figmaApi(token, `/files/${main.fileKey}?branch_data=true&depth=1`);
905
910
  const identity = {
906
911
  fileKey: main.fileKey,
907
- fileName: typeof file.json.name === "string" ? file.json.name : rootName
912
+ fileName: typeof file.json.name === "string" ? file.json.name : rootName,
913
+ by: VERSION
908
914
  };
909
915
  if (rootName && rootName !== identity.fileName) {
910
916
  const branches = file.json.branches ?? [];
@@ -4464,6 +4470,7 @@ function registerPrompts(server) {
4464
4470
  }
4465
4471
 
4466
4472
  export {
4473
+ VERSION,
4467
4474
  createServer,
4468
4475
  FIGMA_COMMANDS,
4469
4476
  RelayCore,
@@ -4475,4 +4482,4 @@ export {
4475
4482
  listToolCatalog,
4476
4483
  registerPrompts
4477
4484
  };
4478
- //# sourceMappingURL=chunk-BW7VTSKX.js.map
4485
+ //# sourceMappingURL=chunk-BRUWHN2A.js.map