@talonic/mcp 0.1.51 → 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
  })
@@ -838,9 +888,13 @@ var DESCRIPTION5 = [
838
888
  "STATUS: stable.",
839
889
  "",
840
890
  "List all saved schemas in the user's Talonic workspace.",
841
- "Returns each schema with its id (UUID), short_id (SCH-XXXXXXXX), name, description,",
842
- "version, field count, and full JSON Schema definition. Either id form is accepted by",
843
- "talonic_extract's `schema_id` parameter.",
891
+ "Returns a COMPACT SUMMARY of each schema: id (UUID), short_id (SCH-XXXXXXXX), name,",
892
+ "description, version, and field_count. Either id form is accepted by talonic_extract's",
893
+ "`schema_id` parameter, so you can extract with a saved schema straight from this list.",
894
+ "",
895
+ "The full JSON Schema definition for each field is intentionally NOT included here \u2014 for",
896
+ "many schemas that payload is large and gets truncated by some clients. To inspect a",
897
+ "schema's full field definitions, read the `talonic://schemas` resource.",
844
898
  "",
845
899
  "USE WHEN:",
846
900
  "- The user asks what schemas they have, or asks to see existing schemas.",
@@ -880,10 +934,18 @@ var outputSchema5 = {
880
934
  next_cursor: z.string().nullable().optional()
881
935
  }).optional().describe("Cursor-based pagination metadata.")
882
936
  };
937
+ var LIST_ITEM_OMIT = /* @__PURE__ */ new Set(["definition", "links"]);
883
938
  async function handleListSchemas(talonic) {
884
939
  try {
885
940
  const result = await talonic.schemas.list();
886
- return jsonOk(result);
941
+ const data = Array.isArray(result?.data) ? result.data.map((schema) => {
942
+ const summary = {};
943
+ for (const [key, value] of Object.entries(schema)) {
944
+ if (!LIST_ITEM_OMIT.has(key)) summary[key] = value;
945
+ }
946
+ return summary;
947
+ }) : result?.data;
948
+ return jsonOk({ ...result, data });
887
949
  } catch (err) {
888
950
  return toolError(err);
889
951
  }
@@ -1296,7 +1358,7 @@ function registerToMarkdown(server, getTalonic) {
1296
1358
 
1297
1359
  // package.json
1298
1360
  var package_default = {
1299
- version: "0.1.51"};
1361
+ version: "0.1.53"};
1300
1362
 
1301
1363
  // src/version.ts
1302
1364
  var VERSION = package_default.version;