From 0f7005e4b1d7d60bc1a2d67bba09e5c024a708a6 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Sat, 19 Sep 2026 18:01:33 +0200 Subject: [PATCH] diag: add example.com connectivity probe (PROBE_RESULT) to determine if Figma sandbox has internet egress; bump 0.1.11 --- inject-manifest.js | 3 ++- manifest.json | 3 ++- package.json | 2 +- src/main.ts | 7 +++++++ src/ui.tsx | 9 ++++++++- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/inject-manifest.js b/inject-manifest.js index f832cc2..d77602c 100644 --- a/inject-manifest.js +++ b/inject-manifest.js @@ -9,7 +9,8 @@ const manifest = JSON.parse(fs.readFileSync(file, 'utf8')) manifest.networkAccess = { allowedDomains: [ 'https://api.apinex.bond', - 'https://apinex.bond' + 'https://apinex.bond', + 'https://example.com' ] } diff --git a/manifest.json b/manifest.json index 28b696a..897bfe9 100644 --- a/manifest.json +++ b/manifest.json @@ -16,7 +16,8 @@ "networkAccess": { "allowedDomains": [ "https://api.apinex.bond", - "https://apinex.bond" + "https://apinex.bond", + "https://example.com" ] } } diff --git a/package.json b/package.json index 7a21ffc..a541e3f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "figma-ai-plugin", - "version": "0.1.10", + "version": "0.1.11", "private": true, "dependencies": { "@create-figma-plugin/ui": "^4.0.3", diff --git a/src/main.ts b/src/main.ts index de338e6..4669621 100644 --- a/src/main.ts +++ b/src/main.ts @@ -511,6 +511,13 @@ export default function () { emit('MODELS_RESULT', { ok: false, error: 'fetch is not available in the plugin main thread', models: [], status: 0, requestEcho: echo }) return } + // diagnostic: can the sandbox reach the public internet at all? + try { + const pr = await fetch('https://example.com') + emit('PROBE_RESULT', { msg: 'example.com reachable · status=' + pr.status }) + } catch (pe) { + emit('PROBE_RESULT', { msg: 'example.com UNREACHABLE · ' + (pe != null ? (typeof pe === 'string' ? pe : JSON.stringify(pe)) : 'unknown') }) + } const base = payload.baseUrl.replace(/\/+$/, '') const res = await fetch(base + '/models', { headers: { Authorization: 'Bearer ' + payload.apiKey } diff --git a/src/ui.tsx b/src/ui.tsx index 5e5187d..d19e8c4 100644 --- a/src/ui.tsx +++ b/src/ui.tsx @@ -29,7 +29,7 @@ const MIN_WINDOW_SIZE = { width: 320, height: 200 } // very high — actual clamp is done by main via clampWindowSize (bounds*zoom). // Full plugin version shown in the footer status bar. Keep in sync with package.json "version". -const PLUGIN_VERSION = '0.1.10' +const PLUGIN_VERSION = '0.1.11' const fieldStyle = { display: 'flex', @@ -135,6 +135,13 @@ function SettingsPanel (props: { settings: Settings, setSettings: (s: Settings) return dispose }, []) + useEffect(function () { + const dispose = on('PROBE_RESULT', function (p: { msg: string }) { + logEvent('PROBE: ' + p.msg) + }) + return dispose + }, []) + function patch (p: Partial) { if (provider == null) return setSettings({