openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
53 lines (52 loc) • 1.56 kB
JavaScript
//#region src/plugin-sdk/control-ui-session-link.ts
/**
* A plugin-owned accessory with the standard header link appearance and direct navigation.
*
* @deprecated Retained only so plugins built against OpenClaw 2026.10.1 still load; hosts no
* longer supply `props.session` to session-header accessories, so the link never renders.
* Render a custom accessory instead. Removal is tracked by `plugin-sdk-session-header-link`.
*/
function createSessionHeaderLink(e) {
return (t, n) => {
const r = document.createElement("a");
r.className = "plugin-session-header-link";
r.target = "_blank";
r.rel = "noopener noreferrer";
r.dataset.linkReaderExternal = "";
let i = false;
const dispose = () => {
i = true;
r.removeAttribute("href");
r.remove();
};
const update = (n) => {
if (i) return;
const a = n.presented && !n.signal.aborted && n.props.session ? e(n.props.session) : void 0;
const o = a ? URL.parse(a.url) : null;
if (!a || !o || o.protocol !== "https:" && o.protocol !== "http:") {
r.removeAttribute("href");
r.remove();
return;
}
r.href = o.href;
r.textContent = `${a.label} ↗`;
if (r.parentNode !== t) t.append(r);
};
n.signal.addEventListener("abort", dispose, { once: true });
update(n);
return {
update,
dispose() {
n.signal.removeEventListener("abort", dispose);
dispose();
}
};
};
}
//#endregion
//#region src/plugin-sdk/control-ui.ts
function defineControlUiPlugin(e) {
return e;
}
//#endregion
export { createSessionHeaderLink, defineControlUiPlugin };