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