@wu529778790/open-im 1.11.2-beta.10 → 1.11.2-beta.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wu529778790/open-im",
3
- "version": "1.11.2-beta.10",
3
+ "version": "1.11.2-beta.11",
4
4
  "description": "Your AI coding assistant, in every chat app. Multi-platform IM bridge for Claude Code, Codex, and CodeBuddy.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -54,4 +54,4 @@ Error generating stack: `+a.message+`
54
54
  `));const La=($e.contents??"").trim();W(La),P(Me($e.contents,`{}
55
55
  `))}catch(Z){D&&dl({text:wa(Z),type:"error"})}finally{D&&Nl(!1)}})(),()=>{D=!1}},[h,b,xl]),G.useEffect(()=>{const D=window.setInterval(()=>{xl(),b()},Ny);return()=>window.clearInterval(D)},[b,xl]);const N=G.useCallback(()=>{try{JSON.parse(M),Ct({text:C("jsonValid"),type:"success"})}catch(D){Ct({text:C("jsonInvalid",{error:D instanceof Error?D.message:String(D)}),type:"error"})}},[M,C]);G.useEffect(()=>{N()},[M,N]);const w=G.useCallback(()=>({...r,ai:{...r.ai,hookPort:Number(r.ai.hookPort)||0}}),[r]),cl=G.useCallback(()=>{const D=[];return Fe.some(Z=>r.platforms[Z].enabled)||D.push(C("validationNoPlatformEnabled")),Rn.forEach(Z=>{if(!r.platforms[Z.key].enabled)return;const gl=Z.requiredFields.filter(Wl=>!String(r.platforms[Z.key][Wl]??"").trim());gl.length&&D.push(C("validationPlatformIncomplete",{platform:Z.label,fields:gl.join(", ")}))}),D},[r,C]),ml=async()=>{const D=cl();if(D.length){dl({text:D.join(" "),type:"error"});return}Nl(!0);try{await h("/api/config/validate",{method:"POST",body:JSON.stringify(w())}),dl({text:C("validationOk"),type:"success"})}catch(Z){dl({text:wa(Z),type:"error"})}finally{Nl(!1)}},o=async()=>{await h("/api/claude/settings",{method:"POST",body:JSON.stringify({contents:I})})},T=async()=>{await h("/api/codex/settings",{method:"POST",body:JSON.stringify({contents:S})})},O=async()=>{const D=M.trim();D&&(JSON.parse(D),await h("/api/config/file",{method:"POST",body:JSON.stringify({contents:D})}),W(D))},q=async()=>{const D=cl();if(D.length){dl({text:D.join(" "),type:"error"});return}Nl(!0);try{await Promise.all([o(),T(),O()]),await h("/api/config/save?final=1",{method:"POST",body:JSON.stringify(w())}),dl({text:C("saveOk"),type:"success"})}catch(Z){dl({text:wa(Z),type:"error"})}finally{Nl(!1)}},K=async()=>{const D=cl();if(D.length){dl({text:D.join(" "),type:"error"});return}Nl(!0);try{await Promise.all([o(),T(),h("/api/config/save",{method:"POST",body:JSON.stringify(w())})]),await h("/api/service/start",{method:"POST"}),await Promise.all([xl(),b()]),dl({text:C("startOk"),type:"success"})}catch(Z){dl({text:wa(Z),type:"error"})}finally{Nl(!1)}},ll=async()=>{Nl(!0);try{await h("/api/service/stop",{method:"POST"}),await xl(),dl({text:C("stopOk"),type:"success"})}catch(D){dl({text:wa(D),type:"error"})}finally{Nl(!1)}},rl=async()=>{J.running?await ll():await K()},Zl=async D=>{const Z=Rn.find(gl=>gl.key===D);if(Z){wl(D),Ll(gl=>({...gl,[D]:{text:"",ok:!0}}));try{const gl={};Z.testFields.forEach(Gt=>{gl[Gt]=String(r.platforms[D][Gt]??"")});const Wl=await h("/api/config/test",{method:"POST",body:JSON.stringify({platform:D,config:gl})});Ll(Gt=>({...Gt,[D]:Wl.success?{text:Wl.message||C("testSuccess"),ok:!0}:{text:C("testFailed",{error:Wl.error||"?"}),ok:!1}}))}catch(gl){Ll(Wl=>({...Wl,[D]:{text:C("testFailed",{error:wa(gl)}),ok:!1}}))}finally{wl(null)}}},x=(D,Z)=>{j(gl=>({...gl,platforms:{...gl.platforms,[D]:{...gl.platforms[D],...Z}}}))},Y=()=>{try{P(Rr(M))}catch{Ct({text:C("jsonInvalid",{error:"parse"}),type:"error"})}},el=()=>P(sl?`${sl}
56
56
  `:`{}
57
- `),bl=()=>{const D=!document.documentElement.classList.contains("dark");document.documentElement.classList.toggle("dark",D),localStorage.setItem(kr,D?"true":"false")},Jl=async()=>{Ul(!1);try{const D=await h("/api/config");j(Br(D.payload)),X({configPath:D.meta.configPath}),await Promise.all([xl(),b()])}catch{}};return d.jsxs("div",{style:{minHeight:"100vh",background:"var(--c-bg)"},children:[d.jsx(Dy,{lang,toggleLang,toggleDark:bl,serviceStatus:J,busy:ql,onValidate:()=>void ml(),onSave:()=>void q(),onToggleService:()=>void rl(),t:C}),d.jsxs("div",{className:"content",children:[ol.text&&d.jsx("div",{className:`flash msg ${ol.type==="success"?"msg-ok":"msg-err"}`,children:ol.text}),F?d.jsx(By,{request:h,t:C,html:_,onComplete:()=>void Jl(),initialPayload:r}):d.jsxs(d.Fragment,{children:[d.jsx(Uy,{health:kl,serviceStatus:J,t:C}),d.jsxs("section",{className:"section",children:[d.jsx("div",{className:"section-head",children:d.jsxs("div",{children:[d.jsx("h2",{className:"section-title",children:C("platformsTitle")}),d.jsx("p",{className:"section-desc",children:C("platformsHint")})]})}),d.jsx("div",{className:"platform-grid",children:Rn.map(D=>{const Z=D.key;return d.jsx(jy,{def:D,values:r.platforms[Z],t:C,html:_,disabledVisual:!r.platforms[Z].enabled,onChange:gl=>x(Z,gl),onTest:()=>void Zl(Z),testing:ct===Z,testResult:at[Z]},Z)})})]}),d.jsx(qy,{configJson:M,setConfigJson:P,claudeSettingsJson:I,setClaudeSettingsJson:U,codexSettingsJson:S,setCodexSettingsJson:L,jsonValidation:it,onSaveConfig:O,onSaveClaude:o,onSaveCodex:T,onFormat:Y,onReset:el,meta:H,setMessage:dl,t:C})]})]})]})}function Yy(){return d.jsx("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M11 2L3 12h7l-1 6 8-10H10l1-6z"})})}function wr(){return typeof window>"u"?zf:li()?"":zf}function Lr(){if(typeof localStorage>"u")return wr();const h=localStorage.getItem(Zr);return h&&!(li()&&Gr(h))?h:wr()}function Qy(){const[h,C]=G.useState(""),[_,r]=G.useState(!1),[j,H]=G.useState({text:"",ok:null}),X=G.useMemo(()=>qr(()=>h),[h]),I=G.useCallback(async S=>{const L=Qr(S);if(li()&&L&&Gr(L)){H({text:"HTTPS 页面不能直连 http://127.0.0.1。请使用内置页面或 HTTPS 隧道。",ok:!1}),C("");return}if(!L){H({text:"Enter server URL (e.g. http://127.0.0.1:39282)",ok:!1});return}C(L),H({text:"Connecting…",ok:null});try{await qr(()=>L)("/api/health"),localStorage.setItem(Zr,L),H({text:"Connected",ok:!0}),r(!0)}catch(M){H({text:M instanceof Error?M.message:String(M),ok:!1}),C("")}},[]);if(G.useEffect(()=>{const S=Lr();S.trim()&&I(S)},[I]),_)return d.jsx(Oy,{request:X,children:d.jsx("div",{id:"mainAppWrap",children:d.jsx(Ly,{})})});const U=()=>{var L;const S=((L=document.getElementById("srvUrl"))==null?void 0:L.value)??"";I(S)};return d.jsx("div",{className:"conn",children:d.jsxs("div",{className:"conn-card",children:[d.jsx("div",{className:"conn-logo",children:d.jsx(Yy,{})}),d.jsx("h1",{className:"conn-title",children:"open-im"}),d.jsx("p",{className:"conn-desc",children:"Connect to your open-im web API to manage configuration."}),d.jsxs("div",{className:"conn-row",children:[d.jsx("input",{id:"srvUrl",className:"conn-input",type:"text",placeholder:li()?"https://… or open http://127.0.0.1:39282":zf,autoComplete:"url",spellCheck:!1,defaultValue:Lr(),onKeyDown:S=>{S.key==="Enter"&&U()}}),d.jsx("button",{type:"button",className:"btn btn-p",onClick:U,children:"Connect"})]}),d.jsx("p",{className:`conn-status ${j.ok===!0?"ok":j.ok===!1?"err":""}`,"aria-live":"polite",children:j.text})]})})}const Yr=typeof localStorage<"u"?localStorage.getItem(kr):null;typeof document<"u"&&(Yr==="true"?document.documentElement.classList.add("dark"):Yr==="false"?document.documentElement.classList.remove("dark"):typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches&&document.documentElement.classList.add("dark"));Ey.createRoot(document.getElementById("root")).render(d.jsx(G.StrictMode,{children:d.jsx(Qy,{})}));
57
+ `),bl=()=>{const D=!document.documentElement.classList.contains("dark");document.documentElement.classList.toggle("dark",D),localStorage.setItem(kr,D?"true":"false")},Jl=async()=>{Ul(!1);try{const D=await h("/api/config");j(Br(D.payload)),X({configPath:D.meta.configPath}),await Promise.all([xl(),b()])}catch{}};return d.jsxs("div",{style:{minHeight:"100vh",background:"var(--c-bg)"},children:[d.jsx(Dy,{toggleDark:bl,serviceStatus:J,busy:ql,onValidate:()=>void ml(),onSave:()=>void q(),onToggleService:()=>void rl(),t:C}),d.jsxs("div",{className:"content",children:[ol.text&&d.jsx("div",{className:`flash msg ${ol.type==="success"?"msg-ok":"msg-err"}`,children:ol.text}),F?d.jsx(By,{request:h,t:C,html:_,onComplete:()=>void Jl(),initialPayload:r}):d.jsxs(d.Fragment,{children:[d.jsx(Uy,{health:kl,serviceStatus:J,t:C}),d.jsxs("section",{className:"section",children:[d.jsx("div",{className:"section-head",children:d.jsxs("div",{children:[d.jsx("h2",{className:"section-title",children:C("platformsTitle")}),d.jsx("p",{className:"section-desc",children:C("platformsHint")})]})}),d.jsx("div",{className:"platform-grid",children:Rn.map(D=>{const Z=D.key;return d.jsx(jy,{def:D,values:r.platforms[Z],t:C,html:_,disabledVisual:!r.platforms[Z].enabled,onChange:gl=>x(Z,gl),onTest:()=>void Zl(Z),testing:ct===Z,testResult:at[Z]},Z)})})]}),d.jsx(qy,{configJson:M,setConfigJson:P,claudeSettingsJson:I,setClaudeSettingsJson:U,codexSettingsJson:S,setCodexSettingsJson:L,jsonValidation:it,onSaveConfig:O,onSaveClaude:o,onSaveCodex:T,onFormat:Y,onReset:el,meta:H,setMessage:dl,t:C})]})]})]})}function Yy(){return d.jsx("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M11 2L3 12h7l-1 6 8-10H10l1-6z"})})}function wr(){return typeof window>"u"?zf:li()?"":zf}function Lr(){if(typeof localStorage>"u")return wr();const h=localStorage.getItem(Zr);return h&&!(li()&&Gr(h))?h:wr()}function Qy(){const[h,C]=G.useState(""),[_,r]=G.useState(!1),[j,H]=G.useState({text:"",ok:null}),X=G.useMemo(()=>qr(()=>h),[h]),I=G.useCallback(async S=>{const L=Qr(S);if(li()&&L&&Gr(L)){H({text:"HTTPS 页面不能直连 http://127.0.0.1。请使用内置页面或 HTTPS 隧道。",ok:!1}),C("");return}if(!L){H({text:"Enter server URL (e.g. http://127.0.0.1:39282)",ok:!1});return}C(L),H({text:"Connecting…",ok:null});try{await qr(()=>L)("/api/health"),localStorage.setItem(Zr,L),H({text:"Connected",ok:!0}),r(!0)}catch(M){H({text:M instanceof Error?M.message:String(M),ok:!1}),C("")}},[]);if(G.useEffect(()=>{const S=Lr();S.trim()&&I(S)},[I]),_)return d.jsx(Oy,{request:X,children:d.jsx("div",{id:"mainAppWrap",children:d.jsx(Ly,{})})});const U=()=>{var L;const S=((L=document.getElementById("srvUrl"))==null?void 0:L.value)??"";I(S)};return d.jsx("div",{className:"conn",children:d.jsxs("div",{className:"conn-card",children:[d.jsx("div",{className:"conn-logo",children:d.jsx(Yy,{})}),d.jsx("h1",{className:"conn-title",children:"open-im"}),d.jsx("p",{className:"conn-desc",children:"Connect to your open-im web API to manage configuration."}),d.jsxs("div",{className:"conn-row",children:[d.jsx("input",{id:"srvUrl",className:"conn-input",type:"text",placeholder:li()?"https://… or open http://127.0.0.1:39282":zf,autoComplete:"url",spellCheck:!1,defaultValue:Lr(),onKeyDown:S=>{S.key==="Enter"&&U()}}),d.jsx("button",{type:"button",className:"btn btn-p",onClick:U,children:"Connect"})]}),d.jsx("p",{className:`conn-status ${j.ok===!0?"ok":j.ok===!1?"err":""}`,"aria-live":"polite",children:j.text})]})})}const Yr=typeof localStorage<"u"?localStorage.getItem(kr):null;typeof document<"u"&&(Yr==="true"?document.documentElement.classList.add("dark"):Yr==="false"?document.documentElement.classList.remove("dark"):typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches&&document.documentElement.classList.add("dark"));Ey.createRoot(document.getElementById("root")).render(d.jsx(G.StrictMode,{children:d.jsx(Qy,{})}));
@@ -7,7 +7,7 @@
7
7
  <link rel="preconnect" href="https://fonts.googleapis.com" />
8
8
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9
9
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
10
- <script type="module" crossorigin src="./assets/index-sm3ONyUc.js"></script>
10
+ <script type="module" crossorigin src="./assets/index-e3jHqrwL.js"></script>
11
11
  <link rel="stylesheet" crossorigin href="./assets/index-3rbPJRxR.css">
12
12
  </head>
13
13
  <body>