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