@atoms-tech/atoms-mcp 0.59.0 → 0.64.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 +6 -6
- package/dist/apps/src/apps/browse/browse-app.html +1 -1
- package/dist/apps/src/apps/editor/editor-app.html +1 -1
- package/dist/apps/src/apps/summary/summary-app.html +10 -10
- package/dist/apps/src/apps/trace/trace-app.html +20 -18
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -153,7 +153,7 @@ atoms-mcp checks for a newer version once a day and tells you in `atoms_status`
|
|
|
153
153
|
|
|
154
154
|
## Org-Controlled Policy
|
|
155
155
|
|
|
156
|
-
Org admins can set guardrails (read-only mode, allowed toolsets, project scope, required confirmations) for every member of their org through **Org Settings → MCP Access Policy** in the ATOMS web app. Both this stdio package and the hosted MCP server (`https://<project>.supabase.co/functions/v1/mcp-server`) read the same `mcp_policy` table
|
|
156
|
+
Org admins can set guardrails (read-only mode, allowed toolsets, project scope, required confirmations) for every member of their org through **Org Settings → MCP Access Policy** in the ATOMS web app. Both this stdio package and the hosted MCP server (`https://<project>.supabase.co/functions/v1/mcp-server`) read the same `mcp_policy` table, one policy for each organization where you are an editor or admin, and judge each call by the organization of the project it touches. This package re-reads the policies every 30 seconds; the hosted server reads them on every request. So an admin's policy applies to their own organization's projects regardless of how a user connects, and a change needs no restart. If you belong to several organizations, a tool is listed when at least one of them allows it, and a call is refused when the organization of its project refuses it.
|
|
157
157
|
|
|
158
158
|
**Tenancy:** every policy row is scoped by `org_id`. Org A admins cannot read or modify Org B's policy — Row-Level Security enforces this at the database.
|
|
159
159
|
|
|
@@ -164,7 +164,7 @@ Org admins can set guardrails (read-only mode, allowed toolsets, project scope,
|
|
|
164
164
|
3. Optional per-user override
|
|
165
165
|
4. Operator env-var ceiling (this package, see below)
|
|
166
166
|
|
|
167
|
-
The operator env vars below are layered **on top** of the org policy. They're useful for stdio installs (per-machine lockdown) and CI bots; they don't replace the admin-set policy and they cannot widen it.
|
|
167
|
+
The operator env vars below are layered **on top** of the org policy. They're useful for stdio installs (per-machine lockdown) and CI bots; they don't replace the admin-set policy and they cannot widen it. `ATOMS_MCP_ORG_ID` and `ATOMS_MCP_PROJECT_ID` can only narrow which projects a session reaches; neither one chooses whose policy applies.
|
|
168
168
|
|
|
169
169
|
## Environment Variables
|
|
170
170
|
|
|
@@ -194,11 +194,11 @@ Comma-separated list of toolsets to enable. When set, only tools in the named to
|
|
|
194
194
|
|
|
195
195
|
| Toolset | Tools |
|
|
196
196
|
|---|---|
|
|
197
|
-
| `items` | list, get, search, browse, history, create, update, delete, bulk_import |
|
|
197
|
+
| `items` | list, get, search, browse, history, create, update, delete, bulk_import. Since 0.63.0 create and bulk_import take type 'hazard' and 'goal' (alias 'safety_goal') in ISO 26262 (automotive) projects where Hazard and Safety goal items are on; in a medical device project hazards are rows of the ISO 14971 risk analysis |
|
|
198
198
|
| `traceability` | trace, link_items, export_mermaid, impact_analysis |
|
|
199
199
|
| `coverage` | get_coverage, record_test_result, project_summary |
|
|
200
200
|
| `variables` | list/get/create/update/delete variables |
|
|
201
|
-
| `domains` | list/create/update/delete domains
|
|
201
|
+
| `domains` | list/create/update (rename)/delete domains. A function is not a domain: it is an item, created with `atoms_create_item` type 'function' (since 0.62.0 there is no `is_function` flag) |
|
|
202
202
|
|
|
203
203
|
Always-on regardless of `ATOMS_MCP_TOOLSETS`: `atoms_status`, `atoms_list_projects`.
|
|
204
204
|
|
|
@@ -234,11 +234,11 @@ Optional: set `ATOMS_MCP_CONFIRMATION_SECRET` (≥16 chars) to make tokens survi
|
|
|
234
234
|
|
|
235
235
|
### `ATOMS_MCP_ORG_ID`
|
|
236
236
|
|
|
237
|
-
|
|
237
|
+
Limits this stdio session to one org. Set to an org UUID. A call on a project of any other org, or on a project or baseline that cannot be found, is refused with "Tool call rejected: this project's organization is outside the configured ATOMS_MCP_ORG_ID scope.", and `atoms_list_projects` lists only that org's projects. It can only narrow: it does not pick whose policy applies (each project is always judged by its own org's policy). If you are not an editor or admin of that org, every call on a project is refused. If unset, the session works across every org where you are an editor or admin.
|
|
238
238
|
|
|
239
239
|
### `ATOMS_MCP_PROJECT_ID`
|
|
240
240
|
|
|
241
|
-
Bind the session to a single project. Every tool call's `project_id` argument must match
|
|
241
|
+
Bind the session to a single project. Every tool call's `project_id` argument must match; a mismatch is rejected before the handler runs. A call that names a baseline (`baseline_id`, `baseline_a_id`, `baseline_b_id`) is judged by the project the baseline belongs to, and a baseline that cannot be found is refused. `atoms_list_projects` filters its response to just the scoped project. Set to a project UUID; invalid values are ignored with a warning.
|
|
242
242
|
|
|
243
243
|
```json
|
|
244
244
|
{ "env": { "ATOMS_MCP_PROJECT_ID": "11111111-2222-3333-4444-555555555555" } }
|
|
@@ -67,7 +67,7 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
67
67
|
- omitted: host decides border`)});l({method:c("ui/request-display-mode"),params:l({mode:pe.describe("The display mode being requested.")})});var lu=l({mode:pe.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),du=y([c("model"),c("app")]).describe("Tool visibility scope - who can access the tool.");l({resourceUri:u().optional(),visibility:b(du).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
68
68
|
- "model": Tool visible to and callable by the agent
|
|
69
69
|
- "app": Tool callable by the app from this server only`)});l({mimeTypes:b(u()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});l({method:c("ui/download-file"),params:l({contents:b(y([Vo,Wo])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})});l({method:c("ui/message"),params:l({role:c("user").describe('Message role, currently only "user" is supported.'),content:b(Se).describe("Message content blocks (text, image, etc.).")})});l({method:c("ui/notifications/sandbox-resource-ready"),params:l({html:u().describe("HTML content to load into the inner iframe."),sandbox:u().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:zt.optional().describe("CSP configuration from resource metadata."),permissions:$t.optional().describe("Sandbox permissions from resource metadata.")})});var pu=l({method:c("ui/notifications/tool-result"),params:He.describe("Standard MCP tool execution result.")}),Yo=l({toolInfo:l({id:ve.optional().describe("JSON-RPC id of the tools/call request."),tool:Tt.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Kc.optional().describe("Current color theme preference."),styles:iu.optional().describe("Style configuration for theming the app."),displayMode:pe.optional().describe("How the UI is currently displayed."),availableDisplayModes:b(pe).optional().describe("Display modes the host supports."),containerDimensions:y([l({height:_().describe("Fixed container height in pixels.")}),l({maxHeight:y([_(),Qe()]).optional().describe("Maximum container height in pixels.")})]).and(y([l({width:_().describe("Fixed container width in pixels.")}),l({maxWidth:y([_(),Qe()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
70
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:u().optional().describe("User's language and region preference in BCP 47 format."),timeZone:u().optional().describe("User's timezone in IANA format."),userAgent:u().optional().describe("Host application identifier."),platform:y([c("web"),c("desktop"),c("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:l({touch:I().optional().describe("Whether the device supports touch input."),hover:I().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:l({top:_().describe("Top safe area inset in pixels."),right:_().describe("Right safe area inset in pixels."),bottom:_().describe("Bottom safe area inset in pixels."),left:_().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),mu=l({method:c("ui/notifications/host-context-changed"),params:Yo.describe("Partial context update containing only changed fields.")});l({method:c("ui/update-model-context"),params:l({content:b(Se).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:z(u(),$().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});l({method:c("ui/initialize"),params:l({appInfo:Ue.describe("App identification (name and version)."),appCapabilities:uu.describe("Features and capabilities this app provides."),protocolVersion:u().describe("Protocol version this app supports.")})});var hu=l({protocolVersion:u().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Ue.describe("Host application identification and version."),hostCapabilities:cu.describe("Features and capabilities provided by the host."),hostContext:Yo.describe("Rich context about the host environment.")}).passthrough();function fu(e,t=document.documentElement){for(let[o,n]of Object.entries(e))n!==void 0&&t.style.setProperty(o,n)}function gu(e){if(document.getElementById("__mcp-host-fonts"))return;let t=document.createElement("style");t.id="__mcp-host-fonts",t.textContent=e,document.head.appendChild(t)}class vu extends Wc{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor(t,o={},n={autoResize:!0}){super(n),this._appInfo=t,this._capabilities=o,this.options=n,this.setRequestHandler(je,r=>(console.log("Received ping:",r.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(t){this.setNotificationHandler(ou,o=>t(o.params))}set ontoolinputpartial(t){this.setNotificationHandler(nu,o=>t(o.params))}set ontoolresult(t){this.setNotificationHandler(pu,o=>t(o.params))}set ontoolcancelled(t){this.setNotificationHandler(ru,o=>t(o.params))}set onhostcontextchanged(t){this.setNotificationHandler(mu,o=>{this._hostContext={...this._hostContext,...o.params},t(o.params)})}set onteardown(t){this.setRequestHandler(au,(o,n)=>t(o.params,n))}set oncalltool(t){this.setRequestHandler(Go,(o,n)=>t(o.params,n))}set onlisttools(t){this.setRequestHandler(Jo,(o,n)=>t(o.params,n))}assertCapabilityForMethod(t){}assertRequestHandlerCapability(t){switch(t){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${t})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${t} registered`)}}assertNotificationCapability(t){}assertTaskCapability(t){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(t){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(t,o){if(typeof t=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${t}"). Did you mean: callServerTool({ name: "${t}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:t},He,o)}async readServerResource(t,o){return await this.request({method:"resources/read",params:t},Bo,o)}async listServerResources(t,o){return await this.request({method:"resources/list",params:t},Fo,o)}sendMessage(t,o){return this.request({method:"ui/message",params:t},tu,o)}sendLog(t){return this.notification({method:"notifications/message",params:t})}updateModelContext(t,o){return this.request({method:"ui/update-model-context",params:t},lt,o)}openLink(t,o){return this.request({method:"ui/open-link",params:t},Xc,o)}sendOpenLink=this.openLink;downloadFile(t,o){return this.request({method:"ui/download-file",params:t},eu,o)}requestTeardown(t={}){return this.notification({method:"ui/notifications/request-teardown",params:t})}requestDisplayMode(t,o){return this.request({method:"ui/request-display-mode",params:t},lu,o)}sendSizeChanged(t){return this.notification({method:"ui/notifications/size-changed",params:t})}setupSizeChangedNotifications(){let t=!1,o=0,n=0,r=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1;let i=document.documentElement,a=i.style.width,p=i.style.height;i.style.width="fit-content",i.style.height="max-content";let h=i.getBoundingClientRect();i.style.width=a,i.style.height=p;let g=window.innerWidth-i.clientWidth,m=Math.ceil(h.width+g),v=Math.ceil(h.height);(m!==o||v!==n)&&(o=m,n=v,this.sendSizeChanged({width:m,height:v}))}))};r();let s=new ResizeObserver(r);return s.observe(document.documentElement),s.observe(document.body),()=>s.disconnect()}async connect(t=new Qo(window.parent,window.parent),o){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(t);try{let n=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:Jc}},hu,o);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(n){throw this.close(),n}}}class Yt extends Error{structured;constructor(t,o){super(t),this.name="ToolCallError",this.structured=o}}async function bu(e){const t=new vu({name:e.name,version:e.version});return t.ontoolresult=o=>{try{const n=o.structuredContent;if(n&&typeof n=="object"&&n.status==="success")Xt(e,n.data,n.meta,o);else if(n&&typeof n=="object"&&n.status==="error"){const r=n.message;Ve(r||"Unknown error"),e.onError?.(r||"Unknown error")}else{const r=o.content?.find(s=>s.type==="text");if(r&&"text"in r){const s=JSON.parse(r.text);s.status==="success"?Xt(e,s.data,s.meta,o):Ve(s.message||"Unknown error")}}}catch(n){const r=n instanceof Error?n.message:String(n);Ve(`Failed to parse result: ${r}`),e.onError?.(r)}},t.ontoolinput=o=>e.onInput?.(o.arguments??{}),t.onhostcontextchanged=o=>{if(o.styles?.variables&&fu(o.styles.variables),o.styles?.css?.fonts&&gu(o.styles.css.fonts),o.safeAreaInsets){const{top:n,right:r,bottom:s,left:i}=o.safeAreaInsets;document.body.style.padding=`${n}px ${r}px ${s}px ${i}px`}},t.onteardown=async()=>({}),await t.connect(new Qo),t}function Xt(e,t,o,n){const r=n._meta;r===void 0?e.onData(t,o):e.onData(t,o,r)}function Ve(e){const t=document.querySelector(".atoms-error");t&&t.remove();const o=document.createElement("div");o.className="atoms-error",o.textContent=e,document.body.prepend(o)}async function _u(e,t,o){return(await Xo(e,t,o)).data}async function Xo(e,t,o){const n=await e.callServerTool({name:t,arguments:o}),r=n._meta,s=p=>r===void 0?p:{...p,resultMeta:r},i=n.structuredContent;if(i&&typeof i=="object"&&"status"in i){if(i.status==="success")return s({data:i.data,meta:i.meta});throw new Yt(i.message||"Tool call failed",i)}const a=n.content?.find(p=>p.type==="text");if(a&&"text"in a){const p=JSON.parse(a.text);if(p.status==="success")return s({data:p.data,meta:p.meta});throw new Yt(p.message||"Tool call failed",p)}throw new Error("No structured or text content in tool response")}const wu={"&":"&","<":"<",">":">",'"':""","'":"'"};function D(e){return e==null?"":String(e).replace(/[&<>"']/g,t=>wu[t])}function yu(e){const t=e;if(!(!t||typeof t!="object")&&!(typeof t.total_count!="number"||typeof t.limit!="number"||typeof t.offset!="number"))return{total_count:t.total_count,limit:t.limit,offset:t.offset,has_more:t.has_more===!0}}const eo=e=>`${e} item${e===1?"":"s"}`;function ku(e,t,o){const n=yu(t);if(!n)return{stats:`Showing ${eo(e)}`,pager:null,prev:null,next:null,notice:null};const r=n.total_count,s=o?0:n.offset,i=`${s+1} to ${s+e} of ${r}`,a=r===0?"No items":e===0?`0 of ${r}`:s===0&&e>=r?eo(r):i;if(o){const m=e<r?`First ${e} matches. Refine the search.`:null;return{stats:a,pager:null,prev:null,next:null,notice:m}}const p=Math.floor((r-1)/n.limit)*n.limit,h=s>0?Math.max(0,Math.min(s-n.limit,p)):null,g=e>0&&s+e<r?s+e:null;return{stats:a,pager:h!==null||g!==null?e>0?i:a:null,prev:h,next:g,notice:null}}function Su(e){const t=o=>typeof o=="string"?o:"";return{type:t(e?.type),domain:t(e?.domain),level:t(e?.level),query:t(e?.query).trim()}}function We(e,t){if(!e)return{value:e,options:t};const o=t.find(n=>n===e)??t.find(n=>n.toLowerCase()===e.toLowerCase());return o===void 0?{value:e,options:[...t,e]}:{value:o,options:t}}function xu(e,t,o,n){const r={...t.type?{type:t.type}:{},...t.domain?{domain:t.domain}:{},...t.level?{level:t.level}:{}};return t.query.length>0?{name:"atoms_browse",args:{project_id:e,query:t.query,...r,limit:n}}:{name:"atoms_list_items",args:{project_id:e,...r,limit:n,offset:o}}}let me=null,It="",H={type:"",domain:"",level:"",query:""},te=0;const Tu=25;let Pe=null,Je=null;const zu={requirement:"#a855f7","test-case":"#e4e4e7",note:"#a855f780",table:"#606060"},$u={requirement:"REQ","test-case":"TC",note:"NOTE",table:"TABLE"},en=document.createElement("style");en.textContent=`
|
|
70
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:u().optional().describe("User's language and region preference in BCP 47 format."),timeZone:u().optional().describe("User's timezone in IANA format."),userAgent:u().optional().describe("Host application identifier."),platform:y([c("web"),c("desktop"),c("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:l({touch:I().optional().describe("Whether the device supports touch input."),hover:I().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:l({top:_().describe("Top safe area inset in pixels."),right:_().describe("Right safe area inset in pixels."),bottom:_().describe("Bottom safe area inset in pixels."),left:_().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),mu=l({method:c("ui/notifications/host-context-changed"),params:Yo.describe("Partial context update containing only changed fields.")});l({method:c("ui/update-model-context"),params:l({content:b(Se).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:z(u(),$().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});l({method:c("ui/initialize"),params:l({appInfo:Ue.describe("App identification (name and version)."),appCapabilities:uu.describe("Features and capabilities this app provides."),protocolVersion:u().describe("Protocol version this app supports.")})});var hu=l({protocolVersion:u().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Ue.describe("Host application identification and version."),hostCapabilities:cu.describe("Features and capabilities provided by the host."),hostContext:Yo.describe("Rich context about the host environment.")}).passthrough();function fu(e,t=document.documentElement){for(let[o,n]of Object.entries(e))n!==void 0&&t.style.setProperty(o,n)}function gu(e){if(document.getElementById("__mcp-host-fonts"))return;let t=document.createElement("style");t.id="__mcp-host-fonts",t.textContent=e,document.head.appendChild(t)}class vu extends Wc{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor(t,o={},n={autoResize:!0}){super(n),this._appInfo=t,this._capabilities=o,this.options=n,this.setRequestHandler(je,r=>(console.log("Received ping:",r.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(t){this.setNotificationHandler(ou,o=>t(o.params))}set ontoolinputpartial(t){this.setNotificationHandler(nu,o=>t(o.params))}set ontoolresult(t){this.setNotificationHandler(pu,o=>t(o.params))}set ontoolcancelled(t){this.setNotificationHandler(ru,o=>t(o.params))}set onhostcontextchanged(t){this.setNotificationHandler(mu,o=>{this._hostContext={...this._hostContext,...o.params},t(o.params)})}set onteardown(t){this.setRequestHandler(au,(o,n)=>t(o.params,n))}set oncalltool(t){this.setRequestHandler(Go,(o,n)=>t(o.params,n))}set onlisttools(t){this.setRequestHandler(Jo,(o,n)=>t(o.params,n))}assertCapabilityForMethod(t){}assertRequestHandlerCapability(t){switch(t){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${t})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${t} registered`)}}assertNotificationCapability(t){}assertTaskCapability(t){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(t){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(t,o){if(typeof t=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${t}"). Did you mean: callServerTool({ name: "${t}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:t},He,o)}async readServerResource(t,o){return await this.request({method:"resources/read",params:t},Bo,o)}async listServerResources(t,o){return await this.request({method:"resources/list",params:t},Fo,o)}sendMessage(t,o){return this.request({method:"ui/message",params:t},tu,o)}sendLog(t){return this.notification({method:"notifications/message",params:t})}updateModelContext(t,o){return this.request({method:"ui/update-model-context",params:t},lt,o)}openLink(t,o){return this.request({method:"ui/open-link",params:t},Xc,o)}sendOpenLink=this.openLink;downloadFile(t,o){return this.request({method:"ui/download-file",params:t},eu,o)}requestTeardown(t={}){return this.notification({method:"ui/notifications/request-teardown",params:t})}requestDisplayMode(t,o){return this.request({method:"ui/request-display-mode",params:t},lu,o)}sendSizeChanged(t){return this.notification({method:"ui/notifications/size-changed",params:t})}setupSizeChangedNotifications(){let t=!1,o=0,n=0,r=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1;let i=document.documentElement,a=i.style.width,p=i.style.height;i.style.width="fit-content",i.style.height="max-content";let h=i.getBoundingClientRect();i.style.width=a,i.style.height=p;let g=window.innerWidth-i.clientWidth,m=Math.ceil(h.width+g),v=Math.ceil(h.height);(m!==o||v!==n)&&(o=m,n=v,this.sendSizeChanged({width:m,height:v}))}))};r();let s=new ResizeObserver(r);return s.observe(document.documentElement),s.observe(document.body),()=>s.disconnect()}async connect(t=new Qo(window.parent,window.parent),o){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(t);try{let n=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:Jc}},hu,o);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(n){throw this.close(),n}}}class Yt extends Error{structured;constructor(t,o){super(t),this.name="ToolCallError",this.structured=o}}async function bu(e){const t=new vu({name:e.name,version:e.version});return t.ontoolresult=o=>{try{const n=o.structuredContent;if(n&&typeof n=="object"&&n.status==="success")Xt(e,n.data,n.meta,o);else if(n&&typeof n=="object"&&n.status==="error"){const r=n.message;Ve(r||"Unknown error"),e.onError?.(r||"Unknown error")}else{const r=o.content?.find(s=>s.type==="text");if(r&&"text"in r){const s=JSON.parse(r.text);s.status==="success"?Xt(e,s.data,s.meta,o):Ve(s.message||"Unknown error")}}}catch(n){const r=n instanceof Error?n.message:String(n);Ve(`Failed to parse result: ${r}`),e.onError?.(r)}},t.ontoolinput=o=>e.onInput?.(o.arguments??{}),t.onhostcontextchanged=o=>{if(o.styles?.variables&&fu(o.styles.variables),o.styles?.css?.fonts&&gu(o.styles.css.fonts),o.safeAreaInsets){const{top:n,right:r,bottom:s,left:i}=o.safeAreaInsets;document.body.style.padding=`${n}px ${r}px ${s}px ${i}px`}},t.onteardown=async()=>({}),await t.connect(new Qo),t}function Xt(e,t,o,n){const r=n._meta;r===void 0?e.onData(t,o):e.onData(t,o,r)}function Ve(e){const t=document.querySelector(".atoms-error");t&&t.remove();const o=document.createElement("div");o.className="atoms-error",o.textContent=e,document.body.prepend(o)}async function _u(e,t,o){return(await Xo(e,t,o)).data}async function Xo(e,t,o){const n=await e.callServerTool({name:t,arguments:o}),r=n._meta,s=p=>r===void 0?p:{...p,resultMeta:r},i=n.structuredContent;if(i&&typeof i=="object"&&"status"in i){if(i.status==="success")return s({data:i.data,meta:i.meta});throw new Yt(i.message||"Tool call failed",i)}const a=n.content?.find(p=>p.type==="text");if(a&&"text"in a){const p=JSON.parse(a.text);if(p.status==="success")return s({data:p.data,meta:p.meta});throw new Yt(p.message||"Tool call failed",p)}throw new Error("No structured or text content in tool response")}const wu={"&":"&","<":"<",">":">",'"':""","'":"'"};function D(e){return e==null?"":String(e).replace(/[&<>"']/g,t=>wu[t])}function yu(e){const t=e;if(!(!t||typeof t!="object")&&!(typeof t.total_count!="number"||typeof t.limit!="number"||typeof t.offset!="number"))return{total_count:t.total_count,limit:t.limit,offset:t.offset,has_more:t.has_more===!0}}const eo=e=>`${e} item${e===1?"":"s"}`;function ku(e,t,o){const n=yu(t);if(!n)return{stats:`Showing ${eo(e)}`,pager:null,prev:null,next:null,notice:null};const r=n.total_count,s=o?0:n.offset,i=`${s+1} to ${s+e} of ${r}`,a=r===0?"No items":e===0?`0 of ${r}`:s===0&&e>=r?eo(r):i;if(o){const m=e<r?`First ${e} matches. Refine the search.`:null;return{stats:a,pager:null,prev:null,next:null,notice:m}}const p=Math.floor((r-1)/n.limit)*n.limit,h=s>0?Math.max(0,Math.min(s-n.limit,p)):null,g=e>0&&s+e<r?s+e:null;return{stats:a,pager:h!==null||g!==null?e>0?i:a:null,prev:h,next:g,notice:null}}function Su(e){const t=o=>typeof o=="string"?o:"";return{type:t(e?.type),domain:t(e?.domain),level:t(e?.level),query:t(e?.query).trim()}}function We(e,t){if(!e)return{value:e,options:t};const o=t.find(n=>n===e)??t.find(n=>n.toLowerCase()===e.toLowerCase());return o===void 0?{value:e,options:[...t,e]}:{value:o,options:t}}function xu(e,t,o,n){const r={...t.type?{type:t.type}:{},...t.domain?{domain:t.domain}:{},...t.level?{level:t.level}:{}};return t.query.length>0?{name:"atoms_browse",args:{project_id:e,query:t.query,...r,limit:n}}:{name:"atoms_list_items",args:{project_id:e,...r,limit:n,offset:o}}}let me=null,It="",H={type:"",domain:"",level:"",query:""},te=0;const Tu=25;let Pe=null,Je=null;const zu={requirement:"#a855f7","test-case":"#e4e4e7",note:"#a855f780",function:"#14b8a6",table:"#606060"},$u={requirement:"REQ","test-case":"TC",note:"NOTE",table:"TABLE",function:"FN"},en=document.createElement("style");en.textContent=`
|
|
71
71
|
/* Toolbar controls */
|
|
72
72
|
.browse-toolbar-group {
|
|
73
73
|
display: flex;
|
|
@@ -67,7 +67,7 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
67
67
|
- omitted: host decides border`)});l({method:c("ui/request-display-mode"),params:l({mode:ge.describe("The display mode being requested.")})});var fu=l({mode:ge.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),gu=k([c("model"),c("app")]).describe("Tool visibility scope - who can access the tool.");l({resourceUri:u().optional(),visibility:b(gu).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
68
68
|
- "model": Tool visible to and callable by the agent
|
|
69
69
|
- "app": Tool callable by the app from this server only`)});l({mimeTypes:b(u()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});l({method:c("ui/download-file"),params:l({contents:b(k([Qo,Go])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})});l({method:c("ui/message"),params:l({role:c("user").describe('Message role, currently only "user" is supported.'),content:b($e).describe("Message content blocks (text, image, etc.).")})});l({method:c("ui/notifications/sandbox-resource-ready"),params:l({html:u().describe("HTML content to load into the inner iframe."),sandbox:u().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Pt.optional().describe("CSP configuration from resource metadata."),permissions:Zt.optional().describe("Sandbox permissions from resource metadata.")})});var vu=l({method:c("ui/notifications/tool-result"),params:Ke.describe("Standard MCP tool execution result.")}),on=l({toolInfo:l({id:ke.optional().describe("JSON-RPC id of the tools/call request."),tool:Ct.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:tu.optional().describe("Current color theme preference."),styles:du.optional().describe("Style configuration for theming the app."),displayMode:ge.optional().describe("How the UI is currently displayed."),availableDisplayModes:b(ge).optional().describe("Display modes the host supports."),containerDimensions:k([l({height:y().describe("Fixed container height in pixels.")}),l({maxHeight:k([y(),ot()]).optional().describe("Maximum container height in pixels.")})]).and(k([l({width:y().describe("Fixed container width in pixels.")}),l({maxWidth:k([y(),ot()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
70
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:u().optional().describe("User's language and region preference in BCP 47 format."),timeZone:u().optional().describe("User's timezone in IANA format."),userAgent:u().optional().describe("Host application identifier."),platform:k([c("web"),c("desktop"),c("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:l({touch:I().optional().describe("Whether the device supports touch input."),hover:I().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:l({top:y().describe("Top safe area inset in pixels."),right:y().describe("Right safe area inset in pixels."),bottom:y().describe("Bottom safe area inset in pixels."),left:y().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),_u=l({method:c("ui/notifications/host-context-changed"),params:on.describe("Partial context update containing only changed fields.")});l({method:c("ui/update-model-context"),params:l({content:b($e).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:z(u(),$().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});l({method:c("ui/initialize"),params:l({appInfo:We.describe("App identification (name and version)."),appCapabilities:hu.describe("Features and capabilities this app provides."),protocolVersion:u().describe("Protocol version this app supports.")})});var bu=l({protocolVersion:u().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:We.describe("Host application identification and version."),hostCapabilities:mu.describe("Features and capabilities provided by the host."),hostContext:on.describe("Rich context about the host environment.")}).passthrough();function yu(e,t=document.documentElement){for(let[o,n]of Object.entries(e))n!==void 0&&t.style.setProperty(o,n)}function ku(e){if(document.getElementById("__mcp-host-fonts"))return;let t=document.createElement("style");t.id="__mcp-host-fonts",t.textContent=e,document.head.appendChild(t)}class wu extends Yc{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor(t,o={},n={autoResize:!0}){super(n),this._appInfo=t,this._capabilities=o,this.options=n,this.setRequestHandler(Je,r=>(console.log("Received ping:",r.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(t){this.setNotificationHandler(au,o=>t(o.params))}set ontoolinputpartial(t){this.setNotificationHandler(cu,o=>t(o.params))}set ontoolresult(t){this.setNotificationHandler(vu,o=>t(o.params))}set ontoolcancelled(t){this.setNotificationHandler(uu,o=>t(o.params))}set onhostcontextchanged(t){this.setNotificationHandler(_u,o=>{this._hostContext={...this._hostContext,...o.params},t(o.params)})}set onteardown(t){this.setRequestHandler(pu,(o,n)=>t(o.params,n))}set oncalltool(t){this.setRequestHandler(Xo,(o,n)=>t(o.params,n))}set onlisttools(t){this.setRequestHandler(Yo,(o,n)=>t(o.params,n))}assertCapabilityForMethod(t){}assertRequestHandlerCapability(t){switch(t){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${t})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${t} registered`)}}assertNotificationCapability(t){}assertTaskCapability(t){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(t){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(t,o){if(typeof t=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${t}"). Did you mean: callServerTool({ name: "${t}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:t},Ke,o)}async readServerResource(t,o){return await this.request({method:"resources/read",params:t},Ko,o)}async listServerResources(t,o){return await this.request({method:"resources/list",params:t},Jo,o)}sendMessage(t,o){return this.request({method:"ui/message",params:t},iu,o)}sendLog(t){return this.notification({method:"notifications/message",params:t})}updateModelContext(t,o){return this.request({method:"ui/update-model-context",params:t},gt,o)}openLink(t,o){return this.request({method:"ui/open-link",params:t},ru,o)}sendOpenLink=this.openLink;downloadFile(t,o){return this.request({method:"ui/download-file",params:t},su,o)}requestTeardown(t={}){return this.notification({method:"ui/notifications/request-teardown",params:t})}requestDisplayMode(t,o){return this.request({method:"ui/request-display-mode",params:t},fu,o)}sendSizeChanged(t){return this.notification({method:"ui/notifications/size-changed",params:t})}setupSizeChangedNotifications(){let t=!1,o=0,n=0,r=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1;let i=document.documentElement,a=i.style.width,d=i.style.height;i.style.width="fit-content",i.style.height="max-content";let m=i.getBoundingClientRect();i.style.width=a,i.style.height=d;let g=window.innerWidth-i.clientWidth,f=Math.ceil(m.width+g),h=Math.ceil(m.height);(f!==o||h!==n)&&(o=f,n=h,this.sendSizeChanged({width:f,height:h}))}))};r();let s=new ResizeObserver(r);return s.observe(document.documentElement),s.observe(document.body),()=>s.disconnect()}async connect(t=new tn(window.parent,window.parent),o){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(t);try{let n=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:Xc}},bu,o);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(n){throw this.close(),n}}}class st extends Error{structured;constructor(t,o){super(t),this.name="ToolCallError",this.structured=o}}async function xu(e){const t=new wu({name:e.name,version:e.version});return t.ontoolresult=o=>{try{const n=o.structuredContent;if(n&&typeof n=="object"&&n.status==="success")ro(e,n.data,n.meta,o);else if(n&&typeof n=="object"&&n.status==="error"){const r=n.message;Xe(r||"Unknown error"),e.onError?.(r||"Unknown error")}else{const r=o.content?.find(s=>s.type==="text");if(r&&"text"in r){const s=JSON.parse(r.text);s.status==="success"?ro(e,s.data,s.meta,o):Xe(s.message||"Unknown error")}}}catch(n){const r=n instanceof Error?n.message:String(n);Xe(`Failed to parse result: ${r}`),e.onError?.(r)}},t.ontoolinput=o=>e.onInput?.(o.arguments??{}),t.onhostcontextchanged=o=>{if(o.styles?.variables&&yu(o.styles.variables),o.styles?.css?.fonts&&ku(o.styles.css.fonts),o.safeAreaInsets){const{top:n,right:r,bottom:s,left:i}=o.safeAreaInsets;document.body.style.padding=`${n}px ${r}px ${s}px ${i}px`}},t.onteardown=async()=>({}),await t.connect(new tn),t}function ro(e,t,o,n){const r=n._meta;r===void 0?e.onData(t,o):e.onData(t,o,r)}function Xe(e){const t=document.querySelector(".atoms-error");t&&t.remove();const o=document.createElement("div");o.className="atoms-error",o.textContent=e,document.body.prepend(o)}async function Su(e,t,o){const n=await e.callServerTool({name:t,arguments:o}),r=n._meta,s=d=>r===void 0?d:{...d,resultMeta:r},i=n.structuredContent;if(i&&typeof i=="object"&&"status"in i){if(i.status==="success")return s({data:i.data,meta:i.meta});throw new st(i.message||"Tool call failed",i)}const a=n.content?.find(d=>d.type==="text");if(a&&"text"in a){const d=JSON.parse(a.text);if(d.status==="success")return s({data:d.data,meta:d.meta});throw new st(d.message||"Tool call failed",d)}throw new Error("No structured or text content in tool response")}const Tu={"&":"&","<":"<",">":">",'"':""","'":"'"};function V(e){return e==null?"":String(e).replace(/[&<>"']/g,t=>Tu[t])}const so=["title","summary","body","domains","level"],nn={title:"Title",summary:"Summary",body:"Body",domains:"Domains",level:"Level"};let Nt=null,rn="",Qe="",U=null,et=Promise.resolve(),se=0,K=null,ie=null,De=[],ve={},Le=null;const Q={},zu={requirement:"#a855f7","test-case":"#e4e4e7",note:"#a855f780"},$u={requirement:"REQ","test-case":"TC",note:"NOTE",table:"TABLE"},sn=document.createElement("style");sn.textContent=`
|
|
70
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:u().optional().describe("User's language and region preference in BCP 47 format."),timeZone:u().optional().describe("User's timezone in IANA format."),userAgent:u().optional().describe("Host application identifier."),platform:k([c("web"),c("desktop"),c("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:l({touch:I().optional().describe("Whether the device supports touch input."),hover:I().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:l({top:y().describe("Top safe area inset in pixels."),right:y().describe("Right safe area inset in pixels."),bottom:y().describe("Bottom safe area inset in pixels."),left:y().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),_u=l({method:c("ui/notifications/host-context-changed"),params:on.describe("Partial context update containing only changed fields.")});l({method:c("ui/update-model-context"),params:l({content:b($e).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:z(u(),$().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})});l({method:c("ui/initialize"),params:l({appInfo:We.describe("App identification (name and version)."),appCapabilities:hu.describe("Features and capabilities this app provides."),protocolVersion:u().describe("Protocol version this app supports.")})});var bu=l({protocolVersion:u().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:We.describe("Host application identification and version."),hostCapabilities:mu.describe("Features and capabilities provided by the host."),hostContext:on.describe("Rich context about the host environment.")}).passthrough();function yu(e,t=document.documentElement){for(let[o,n]of Object.entries(e))n!==void 0&&t.style.setProperty(o,n)}function ku(e){if(document.getElementById("__mcp-host-fonts"))return;let t=document.createElement("style");t.id="__mcp-host-fonts",t.textContent=e,document.head.appendChild(t)}class wu extends Yc{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor(t,o={},n={autoResize:!0}){super(n),this._appInfo=t,this._capabilities=o,this.options=n,this.setRequestHandler(Je,r=>(console.log("Received ping:",r.params),{})),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(t){this.setNotificationHandler(au,o=>t(o.params))}set ontoolinputpartial(t){this.setNotificationHandler(cu,o=>t(o.params))}set ontoolresult(t){this.setNotificationHandler(vu,o=>t(o.params))}set ontoolcancelled(t){this.setNotificationHandler(uu,o=>t(o.params))}set onhostcontextchanged(t){this.setNotificationHandler(_u,o=>{this._hostContext={...this._hostContext,...o.params},t(o.params)})}set onteardown(t){this.setRequestHandler(pu,(o,n)=>t(o.params,n))}set oncalltool(t){this.setRequestHandler(Xo,(o,n)=>t(o.params,n))}set onlisttools(t){this.setRequestHandler(Yo,(o,n)=>t(o.params,n))}assertCapabilityForMethod(t){}assertRequestHandlerCapability(t){switch(t){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${t})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${t} registered`)}}assertNotificationCapability(t){}assertTaskCapability(t){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(t){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(t,o){if(typeof t=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${t}"). Did you mean: callServerTool({ name: "${t}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:t},Ke,o)}async readServerResource(t,o){return await this.request({method:"resources/read",params:t},Ko,o)}async listServerResources(t,o){return await this.request({method:"resources/list",params:t},Jo,o)}sendMessage(t,o){return this.request({method:"ui/message",params:t},iu,o)}sendLog(t){return this.notification({method:"notifications/message",params:t})}updateModelContext(t,o){return this.request({method:"ui/update-model-context",params:t},gt,o)}openLink(t,o){return this.request({method:"ui/open-link",params:t},ru,o)}sendOpenLink=this.openLink;downloadFile(t,o){return this.request({method:"ui/download-file",params:t},su,o)}requestTeardown(t={}){return this.notification({method:"ui/notifications/request-teardown",params:t})}requestDisplayMode(t,o){return this.request({method:"ui/request-display-mode",params:t},fu,o)}sendSizeChanged(t){return this.notification({method:"ui/notifications/size-changed",params:t})}setupSizeChangedNotifications(){let t=!1,o=0,n=0,r=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1;let i=document.documentElement,a=i.style.width,d=i.style.height;i.style.width="fit-content",i.style.height="max-content";let m=i.getBoundingClientRect();i.style.width=a,i.style.height=d;let g=window.innerWidth-i.clientWidth,f=Math.ceil(m.width+g),h=Math.ceil(m.height);(f!==o||h!==n)&&(o=f,n=h,this.sendSizeChanged({width:f,height:h}))}))};r();let s=new ResizeObserver(r);return s.observe(document.documentElement),s.observe(document.body),()=>s.disconnect()}async connect(t=new tn(window.parent,window.parent),o){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(t);try{let n=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:Xc}},bu,o);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(n){throw this.close(),n}}}class st extends Error{structured;constructor(t,o){super(t),this.name="ToolCallError",this.structured=o}}async function xu(e){const t=new wu({name:e.name,version:e.version});return t.ontoolresult=o=>{try{const n=o.structuredContent;if(n&&typeof n=="object"&&n.status==="success")ro(e,n.data,n.meta,o);else if(n&&typeof n=="object"&&n.status==="error"){const r=n.message;Xe(r||"Unknown error"),e.onError?.(r||"Unknown error")}else{const r=o.content?.find(s=>s.type==="text");if(r&&"text"in r){const s=JSON.parse(r.text);s.status==="success"?ro(e,s.data,s.meta,o):Xe(s.message||"Unknown error")}}}catch(n){const r=n instanceof Error?n.message:String(n);Xe(`Failed to parse result: ${r}`),e.onError?.(r)}},t.ontoolinput=o=>e.onInput?.(o.arguments??{}),t.onhostcontextchanged=o=>{if(o.styles?.variables&&yu(o.styles.variables),o.styles?.css?.fonts&&ku(o.styles.css.fonts),o.safeAreaInsets){const{top:n,right:r,bottom:s,left:i}=o.safeAreaInsets;document.body.style.padding=`${n}px ${r}px ${s}px ${i}px`}},t.onteardown=async()=>({}),await t.connect(new tn),t}function ro(e,t,o,n){const r=n._meta;r===void 0?e.onData(t,o):e.onData(t,o,r)}function Xe(e){const t=document.querySelector(".atoms-error");t&&t.remove();const o=document.createElement("div");o.className="atoms-error",o.textContent=e,document.body.prepend(o)}async function Su(e,t,o){const n=await e.callServerTool({name:t,arguments:o}),r=n._meta,s=d=>r===void 0?d:{...d,resultMeta:r},i=n.structuredContent;if(i&&typeof i=="object"&&"status"in i){if(i.status==="success")return s({data:i.data,meta:i.meta});throw new st(i.message||"Tool call failed",i)}const a=n.content?.find(d=>d.type==="text");if(a&&"text"in a){const d=JSON.parse(a.text);if(d.status==="success")return s({data:d.data,meta:d.meta});throw new st(d.message||"Tool call failed",d)}throw new Error("No structured or text content in tool response")}const Tu={"&":"&","<":"<",">":">",'"':""","'":"'"};function V(e){return e==null?"":String(e).replace(/[&<>"']/g,t=>Tu[t])}const so=["title","summary","body","domains","level"],nn={title:"Title",summary:"Summary",body:"Body",domains:"Domains",level:"Level"};let Nt=null,rn="",Qe="",U=null,et=Promise.resolve(),se=0,K=null,ie=null,De=[],ve={},Le=null;const Q={},zu={requirement:"#a855f7","test-case":"#e4e4e7",note:"#a855f780",function:"#14b8a6"},$u={requirement:"REQ","test-case":"TC",note:"NOTE",table:"TABLE",function:"FN"},sn=document.createElement("style");sn.textContent=`
|
|
71
71
|
.editor-card {
|
|
72
72
|
padding: 16px;
|
|
73
73
|
}
|