with-figma 0.1.4 → 0.1.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.
@@ -30120,6 +30120,7 @@ var currentPage = null;
30120
30120
  var pages = [];
30121
30121
  var pendingRequests = /* @__PURE__ */ new Map();
30122
30122
  var requestCounter = 0;
30123
+ var chatQueue = [];
30123
30124
  function genRequestId() {
30124
30125
  return `req_${++requestCounter}_${Date.now()}`;
30125
30126
  }
@@ -30154,10 +30155,18 @@ function handleFigmaMessage(msg) {
30154
30155
  case "chat-message":
30155
30156
  currentSelection = msg.selection || currentSelection;
30156
30157
  currentPage = msg.page || currentPage;
30158
+ chatQueue.push({
30159
+ text: msg.text,
30160
+ selection: msg.selection || [],
30161
+ page: msg.page || null,
30162
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
30163
+ });
30164
+ console.error(`[with-figma] Chat message queued: "${msg.text}"`);
30157
30165
  if (figmaSocket) {
30158
30166
  figmaSocket.send(JSON.stringify({
30159
30167
  type: "chat-response",
30160
- text: `Received: "${msg.text}". Processing via AI agent...`
30168
+ text: `Queued for AI agent. Tell Codex in VS Code:
30169
+ "Check Figma messages and process them"`
30161
30170
  }));
30162
30171
  }
30163
30172
  break;
@@ -30358,6 +30367,28 @@ server.tool(
30358
30367
  };
30359
30368
  }
30360
30369
  );
30370
+ server.tool(
30371
+ "get_chat_messages",
30372
+ "Get pending chat messages from the Figma plugin. Users send design requests via the Figma chat UI. Call this tool to check for new messages, then use other Figma tools to fulfill the requests. After processing, the queue is cleared.",
30373
+ {},
30374
+ async () => {
30375
+ if (chatQueue.length === 0) {
30376
+ return {
30377
+ content: [{ type: "text", text: "No pending messages from Figma." }]
30378
+ };
30379
+ }
30380
+ const messages = [...chatQueue];
30381
+ chatQueue.length = 0;
30382
+ return {
30383
+ content: [
30384
+ {
30385
+ type: "text",
30386
+ text: JSON.stringify(messages, null, 2)
30387
+ }
30388
+ ]
30389
+ };
30390
+ }
30391
+ );
30361
30392
  server.tool(
30362
30393
  "send_chat_message",
30363
30394
  "Send a message back to the Figma plugin chat UI to communicate with the user.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "with-figma",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "MCP server that connects AI agents to Figma via WebSocket",
5
5
  "license": "MIT",
6
6
  "bin": {