@ycodium-ai/plugin-im 0.2.3710 → 0.2.3799
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/assets/ui.js +4 -4
- package/dist/index.js +203 -85
- package/locales/en.json +18 -7
- package/locales/zh-CN.json +18 -7
- package/package.json +5 -3
package/assets/ui.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var Hn=window.__ycodiumPluginHost.react;var{Activity:st,Children:dt,Component:ct,Fragment:Me,Profiler:mt,PureComponent:ut,StrictMode:gt,Suspense:yt,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:ft,__COMPILER_RUNTIME:pt,act:bt,cache:vt,cacheSignal:St,captureOwnerStack:wt,cloneElement:ht,createContext:te,createElement:Re,createRef:It,forwardRef:xt,isValidElement:Ct,lazy:kt,memo:Nt,startTransition:Rt,unstable_useCacheRefresh:Tt,use:ie,useActionState:_t,useCallback:Pt,useContext:Et,useDebugValue:At,useDeferredValue:Bt,useEffect:Ve,useEffectEvent:Ot,useId:Ke,useImperativeHandle:Lt,useInsertionEffect:Mt,useLayoutEffect:Vt,useMemo:B,useOptimistic:Kt,useReducer:Ft,useRef:L,useState:x,useSyncExternalStore:Dt,useTransition:Ut,version:$t}=Hn;var M=(e,n)=>{let t=e[n];return typeof t=="string"?t.trim():""};var N="/developers/v1",zt={uploadImage:`${N}/app/upload/image`,createFromTemplate:`${N}/manifest/upsert_by_template`,createBare:`${N}/app/create`,listApps:`${N}/app/list`,robotSwitch:e=>`${N}/robot/switch/${e}`,eventSwitch:e=>`${N}/event/switch/${e}`,eventRead:e=>`${N}/event/${e}`,eventUpdate:e=>`${N}/event/update/${e}`,callbackSwitch:e=>`${N}/callback/switch/${e}`,callbackRead:e=>`${N}/callback/${e}`,callbackUpdate:e=>`${N}/callback/update/${e}`,scopeCatalog:e=>`${N}/scope/all/${e}`,scopeUpdate:e=>`${N}/scope/update/${e}`,safeSetting:e=>`${N}/safe_setting/update/${e}`,visibleOnline:e=>`${N}/visible/online/${e}`,versionList:e=>`${N}/app_version/list/${e}`,versionCreate:e=>`${N}/app_version/create/${e}`,publishCommit:(e,n)=>`${N}/publish/commit/${e}/${n}`,secret:e=>`${N}/secret/${e}`};var Qt=10*6e4;var Fe=9e4;var De="settings.view",Ue="settings.connections",$e="settings.saveBot",He="settings.removeBot",Ge="settings.saveGeneral",ze="settings.saveTarget",Qe="settings.removeTarget",We="larkSetup.session",je="wecomSetup.session",Y={labelKey:"setup.action.label",descriptionKey:"setup.action.description",badgeKey:"setup.action.badge",warningKey:"setup.action.warning"},qe={checkConnection:"im.settings.checkConnection",reconnect:"im.settings.reconnect",resetInbox:"im.settings.resetInbox",copyDiagnostics:"im.settings.copyDiagnostics",larkRepair:"im.settings.larkRepair",larkCallbackProbe:"im.settings.larkCallbackProbe"},Ye=e=>e==="telegram"?["rowAction.resetInbox.telegramOffline"]:[],Je=[{id:"checkConnection",labelKey:"rowAction.checkConnection.label",descriptionKey:"rowAction.checkConnection.description"},{id:"reconnect",labelKey:"rowAction.reconnect.label"},{id:"resetInbox",labelKey:"rowAction.resetInbox.label",descriptionKey:"rowAction.resetInbox.description"},{id:"copyDiagnostics",labelKey:"rowAction.copyDiagnostics.label"},{id:"larkRepair",labelKey:"rowAction.larkRepair.label",platform:"lark"},{id:"larkCallbackProbe",labelKey:"rowAction.larkCallbackProbe.label",descriptionKey:"rowAction.larkCallbackProbe.description",descriptionParams:{seconds:Fe/1e3},platform:"lark"}],Gn="lark",oe=[{value:"zh-CN",labelKey:"settings.language.zhCN"},{value:"en",labelKey:"settings.language.en"}],zn="botId",U=e=>M(e,"platform")||Gn,Ze=(e,n)=>{let t=e.showWhen;if(t===void 0)return!0;let o=t.key==="platform"?U(n):M(n,t.key);return t.equals.includes(o)},Xe=(e,n,t)=>e.map(o=>o.key===zn?{...o,kind:"select",options:n.map(r=>({value:r.rowId,label:`${M(r.values,"displayName")||t(r.platform)} (${r.rowId})`}))}:o),en=(e,n)=>{switch(n.kind){case"qr":{let{expired:t,...o}=e,r=n.expiresAt===void 0?{payload:n.payload}:{payload:n.payload,expiresAt:n.expiresAt};return{...o,qr:r}}case"status":{let t=n.params===void 0?{statusKey:n.statusKey}:{statusKey:n.statusKey,params:n.params};if(n.expired!==!0)return{...e,status:t};let{qr:o,...r}=e;return{...r,status:t,expired:!0}}case"steps":return{...e,steps:n.steps};case"done":case"failed":{let{status:t,...o}=e;return{...o,result:n}}}},Te=e=>e==="inboxUnreadable"?"settingsSection.connection.reason.inbox-unreadable":e==="notAvailable"?"settingsSection.connection.reason.not-available":`rowAction.checkConnection.hint.${e}`,J=e=>e.reason==="not-available"||e.hint==="notAvailable",ae=e=>e?.state==="failed"&&(e.reason==="inbox-unreadable"||e.hint==="inboxUnreadable"),nn=e=>e.hint==="wecomBotCredentials"||e.hint==="unauthorized"||e.hint==="larkCredentials"||e.hint==="wecomLongConnOff"||e.hint==="wecomTakenOver",K=e=>e.state==="duplicate"||J(e)||e.hint==="connecting"||e.hint==="wecomCallbackNotSeen"?"warning":"error";var tn=e=>{if(!e||typeof e!="object"||Array.isArray(e)||!("code"in e)||typeof e.code!="string"||!e.code.trim()||!("reason"in e)||typeof e.reason!="string"||!e.reason.trim()||!("message"in e)||typeof e.message!="string"||!e.message.trim()||!("referenceId"in e)||typeof e.referenceId!="string"||!e.referenceId.trim()||!("at"in e)||typeof e.at!="number"||!Number.isFinite(e.at))return null;let n="messageKey"in e?e.messageKey:void 0;if(n!==void 0&&(typeof n!="string"||!n.trim()))return null;let t="messageParams"in e?e.messageParams:void 0,o;if(t!==void 0){if(!t||typeof t!="object"||Array.isArray(t)||!("detail"in t)||typeof t.detail!="string")return null;o={detail:t.detail.slice(0,500)}}return{code:e.code.slice(0,64),reason:e.reason.slice(0,64),message:e.message.slice(0,500),...n!==void 0?{messageKey:n.slice(0,128)}:{},...o===void 0?{}:{messageParams:o},referenceId:e.referenceId.slice(0,40),at:e.at}},on=e=>!e||typeof e!="object"||Array.isArray(e)?tn(e):tn(Object.fromEntries(Object.entries(e).map(([n,t])=>[n,typeof t=="string"?t.trim():t])));var an=(e,n)=>{let t=e.filter(o=>o.configured);return{configured:t.length,connected:t.filter(o=>n?.[o.rowId]?.state==="connected").length}},rn=e=>{if(e.error!==null||e.isUnavailable||typeof e.data!="object"||e.data===null||Array.isArray(e.data))return null;let n=e.data;return Object.values(n).some(t=>"lastMessageError"in t||"statusSince"in t)?Object.fromEntries(Object.entries(n).map(([t,o])=>{let{lastMessageError:r,statusSince:a,...l}=o,d=on(r);return[t,{...l,...typeof a=="number"&&Number.isSafeInteger(a)&&a>=0&&a<=864e13?{statusSince:a}:{},...d===null?{}:{lastMessageError:d}}]})):n},_e=e=>e===null||!e.configured?{key:"settingsSection.status.incomplete",tone:"attention"}:{key:"settingsSection.status.ready",tone:"success"},re=(e,n)=>{if(e===null||!e.configured)return _e(e);let t=n?.[e.rowId];switch(t?.state){case"connecting":return{key:"settingsSection.status.connecting",tone:"working"};case"connected":return{key:"settingsSection.status.connected",tone:"success"};case"failed":case"duplicate":return{key:"settingsSection.status.notConnected",tone:K(t)};default:return{key:"settingsSection.status.ready",tone:"neutral"}}},ln=(e,n,t,o)=>{if(e===null||!e.configured)return null;let r=n?.[e.rowId];return r?.state==="failed"?ae(r)?{text:o(Te("inboxUnreadable")),variant:K(r)}:{text:[o(r.reason===void 0?"settingsSection.connection.failed":`settingsSection.connection.reason.${r.reason}`),r.hint===void 0?null:o(Te(r.hint)),J(r)||nn(r)?null:o("settingsSection.connection.reconnect"),r.error===void 0?null:o("settingsSection.connection.details",{error:r.error})].filter(l=>l!==null).join(" "),variant:K(r)}:r?.state==="duplicate"?{text:o("settingsSection.connection.duplicate",{name:t??r.duplicateOf??""}),variant:K(r)}:null};var{jsx:i,jsxs:s,Fragment:C}=window.__ycodiumPluginHost.jsxRuntime;function le(e){let n=e.bridge.useFormatTimestamp();if(e.since===void 0)return null;let t=new Date(e.since).toISOString();return i("time",{className:"im-small im-muted",dateTime:t,children:e.t("settingsSection.connection.since",{time:n(t)})})}var sn=te(null);function dn(e){return i(sn,{value:e.bridge,children:e.children})}var Qn=new Set(["Collapsible","CollapsiblePanel","CollapsibleTrigger"]);function k(e){let n=t=>{let a=ie(sn)?.ui?.[e];return a===void 0?Qn.has(e)?Re("div",{className:t.className},t.children):null:Re(a,t)};return n.displayName=e,n}var p=k("Button"),$=k("Input"),H=k("Label"),cn=k("Switch"),se=k("Select"),de=k("SelectTrigger"),Z=k("SelectValue"),ce=k("SelectPopup"),X=k("SelectItem"),G=k("StatusPill"),mn=k("EmptyInline"),z=k("Alert"),un=k("AlertAction"),Q=k("AlertDescription"),gn=k("Collapsible"),yn=k("CollapsibleTrigger"),fn=k("CollapsiblePanel"),F=k("Spinner"),pn=k("QRCodeSvg"),bn=k("ProxyChoiceSelect");var vn=(e,n)=>{if(e.kind==="done")return{headline:e.messageKey===void 0?n("settingsSection.action.done"):n(e.messageKey),tone:e.tone??"done",link:e.link===void 0?void 0:{url:e.link.url,label:n(e.link.labelKey)},note:void 0,headlineTone:e.tone??"done",details:(e.warnings??[]).map(d=>n(d.key,d.params))};let t=e.params?.ref,o=t===void 0?e.detail:n("rowAction.diagnostic.ref",{ref:t,detail:e.detail??""}).trimEnd(),r=e.params?.hint?.toString(),a=e.noteKey===void 0?void 0:n(e.noteKey),l=K({hint:r})==="warning"?"caution":"issue";return{headline:n(e.reasonKey,e.params),link:void 0,note:a,tone:l,headlineTone:a===void 0?l:"neutral",details:[...o===void 0?[]:[o],...(e.warnings??[]).map(d=>n(d.key,d.params))]}};var Sn=(e,n,t,o)=>{let r=o?.state==="failed"&&J(o),a=ae(o);return{actions:Je.filter(l=>(l.platform===void 0||l.platform===e)&&(l.id!=="resetInbox"||a)).map(l=>({...l,descriptionKeys:[...l.descriptionKey===void 0?[]:[l.descriptionKey],...l.id==="resetInbox"?Ye(e):[]],disabled:n||t||l.id==="reconnect"&&r})),noteKey:n?"settingsSection.action.saveFirst":r?"rowAction.reconnect.notAvailable":null}},me=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),wn=e=>me(e)&&Array.isArray(e.bots)&&Array.isArray(e.targets)&&me(e.delivery),hn=e=>me(e)&&wn(e.view)&&Array.isArray(e.columns)&&Array.isArray(e.targetColumns)&&Array.isArray(e.proxies)?e:null,ee=async(e,n,t,o)=>{try{let r=await e.commands.invoke(n,t,o);return me(r)&&r.ok===!0&&wn(r.view)?r.view:null}catch{return null}},In=(e,n)=>n.isPending?e.phase==="asked"?{...e,phase:"refetching"}:e:n.view!==null&&!n.failed?e.phase==="refetching"||JSON.stringify(n.view)===JSON.stringify(e.view)?null:e:e.phase==="asked"?e:{...e,phase:"asked"},O=e=>e==null||e.length===0?{}:{environmentId:e},W=(e,n)=>n===null?e:`${e}:${n}`,Pe=e=>JSON.stringify([e.replyLanguage,e.delivery]);function j(e,n,t){if(n!==void 0&&n.length>0)return e(n);if(t!==void 0&&t.length>0)return t}function xn(e,n){return n.length===0?null:n.map(t=>e(t==="required"?"settingsSection.issue.required":"settingsSection.issue.format")).join(" ")}function D(e,n,t){return`im-${(e??"here").replace(/[^A-Za-z0-9_-]/g,"")}-${n}-${t}`}function ne(e,n,t){let o=[n?`${e}-issue`:null,t?`${e}-hint`:null].filter(r=>r!==null);return o.length===0?void 0:o.join(" ")}function V(e){return s("div",{className:e.span===!0?"im-field im-span":"im-field",children:[i(H,{htmlFor:e.id,children:e.label}),e.children,e.issue?i("p",{id:`${e.id}-issue`,className:"im-small im-issue",role:"alert",children:e.issue}):null,e.description===void 0?null:i("p",{id:`${e.id}-hint`,className:"im-hint im-small im-muted",children:e.description})]})}function ue(e){let n=e.stored&&e.value===""&&!e.clearing?e.savedPlaceholder:e.placeholder;return s("div",{className:"im-secret",children:[i($,{id:e.id,type:"password",value:e.value,placeholder:n,disabled:e.disabled,autoComplete:"new-password","aria-invalid":e.invalid?!0:void 0,"aria-describedby":e.describedBy,onChange:t=>e.onChange(t.target.value)}),e.stored?i(p,{variant:"ghost",size:"sm","aria-pressed":e.clearing,disabled:e.disabled,onClick:e.onToggleClear,children:e.clearing?e.undoLabel:e.clearLabel}):null]})}function ge(e){let n=e.saving||e.busy===!0;return!e.dirty&&!e.saving&&!e.failed?null:s("div",{className:"im-span",children:[e.dirty||e.saving?s("div",{className:"im-actions",children:[s(p,{variant:e.solid?"default":"outline",disabled:n||!e.dirty,onClick:e.onSave,children:[e.saving?i(F,{}):null,e.saveLabel]}),e.dirty&&!n?i(p,{variant:"ghost",size:"sm",onClick:e.onRevert,children:e.revertLabel}):null]}):null,e.failed?i("p",{className:"im-small im-issue",role:"alert",children:e.failedLabel}):null]})}async function ye(e,n,t){try{await e.writeClipboard(n),e.notify(t("settingsSection.copied"),"success")}catch{e.notify(t("settingsSection.copyFailed"),"warning")}}var Wn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function fe(e){let n=B(()=>O(e.environmentId),[e.environmentId]),t=e.bridge.commands.useSubscription(e.command,e.payload,n),o=B(()=>Wn(t.data)?e.items==="snapshots"?t.data:en({},t.data):{},[t.data,e.items]),r=o.result,a=L(null),l=e.onSettled;Ve(()=>{r===void 0||a.current===t.data||(a.current=t.data,l?.(r))},[r,t.data,l]);let d=e.t,c=r===void 0&&t.error===null&&!t.isUnavailable;return s("div",{className:"im-flow im-span",children:[t.isUnavailable||t.error!==null?i(z,{variant:"error",layout:"inline",children:i(Q,{children:d("settingsSection.action.failedToRun")})}):null,o.qr===void 0?null:i("div",{className:"im-qr",children:i(pn,{value:o.qr.payload,size:176,marginSize:2,title:d("settingsSection.action.qrTitle")})}),o.status===void 0?null:s("p",{className:"im-flow-status im-medium",children:[c?i(F,{size:"sm"}):null,i("span",{children:d(o.status.statusKey,o.status.params)})]}),c&&o.status===void 0&&o.qr===void 0?s("p",{className:"im-flow-status im-medium",children:[i(F,{size:"sm"}),i("span",{children:d("settingsSection.action.running")})]}):null,o.steps===void 0?null:i("ul",{className:"im-steps im-small",children:o.steps.map(b=>s("li",{"data-state":b.state,children:[i("span",{children:d(b.labelKey)}),i("span",{className:"im-muted",children:d(`settingsSection.step.${b.state}`)})]},b.id))}),r===void 0?null:i(jn,{result:r,bridge:e.bridge,t:d}),s("div",{className:"im-actions",children:[r?.kind==="failed"||o.expired===!0||t.error!==null?i(p,{variant:"ghost",size:"sm",onClick:t.refresh,children:d("settingsSection.retry")}):null,i(p,{variant:"ghost",size:"sm",onClick:e.onClose,children:d(r===void 0?"settingsSection.cancel":"settingsSection.action.close")})]})]})}var Cn=e=>e==="issue"?"im-issue":e==="caution"?"im-caution":"";function jn(e){let{headline:n,headlineTone:t,tone:o,note:r,link:a,details:l}=vn(e.result,e.t),d=e.t;return s("div",{className:"im-result",children:[s("div",{className:"im-result-verdict",role:"status",children:[i("p",{className:`im-medium im-result-headline ${Cn(t)}`.trimEnd(),children:n}),r===void 0?null:i("p",{className:`im-small im-result-note ${Cn(o)}`.trimEnd(),children:r})]}),a===void 0?null:i("div",{className:"im-actions",children:i(p,{className:"im-link",variant:"link",size:"sm",onClick:()=>e.bridge.openExternal(a.url),children:a.label})}),l.length===0?null:s(C,{children:[i("pre",{className:"im-detail im-small",children:l.join(`
|
|
1
|
+
var Hn=window.__ycodiumPluginHost.react;var{Activity:st,Children:dt,Component:ct,Fragment:Me,Profiler:mt,PureComponent:ut,StrictMode:gt,Suspense:yt,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:ft,__COMPILER_RUNTIME:pt,act:bt,cache:vt,cacheSignal:St,captureOwnerStack:ht,cloneElement:wt,createContext:te,createElement:Re,createRef:It,forwardRef:xt,isValidElement:Ct,lazy:kt,memo:Nt,startTransition:Rt,unstable_useCacheRefresh:Tt,use:ie,useActionState:_t,useCallback:Pt,useContext:Et,useDebugValue:At,useDeferredValue:Bt,useEffect:Ve,useEffectEvent:Ot,useId:Ke,useImperativeHandle:Lt,useInsertionEffect:Mt,useLayoutEffect:Vt,useMemo:B,useOptimistic:Kt,useReducer:Ft,useRef:L,useState:x,useSyncExternalStore:Dt,useTransition:Ut,version:$t}=Hn;var M=(e,n)=>{let t=e[n];return typeof t=="string"?t.trim():""};var N="/developers/v1",zt={uploadImage:`${N}/app/upload/image`,createFromTemplate:`${N}/manifest/upsert_by_template`,createBare:`${N}/app/create`,listApps:`${N}/app/list`,robotSwitch:e=>`${N}/robot/switch/${e}`,eventSwitch:e=>`${N}/event/switch/${e}`,eventRead:e=>`${N}/event/${e}`,eventUpdate:e=>`${N}/event/update/${e}`,callbackSwitch:e=>`${N}/callback/switch/${e}`,callbackRead:e=>`${N}/callback/${e}`,callbackUpdate:e=>`${N}/callback/update/${e}`,scopeCatalog:e=>`${N}/scope/all/${e}`,scopeUpdate:e=>`${N}/scope/update/${e}`,safeSetting:e=>`${N}/safe_setting/update/${e}`,visibleOnline:e=>`${N}/visible/online/${e}`,versionList:e=>`${N}/app_version/list/${e}`,versionCreate:e=>`${N}/app_version/create/${e}`,publishCommit:(e,n)=>`${N}/publish/commit/${e}/${n}`,secret:e=>`${N}/secret/${e}`};var Qt=10*6e4;var Fe=9e4;var De="settings.view",Ue="settings.connections",$e="settings.saveBot",He="settings.removeBot",Ge="settings.saveGeneral",ze="settings.saveTarget",Qe="settings.removeTarget",We="larkSetup.session",je="wecomSetup.session",Y={labelKey:"setup.action.label",descriptionKey:"setup.action.description",badgeKey:"setup.action.badge",warningKey:"setup.action.warning"},qe={checkConnection:"im.settings.checkConnection",reconnect:"im.settings.reconnect",resetInbox:"im.settings.resetInbox",copyDiagnostics:"im.settings.copyDiagnostics",larkRepair:"im.settings.larkRepair",larkCallbackProbe:"im.settings.larkCallbackProbe"},Ye=e=>e==="telegram"?["rowAction.resetInbox.telegramOffline"]:[],Je=[{id:"checkConnection",labelKey:"rowAction.checkConnection.label",descriptionKey:"rowAction.checkConnection.description"},{id:"reconnect",labelKey:"rowAction.reconnect.label"},{id:"resetInbox",labelKey:"rowAction.resetInbox.label",descriptionKey:"rowAction.resetInbox.description"},{id:"copyDiagnostics",labelKey:"rowAction.copyDiagnostics.label"},{id:"larkRepair",labelKey:"rowAction.larkRepair.label",platform:"lark"},{id:"larkCallbackProbe",labelKey:"rowAction.larkCallbackProbe.label",descriptionKey:"rowAction.larkCallbackProbe.description",descriptionParams:{seconds:Fe/1e3},platform:"lark"}],Gn="lark",oe=[{value:"zh-CN",labelKey:"settings.language.zhCN"},{value:"en",labelKey:"settings.language.en"}],zn="botId",U=e=>M(e,"platform")||Gn,Ze=(e,n)=>{let t=e.showWhen;if(t===void 0)return!0;let o=t.key==="platform"?U(n):M(n,t.key);return t.equals.includes(o)},Xe=(e,n,t)=>e.map(o=>o.key===zn?{...o,kind:"select",options:n.map(r=>({value:r.rowId,label:`${M(r.values,"displayName")||t(r.platform)} (${r.rowId})`}))}:o),en=(e,n)=>{switch(n.kind){case"qr":{let{expired:t,...o}=e,r=n.expiresAt===void 0?{payload:n.payload}:{payload:n.payload,expiresAt:n.expiresAt};return{...o,qr:r}}case"status":{let t=n.params===void 0?{statusKey:n.statusKey}:{statusKey:n.statusKey,params:n.params};if(n.expired!==!0)return{...e,status:t};let{qr:o,...r}=e;return{...r,status:t,expired:!0}}case"steps":return{...e,steps:n.steps};case"done":case"failed":{let{status:t,...o}=e;return{...o,result:n}}}},Te=e=>e==="inboxUnreadable"?"settingsSection.connection.reason.inbox-unreadable":e==="notAvailable"?"settingsSection.connection.reason.not-available":`rowAction.checkConnection.hint.${e}`,J=e=>e.reason==="not-available"||e.hint==="notAvailable",ae=e=>e?.state==="failed"&&(e.reason==="inbox-unreadable"||e.hint==="inboxUnreadable"),nn=e=>e.hint==="wecomBotCredentials"||e.hint==="unauthorized"||e.hint==="larkCredentials"||e.hint==="wecomLongConnOff"||e.hint==="wecomTakenOver",K=e=>e.state==="duplicate"||J(e)||e.hint==="connecting"||e.hint==="wecomCallbackNotSeen"?"warning":"error";var tn=e=>{if(!e||typeof e!="object"||Array.isArray(e)||!("code"in e)||typeof e.code!="string"||!e.code.trim()||!("reason"in e)||typeof e.reason!="string"||!e.reason.trim()||!("message"in e)||typeof e.message!="string"||!e.message.trim()||!("referenceId"in e)||typeof e.referenceId!="string"||!e.referenceId.trim()||!("at"in e)||typeof e.at!="number"||!Number.isFinite(e.at))return null;let n="messageKey"in e?e.messageKey:void 0;if(n!==void 0&&(typeof n!="string"||!n.trim()))return null;let t="messageParams"in e?e.messageParams:void 0,o;if(t!==void 0){if(!t||typeof t!="object"||Array.isArray(t)||!("detail"in t)||typeof t.detail!="string")return null;o={detail:t.detail.slice(0,500)}}return{code:e.code.slice(0,64),reason:e.reason.slice(0,64),message:e.message.slice(0,500),...n!==void 0?{messageKey:n.slice(0,128)}:{},...o===void 0?{}:{messageParams:o},referenceId:e.referenceId.slice(0,40),at:e.at}},on=e=>!e||typeof e!="object"||Array.isArray(e)?tn(e):tn(Object.fromEntries(Object.entries(e).map(([n,t])=>[n,typeof t=="string"?t.trim():t])));var an=(e,n)=>{let t=e.filter(o=>o.configured);return{configured:t.length,connected:t.filter(o=>n?.[o.rowId]?.state==="connected").length}},rn=e=>{if(e.error!==null||e.isUnavailable||typeof e.data!="object"||e.data===null||Array.isArray(e.data))return null;let n=e.data;return Object.values(n).some(t=>"lastMessageError"in t||"statusSince"in t)?Object.fromEntries(Object.entries(n).map(([t,o])=>{let{lastMessageError:r,statusSince:a,...l}=o,d=on(r);return[t,{...l,...typeof a=="number"&&Number.isSafeInteger(a)&&a>=0&&a<=864e13?{statusSince:a}:{},...d===null?{}:{lastMessageError:d}}]})):n},_e=e=>e===null||!e.configured?{key:"settingsSection.status.incomplete",tone:"attention"}:{key:"settingsSection.status.ready",tone:"success"},re=(e,n)=>{if(e===null||!e.configured)return _e(e);let t=n?.[e.rowId];switch(t?.state){case"connecting":return{key:"settingsSection.status.connecting",tone:"working"};case"connected":return{key:"settingsSection.status.connected",tone:"success"};case"failed":case"duplicate":return{key:"settingsSection.status.notConnected",tone:K(t)};default:return{key:"settingsSection.status.ready",tone:"neutral"}}},ln=(e,n,t,o)=>{if(e===null||!e.configured)return null;let r=n?.[e.rowId];return r?.state==="failed"?ae(r)?{text:o(Te("inboxUnreadable")),variant:K(r)}:{text:[o(r.reason===void 0?"settingsSection.connection.failed":`settingsSection.connection.reason.${r.reason}`),r.hint===void 0?null:o(Te(r.hint)),J(r)||nn(r)?null:o("settingsSection.connection.reconnect"),r.error===void 0?null:o("settingsSection.connection.details",{error:r.error})].filter(l=>l!==null).join(" "),variant:K(r)}:r?.state==="duplicate"?{text:o("settingsSection.connection.duplicate",{name:t??r.duplicateOf??""}),variant:K(r)}:null};var{jsx:i,jsxs:s,Fragment:C}=window.__ycodiumPluginHost.jsxRuntime;function le(e){let n=e.bridge.useFormatTimestamp();if(e.since===void 0)return null;let t=new Date(e.since).toISOString();return i("time",{className:"im-small im-muted",dateTime:t,children:e.t("settingsSection.connection.since",{time:n(t)})})}var sn=te(null);function dn(e){return i(sn,{value:e.bridge,children:e.children})}var Qn=new Set(["Collapsible","CollapsiblePanel","CollapsibleTrigger"]);function k(e){let n=t=>{let a=ie(sn)?.ui?.[e];return a===void 0?Qn.has(e)?Re("div",{className:t.className},t.children):null:Re(a,t)};return n.displayName=e,n}var b=k("Button"),$=k("Input"),H=k("Label"),cn=k("Switch"),se=k("Select"),de=k("SelectTrigger"),Z=k("SelectValue"),ce=k("SelectPopup"),X=k("SelectItem"),G=k("StatusPill"),mn=k("EmptyInline"),z=k("Alert"),un=k("AlertAction"),Q=k("AlertDescription"),gn=k("Collapsible"),yn=k("CollapsibleTrigger"),fn=k("CollapsiblePanel"),F=k("Spinner"),pn=k("QRCodeSvg"),bn=k("ProxyChoiceSelect");var vn=(e,n)=>{if(e.kind==="done")return{headline:e.messageKey===void 0?n("settingsSection.action.done"):n(e.messageKey),tone:e.tone??"done",link:e.link===void 0?void 0:{url:e.link.url,label:n(e.link.labelKey)},note:void 0,headlineTone:e.tone??"done",details:(e.warnings??[]).map(d=>n(d.key,d.params))};let t=e.params?.ref,o=t===void 0?e.detail:n("rowAction.diagnostic.ref",{ref:t,detail:e.detail??""}).trimEnd(),r=e.params?.hint?.toString(),a=e.noteKey===void 0?void 0:n(e.noteKey),l=K({hint:r})==="warning"?"caution":"issue";return{headline:n(e.reasonKey,e.params),link:void 0,note:a,tone:l,headlineTone:a===void 0?l:"neutral",details:[...o===void 0?[]:[o],...(e.warnings??[]).map(d=>n(d.key,d.params))]}};var Sn=(e,n,t,o)=>{let r=o?.state==="failed"&&J(o),a=ae(o);return{actions:Je.filter(l=>(l.platform===void 0||l.platform===e)&&(l.id!=="resetInbox"||a)).map(l=>({...l,descriptionKeys:[...l.descriptionKey===void 0?[]:[l.descriptionKey],...l.id==="resetInbox"?Ye(e):[]],disabled:n||t||l.id==="reconnect"&&r})),noteKey:n?"settingsSection.action.saveFirst":r?"rowAction.reconnect.notAvailable":null}},me=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),hn=e=>me(e)&&Array.isArray(e.bots)&&Array.isArray(e.targets)&&me(e.delivery),wn=e=>me(e)&&hn(e.view)&&Array.isArray(e.columns)&&Array.isArray(e.targetColumns)&&Array.isArray(e.proxies)?e:null,ee=async(e,n,t,o)=>{try{let r=await e.commands.invoke(n,t,o);return me(r)&&r.ok===!0&&hn(r.view)?r.view:null}catch{return null}},In=(e,n)=>n.isPending?e.phase==="asked"?{...e,phase:"refetching"}:e:n.view!==null&&!n.failed?e.phase==="refetching"||JSON.stringify(n.view)===JSON.stringify(e.view)?null:e:e.phase==="asked"?e:{...e,phase:"asked"},O=e=>e==null||e.length===0?{}:{environmentId:e},W=(e,n)=>n===null?e:`${e}:${n}`,Pe=e=>JSON.stringify([e.replyLanguage,e.delivery]);function j(e,n,t){if(n!==void 0&&n.length>0)return e(n);if(t!==void 0&&t.length>0)return t}function xn(e,n){return n.length===0?null:n.map(t=>e(t==="required"?"settingsSection.issue.required":"settingsSection.issue.format")).join(" ")}function D(e,n,t){return`im-${(e??"here").replace(/[^A-Za-z0-9_-]/g,"")}-${n}-${t}`}function ne(e,n,t){let o=[n?`${e}-issue`:null,t?`${e}-hint`:null].filter(r=>r!==null);return o.length===0?void 0:o.join(" ")}function V(e){return s("div",{className:e.span===!0?"im-field im-span":"im-field",children:[i(H,{htmlFor:e.id,children:e.label}),e.children,e.issue?i("p",{id:`${e.id}-issue`,className:"im-small im-issue",role:"alert",children:e.issue}):null,e.description===void 0?null:i("p",{id:`${e.id}-hint`,className:"im-hint im-small im-muted",children:e.description})]})}function ue(e){let n=e.stored&&e.value===""&&!e.clearing?e.savedPlaceholder:e.placeholder;return s("div",{className:"im-secret",children:[i($,{id:e.id,type:"password",value:e.value,placeholder:n,disabled:e.disabled,autoComplete:"new-password","aria-invalid":e.invalid?!0:void 0,"aria-describedby":e.describedBy,onChange:t=>e.onChange(t.target.value)}),e.stored?i(b,{variant:"ghost",size:"sm","aria-pressed":e.clearing,disabled:e.disabled,onClick:e.onToggleClear,children:e.clearing?e.undoLabel:e.clearLabel}):null]})}function ge(e){let n=e.saving||e.busy===!0;return!e.dirty&&!e.saving&&!e.failed?null:s("div",{className:"im-span",children:[e.dirty||e.saving?s("div",{className:"im-actions",children:[s(b,{variant:e.solid?"default":"outline",disabled:n||!e.dirty,onClick:e.onSave,children:[e.saving?i(F,{}):null,e.saveLabel]}),e.dirty&&!n?i(b,{variant:"ghost",size:"sm",onClick:e.onRevert,children:e.revertLabel}):null]}):null,e.failed?i("p",{className:"im-small im-issue",role:"alert",children:e.failedLabel}):null]})}async function ye(e,n,t){try{await e.writeClipboard(n),e.notify(t("settingsSection.copied"),"success")}catch{e.notify(t("settingsSection.copyFailed"),"warning")}}var Wn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function fe(e){let n=B(()=>O(e.environmentId),[e.environmentId]),t=e.bridge.commands.useSubscription(e.command,e.payload,n),o=B(()=>Wn(t.data)?e.items==="snapshots"?t.data:en({},t.data):{},[t.data,e.items]),r=o.result,a=L(null),l=e.onSettled;Ve(()=>{r===void 0||a.current===t.data||(a.current=t.data,l?.(r))},[r,t.data,l]);let d=e.t,c=r===void 0&&t.error===null&&!t.isUnavailable;return s("div",{className:"im-flow im-span",children:[t.isUnavailable||t.error!==null?i(z,{variant:"error",layout:"inline",children:i(Q,{children:d("settingsSection.action.failedToRun")})}):null,o.qr===void 0?null:i("div",{className:"im-qr",children:i(pn,{value:o.qr.payload,size:176,marginSize:2,title:d("settingsSection.action.qrTitle")})}),o.status===void 0?null:s("p",{className:"im-flow-status im-medium",children:[c?i(F,{size:"sm"}):null,i("span",{children:d(o.status.statusKey,o.status.params)})]}),c&&o.status===void 0&&o.qr===void 0?s("p",{className:"im-flow-status im-medium",children:[i(F,{size:"sm"}),i("span",{children:d("settingsSection.action.running")})]}):null,o.steps===void 0?null:i("ul",{className:"im-steps im-small",children:o.steps.map(g=>s("li",{"data-state":g.state,children:[i("span",{children:d(g.labelKey)}),i("span",{className:"im-muted",children:d(`settingsSection.step.${g.state}`)})]},g.id))}),r===void 0?null:i(jn,{result:r,bridge:e.bridge,t:d}),s("div",{className:"im-actions",children:[r?.kind==="failed"||o.expired===!0||t.error!==null?i(b,{variant:"ghost",size:"sm",onClick:t.refresh,children:d("settingsSection.retry")}):null,i(b,{variant:"ghost",size:"sm",onClick:e.onClose,children:d(r===void 0?"settingsSection.cancel":"settingsSection.action.close")})]})]})}var Cn=e=>e==="issue"?"im-issue":e==="caution"?"im-caution":"";function jn(e){let{headline:n,headlineTone:t,tone:o,note:r,link:a,details:l}=vn(e.result,e.t),d=e.t;return s("div",{className:"im-result",children:[s("div",{className:"im-result-verdict",role:"status",children:[i("p",{className:`im-medium im-result-headline ${Cn(t)}`.trimEnd(),children:n}),r===void 0?null:i("p",{className:`im-small im-result-note ${Cn(o)}`.trimEnd(),children:r})]}),a===void 0?null:i("div",{className:"im-actions",children:i(b,{className:"im-link",variant:"link",size:"sm",onClick:()=>e.bridge.openExternal(a.url),children:a.label})}),l.length===0?null:s(C,{children:[i("pre",{className:"im-detail im-small",children:l.join(`
|
|
2
2
|
|
|
3
|
-
`)}),i("div",{className:"im-actions",children:i(
|
|
3
|
+
`)}),i("div",{className:"im-actions",children:i(b,{variant:"ghost",size:"sm",onClick:()=>{ye(e.bridge,l.join(`
|
|
4
4
|
|
|
5
|
-
`),d)},children:d("settingsSection.copy")})})]})]})}function q(e){let n=(()=>{switch(e.platform){case"lark":return s(C,{children:[i("path",{fill:"#00D6B9",d:"M7.2 4.5h7.6c1.2 0 2.1.55 2.7 1.58 1.05 1.8 1.55 3.45 1.58 4.95-2.04-.62-4.2-.15-6.22 1.45C11.3 9.7 9.42 7.04 7.2 4.5Z"}),i("path",{fill:"#1456B8",d:"M10.8 13.55c3.3-2.93 5.72-4.24 9.47-2.52-1.2 1.45-2.27 4.18-3.86 5.43-1.67 1.31-3.9.5-5.61-.64v-2.27Z"}),i("path",{fill:"#3370FF",d:"M4.4 8.35c3.47 3.61 7.25 6.1 10.33 5.7 1.06-.14 2.2-.72 3.4-1.72-1.04 2.65-2.6 4.8-5.06 6-2.46 1.2-5.56.52-7.42-.72A2.76 2.76 0 0 1 4.4 15.3V8.35Z"})]});case"wecom":case"wecom-app":return s(C,{children:[i("path",{fill:"none",stroke:"#3370FF",strokeWidth:"2.35",strokeLinecap:"round",strokeLinejoin:"round",d:"M17.7 14.5c1.05-1.12 1.65-2.52 1.65-4.03 0-3.82-3.58-6.92-8-6.92s-8 3.1-8 6.92 3.58 6.92 8 6.92c1.17 0 2.28-.22 3.28-.62"}),i("path",{fill:"#07C160",d:"M16.1 15.15c.7-.7 1.83-.7 2.53 0s.7 1.83 0 2.53-1.83.7-2.53 0-.7-1.83 0-2.53Z"}),i("path",{fill:"#FFB800",d:"M19.25 13.45a1.36 1.36 0 1 1 1.92 1.92 1.36 1.36 0 0 1-1.92-1.92Z"}),i("path",{fill:"#FF7A00",d:"M19.55 18.05a1.16 1.16 0 1 1 1.64 1.64 1.16 1.16 0 0 1-1.64-1.64Z"}),i("path",{fill:"#3370FF",d:"M15.25 18.75a.92.92 0 1 1 1.3 1.3.92.92 0 0 1-1.3-1.3Z"})]});case"telegram":return i("path",{fill:"#229ED9",d:"M23.95 4.57c-.36-1.45-1.43-1.76-2.82-1.24L1.5 10.9c-1.34.52-1.32 1.27-.24 1.6l5.03 1.57 11.66-7.36c.55-.34 1.05-.16.64.21l-9.44 8.52-.37 5.12c.54 0 .78-.24 1.08-.53l2.59-2.51 5.38 3.97c.99.55 1.7.27 1.95-.92L23.95 4.57Z"});case"wechat":return i("path",{fill:"#07C160",d:"M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 0 0 .167-.054l1.903-1.114a.864.864 0 0 1 .717-.098 10.16 10.16 0 0 0 2.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178A1.17 1.17 0 0 1 4.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178 1.17 1.17 0 0 1-1.162-1.178c0-.651.52-1.18 1.162-1.18zm5.34 2.867c-1.797-.052-3.746.512-5.28 1.786-1.72 1.428-2.687 3.72-1.78 6.22.942 2.453 3.666 4.229 6.884 4.229.826 0 1.622-.12 2.361-.336a.722.722 0 0 1 .598.082l1.584.926a.272.272 0 0 0 .14.047c.134 0 .24-.111.24-.247 0-.06-.023-.12-.038-.177l-.327-1.233a.582.582 0 0 1-.023-.156.49.49 0 0 1 .201-.398C23.024 18.48 24 16.82 24 14.98c0-3.21-2.931-5.837-6.656-6.088V8.89c-.135-.01-.27-.027-.407-.03zm-2.53 3.274c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.97-.982zm4.844 0c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.969-.982z"});default:return null}})();return n===null?null:i("span",{className:`im-platform im-platform-${e.platform}`,"aria-hidden":"true",children:i("svg",{width:20,height:20,viewBox:"0 0 24 24",focusable:"false",children:n})})}function qn(e){return e.length>12?`${e.slice(0,8)}\u2022\u2022\u2022\u2022${e.slice(-4)}`:"cli_\u2022\u2022\u2022\u2022"}function kn(e){return e.length<=10?`${e.slice(0,3)}\u2022\u2022\u2022`:`${e.slice(0,6)}\u2022\u2022\u2022\u2022${e.slice(-4)}`}var Yn={lark:{column:"larkAppId",mask:qn},wecom:{column:"wecomBotId",mask:kn},"wecom-app":{column:"wecomAppCorpId",mask:kn}};function pe(e,n){let t=Yn[e];if(t===void 0)return null;let o=M(n,t.column);return o===""?null:t.mask(o)}function Ee(e){let n=e.className===void 0?"im-collapse":`im-collapse ${e.className}`;return e.staticHead===!0&&e.hideTitle===!0?s("div",{className:n,children:[e.notice,i("div",{className:"im-panel",children:e.children})]}):e.staticHead===!0?s("div",{className:n,children:[s("div",{className:"im-head",children:[s("div",{className:"im-toggle im-static",children:[e.icon,i("span",{className:"im-title im-medium",children:e.title}),e.meta]}),e.actions]}),e.notice,i("div",{className:"im-panel",children:e.children})]}):s(gn,{className:n,...e.defaultOpen===void 0?{}:{defaultOpen:e.defaultOpen},...e.open===void 0?{}:{open:e.open},...e.onOpenChange===void 0?{}:{onOpenChange:e.onOpenChange},children:[s("div",{className:"im-head",children:[s(yn,{className:"im-toggle",children:[i("span",{className:"im-chevron","aria-hidden":"true"}),e.icon,i("span",{className:"im-title im-medium",children:e.title}),e.meta]}),e.actions]}),e.notice,i(fn,{children:i("div",{className:"im-panel",children:e.children})})]})}function be(e){return i("section",{className:e.className===void 0?"im-block":`im-block ${e.className}`,...e.hideTitle===!0?{"aria-label":e.title}:{},children:i(Ee,{...e})})}var Jn=new Set(["accessMode","allowedSenders","runtimeMode"]),Zn=new Set(["groupMention","queueMode","approvalTimeoutMinutes","larkPanelMode","larkTopicOnMention","wecomNumberedHints"]);function Nn(e){return Jn.has(e.key)?"access":Zn.has(e.key)?"chat":e.group==="essential"||e.key==="defaultModel"||e.key==="defaultPreset"?"basic":"advanced"}var ve=(e,n)=>e!=="wechat"||n;var Ae="\0empty";function Rn(e){let n=e.columns.filter(f=>Ze(f,e.values)&&(e.section===void 0||Nn(f)===e.section)),t=e.section!==void 0?n:e.groupBotSettings?n.filter(f=>f.group==="essential"):n,o=e.section!==void 0?[]:e.groupBotSettings?n.filter(f=>f.group!=="essential"):[],r=e.issues.filter(f=>o.some(w=>w.key===f.column)),a=JSON.stringify(r),[l,d]=x(()=>({open:r.length>0,issues:a})),c=l.open||l.issues!==a&&r.length>0;l.issues!==a&&d({open:c,issues:a});let b=f=>i(Xn,{column:f,scope:e.scope,environmentId:e.environmentId,proxies:e.proxies,values:e.values,savedValues:e.savedValues,secrets:e.secrets,clearSecrets:e.clearSecrets,storedSecrets:e.storedSecrets,issues:e.issues,disabled:e.disabled,t:e.t,onValue:e.onValue,onSecret:e.onSecret,onToggleClear:e.onToggleClear},f.key);return s(C,{children:[t.map(b),(e.section===void 0||e.section==="basic"?e.publicFields:[]).map(f=>i(nt,{field:f,scope:e.scope,environmentId:e.environmentId,bridge:e.bridge,t:e.t},f.key)),o.length===0?null:i(Ee,{className:"im-span",title:r.length>0?e.t("settingsSection.moreSettingsIssues",{count:r.length}):e.t("settingsSection.moreSettings"),open:c,onOpenChange:f=>d({open:f,issues:a}),children:i("div",{className:"im-form",children:o.map(b)})})]})}function Xn(e){let n=e.column,t=D(e.environmentId,e.scope,n.key),o=j(e.t,n.labelKey,n.label)??n.key,r=j(e.t,n.descriptionKey,n.description),a=j(e.t,n.placeholderKey,n.placeholder),l=xn(e.t,e.issues.filter(c=>c.column===n.key).map(c=>c.code)),d=ne(t,l!==null,r!==void 0);return n.kind==="password"?i(V,{id:t,label:o,description:r,issue:l,children:i(ue,{id:t,value:e.secrets[n.key]??"",stored:e.storedSecrets[n.key]===!0,clearing:e.clearSecrets.includes(n.key),disabled:e.disabled,invalid:l!==null,describedBy:d,placeholder:a,savedPlaceholder:e.t("settingsSection.secret.saved"),clearLabel:e.t("settingsSection.secret.clear"),undoLabel:e.t("settingsSection.secret.clearUndo"),onChange:c=>{c!==(e.secrets[n.key]??"")&&e.onSecret(n.key,c)},onToggleClear:()=>e.onToggleClear(n.key)})}):n.kind==="select"?i(et,{column:n,id:t,label:o,description:r,issue:l,described:d,values:e.values,savedValues:e.savedValues,disabled:e.disabled,t:e.t,onValue:e.onValue}):n.kind==="proxy"?i("div",{className:"im-field",children:i(bn,{id:t,label:o,hint:e.values.platform==="lark"?e.t("column.proxy.larkHint"):r,value:e.values[n.key]??"",proxies:e.proxies,disabled:e.disabled,onChange:c=>{c!==(e.values[n.key]??"")&&e.onValue(n.key,c)},children:l===null?null:i("p",{id:`${t}-issue`,className:"im-small im-issue",role:"alert",children:l})})}):i(V,{id:t,label:o,description:r,issue:l,children:i($,{id:t,type:n.kind==="number"?"number":"text",min:n.min,max:n.max,step:n.kind==="number"?1:void 0,value:e.values[n.key]??n.defaultValue??"",placeholder:a,disabled:e.disabled,"aria-invalid":l!==null?!0:void 0,"aria-describedby":d,onChange:c=>{let b=c.target.value;b!==(e.values[n.key]??"")&&e.onValue(n.key,b)}})})}function et(e){let n=e.values[e.column.key]??"",t=e.savedValues[e.column.key]??"",o=(e.column.options??[]).filter(c=>e.column.key!=="platform"||ve(c.value,e.savedValues.platform===c.value)),r=o.some(c=>c.value===""),a=o.find(c=>c.value===n),l=c=>e.column.unavailableLabelKey===void 0?c:e.t(e.column.unavailableLabelKey,{value:c}),d=n===""&&a===void 0?void 0:a===void 0?l(n):j(e.t,a.labelKey,a.label)??a.value;return i(V,{id:e.id,label:e.label,description:e.description,issue:e.issue,children:s(se,{className:"im-wide",value:n===""?r?Ae:null:n,disabled:e.disabled,onValueChange:c=>{let b=r&&c===Ae?"":c??"";b!==n&&e.onValue(e.column.key,b)},children:[i(de,{id:e.id,"aria-invalid":e.issue!==null?!0:void 0,"aria-describedby":e.described,children:d===void 0?i(Z,{placeholder:e.t("settingsSection.select.default")}):i(Z,{children:d})}),s(ce,{children:[e.column.listsUnknownValue===!0&&t!==""&&!o.some(c=>c.value===t)?i(X,{value:t,disabled:e.column.unavailableLabelKey!==void 0,children:l(t)}):null,o.map(c=>i(X,{value:c.value===""?Ae:c.value,children:j(e.t,c.labelKey,c.label)??c.value},c.value))]})]})})}function nt(e){let n=D(e.environmentId,`${e.scope}-pub`,e.field.key);return s("div",{className:"im-field im-span",children:[i(H,{children:e.t(`settingsSection.publicField.${e.field.key}`)}),e.field.value===""?null:s("div",{className:"im-inline im-public-row",children:[i("span",{id:n,className:"im-public-value im-small",children:tt(e.field.value)}),e.field.copyable?i(p,{variant:"ghost",size:"sm",onClick:()=>{ye(e.bridge,e.field.value,e.t)},children:e.t("settingsSection.copy")}):null]}),e.field.hint===void 0?null:i("p",{className:"im-small im-muted",children:e.t(`settingsSection.publicFieldHint.${e.field.hint}`)})]})}function tt(e){let n=0;return e.split(/(?<=\/)(?!\/)/).map(t=>{let o=n;return n+=t.length,s(Me,{children:[o===0?null:i("wbr",{}),t]},o)})}var Tn=["basic","access","chat","advanced","danger"];function _n(e){let n=Ke(),t=e.showDanger?Tn:Tn.slice(0,-1),o=a=>{e.onChange(a),document.getElementById(`${n}-${a}`)?.focus()},r=(a,l)=>{let d=a.key==="Home"?0:a.key==="End"?t.length-1:a.key==="ArrowLeft"?(l-1+t.length)%t.length:a.key==="ArrowRight"?(l+1)%t.length:null;d!==null&&(a.preventDefault(),o(t[d]))};return i("div",{className:"im-detail-tabs",role:"tablist","aria-label":e.t("settingsSection.detailTabs"),children:t.map((a,l)=>i(p,{id:`${n}-${a}`,type:"button",variant:"ghost",size:"sm",role:"tab","aria-selected":e.value===a,tabIndex:e.value===a?0:-1,className:"im-detail-tab",onClick:()=>e.onChange(a),onKeyDown:d=>r(d,l),children:e.t(`settingsSection.tab.${a}`)},a))})}function Pn(e){let n={};for(let[a,l]of Object.entries(e.values))(e.baseline[a]??"")!==l&&(n[a]=l);let t={};for(let[a,l]of Object.entries(e.secrets))l!==""&&(t[a]=l);let o=[];for(let a of e.clearSecrets)Object.hasOwn(t,a)||o.includes(a)||o.push(a);return e.rowId===void 0||Object.keys(n).length>0||Object.keys(t).length>0||o.length>0?{changed:!0,edit:{...e.rowId===void 0?{}:{rowId:e.rowId},values:n,...Object.keys(t).length>0?{secrets:t}:{},...o.length>0?{clearSecrets:o}:{}}}:{changed:!1}}function it(e){let n=e.trim();if(!/^\d+$/.test(n))return null;let t=Number(n);return!Number.isInteger(t)||t<1||t>65535?null:t}function En(e){let n={};e.replyLanguage!==e.baseline.replyLanguage&&(n.replyLanguage=e.replyLanguage),e.enabled!==e.baseline.enabled&&(n.deliveryHttpEnabled=e.enabled);let t=!1;if(e.enabled){let o=it(e.port);o===null?t=!0:o!==e.baseline.port&&(n.deliveryHttpPort=o),e.token!==""?n.deliveryHttpToken=e.token:e.clearToken&&e.baseline.hasToken&&(n.clearDeliveryHttpToken=!0)}return t?{changed:!0,invalidPort:!0}:Object.keys(n).length===0?{changed:!1}:{changed:!0,invalidPort:!1,payload:n}}var An=te({activeId:null,activate:()=>{}});function Bn(e){return i(An,{value:{activeId:e.activeId,activate:e.activate},children:e.children})}function Se(e){let n=ie(An);return{chosen:n.activeId===e,activate:()=>n.activate(e)}}function we(e,n){let t=L(!1);return{cancelProps:{autoFocus:!0,"aria-describedby":e,onClick:()=>{t.current=!0,n()}},confirmProps:{"aria-describedby":e},triggerRef:o=>{o===null||!t.current||(t.current=!1,o.focus())}}}function he(e,n,t={}){return{signature:n,values:{...t,...e?.values},secrets:{},clearSecrets:[],saving:!1,failed:!1,confirming:!1,removing:!1,removeFailed:!1}}function Be(e){let{kind:n,row:t}=e,o=t===null?`${n.newSlot}:${JSON.stringify(e.initialValues??{})}`:JSON.stringify(t),r=Se(W(n.newSlot,t?.rowId??null)),a=L(0),[l,d]=x(()=>he(t,o,e.initialValues)),[c,b]=x("basic"),f=t!==null&&n.removeHintKey!==void 0?`im-remove-consequence-${n.newSlot}-${t.rowId}`:void 0,w=we(f,()=>d(m=>({...m,confirming:!1})));l.signature!==o&&(a.current+=1,d(he(t,o,e.initialValues)));let h=Pn({...t===null?{}:{rowId:t.rowId},baseline:t?.values??{},values:l.values,secrets:l.secrets,clearSecrets:l.clearSecrets}),v=h.changed,R=t===null||!t.configured,g=e.status??_e(t),I=e.notice??null,u=l.saving||l.removing;function T(m){r.activate(),d(y=>({...m(y),failed:!1}))}function P(){if(!h.changed||u)return;r.activate();let m=h.edit,y=++a.current;d(S=>({...S,saving:!0,failed:!1})),ee(e.bridge,n.saveCommand,m,O(e.environmentId)).then(S=>{if(a.current!==y)return;if(S===null){d(Ne=>({...Ne,saving:!1,failed:!0}));return}let A=t===null?void 0:n.rows(S).find(Ne=>Ne.rowId===t.rowId);A!==void 0&&d(he(A,JSON.stringify(A))),e.onSaved(S)})}function E(){if(t===null){e.onDiscard();return}let m=t.rowId,y=++a.current;d(S=>({...S,removing:!0,removeFailed:!1})),ee(e.bridge,n.removeCommand,{rowId:m},O(e.environmentId)).then(S=>{if(a.current===y){if(S===null){d(A=>({...A,removing:!1,removeFailed:!0,confirming:!0}));return}e.onSaved(S)}})}let _=l.confirming?s("div",{className:"im-actions",children:[i(p,{type:"button",variant:"ghost",size:"sm",disabled:u,...w.cancelProps,children:e.t("settingsSection.cancel")}),i(p,{type:"button",variant:"destructive",size:"sm",disabled:u,...w.confirmProps,onClick:E,children:e.t(n.removeConfirmKey)})]}):i(p,{type:"button",variant:e.detail===!0?"destructive":"ghost",size:"sm",disabled:u,ref:w.triggerRef,onClick:()=>d(m=>({...m,confirming:!0,removeFailed:!1})),children:e.t("settingsSection.remove")});return s(be,{title:e.title(l.values),icon:e.icon?.(l.values),defaultOpen:R,staticHead:e.detail===!0,...e.detail===!0?{className:"im-detail"}:{},meta:s(C,{children:[e.meta?.(l.values),s("span",{className:"im-status",children:[e.statusMeta,i(G,{tone:g.tone,children:e.t(g.key)})]})]}),actions:e.detail===!0?null:_,notice:s(C,{children:[e.summary,e.detail===!0?null:s(C,{children:[l.confirming&&t!==null&&n.removeHintKey!==void 0?i("p",{id:f,children:e.t(n.removeHintKey)}):null,l.removeFailed?i("p",{className:"im-small im-issue",role:"alert",children:e.t(n.removeFailedKey)}):null]})]}),children:[I===null?null:i(z,{variant:I.variant,children:i(Q,{children:I.text})}),e.detail===!0?i(_n,{value:c,showDanger:t!==null,onChange:m=>{m!=="danger"&&l.confirming&&d(y=>({...y,confirming:!1})),b(m),e.onSectionChange?.(m)},t:e.t}):null,e.detail===!0&&c==="danger"?s("div",{className:"im-danger-zone",children:[n.removeHintKey===void 0?null:l.confirming&&t!==null?i("p",{id:f,children:e.t(n.removeHintKey)}):i("p",{className:"im-small im-muted",children:e.t(n.removeHintKey)}),l.removeFailed?i("p",{className:"im-small im-issue",role:"alert",children:e.t(n.removeFailedKey)}):null,_,e.extra?.({dirty:v,frozen:u,section:c})]}):null,s("div",{className:"im-form",children:[e.detail===!0&&c==="danger"?null:i(Rn,{scope:`${n.newSlot}-${t?.rowId??"new"}`,environmentId:e.environmentId,columns:e.columns,groupBotSettings:n.groupBotSettings===!0,...e.detail===!0?{section:c}:{},proxies:e.proxies,values:l.values,savedValues:t?.values??{},secrets:l.secrets,clearSecrets:l.clearSecrets,storedSecrets:t?.secrets??{},issues:t?.issues??[],publicFields:t?.publicFields??[],disabled:u,bridge:e.bridge,t:e.t,onValue:(m,y)=>T(S=>({...S,values:{...S.values,[m]:y}})),onSecret:(m,y)=>T(S=>({...S,secrets:{...S.secrets,[m]:y}})),onToggleClear:m=>T(y=>({...y,clearSecrets:y.clearSecrets.includes(m)?y.clearSecrets.filter(S=>S!==m):[...y.clearSecrets,m]}))}),e.detail===!0&&c!=="advanced"?null:e.extra?.({dirty:v,frozen:u,...e.detail===!0?{section:c}:{}}),i(ge,{dirty:v,saving:l.saving,busy:l.removing,solid:r.chosen&&v,failed:l.failed,saveLabel:e.t("settingsSection.save"),revertLabel:e.t("settingsSection.revert"),failedLabel:e.t("settingsSection.saveFailed"),onSave:P,onRevert:()=>{a.current+=1,d(he(t,o,e.initialValues))}})]})]})}function On(e){let n=e.bridge.useFormatTimestamp(),{error:t,t:o}=e;if(t===void 0)return null;let r=new Date(t.at),a=Number.isFinite(r.getTime())?r.toISOString():null;return s("div",{className:"im-small",role:"status",children:[s("p",{children:[i("strong",{className:"im-issue",children:o("settingsSection.lastMessageError.title")}),o("settingsSection.lastMessageError.separator"),i("span",{children:t.messageKey===void 0?t.message:o(t.messageKey,{...t.messageParams,defaultValue:t.message})})]}),s("p",{className:"im-muted",children:[o("settingsSection.lastMessageError.code",{code:t.code}),", ",o("settingsSection.lastMessageError.reference",{referenceId:t.referenceId}),a===null?null:s(C,{children:[", ",i("time",{dateTime:a,children:n(a)})]})]})]})}var xe={groupBotSettings:!0,newSlot:"im-new-row",saveCommand:$e,removeCommand:He,rows:e=>e.bots,removeConfirmKey:"settingsSection.removeConfirm",removeHintKey:"settingsSection.removeHint",removeFailedKey:"settingsSection.removeFailed"},Ce={newSlot:"im-new-target",saveCommand:ze,removeCommand:Qe,rows:e=>e.targets,removeConfirmKey:"settingsSection.target.removeConfirm",removeFailedKey:"settingsSection.target.removeFailed"},Ie=(e,n,t)=>{let o=(e.displayName??"").trim();return o.length>0?o:t(`platform.${n}`)};function Ln(e){let{bot:n,t}=e,o=e.bots.find(w=>w.rowId===(n===null?void 0:e.connections?.[n.rowId]?.duplicateOf)),r=ln(n,e.connections,o===void 0?void 0:Ie(o.values,o.platform,t),t),[a,l]=x(null),[d,c]=x(!1),b=n===null?void 0:`im-reset-consequence-${n.rowId}`,f=we(b,()=>c(!1));return i(Be,{...e,kind:xe,row:n,onSectionChange:w=>{l(null),w!=="danger"&&c(!1)},status:re(n,e.connections),statusMeta:n?.configured&&e.connections?.[n.rowId]?.statusSince!==void 0?i(le,{since:e.connections[n.rowId]?.statusSince,bridge:e.bridge,t}):null,notice:r,summary:n===null?null:i(On,{error:e.connections?.[n.rowId]?.lastMessageError,bridge:e.bridge,t}),title:w=>Ie(w,U(w),t),icon:w=>{let h=M(w,"platform");return h===""?null:i(q,{platform:h})},meta:w=>{let h=U(w),v=pe(h,w);return v===null?null:i("span",{className:"im-small im-muted",children:v})},extra:({dirty:w,frozen:h,section:v})=>{if(n===null)return null;let R=Sn(n.platform,w,h,e.connections?.[n.rowId]),g=R.actions.find(u=>u.id==="resetInbox"),I=R.actions.filter(u=>v===void 0||v==="danger"==(u.id==="resetInbox"));return s(C,{children:[s("div",{className:"im-span",children:[d&&g!==void 0?s(C,{children:[i("p",{id:b,children:g.descriptionKeys.map(u=>t(u)).join(" ")}),s("div",{className:"im-actions",children:[i(p,{type:"button",variant:"ghost",size:"sm",disabled:h,...f.cancelProps,children:t("settingsSection.cancel")}),i(p,{type:"button",variant:"destructive",size:"sm",disabled:g.disabled,...f.confirmProps,onClick:()=>{c(!1),l({id:"resetInbox",payload:{rowId:n.rowId}})},children:t("rowAction.resetInbox.confirm")})]})]}):i("div",{className:"im-actions",children:I.map(u=>i(p,{type:"button",variant:"ghost",size:"sm",disabled:u.disabled,ref:u.id==="resetInbox"?f.triggerRef:void 0,onClick:()=>{u.id==="resetInbox"?c(!0):l({id:u.id,payload:{rowId:n.rowId}})},children:t(u.labelKey)},u.id))}),v==="danger"?null:I.filter(u=>u.id!=="resetInbox"&&u.descriptionKeys.length>0).map(u=>i("p",{className:"im-small im-muted",children:u.descriptionKeys.map(T=>t(T,u.descriptionParams)).join(" ")},u.id)),v==="danger"||R.noteKey===null?null:i("p",{className:"im-small im-muted",children:t(R.noteKey)})]}),a===null?null:i(fe,{bridge:e.bridge,command:qe[a.id],payload:a.payload,items:"latest",environmentId:e.environmentId,t,onClose:()=>l(null)},a.id)]})}})}function Oe(e){let{t:n}=e;return i(Be,{...e,kind:Ce,row:e.target,title:t=>{let o=(t.name??"").trim()||(t.targetId??"").trim();return o.length>0?o:n("settingsSection.target.untitled")}})}function Mn(e){let{bot:n,t}=e,o=re(n,e.connections),r=U(n.values),a=pe(r,n.values);return s(p,{type:"button",variant:"outline",className:"im-bot-summary",onClick:e.onOpen,children:[s("span",{className:"im-bot-summary-identity",children:[i(q,{platform:r}),s("span",{className:"im-bot-summary-copy",children:[i("strong",{children:Ie(n.values,n.platform,t)}),a===null?null:i("span",{className:"im-small im-muted",children:a})]})]}),s("span",{className:"im-status",children:[n.configured&&e.connections?.[n.rowId]?.statusSince!==void 0?i(le,{since:e.connections[n.rowId]?.statusSince,bridge:e.bridge,t}):null,i(G,{tone:o.tone,children:t(o.key)})]}),i("span",{className:"im-summary-chevron","aria-hidden":"true"})]})}var ot={};function Vn(e){let{view:n,snapshot:t,t:o}=e,r=B(()=>{let y=(t.columns.find(S=>S.key==="platform")?.options?.map(S=>S.value)??[]).filter(S=>ve(S,n.bots.some(A=>A.platform===S)));for(let S of n.bots)y.includes(S.platform)||y.push(S.platform);return y.length===0?["lark"]:y},[t.columns,n.bots]),[a,l]=x(null),[d,c]=x(null),[b,f]=x(!1),[w,h]=x(null),v=a!==null&&r.includes(a)?a:n.bots[0]?.platform??r[0]??"lark",R=n.bots.filter(m=>m.platform===v),g=d===null?void 0:R.find(m=>m.rowId===d),I=b||g!==void 0,u=o(`platform.${v}`),T=w==="lark"?{command:We,descriptionKey:Y.descriptionKey}:w==="wecom"?{command:je,descriptionKey:"wecomSetup.action.description"}:null,P=()=>{c(null),f(!1)},E=v==="wechat"?null:s("div",{className:"im-actions",children:[i(p,{variant:"outline",disabled:w!==null,onClick:()=>{f(!0),c(null),e.activate(W(xe.newSlot,null))},children:o("settingsSection.addBot")}),v==="lark"?i(p,{variant:R.length===0?"default":"outline",disabled:w!==null,onClick:()=>h("lark"),children:o(Y.labelKey)}):null,v==="wecom"?s(p,{variant:"outline",disabled:w!==null,onClick:()=>h("wecom"),children:[o("wecomSetup.action.label"),i("span",{className:"im-badge im-small",children:o(Y.badgeKey)})]}):null]}),_=v==="lark"?i("p",{className:"im-small im-muted",children:o(Y.warningKey)}):null;return s("div",{className:"im-workspace",children:[i("div",{className:"im-rail",role:"tablist","aria-label":o("settingsSection.channelPicker"),children:r.map(m=>{let y=n.bots.filter(S=>S.platform===m).length;return s(p,{type:"button",variant:"ghost",role:"tab","aria-selected":m===v,className:"im-channel",onClick:()=>{l(m),P(),h(null)},children:[i(q,{platform:m}),i("span",{className:"im-channel-label",children:o(`platform.${m}`)}),y===0?null:i("span",{className:"im-channel-count",children:y})]},m)})}),i("div",{className:"im-main",children:I?s(C,{children:[i(p,{type:"button",variant:"ghost",size:"sm",className:"im-back",onClick:P,children:o("settingsSection.backToBots")}),i(Ln,{bot:b?null:g??null,bots:n.bots,connections:e.connections,columns:t.columns,proxies:t.proxies,environmentId:e.environmentId,bridge:e.bridge,t:o,detail:!0,...b?{initialValues:{platform:v}}:{},onSaved:m=>{if(b){let y=m.bots.find(S=>!n.bots.some(A=>A.rowId===S.rowId));y!==void 0&&l(y.platform),f(!1)}e.onSaved(m)},onDiscard:P},b?xe.newSlot:g?.rowId)]}):s(C,{children:[i("div",{className:"im-main-head",children:i("h3",{className:"im-heading im-medium",children:u})}),v==="wechat"?i("p",{className:"im-small im-muted",children:o("settingsSection.wechatUnavailable")}):null,R.length===0?s("div",{className:"im-empty",children:[i(mn,{title:o("settingsSection.platformEmpty",{platform:u})}),E,_]}):s(C,{children:[i("div",{className:"im-bot-list",children:R.map(m=>i(Mn,{bot:m,connections:e.connections,bridge:e.bridge,t:o,onOpen:()=>{c(m.rowId),h(null)}},m.rowId))}),E,_]}),T===null?null:s("section",{className:"im-block",children:[i("p",{className:"im-small im-muted",children:o(T.descriptionKey)}),i(fe,{bridge:e.bridge,command:T.command,payload:ot,items:"snapshots",environmentId:e.environmentId,t:o,onSettled:m=>{m.kind==="done"&&e.reload()},onClose:()=>h(null)})]})]})})]})}var at="im-general";function ke(e,n){return{signature:n,replyLanguage:e.replyLanguage,enabled:e.delivery.enabled,port:String(e.delivery.port),token:"",clearToken:!1,saving:!1,failed:!1}}function Kn(e){let n=e.view,t=Pe(n),o=Se(at),r=L(0),[a,l]=x(()=>ke(n,t));a.signature!==t&&(r.current+=1,l(ke(n,t)));let d=En({baseline:{replyLanguage:n.replyLanguage,enabled:n.delivery.enabled,port:n.delivery.port,hasToken:n.delivery.hasToken},replyLanguage:a.replyLanguage,enabled:a.enabled,port:a.port,token:a.token,clearToken:a.clearToken}),c=d.changed,b=d.changed&&d.invalidPort,f=D(e.environmentId,"general","port"),w=D(e.environmentId,"general","token"),h=D(e.environmentId,"general","language");function v(g){o.activate(),l(I=>({...I,...g,failed:!1}))}function R(){if(!d.changed||a.saving)return;if(o.activate(),d.invalidPort){l(u=>({...u,failed:!0}));return}let g=d.payload,I=++r.current;l(u=>({...u,saving:!0,failed:!1})),ee(e.bridge,Ge,g,O(e.environmentId)).then(u=>{if(r.current===I){if(u===null){l(T=>({...T,saving:!1,failed:!0}));return}l(ke(u,Pe(u))),e.onSaved(u)}})}return i(be,{title:e.t("settingsSection.general"),defaultOpen:e.open===!0,staticHead:e.open===!0,hideTitle:e.open===!0,...e.open===!0?{className:"im-detail"}:{},children:s("div",{className:"im-form",children:[i(V,{id:h,label:e.t("settings.language.label"),description:e.t("settings.language.description"),children:s(se,{className:"im-wide",value:a.replyLanguage,disabled:a.saving,onValueChange:g=>{let I=oe.find(u=>u.value===g);I===void 0||I.value===a.replyLanguage||v({replyLanguage:I.value})},children:[i(de,{id:h,"aria-describedby":`${h}-hint`,children:i(Z,{children:oe.filter(g=>g.value===a.replyLanguage).map(g=>e.t(g.labelKey))})}),i(ce,{children:oe.map(g=>i(X,{value:g.value,children:e.t(g.labelKey)},g.value))})]})}),s("div",{className:"im-field",children:[s(H,{className:"im-inline",children:[i("span",{className:"im-medium",children:e.t("settings.deliveryHttp.enabled.label")}),i(cn,{checked:a.enabled,disabled:a.saving,onCheckedChange:g=>{g!==a.enabled&&v({enabled:g})}})]}),i("p",{className:"im-small im-muted",children:e.t("settings.deliveryHttp.enabled.description")})]}),a.enabled?i(V,{id:f,label:e.t("settings.deliveryHttp.port.label"),description:e.t("settings.deliveryHttp.port.description"),issue:b?e.t("settingsSection.issue.format"):null,children:i($,{id:f,type:"number",value:a.port,disabled:a.saving,"aria-invalid":b?!0:void 0,"aria-describedby":ne(f,b,!0),onChange:g=>{g.target.value!==a.port&&v({port:g.target.value})}})}):null,a.enabled?i(V,{id:w,label:e.t("settings.deliveryHttp.token.label"),description:e.t("settings.deliveryHttp.token.description"),children:i(ue,{id:w,value:a.token,stored:n.delivery.hasToken,clearing:a.clearToken,disabled:a.saving,invalid:!1,describedBy:ne(w,!1,!0),savedPlaceholder:e.t("settingsSection.secret.saved"),clearLabel:e.t("settingsSection.secret.clear"),undoLabel:e.t("settingsSection.secret.clearUndo"),onChange:g=>{g!==a.token&&v({token:g})},onToggleClear:()=>v({clearToken:!a.clearToken})})}):null,i(ge,{dirty:c,saving:a.saving,solid:o.chosen&&c,failed:a.failed,saveLabel:e.t("settingsSection.save"),revertLabel:e.t("settingsSection.revert"),failedLabel:e.t("settingsSection.saveFailed"),onSave:R,onRevert:()=>{r.current+=1,l(ke(n,t))}})]})})}function Fn(e){let[n,t]=x(!1),{t:o}=e;return s("div",{className:"im-main",role:"region","aria-label":o("settings.deliveryTargets.label"),children:[e.view.targets.map(r=>i(Oe,{target:r,columns:e.columns,proxies:e.proxies,environmentId:e.environmentId,bridge:e.bridge,t:o,onSaved:e.onSaved,onDiscard:()=>{}},r.rowId)),n?i(Oe,{target:null,columns:e.columns,proxies:e.proxies,environmentId:e.environmentId,bridge:e.bridge,t:o,onSaved:r=>{t(!1),e.onSaved(r)},onDiscard:()=>t(!1)},Ce.newSlot):null,i("div",{className:"im-actions",children:i(p,{variant:"outline",disabled:n,onClick:()=>{t(!0),e.activate(W(Ce.newSlot,null))},children:o("settingsSection.target.add")})})]})}var Dn=`
|
|
5
|
+
`),d)},children:d("settingsSection.copy")})})]})]})}function q(e){let n=(()=>{switch(e.platform){case"lark":return s(C,{children:[i("path",{fill:"#00D6B9",d:"M7.2 4.5h7.6c1.2 0 2.1.55 2.7 1.58 1.05 1.8 1.55 3.45 1.58 4.95-2.04-.62-4.2-.15-6.22 1.45C11.3 9.7 9.42 7.04 7.2 4.5Z"}),i("path",{fill:"#1456B8",d:"M10.8 13.55c3.3-2.93 5.72-4.24 9.47-2.52-1.2 1.45-2.27 4.18-3.86 5.43-1.67 1.31-3.9.5-5.61-.64v-2.27Z"}),i("path",{fill:"#3370FF",d:"M4.4 8.35c3.47 3.61 7.25 6.1 10.33 5.7 1.06-.14 2.2-.72 3.4-1.72-1.04 2.65-2.6 4.8-5.06 6-2.46 1.2-5.56.52-7.42-.72A2.76 2.76 0 0 1 4.4 15.3V8.35Z"})]});case"wecom":case"wecom-app":return s(C,{children:[i("path",{fill:"none",stroke:"#3370FF",strokeWidth:"2.35",strokeLinecap:"round",strokeLinejoin:"round",d:"M17.7 14.5c1.05-1.12 1.65-2.52 1.65-4.03 0-3.82-3.58-6.92-8-6.92s-8 3.1-8 6.92 3.58 6.92 8 6.92c1.17 0 2.28-.22 3.28-.62"}),i("path",{fill:"#07C160",d:"M16.1 15.15c.7-.7 1.83-.7 2.53 0s.7 1.83 0 2.53-1.83.7-2.53 0-.7-1.83 0-2.53Z"}),i("path",{fill:"#FFB800",d:"M19.25 13.45a1.36 1.36 0 1 1 1.92 1.92 1.36 1.36 0 0 1-1.92-1.92Z"}),i("path",{fill:"#FF7A00",d:"M19.55 18.05a1.16 1.16 0 1 1 1.64 1.64 1.16 1.16 0 0 1-1.64-1.64Z"}),i("path",{fill:"#3370FF",d:"M15.25 18.75a.92.92 0 1 1 1.3 1.3.92.92 0 0 1-1.3-1.3Z"})]});case"telegram":return i("path",{fill:"#229ED9",d:"M23.95 4.57c-.36-1.45-1.43-1.76-2.82-1.24L1.5 10.9c-1.34.52-1.32 1.27-.24 1.6l5.03 1.57 11.66-7.36c.55-.34 1.05-.16.64.21l-9.44 8.52-.37 5.12c.54 0 .78-.24 1.08-.53l2.59-2.51 5.38 3.97c.99.55 1.7.27 1.95-.92L23.95 4.57Z"});case"wechat":return i("path",{fill:"#07C160",d:"M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 0 0 .167-.054l1.903-1.114a.864.864 0 0 1 .717-.098 10.16 10.16 0 0 0 2.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178A1.17 1.17 0 0 1 4.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178 1.17 1.17 0 0 1-1.162-1.178c0-.651.52-1.18 1.162-1.18zm5.34 2.867c-1.797-.052-3.746.512-5.28 1.786-1.72 1.428-2.687 3.72-1.78 6.22.942 2.453 3.666 4.229 6.884 4.229.826 0 1.622-.12 2.361-.336a.722.722 0 0 1 .598.082l1.584.926a.272.272 0 0 0 .14.047c.134 0 .24-.111.24-.247 0-.06-.023-.12-.038-.177l-.327-1.233a.582.582 0 0 1-.023-.156.49.49 0 0 1 .201-.398C23.024 18.48 24 16.82 24 14.98c0-3.21-2.931-5.837-6.656-6.088V8.89c-.135-.01-.27-.027-.407-.03zm-2.53 3.274c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.97-.982zm4.844 0c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.969-.982z"});default:return null}})();return n===null?null:i("span",{className:`im-platform im-platform-${e.platform}`,"aria-hidden":"true",children:i("svg",{width:20,height:20,viewBox:"0 0 24 24",focusable:"false",children:n})})}function qn(e){return e.length>12?`${e.slice(0,8)}\u2022\u2022\u2022\u2022${e.slice(-4)}`:"cli_\u2022\u2022\u2022\u2022"}function kn(e){return e.length<=10?`${e.slice(0,3)}\u2022\u2022\u2022`:`${e.slice(0,6)}\u2022\u2022\u2022\u2022${e.slice(-4)}`}var Yn={lark:{column:"larkAppId",mask:qn},wecom:{column:"wecomBotId",mask:kn},"wecom-app":{column:"wecomAppCorpId",mask:kn}};function pe(e,n){let t=Yn[e];if(t===void 0)return null;let o=M(n,t.column);return o===""?null:t.mask(o)}function Ee(e){let n=e.className===void 0?"im-collapse":`im-collapse ${e.className}`;return e.staticHead===!0&&e.hideTitle===!0?s("div",{className:n,children:[e.notice,i("div",{className:"im-panel",children:e.children})]}):e.staticHead===!0?s("div",{className:n,children:[s("div",{className:"im-head",children:[s("div",{className:"im-toggle im-static",children:[e.icon,i("span",{className:"im-title im-medium",children:e.title}),e.meta]}),e.actions]}),e.notice,i("div",{className:"im-panel",children:e.children})]}):s(gn,{className:n,...e.defaultOpen===void 0?{}:{defaultOpen:e.defaultOpen},...e.open===void 0?{}:{open:e.open},...e.onOpenChange===void 0?{}:{onOpenChange:e.onOpenChange},children:[s("div",{className:"im-head",children:[s(yn,{className:"im-toggle",children:[i("span",{className:"im-chevron","aria-hidden":"true"}),e.icon,i("span",{className:"im-title im-medium",children:e.title}),e.meta]}),e.actions]}),e.notice,i(fn,{children:i("div",{className:"im-panel",children:e.children})})]})}function be(e){return i("section",{className:e.className===void 0?"im-block":`im-block ${e.className}`,...e.hideTitle===!0?{"aria-label":e.title}:{},children:i(Ee,{...e})})}var Jn=new Set(["accessMode","allowedSenders","runtimeMode"]),Zn=new Set(["groupMention","queueMode","approvalTimeoutMinutes","larkPanelMode","larkTopicOnMention","wecomNumberedHints"]);function Nn(e){return Jn.has(e.key)?"access":Zn.has(e.key)?"chat":e.group==="essential"||e.key==="defaultModel"||e.key==="defaultPreset"?"basic":"advanced"}var ve=(e,n)=>e!=="wechat"||n;var Ae="\0empty";function Rn(e){let n=e.columns.filter(p=>Ze(p,e.values)&&(e.section===void 0||Nn(p)===e.section)),t=e.section!==void 0?n:e.groupBotSettings?n.filter(p=>p.group==="essential"):n,o=e.section!==void 0?[]:e.groupBotSettings?n.filter(p=>p.group!=="essential"):[],r=e.issues.filter(p=>o.some(h=>h.key===p.column)),a=JSON.stringify(r),[l,d]=x(()=>({open:r.length>0,issues:a})),c=l.open||l.issues!==a&&r.length>0;l.issues!==a&&d({open:c,issues:a});let g=p=>i(Xn,{column:p,scope:e.scope,environmentId:e.environmentId,proxies:e.proxies,values:e.values,savedValues:e.savedValues,secrets:e.secrets,clearSecrets:e.clearSecrets,storedSecrets:e.storedSecrets,issues:e.issues,disabled:e.disabled,t:e.t,onValue:e.onValue,onSecret:e.onSecret,onToggleClear:e.onToggleClear},p.key);return s(C,{children:[t.map(g),(e.section===void 0||e.section==="basic"?e.publicFields:[]).map(p=>i(nt,{field:p,scope:e.scope,environmentId:e.environmentId,bridge:e.bridge,t:e.t},p.key)),o.length===0?null:i(Ee,{className:"im-span",title:r.length>0?e.t("settingsSection.moreSettingsIssues",{count:r.length}):e.t("settingsSection.moreSettings"),open:c,onOpenChange:p=>d({open:p,issues:a}),children:i("div",{className:"im-form",children:o.map(g)})})]})}function Xn(e){let n=e.column,t=D(e.environmentId,e.scope,n.key),o=j(e.t,n.labelKey,n.label)??n.key,r=j(e.t,n.descriptionKey,n.description),a=e.values.platform??"",l=n.key==="displayName"&&a.length>0?e.t(`platform.${a}`):j(e.t,n.placeholderKey,n.placeholder),d=xn(e.t,e.issues.filter(g=>g.column===n.key).map(g=>g.code)),c=ne(t,d!==null,r!==void 0);return n.kind==="password"?i(V,{id:t,label:o,description:r,issue:d,children:i(ue,{id:t,value:e.secrets[n.key]??"",stored:e.storedSecrets[n.key]===!0,clearing:e.clearSecrets.includes(n.key),disabled:e.disabled,invalid:d!==null,describedBy:c,placeholder:l,savedPlaceholder:e.t("settingsSection.secret.saved"),clearLabel:e.t("settingsSection.secret.clear"),undoLabel:e.t("settingsSection.secret.clearUndo"),onChange:g=>{g!==(e.secrets[n.key]??"")&&e.onSecret(n.key,g)},onToggleClear:()=>e.onToggleClear(n.key)})}):n.kind==="select"?i(et,{column:n,id:t,label:o,description:r,issue:d,described:c,values:e.values,savedValues:e.savedValues,disabled:e.disabled,t:e.t,onValue:e.onValue}):n.kind==="proxy"?i("div",{className:"im-field",children:i(bn,{id:t,label:o,hint:e.values.platform==="lark"?e.t("column.proxy.larkHint"):r,value:e.values[n.key]??"",proxies:e.proxies,disabled:e.disabled,onChange:g=>{g!==(e.values[n.key]??"")&&e.onValue(n.key,g)},children:d===null?null:i("p",{id:`${t}-issue`,className:"im-small im-issue",role:"alert",children:d})})}):i(V,{id:t,label:o,description:r,issue:d,children:i($,{id:t,type:n.kind==="number"?"number":"text",min:n.min,max:n.max,step:n.kind==="number"?1:void 0,value:e.values[n.key]??n.defaultValue??"",placeholder:l,disabled:e.disabled,"aria-invalid":d!==null?!0:void 0,"aria-describedby":c,onChange:g=>{let p=g.target.value;p!==(e.values[n.key]??"")&&e.onValue(n.key,p)}})})}function et(e){let n=e.values[e.column.key]??"",t=e.savedValues[e.column.key]??"",o=(e.column.options??[]).filter(c=>e.column.key!=="platform"||ve(c.value,e.savedValues.platform===c.value)),r=o.some(c=>c.value===""),a=o.find(c=>c.value===n),l=c=>e.column.unavailableLabelKey===void 0?c:e.t(e.column.unavailableLabelKey,{value:c}),d=n===""&&a===void 0?void 0:a===void 0?l(n):j(e.t,a.labelKey,a.label)??a.value;return i(V,{id:e.id,label:e.label,description:e.description,issue:e.issue,children:s(se,{className:"im-wide",value:n===""?r?Ae:null:n,disabled:e.disabled,onValueChange:c=>{let g=r&&c===Ae?"":c??"";g!==n&&e.onValue(e.column.key,g)},children:[i(de,{id:e.id,"aria-invalid":e.issue!==null?!0:void 0,"aria-describedby":e.described,children:d===void 0?i(Z,{placeholder:e.t("settingsSection.select.default")}):i(Z,{children:d})}),s(ce,{children:[e.column.listsUnknownValue===!0&&t!==""&&!o.some(c=>c.value===t)?i(X,{value:t,disabled:e.column.unavailableLabelKey!==void 0,children:l(t)}):null,o.map(c=>i(X,{value:c.value===""?Ae:c.value,children:j(e.t,c.labelKey,c.label)??c.value},c.value))]})]})})}function nt(e){let n=D(e.environmentId,`${e.scope}-pub`,e.field.key);return s("div",{className:"im-field im-span",children:[i(H,{children:e.t(`settingsSection.publicField.${e.field.key}`)}),e.field.value===""?null:s("div",{className:"im-inline im-public-row",children:[i("span",{id:n,className:"im-public-value im-small",children:tt(e.field.value)}),e.field.copyable?i(b,{variant:"ghost",size:"sm",onClick:()=>{ye(e.bridge,e.field.value,e.t)},children:e.t("settingsSection.copy")}):null]}),e.field.hint===void 0?null:i("p",{className:"im-small im-muted",children:e.t(`settingsSection.publicFieldHint.${e.field.hint}`)})]})}function tt(e){let n=0;return e.split(/(?<=\/)(?!\/)/).map(t=>{let o=n;return n+=t.length,s(Me,{children:[o===0?null:i("wbr",{}),t]},o)})}var Tn=["basic","access","chat","advanced","danger"];function _n(e){let n=Ke(),t=e.showDanger?Tn:Tn.slice(0,-1),o=a=>{e.onChange(a),document.getElementById(`${n}-${a}`)?.focus()},r=(a,l)=>{let d=a.key==="Home"?0:a.key==="End"?t.length-1:a.key==="ArrowLeft"?(l-1+t.length)%t.length:a.key==="ArrowRight"?(l+1)%t.length:null;d!==null&&(a.preventDefault(),o(t[d]))};return i("div",{className:"im-detail-tabs",role:"tablist","aria-label":e.t("settingsSection.detailTabs"),children:t.map((a,l)=>i(b,{id:`${n}-${a}`,type:"button",variant:"ghost",size:"sm",role:"tab","aria-selected":e.value===a,tabIndex:e.value===a?0:-1,className:"im-detail-tab",onClick:()=>e.onChange(a),onKeyDown:d=>r(d,l),children:e.t(`settingsSection.tab.${a}`)},a))})}function Pn(e){let n={};for(let[a,l]of Object.entries(e.values))(e.baseline[a]??"")!==l&&(n[a]=l);let t={};for(let[a,l]of Object.entries(e.secrets))l!==""&&(t[a]=l);let o=[];for(let a of e.clearSecrets)Object.hasOwn(t,a)||o.includes(a)||o.push(a);return e.rowId===void 0||Object.keys(n).length>0||Object.keys(t).length>0||o.length>0?{changed:!0,edit:{...e.rowId===void 0?{}:{rowId:e.rowId},values:n,...Object.keys(t).length>0?{secrets:t}:{},...o.length>0?{clearSecrets:o}:{}}}:{changed:!1}}function it(e){let n=e.trim();if(!/^\d+$/.test(n))return null;let t=Number(n);return!Number.isInteger(t)||t<1||t>65535?null:t}function En(e){let n={};e.replyLanguage!==e.baseline.replyLanguage&&(n.replyLanguage=e.replyLanguage),e.enabled!==e.baseline.enabled&&(n.deliveryHttpEnabled=e.enabled);let t=!1;if(e.enabled){let o=it(e.port);o===null?t=!0:o!==e.baseline.port&&(n.deliveryHttpPort=o),e.token!==""?n.deliveryHttpToken=e.token:e.clearToken&&e.baseline.hasToken&&(n.clearDeliveryHttpToken=!0)}return t?{changed:!0,invalidPort:!0}:Object.keys(n).length===0?{changed:!1}:{changed:!0,invalidPort:!1,payload:n}}var An=te({activeId:null,activate:()=>{}});function Bn(e){return i(An,{value:{activeId:e.activeId,activate:e.activate},children:e.children})}function Se(e){let n=ie(An);return{chosen:n.activeId===e,activate:()=>n.activate(e)}}function he(e,n){let t=L(!1);return{cancelProps:{autoFocus:!0,"aria-describedby":e,onClick:()=>{t.current=!0,n()}},confirmProps:{"aria-describedby":e},triggerRef:o=>{o===null||!t.current||(t.current=!1,o.focus())}}}function we(e,n,t={}){return{signature:n,values:{...t,...e?.values},secrets:{},clearSecrets:[],saving:!1,failed:!1,confirming:!1,removing:!1,removeFailed:!1}}function Be(e){let{kind:n,row:t}=e,o=t===null?`${n.newSlot}:${JSON.stringify(e.initialValues??{})}`:JSON.stringify(t),r=Se(W(n.newSlot,t?.rowId??null)),a=L(0),[l,d]=x(()=>we(t,o,e.initialValues)),[c,g]=x("basic"),p=t!==null&&n.removeHintKey!==void 0?`im-remove-consequence-${n.newSlot}-${t.rowId}`:void 0,h=he(p,()=>d(m=>({...m,confirming:!1})));l.signature!==o&&(a.current+=1,d(we(t,o,e.initialValues)));let w=Pn({...t===null?{}:{rowId:t.rowId},baseline:t?.values??{},values:l.values,secrets:l.secrets,clearSecrets:l.clearSecrets}),v=w.changed,R=t===null||!t.configured,y=e.status??_e(t),I=e.notice??null,u=l.saving||l.removing;function T(m){r.activate(),d(f=>({...m(f),failed:!1}))}function P(){if(!w.changed||u)return;r.activate();let m=w.edit,f=++a.current;d(S=>({...S,saving:!0,failed:!1})),ee(e.bridge,n.saveCommand,m,O(e.environmentId)).then(S=>{if(a.current!==f)return;if(S===null){d(Ne=>({...Ne,saving:!1,failed:!0}));return}let A=t===null?void 0:n.rows(S).find(Ne=>Ne.rowId===t.rowId);A!==void 0&&d(we(A,JSON.stringify(A))),e.onSaved(S)})}function E(){if(t===null){e.onDiscard();return}let m=t.rowId,f=++a.current;d(S=>({...S,removing:!0,removeFailed:!1})),ee(e.bridge,n.removeCommand,{rowId:m},O(e.environmentId)).then(S=>{if(a.current===f){if(S===null){d(A=>({...A,removing:!1,removeFailed:!0,confirming:!0}));return}e.onSaved(S)}})}let _=l.confirming?s("div",{className:"im-actions",children:[i(b,{type:"button",variant:"ghost",size:"sm",disabled:u,...h.cancelProps,children:e.t("settingsSection.cancel")}),i(b,{type:"button",variant:"destructive",size:"sm",disabled:u,...h.confirmProps,onClick:E,children:e.t(n.removeConfirmKey)})]}):i(b,{type:"button",variant:e.detail===!0?"destructive":"ghost",size:"sm",disabled:u,ref:h.triggerRef,onClick:()=>d(m=>({...m,confirming:!0,removeFailed:!1})),children:e.t("settingsSection.remove")});return s(be,{title:e.title(l.values),icon:e.icon?.(l.values),defaultOpen:R,staticHead:e.detail===!0,...e.detail===!0?{className:"im-detail"}:{},meta:s(C,{children:[e.meta?.(l.values),s("span",{className:"im-status",children:[e.statusMeta,i(G,{tone:y.tone,children:e.t(y.key)})]})]}),actions:e.detail===!0?null:_,notice:s(C,{children:[e.summary,e.detail===!0?null:s(C,{children:[l.confirming&&t!==null&&n.removeHintKey!==void 0?i("p",{id:p,children:e.t(n.removeHintKey)}):null,l.removeFailed?i("p",{className:"im-small im-issue",role:"alert",children:e.t(n.removeFailedKey)}):null]})]}),children:[I===null?null:i(z,{variant:I.variant,children:i(Q,{children:I.text})}),e.detail===!0?i(_n,{value:c,showDanger:t!==null,onChange:m=>{m!=="danger"&&l.confirming&&d(f=>({...f,confirming:!1})),g(m),e.onSectionChange?.(m)},t:e.t}):null,e.detail===!0&&c==="danger"?s("div",{className:"im-danger-zone",children:[n.removeHintKey===void 0?null:l.confirming&&t!==null?i("p",{id:p,children:e.t(n.removeHintKey)}):i("p",{className:"im-small im-muted",children:e.t(n.removeHintKey)}),l.removeFailed?i("p",{className:"im-small im-issue",role:"alert",children:e.t(n.removeFailedKey)}):null,_,e.extra?.({dirty:v,frozen:u,section:c})]}):null,s("div",{className:"im-form",children:[e.detail===!0&&c==="danger"?null:i(Rn,{scope:`${n.newSlot}-${t?.rowId??"new"}`,environmentId:e.environmentId,columns:e.columns,groupBotSettings:n.groupBotSettings===!0,...e.detail===!0?{section:c}:{},proxies:e.proxies,values:l.values,savedValues:t?.values??{},secrets:l.secrets,clearSecrets:l.clearSecrets,storedSecrets:t?.secrets??{},issues:t?.issues??[],publicFields:t?.publicFields??[],disabled:u,bridge:e.bridge,t:e.t,onValue:(m,f)=>T(S=>({...S,values:{...S.values,[m]:f}})),onSecret:(m,f)=>T(S=>({...S,secrets:{...S.secrets,[m]:f}})),onToggleClear:m=>T(f=>({...f,clearSecrets:f.clearSecrets.includes(m)?f.clearSecrets.filter(S=>S!==m):[...f.clearSecrets,m]}))}),e.detail===!0&&c!=="advanced"?null:e.extra?.({dirty:v,frozen:u,...e.detail===!0?{section:c}:{}}),i(ge,{dirty:v,saving:l.saving,busy:l.removing,solid:r.chosen&&v,failed:l.failed,saveLabel:e.t("settingsSection.save"),revertLabel:e.t("settingsSection.revert"),failedLabel:e.t("settingsSection.saveFailed"),onSave:P,onRevert:()=>{a.current+=1,d(we(t,o,e.initialValues))}})]})]})}function On(e){let n=e.bridge.useFormatTimestamp(),{error:t,t:o}=e;if(t===void 0)return null;let r=new Date(t.at),a=Number.isFinite(r.getTime())?r.toISOString():null;return s("div",{className:"im-small",role:"status",children:[s("p",{children:[i("strong",{className:"im-issue",children:o("settingsSection.lastMessageError.title")}),o("settingsSection.lastMessageError.separator"),i("span",{children:t.messageKey===void 0?t.message:o(t.messageKey,{...t.messageParams,defaultValue:t.message})})]}),s("p",{className:"im-muted",children:[o("settingsSection.lastMessageError.code",{code:t.code}),", ",o("settingsSection.lastMessageError.reference",{referenceId:t.referenceId}),a===null?null:s(C,{children:[", ",i("time",{dateTime:a,children:n(a)})]})]})]})}var xe={groupBotSettings:!0,newSlot:"im-new-row",saveCommand:$e,removeCommand:He,rows:e=>e.bots,removeConfirmKey:"settingsSection.removeConfirm",removeHintKey:"settingsSection.removeHint",removeFailedKey:"settingsSection.removeFailed"},Ce={newSlot:"im-new-target",saveCommand:ze,removeCommand:Qe,rows:e=>e.targets,removeConfirmKey:"settingsSection.target.removeConfirm",removeFailedKey:"settingsSection.target.removeFailed"},Ie=(e,n,t)=>{let o=(e.displayName??"").trim();return o.length>0?o:t(`platform.${n}`)};function Ln(e){let{bot:n,t}=e,o=e.bots.find(h=>h.rowId===(n===null?void 0:e.connections?.[n.rowId]?.duplicateOf)),r=ln(n,e.connections,o===void 0?void 0:Ie(o.values,o.platform,t),t),[a,l]=x(null),[d,c]=x(!1),g=n===null?void 0:`im-reset-consequence-${n.rowId}`,p=he(g,()=>c(!1));return i(Be,{...e,kind:xe,row:n,onSectionChange:h=>{l(null),h!=="danger"&&c(!1)},status:re(n,e.connections),statusMeta:n?.configured&&e.connections?.[n.rowId]?.statusSince!==void 0?i(le,{since:e.connections[n.rowId]?.statusSince,bridge:e.bridge,t}):null,notice:r,summary:n===null?null:i(On,{error:e.connections?.[n.rowId]?.lastMessageError,bridge:e.bridge,t}),title:h=>Ie(h,U(h),t),icon:h=>{let w=M(h,"platform");return w===""?null:i(q,{platform:w})},meta:h=>{let w=U(h),v=pe(w,h);return v===null?null:i("span",{className:"im-small im-muted",children:v})},extra:({dirty:h,frozen:w,section:v})=>{if(n===null)return null;let R=Sn(n.platform,h,w,e.connections?.[n.rowId]),y=R.actions.find(u=>u.id==="resetInbox"),I=R.actions.filter(u=>v===void 0||v==="danger"==(u.id==="resetInbox"));return s(C,{children:[s("div",{className:"im-span",children:[d&&y!==void 0?s(C,{children:[i("p",{id:g,children:y.descriptionKeys.map(u=>t(u)).join(" ")}),s("div",{className:"im-actions",children:[i(b,{type:"button",variant:"ghost",size:"sm",disabled:w,...p.cancelProps,children:t("settingsSection.cancel")}),i(b,{type:"button",variant:"destructive",size:"sm",disabled:y.disabled,...p.confirmProps,onClick:()=>{c(!1),l({id:"resetInbox",payload:{rowId:n.rowId}})},children:t("rowAction.resetInbox.confirm")})]})]}):i("div",{className:"im-actions",children:I.map(u=>i(b,{type:"button",variant:"ghost",size:"sm",disabled:u.disabled,ref:u.id==="resetInbox"?p.triggerRef:void 0,onClick:()=>{u.id==="resetInbox"?c(!0):l({id:u.id,payload:{rowId:n.rowId}})},children:t(u.labelKey)},u.id))}),v==="danger"?null:I.filter(u=>u.id!=="resetInbox"&&u.descriptionKeys.length>0).map(u=>i("p",{className:"im-small im-muted",children:u.descriptionKeys.map(T=>t(T,u.descriptionParams)).join(" ")},u.id)),v==="danger"||R.noteKey===null?null:i("p",{className:"im-small im-muted",children:t(R.noteKey)})]}),a===null?null:i(fe,{bridge:e.bridge,command:qe[a.id],payload:a.payload,items:"latest",environmentId:e.environmentId,t,onClose:()=>l(null)},a.id)]})}})}function Oe(e){let{t:n}=e;return i(Be,{...e,kind:Ce,row:e.target,title:t=>{let o=(t.name??"").trim()||(t.targetId??"").trim();return o.length>0?o:n("settingsSection.target.untitled")}})}function Mn(e){let{bot:n,t}=e,o=re(n,e.connections),r=U(n.values),a=pe(r,n.values);return s(b,{type:"button",variant:"outline",className:"im-bot-summary",onClick:e.onOpen,children:[s("span",{className:"im-bot-summary-identity",children:[i(q,{platform:r}),s("span",{className:"im-bot-summary-copy",children:[i("strong",{children:Ie(n.values,n.platform,t)}),a===null?null:i("span",{className:"im-small im-muted",children:a})]})]}),s("span",{className:"im-status",children:[n.configured&&e.connections?.[n.rowId]?.statusSince!==void 0?i(le,{since:e.connections[n.rowId]?.statusSince,bridge:e.bridge,t}):null,i(G,{tone:o.tone,children:t(o.key)})]}),i("span",{className:"im-summary-chevron","aria-hidden":"true"})]})}var ot={};function Vn(e){let{view:n,snapshot:t,t:o}=e,r=B(()=>{let f=(t.columns.find(S=>S.key==="platform")?.options?.map(S=>S.value)??[]).filter(S=>ve(S,n.bots.some(A=>A.platform===S)));for(let S of n.bots)f.includes(S.platform)||f.push(S.platform);return f.length===0?["lark"]:f},[t.columns,n.bots]),[a,l]=x(null),[d,c]=x(null),[g,p]=x(!1),[h,w]=x(null),v=a!==null&&r.includes(a)?a:n.bots[0]?.platform??r[0]??"lark",R=n.bots.filter(m=>m.platform===v),y=d===null?void 0:R.find(m=>m.rowId===d),I=g||y!==void 0,u=o(`platform.${v}`),T=h==="lark"?{command:We,descriptionKey:Y.descriptionKey}:h==="wecom"?{command:je,descriptionKey:"wecomSetup.action.description"}:null,P=()=>{c(null),p(!1)},E=v==="wechat"?null:s("div",{className:"im-actions",children:[i(b,{variant:"outline",disabled:h!==null,onClick:()=>{p(!0),c(null),e.activate(W(xe.newSlot,null))},children:o("settingsSection.addBot")}),v==="lark"?i(b,{variant:R.length===0?"default":"outline",disabled:h!==null,onClick:()=>w("lark"),children:o(Y.labelKey)}):null,v==="wecom"?s(b,{variant:"outline",disabled:h!==null,onClick:()=>w("wecom"),children:[o("wecomSetup.action.label"),i("span",{className:"im-badge im-small",children:o(Y.badgeKey)})]}):null]}),_=v==="lark"?i("p",{className:"im-small im-muted",children:o(Y.warningKey)}):null;return s("div",{className:"im-workspace",children:[i("div",{className:"im-rail",role:"tablist","aria-label":o("settingsSection.channelPicker"),children:r.map(m=>{let f=n.bots.filter(S=>S.platform===m).length;return s(b,{type:"button",variant:"ghost",role:"tab","aria-selected":m===v,className:"im-channel",onClick:()=>{l(m),P(),w(null)},children:[i(q,{platform:m}),i("span",{className:"im-channel-label",children:o(`platform.${m}`)}),f===0?null:i("span",{className:"im-channel-count",children:f})]},m)})}),i("div",{className:"im-main",children:I?s(C,{children:[i(b,{type:"button",variant:"ghost",size:"sm",className:"im-back",onClick:P,children:o("settingsSection.backToBots")}),i(Ln,{bot:g?null:y??null,bots:n.bots,connections:e.connections,columns:t.columns,proxies:t.proxies,environmentId:e.environmentId,bridge:e.bridge,t:o,detail:!0,...g?{initialValues:{platform:v}}:{},onSaved:m=>{if(g){let f=m.bots.find(S=>!n.bots.some(A=>A.rowId===S.rowId));f!==void 0&&l(f.platform),p(!1)}e.onSaved(m)},onDiscard:P},g?xe.newSlot:y?.rowId)]}):s(C,{children:[i("div",{className:"im-main-head",children:i("h3",{className:"im-heading im-medium",children:u})}),v==="wechat"?i("p",{className:"im-small im-muted",children:o("settingsSection.wechatUnavailable")}):null,R.length===0?s("div",{className:"im-empty",children:[i(mn,{title:o("settingsSection.platformEmpty",{platform:u})}),E,_]}):s(C,{children:[i("div",{className:"im-bot-list",children:R.map(m=>i(Mn,{bot:m,connections:e.connections,bridge:e.bridge,t:o,onOpen:()=>{c(m.rowId),w(null)}},m.rowId))}),E,_]}),T===null?null:s("section",{className:"im-block",children:[i("p",{className:"im-small im-muted",children:o(T.descriptionKey)}),i(fe,{bridge:e.bridge,command:T.command,payload:ot,items:"snapshots",environmentId:e.environmentId,t:o,onSettled:m=>{m.kind==="done"&&e.reload()},onClose:()=>w(null)})]})]})})]})}var at="im-general";function ke(e,n){return{signature:n,replyLanguage:e.replyLanguage,enabled:e.delivery.enabled,port:String(e.delivery.port),token:"",clearToken:!1,saving:!1,failed:!1}}function Kn(e){let n=e.view,t=Pe(n),o=Se(at),r=L(0),[a,l]=x(()=>ke(n,t));a.signature!==t&&(r.current+=1,l(ke(n,t)));let d=En({baseline:{replyLanguage:n.replyLanguage,enabled:n.delivery.enabled,port:n.delivery.port,hasToken:n.delivery.hasToken},replyLanguage:a.replyLanguage,enabled:a.enabled,port:a.port,token:a.token,clearToken:a.clearToken}),c=d.changed,g=d.changed&&d.invalidPort,p=D(e.environmentId,"general","port"),h=D(e.environmentId,"general","token"),w=D(e.environmentId,"general","language");function v(y){o.activate(),l(I=>({...I,...y,failed:!1}))}function R(){if(!d.changed||a.saving)return;if(o.activate(),d.invalidPort){l(u=>({...u,failed:!0}));return}let y=d.payload,I=++r.current;l(u=>({...u,saving:!0,failed:!1})),ee(e.bridge,Ge,y,O(e.environmentId)).then(u=>{if(r.current===I){if(u===null){l(T=>({...T,saving:!1,failed:!0}));return}l(ke(u,Pe(u))),e.onSaved(u)}})}return i(be,{title:e.t("settingsSection.general"),defaultOpen:e.open===!0,staticHead:e.open===!0,hideTitle:e.open===!0,...e.open===!0?{className:"im-detail"}:{},children:s("div",{className:"im-form",children:[i(V,{id:w,label:e.t("settings.language.label"),description:e.t("settings.language.description"),children:s(se,{className:"im-wide",value:a.replyLanguage,disabled:a.saving,onValueChange:y=>{let I=oe.find(u=>u.value===y);I===void 0||I.value===a.replyLanguage||v({replyLanguage:I.value})},children:[i(de,{id:w,"aria-describedby":`${w}-hint`,children:i(Z,{children:oe.filter(y=>y.value===a.replyLanguage).map(y=>e.t(y.labelKey))})}),i(ce,{children:oe.map(y=>i(X,{value:y.value,children:e.t(y.labelKey)},y.value))})]})}),s("div",{className:"im-field",children:[s(H,{className:"im-inline",children:[i("span",{className:"im-medium",children:e.t("settings.deliveryHttp.enabled.label")}),i(cn,{checked:a.enabled,disabled:a.saving,onCheckedChange:y=>{y!==a.enabled&&v({enabled:y})}})]}),i("p",{className:"im-small im-muted",children:e.t("settings.deliveryHttp.enabled.description")})]}),a.enabled?i(V,{id:p,label:e.t("settings.deliveryHttp.port.label"),description:e.t("settings.deliveryHttp.port.description"),issue:g?e.t("settingsSection.issue.format"):null,children:i($,{id:p,type:"number",value:a.port,disabled:a.saving,"aria-invalid":g?!0:void 0,"aria-describedby":ne(p,g,!0),onChange:y=>{y.target.value!==a.port&&v({port:y.target.value})}})}):null,a.enabled?i(V,{id:h,label:e.t("settings.deliveryHttp.token.label"),description:e.t("settings.deliveryHttp.token.description"),children:i(ue,{id:h,value:a.token,stored:n.delivery.hasToken,clearing:a.clearToken,disabled:a.saving,invalid:!1,describedBy:ne(h,!1,!0),savedPlaceholder:e.t("settingsSection.secret.saved"),clearLabel:e.t("settingsSection.secret.clear"),undoLabel:e.t("settingsSection.secret.clearUndo"),onChange:y=>{y!==a.token&&v({token:y})},onToggleClear:()=>v({clearToken:!a.clearToken})})}):null,i(ge,{dirty:c,saving:a.saving,solid:o.chosen&&c,failed:a.failed,saveLabel:e.t("settingsSection.save"),revertLabel:e.t("settingsSection.revert"),failedLabel:e.t("settingsSection.saveFailed"),onSave:R,onRevert:()=>{r.current+=1,l(ke(n,t))}})]})})}function Fn(e){let[n,t]=x(!1),{t:o}=e;return s("div",{className:"im-main",role:"region","aria-label":o("settings.deliveryTargets.label"),children:[e.view.targets.map(r=>i(Oe,{target:r,columns:e.columns,proxies:e.proxies,environmentId:e.environmentId,bridge:e.bridge,t:o,onSaved:e.onSaved,onDiscard:()=>{}},r.rowId)),n?i(Oe,{target:null,columns:e.columns,proxies:e.proxies,environmentId:e.environmentId,bridge:e.bridge,t:o,onSaved:r=>{t(!1),e.onSaved(r)},onDiscard:()=>t(!1)},Ce.newSlot):null,i("div",{className:"im-actions",children:i(b,{variant:"outline",disabled:n,onClick:()=>{t(!0),e.activate(W(Ce.newSlot,null))},children:o("settingsSection.target.add")})})]})}var Dn=`
|
|
6
6
|
.im-settings {
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
color: var(--foreground);
|
|
@@ -423,4 +423,4 @@ var Hn=window.__ycodiumPluginHost.react;var{Activity:st,Children:dt,Component:ct
|
|
|
423
423
|
.im-settings .im-detail .im-form {
|
|
424
424
|
grid-template-columns: minmax(0, 1fr);
|
|
425
425
|
}
|
|
426
|
-
`;var Un={},rt=["bots","targets","general"];function $n(e){let n=e.bridge.i18n.usePluginTranslation(),t=B(()=>O(e.environmentId),[e.environmentId]),o=e.bridge.commands.useQuery(De,Un,t),r=e.bridge.commands.useSubscription(Ue,Un,t),a=rn(r),l=B(()=>
|
|
426
|
+
`;var Un={},rt=["bots","targets","general"];function $n(e){let n=e.bridge.i18n.usePluginTranslation(),t=B(()=>O(e.environmentId),[e.environmentId]),o=e.bridge.commands.useQuery(De,Un,t),r=e.bridge.commands.useSubscription(Ue,Un,t),a=rn(r),l=B(()=>wn(o.data),[o.data]),[d,c]=x(null),[g,p]=x(null),[h,w]=x(null),[v,R]=x("bots");if(l!==null&&l!==d&&c(l),g!==null){let f=In(g,{view:l?.view??null,isPending:o.isPending,failed:o.error!==null});f!==g&&p(f)}let y=g?.view??l?.view??d?.view??null,I=l??d,u=l===null&&o.data!==null&&!o.isPending,T=B(()=>Xe(I?.targetColumns??[],y?.bots??[],f=>n(`platform.${f}`)),[I,y,n]);function P(f){p({view:f,phase:"asked"}),o.refresh()}function E(){p(null),o.refresh()}let _;o.isUnavailable?_=i(Le,{variant:"warning",message:n("settingsSection.unavailable"),retryLabel:n("settingsSection.retry"),onRetry:E}):y===null&&o.isPending?_=i("div",{className:"im-pending",children:i(F,{size:"md"})}):y===null||I===null?_=i(Le,{variant:"error",message:n("settingsSection.loadFailed"),retryLabel:n("settingsSection.retry"),onRetry:E}):_=s(Bn,{activeId:h,activate:w,children:[o.error!==null||u?i(Le,{variant:"error",message:n("settingsSection.loadFailed"),retryLabel:n("settingsSection.retry"),onRetry:E}):null,i("div",{className:"im-area-tabs",role:"tablist","aria-label":n("settingsSection.globalTabs"),children:rt.map(f=>i(b,{type:"button",variant:"ghost",size:"sm",role:"tab","aria-selected":v===f,className:"im-area-tab",onClick:()=>R(f),children:n(f==="bots"?"settingsSection.bots":f==="targets"?"settings.deliveryTargets.label":"settingsSection.general")},f))}),v==="bots"?i(Vn,{view:y,snapshot:I,connections:a,environmentId:e.environmentId,bridge:e.bridge,t:n,activate:w,onSaved:P,reload:E}):v==="targets"?i(Fn,{view:y,columns:T,proxies:I.proxies,environmentId:e.environmentId,bridge:e.bridge,t:n,activate:w,onSaved:P}):i("div",{className:"im-main",children:i(Kn,{view:y,environmentId:e.environmentId,bridge:e.bridge,t:n,onSaved:P,open:!0})})]});let m=a===null?null:an(y?.bots??[],a);return i(dn,{bridge:e.bridge,children:s("div",{className:"im-settings",children:[i("style",{children:Dn}),s("div",{className:"im-head",children:[i("h2",{className:"im-heading im-medium im-title",children:n("settings.title")}),m!==null&&m.configured>0?i(G,{tone:"neutral","aria-label":n("settingsSection.onlineLabel",m),children:n("settingsSection.online",m)}):null]}),_]})})}function Le(e){return s(z,{variant:e.variant,layout:"inline",children:[i(Q,{children:e.message}),i(un,{children:i(b,{variant:"ghost",size:"sm",onClick:e.onRetry,children:e.retryLabel})})]})}function lt(e){return{slots:[{name:"settings.section",order:20,component(n){return i($n,{bridge:e,environmentId:n.environmentId??null},n.environmentId??"")}}]}}export{lt as default};
|
package/dist/index.js
CHANGED
|
@@ -132135,6 +132135,8 @@ var parseChatCommand = (input) => {
|
|
|
132135
132135
|
}
|
|
132136
132136
|
const model = modelArgument(input.text, input.chinese);
|
|
132137
132137
|
if (model !== void 0) return { kind: "model", arg: model };
|
|
132138
|
+
if (/^\/models$/iu.test(trimmed)) return { kind: "model", arg: "" };
|
|
132139
|
+
if (/^\/(?:reasoninglist|reasonings)$/iu.test(trimmed)) return { kind: "reasoning", arg: "" };
|
|
132138
132140
|
const reasoning = commandArgument(
|
|
132139
132141
|
trimmed,
|
|
132140
132142
|
input.chinese,
|
|
@@ -133284,6 +133286,7 @@ var buildBotColumns = (adapters, models = [], catalogComplete = true, presets =
|
|
|
133284
133286
|
kind: "text",
|
|
133285
133287
|
labelKey: "column.allowedSenders.label",
|
|
133286
133288
|
descriptionKey: "column.allowedSenders.description",
|
|
133289
|
+
placeholderKey: "column.allowedSenders.placeholder",
|
|
133287
133290
|
// 除了两边都放开的 open,哪一档都至少有一边按名单;缺省/空串=allowlist,也显示。
|
|
133288
133291
|
showWhen: {
|
|
133289
133292
|
key: "accessMode",
|
|
@@ -134740,10 +134743,14 @@ ${body}`);
|
|
|
134740
134743
|
};
|
|
134741
134744
|
|
|
134742
134745
|
// src/reasoningCommand.ts
|
|
134743
|
-
import {
|
|
134746
|
+
import {
|
|
134747
|
+
isReasoningEffortOptionId as isReasoningEffortOptionId3,
|
|
134748
|
+
modelSelectionStringOption as modelSelectionStringOption2
|
|
134749
|
+
} from "@ycodium-ai/plugin-api/executor";
|
|
134744
134750
|
|
|
134745
134751
|
// src/currentModel.ts
|
|
134746
134752
|
import { threadOrNull as threadOrNull3 } from "@ycodium-ai/plugin-api";
|
|
134753
|
+
import { isReasoningEffortOptionId as isReasoningEffortOptionId2 } from "@ycodium-ai/plugin-api/executor";
|
|
134747
134754
|
|
|
134748
134755
|
// src/botModel.ts
|
|
134749
134756
|
var resolveDefaultModel = async (bot, chatModel, projectDefault, providers, knownInstances) => {
|
|
@@ -134757,6 +134764,19 @@ var resolveDefaultModel = async (bot, chatModel, projectDefault, providers, know
|
|
|
134757
134764
|
return projectDefault;
|
|
134758
134765
|
};
|
|
134759
134766
|
|
|
134767
|
+
// src/reasoningOption.ts
|
|
134768
|
+
import {
|
|
134769
|
+
isReasoningEffortOptionId,
|
|
134770
|
+
modelSelectionStringOption
|
|
134771
|
+
} from "@ycodium-ai/plugin-api/executor";
|
|
134772
|
+
var reasoningOption = (model) => model.options.find((option2) => isReasoningEffortOptionId(option2.id) && option2.values.length > 0);
|
|
134773
|
+
var selectedReasoning = (selection) => {
|
|
134774
|
+
const option2 = selection?.options?.find((entry) => isReasoningEffortOptionId(entry.id));
|
|
134775
|
+
if (option2 === void 0) return void 0;
|
|
134776
|
+
const value2 = modelSelectionStringOption(selection, option2.id);
|
|
134777
|
+
return value2 === void 0 ? void 0 : { id: option2.id, value: value2 };
|
|
134778
|
+
};
|
|
134779
|
+
|
|
134760
134780
|
// src/threadUsable.ts
|
|
134761
134781
|
var threadState = (binding, thread) => thread === null || thread.projectId !== binding.projectId ? "gone" : thread.archivedAt == null ? "usable" : "archived";
|
|
134762
134782
|
var threadUsable = (binding, thread) => threadState(binding, thread) === "usable";
|
|
@@ -134792,37 +134812,88 @@ var makeCurrentModelResolver = (core) => {
|
|
|
134792
134812
|
};
|
|
134793
134813
|
};
|
|
134794
134814
|
};
|
|
134795
|
-
var
|
|
134815
|
+
var confirmsSelection = (actual, requested) => actual.instanceId === requested.instanceId && actual.model === requested.model && selectedReasoning(actual)?.value === selectedReasoning(requested)?.value;
|
|
134816
|
+
var withoutReasoningEffort = (selection) => {
|
|
134817
|
+
const kept = (selection.options ?? []).filter((entry) => !isReasoningEffortOptionId2(entry.id));
|
|
134818
|
+
return {
|
|
134819
|
+
instanceId: selection.instanceId,
|
|
134820
|
+
model: selection.model,
|
|
134821
|
+
...kept.length === 0 ? {} : { options: kept }
|
|
134822
|
+
};
|
|
134823
|
+
};
|
|
134824
|
+
var saveAndVerifySelection = async (core, binding, threadId, boundThreadId, requested) => {
|
|
134825
|
+
const chatKey = chatKeyOf(binding);
|
|
134826
|
+
const { host } = core;
|
|
134796
134827
|
if (threadId !== null) {
|
|
134797
134828
|
try {
|
|
134798
|
-
await
|
|
134829
|
+
await host.threads.update({
|
|
134799
134830
|
requestId: crypto.randomUUID(),
|
|
134800
134831
|
threadId,
|
|
134801
|
-
modelSelection:
|
|
134832
|
+
modelSelection: requested
|
|
134802
134833
|
});
|
|
134803
134834
|
} catch (error) {
|
|
134804
|
-
|
|
134805
|
-
|
|
134806
|
-
});
|
|
134807
|
-
return false;
|
|
134835
|
+
host.log.warn("chat could not switch the thread model", { error: describeError(error) });
|
|
134836
|
+
return { kind: "failed" };
|
|
134808
134837
|
}
|
|
134809
134838
|
}
|
|
134810
|
-
core.
|
|
134811
|
-
|
|
134839
|
+
if (chatOf(core.state, chatKey).threadId !== boundThreadId) return { kind: "bindingChanged" };
|
|
134840
|
+
let actual;
|
|
134841
|
+
if (threadId === null) {
|
|
134842
|
+
try {
|
|
134843
|
+
await core.commitDurably("chat-updated", { chatKey, model: requested });
|
|
134844
|
+
} catch {
|
|
134845
|
+
return { kind: "failed" };
|
|
134846
|
+
}
|
|
134847
|
+
if (chatOf(core.state, chatKey).threadId !== boundThreadId) return { kind: "bindingChanged" };
|
|
134848
|
+
actual = chatOf(core.state, chatKey).model;
|
|
134849
|
+
} else {
|
|
134850
|
+
const thread = await threadOrNull3(host.threads, threadId, { archived: "include" }).catch(
|
|
134851
|
+
() => null
|
|
134852
|
+
);
|
|
134853
|
+
if (chatOf(core.state, chatKey).threadId !== boundThreadId) return { kind: "bindingChanged" };
|
|
134854
|
+
actual = thread === null ? null : thread.modelSelection;
|
|
134855
|
+
if (actual !== null)
|
|
134856
|
+
core.commit("chat-updated", { chatKey, model: withoutReasoningEffort(actual) });
|
|
134857
|
+
}
|
|
134858
|
+
if (chatOf(core.state, chatKey).threadId !== boundThreadId) return { kind: "bindingChanged" };
|
|
134859
|
+
return actual !== null && confirmsSelection(actual, requested) ? { kind: "applied", actual } : { kind: "mismatch", actual };
|
|
134812
134860
|
};
|
|
134813
134861
|
|
|
134814
|
-
// src/
|
|
134815
|
-
|
|
134816
|
-
|
|
134817
|
-
|
|
134818
|
-
|
|
134862
|
+
// src/modelRequest.ts
|
|
134863
|
+
var parseModelRequest = (arg, choices) => {
|
|
134864
|
+
const whole = pickModel(arg, choices);
|
|
134865
|
+
if (whole !== null) return { picked: whole, effort: void 0 };
|
|
134866
|
+
const words = arg.trim().split(/\s+/u);
|
|
134867
|
+
if (words.length < 2) return null;
|
|
134868
|
+
const effort = words[words.length - 1];
|
|
134869
|
+
const picked = pickModel(words.slice(0, -1).join(" "), choices);
|
|
134870
|
+
return picked === null || effort === void 0 ? null : { picked, effort };
|
|
134871
|
+
};
|
|
134872
|
+
var pickEffort = (values, wanted) => values.find((entry) => entry === wanted) ?? pickChatChoice(wanted, values, (entry, needle) => entry.toLowerCase() === needle);
|
|
134873
|
+
var effortRejection = (t, model, wanted, values) => {
|
|
134874
|
+
if (values.length === 0) return t("model.effortNone", { model });
|
|
134875
|
+
const shown = values.slice(0, CHAT_CHOICE_LIST_MAX);
|
|
134876
|
+
return [
|
|
134877
|
+
/^\d+$/u.test(wanted) ? t("reasoning.numberOutOfRange", { number: wanted, max: shown.length }) : t("model.effortUnsupported", { model, value: wanted }),
|
|
134878
|
+
t("reasoning.choices", { values: shown.join(" / ") }),
|
|
134879
|
+
...values.length > shown.length ? [t("reasoning.more", { count: values.length - shown.length })] : []
|
|
134880
|
+
].join("\n");
|
|
134819
134881
|
};
|
|
134820
|
-
var
|
|
134821
|
-
var
|
|
134822
|
-
|
|
134823
|
-
|
|
134824
|
-
|
|
134825
|
-
|
|
134882
|
+
var effortText = (t, selection) => selectedReasoning(selection)?.value ?? t("model.effortDefault");
|
|
134883
|
+
var selectionText = (t, selection) => `${rawModelLabel(selection)} \xB7 ${effortText(t, selection)}`;
|
|
134884
|
+
var mismatchText = (t, requested, actual) => t("model.mismatch", {
|
|
134885
|
+
requested: selectionText(t, requested),
|
|
134886
|
+
actual: actual === null ? t("model.unconfirmed") : selectionText(t, actual)
|
|
134887
|
+
});
|
|
134888
|
+
var saveFailureText = (t, saved, requested, failed = "model.setFailed") => {
|
|
134889
|
+
switch (saved.kind) {
|
|
134890
|
+
case "failed":
|
|
134891
|
+
return t(failed);
|
|
134892
|
+
case "bindingChanged":
|
|
134893
|
+
return t("model.bindingChanged");
|
|
134894
|
+
case "mismatch":
|
|
134895
|
+
return mismatchText(t, requested, saved.actual);
|
|
134896
|
+
}
|
|
134826
134897
|
};
|
|
134827
134898
|
|
|
134828
134899
|
// src/reasoningCommand.ts
|
|
@@ -134841,6 +134912,7 @@ var makeReasoningCommand = (core, currentModel) => {
|
|
|
134841
134912
|
return { ...resolved, option: model === void 0 ? void 0 : reasoningOption(model) };
|
|
134842
134913
|
};
|
|
134843
134914
|
return async (binding, arg) => {
|
|
134915
|
+
const boundThreadId = chatOf(core.state, chatKeyOf(binding)).threadId;
|
|
134844
134916
|
const resolved = await readOptions(binding).catch(() => null);
|
|
134845
134917
|
if (resolved === null) {
|
|
134846
134918
|
host.log.warn("chat could not read reasoning options");
|
|
@@ -134860,13 +134932,13 @@ var makeReasoningCommand = (core, currentModel) => {
|
|
|
134860
134932
|
}
|
|
134861
134933
|
const next2 = {
|
|
134862
134934
|
...selection,
|
|
134863
|
-
options: (selection.options ?? []).filter((entry) => !
|
|
134935
|
+
options: (selection.options ?? []).filter((entry) => !isReasoningEffortOptionId3(entry.id))
|
|
134864
134936
|
};
|
|
134865
|
-
|
|
134866
|
-
|
|
134867
|
-
|
|
134868
|
-
|
|
134869
|
-
|
|
134937
|
+
const saved2 = await saveAndVerifySelection(core, binding, threadId, boundThreadId, next2);
|
|
134938
|
+
await deliver(
|
|
134939
|
+
binding,
|
|
134940
|
+
saved2.kind === "applied" ? t(threadId === null ? "reasoning.resetNext" : "reasoning.resetNow") : saveFailureText(t, saved2, next2, "reasoning.setFailed")
|
|
134941
|
+
);
|
|
134870
134942
|
return;
|
|
134871
134943
|
}
|
|
134872
134944
|
if (option2 === void 0) {
|
|
@@ -134893,7 +134965,7 @@ var makeReasoningCommand = (core, currentModel) => {
|
|
|
134893
134965
|
await deliver(binding, text3);
|
|
134894
134966
|
return;
|
|
134895
134967
|
}
|
|
134896
|
-
const value2 =
|
|
134968
|
+
const value2 = pickEffort(option2.values, wanted);
|
|
134897
134969
|
if (value2 === null) {
|
|
134898
134970
|
const shown = option2.values.slice(0, CHAT_CHOICE_LIST_MAX);
|
|
134899
134971
|
await deliver(
|
|
@@ -134910,17 +134982,16 @@ var makeReasoningCommand = (core, currentModel) => {
|
|
|
134910
134982
|
const next = {
|
|
134911
134983
|
...selection,
|
|
134912
134984
|
options: [
|
|
134913
|
-
...(selection.options ?? []).filter((entry) => !
|
|
134985
|
+
...(selection.options ?? []).filter((entry) => !isReasoningEffortOptionId3(entry.id)),
|
|
134914
134986
|
{ id: option2.id, value: value2 }
|
|
134915
134987
|
]
|
|
134916
134988
|
};
|
|
134917
|
-
|
|
134918
|
-
await deliver(binding, t("reasoning.setFailed"));
|
|
134919
|
-
return;
|
|
134920
|
-
}
|
|
134989
|
+
const saved = await saveAndVerifySelection(core, binding, threadId, boundThreadId, next);
|
|
134921
134990
|
await deliver(
|
|
134922
134991
|
binding,
|
|
134923
|
-
t(threadId === null ? "reasoning.setNext" : "reasoning.setNow", {
|
|
134992
|
+
saved.kind === "applied" ? t(threadId === null ? "reasoning.setNext" : "reasoning.setNow", {
|
|
134993
|
+
value: effortText(t, saved.actual)
|
|
134994
|
+
}) : saveFailureText(t, saved, next, "reasoning.setFailed")
|
|
134924
134995
|
);
|
|
134925
134996
|
};
|
|
134926
134997
|
};
|
|
@@ -135015,7 +135086,7 @@ var makePermissionCommand = (core) => {
|
|
|
135015
135086
|
// package.json
|
|
135016
135087
|
var package_default = {
|
|
135017
135088
|
name: "@ycodium-ai/plugin-im",
|
|
135018
|
-
version: "0.2.
|
|
135089
|
+
version: "0.2.3799",
|
|
135019
135090
|
description: "Talk to your agents from Telegram, WeCom, Lark, or WeChat (experimental).",
|
|
135020
135091
|
keywords: [
|
|
135021
135092
|
"im",
|
|
@@ -135059,7 +135130,9 @@ var package_default = {
|
|
|
135059
135130
|
ycodium: {
|
|
135060
135131
|
plugin: "./dist/index.js",
|
|
135061
135132
|
displayName: "Chat bridge",
|
|
135062
|
-
|
|
135133
|
+
displayNameKey: "presentation.name",
|
|
135134
|
+
description: "Talk to Ycodium from Lark, WeCom, and Telegram.",
|
|
135135
|
+
descriptionKey: "presentation.description",
|
|
135063
135136
|
icon: "./assets/icon.svg",
|
|
135064
135137
|
permissions: [
|
|
135065
135138
|
{
|
|
@@ -146756,14 +146829,17 @@ var formatReplyReference = (reference2) => {
|
|
|
146756
146829
|
...lines.map((line) => `> ${line}`)
|
|
146757
146830
|
].join("\n");
|
|
146758
146831
|
};
|
|
146832
|
+
var inboundSenderName = (message, rowId, t) => {
|
|
146833
|
+
const name = cleanString2(message.senderName, AUTHOR_MAX).value;
|
|
146834
|
+
if (name) return name;
|
|
146835
|
+
if (message.senderId === null) return null;
|
|
146836
|
+
const code2 = NodeCrypto4.createHash("sha256").update(JSON.stringify([rowId, message.senderId])).digest("hex").slice(0, 4);
|
|
146837
|
+
return t("source.member", { code: code2 });
|
|
146838
|
+
};
|
|
146759
146839
|
var textWithInboundContext = (message, rowId, t, topicRoot, delayedDelivery) => {
|
|
146760
146840
|
let text3 = [formatReplyReference(topicRoot), formatReplyReference(message.replyTo), message.text].filter((part) => part !== null).join("\n\n");
|
|
146761
146841
|
if (message.chatKind === "group" && message.senderId !== null) {
|
|
146762
|
-
|
|
146763
|
-
if (!name) {
|
|
146764
|
-
const code2 = NodeCrypto4.createHash("sha256").update(JSON.stringify([rowId, message.senderId])).digest("hex").slice(0, 4);
|
|
146765
|
-
name = t("source.member", { code: code2 });
|
|
146766
|
-
}
|
|
146842
|
+
const name = inboundSenderName(message, rowId, t) ?? "";
|
|
146767
146843
|
const chat = cleanString2(message.chatTitle, AUTHOR_MAX).value;
|
|
146768
146844
|
const source = chat ? t("source.fromChat", { name, chat }) : t("source.from", { name });
|
|
146769
146845
|
text3 = `${source}
|
|
@@ -147140,6 +147216,10 @@ var makeLarkCallbackProbe = (deps) => {
|
|
|
147140
147216
|
|
|
147141
147217
|
// locales/en.json
|
|
147142
147218
|
var en_default = {
|
|
147219
|
+
presentation: {
|
|
147220
|
+
name: "Chat bridge",
|
|
147221
|
+
description: "Talk to Ycodium from Lark, WeCom, and Telegram."
|
|
147222
|
+
},
|
|
147143
147223
|
source: {
|
|
147144
147224
|
fromChat: "From {{name}} in {{chat}}:",
|
|
147145
147225
|
from: "From {{name}}:",
|
|
@@ -147250,7 +147330,8 @@ var en_default = {
|
|
|
147250
147330
|
},
|
|
147251
147331
|
allowedSenders: {
|
|
147252
147332
|
label: "Allowed people",
|
|
147253
|
-
description: "Comma-separated user ids from that platform. Used in chats where the access mode requires the allowlist; while the list is empty, nobody can use the bot in those chats. To find an id: from an account not yet on the list, message the bot in a chat that requires the allowlist (mention it in a group). The bot replies with the id, at most once every 10 minutes per account."
|
|
147333
|
+
description: "Comma-separated user ids from that platform. Used in chats where the access mode requires the allowlist; while the list is empty, nobody can use the bot in those chats. To find an id: from an account not yet on the list, message the bot in a chat that requires the allowlist (mention it in a group). The bot replies with the id, at most once every 10 minutes per account.",
|
|
147334
|
+
placeholder: "Nobody"
|
|
147254
147335
|
},
|
|
147255
147336
|
proxy: {
|
|
147256
147337
|
label: "Proxy",
|
|
@@ -147567,7 +147648,7 @@ var en_default = {
|
|
|
147567
147648
|
archived: "\xB7 /archived on|off \u2014 include archived sessions in this chat's session list; /archived alone shows the current setting",
|
|
147568
147649
|
resume: "\xB7 /resume number-or-id-prefix \u2014 switch sessions; one from another project switches the project too",
|
|
147569
147650
|
history: "\xB7 /history [count] \u2014 preview recent messages in the current session, in private chats only (default {{defaultCount}}, maximum {{maxCount}})",
|
|
147570
|
-
model: "\xB7 /model \u2014 see the model this chat uses; /model number or /model instance/model switches it",
|
|
147651
|
+
model: "\xB7 /model \u2014 see the model this chat uses; /model number or /model instance/model switches it, and a reasoning effort after it sets both (/model number effort); /models lists the models",
|
|
147571
147652
|
reasoning: "\xB7 /reasoning \u2014 see the reasoning effort for this chat's current model; /reasoning value or /reasoning number switches it; /reasoning default resets it to the model default",
|
|
147572
147653
|
preset: "\xB7 /preset \u2014 see the preset this chat uses for new sessions; /preset number or /preset name-or-id switches it; /preset none clears the chat choice",
|
|
147573
147654
|
plan: "\xB7 /plan \u2014 toggle plan mode (the agent proposes a plan instead of acting); /plan on, /plan off set it",
|
|
@@ -147591,9 +147672,8 @@ var en_default = {
|
|
|
147591
147672
|
unsupported: "The current model does not support switching the reasoning effort.",
|
|
147592
147673
|
readFailed: "Could not read the reasoning options. Try again in a moment.",
|
|
147593
147674
|
setFailed: "Switching the reasoning effort failed. Try again in a moment.",
|
|
147594
|
-
setNow: "Reasoning effort set to {{value}}. The current session uses it from the next turn
|
|
147595
|
-
setNext: "Reasoning effort set to {{value}}.
|
|
147596
|
-
unsupportedKept: "This model does not support the reasoning effort {{value}}, so it runs on the model default. The setting is kept and comes back if you switch back.",
|
|
147675
|
+
setNow: "Reasoning effort set to {{value}}. The current session uses it from the next turn.",
|
|
147676
|
+
setNext: "Reasoning effort set to {{value}}. The next session in this chat will use it.",
|
|
147597
147677
|
noModel: "This chat has no model yet. Pick one with /model first.",
|
|
147598
147678
|
switchReadFailed: "Could not read the new model's reasoning efforts, so the model was not switched. Try again in a moment.",
|
|
147599
147679
|
listTitlePlain: "Available reasoning efforts:"
|
|
@@ -147700,11 +147780,18 @@ var en_default = {
|
|
|
147700
147780
|
unavailable: "The available models cannot be read right now, so the model cannot be switched.",
|
|
147701
147781
|
listTitle: "Available models:",
|
|
147702
147782
|
more: "{{count}} more not shown \u2014 pick one with /model instance/model.",
|
|
147703
|
-
footer: "Switch with /model number, or /model instance/model.",
|
|
147783
|
+
footer: "Switch with /model number, or /model instance/model. Add a reasoning effort to set both: /model number effort.",
|
|
147704
147784
|
notFound: 'No single model matches "{{query}}". Use /model to see the list.',
|
|
147705
147785
|
setNow: "Model set to {{model}}. The current session uses it from its next turn.",
|
|
147706
147786
|
setNext: "Model set to {{model}}. It applies to the next new session.",
|
|
147707
|
-
setFailed: "Could not switch the current session's model. Try again in a moment."
|
|
147787
|
+
setFailed: "Could not switch the current session's model. Try again in a moment.",
|
|
147788
|
+
effort: "Reasoning effort: {{effort}}",
|
|
147789
|
+
effortDefault: "model default",
|
|
147790
|
+
effortNone: "{{model}} has no reasoning effort to choose, so the model was not switched.",
|
|
147791
|
+
effortUnsupported: '{{model}} does not support the reasoning effort "{{value}}", so the model was not switched.',
|
|
147792
|
+
mismatch: "The switch was not confirmed by the session. Requested: {{requested}}. Actual: {{actual}}.",
|
|
147793
|
+
unconfirmed: "not confirmed",
|
|
147794
|
+
bindingChanged: "This chat's session changed during the switch. Try again."
|
|
147708
147795
|
},
|
|
147709
147796
|
plan: {
|
|
147710
147797
|
on: "Plan mode is on: from the next message the agent proposes a plan instead of acting. Send /plan off to leave it.",
|
|
@@ -148199,6 +148286,10 @@ var en_default = {
|
|
|
148199
148286
|
|
|
148200
148287
|
// locales/zh-CN.json
|
|
148201
148288
|
var zh_CN_default = {
|
|
148289
|
+
presentation: {
|
|
148290
|
+
name: "\u804A\u5929\u6865",
|
|
148291
|
+
description: "\u4ECE\u98DE\u4E66\u3001\u4F01\u4E1A\u5FAE\u4FE1\u3001Telegram \u8FDE\u5230 Ycodium\u3002"
|
|
148292
|
+
},
|
|
148202
148293
|
source: {
|
|
148203
148294
|
fromChat: "\u6765\u81EA {{name}}\uFF08{{chat}}\uFF09\uFF1A",
|
|
148204
148295
|
from: "\u6765\u81EA {{name}}\uFF1A",
|
|
@@ -148309,7 +148400,8 @@ var zh_CN_default = {
|
|
|
148309
148400
|
},
|
|
148310
148401
|
allowedSenders: {
|
|
148311
148402
|
label: "\u5141\u8BB8\u7684\u4EBA",
|
|
148312
|
-
description: "\u8BE5\u5E73\u53F0\u7684\u7528\u6237 id\uFF0C\u9017\u53F7\u5206\u9694\u3002\u5728\u8BBF\u95EE\u6A21\u5F0F\u8981\u6C42\u540D\u5355\u7684\u804A\u5929\u91CC\u751F\u6548\uFF1B\u7559\u7A7A\u5219\u8C01\u90FD\u4E0D\u80FD\u5728\u8FD9\u4E9B\u804A\u5929\u91CC\u4F7F\u7528\u673A\u5668\u4EBA\u3002\u67E5 id\uFF1A\u7528\u8FD8\u4E0D\u5728\u540D\u5355\u4E0A\u7684\u8D26\u53F7\uFF0C\u5728\u8981\u6C42\u540D\u5355\u7684\u804A\u5929\u91CC\u7ED9\u673A\u5668\u4EBA\u53D1\u4E00\u53E5\u8BDD\uFF08\u7FA4\u91CC\u8981 @ \u5B83\uFF09\uFF0C\u5B83\u4F1A\u56DE\u590D\u8FD9\u4E2A id\uFF1B\u540C\u4E00\u8D26\u53F7 10 \u5206\u949F\u5185\u53EA\u56DE\u4E00\u6B21\u3002"
|
|
148403
|
+
description: "\u8BE5\u5E73\u53F0\u7684\u7528\u6237 id\uFF0C\u9017\u53F7\u5206\u9694\u3002\u5728\u8BBF\u95EE\u6A21\u5F0F\u8981\u6C42\u540D\u5355\u7684\u804A\u5929\u91CC\u751F\u6548\uFF1B\u7559\u7A7A\u5219\u8C01\u90FD\u4E0D\u80FD\u5728\u8FD9\u4E9B\u804A\u5929\u91CC\u4F7F\u7528\u673A\u5668\u4EBA\u3002\u67E5 id\uFF1A\u7528\u8FD8\u4E0D\u5728\u540D\u5355\u4E0A\u7684\u8D26\u53F7\uFF0C\u5728\u8981\u6C42\u540D\u5355\u7684\u804A\u5929\u91CC\u7ED9\u673A\u5668\u4EBA\u53D1\u4E00\u53E5\u8BDD\uFF08\u7FA4\u91CC\u8981 @ \u5B83\uFF09\uFF0C\u5B83\u4F1A\u56DE\u590D\u8FD9\u4E2A id\uFF1B\u540C\u4E00\u8D26\u53F7 10 \u5206\u949F\u5185\u53EA\u56DE\u4E00\u6B21\u3002",
|
|
148404
|
+
placeholder: "\u6CA1\u6709\u4EBA"
|
|
148313
148405
|
},
|
|
148314
148406
|
proxy: {
|
|
148315
148407
|
label: "\u4EE3\u7406",
|
|
@@ -148626,7 +148718,7 @@ var zh_CN_default = {
|
|
|
148626
148718
|
archived: "\xB7 /archived on|off \u2014\u2014 \u8BA9\u8FD9\u4E2A\u804A\u5929\u7684\u4F1A\u8BDD\u5217\u8868\u5E26\u4E0A\uFF08on\uFF09\u6216\u4E0D\u5E26\uFF08off\uFF09\u5DF2\u5F52\u6863\u7684\u4F1A\u8BDD\uFF1B/archived \u770B\u5F53\u524D\u5F00\u5173",
|
|
148627
148719
|
resume: "\xB7 /resume \u7F16\u53F7\u6216 id \u5F00\u5934 \u2014\u2014 \u5207\u4F1A\u8BDD\uFF1B\u522B\u7684\u9879\u76EE\u7684\u4F1A\u8BDD\u4F1A\u8FDE\u540C\u9879\u76EE\u4E00\u8D77\u5207",
|
|
148628
148720
|
history: "\xB7 /history [\u6570\u91CF] \u2014\u2014 \u4EC5\u79C1\u804A\uFF1A\u67E5\u770B\u5F53\u524D\u4F1A\u8BDD\u6700\u8FD1\u7684\u6D88\u606F\uFF08\u9ED8\u8BA4 {{defaultCount}} \u6761\uFF0C\u6700\u591A {{maxCount}} \u6761\uFF09",
|
|
148629
|
-
model: "\xB7 /model \u2014\u2014 \u770B\u8FD9\u4E2A\u804A\u5929\u7528\u7684\u6A21\u578B\uFF1B/model \u7F16\u53F7 \u6216 /model \u5B9E\u4F8B/\u6A21\u578B \u5207\u6362",
|
|
148721
|
+
model: "\xB7 /model \u2014\u2014 \u770B\u8FD9\u4E2A\u804A\u5929\u7528\u7684\u6A21\u578B\uFF1B/model \u7F16\u53F7 \u6216 /model \u5B9E\u4F8B/\u6A21\u578B \u5207\u6362\uFF0C\u540E\u9762\u518D\u5199\u601D\u8003\u5F3A\u5EA6\u5C31\u4E00\u5E76\u8BBE\u5B9A\uFF08/model \u7F16\u53F7 \u5F3A\u5EA6\uFF09\uFF1B/models \u5217\u51FA\u53EF\u9009\u6A21\u578B",
|
|
148630
148722
|
reasoning: "\xB7 /reasoning \u2014\u2014 \u770B\u8FD9\u4E2A\u804A\u5929\u5F53\u524D\u6A21\u578B\u7684\u601D\u8003\u5F3A\u5EA6\uFF1B/reasoning \u53D6\u503C \u6216 /reasoning \u7F16\u53F7 \u5207\u6362\uFF1B/reasoning default \u6062\u590D\u6A21\u578B\u9ED8\u8BA4",
|
|
148631
148723
|
preset: "\xB7 /preset \u2014\u2014 \u770B\u8FD9\u4E2A\u804A\u5929\u65B0\u4F1A\u8BDD\u7528\u7684\u9884\u8BBE\uFF1B/preset \u7F16\u53F7 \u6216 /preset \u540D\u5B57\u6216 id \u5207\u6362\uFF1B/preset none \u6E05\u6389\u804A\u5929\u9009\u62E9",
|
|
148632
148724
|
plan: "\xB7 /plan \u2014\u2014 \u5F00\u5173\u8BA1\u5212\u6A21\u5F0F\uFF08agent \u5148\u51FA\u8BA1\u5212\u3001\u4E0D\u52A8\u624B\uFF09\uFF1B/plan on\u3001/plan off \u660E\u786E\u8BBE\u5B9A",
|
|
@@ -148650,9 +148742,8 @@ var zh_CN_default = {
|
|
|
148650
148742
|
unsupported: "\u5F53\u524D\u6A21\u578B\u4E0D\u652F\u6301\u5207\u6362\u601D\u8003\u5F3A\u5EA6\u3002",
|
|
148651
148743
|
readFailed: "\u6682\u65F6\u8BFB\u4E0D\u5230\u601D\u8003\u5F3A\u5EA6\u9009\u9879\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
|
|
148652
148744
|
setFailed: "\u5207\u6362\u601D\u8003\u5F3A\u5EA6\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
|
|
148653
|
-
setNow: "\u601D\u8003\u5F3A\u5EA6\u5DF2\u8BBE\u4E3A {{value}}\uFF0C\u5F53\u524D\u4F1A\u8BDD\u4ECE\u4E0B\u4E00\u8F6E\u8D77\u4F7F\u7528\u5B83\
|
|
148654
|
-
setNext: "\u601D\u8003\u5F3A\u5EA6\u5DF2\u8BBE\u4E3A {{value}}\uFF0C\u8FD9\u4E2A\u804A\u5929\u7684\
|
|
148655
|
-
unsupportedKept: "\u6B64\u578B\u53F7\u4E0D\u652F\u6301\u601D\u8003\u5F3A\u5EA6 {{value}}\uFF0C\u6309\u6A21\u578B\u9ED8\u8BA4\u8FD0\u884C\u3002\u539F\u8BBE\u7F6E\u4FDD\u7559\uFF0C\u6362\u56DE\u539F\u578B\u53F7\u4F1A\u6062\u590D\u3002",
|
|
148745
|
+
setNow: "\u601D\u8003\u5F3A\u5EA6\u5DF2\u8BBE\u4E3A {{value}}\uFF0C\u5F53\u524D\u4F1A\u8BDD\u4ECE\u4E0B\u4E00\u8F6E\u8D77\u4F7F\u7528\u5B83\u3002",
|
|
148746
|
+
setNext: "\u601D\u8003\u5F3A\u5EA6\u5DF2\u8BBE\u4E3A {{value}}\uFF0C\u8FD9\u4E2A\u804A\u5929\u7684\u4E0B\u4E00\u6761\u4F1A\u8BDD\u5C06\u4F7F\u7528\u5B83\u3002",
|
|
148656
148747
|
noModel: "\u8FD9\u4E2A\u804A\u5929\u8FD8\u6CA1\u6709\u6A21\u578B\uFF0C\u5148\u7528 /model \u9009\u4E00\u4E2A\u3002",
|
|
148657
148748
|
switchReadFailed: "\u6682\u65F6\u8BFB\u4E0D\u5230\u65B0\u6A21\u578B\u7684\u601D\u8003\u5F3A\u5EA6\u9009\u9879\uFF0C\u6A21\u578B\u6CA1\u6709\u5207\u6362\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
|
|
148658
148749
|
listTitlePlain: "\u53EF\u9009\u601D\u8003\u5F3A\u5EA6\uFF1A"
|
|
@@ -148759,11 +148850,18 @@ var zh_CN_default = {
|
|
|
148759
148850
|
unavailable: "\u73B0\u5728\u8BFB\u4E0D\u51FA\u53EF\u9009\u7684\u6A21\u578B\uFF0C\u6CA1\u6CD5\u5207\u6362\u6A21\u578B\u3002",
|
|
148760
148851
|
listTitle: "\u53EF\u9009\u7684\u6A21\u578B\uFF1A",
|
|
148761
148852
|
more: "\u8FD8\u6709 {{count}} \u4E2A\u6CA1\u5217\u51FA\u2014\u2014\u7528 /model \u5B9E\u4F8B/\u6A21\u578B \u4E5F\u80FD\u9009\u5230\u3002",
|
|
148762
|
-
footer: "\u7528 /model \u7F16\u53F7 \u5207\u6362\uFF0C\u6216 /model \u5B9E\u4F8B/\u6A21\u578B\u3002",
|
|
148853
|
+
footer: "\u7528 /model \u7F16\u53F7 \u5207\u6362\uFF0C\u6216 /model \u5B9E\u4F8B/\u6A21\u578B\u3002\u540E\u9762\u52A0\u601D\u8003\u5F3A\u5EA6\u53EF\u4E00\u5E76\u8BBE\u5B9A\uFF1A/model \u7F16\u53F7 \u5F3A\u5EA6\u3002",
|
|
148763
148854
|
notFound: "\u6CA1\u6709\u552F\u4E00\u5BF9\u5F97\u4E0A\u300C{{query}}\u300D\u7684\u6A21\u578B\u3002\u7528 /model \u770B\u770B\u6709\u54EA\u4E9B\u3002",
|
|
148764
148855
|
setNow: "\u6A21\u578B\u5DF2\u8BBE\u4E3A {{model}}\uFF0C\u5F53\u524D\u4F1A\u8BDD\u4ECE\u4E0B\u4E00\u8F6E\u8D77\u7528\u5B83\u3002",
|
|
148765
148856
|
setNext: "\u6A21\u578B\u5DF2\u8BBE\u4E3A {{model}}\uFF0C\u4E0B\u4E00\u6761\u65B0\u4F1A\u8BDD\u8D77\u7528\u5B83\u3002",
|
|
148766
|
-
setFailed: "\u6CA1\u80FD\u5207\u6362\u5F53\u524D\u4F1A\u8BDD\u7684\u6A21\u578B\uFF0C\u7A0D\u540E\u518D\u8BD5\u3002"
|
|
148857
|
+
setFailed: "\u6CA1\u80FD\u5207\u6362\u5F53\u524D\u4F1A\u8BDD\u7684\u6A21\u578B\uFF0C\u7A0D\u540E\u518D\u8BD5\u3002",
|
|
148858
|
+
effort: "\u601D\u8003\u5F3A\u5EA6\uFF1A{{effort}}",
|
|
148859
|
+
effortDefault: "\u6A21\u578B\u9ED8\u8BA4",
|
|
148860
|
+
effortNone: "{{model}} \u6CA1\u6709\u53EF\u9009\u7684\u601D\u8003\u5F3A\u5EA6\uFF0C\u6A21\u578B\u6CA1\u6709\u5207\u6362\u3002",
|
|
148861
|
+
effortUnsupported: "{{model}} \u4E0D\u652F\u6301\u601D\u8003\u5F3A\u5EA6\u300C{{value}}\u300D\uFF0C\u6A21\u578B\u6CA1\u6709\u5207\u6362\u3002",
|
|
148862
|
+
mismatch: "\u4F1A\u8BDD\u6CA1\u6709\u786E\u8BA4\u8FD9\u6B21\u5207\u6362\u3002\u8981\u6C42\uFF1A{{requested}}\u3002\u5B9E\u9645\uFF1A{{actual}}\u3002",
|
|
148863
|
+
unconfirmed: "\u672A\u786E\u8BA4",
|
|
148864
|
+
bindingChanged: "\u5207\u6362\u671F\u95F4\u8FD9\u4E2A\u804A\u5929\u7ED1\u5B9A\u7684\u4F1A\u8BDD\u53D8\u4E86\uFF0C\u8BF7\u91CD\u8BD5\u3002"
|
|
148767
148865
|
},
|
|
148768
148866
|
plan: {
|
|
148769
148867
|
on: "\u8BA1\u5212\u6A21\u5F0F\u5DF2\u5F00\uFF1A\u4ECE\u4E0B\u4E00\u6761\u6D88\u606F\u8D77\uFF0Cagent \u5148\u51FA\u8BA1\u5212\u3001\u4E0D\u52A8\u624B\u3002\u53D1 /plan off \u9000\u51FA\u3002",
|
|
@@ -150052,6 +150150,7 @@ var makeLarkAdapter = (deps) => {
|
|
|
150052
150150
|
};
|
|
150053
150151
|
|
|
150054
150152
|
// src/modelPlan.ts
|
|
150153
|
+
import { isReasoningEffortOptionId as isReasoningEffortOptionId4 } from "@ycodium-ai/plugin-api/executor";
|
|
150055
150154
|
var makeModelPlan = (core) => {
|
|
150056
150155
|
const { host, t, commit, deliver } = core;
|
|
150057
150156
|
const resolveCurrentModel = makeCurrentModelResolver(core);
|
|
@@ -150063,6 +150162,7 @@ var makeModelPlan = (core) => {
|
|
|
150063
150162
|
return selection;
|
|
150064
150163
|
};
|
|
150065
150164
|
const handleModel = async (binding, arg) => {
|
|
150165
|
+
const boundThreadId = chatOf(core.state, chatKeyOf(binding)).threadId;
|
|
150066
150166
|
const instances = await host.providers.instances.list({}).catch(() => null);
|
|
150067
150167
|
const choices = instances === null ? [] : modelChoices(await pickableInstances(host.providers, instances));
|
|
150068
150168
|
if (arg === "") {
|
|
@@ -150073,44 +150173,52 @@ var makeModelPlan = (core) => {
|
|
|
150073
150173
|
await deliver(binding, t("model.unavailable"));
|
|
150074
150174
|
return;
|
|
150075
150175
|
}
|
|
150076
|
-
const
|
|
150077
|
-
if (
|
|
150176
|
+
const request = parseModelRequest(arg, choices);
|
|
150177
|
+
if (request === null) {
|
|
150078
150178
|
await deliver(binding, t("model.notFound", { query: arg }));
|
|
150079
150179
|
return;
|
|
150080
150180
|
}
|
|
150081
|
-
const {
|
|
150082
|
-
|
|
150083
|
-
|
|
150084
|
-
|
|
150085
|
-
const previous = selectedReasoning(current);
|
|
150086
|
-
let carried = (current?.options ?? []).filter(
|
|
150087
|
-
(entry) => typeof entry.value !== "string" || entry.value.trim() !== ""
|
|
150088
|
-
);
|
|
150089
|
-
if (previous !== void 0) {
|
|
150181
|
+
const { picked, effort: effortQuery } = request;
|
|
150182
|
+
let chosen;
|
|
150183
|
+
if (effortQuery !== void 0) {
|
|
150184
|
+
let option2;
|
|
150090
150185
|
try {
|
|
150091
150186
|
const catalog = await host.providers.models.list({
|
|
150092
150187
|
instanceId: picked.instanceId,
|
|
150093
150188
|
includeHidden: true
|
|
150094
150189
|
});
|
|
150095
150190
|
const model = catalog.models.find((entry) => entry.slug === picked.model);
|
|
150096
|
-
|
|
150097
|
-
if (option2 !== void 0 && option2.values.includes(previous.value))
|
|
150098
|
-
carried = carried.map(
|
|
150099
|
-
(entry) => entry.id === previous.id ? { id: option2.id, value: previous.value } : entry
|
|
150100
|
-
);
|
|
150191
|
+
option2 = model === void 0 ? void 0 : reasoningOption(model);
|
|
150101
150192
|
} catch {
|
|
150102
150193
|
host.log.warn("chat could not read reasoning options for a model switch");
|
|
150103
150194
|
await deliver(binding, t("reasoning.switchReadFailed"));
|
|
150104
150195
|
return;
|
|
150105
150196
|
}
|
|
150197
|
+
const value2 = option2 === void 0 ? null : pickEffort(option2.values, effortQuery);
|
|
150198
|
+
if (option2 === void 0 || value2 === null) {
|
|
150199
|
+
await deliver(
|
|
150200
|
+
binding,
|
|
150201
|
+
effortRejection(t, modelLabel(picked), effortQuery, option2?.values ?? [])
|
|
150202
|
+
);
|
|
150203
|
+
return;
|
|
150204
|
+
}
|
|
150205
|
+
chosen = { id: option2.id, value: value2 };
|
|
150106
150206
|
}
|
|
150207
|
+
const { selection: current, threadId } = await resolveCurrentModel(binding, {
|
|
150208
|
+
instances,
|
|
150209
|
+
onReadError: () => null
|
|
150210
|
+
});
|
|
150211
|
+
const carried = (current?.options ?? []).filter(
|
|
150212
|
+
(entry) => !isReasoningEffortOptionId4(entry.id) && (typeof entry.value !== "string" || entry.value.trim() !== "")
|
|
150213
|
+
);
|
|
150214
|
+
const options = chosen === void 0 ? carried : [...carried, chosen];
|
|
150107
150215
|
let resolved;
|
|
150108
150216
|
try {
|
|
150109
150217
|
resolved = await host.providers.selection.resolve({
|
|
150110
150218
|
base: {
|
|
150111
150219
|
instanceId: picked.instanceId,
|
|
150112
150220
|
model: picked.model,
|
|
150113
|
-
...
|
|
150221
|
+
...options.length === 0 ? {} : { options }
|
|
150114
150222
|
},
|
|
150115
150223
|
instanceId: picked.instanceId,
|
|
150116
150224
|
model: picked.model,
|
|
@@ -150127,20 +150235,24 @@ var makeModelPlan = (core) => {
|
|
|
150127
150235
|
await deliver(binding, t("model.setFailed"));
|
|
150128
150236
|
return;
|
|
150129
150237
|
}
|
|
150130
|
-
const
|
|
150131
|
-
|
|
150238
|
+
const saved = await saveAndVerifySelection(
|
|
150239
|
+
core,
|
|
150240
|
+
binding,
|
|
150241
|
+
threadId,
|
|
150242
|
+
boundThreadId,
|
|
150243
|
+
resolved.modelSelection
|
|
150132
150244
|
);
|
|
150133
|
-
if (
|
|
150134
|
-
await deliver(
|
|
150245
|
+
if (saved.kind === "applied") {
|
|
150246
|
+
await deliver(
|
|
150247
|
+
binding,
|
|
150248
|
+
[
|
|
150249
|
+
t(threadId === null ? "model.setNext" : "model.setNow", { model: modelLabel(picked) }),
|
|
150250
|
+
t("model.effort", { effort: effortText(t, saved.actual) })
|
|
150251
|
+
].join("\n")
|
|
150252
|
+
);
|
|
150135
150253
|
return;
|
|
150136
150254
|
}
|
|
150137
|
-
await deliver(
|
|
150138
|
-
binding,
|
|
150139
|
-
[
|
|
150140
|
-
t(threadId === null ? "model.setNext" : "model.setNow", { model: modelLabel(picked) }),
|
|
150141
|
-
...unsupported
|
|
150142
|
-
].join("\n")
|
|
150143
|
-
);
|
|
150255
|
+
await deliver(binding, saveFailureText(t, saved, resolved.modelSelection));
|
|
150144
150256
|
};
|
|
150145
150257
|
const handlePlan = async (binding, mode) => {
|
|
150146
150258
|
if (mode === "invalid") {
|
|
@@ -153475,6 +153587,10 @@ var makeTurns = (core, deps) => {
|
|
|
153475
153587
|
openedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
153476
153588
|
platform: binding.platform
|
|
153477
153589
|
});
|
|
153590
|
+
const pending = chatOf(core.state, chatKey).model;
|
|
153591
|
+
if (pending !== null && selectedReasoning(pending) !== void 0) {
|
|
153592
|
+
commit("chat-updated", { chatKey, model: withoutReasoningEffort(pending) });
|
|
153593
|
+
}
|
|
153478
153594
|
rememberThreadProject(createdThreadId, binding.projectId);
|
|
153479
153595
|
if (dropped) await deliver(binding, t("reply.threadGone"));
|
|
153480
153596
|
return createdThreadId;
|
|
@@ -153603,6 +153719,7 @@ var makeTurns = (core, deps) => {
|
|
|
153603
153719
|
const attachments = saved.stored;
|
|
153604
153720
|
const notes = saved.notes;
|
|
153605
153721
|
const userMessageId = identity2("msg", binding, message);
|
|
153722
|
+
const sender = inboundSenderName(message, binding.rowId, t);
|
|
153606
153723
|
deps.anchors.note(threadId, userMessageId, binding);
|
|
153607
153724
|
if (!options.steer && binding.queueMode === "steer") {
|
|
153608
153725
|
try {
|
|
@@ -153645,7 +153762,8 @@ var makeTurns = (core, deps) => {
|
|
|
153645
153762
|
titleSeed: titleFrom(options.batch?.title ?? (text3 || attachments[0]?.name || "Chat")),
|
|
153646
153763
|
runtimeMode: runtimeModeOf(binding),
|
|
153647
153764
|
interactionMode: interactionModeOf(chatKey),
|
|
153648
|
-
...intentAction !== void 0 ? { intentAction } : {}
|
|
153765
|
+
...intentAction !== void 0 ? { intentAction } : {},
|
|
153766
|
+
...sender === null ? {} : { forwardedFrom: { displayName: sender } }
|
|
153649
153767
|
},
|
|
153650
153768
|
inbox,
|
|
153651
153769
|
restoreCarried,
|
|
@@ -157226,7 +157344,7 @@ var makeWecomAppAdapter = (deps) => {
|
|
|
157226
157344
|
// src/index.ts
|
|
157227
157345
|
var definition = {
|
|
157228
157346
|
id: "im",
|
|
157229
|
-
apiVersion:
|
|
157347
|
+
apiVersion: 60,
|
|
157230
157348
|
// 第二个参数只给插件自己的测试夹具:换掉文件 IO 与派发重试的等待。宿主只传 ctx。
|
|
157231
157349
|
activate: async (ctx, testing = {}) => {
|
|
157232
157350
|
const { dispatchSleep } = testing;
|
package/locales/en.json
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
+
"presentation": {
|
|
3
|
+
"name": "Chat bridge",
|
|
4
|
+
"description": "Talk to Ycodium from Lark, WeCom, and Telegram."
|
|
5
|
+
},
|
|
2
6
|
"source": {
|
|
3
7
|
"fromChat": "From {{name}} in {{chat}}:",
|
|
4
8
|
"from": "From {{name}}:",
|
|
@@ -109,7 +113,8 @@
|
|
|
109
113
|
},
|
|
110
114
|
"allowedSenders": {
|
|
111
115
|
"label": "Allowed people",
|
|
112
|
-
"description": "Comma-separated user ids from that platform. Used in chats where the access mode requires the allowlist; while the list is empty, nobody can use the bot in those chats. To find an id: from an account not yet on the list, message the bot in a chat that requires the allowlist (mention it in a group). The bot replies with the id, at most once every 10 minutes per account."
|
|
116
|
+
"description": "Comma-separated user ids from that platform. Used in chats where the access mode requires the allowlist; while the list is empty, nobody can use the bot in those chats. To find an id: from an account not yet on the list, message the bot in a chat that requires the allowlist (mention it in a group). The bot replies with the id, at most once every 10 minutes per account.",
|
|
117
|
+
"placeholder": "Nobody"
|
|
113
118
|
},
|
|
114
119
|
"proxy": {
|
|
115
120
|
"label": "Proxy",
|
|
@@ -426,7 +431,7 @@
|
|
|
426
431
|
"archived": "· /archived on|off — include archived sessions in this chat's session list; /archived alone shows the current setting",
|
|
427
432
|
"resume": "· /resume number-or-id-prefix — switch sessions; one from another project switches the project too",
|
|
428
433
|
"history": "· /history [count] — preview recent messages in the current session, in private chats only (default {{defaultCount}}, maximum {{maxCount}})",
|
|
429
|
-
"model": "· /model — see the model this chat uses; /model number or /model instance/model switches it",
|
|
434
|
+
"model": "· /model — see the model this chat uses; /model number or /model instance/model switches it, and a reasoning effort after it sets both (/model number effort); /models lists the models",
|
|
430
435
|
"reasoning": "· /reasoning — see the reasoning effort for this chat's current model; /reasoning value or /reasoning number switches it; /reasoning default resets it to the model default",
|
|
431
436
|
"preset": "· /preset — see the preset this chat uses for new sessions; /preset number or /preset name-or-id switches it; /preset none clears the chat choice",
|
|
432
437
|
"plan": "· /plan — toggle plan mode (the agent proposes a plan instead of acting); /plan on, /plan off set it",
|
|
@@ -450,9 +455,8 @@
|
|
|
450
455
|
"unsupported": "The current model does not support switching the reasoning effort.",
|
|
451
456
|
"readFailed": "Could not read the reasoning options. Try again in a moment.",
|
|
452
457
|
"setFailed": "Switching the reasoning effort failed. Try again in a moment.",
|
|
453
|
-
"setNow": "Reasoning effort set to {{value}}. The current session uses it from the next turn
|
|
454
|
-
"setNext": "Reasoning effort set to {{value}}.
|
|
455
|
-
"unsupportedKept": "This model does not support the reasoning effort {{value}}, so it runs on the model default. The setting is kept and comes back if you switch back.",
|
|
458
|
+
"setNow": "Reasoning effort set to {{value}}. The current session uses it from the next turn.",
|
|
459
|
+
"setNext": "Reasoning effort set to {{value}}. The next session in this chat will use it.",
|
|
456
460
|
"noModel": "This chat has no model yet. Pick one with /model first.",
|
|
457
461
|
"switchReadFailed": "Could not read the new model's reasoning efforts, so the model was not switched. Try again in a moment.",
|
|
458
462
|
"listTitlePlain": "Available reasoning efforts:"
|
|
@@ -559,11 +563,18 @@
|
|
|
559
563
|
"unavailable": "The available models cannot be read right now, so the model cannot be switched.",
|
|
560
564
|
"listTitle": "Available models:",
|
|
561
565
|
"more": "{{count}} more not shown — pick one with /model instance/model.",
|
|
562
|
-
"footer": "Switch with /model number, or /model instance/model.",
|
|
566
|
+
"footer": "Switch with /model number, or /model instance/model. Add a reasoning effort to set both: /model number effort.",
|
|
563
567
|
"notFound": "No single model matches \"{{query}}\". Use /model to see the list.",
|
|
564
568
|
"setNow": "Model set to {{model}}. The current session uses it from its next turn.",
|
|
565
569
|
"setNext": "Model set to {{model}}. It applies to the next new session.",
|
|
566
|
-
"setFailed": "Could not switch the current session's model. Try again in a moment."
|
|
570
|
+
"setFailed": "Could not switch the current session's model. Try again in a moment.",
|
|
571
|
+
"effort": "Reasoning effort: {{effort}}",
|
|
572
|
+
"effortDefault": "model default",
|
|
573
|
+
"effortNone": "{{model}} has no reasoning effort to choose, so the model was not switched.",
|
|
574
|
+
"effortUnsupported": "{{model}} does not support the reasoning effort \"{{value}}\", so the model was not switched.",
|
|
575
|
+
"mismatch": "The switch was not confirmed by the session. Requested: {{requested}}. Actual: {{actual}}.",
|
|
576
|
+
"unconfirmed": "not confirmed",
|
|
577
|
+
"bindingChanged": "This chat's session changed during the switch. Try again."
|
|
567
578
|
},
|
|
568
579
|
"plan": {
|
|
569
580
|
"on": "Plan mode is on: from the next message the agent proposes a plan instead of acting. Send /plan off to leave it.",
|
package/locales/zh-CN.json
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
+
"presentation": {
|
|
3
|
+
"name": "聊天桥",
|
|
4
|
+
"description": "从飞书、企业微信、Telegram 连到 Ycodium。"
|
|
5
|
+
},
|
|
2
6
|
"source": {
|
|
3
7
|
"fromChat": "来自 {{name}}({{chat}}):",
|
|
4
8
|
"from": "来自 {{name}}:",
|
|
@@ -109,7 +113,8 @@
|
|
|
109
113
|
},
|
|
110
114
|
"allowedSenders": {
|
|
111
115
|
"label": "允许的人",
|
|
112
|
-
"description": "该平台的用户 id,逗号分隔。在访问模式要求名单的聊天里生效;留空则谁都不能在这些聊天里使用机器人。查 id:用还不在名单上的账号,在要求名单的聊天里给机器人发一句话(群里要 @ 它),它会回复这个 id;同一账号 10 分钟内只回一次。"
|
|
116
|
+
"description": "该平台的用户 id,逗号分隔。在访问模式要求名单的聊天里生效;留空则谁都不能在这些聊天里使用机器人。查 id:用还不在名单上的账号,在要求名单的聊天里给机器人发一句话(群里要 @ 它),它会回复这个 id;同一账号 10 分钟内只回一次。",
|
|
117
|
+
"placeholder": "没有人"
|
|
113
118
|
},
|
|
114
119
|
"proxy": {
|
|
115
120
|
"label": "代理",
|
|
@@ -426,7 +431,7 @@
|
|
|
426
431
|
"archived": "· /archived on|off —— 让这个聊天的会话列表带上(on)或不带(off)已归档的会话;/archived 看当前开关",
|
|
427
432
|
"resume": "· /resume 编号或 id 开头 —— 切会话;别的项目的会话会连同项目一起切",
|
|
428
433
|
"history": "· /history [数量] —— 仅私聊:查看当前会话最近的消息(默认 {{defaultCount}} 条,最多 {{maxCount}} 条)",
|
|
429
|
-
"model": "· /model —— 看这个聊天用的模型;/model 编号 或 /model 实例/模型
|
|
434
|
+
"model": "· /model —— 看这个聊天用的模型;/model 编号 或 /model 实例/模型 切换,后面再写思考强度就一并设定(/model 编号 强度);/models 列出可选模型",
|
|
430
435
|
"reasoning": "· /reasoning —— 看这个聊天当前模型的思考强度;/reasoning 取值 或 /reasoning 编号 切换;/reasoning default 恢复模型默认",
|
|
431
436
|
"preset": "· /preset —— 看这个聊天新会话用的预设;/preset 编号 或 /preset 名字或 id 切换;/preset none 清掉聊天选择",
|
|
432
437
|
"plan": "· /plan —— 开关计划模式(agent 先出计划、不动手);/plan on、/plan off 明确设定",
|
|
@@ -450,9 +455,8 @@
|
|
|
450
455
|
"unsupported": "当前模型不支持切换思考强度。",
|
|
451
456
|
"readFailed": "暂时读不到思考强度选项,请稍后重试。",
|
|
452
457
|
"setFailed": "切换思考强度失败,请稍后重试。",
|
|
453
|
-
"setNow": "思考强度已设为 {{value}}
|
|
454
|
-
"setNext": "思考强度已设为 {{value}}
|
|
455
|
-
"unsupportedKept": "此型号不支持思考强度 {{value}},按模型默认运行。原设置保留,换回原型号会恢复。",
|
|
458
|
+
"setNow": "思考强度已设为 {{value}},当前会话从下一轮起使用它。",
|
|
459
|
+
"setNext": "思考强度已设为 {{value}},这个聊天的下一条会话将使用它。",
|
|
456
460
|
"noModel": "这个聊天还没有模型,先用 /model 选一个。",
|
|
457
461
|
"switchReadFailed": "暂时读不到新模型的思考强度选项,模型没有切换,请稍后重试。",
|
|
458
462
|
"listTitlePlain": "可选思考强度:"
|
|
@@ -559,11 +563,18 @@
|
|
|
559
563
|
"unavailable": "现在读不出可选的模型,没法切换模型。",
|
|
560
564
|
"listTitle": "可选的模型:",
|
|
561
565
|
"more": "还有 {{count}} 个没列出——用 /model 实例/模型 也能选到。",
|
|
562
|
-
"footer": "用 /model 编号 切换,或 /model
|
|
566
|
+
"footer": "用 /model 编号 切换,或 /model 实例/模型。后面加思考强度可一并设定:/model 编号 强度。",
|
|
563
567
|
"notFound": "没有唯一对得上「{{query}}」的模型。用 /model 看看有哪些。",
|
|
564
568
|
"setNow": "模型已设为 {{model}},当前会话从下一轮起用它。",
|
|
565
569
|
"setNext": "模型已设为 {{model}},下一条新会话起用它。",
|
|
566
|
-
"setFailed": "没能切换当前会话的模型,稍后再试。"
|
|
570
|
+
"setFailed": "没能切换当前会话的模型,稍后再试。",
|
|
571
|
+
"effort": "思考强度:{{effort}}",
|
|
572
|
+
"effortDefault": "模型默认",
|
|
573
|
+
"effortNone": "{{model}} 没有可选的思考强度,模型没有切换。",
|
|
574
|
+
"effortUnsupported": "{{model}} 不支持思考强度「{{value}}」,模型没有切换。",
|
|
575
|
+
"mismatch": "会话没有确认这次切换。要求:{{requested}}。实际:{{actual}}。",
|
|
576
|
+
"unconfirmed": "未确认",
|
|
577
|
+
"bindingChanged": "切换期间这个聊天绑定的会话变了,请重试。"
|
|
567
578
|
},
|
|
568
579
|
"plan": {
|
|
569
580
|
"on": "计划模式已开:从下一条消息起,agent 先出计划、不动手。发 /plan off 退出。",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/plugin-im",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3799",
|
|
4
4
|
"description": "Talk to your agents from Telegram, WeCom, Lark, or WeChat (experimental).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"im",
|
|
@@ -32,13 +32,15 @@
|
|
|
32
32
|
"markdown-it": "^15.0.2",
|
|
33
33
|
"react": "19.2.6",
|
|
34
34
|
"vite-plus": "0.2.2",
|
|
35
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
35
|
+
"@ycodium-ai/plugin-api": "0.2.3799",
|
|
36
36
|
"ycodium-react-test-harness": "0.0.0"
|
|
37
37
|
},
|
|
38
38
|
"ycodium": {
|
|
39
39
|
"plugin": "./dist/index.js",
|
|
40
40
|
"displayName": "Chat bridge",
|
|
41
|
-
"
|
|
41
|
+
"displayNameKey": "presentation.name",
|
|
42
|
+
"description": "Talk to Ycodium from Lark, WeCom, and Telegram.",
|
|
43
|
+
"descriptionKey": "presentation.description",
|
|
42
44
|
"icon": "./assets/icon.svg",
|
|
43
45
|
"permissions": [
|
|
44
46
|
{
|