@markupai/sidebar-adapter 2.3.0 → 2.5.0
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/README.md +96 -11
- package/asyncapi.json +201 -41
- package/dist/adapters/index.d.ts +2 -2
- package/dist/adapters/pluginAdapter.d.ts +15 -3
- package/dist/adapters/pluginAdapter.d.ts.map +1 -1
- package/dist/adapters/sidebarAdapter.d.ts +2 -2
- package/dist/adapters/sidebarAdapter.d.ts.map +1 -1
- package/dist/errors.d.ts +12 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/ipc/call-signatures.d.ts +15 -2
- package/dist/ipc/call-signatures.d.ts.map +1 -1
- package/dist/ipc/deferred-promise.d.ts.map +1 -1
- package/dist/ipc/index.d.ts +8 -8
- package/dist/ipc/index.d.ts.map +1 -1
- package/dist/ipc/ipc-core.d.ts +32 -3
- package/dist/ipc/ipc-core.d.ts.map +1 -1
- package/dist/ipc/message-types.d.ts +35 -4
- package/dist/ipc/message-types.d.ts.map +1 -1
- package/dist/ipc/plugin-ipc-adapter.d.ts +16 -5
- package/dist/ipc/plugin-ipc-adapter.d.ts.map +1 -1
- package/dist/ipc/replace-progress.d.ts +9 -0
- package/dist/ipc/replace-progress.d.ts.map +1 -0
- package/dist/ipc/sidebar-build-info.d.ts +1 -1
- package/dist/ipc/sidebar-ipc-adapter.d.ts +4 -4
- package/dist/ipc/sidebar-ipc-adapter.d.ts.map +1 -1
- package/dist/load-overlay/loadOverlayStyles.d.ts.map +1 -1
- package/dist/load-overlay/sidebarLoadOverlay.d.ts.map +1 -1
- package/dist/main.js +319 -210
- package/dist/main.umd.cjs +7 -7
- package/dist/sidebar-host/createSidebarHost.d.ts +4 -4
- package/dist/types/common.d.ts +30 -0
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/integrationSettings.d.ts.map +1 -1
- package/dist/types/pluginInterface.d.ts +38 -2
- package/dist/types/pluginInterface.d.ts.map +1 -1
- package/dist/types/progress.d.ts +18 -0
- package/dist/types/progress.d.ts.map +1 -0
- package/package.json +3 -3
package/dist/main.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(i,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(i=typeof globalThis<"u"?globalThis:i||self,g(i.main={}))})(this,function(i){Object.defineProperty(i,Symbol.toStringTag,{value:"Module"});var g=(function(e){return e.TEXT_PLAIN="text/plain",e.TEXT_MARKDOWN="text/markdown",e.TEXT_HTML="text/html",e.APPLICATION_DITA_XML="application/dita+xml",e})({}),te=["text/plain","text/markdown","text/html","application/dita+xml"],ne={integrationName:"unknown",integrationVersion:"unknown",integrationId:"markupai-sidebar-app",hideBanner:!1,supportCheckSelection:!0,multiAgent:!1,multiDocument:!1},re=e=>typeof e!="object"||e===null?!1:Array.isArray(e.fields),ie=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.id!="string"||t.id.length===0||typeof t.label!="string"?!1:t.type==="boolean"?typeof t.default=="boolean":t.type==="enum"?typeof t.default!="string"||!Array.isArray(t.options)||t.options.length===0?!1:t.options.every(n=>{if(typeof n!="object"||n===null)return!1;const r=n;return typeof r.value=="string"&&typeof r.label=="string"}):!1},R="2.3.0",h=class Q extends Error{name="TextLookupError";constructor(t){super(t),Object.setPrototypeOf(this,Q.prototype)}},v=class ee extends h{name="ReplaceBatchError";applied;failed;constructor(t,n){super(t),this.applied=n.applied.map(r=>({start:r.start,end:r.end})),this.failed=n.failed.map(r=>T(r,r.message)),Object.setPrototypeOf(this,ee.prototype)}};function ae(e){return e instanceof v}function T(e,t){const n={start:e.start,end:e.end};return typeof t=="string"&&t.trim()!==""&&(n.message=t),n}function O(e){return Array.isArray(e)?e.flatMap(t=>{if(t===null||typeof t!="object")return[];const{start:n,end:r,message:a}=t;return typeof n!="number"||typeof r!="number"?[]:[{range:{start:n,end:r},message:a}]}):[]}function oe(e){return e instanceof h}var C={TextLookupError:e=>new h(e),ReplaceBatchError:(e,t)=>new v(e,{applied:O(t.applied).map(n=>n.range),failed:O(t.failed).map(n=>T(n.range,n.message))})};function _(e){const t=e.message??"",n=e.name,r=typeof n=="string"&&n in C?C[n]:void 0;return r?r(t,e):Object.assign(new Error(t),n?{name:n}:{})}var D=":",L=/^[a-z][a-z0-9-]*$/;function se(e){const t=e.indexOf(D);return t<=0||t===e.length-1?!1:L.test(e.slice(0,t))}function le(e,t){const n=e.trim().toLowerCase(),r=t.trim();if(!L.test(n))throw new Error(`Invalid document reference prefix ${JSON.stringify(e)}: expected a lowercase name like "word".`);if(r.length===0)throw new Error("Invalid document reference: the document id is empty.");const a=`${n}${D}`;return r.startsWith(a)?r:`${a}${r}`}var M=class extends Promise{static get[Symbol.species](){return Promise}resolve;reject;constructor(e=()=>{}){let t,n;super((r,a)=>{t=r,n=a,e(r,a)}),this.resolve=t,this.reject=n}},B={timeout:1e4};function ce(e){const t=typeof e=="object"&&e!==null?Object.fromEntries(Object.getOwnPropertyNames(e).map(s=>[s,e[s]])):{},n=e instanceof Error?e.message:String(e),r=typeof t.message=="string"&&t.message!==""?t.message:n,a=e instanceof Error?e.name:void 0,o=typeof t.name=="string"?t.name:a;return JSON.stringify({...t,message:r,...o!==void 0&&{name:o}})}var b=class{promisesByID={};receiversByName={};currentID=0;config;postMessage;constructor(e,t){this.postMessage=e,this.config={...B,...t}}configure(e){this.config={...this.config,...e}}call(e,...t){return this.callWithOptions(e,{},...t)}callWithOptions(e,t,...n){const r=this.currentID++,a=new M,o=t.timeout??this.config.timeout,s=setTimeout(()=>{if(r in this.promisesByID){const c=new Error(`IPC call timeout: "${e}" did not respond within ${String(o)}ms`);a.reject(c),Reflect.deleteProperty(this.promisesByID,r)}},o);this.promisesByID[r]={promise:a,timeoutId:s};const l={type:"call",id:r,name:e,data:n};return this.postMessage(l),a}receive(e,t){this.receiversByName[e]=t}ignore(e){delete this.receiversByName[e]}async handleMessage(e){switch(e.type){case"call":await this.handleCall(e);break;case"response":this.handleResponse(e);break;case"error":this.handleError(e);break;default:}}async handleCall(e){const{id:t,name:n,data:r}=e;if(!(n in this.receiversByName)){const o=new Error(`No receiver registered for: ${n}`),s=JSON.stringify({message:o.message,name:o.name});this.postMessage({type:"error",id:t,name:n,errorJSON:s});return}const a=this.receiversByName[n];try{if(!Array.isArray(r))throw new TypeError(`IPC: Expected array of arguments but got ${typeof r}`);const o=await a(...r),s={type:"response",id:t,name:n,data:o};this.postMessage(s)}catch(o){const s={type:"error",id:t,name:n,errorJSON:ce(o)};this.postMessage(s)}}handleResponse(e){const{id:t}=e;if(t in this.promisesByID){const{promise:n,timeoutId:r}=this.promisesByID[t];clearTimeout(r),n.resolve(e.data),Reflect.deleteProperty(this.promisesByID,t)}}handleError(e){const{id:t,errorJSON:n}=e;if(t in this.promisesByID){const{promise:r,timeoutId:a}=this.promisesByID[t];clearTimeout(a);try{const o=JSON.parse(n),s=_(o);r.reject(s)}catch{r.reject(new Error("Failed to parse error from IPC"))}Reflect.deleteProperty(this.promisesByID,t)}}destroy(){for(const{promise:e,timeoutId:t}of Object.values(this.promisesByID))clearTimeout(t),e.reject(new Error("IPC destroyed"));this.promisesByID={},this.receiversByName={}}},Ne=64,de=new Set(["auto","prompt"]),S=(e,t)=>{const n=e[t];if(!(typeof n!="string"||n.length===0))return n.slice(0,64)};function ge(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,n=S(t,"version"),r=S(t,"commitHash");if(n===void 0||r===void 0)return null;const a={version:n,commitHash:r};typeof t.swControlled=="boolean"&&(a.swControlled=t.swControlled),de.has(t.pwaUpdateMode)&&(a.pwaUpdateMode=t.pwaUpdateMode);const o=S(t,"adapterVersion");return o!==void 0&&(a.adapterVersion=o),a}function ue(e){return typeof e!="string"||e.length===0?null:e.slice(0,64)}function He(e,t){if(!e)return`getInitConfig from sidebar build unknown (no valid build report — sidebar predates build reporting; host adapter ${t})`;const n=[e.commitHash];return e.swControlled!==void 0&&n.push(e.swControlled?"sw-controlled":"network"),e.pwaUpdateMode&&n.push(`${e.pwaUpdateMode} update mode`),e.adapterVersion&&n.push(`sidebar adapter ${e.adapterVersion}`),n.push(`host adapter ${t}`),`getInitConfig from sidebar v${e.version} (${n.join(", ")})`}var k=class{ipc;sidebar;targetOrigin;latestHostAdapterVersion=null;constructor(e,t,n="*"){this.sidebar=e||{},this.targetOrigin=n,this.ipc=new b(r=>{window.parent.postMessage(r,this.targetOrigin)},t),window.addEventListener("message",this.handleMessage),this.registerReceivers()}handleMessage=e=>{const t=globalThis.window.location.origin,n=this.targetOrigin;e.origin!==t&&(n!=="*"&&e.origin!==n||e.data&&typeof e.data=="object"&&this.ipc.handleMessage(e.data))};registerReceivers(){if(this.sidebar.onPluginStatusChange){const e=this.sidebar.onPluginStatusChange;this.ipc.receive("onPluginStatusChange",async(t,n)=>{await e(t,n)})}if(this.sidebar.activateAgenticIssue){const e=this.sidebar.activateAgenticIssue;this.ipc.receive("activateAgenticIssue",async(t,n)=>{await e(t,typeof n=="string"?n:null)})}if(this.sidebar.invalidateAgenticIssue){const e=this.sidebar.invalidateAgenticIssue;this.ipc.receive("invalidateAgenticIssue",async t=>{await e(t)})}if(this.sidebar.markAgenticIssueResolved){const e=this.sidebar.markAgenticIssueResolved;this.ipc.receive("markAgenticIssueResolved",async t=>{await e(t)})}if(this.sidebar.restoreAgenticIssue){const e=this.sidebar.restoreAgenticIssue;this.ipc.receive("restoreAgenticIssue",async t=>{await e(t)})}if(this.sidebar.applyIntegrationSettings){const e=this.sidebar.applyIntegrationSettings;this.ipc.receive("applyIntegrationSettings",async t=>{await e(t)})}if(this.sidebar.getIntegrationSettings){const e=this.sidebar.getIntegrationSettings;this.ipc.receive("getIntegrationSettings",async()=>await e())}if(this.sidebar.onActiveDocumentChanged){const e=this.sidebar.onActiveDocumentChanged;this.ipc.receive("onActiveDocumentChanged",async t=>{await e(t)})}}async getInitConfig(e){const{hostAdapterVersion:t,...n}=e?await this.ipc.call("getInitConfig",{...e,adapterVersion:e.adapterVersion??"2.3.0"}):await this.ipc.call("getInitConfig");return this.latestHostAdapterVersion=ue(t),n}getHostAdapterVersion(){return this.latestHostAdapterVersion}async getContent(e){return this.ipc.callWithOptions("getContent",e??{})}async getSelectedContent(e){return this.ipc.callWithOptions("getSelectedContent",e??{})}async replaceContent(e,t,n=null){await this.ipc.call("replaceContent",e,t,n)}async selectContent(e,t=null){await this.ipc.call("selectContent",e,t)}async replaceMultipleContents(e){await this.ipc.call("replaceMultipleContents",e)}async onAgenticAgentResults(e,t,n=null){await this.ipc.call("onAgenticAgentResults",e,t,n)}async onAgenticStreamComplete(e=null){await this.ipc.call("onAgenticStreamComplete",e)}async onAgenticIssueStatusChanged(e,t,n){await this.ipc.call("onAgenticIssueStatusChanged",e,t,n)}async onAgenticIssuesCleared(e=null){await this.ipc.call("onAgenticIssuesCleared",e)}async openAuthUrl(e){await this.ipc.call("openAuthUrl",e)}async copyToClipboard(e){await this.ipc.call("copyToClipboard",e)}async onIntegrationSettingsChange(e,t){await this.ipc.call("onIntegrationSettingsChange",e,t)}configure(e){this.ipc.configure(e)}setTargetOrigin(e){if(!e||typeof e!="string")throw new Error("Invalid targetOrigin: must be a non-empty string");try{const t=new URL(e);if(!["http:","https:"].includes(t.protocol)||!t.host)throw new Error("Invalid targetOrigin: protocol must be http or https and must have a host")}catch{throw new Error("Invalid targetOrigin: must be a valid origin (e.g., https://example.com)")}this.targetOrigin=e}getTargetOrigin(){return this.targetOrigin}destroy(){window.removeEventListener("message",this.handleMessage),this.ipc.destroy()}},pe=class{ipcAdapter;constructor(e,t,n){this.ipcAdapter=new k(e,t,n)}destroy(){this.ipcAdapter.destroy()}async getInitConfig(e){return await this.ipcAdapter.getInitConfig(e)}getHostAdapterVersion(){return this.ipcAdapter.getHostAdapterVersion()}async getContent(e){return await this.ipcAdapter.getContent(e)}async getSelectedContent(e){return await this.ipcAdapter.getSelectedContent(e)}async replaceContent(e,t,n=null){await this.ipcAdapter.replaceContent(e,t,n)}async selectContent(e,t=null){await this.ipcAdapter.selectContent(e,t)}async replaceMultipleContents(e){await this.ipcAdapter.replaceMultipleContents(e)}onAgenticAgentResults(e,t,n=null){return this.ipcAdapter.onAgenticAgentResults(e,t,n)}onAgenticStreamComplete(e=null){return this.ipcAdapter.onAgenticStreamComplete(e)}onAgenticIssueStatusChanged(e,t,n){return this.ipcAdapter.onAgenticIssueStatusChanged(e,t,n)}onAgenticIssuesCleared(e=null){return this.ipcAdapter.onAgenticIssuesCleared(e)}openAuthUrl(e){return this.ipcAdapter.openAuthUrl(e)}copyToClipboard(e){return this.ipcAdapter.copyToClipboard(e)}onIntegrationSettingsChange(e,t){return this.ipcAdapter.onIntegrationSettingsChange(e,t)}configure(e){this.ipcAdapter.configure(e)}setTargetOrigin(e){this.ipcAdapter.setTargetOrigin(e)}getTargetOrigin(){return this.ipcAdapter.getTargetOrigin()}},N=class{ipc;plugin;iframe;window;targetOrigin;latestSidebarBuildInfo=null;constructor(e,t,n,r,a="*"){this.plugin=e,this.iframe=t,this.window=n??window,this.targetOrigin=a,this.ipc=new b(o=>{this.iframe.contentWindow?.postMessage(o,this.targetOrigin)},r),this.window.addEventListener("message",this.handleMessage,!1),this.registerReceivers()}handleMessage=e=>{const t=this.window.location.origin,n=this.targetOrigin;e.origin!==t&&(n!=="*"&&e.origin!==n||e.data&&typeof e.data=="object"&&this.ipc.handleMessage(e.data))};registerReceivers(){if(this.ipc.receive("getInitConfig",async e=>{const t=ge(e);return this.latestSidebarBuildInfo=t,{...await this.plugin.getInitConfig(t??void 0),hostAdapterVersion:R}}),this.ipc.receive("getContent",async()=>await this.plugin.getContent()),this.ipc.receive("getSelectedContent",async()=>await this.plugin.getSelectedContent()),this.ipc.receive("replaceContent",async(e,t,n)=>{await this.plugin.replaceContent(e,t,typeof n=="string"?n:null)}),this.ipc.receive("selectContent",async(e,t)=>{await this.plugin.selectContent(e,typeof t=="string"?t:null)}),this.ipc.receive("replaceMultipleContents",async e=>{await this.plugin.replaceMultipleContents(e)}),this.ipc.receive("onAgenticAgentResults",async(e,t,n)=>{if(!Array.isArray(t))return;const r=this.plugin.onAgenticAgentResults;r&&await r(e,t,typeof n=="string"?n:null)}),this.ipc.receive("onAgenticStreamComplete",async e=>{const t=this.plugin.onAgenticStreamComplete;t&&await t(typeof e=="string"?e:null)}),this.ipc.receive("onAgenticIssueStatusChanged",async(e,t,n)=>{const r=this.plugin.onAgenticIssueStatusChanged;if(r&&!(t!=="active"&&t!=="resolved"&&t!=="dismissed"||n!=="user"&&n!=="host"))try{await r(e,t,n)}catch{}}),this.ipc.receive("onAgenticIssuesCleared",async e=>{const t=this.plugin.onAgenticIssuesCleared;if(t)try{await t(typeof e=="string"?e:null)}catch{}}),this.plugin.openAuthUrl){const e=this.plugin.openAuthUrl;this.ipc.receive("openAuthUrl",async t=>{await e(t)})}if(this.plugin.copyToClipboard){const e=this.plugin.copyToClipboard;this.ipc.receive("copyToClipboard",async t=>{await e(t)})}if(this.plugin.onIntegrationSettingsChange){const e=this.plugin.onIntegrationSettingsChange;this.ipc.receive("onIntegrationSettingsChange",async(t,n)=>{await e(t,n)})}}async activateAgenticIssue(e,t=null){await this.ipc.call("activateAgenticIssue",e,t)}async invalidateAgenticIssue(e){await this.ipc.call("invalidateAgenticIssue",e)}async markAgenticIssueResolved(e){await this.ipc.call("markAgenticIssueResolved",e)}async restoreAgenticIssue(e){await this.ipc.call("restoreAgenticIssue",e)}async notifyPluginStatus(e,t){await this.ipc.call("onPluginStatusChange",e,t)}async applyIntegrationSettings(e){await this.ipc.call("applyIntegrationSettings",e)}async getIntegrationSettings(){return await this.ipc.call("getIntegrationSettings")}async notifyActiveDocumentChanged(e){await this.ipc.call("onActiveDocumentChanged",e)}getSidebarBuildInfo(){return this.latestSidebarBuildInfo}configure(e){this.ipc.configure(e)}destroy(){this.window.removeEventListener("message",this.handleMessage),this.ipc.destroy()}},H=class{ipcAdapter;constructor(e,t,n){this.ipcAdapter=new N(e,t,n?.win,n?.config,n?.targetOrigin)}destroy(){this.ipcAdapter.destroy()}async notifyPluginStatus(e,t){await this.ipcAdapter.notifyPluginStatus(e,t)}async activateAgenticIssue(e,t=null){await this.ipcAdapter.activateAgenticIssue(e,t)}async invalidateAgenticIssue(e){await this.ipcAdapter.invalidateAgenticIssue(e)}async markAgenticIssueResolved(e){await this.ipcAdapter.markAgenticIssueResolved(e)}async restoreAgenticIssue(e){await this.ipcAdapter.restoreAgenticIssue(e)}async applyIntegrationSettings(e){await this.ipcAdapter.applyIntegrationSettings(e)}async getIntegrationSettings(){return await this.ipcAdapter.getIntegrationSettings()}async notifyActiveDocumentChanged(e){await this.ipcAdapter.notifyActiveDocumentChanged(e)}getSidebarBuildInfo(){return this.ipcAdapter.getSidebarBuildInfo()}configure(e){this.ipcAdapter.configure(e)}},he=`
|
|
1
|
+
(function(o,u){typeof exports=="object"&&typeof module<"u"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(o=typeof globalThis<"u"?globalThis:o||self,u(o.main={}))})(this,function(o){Object.defineProperty(o,Symbol.toStringTag,{value:"Module"});var u=(function(e){return e.TEXT_PLAIN="text/plain",e.TEXT_MARKDOWN="text/markdown",e.TEXT_HTML="text/html",e.APPLICATION_DITA_XML="application/dita+xml",e})({}),se=["text/plain","text/markdown","text/html","application/dita+xml"],le={integrationName:"unknown",integrationVersion:"unknown",integrationId:"markupai-sidebar-app",hideBanner:!1,supportCheckSelection:!0,supportComments:!1,multiAgent:!1,multiDocument:!1},ce=e=>typeof e!="object"||e===null?!1:Array.isArray(e.fields),de=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.id!="string"||t.id.length===0||typeof t.label!="string"?!1:t.type==="boolean"?typeof t.default=="boolean":t.type==="enum"?typeof t.default!="string"||!Array.isArray(t.options)||t.options.length===0?!1:t.options.every(r=>{if(typeof r!="object"||r===null)return!1;const n=r;return typeof n.value=="string"&&typeof n.label=="string"}):!1},_="2.5.0",f=class ie extends Error{name="TextLookupError";constructor(t){super(t),Object.setPrototypeOf(this,ie.prototype)}},v=class ae extends f{name="ReplaceBatchError";applied;failed;constructor(t,r){super(t),this.applied=r.applied.map(n=>({start:n.start,end:n.end})),this.failed=r.failed.map(n=>D(n,n.message)),Object.setPrototypeOf(this,ae.prototype)}},C=class oe extends Error{name="IpcTimeoutError";constructor(t,r,n){super(`IPC call timeout: "${t}" did not respond within ${String(r)}ms`+(n===void 0?"":` (timeout ${String(n)} could not be used)`)),Object.setPrototypeOf(this,oe.prototype)}};function ge(e){return e instanceof C}function ue(e){return e instanceof v}function D(e,t){const r={start:e.start,end:e.end};return typeof t=="string"&&t.trim()!==""&&(r.message=t),r}function M(e){return Array.isArray(e)?e.flatMap(t=>{if(t===null||typeof t!="object")return[];const{start:r,end:n,message:i}=t;return typeof r!="number"||typeof n!="number"?[]:[{range:{start:r,end:n},message:i}]}):[]}function pe(e){return e instanceof f}var b={TextLookupError:e=>new f(e),ReplaceBatchError:(e,t)=>new v(e,{applied:M(t.applied).map(r=>r.range),failed:M(t.failed).map(r=>D(r.range,r.message))})};function L(e){const t=e.message??"",r=e.name,n=typeof r=="string"&&r in b?b[r]:void 0;return n?n(t,e):Object.assign(new Error(t),r?{name:r}:{})}var B=":",N=/^[a-z][a-z0-9-]*$/;function he(e){const t=e.indexOf(B);return t<=0||t===e.length-1?!1:N.test(e.slice(0,t))}function fe(e,t){const r=e.trim().toLowerCase(),n=t.trim();if(!N.test(r))throw new Error(`Invalid document reference prefix ${JSON.stringify(e)}: expected a lowercase name like "word".`);if(n.length===0)throw new Error("Invalid document reference: the document id is empty.");const i=`${r}${B}`;return n.startsWith(i)?n:`${i}${n}`}var k=class extends Promise{static get[Symbol.species](){return Promise}resolve;reject;constructor(e=()=>{}){let t,r;super((n,i)=>{t=n,r=i,e(n,i)}),this.resolve=t,this.reject=r}},S={timeout:1e4};function w(e,t){try{e?.(t)}catch{}}function me(e){const t=typeof e=="object"&&e!==null?Object.fromEntries(Object.getOwnPropertyNames(e).map(s=>[s,e[s]])):{},r=e instanceof Error?e.message:String(e),n=typeof t.message=="string"&&t.message!==""?t.message:r,i=e instanceof Error?e.name:void 0,a=typeof t.name=="string"?t.name:i;return JSON.stringify({...t,message:n,...a!==void 0&&{name:a}})}function Ie(e){try{return L(JSON.parse(e))}catch{return new Error("Failed to parse error from IPC")}}var U=3e5,H=2147483647;function ye(e,t){const r=i=>!Number.isNaN(i)&&i>0;let n=S.timeout;return r(e)?n=e:r(t)&&(n=t),Math.min(Math.max(1,Math.ceil(n)),H)}var E=class{promisesByID={};receiversByName={};progressReceiverNames=new Set;currentID=0;config;postMessage;constructor(e,t){this.postMessage=e,this.config={...S,...t}}configure(e){this.config={...this.config,...e}}call(e,...t){return this.callWithOptions(e,{},...t)}callWithOptions(e,t,...r){const n=t.timeout??this.config.timeout,i=ye(n,this.config.timeout),a=this.currentID++,s=new k,l=setTimeout(()=>{if(a in this.promisesByID)if(s.reject(new C(e,i,i===n?void 0:n)),t.onProgress||t.onLateResult){const d=this.promisesByID[a];d.timedOut=!0,d.timeoutId=setTimeout(()=>{this.promisesByID[a]===d&&Reflect.deleteProperty(this.promisesByID,a)},U)}else Reflect.deleteProperty(this.promisesByID,a)},i);this.promisesByID[a]={promise:s,timeoutId:l,onProgress:t.onProgress,onLateResult:t.onLateResult,timedOut:!1};const c={type:"call",id:a,name:e,data:r};return this.postMessage(c),s}receive(e,t){this.receiversByName[e]=t,this.progressReceiverNames.delete(e)}receiveWithProgress(e,t){this.receiversByName[e]=t,this.progressReceiverNames.add(e)}ignore(e){delete this.receiversByName[e],this.progressReceiverNames.delete(e)}async handleMessage(e){switch(e.type){case"call":await this.handleCall(e);break;case"response":this.handleResponse(e);break;case"error":this.handleError(e);break;case"progress":this.handleProgress(e);break;default:}}async handleCall(e){const{id:t,name:r,data:n}=e;if(!(r in this.receiversByName)){const l=new Error(`No receiver registered for: ${r}`),c=JSON.stringify({message:l.message,name:l.name});this.postMessage({type:"error",id:t,name:r,errorJSON:c});return}const i=this.receiversByName[r];let a=!1;const s=l=>{if(!a)try{this.postMessage({type:"progress",id:t,name:r,data:l})}catch{}};try{if(!Array.isArray(n))throw new TypeError(`IPC: Expected array of arguments but got ${typeof n}`);const l=n,c=await(this.progressReceiverNames.has(r)?i(s,...l):i(...l));a=!0;const d={type:"response",id:t,name:r,data:c};this.postMessage(d)}catch(l){a=!0;const c={type:"error",id:t,name:r,errorJSON:me(l)};this.postMessage(c)}}handleResponse(e){const{id:t}=e;if(t in this.promisesByID){const{promise:r,timeoutId:n,timedOut:i,onLateResult:a}=this.promisesByID[t];if(clearTimeout(n),Reflect.deleteProperty(this.promisesByID,t),i){w(a,{status:"success"});return}r.resolve(e.data)}}handleError(e){const{id:t,errorJSON:r}=e;if(t in this.promisesByID){const{promise:n,timeoutId:i,timedOut:a,onLateResult:s}=this.promisesByID[t];clearTimeout(i),Reflect.deleteProperty(this.promisesByID,t);const l=Ie(r);if(a){w(s,{status:"error",error:l});return}n.reject(l)}}handleProgress(e){const{id:t}=e;t in this.promisesByID&&w(this.promisesByID[t].onProgress,e.data)}destroy(){for(const{promise:e,timeoutId:t}of Object.values(this.promisesByID))clearTimeout(t),e.reject(new Error("IPC destroyed"));this.promisesByID={},this.receiversByName={},this.progressReceiverNames.clear()}};function Ae(e){if(typeof e!="object"||e===null)return!1;const{start:t,end:r}=e;return typeof t=="number"&&typeof r=="number"}var F=e=>`${String(e.start)}:${String(e.end)}`;function ve(e,t){if(typeof e!="object"||e===null)return null;const{total:r,applied:n}=e;if(typeof r!="number"||!Array.isArray(n)||!n.every(Ae))return null;const i=new Set(t.map(({range:a})=>F(a)));return{total:r,applied:n.filter(a=>i.has(F(a))).map(({start:a,end:s})=>({start:a,end:s}))}}var Ye=64,Ce=new Set(["auto","prompt"]),P=(e,t)=>{const r=e[t];if(!(typeof r!="string"||r.length===0))return r.slice(0,64)};function be(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,r=P(t,"version"),n=P(t,"commitHash");if(r===void 0||n===void 0)return null;const i={version:r,commitHash:n};typeof t.swControlled=="boolean"&&(i.swControlled=t.swControlled),Ce.has(t.pwaUpdateMode)&&(i.pwaUpdateMode=t.pwaUpdateMode);const a=P(t,"adapterVersion");return a!==void 0&&(i.adapterVersion=a),i}function Se(e){return typeof e!="string"||e.length===0?null:e.slice(0,64)}function Xe(e,t){if(!e)return`getInitConfig from sidebar build unknown (no valid build report — sidebar predates build reporting; host adapter ${t})`;const r=[e.commitHash];return e.swControlled!==void 0&&r.push(e.swControlled?"sw-controlled":"network"),e.pwaUpdateMode&&r.push(`${e.pwaUpdateMode} update mode`),e.adapterVersion&&r.push(`sidebar adapter ${e.adapterVersion}`),r.push(`host adapter ${t}`),`getInitConfig from sidebar v${e.version} (${r.join(", ")})`}var $=class{ipc;sidebar;targetOrigin;latestHostAdapterVersion=null;constructor(e,t,r="*"){this.sidebar=e||{},this.targetOrigin=r,this.ipc=new E(n=>{window.parent.postMessage(n,this.targetOrigin)},t),window.addEventListener("message",this.handleMessage),this.registerReceivers()}handleMessage=e=>{const t=globalThis.window.location.origin,r=this.targetOrigin;e.origin!==t&&(r!=="*"&&e.origin!==r||e.data&&typeof e.data=="object"&&this.ipc.handleMessage(e.data))};registerReceivers(){if(this.sidebar.onPluginStatusChange){const e=this.sidebar.onPluginStatusChange;this.ipc.receive("onPluginStatusChange",async(t,r)=>{await e(t,r)})}if(this.sidebar.activateAgenticIssue){const e=this.sidebar.activateAgenticIssue;this.ipc.receive("activateAgenticIssue",async(t,r)=>{await e(t,typeof r=="string"?r:null)})}if(this.sidebar.invalidateAgenticIssue){const e=this.sidebar.invalidateAgenticIssue;this.ipc.receive("invalidateAgenticIssue",async t=>{await e(t)})}if(this.sidebar.markAgenticIssueResolved){const e=this.sidebar.markAgenticIssueResolved;this.ipc.receive("markAgenticIssueResolved",async t=>{await e(t)})}if(this.sidebar.restoreAgenticIssue){const e=this.sidebar.restoreAgenticIssue;this.ipc.receive("restoreAgenticIssue",async t=>{await e(t)})}if(this.sidebar.applyIntegrationSettings){const e=this.sidebar.applyIntegrationSettings;this.ipc.receive("applyIntegrationSettings",async t=>{await e(t)})}if(this.sidebar.getIntegrationSettings){const e=this.sidebar.getIntegrationSettings;this.ipc.receive("getIntegrationSettings",async()=>await e())}if(this.sidebar.onActiveDocumentChanged){const e=this.sidebar.onActiveDocumentChanged;this.ipc.receive("onActiveDocumentChanged",async t=>{await e(t)})}}async getInitConfig(e){const{hostAdapterVersion:t,...r}=e?await this.ipc.call("getInitConfig",{...e,adapterVersion:e.adapterVersion??"2.5.0"}):await this.ipc.call("getInitConfig");return this.latestHostAdapterVersion=Se(t),r}getHostAdapterVersion(){return this.latestHostAdapterVersion}async getContent(e){return this.ipc.callWithOptions("getContent",e??{})}async getSelectedContent(e){return this.ipc.callWithOptions("getSelectedContent",e??{})}async replaceContent(e,t,r=null){await this.ipc.call("replaceContent",e,t,r)}async selectContent(e,t=null){await this.ipc.call("selectContent",e,t)}async replaceMultipleContents(e,t){const{onProgress:r,...n}=t??{};await this.ipc.callWithOptions("replaceMultipleContents",{...n,...r&&{onProgress:i=>{const a=ve(i,e);a&&r(a)}}},e)}async onAgenticAgentResults(e,t,r=null){await this.ipc.call("onAgenticAgentResults",e,t,r)}async onAgenticStreamComplete(e=null){await this.ipc.call("onAgenticStreamComplete",e)}async onAgenticIssueStatusChanged(e,t,r){await this.ipc.call("onAgenticIssueStatusChanged",e,t,r)}async onAgenticIssuesCleared(e=null){await this.ipc.call("onAgenticIssuesCleared",e)}async openAuthUrl(e){await this.ipc.call("openAuthUrl",e)}async copyToClipboard(e){await this.ipc.call("copyToClipboard",e)}async addComment(e,t=null){await this.ipc.call("addComment",e,t)}async onIntegrationSettingsChange(e,t){await this.ipc.call("onIntegrationSettingsChange",e,t)}configure(e){this.ipc.configure(e)}setTargetOrigin(e){if(!e||typeof e!="string")throw new Error("Invalid targetOrigin: must be a non-empty string");try{const t=new URL(e);if(!["http:","https:"].includes(t.protocol)||!t.host)throw new Error("Invalid targetOrigin: protocol must be http or https and must have a host")}catch{throw new Error("Invalid targetOrigin: must be a valid origin (e.g., https://example.com)")}this.targetOrigin=e}getTargetOrigin(){return this.targetOrigin}destroy(){window.removeEventListener("message",this.handleMessage),this.ipc.destroy()}},we=class{ipcAdapter;constructor(e,t,r){this.ipcAdapter=new $(e,t,r)}destroy(){this.ipcAdapter.destroy()}async getInitConfig(e){return await this.ipcAdapter.getInitConfig(e)}getHostAdapterVersion(){return this.ipcAdapter.getHostAdapterVersion()}async getContent(e){return await this.ipcAdapter.getContent(e)}async getSelectedContent(e){return await this.ipcAdapter.getSelectedContent(e)}async replaceContent(e,t,r=null){await this.ipcAdapter.replaceContent(e,t,r)}async selectContent(e,t=null){await this.ipcAdapter.selectContent(e,t)}async replaceMultipleContents(e,t){await this.ipcAdapter.replaceMultipleContents(e,t)}onAgenticAgentResults(e,t,r=null){return this.ipcAdapter.onAgenticAgentResults(e,t,r)}onAgenticStreamComplete(e=null){return this.ipcAdapter.onAgenticStreamComplete(e)}onAgenticIssueStatusChanged(e,t,r){return this.ipcAdapter.onAgenticIssueStatusChanged(e,t,r)}onAgenticIssuesCleared(e=null){return this.ipcAdapter.onAgenticIssuesCleared(e)}openAuthUrl(e){return this.ipcAdapter.openAuthUrl(e)}copyToClipboard(e){return this.ipcAdapter.copyToClipboard(e)}addComment(e,t=null){return this.ipcAdapter.addComment(e,t)}onIntegrationSettingsChange(e,t){return this.ipcAdapter.onIntegrationSettingsChange(e,t)}configure(e){this.ipcAdapter.configure(e)}setTargetOrigin(e){this.ipcAdapter.setTargetOrigin(e)}getTargetOrigin(){return this.ipcAdapter.getTargetOrigin()}},j=class{ipc;plugin;iframe;window;targetOrigin;latestSidebarBuildInfo=null;constructor(e,t,r,n,i="*"){this.plugin=e,this.iframe=t,this.window=r??window,this.targetOrigin=i,this.ipc=new E(a=>{this.iframe.contentWindow?.postMessage(a,this.targetOrigin)},n),this.window.addEventListener("message",this.handleMessage,!1),this.registerReceivers()}handleMessage=e=>{const t=this.window.location.origin,r=this.targetOrigin;e.origin!==t&&(r!=="*"&&e.origin!==r||e.data&&typeof e.data=="object"&&this.ipc.handleMessage(e.data))};registerReceivers(){if(this.ipc.receive("getInitConfig",async e=>{const t=be(e);return this.latestSidebarBuildInfo=t,{...await this.plugin.getInitConfig(t??void 0),hostAdapterVersion:_}}),this.ipc.receive("getContent",async()=>await this.plugin.getContent()),this.ipc.receive("getSelectedContent",async()=>await this.plugin.getSelectedContent()),this.ipc.receive("replaceContent",async(e,t,r)=>{await this.plugin.replaceContent(e,t,typeof r=="string"?r:null)}),this.ipc.receive("selectContent",async(e,t)=>{await this.plugin.selectContent(e,typeof t=="string"?t:null)}),this.ipc.receiveWithProgress("replaceMultipleContents",async(e,t)=>{await this.plugin.replaceMultipleContents(t,{reportProgress:e})}),this.ipc.receive("onAgenticAgentResults",async(e,t,r)=>{if(!Array.isArray(t))return;const n=this.plugin.onAgenticAgentResults;n&&await n(e,t,typeof r=="string"?r:null)}),this.ipc.receive("onAgenticStreamComplete",async e=>{const t=this.plugin.onAgenticStreamComplete;t&&await t(typeof e=="string"?e:null)}),this.ipc.receive("onAgenticIssueStatusChanged",async(e,t,r)=>{const n=this.plugin.onAgenticIssueStatusChanged;if(n&&!(t!=="active"&&t!=="resolved"&&t!=="dismissed"||r!=="user"&&r!=="host"))try{await n(e,t,r)}catch{}}),this.ipc.receive("onAgenticIssuesCleared",async e=>{const t=this.plugin.onAgenticIssuesCleared;if(t)try{await t(typeof e=="string"?e:null)}catch{}}),this.plugin.openAuthUrl){const e=this.plugin.openAuthUrl;this.ipc.receive("openAuthUrl",async t=>{await e(t)})}if(this.plugin.copyToClipboard){const e=this.plugin.copyToClipboard;this.ipc.receive("copyToClipboard",async t=>{await e(t)})}if(this.plugin.addComment){const e=this.plugin.addComment;this.ipc.receive("addComment",async(t,r)=>{await e(t,typeof r=="string"?r:null)})}if(this.plugin.onIntegrationSettingsChange){const e=this.plugin.onIntegrationSettingsChange;this.ipc.receive("onIntegrationSettingsChange",async(t,r)=>{await e(t,r)})}}async activateAgenticIssue(e,t=null){await this.ipc.call("activateAgenticIssue",e,t)}async invalidateAgenticIssue(e){await this.ipc.call("invalidateAgenticIssue",e)}async markAgenticIssueResolved(e){await this.ipc.call("markAgenticIssueResolved",e)}async restoreAgenticIssue(e){await this.ipc.call("restoreAgenticIssue",e)}async notifyPluginStatus(e,t){await this.ipc.call("onPluginStatusChange",e,t)}async applyIntegrationSettings(e){await this.ipc.call("applyIntegrationSettings",e)}async getIntegrationSettings(){return await this.ipc.call("getIntegrationSettings")}async notifyActiveDocumentChanged(e){await this.ipc.call("onActiveDocumentChanged",e)}getSidebarBuildInfo(){return this.latestSidebarBuildInfo}configure(e){this.ipc.configure(e)}destroy(){this.window.removeEventListener("message",this.handleMessage),this.ipc.destroy()}},x=class{ipcAdapter;constructor(e,t,r){this.ipcAdapter=new j(e,t,r?.win,r?.config,r?.targetOrigin)}destroy(){this.ipcAdapter.destroy()}async notifyPluginStatus(e,t){await this.ipcAdapter.notifyPluginStatus(e,t)}async activateAgenticIssue(e,t=null){await this.ipcAdapter.activateAgenticIssue(e,t)}async invalidateAgenticIssue(e){await this.ipcAdapter.invalidateAgenticIssue(e)}async markAgenticIssueResolved(e){await this.ipcAdapter.markAgenticIssueResolved(e)}async restoreAgenticIssue(e){await this.ipcAdapter.restoreAgenticIssue(e)}async applyIntegrationSettings(e){await this.ipcAdapter.applyIntegrationSettings(e)}async getIntegrationSettings(){return await this.ipcAdapter.getIntegrationSettings()}async notifyActiveDocumentChanged(e){await this.ipcAdapter.notifyActiveDocumentChanged(e)}getSidebarBuildInfo(){return this.ipcAdapter.getSidebarBuildInfo()}configure(e){this.ipcAdapter.configure(e)}},Ee=`
|
|
2
2
|
<div class="sidebar-load-overlay-card">
|
|
3
3
|
<div class="sidebar-load-overlay-title">Sidebar failed to load</div>
|
|
4
4
|
<div class="sidebar-load-overlay-description">Check your connection or try again.</div>
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<span>Retry</span>
|
|
20
20
|
</button>
|
|
21
21
|
</div>
|
|
22
|
-
`,
|
|
22
|
+
`,Pe=()=>{const e=document.createElement("div");e.className="sidebar-load-overlay",e.style.display="none",e.innerHTML=Ee;const t=e.querySelector(".sidebar-load-overlay-button");if(!t)throw new Error("Missing retry button in load overlay template.");return{overlay:e,button:t}},V="markupai-sidebar-load-overlay-styles",Re=`
|
|
23
23
|
:root {
|
|
24
24
|
--background: #f5f5f4;
|
|
25
25
|
--foreground: #333332;
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
box-shadow: 0 0 0 2px
|
|
112
112
|
color-mix(in srgb, var(--accent, #ef4640) 60%, transparent);
|
|
113
113
|
}
|
|
114
|
-
`,
|
|
114
|
+
`,Te=e=>{const t=e??document;if(t.getElementById(V))return;const r=t.createElement("style");r.id=V,r.textContent=Re,t.head.appendChild(r)},Oe=8e3,_e=12e3,W=(e,t,r={})=>{Te(e.ownerDocument);const{sidebarUrl:n,targetOrigin:i,timeoutMs:a=Oe,retryIntervalMs:s=_e,messageListenWindow:l}=r,c=l??(typeof globalThis.window<"u"?globalThis.window:globalThis),d=()=>n??t.src,Ge=()=>{if(i)return i;try{return new URL(d()).origin}catch{return"*"}},{overlay:O,button:q}=Pe();e.appendChild(O);let m=!1,I,p;const h=g=>{O.style.display=g?"flex":"none"};h(!1);const y=()=>{I&&(globalThis.clearTimeout(I),I=void 0)},Z=()=>{y(),I=globalThis.setTimeout(()=>{m||h(!0)},a)},Q=g=>{const A=g?.preserveOverlay??!0;m=!1,A||h(!1),t.src=d(),Z()},ze=()=>{p||s<=0||(p=globalThis.setInterval(()=>{m||Q({preserveOverlay:!0})},s))},ee=()=>{p&&(globalThis.clearInterval(p),p=void 0)},te=g=>{if(!t.contentWindow||g.source!==t.contentWindow)return;const A=Ge();A!=="*"&&g.origin!==A||(m=!0,y(),ee(),h(!1))},re=()=>{y(),h(!0)},ne=()=>{Q()};return q.addEventListener("click",ne),t.addEventListener("error",re),c.addEventListener("message",te),Z(),ze(),()=>{y(),ee(),t.removeEventListener("error",re),c.removeEventListener("message",te),q.removeEventListener("click",ne),O.remove()}},G="Markup AI Sidebar",z="clipboard-read; clipboard-write",De="markupai.sidebarNextGen.overrideUrl",Me="https://sidebar.markup.ai/";function Le(e){try{return"localStorage"in globalThis&&globalThis.localStorage.getItem("markupai.sidebarNextGen.overrideUrl")?.trim()||e}catch{return e}}var Y="markupai.sidebarNextGen.authOverride";function Be(e,t){if(!t)return e;try{if(!("localStorage"in globalThis))return e;const r=globalThis.localStorage.getItem(Y)?.trim();if(!r)return e;const n=JSON.parse(r);return n!==null&&typeof n=="object"&&"type"in n&&(n.type==="mediation"||n.type==="popup")?n:e}catch{return e}}function Ne(e,t){try{return new URL(e).origin}catch(r){return t?.onInvalidUrl?.(e,r),"*"}}function ke(e,t="Expected SidebarAdapter from createSidebarHost"){if(e.adapter===null)throw new Error(t)}function Ue(e){const{iframe:t,iframeMount:r}=e;if(t!==void 0&&r!==void 0)throw new Error("createSidebarHost: pass only one of `iframe` or `iframeMount`");if(t!==void 0)return{iframe:t,removeMountedIframe:null};if(r===void 0)throw new Error("createSidebarHost: pass either `iframe` or `iframeMount`");const{container:n,src:i,allow:a=z}=r,s=document.createElement("iframe");return s.title=G,s.src=i,a&&s.setAttribute("allow",a),n.appendChild(s),{iframe:s,removeMountedIframe:()=>{s.remove()}}}function He(e){const{plugin:t,loadOverlayContainer:r,loadOverlayOptions:n,adapterOptions:i}=e,{iframe:a,removeMountedIframe:s}=Ue(e),l=r!==void 0?W(r,a,n??{}):null;if(t!==void 0){const c=new x(t,a,i);return{iframe:a,adapter:c,destroy:()=>{l?.(),c.destroy(),s?.()}}}return{iframe:a,adapter:null,destroy:()=>{l?.(),s?.()}}}var R="sidebarContainer",X="markupai-sidebar-host-shell-styles";function J(e){if(typeof CSS<"u"&&typeof CSS.escape=="function")return CSS.escape(e);if(!/^[a-zA-Z_][\w-]*$/.test(e))throw new Error(String.raw`sidebar host shell: containerId must match /^[a-zA-Z_][\w-]*$/ when CSS.escape is unavailable (got ${JSON.stringify(e)})`);return e}function T(e=R){const t=J(e);return`
|
|
115
115
|
html {
|
|
116
116
|
height: 100%;
|
|
117
117
|
}
|
|
@@ -133,17 +133,17 @@ body {
|
|
|
133
133
|
margin: 0;
|
|
134
134
|
display: block;
|
|
135
135
|
}
|
|
136
|
-
`.trim()}var
|
|
136
|
+
`.trim()}var Fe=T();function $e(e){return e instanceof Document?e:e.ownerDocument}function je(e,t,r){if(!t||e.getElementById(X))return;const n=e.createElement("style");n.id=X,n.textContent=T(r),e.head.appendChild(n)}function xe(e){const{root:t=typeof document<"u"?document:void 0,containerId:r=R,includeDefaultStyles:n=!0}=e??{};if(t===void 0)throw new Error("ensureSidebarHostShell: no document — pass `root` in non-browser environments");const i=$e(t);je(i,n,r);const a=t instanceof Document?i.getElementById(r):t.querySelector(`#${J(r)}`);if(a instanceof HTMLElement&&(t instanceof Document||t.contains(a)))return a;if(!(t instanceof Document)){const l=i.createElement("div");return l.id=r,t.appendChild(l),l}const s=i.createElement("div");return s.id=r,i.body.appendChild(s),s}function K(){return' <meta name="viewport" content="width=device-width, initial-scale=1.0" />'}function Ve(e){const{title:t="Markup AI Sidebar",headInnerHtml:r="",includePluginHostHead:n=!1,bodyScriptsHtml:i,htmlLang:a="en",htmlAttrs:s=`lang="${a}" style="height:100%"`,bodyAttrs:l='style="height:100%;margin:0"'}=e,c=[n?K():"",r].filter(d=>d.trim().length>0).join(`
|
|
137
137
|
`);return`<!DOCTYPE html>
|
|
138
138
|
<html ${s}>
|
|
139
139
|
<head>
|
|
140
140
|
<base target="_top" />
|
|
141
141
|
<meta charset="UTF-8" />
|
|
142
|
-
<title>${
|
|
142
|
+
<title>${We(t)}</title>${c?`
|
|
143
143
|
${c}`:""}
|
|
144
144
|
</head>
|
|
145
145
|
<body ${l}>
|
|
146
|
-
${
|
|
146
|
+
${i}
|
|
147
147
|
</body>
|
|
148
148
|
</html>
|
|
149
|
-
`}function
|
|
149
|
+
`}function We(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}o.ADAPTER_VERSION=_,o.AUTH_CONFIG_OVERRIDE_STORAGE_KEY=Y,o.DEFAULT_IPC_CONFIG=S,o.DEFAULT_SIDEBAR_CONFIG=le,o.DeferredPromise=k,o.IPCCore=E,o.IpcTimeoutError=C,o.LATE_RESULT_WINDOW_MS=U,o.MAX_IPC_TIMEOUT_MS=H,o.MimeType=u,o.PluginAdapter=we,o.PluginIPCAdapter=$,o.ReplaceBatchError=v,o.SIDEBAR_DEFAULT_PRODUCTION_BASE_URL=Me,o.SIDEBAR_HOST_CONTAINER_ID=R,o.SIDEBAR_HOST_SHELL_CSS=Fe,o.SIDEBAR_IFRAME_DEFAULT_ALLOW=z,o.SIDEBAR_IFRAME_DEFAULT_TITLE=G,o.SIDEBAR_URL_OVERRIDE_STORAGE_KEY=De,o.SidebarAdapter=x,o.SidebarIPCAdapter=j,o.TEXT_MIME_TYPES=se,o.TextLookupError=f,o.assertSidebarHostAdapter=ke,o.buildDocumentReference=fe,o.buildSidebarHostHtmlDocument=Ve,o.buildSidebarHostShellCss=T,o.buildSidebarPluginHostHeadInnerHtml=K,o.createSidebarHost=He,o.ensureSidebarHostShell=xe,o.getAuthConfigWithOverride=Be,o.getSidebarBaseUrlWithOverride=Le,o.ipcErrorReconstructors=b,o.isDocumentReference=he,o.isIntegrationSettingField=de,o.isIntegrationSettingsSchema=ce,o.isIpcTimeoutError=ge,o.isReplaceBatchError=ue,o.isTextLookupError=pe,o.reconstructError=L,o.setupSidebarLoadOverlay=W,o.sidebarPostMessageTargetOrigin=Ne});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SidebarAdapter, type SidebarAdapterOptions } from "../adapters/sidebarAdapter";
|
|
2
|
-
import { type SidebarLoadOverlayOptions } from "../load-overlay";
|
|
3
|
-
import type { AuthConfig } from "../types/common";
|
|
4
|
-
import type { PluginInterface } from "../types/pluginInterface";
|
|
1
|
+
import { SidebarAdapter, type SidebarAdapterOptions } from "../adapters/sidebarAdapter.js";
|
|
2
|
+
import { type SidebarLoadOverlayOptions } from "../load-overlay/index.js";
|
|
3
|
+
import type { AuthConfig } from "../types/common.js";
|
|
4
|
+
import type { PluginInterface } from "../types/pluginInterface.js";
|
|
5
5
|
/** Fixed `iframe.title` for accessibility on adapter-created sidebars. */
|
|
6
6
|
export declare const SIDEBAR_IFRAME_DEFAULT_TITLE = "Markup AI Sidebar";
|
|
7
7
|
/** Default `iframe.allow` so the embedded sidebar can use the clipboard (Permissions Policy). */
|
package/dist/types/common.d.ts
CHANGED
|
@@ -34,6 +34,25 @@ export type ContentReplacement = {
|
|
|
34
34
|
suggestion: string;
|
|
35
35
|
range: ContentRange;
|
|
36
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* A comment the sidebar asks the host to anchor on a span of the document
|
|
39
|
+
* (see {@link PluginInterface.addComment}).
|
|
40
|
+
*/
|
|
41
|
+
export interface CommentRequest {
|
|
42
|
+
/**
|
|
43
|
+
* Ready-to-post plain-text comment body composed by the sidebar. Hosts can
|
|
44
|
+
* post it as-is or build their own body from {@link CommentRequest.issue}.
|
|
45
|
+
* It carries no author information — the host attributes the comment.
|
|
46
|
+
*/
|
|
47
|
+
text: string;
|
|
48
|
+
/**
|
|
49
|
+
* Half-open document span `[range.start, range.end)` to anchor the comment
|
|
50
|
+
* on — same offset semantics as `replaceContent` / `selectContent`.
|
|
51
|
+
*/
|
|
52
|
+
range: ContentRange;
|
|
53
|
+
/** The issue the comment is about, for hosts that format their own body. */
|
|
54
|
+
issue?: AgenticIssuePayload;
|
|
55
|
+
}
|
|
37
56
|
/**
|
|
38
57
|
* Content information including the content, document reference, optional document name, and optional mime type
|
|
39
58
|
* The integration must provide content and documentReference - documentName and mimeType are optional
|
|
@@ -184,6 +203,17 @@ export interface SidebarConfig {
|
|
|
184
203
|
* If false, the selection toggle UI will be hidden and checkSelectionEnabled will be forced to false
|
|
185
204
|
*/
|
|
186
205
|
supportCheckSelection?: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Whether the host can anchor a comment on a span of the document via
|
|
208
|
+
* {@link PluginInterface.addComment}.
|
|
209
|
+
*
|
|
210
|
+
* When `true`, the sidebar offers an "Add as Comment" action on open issue
|
|
211
|
+
* cards. When `false` or omitted (the default), the action is hidden. Only
|
|
212
|
+
* set it when the host implements `addComment` — and, where the editor's
|
|
213
|
+
* comment API is version-gated (e.g. Word's `WordApi 1.4`), only when that
|
|
214
|
+
* API is actually available.
|
|
215
|
+
*/
|
|
216
|
+
supportComments?: boolean;
|
|
187
217
|
/**
|
|
188
218
|
* Whether the sidebar may run several agents concurrently in one check.
|
|
189
219
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAEvE;;;;GAIG;AACH,oBAAY,QAAQ;IAClB,UAAU,eAAe;IACzB,aAAa,kBAAkB;IAC/B,SAAS,cAAc;IACvB,oBAAoB,yBAAyB;CAC9C;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,2GAKlB,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;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ACA,cAAc,UAAU,CAAC;AAGzB,cAAc,mBAAmB,CAAC;AAGlC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AAGzB,cAAc,mBAAmB,CAAC;AAGlC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,YAAY,CAAC;AAG3B,cAAc,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrationSettings.d.ts","sourceRoot":"","sources":["../../src/types/integrationSettings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,8BAA+B,SAAQ,2BAA2B;IACjF,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA4B,SAAQ,2BAA2B;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,aAAa,CAAC,4BAA4B,CAAC,CAAC;CACtD;AAED;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,8BAA8B,GAAG,2BAA2B,CAAC;AAEnG;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;CAChD;AAED;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,CAAC;AAEzE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,4BAA4B,GAAG,IAAI,CAAC,CAAC;CACnE;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,+BAA+B,GAAG,MAAM,CAAC;AAErD,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,+BAA+B,CAAC;CACzC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,yBAAyB,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;CAC3D;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,2BAA2B,
|
|
1
|
+
{"version":3,"file":"integrationSettings.d.ts","sourceRoot":"","sources":["../../src/types/integrationSettings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,8BAA+B,SAAQ,2BAA2B;IACjF,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG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3D;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,2BAA2B,UAAW,OAAO,KAAG,KAAK,IAAI,yBAIrE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,UAAW,OAAO,KAAG,KAAK,IAAI,uBAmBnE,CAAC"}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import type { ContentRange, ContentReplacement, ContentInfo, SidebarConfig, SidebarBuildInfo, AgenticIssuePayload } from "./common";
|
|
1
|
+
import type { CommentRequest, ContentRange, ContentReplacement, ContentInfo, SidebarConfig, SidebarBuildInfo, AgenticIssuePayload } from "./common";
|
|
2
2
|
import type { IntegrationSettingsValues, IntegrationSettingsChangeMeta } from "./integrationSettings";
|
|
3
|
+
import type { ReplaceProgress } from "./progress";
|
|
4
|
+
/** What the adapter hands the host with a `replaceMultipleContents` call. */
|
|
5
|
+
export interface ReplaceMultipleContext {
|
|
6
|
+
/**
|
|
7
|
+
* Report which places are replaced so far. Best effort: it never throws,
|
|
8
|
+
* returns nothing to wait for, and does not change the call's timeout.
|
|
9
|
+
*/
|
|
10
|
+
reportProgress?: (progress: ReplaceProgress) => void;
|
|
11
|
+
}
|
|
3
12
|
/**
|
|
4
13
|
* Interface for the functions to implement in the Editor that the Sidebar will call via IPC
|
|
5
14
|
* All methods return Promises for proper async handling
|
|
@@ -42,12 +51,14 @@ export interface PluginInterface {
|
|
|
42
51
|
/**
|
|
43
52
|
* Replace multiple contents in the editor
|
|
44
53
|
* @param replacements - Array of content replacements to apply
|
|
54
|
+
* @param context - Created by the adapter; lets the host report progress. It
|
|
55
|
+
* is optional to use: a host with one parameter keeps working.
|
|
45
56
|
* @returns Promise that resolves when all replacements are complete
|
|
46
57
|
* @throws {ReplaceBatchError} When the batch could not be applied in full; carries
|
|
47
58
|
* the ranges that were applied and the ones that failed (see ReplaceMultipleContentsError)
|
|
48
59
|
* @throws {TextLookupError} When the batch failed and the host cannot say which ranges landed
|
|
49
60
|
*/
|
|
50
|
-
replaceMultipleContents: (replacements: ContentReplacement[]) => Promise<void>;
|
|
61
|
+
replaceMultipleContents: (replacements: ContentReplacement[], context?: ReplaceMultipleContext) => Promise<void>;
|
|
51
62
|
/**
|
|
52
63
|
* Get initialization configuration from the editor
|
|
53
64
|
* Called by the sidebar when it's ready to initialize — once per sidebar
|
|
@@ -154,6 +165,31 @@ export interface PluginInterface {
|
|
|
154
165
|
* clipboard; reject to signal the write failed.
|
|
155
166
|
*/
|
|
156
167
|
copyToClipboard?: (text: string) => Promise<void>;
|
|
168
|
+
/**
|
|
169
|
+
* Anchor a comment on a span of the document — e.g. Word's
|
|
170
|
+
* `Range.insertComment`. The sidebar calls this when the user picks
|
|
171
|
+
* **Add as Comment** on an issue card.
|
|
172
|
+
*
|
|
173
|
+
* Optional. Implement it together with
|
|
174
|
+
* {@link SidebarConfig.supportComments} `: true`; the sidebar only offers
|
|
175
|
+
* the action when that flag is set. Without a handler, the call rejects
|
|
176
|
+
* with `No receiver registered for: addComment`.
|
|
177
|
+
*
|
|
178
|
+
* The handler MUST NOT change the document text. Author attribution is the
|
|
179
|
+
* host's responsibility — the sidebar sends no user information, and
|
|
180
|
+
* editors typically attach the signed-in editor user themselves.
|
|
181
|
+
*
|
|
182
|
+
* @param comment - Composed plain-text body, the half-open range to anchor
|
|
183
|
+
* on (same semantics as `replaceContent`'s `range`), and the structured
|
|
184
|
+
* issue for hosts that build their own body.
|
|
185
|
+
* @param documentReference - The document to comment in. Omitted or `null`
|
|
186
|
+
* means the integration's currently active document.
|
|
187
|
+
* @returns Promise that resolves once the comment has been added
|
|
188
|
+
* @throws {TextLookupError} When the range cannot be located in the document
|
|
189
|
+
* @throws {Error} When the host cannot comment there (e.g. a protected
|
|
190
|
+
* document); its `message` is shown to the user on the issue card
|
|
191
|
+
*/
|
|
192
|
+
addComment?: (comment: CommentRequest, documentReference?: string | null) => Promise<void>;
|
|
157
193
|
/**
|
|
158
194
|
* Called when the user changes a value in the integration-settings form
|
|
159
195
|
* declared via {@link SidebarConfig.integrationSettings}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginInterface.d.ts","sourceRoot":"","sources":["../../src/types/pluginInterface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,yBAAyB,EACzB,6BAA6B,EAC9B,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"pluginInterface.d.ts","sourceRoot":"","sources":["../../src/types/pluginInterface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,yBAAyB,EACzB,6BAA6B,EAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,6EAA6E;AAC7E,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;CACtD;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IAEvC;;;;;OAKG;IACH,kBAAkB,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IAE/C;;;;;;;;OAQG;IACH,cAAc,EAAE,CACd,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,YAAY,EACnB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,KAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnB;;;;;;;OAOG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,iBAAiB,CAAC,EAA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U,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3F;;;;;;;;;;;OAWG;IACH,2BAA2B,CAAC,EAAE,CAC5B,MAAM,EAAE,yBAAyB,EACjC,IAAI,EAAE,6BAA6B,KAChC,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ContentRange } from "./common";
|
|
2
|
+
/**
|
|
3
|
+
* Wire shape of the `data` of a `progress` message for
|
|
4
|
+
* `replaceMultipleContents`: which places are in the document already.
|
|
5
|
+
*
|
|
6
|
+
* It carries no failures; those come with the error that ends the call. An
|
|
7
|
+
* empty `applied` says that the host is still working.
|
|
8
|
+
*/
|
|
9
|
+
export interface ReplaceProgress {
|
|
10
|
+
/** How many places the host is replacing. */
|
|
11
|
+
total: number;
|
|
12
|
+
/**
|
|
13
|
+
* Every range replaced so far, as it was sent in the call. List a range only
|
|
14
|
+
* after its edit is in the document: the sidebar settles it at once.
|
|
15
|
+
*/
|
|
16
|
+
applied: ContentRange[];
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/types/progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markupai/sidebar-adapter",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Adapter package for MarkupAI Sidebar integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markupai",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"type-check": "tsc --project tsconfig.json --noEmit"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@asyncapi/parser": "^3.6.
|
|
46
|
+
"@asyncapi/parser": "^3.6.4",
|
|
47
47
|
"ajv": "^8.20.0",
|
|
48
48
|
"ts-json-schema-generator": "^2.9.0",
|
|
49
|
-
"tsc-alias": "1.9.
|
|
49
|
+
"tsc-alias": "1.9.8"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|