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