bridgerator 1.1.4 → 1.1.6

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/src/policy.mjs CHANGED
@@ -274,6 +274,11 @@ export function createPolicy(cfg = {}) {
274
274
  // The bundled engine's own name and links are not shown to the user: tool titles/descriptions and
275
275
  // widget HTML say Bridgerator. Tool RESULTS are never rewritten (they are the user's own data).
276
276
  const BRAND = [[/"DC: \.\.\." or /g, ''], [/Desktop ?Commander/g, 'Bridgerator'], [/https?:\/\/(www\.)?desktopcommander\.app[^\s"'\)<]*/g, 'https://bridgerator.recondeck.com']];
277
+ // The engine's widget URIs and their in-page state key carry its name: ChatGPT sees them in tool _meta and resources.
278
+ // Shown as ui://bridgerator/…, mapped back when a resource is read (owner 26.10: "как будто наш код").
279
+ const UI_ENGINE = 'ui://desktop-commander/', UI_OURS = 'ui://bridgerator/';
280
+ export const ourUi = (v) => JSON.parse(JSON.stringify(v).replaceAll(UI_ENGINE, UI_OURS).replaceAll('desktop-commander:widget-state', 'bridgerator:widget-state'));
281
+ export const engineUi = (uri) => String(uri).replace(UI_OURS, UI_ENGINE);
277
282
  export function debrand(v) {
278
283
  if (typeof v === 'string') return BRAND.reduce((s, [re, to]) => s.replace(re, to), v);
279
284
  if (Array.isArray(v)) return v.map(debrand);