@optiaxiom/proteus 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/esm/_virtual/_openai-shim-script.js +1 -1
  2. package/dist/esm/assets/src/proteus-chart/{ProteusChart.css.ts.vanilla-BMEbDhgW.css → ProteusChart.css.ts.vanilla-UlV5bM-e.css} +2 -2
  3. package/dist/esm/assets/src/proteus-chart/{ProteusChartTooltipContent.css.ts.vanilla-DeE905en.css → ProteusChartTooltipContent.css.ts.vanilla-DFvGuq6I.css} +2 -2
  4. package/dist/esm/assets/src/proteus-document/{ProteusDocumentShell.css.ts.vanilla-JoQXI97u.css → ProteusDocumentShell.css.ts.vanilla-C3__yEhR.css} +2 -2
  5. package/dist/esm/assets/src/proteus-image-carousel/{ProteusImageCarousel.css.ts.vanilla-D8aYxZmX.css → ProteusImageCarousel.css.ts.vanilla-bCVJ5JAJ.css} +2 -2
  6. package/dist/esm/assets/src/proteus-question/{ProteusQuestion.css.ts.vanilla-CyslVupM.css → ProteusQuestion.css.ts.vanilla-usVGixHc.css} +2 -2
  7. package/dist/esm/index.js +1 -0
  8. package/dist/esm/proteus-bridge/ProteusBridge.js +1 -1
  9. package/dist/esm/proteus-chart/ProteusChart-css.js +1 -1
  10. package/dist/esm/proteus-chart/ProteusChart.js +1 -1
  11. package/dist/esm/proteus-chart/ProteusChartTooltipContent-css.js +1 -1
  12. package/dist/esm/proteus-data-table/ProteusDataTable.js +1 -1
  13. package/dist/esm/proteus-document/ProteusDocumentShell-css.js +1 -1
  14. package/dist/esm/proteus-document/ProteusDocumentShell.js +2 -0
  15. package/dist/esm/proteus-document/resolveProteusValue.js +18 -6
  16. package/dist/esm/proteus-element/ProteusElement.js +3 -0
  17. package/dist/esm/proteus-file-upload/ProteusFileUpload.js +66 -0
  18. package/dist/esm/proteus-image-carousel/ProteusImageCarousel-css.js +1 -1
  19. package/dist/esm/proteus-image-carousel/ProteusImageCarousel.js +4 -1
  20. package/dist/esm/proteus-question/ProteusQuestion-css.js +1 -1
  21. package/dist/esm/schema/public-schema.json.js +128 -18
  22. package/dist/esm/schema/runtime-schema.json.js +124 -17
  23. package/dist/index.d.ts +45 -8
  24. package/dist/spec.d.ts +864 -749
  25. package/package.json +3 -3
@@ -75,7 +75,7 @@ Boolean requesting whether a visible border and background is provided by the ho
75
75
  - omitted: host decides border\`)}),cT=l.object({method:l.literal("ui/request-display-mode"),params:l.object({mode:so.describe("The display mode being requested.")})}),O_=l.object({mode:so.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),D_=l.union([l.literal("model"),l.literal("app")]).describe("Tool visibility scope - who can access the tool."),uT=l.object({resourceUri:l.string().optional(),visibility:l.array(D_).optional().describe(\`Who can access this tool. Default: ["model", "app"]
76
76
  - "model": Tool visible to and callable by the agent
77
77
  - "app": Tool callable by the app from this server only\`)}),lT=l.object({mimeTypes:l.array(l.string()).optional().describe('Array of supported MIME types for UI resources.\\nMust include \`"text/html;profile=mcp-app"\` for MCP Apps support.')}),dT=l.object({method:l.literal("ui/download-file"),params:l.object({contents:l.array(l.union([Rl,Al])).describe("Resource contents to download \\u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),pT=l.object({method:l.literal("ui/message"),params:l.object({role:l.literal("user").describe('Message role, currently only "user" is supported.'),content:l.array(\$r).describe("Message content blocks (text, image, etc.).")})}),mT=l.object({method:l.literal("ui/notifications/sandbox-resource-ready"),params:l.object({html:l.string().describe("HTML content to load into the inner iframe."),sandbox:l.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Wl.optional().describe("CSP configuration from resource metadata."),permissions:Kl.optional().describe("Sandbox permissions from resource metadata.")})}),N_=l.object({method:l.literal("ui/notifications/tool-result"),params:kr.describe("Standard MCP tool execution result.")}),bf=l.object({toolInfo:l.object({id:_r.optional().describe("JSON-RPC id of the tools/call request."),tool:ks.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:y_.optional().describe("Current color theme preference."),styles:T_.optional().describe("Style configuration for theming the app."),displayMode:so.optional().describe("How the UI is currently displayed."),availableDisplayModes:l.array(so).optional().describe("Display modes the host supports."),containerDimensions:l.union([l.object({height:l.number().describe("Fixed container height in pixels.")}),l.object({maxHeight:l.union([l.number(),l.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(l.union([l.object({width:l.number().describe("Fixed container width in pixels.")}),l.object({maxWidth:l.union([l.number(),l.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(\`Container dimensions. Represents the dimensions of the iframe or other
78
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.\`),locale:l.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:l.string().optional().describe("User's timezone in IANA format."),userAgent:l.string().optional().describe("Host application identifier."),platform:l.union([l.literal("web"),l.literal("desktop"),l.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:l.object({touch:l.boolean().optional().describe("Whether the device supports touch input."),hover:l.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:l.object({top:l.number().describe("Top safe area inset in pixels."),right:l.number().describe("Right safe area inset in pixels."),bottom:l.number().describe("Bottom safe area inset in pixels."),left:l.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),U_=l.object({method:l.literal("ui/notifications/host-context-changed"),params:bf.describe("Partial context update containing only changed fields.")}),fT=l.object({method:l.literal("ui/update-model-context"),params:l.object({content:l.array(\$r).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:l.record(l.string(),l.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),gT=l.object({method:l.literal("ui/initialize"),params:l.object({appInfo:qn.describe("App identification (name and version)."),appCapabilities:Z_.describe("Features and capabilities this app provides."),protocolVersion:l.string().describe("Protocol version this app supports.")})}),E_=l.object({protocolVersion:l.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:qn.describe("Host application identification and version."),hostCapabilities:j_.describe("Features and capabilities provided by the host."),hostContext:bf.describe("Rich context about the host environment.")}).passthrough();var Ps=class extends Bl{constructor(n,i={},t={autoResize:!0}){super(t);X(this,"_appInfo");X(this,"_capabilities");X(this,"options");X(this,"_hostCapabilities");X(this,"_hostInfo");X(this,"_hostContext");X(this,"eventSchemas",{toolinput:z_,toolinputpartial:S_,toolresult:N_,toolcancelled:w_,hostcontextchanged:U_});X(this,"_onteardown");X(this,"_oncalltool");X(this,"_onlisttools");X(this,"sendOpenLink",this.openLink);this._appInfo=n,this._capabilities=i,this.options=t,this.setRequestHandler(xr,o=>(console.log("Received ping:",o.params),{})),this.setEventHandler("hostcontextchanged",void 0)}onEventDispatch(n,i){n==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...i})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(n){this.setEventHandler("toolinput",n)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(n){this.setEventHandler("toolinputpartial",n)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(n){this.setEventHandler("toolresult",n)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(n){this.setEventHandler("toolcancelled",n)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(n){this.setEventHandler("hostcontextchanged",n)}get onteardown(){return this._onteardown}set onteardown(n){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,n),this._onteardown=n,this.replaceRequestHandler(P_,(i,t)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(i.params,t)})}get oncalltool(){return this._oncalltool}set oncalltool(n){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,n),this._oncalltool=n,this.replaceRequestHandler(Ml,(i,t)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(i.params,t)})}get onlisttools(){return this._onlisttools}set onlisttools(n){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,n),this._onlisttools=n,this.replaceRequestHandler(Cl,(i,t)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(i.params,t)})}assertCapabilityForMethod(n){}assertRequestHandlerCapability(n){switch(n){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(\`Client does not support tool capability (required for \${n})\`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(\`No handler for method \${n} registered\`)}}assertNotificationCapability(n){}assertTaskCapability(n){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(n){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(n,i){if(typeof n=="string")throw Error(\`callServerTool() expects an object as its first argument, but received a string ("\${n}"). Did you mean: callServerTool({ name: "\${n}", arguments: { ... } })?\`);return await this.request({method:"tools/call",params:n},kr,i)}async readServerResource(n,i){return await this.request({method:"resources/read",params:n},Dl,i)}async listServerResources(n,i){return await this.request({method:"resources/list",params:n},Zl,i)}sendMessage(n,i){return this.request({method:"ui/message",params:n},k_,i)}sendLog(n){return this.notification({method:"notifications/message",params:n})}updateModelContext(n,i){return this.request({method:"ui/update-model-context",params:n},ms,i)}openLink(n,i){return this.request({method:"ui/open-link",params:n},b_,i)}downloadFile(n,i){return this.request({method:"ui/download-file",params:n},\$_,i)}requestTeardown(n={}){return this.notification({method:"ui/notifications/request-teardown",params:n})}requestDisplayMode(n,i){return this.request({method:"ui/request-display-mode",params:n},O_,i)}sendSizeChanged(n){return this.notification({method:"ui/notifications/size-changed",params:n})}setupSizeChangedNotifications(){let n=!1,i=0,t=0,o=()=>{n||(n=!0,requestAnimationFrame(()=>{n=!1;let s=document.documentElement,u=s.style.height;s.style.height="max-content";let c=Math.ceil(s.getBoundingClientRect().height);s.style.height=u;let d=Math.ceil(window.innerWidth);(d!==i||c!==t)&&(i=d,t=c,this.sendSizeChanged({width:d,height:c}))}))};o();let a=new ResizeObserver(o);return a.observe(document.documentElement),a.observe(document.body),()=>a.disconnect()}async connect(n=new ao(window.parent,window.parent),i){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(n);try{let t=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:h_}},E_,i);if(t===void 0)throw Error(\`Server sent invalid initialize result: \${t}\`);this._hostCapabilities=t.hostCapabilities,this._hostInfo=t.hostInfo,this._hostContext=t.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(t){throw this.close(),t}}};var Lt=new Ps({name:"Opal Widget",version:"1.0.0"},{}),Gl={},Xl=null,xt={};function Ql(){window.dispatchEvent(new CustomEvent("openai:set_globals",{detail:{globals:{displayMode:xt.displayMode,locale:xt.locale,maxHeight:xt.containerDimensions?.maxHeight,toolInput:Gl,toolOutput:Xl}}}))}Lt.ontoolinput=e=>{Gl=e.arguments??{},Ql()};Lt.ontoolresult=e=>{Xl=e.content,Ql()};Lt.onhostcontextchanged=e=>{xt={...xt,...e},Ql()};window.openai={get displayMode(){return xt.displayMode},get locale(){return xt.locale},get maxHeight(){return xt.containerDimensions?.maxHeight},get toolInput(){return Gl},get toolOutput(){return Xl},callTool:(e,r)=>Lt.callServerTool({arguments:r,name:e}),openExternal:e=>Lt.openLink({url:e.href}),sendFollowUpMessage:e=>Lt.sendMessage({content:[{text:e.prompt,type:"text"}],role:"user"})};var R_=new ao(window.parent,window.parent);Lt.connect(R_);})();
78
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.\`),locale:l.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:l.string().optional().describe("User's timezone in IANA format."),userAgent:l.string().optional().describe("Host application identifier."),platform:l.union([l.literal("web"),l.literal("desktop"),l.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:l.object({touch:l.boolean().optional().describe("Whether the device supports touch input."),hover:l.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:l.object({top:l.number().describe("Top safe area inset in pixels."),right:l.number().describe("Right safe area inset in pixels."),bottom:l.number().describe("Bottom safe area inset in pixels."),left:l.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),U_=l.object({method:l.literal("ui/notifications/host-context-changed"),params:bf.describe("Partial context update containing only changed fields.")}),fT=l.object({method:l.literal("ui/update-model-context"),params:l.object({content:l.array(\$r).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:l.record(l.string(),l.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),gT=l.object({method:l.literal("ui/initialize"),params:l.object({appInfo:qn.describe("App identification (name and version)."),appCapabilities:Z_.describe("Features and capabilities this app provides."),protocolVersion:l.string().describe("Protocol version this app supports.")})}),E_=l.object({protocolVersion:l.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:qn.describe("Host application identification and version."),hostCapabilities:j_.describe("Features and capabilities provided by the host."),hostContext:bf.describe("Rich context about the host environment.")}).passthrough();var Ps=class extends Bl{constructor(n,i={},t={autoResize:!0}){super(t);X(this,"_appInfo");X(this,"_capabilities");X(this,"options");X(this,"_hostCapabilities");X(this,"_hostInfo");X(this,"_hostContext");X(this,"eventSchemas",{toolinput:z_,toolinputpartial:S_,toolresult:N_,toolcancelled:w_,hostcontextchanged:U_});X(this,"_onteardown");X(this,"_oncalltool");X(this,"_onlisttools");X(this,"sendOpenLink",this.openLink);this._appInfo=n,this._capabilities=i,this.options=t,this.setRequestHandler(xr,o=>(console.log("Received ping:",o.params),{})),this.setEventHandler("hostcontextchanged",void 0)}onEventDispatch(n,i){n==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...i})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(n){this.setEventHandler("toolinput",n)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(n){this.setEventHandler("toolinputpartial",n)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(n){this.setEventHandler("toolresult",n)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(n){this.setEventHandler("toolcancelled",n)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(n){this.setEventHandler("hostcontextchanged",n)}get onteardown(){return this._onteardown}set onteardown(n){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,n),this._onteardown=n,this.replaceRequestHandler(P_,(i,t)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(i.params,t)})}get oncalltool(){return this._oncalltool}set oncalltool(n){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,n),this._oncalltool=n,this.replaceRequestHandler(Ml,(i,t)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(i.params,t)})}get onlisttools(){return this._onlisttools}set onlisttools(n){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,n),this._onlisttools=n,this.replaceRequestHandler(Cl,(i,t)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(i.params,t)})}assertCapabilityForMethod(n){}assertRequestHandlerCapability(n){switch(n){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(\`Client does not support tool capability (required for \${n})\`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(\`No handler for method \${n} registered\`)}}assertNotificationCapability(n){}assertTaskCapability(n){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(n){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(n,i){if(typeof n=="string")throw Error(\`callServerTool() expects an object as its first argument, but received a string ("\${n}"). Did you mean: callServerTool({ name: "\${n}", arguments: { ... } })?\`);return await this.request({method:"tools/call",params:n},kr,i)}async readServerResource(n,i){return await this.request({method:"resources/read",params:n},Dl,i)}async listServerResources(n,i){return await this.request({method:"resources/list",params:n},Zl,i)}sendMessage(n,i){return this.request({method:"ui/message",params:n},k_,i)}sendLog(n){return this.notification({method:"notifications/message",params:n})}updateModelContext(n,i){return this.request({method:"ui/update-model-context",params:n},ms,i)}openLink(n,i){return this.request({method:"ui/open-link",params:n},b_,i)}downloadFile(n,i){return this.request({method:"ui/download-file",params:n},\$_,i)}requestTeardown(n={}){return this.notification({method:"ui/notifications/request-teardown",params:n})}requestDisplayMode(n,i){return this.request({method:"ui/request-display-mode",params:n},O_,i)}sendSizeChanged(n){return this.notification({method:"ui/notifications/size-changed",params:n})}setupSizeChangedNotifications(){let n=!1,i=0,t=0,o=()=>{n||(n=!0,requestAnimationFrame(()=>{n=!1;let s=document.documentElement,u=s.style.height;s.style.height="max-content";let c=Math.ceil(s.getBoundingClientRect().height);s.style.height=u;let d=Math.ceil(window.innerWidth);(d!==i||c!==t)&&(i=d,t=c,this.sendSizeChanged({width:d,height:c}))}))};o();let a=new ResizeObserver(o);return a.observe(document.documentElement),a.observe(document.body),()=>a.disconnect()}async connect(n=new ao(window.parent,window.parent),i){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(n);try{let t=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:h_}},E_,i);if(t===void 0)throw Error(\`Server sent invalid initialize result: \${t}\`);this._hostCapabilities=t.hostCapabilities,this._hostInfo=t.hostInfo,this._hostContext=t.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(t){throw this.close(),t}}};var Lt=new Ps({name:"Opal Widget",version:"1.0.0"},{}),Gl={},Xl=null,xt={};function Ql(){window.dispatchEvent(new CustomEvent("openai:set_globals",{detail:{globals:{displayMode:xt.displayMode,locale:xt.locale,maxHeight:xt.containerDimensions?.maxHeight,toolInput:Gl,toolOutput:Xl}}}))}Lt.ontoolinput=e=>{Gl=e.arguments??{},Ql()};Lt.ontoolresult=e=>{Xl=e.content,Ql()};Lt.onhostcontextchanged=e=>{xt={...xt,...e},Ql()};window.openai={get displayMode(){return xt.displayMode},get locale(){return xt.locale},get maxHeight(){return xt.containerDimensions?.maxHeight},get toolInput(){return Gl},get toolOutput(){return Xl},callTool:async(e,r)=>({result:await Lt.callServerTool({arguments:r,name:e})}),openExternal:e=>Lt.openLink({url:e.href}),sendFollowUpMessage:e=>Lt.sendMessage({content:[{text:e.prompt,type:"text"}],role:"user"})};var R_=new ao(window.parent,window.parent);Lt.connect(R_);})();
79
79
  </script>`;
80
80
 
81
81
  export { OPENAI_SHIM_SCRIPT };
@@ -1,5 +1,5 @@
1
- @layer optiaxiom.txqk6n;
2
- @layer optiaxiom.txqk6n {
1
+ @layer optiaxiom._10u9e24;
2
+ @layer optiaxiom._10u9e24 {
3
3
  .ProteusChart__jmlqij1 {
4
4
  border-radius: 16px;
5
5
  }
@@ -1,5 +1,5 @@
1
- @layer optiaxiom.txqk6n;
2
- @layer optiaxiom.txqk6n {
1
+ @layer optiaxiom._10u9e24;
2
+ @layer optiaxiom._10u9e24 {
3
3
  .ProteusChartTooltipContent__1gsvq810 {
4
4
  min-width: 128px;
5
5
  position: absolute;
@@ -1,5 +1,5 @@
1
- @layer optiaxiom.txqk6n;
2
- @layer optiaxiom.txqk6n {
1
+ @layer optiaxiom._10u9e24;
2
+ @layer optiaxiom._10u9e24 {
3
3
  .ProteusDocumentShell__vpuvfj1 {
4
4
  margin: -4px;
5
5
  }
@@ -1,5 +1,5 @@
1
- @layer optiaxiom.txqk6n;
2
- @layer optiaxiom.txqk6n {
1
+ @layer optiaxiom._10u9e24;
2
+ @layer optiaxiom._10u9e24 {
3
3
  .ProteusImageCarousel__1t6qej70 {
4
4
  outline: none;
5
5
  user-select: none;
@@ -1,5 +1,5 @@
1
- @layer optiaxiom.txqk6n;
2
- @layer optiaxiom.txqk6n {
1
+ @layer optiaxiom._10u9e24;
2
+ @layer optiaxiom._10u9e24 {
3
3
  .ProteusQuestion__8f590p0 {
4
4
  outline: none;
5
5
  }
package/dist/esm/index.js CHANGED
@@ -5,6 +5,7 @@ export { ProteusDataTable } from './proteus-data-table/ProteusDataTable.js';
5
5
  export { ProteusDocumentRenderer } from './proteus-document/ProteusDocumentRenderer.js';
6
6
  export { ProteusDocumentShell } from './proteus-document/ProteusDocumentShell.js';
7
7
  export { safeParseDocument } from './proteus-document/schemas.js';
8
+ export { ProteusFileUpload } from './proteus-file-upload/ProteusFileUpload.js';
8
9
  export { ProteusImage } from './proteus-image/ProteusImage.js';
9
10
  export { ProteusImageCarousel } from './proteus-image-carousel/ProteusImageCarousel.js';
10
11
  export { ProteusInput } from './proteus-input/ProteusInput.js';
@@ -79,7 +79,7 @@ function ProteusBridge({ height = 400, resource }) {
79
79
  {
80
80
  ref: setIframe,
81
81
  sandbox: "allow-scripts allow-popups allow-popups-to-escape-sandbox allow-forms",
82
- srcDoc: mimeType === "text/html;profile=openai-app" ? OPENAI_SHIM_SCRIPT + html : html,
82
+ srcDoc: mimeType === "text/html+skybridge" ? OPENAI_SHIM_SCRIPT + html : html,
83
83
  style: { border: "none", height, width: "100%" },
84
84
  title: "Opal Widget"
85
85
  }
@@ -1,4 +1,4 @@
1
- import './../assets/src/proteus-chart/ProteusChart.css.ts.vanilla-BMEbDhgW.css';
1
+ import './../assets/src/proteus-chart/ProteusChart.css.ts.vanilla-UlV5bM-e.css';
2
2
  import { recipe } from '@optiaxiom/react/css-runtime';
3
3
 
4
4
  var chart = recipe({base:[{border:'1',borderColor:'border.tertiary',fontSize:'sm',p:'16'},'ProteusChart__jmlqij1','ProteusChart__jmlqij0']});
@@ -69,7 +69,7 @@ const ProteusChart = ({
69
69
  portal: document.body
70
70
  }
71
71
  ),
72
- series.map((s, i) => /* @__PURE__ */ jsx(
72
+ series?.map((s, i) => /* @__PURE__ */ jsx(
73
73
  Chart,
74
74
  {
75
75
  dataKey: (row) => get(row, "/" + s.dataKey),
@@ -1,4 +1,4 @@
1
- import './../assets/src/proteus-chart/ProteusChartTooltipContent.css.ts.vanilla-DeE905en.css';
1
+ import './../assets/src/proteus-chart/ProteusChartTooltipContent.css.ts.vanilla-DFvGuq6I.css';
2
2
  import { recipe } from '@optiaxiom/react/css-runtime';
3
3
 
4
4
  var tooltip = recipe({base:[{bg:'bg.default',border:'1',borderColor:'border.secondary',display:'grid',fontSize:'sm',gap:'6',pointerEvents:'none',px:'8',py:'10',rounded:'lg',shadow:'lg',transition:'all',z:'popover'},'ProteusChartTooltipContent__1gsvq810']});
@@ -8,7 +8,7 @@ import { applyFormatter } from '../proteus-document/getProteusValue.js';
8
8
  const ProteusDataTable = ({ columns, data }) => {
9
9
  const tableData = data;
10
10
  const columnHelper = createColumnHelper();
11
- const columnDefs = columns.map((col) => {
11
+ const columnDefs = (columns || []).map((col) => {
12
12
  return columnHelper.accessor(
13
13
  (row) => {
14
14
  const value = get(row, "/" + col.accessorKey);
@@ -1,4 +1,4 @@
1
- import './../assets/src/proteus-document/ProteusDocumentShell.css.ts.vanilla-JoQXI97u.css';
1
+ import './../assets/src/proteus-document/ProteusDocumentShell.css.ts.vanilla-C3__yEhR.css';
2
2
  import { recipe } from '@optiaxiom/react/css-runtime';
3
3
 
4
4
  var body = recipe({base:[{flexDirection:'column',gap:'16'},'ProteusDocumentShell__vpuvfj0'],variants:{truncate:{false:{},true:[{maxH:'sm',overflow:'auto',p:'4'},'ProteusDocumentShell__vpuvfj1']}}});
@@ -21,6 +21,7 @@ function ProteusDocumentShell({
21
21
  onMessage,
22
22
  onOpenChange,
23
23
  onTrack,
24
+ onUpload,
24
25
  open: openProp,
25
26
  readOnly = false,
26
27
  strict,
@@ -101,6 +102,7 @@ function ProteusDocumentShell({
101
102
  onTrack?.(event, properties);
102
103
  }
103
104
  ),
105
+ onUpload,
104
106
  readOnly,
105
107
  strict,
106
108
  useResource,
@@ -88,11 +88,13 @@ function resolveProteusValue(value, data, parentPath, mapIndices = []) {
88
88
  }
89
89
  const resolvedPath = value.path.startsWith("/") ? value.path : `${parentPath}/${value.path}`;
90
90
  const items = array.map(
91
- (_, index) => resolveProteusValue(value.children, data, `${resolvedPath}/${index}`, [
92
- ...mapIndices,
93
- index
94
- ])
95
- );
91
+ (_, index) => resolveProteusValue(
92
+ value.children,
93
+ data,
94
+ `${resolvedPath}/${index}`,
95
+ [...mapIndices, index]
96
+ )
97
+ ).filter((v) => v !== void 0);
96
98
  if ("separator" in value) {
97
99
  const sep = resolveProteusValue(
98
100
  value.separator,
@@ -122,8 +124,18 @@ function resolveProteusValue(value, data, parentPath, mapIndices = []) {
122
124
  (child) => resolveProteusValue(child, data, parentPath, mapIndices)
123
125
  ).filter((v) => v !== void 0).join("");
124
126
  }
127
+ return value;
128
+ }
129
+ if (Array.isArray(value)) {
130
+ return value.map((v) => resolveProteusValue(v, data, parentPath, mapIndices)).filter((v) => v !== void 0);
131
+ }
132
+ const resolved = {};
133
+ for (const [k, v] of Object.entries(value)) {
134
+ const r = resolveProteusValue(v, data, parentPath, mapIndices);
135
+ if (r !== void 0)
136
+ resolved[k] = r;
125
137
  }
126
- return value;
138
+ return resolved;
127
139
  }
128
140
 
129
141
  export { evaluateCondition, resolveProteusValue };
@@ -11,6 +11,7 @@ import { useProteusDocumentContext } from '../proteus-document/ProteusDocumentCo
11
11
  import { useProteusDocumentPathContext } from '../proteus-document/ProteusDocumentPathContext.js';
12
12
  import { resolveProteusProp } from '../proteus-document/resolveProteusProp.js';
13
13
  import { safeParseElement } from '../proteus-document/schemas.js';
14
+ import { ProteusFileUpload } from '../proteus-file-upload/ProteusFileUpload.js';
14
15
  import { ProteusImageCarousel } from '../proteus-image-carousel/ProteusImageCarousel.js';
15
16
  import { ProteusImage } from '../proteus-image/ProteusImage.js';
16
17
  import { ProteusInput } from '../proteus-input/ProteusInput.js';
@@ -97,6 +98,8 @@ const ProteusElement = ({
97
98
  );
98
99
  case "Field":
99
100
  return /* @__PURE__ */ jsx(Field, { ...resolve(element) });
101
+ case "FileUpload":
102
+ return /* @__PURE__ */ jsx(ProteusFileUpload, { ...resolve(element) });
100
103
  case "Group":
101
104
  return /* @__PURE__ */ jsx(Group, { ...resolve(element) });
102
105
  case "Heading":
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { Flex } from '@optiaxiom/react';
4
+ import { FileUpload, FileUploadList, FileUploadDropzone, FileUploadTrigger } from '@optiaxiom/react/unstable';
5
+ import { useState, useCallback } from 'react';
6
+ import { useProteusDocumentContext } from '../proteus-document/ProteusDocumentContext.js';
7
+ import { useProteusDocumentPathContext } from '../proteus-document/ProteusDocumentPathContext.js';
8
+
9
+ function ProteusFileUpload({ accept, name }) {
10
+ const { onDataChange, onUpload, readOnly } = useProteusDocumentContext(
11
+ "@optiaxiom/proteus/ProteusFileUpload"
12
+ );
13
+ const { path: parentPath } = useProteusDocumentPathContext(
14
+ "@optiaxiom/proteus/ProteusFileUpload"
15
+ );
16
+ const [item, setItem] = useState(null);
17
+ const writeUrl = useCallback(
18
+ (url) => {
19
+ if (!name)
20
+ return;
21
+ onDataChange?.(`${parentPath}/${name}`, url);
22
+ },
23
+ [name, onDataChange, parentPath]
24
+ );
25
+ const handleFilesDrop = useCallback(
26
+ async (incoming) => {
27
+ if (!onUpload || readOnly || incoming.length === 0) {
28
+ return;
29
+ }
30
+ const file = incoming[0];
31
+ setItem({ file, status: "uploading" });
32
+ writeUrl(null);
33
+ try {
34
+ const url = await onUpload(file);
35
+ setItem(
36
+ (curr) => curr?.file === file ? { file, status: "complete" } : curr
37
+ );
38
+ writeUrl(url);
39
+ } catch {
40
+ setItem(
41
+ (curr) => curr?.file === file ? { file, status: "error" } : curr
42
+ );
43
+ }
44
+ },
45
+ [onUpload, readOnly, writeUrl]
46
+ );
47
+ const handleRemove = useCallback(() => {
48
+ setItem(null);
49
+ writeUrl(null);
50
+ }, [writeUrl]);
51
+ return /* @__PURE__ */ jsx(
52
+ FileUpload,
53
+ {
54
+ accept,
55
+ disabled: !onUpload || readOnly,
56
+ onFilesDrop: handleFilesDrop,
57
+ children: item ? /* @__PURE__ */ jsxs(Flex, { flexDirection: "column", gap: "8", children: [
58
+ /* @__PURE__ */ jsx(FileUploadList, { items: [item], onRemove: handleRemove }),
59
+ /* @__PURE__ */ jsx(FileUploadDropzone, { overlay: true })
60
+ ] }) : /* @__PURE__ */ jsx(FileUploadDropzone, { children: /* @__PURE__ */ jsx(FileUploadTrigger, {}) })
61
+ }
62
+ );
63
+ }
64
+ ProteusFileUpload.displayName = "@optiaxiom/proteus/ProteusFileUpload";
65
+
66
+ export { ProteusFileUpload };
@@ -1,4 +1,4 @@
1
- import './../assets/src/proteus-image-carousel/ProteusImageCarousel.css.ts.vanilla-D8aYxZmX.css';
1
+ import './../assets/src/proteus-image-carousel/ProteusImageCarousel.css.ts.vanilla-bCVJ5JAJ.css';
2
2
  import { recipe } from '@optiaxiom/react/css-runtime';
3
3
 
4
4
  var carousel = recipe({base:[{flexDirection:'column',gap:'12'},'ProteusImageCarousel__1t6qej70']});
@@ -16,7 +16,10 @@ function ProteusImageCarousel({
16
16
  const { onEvent } = useProteusDocumentContext(
17
17
  "@optiaxiom/proteus/ProteusImageCarousel"
18
18
  );
19
- const [emblaMainRef, emblaMainApi] = useEmblaCarousel({ loop: false });
19
+ const [emblaMainRef, emblaMainApi] = useEmblaCarousel({
20
+ loop: false,
21
+ watchDrag: false
22
+ });
20
23
  const [emblaThumbsRef, emblaThumbsApi] = useEmblaCarousel({
21
24
  containScroll: "keepSnaps",
22
25
  dragFree: true
@@ -1,4 +1,4 @@
1
- import './../assets/src/proteus-question/ProteusQuestion.css.ts.vanilla-CyslVupM.css';
1
+ import './../assets/src/proteus-question/ProteusQuestion.css.ts.vanilla-usVGixHc.css';
2
2
  import { recipe } from '@optiaxiom/react/css-runtime';
3
3
 
4
4
  var addon = recipe({base:[{display:'grid',fontWeight:'500',placeItems:'center',rounded:'lg',size:'md',transition:'colors'},'ProteusQuestion__8f590p3'],variants:{cursor:{pointer:{cursor:'pointer'}}}});
@@ -2734,6 +2734,9 @@ var definitions = {
2734
2734
  {
2735
2735
  $ref: "#/definitions/ProteusField"
2736
2736
  },
2737
+ {
2738
+ $ref: "#/definitions/ProteusFileUpload"
2739
+ },
2737
2740
  {
2738
2741
  $ref: "#/definitions/ProteusGroup"
2739
2742
  },
@@ -2833,9 +2836,12 @@ var definitions = {
2833
2836
  },
2834
2837
  {
2835
2838
  type: "string"
2839
+ },
2840
+ {
2841
+ $ref: "#/definitions/ProteusStructuredMessage"
2836
2842
  }
2837
2843
  ],
2838
- description: "Message to send to LLM via sendNewMessage(). Can be a string, a Value reference, or a Map expression."
2844
+ description: "Message to send to LLM via sendNewMessage(). Can be a string, a Value reference, a Map expression, or a structured payload with parts and files."
2839
2845
  }
2840
2846
  },
2841
2847
  required: [
@@ -2932,6 +2938,56 @@ var definitions = {
2932
2938
  ],
2933
2939
  description: "A Proteus node can be a string, number, boolean, null, a single element, or an array of these types (similar to ReactNode)"
2934
2940
  },
2941
+ ProteusStructuredMessage: {
2942
+ additionalProperties: false,
2943
+ description: "Structured message payload that lets file URLs travel as a typed list alongside the text parts, instead of being joined into the text.",
2944
+ properties: {
2945
+ files: {
2946
+ anyOf: [
2947
+ {
2948
+ items: {
2949
+ type: "string"
2950
+ },
2951
+ type: "array"
2952
+ },
2953
+ {
2954
+ $ref: "#/definitions/ProteusExpression"
2955
+ }
2956
+ ],
2957
+ description: "List of file URLs (typically signed URLs from a host upload)."
2958
+ },
2959
+ parts: {
2960
+ items: {
2961
+ additionalProperties: false,
2962
+ properties: {
2963
+ content: {
2964
+ anyOf: [
2965
+ {
2966
+ type: "string"
2967
+ },
2968
+ {
2969
+ $ref: "#/definitions/ProteusExpression"
2970
+ }
2971
+ ]
2972
+ },
2973
+ type: {
2974
+ "const": "text"
2975
+ }
2976
+ },
2977
+ required: [
2978
+ "type",
2979
+ "content"
2980
+ ],
2981
+ type: "object"
2982
+ },
2983
+ type: "array"
2984
+ }
2985
+ },
2986
+ required: [
2987
+ "parts"
2988
+ ],
2989
+ type: "object"
2990
+ },
2935
2991
  ProteusZip: {
2936
2992
  additionalProperties: false,
2937
2993
  description: "Zips multiple parallel arrays into an array of objects. Each key in 'sources' becomes a property in the resulting row objects.",
@@ -4689,25 +4745,32 @@ var definitions = {
4689
4745
  description: "Chart layout direction"
4690
4746
  },
4691
4747
  series: {
4692
- description: "Data series configuration",
4693
- items: {
4694
- additionalProperties: false,
4695
- properties: {
4696
- dataKey: {
4697
- description: "Key in data records for this series",
4698
- type: "string"
4748
+ anyOf: [
4749
+ {
4750
+ description: "Data series configuration",
4751
+ items: {
4752
+ additionalProperties: false,
4753
+ properties: {
4754
+ dataKey: {
4755
+ description: "Key in data records for this series",
4756
+ type: "string"
4757
+ },
4758
+ name: {
4759
+ description: "Display name for legend",
4760
+ type: "string"
4761
+ }
4762
+ },
4763
+ required: [
4764
+ "dataKey"
4765
+ ],
4766
+ type: "object"
4699
4767
  },
4700
- name: {
4701
- description: "Display name for legend",
4702
- type: "string"
4703
- }
4768
+ type: "array"
4704
4769
  },
4705
- required: [
4706
- "dataKey"
4707
- ],
4708
- type: "object"
4709
- },
4710
- type: "array"
4770
+ {
4771
+ $ref: "#/definitions/ProteusExpression"
4772
+ }
4773
+ ]
4711
4774
  },
4712
4775
  type: {
4713
4776
  anyOf: [
@@ -5080,6 +5143,53 @@ var definitions = {
5080
5143
  ],
5081
5144
  type: "object"
5082
5145
  },
5146
+ ProteusFileUpload: {
5147
+ additionalProperties: false,
5148
+ examples: [
5149
+ {
5150
+ $type: "FileUpload",
5151
+ name: "value"
5152
+ }
5153
+ ],
5154
+ properties: {
5155
+ $type: {
5156
+ "const": "FileUpload"
5157
+ },
5158
+ accept: {
5159
+ description: "File types to accept; array of MIME types or extensions.",
5160
+ items: {
5161
+ type: "string"
5162
+ },
5163
+ type: "array"
5164
+ },
5165
+ name: {
5166
+ anyOf: [
5167
+ {
5168
+ type: "string"
5169
+ },
5170
+ {
5171
+ $ref: "#/definitions/ProteusExpression"
5172
+ }
5173
+ ],
5174
+ description: "The name of the form control element. The resolved URL is written at parentPath/name in form data."
5175
+ },
5176
+ required: {
5177
+ anyOf: [
5178
+ {
5179
+ type: "boolean"
5180
+ },
5181
+ {
5182
+ $ref: "#/definitions/ProteusExpression"
5183
+ }
5184
+ ],
5185
+ description: "Whether a file is required."
5186
+ }
5187
+ },
5188
+ required: [
5189
+ "$type"
5190
+ ],
5191
+ type: "object"
5192
+ },
5083
5193
  ProteusGroup: {
5084
5194
  additionalProperties: false,
5085
5195
  examples: [