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