@talonic/mcp 0.1.52 → 0.1.53

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.
@@ -246,13 +246,42 @@ var WIDGET_HTML = `<!doctype html>
246
246
  });
247
247
  }
248
248
 
249
- // Apps SDK delivers tool results via JSON-RPC notifications over postMessage.
250
- // The host posts { method: "ui/notifications/tool-result", params: { structuredContent } }.
249
+ // PRIMARY channel: OpenAI Apps SDK injects the tool's structuredContent as
250
+ // window.openai.toolOutput and fires "openai:set_globals" whenever globals
251
+ // change. This is the documented widget data API.
252
+ function payloadFromHost() {
253
+ return (window.openai && window.openai.toolOutput) || null;
254
+ }
255
+
256
+ function renderFromHost() {
257
+ render(payloadFromHost());
258
+ }
259
+
260
+ // Initial paint: toolOutput is normally present by the time the iframe runs.
261
+ renderFromHost();
262
+
263
+ // Re-render whenever the host pushes new globals.
264
+ window.addEventListener(
265
+ "openai:set_globals",
266
+ function (event) {
267
+ var globals = event && event.detail && event.detail.globals;
268
+ var output = globals && globals.toolOutput;
269
+ if (output) {
270
+ window.openai = window.openai || {};
271
+ window.openai.toolOutput = output;
272
+ }
273
+ renderFromHost();
274
+ },
275
+ { passive: true }
276
+ );
277
+
278
+ // FALLBACK channel: some host versions also post the raw MCP bridge
279
+ // notification { method: "ui/notifications/tool-result", params: { structuredContent } }.
251
280
  window.addEventListener("message", function (event) {
252
281
  var msg = event.data;
253
282
  if (!msg || msg.method !== "ui/notifications/tool-result") return;
254
283
  var sc = msg.params && msg.params.structuredContent;
255
- render(sc);
284
+ if (sc) render(sc);
256
285
  });
257
286
  })();
258
287
  </script>
@@ -278,7 +307,28 @@ function registerExtractionResultWidget(server) {
278
307
  {
279
308
  uri: EXTRACTION_RESULT_WIDGET_URI,
280
309
  mimeType: EXTRACTION_RESULT_WIDGET_MIME,
281
- text: getExtractionResultWidgetHtml()
310
+ text: getExtractionResultWidgetHtml(),
311
+ // Content Security Policy. The widget is fully self-contained — it
312
+ // makes no external network calls, loads no external resources, and
313
+ // embeds no external frames — so every domain list is empty. The CSP
314
+ // must still be declared: ChatGPT flags the widget "CSP off"
315
+ // otherwise, and the Apps SDK submission guidelines require it.
316
+ // Both keys are emitted: `ui.csp` (modern) and `openai/widgetCSP`
317
+ // (legacy ChatGPT compatibility).
318
+ _meta: {
319
+ ui: {
320
+ csp: {
321
+ connectDomains: [],
322
+ resourceDomains: [],
323
+ frameDomains: []
324
+ }
325
+ },
326
+ "openai/widgetCSP": {
327
+ connect_domains: [],
328
+ resource_domains: [],
329
+ redirect_domains: []
330
+ }
331
+ }
282
332
  }
283
333
  ]
284
334
  })
@@ -1314,7 +1364,7 @@ function registerToMarkdown(server, getTalonic) {
1314
1364
 
1315
1365
  // package.json
1316
1366
  var package_default = {
1317
- version: "0.1.52"};
1367
+ version: "0.1.53"};
1318
1368
 
1319
1369
  // src/version.ts
1320
1370
  var VERSION = package_default.version;