@todoforai/figma-api 1.0.3 → 1.0.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/bridge.ts +9 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todoforai/figma-api",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Figma CLI — full REST API wrapper (files, comments, variables, webhooks…) plus a plugin bridge for canvas writes.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/bridge.ts CHANGED
@@ -34,6 +34,11 @@ function json(body: unknown, status = 200): Response {
34
34
  export function startBridge(port: number): void {
35
35
  Bun.serve({
36
36
  port,
37
+ // Bun's default idleTimeout (10s) is shorter than our 25s /poll long-poll and
38
+ // 30s /cmd result-wait, so it would sever those connections mid-wait — making
39
+ // the plugin's fetch throw ("Relay unreachable") and commands silently time
40
+ // out. Hold connections long enough to cover both.
41
+ idleTimeout: 60,
37
42
  async fetch(req) {
38
43
  const url = new URL(req.url);
39
44
  if (req.method === "OPTIONS") return json({}, 204);
@@ -94,10 +99,10 @@ const setup = () => `
94
99
  Canvas writes (create frames/text/shapes, edit variables off-Enterprise) aren't in
95
100
  the Figma REST API — they need the plugin bridge, which the user must install.
96
101
 
97
- AGENT: don't do this silently. First tell the user this grants write access to
98
- their Figma documents and ask if they want to install the bridge plugin. If yes,
99
- walk them through these steps (the plugin runs in THEIR Figma, you can't do step 2
100
- for them):
102
+ AGENT: be explicit with the user about this. Explain that the bridge plugin grants
103
+ write access to their Figma documents, confirm they want to install it, then walk
104
+ them through these steps (the plugin runs in THEIR Figma, you can't do step 2 for
105
+ them):
101
106
  1. Start the relay (keep running): figma-api bridge
102
107
  2. In the Figma DESKTOP app: Plugins → Development → Import plugin from manifest
103
108
  → ${manifestPath()}