@waniwani/sdk 0.5.0 → 0.5.2

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.
@@ -14,8 +14,8 @@ import React$1, { ReactNode, SetStateAction } from 'react';
14
14
  *
15
15
  * https://vercel.com/blog/running-next-js-inside-chatgpt-a-deep-dive-into-native-app-integration
16
16
  */
17
- declare function InitializeNextJsInChatGpt({ apiUrl }: {
18
- apiUrl: string;
17
+ declare function InitializeNextJsInChatGpt({ baseUrl }: {
18
+ baseUrl: string;
19
19
  }): react_jsx_runtime.JSX.Element;
20
20
 
21
21
  interface DevControlsProps {
package/dist/mcp/react.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import{a as ae}from"../chunk-DGSC74SV.js";import{b as H,c as le}from"../chunk-5OQXAEHG.js";import{Fragment as Ke,jsx as Y,jsxs as ze}from"react/jsx-runtime";function je({apiUrl:e}){return ze(Ke,{children:[Y("base",{href:e}),Y("script",{children:`window.innerBaseUrl = ${JSON.stringify(e)}`}),Y("script",{children:'window.__isChatGptApp = typeof window.openai !== "undefined";'}),Y("script",{children:"("+(()=>{let t=window.innerBaseUrl,n=document.documentElement;new MutationObserver(p=>{p.forEach(s=>{if(s.type==="attributes"&&s.target===n){let c=s.attributeName;c&&c!=="suppresshydrationwarning"&&c!=="lang"&&c!=="class"&&c!=="style"&&n.removeAttribute(c)}})}).observe(n,{attributes:!0,attributeOldValue:!0});let o=history.replaceState.bind(history);history.replaceState=(p,s,c)=>{try{let a=new URL(String(c??""),window.location.href);o(null,s,a.pathname+a.search+a.hash)}catch{}};let l=history.pushState.bind(history);history.pushState=(p,s,c)=>{try{let a=new URL(String(c??""),window.location.href);l(null,s,a.pathname+a.search+a.hash)}catch{}};let f=new URL(t).origin,h=window.self!==window.top;if(window.addEventListener("click",p=>{let s=p?.target?.closest("a");if(!s||!s.href)return;let c=new URL(s.href,window.location.href);if(c.origin!==window.location.origin&&c.origin!==f)try{window.openai&&(window.openai?.openExternal({href:s.href}),p.preventDefault())}catch{console.warn("openExternal failed, likely not in OpenAI client")}},!0),h&&window.location.origin!==f){let p=window.fetch;window.fetch=(s,c)=>{let a;if(typeof s=="string"||s instanceof URL?a=new URL(s,window.location.href):a=new URL(s.url,window.location.href),a.origin===f)return typeof s=="string"||s instanceof URL?s=a.toString():s=new Request(a.toString(),s),p.call(window,s,{...c,mode:"cors"});if(a.origin===window.location.origin){let g=new URL(t);return g.pathname=a.pathname,g.search=a.search,g.hash=a.hash,a=g,typeof s=="string"||s instanceof URL?s=a.toString():s=new Request(a.toString(),s),p.call(window,s,{...c,mode:"cors"})}return p.call(window,s,c)}}}).toString()+")()"})]})}import{useCallback as S,useEffect as O,useRef as te,useState as C}from"react";var de={theme:"dark",userAgent:{device:{type:"desktop"},capabilities:{hover:!0,touch:!1}},locale:"en",maxHeight:800,displayMode:"inline",safeArea:{insets:{top:0,bottom:0,left:0,right:0}},toolInput:{},toolOutput:null,toolResponseMetadata:null,widgetState:null},B={...de};function j(e){typeof window>"u"||window.openai||(B={...de,toolOutput:e??null},window.openai={...B,requestDisplayMode:async({mode:t})=>(_("displayMode",t),{mode:t}),callTool:async(t,n)=>(console.log(`[DevMode] callTool: ${t}`,n),{result:JSON.stringify({mock:!0,tool:t,args:n})}),sendFollowUpMessage:async({prompt:t})=>{console.log(`[DevMode] sendFollowUpMessage: ${t}`)},openExternal:({href:t})=>{console.log(`[DevMode] openExternal: ${t}`),window.open(t,"_blank")},setWidgetState:async t=>{_("widgetState",t)}},window.dispatchEvent(new H({globals:B})))}function _(e,t){typeof window>"u"||!window.openai||(B[e]=t,window.openai[e]=t,window.dispatchEvent(new H({globals:{[e]:t}})))}function $(){return{...B}}function K(e){_("toolOutput",e)}function z(e){_("displayMode",e)}function G(e){_("theme",e)}import{Fragment as ne,jsx as r,jsxs as v}from"react/jsx-runtime";var X=150;function ce({className:e}){return v("svg",{className:e,viewBox:"0 0 24 24",fill:"none",role:"img","aria-label":"Dev Controls",children:[r("rect",{x:"4",y:"4",width:"10",height:"10",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),r("rect",{x:"10",y:"10",width:"10",height:"10",rx:"2",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.15"})]})}function Ge({className:e}){return r("svg",{"aria-hidden":"true",className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r("path",{d:"M18 6L6 18M6 6l12 12"})})}function Ve({className:e}){return r("svg",{"aria-hidden":"true",className:e,viewBox:"0 0 16 16",fill:"none",children:r("rect",{x:"2",y:"4",width:"12",height:"8",rx:"1.5",stroke:"currentColor",strokeWidth:"1.25"})})}function Ye({className:e}){return v("svg",{"aria-hidden":"true",className:e,viewBox:"0 0 16 16",fill:"none",children:[r("rect",{x:"1.5",y:"3",width:"13",height:"10",rx:"1.5",stroke:"currentColor",strokeWidth:"1.25"}),r("rect",{x:"8.5",y:"7",width:"5",height:"4",rx:"0.75",fill:"currentColor"})]})}function $e({className:e}){return r("svg",{"aria-hidden":"true",className:e,viewBox:"0 0 16 16",fill:"none",children:r("path",{d:"M2 5.5V3.5C2 2.95 2.45 2.5 3 2.5H5.5M10.5 2.5H13C13.55 2.5 14 2.95 14 3.5V5.5M14 10.5V12.5C14 13.05 13.55 13.5 13 13.5H10.5M5.5 13.5H3C2.45 13.5 2 13.05 2 12.5V10.5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function Xe({className:e}){return v("svg",{"aria-hidden":"true",className:e,viewBox:"0 0 16 16",fill:"none",children:[r("circle",{cx:"8",cy:"8",r:"2.5",stroke:"currentColor",strokeWidth:"1.25"}),r("path",{d:"M8 2v1.5M8 12.5V14M2 8h1.5M12.5 8H14M4.11 4.11l1.06 1.06M10.83 10.83l1.06 1.06M4.11 11.89l1.06-1.06M10.83 5.17l1.06-1.06",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}function Je({className:e}){return r("svg",{"aria-hidden":"true",className:e,viewBox:"0 0 16 16",fill:"none",children:r("path",{d:"M13.5 9.5a5.5 5.5 0 01-7-7 5.5 5.5 0 107 7z",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function qe({className:e}){return v("svg",{"aria-hidden":"true",className:e,viewBox:"0 0 16 16",fill:"none",children:[r("path",{d:"M2.5 8a5.5 5.5 0 019.37-3.9M13.5 8a5.5 5.5 0 01-9.37 3.9",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),r("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]})}var Ze=`
2
+ import{a as ae}from"../chunk-DGSC74SV.js";import{b as H,c as le}from"../chunk-5OQXAEHG.js";import{Fragment as Ke,jsx as Y,jsxs as ze}from"react/jsx-runtime";function je({baseUrl:e}){return ze(Ke,{children:[Y("base",{href:e}),Y("script",{children:`window.innerBaseUrl = ${JSON.stringify(e)}`}),Y("script",{children:'window.__isChatGptApp = typeof window.openai !== "undefined";'}),Y("script",{children:"("+(()=>{let t=window.innerBaseUrl,n=document.documentElement;new MutationObserver(p=>{p.forEach(s=>{if(s.type==="attributes"&&s.target===n){let c=s.attributeName;c&&c!=="suppresshydrationwarning"&&c!=="lang"&&c!=="class"&&c!=="style"&&n.removeAttribute(c)}})}).observe(n,{attributes:!0,attributeOldValue:!0});let o=history.replaceState.bind(history);history.replaceState=(p,s,c)=>{try{let a=new URL(String(c??""),window.location.href);o(null,s,a.pathname+a.search+a.hash)}catch{}};let l=history.pushState.bind(history);history.pushState=(p,s,c)=>{try{let a=new URL(String(c??""),window.location.href);l(null,s,a.pathname+a.search+a.hash)}catch{}};let f=new URL(t).origin,h=window.self!==window.top;if(window.addEventListener("click",p=>{let s=p?.target?.closest("a");if(!s||!s.href)return;let c=new URL(s.href,window.location.href);if(c.origin!==window.location.origin&&c.origin!==f)try{window.openai&&(window.openai?.openExternal({href:s.href}),p.preventDefault())}catch{console.warn("openExternal failed, likely not in OpenAI client")}},!0),h&&window.location.origin!==f){let p=window.fetch;window.fetch=(s,c)=>{let a;if(typeof s=="string"||s instanceof URL?a=new URL(s,window.location.href):a=new URL(s.url,window.location.href),a.origin===f)return typeof s=="string"||s instanceof URL?s=a.toString():s=new Request(a.toString(),s),p.call(window,s,{...c,mode:"cors"});if(a.origin===window.location.origin){let g=new URL(t);return g.pathname=a.pathname,g.search=a.search,g.hash=a.hash,a=g,typeof s=="string"||s instanceof URL?s=a.toString():s=new Request(a.toString(),s),p.call(window,s,{...c,mode:"cors"})}return p.call(window,s,c)}}}).toString()+")()"})]})}import{useCallback as S,useEffect as O,useRef as te,useState as C}from"react";var de={theme:"dark",userAgent:{device:{type:"desktop"},capabilities:{hover:!0,touch:!1}},locale:"en",maxHeight:800,displayMode:"inline",safeArea:{insets:{top:0,bottom:0,left:0,right:0}},toolInput:{},toolOutput:null,toolResponseMetadata:null,widgetState:null},B={...de};function j(e){typeof window>"u"||window.openai||(B={...de,toolOutput:e??null},window.openai={...B,requestDisplayMode:async({mode:t})=>(_("displayMode",t),{mode:t}),callTool:async(t,n)=>(console.log(`[DevMode] callTool: ${t}`,n),{result:JSON.stringify({mock:!0,tool:t,args:n})}),sendFollowUpMessage:async({prompt:t})=>{console.log(`[DevMode] sendFollowUpMessage: ${t}`)},openExternal:({href:t})=>{console.log(`[DevMode] openExternal: ${t}`),window.open(t,"_blank")},setWidgetState:async t=>{_("widgetState",t)}},window.dispatchEvent(new H({globals:B})))}function _(e,t){typeof window>"u"||!window.openai||(B[e]=t,window.openai[e]=t,window.dispatchEvent(new H({globals:{[e]:t}})))}function $(){return{...B}}function K(e){_("toolOutput",e)}function z(e){_("displayMode",e)}function G(e){_("theme",e)}import{Fragment as ne,jsx as r,jsxs as v}from"react/jsx-runtime";var X=150;function ce({className:e}){return v("svg",{className:e,viewBox:"0 0 24 24",fill:"none",role:"img","aria-label":"Dev Controls",children:[r("rect",{x:"4",y:"4",width:"10",height:"10",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),r("rect",{x:"10",y:"10",width:"10",height:"10",rx:"2",stroke:"currentColor",strokeWidth:"1.5",fill:"currentColor",fillOpacity:"0.15"})]})}function Ge({className:e}){return r("svg",{"aria-hidden":"true",className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r("path",{d:"M18 6L6 18M6 6l12 12"})})}function Ve({className:e}){return r("svg",{"aria-hidden":"true",className:e,viewBox:"0 0 16 16",fill:"none",children:r("rect",{x:"2",y:"4",width:"12",height:"8",rx:"1.5",stroke:"currentColor",strokeWidth:"1.25"})})}function Ye({className:e}){return v("svg",{"aria-hidden":"true",className:e,viewBox:"0 0 16 16",fill:"none",children:[r("rect",{x:"1.5",y:"3",width:"13",height:"10",rx:"1.5",stroke:"currentColor",strokeWidth:"1.25"}),r("rect",{x:"8.5",y:"7",width:"5",height:"4",rx:"0.75",fill:"currentColor"})]})}function $e({className:e}){return r("svg",{"aria-hidden":"true",className:e,viewBox:"0 0 16 16",fill:"none",children:r("path",{d:"M2 5.5V3.5C2 2.95 2.45 2.5 3 2.5H5.5M10.5 2.5H13C13.55 2.5 14 2.95 14 3.5V5.5M14 10.5V12.5C14 13.05 13.55 13.5 13 13.5H10.5M5.5 13.5H3C2.45 13.5 2 13.05 2 12.5V10.5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function Xe({className:e}){return v("svg",{"aria-hidden":"true",className:e,viewBox:"0 0 16 16",fill:"none",children:[r("circle",{cx:"8",cy:"8",r:"2.5",stroke:"currentColor",strokeWidth:"1.25"}),r("path",{d:"M8 2v1.5M8 12.5V14M2 8h1.5M12.5 8H14M4.11 4.11l1.06 1.06M10.83 10.83l1.06 1.06M4.11 11.89l1.06-1.06M10.83 5.17l1.06-1.06",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}function Je({className:e}){return r("svg",{"aria-hidden":"true",className:e,viewBox:"0 0 16 16",fill:"none",children:r("path",{d:"M13.5 9.5a5.5 5.5 0 01-7-7 5.5 5.5 0 107 7z",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function qe({className:e}){return v("svg",{"aria-hidden":"true",className:e,viewBox:"0 0 16 16",fill:"none",children:[r("path",{d:"M2.5 8a5.5 5.5 0 019.37-3.9M13.5 8a5.5 5.5 0 01-9.37 3.9",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"}),r("path",{d:"M12.5 2v3h-3M3.5 14v-3h3",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]})}var Ze=`
3
3
  @keyframes devPanelSlideIn {
4
4
  0% {
5
5
  opacity: 0;