@ycodium-ai/agent-codex 0.2.5557 → 0.2.5751
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 +2 -2
- package/dist/index.js +238 -2633
- package/locales/en.json +0 -1
- package/locales/zh-CN.json +0 -1
- package/package.json +5 -7
package/assets/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var W=window.__ycodiumPluginHost.modules?.["@ycodium-ai/plugin-api/provider-settings"];if(!W)throw new Error("This plugin needs a newer Ycodium app. Update the app.");var{PROVIDER_SETTINGS_VIEW_CAPABILITY:J,accountDirectoryCandidates:Ue,accountDirectorySlug:Le,accountProbeHasSignedInAccount:Q,allocateAccountDirectory:Z,providerInstanceAccountPaths:Ve}=W;var De=window.__ycodiumPluginHost.react;var{Activity:Fe,Children:Xe,Component:je,Fragment:ze,Profiler:$e,PureComponent:qe,StrictMode:Ge,Suspense:We,__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE:Je,__COMPILER_RUNTIME:Qe,act:Ze,cache:et,cacheSignal:tt,captureOwnerStack:nt,cloneElement:ot,createContext:ee,createElement:te,createRef:rt,forwardRef:at,isValidElement:it,lazy:ct,memo:st,startTransition:ut,unstable_useCacheRefresh:dt,use:lt,useActionState:pt,useCallback:gt,useContext:ne,useDebugValue:ft,useDeferredValue:mt,useEffect:A,useEffectEvent:yt,useId:ht,useImperativeHandle:Pt,useInsertionEffect:wt,useLayoutEffect:xt,useMemo:vt,useOptimistic:St,useReducer:At,useRef:f,useState:B,useSyncExternalStore:Ct,useTransition:bt,version:It}=De;var oe=ee(null),re=oe.Provider;function h(){let e=ne(oe);if(e===null)throw new Error("Codex UI has not been registered.");return e}var x="YCODIUM_CODEX_API_KEY";var Ke={configKeys:["shadowHomePath","homePath"],defaultDirectory:"~/.codex"},M="account",ae="codex",Be="Codex";function d(e,t){if(e===null||typeof e!="object")return"";let r=e[t];return typeof r=="string"?r:""}function m(e){let t=d(e.config,"authMode");return t==="chatgpt"||t==="apiKey"?t:"default"}function k(e){return e.displayName?.trim()||Be}function ie(e){if(m(e)!=="apiKey")return!0;try{let t=new URL(d(e.config,"apiBaseUrl"));if(t.protocol!=="https:"&&t.protocol!=="http:")return!1}catch{return!1}return e.environment.some(t=>t.name===x&&(t.valueRedacted===!0||t.value.trim().length>0))}function v(e){if(m(e)!=="chatgpt")return null;let t=e.config;if(t.shadowHomePath!=="")return null;let r=d(t,"homePath");return r.length>0?r:null}function ce(e){return m(e)==="chatgpt"&&v(e)===null}function se(e){return{config:{homePath:e,shadowHomePath:"",authMode:"chatgpt"}}}function ue(e,t,r){let a=r==="add"?v(e):null;return t==="apiKey"&&a!==null?{config:{authMode:t,homePath:void 0,shadowHomePath:void 0}}:{config:{authMode:t}}}function de(){return{config:{authMode:"chatgpt",shadowHomePath:void 0}}}function Me(e){return d(e.config,"shadowHomePath").trim().length===0}async function le(e){let t=e.siblings.filter(o=>o.instance.driver===ae).filter(o=>m(o.instance)!=="apiKey").map(o=>({id:o.instanceId,path:d(o.instance.config,"shadowHomePath")||d(o.instance.config,"homePath")})),r=[...new Set(["",...t.map(o=>o.path)])],a=await e.probe(r),c=new Map(t.flatMap(({id:o,path:l})=>{let S=a[r.indexOf(l)];return S?[[S.accountPath,o]]:[]}));return{probes:[...new Map(a.map(o=>[o.accountPath,o])).values()],configuredPaths:c,defaultAccount:a[0]??null}}function pe(e){return e.filter(t=>t.authType!=="apiKey"&&(t.state==="signed-in"||t.state==="expired"))}function ge(e){return{none:e.every(r=>r.state==="signed-out"||r.authType==="apiKey")?e.length===0?"detectFailed":"noAccounts":null,unreadable:e.some(r=>r.state==="unreadable")}}function C(e){return Z({driver:ae,displayName:e.displayName,instances:e.instances,rule:Ke,probe:e.probe})}function fe(e){let t=m(e);return(t==="chatgpt"||t==="apiKey")&&v(e)===null&&Me(e)}async function me(e,t){let r=d(e.config,"shadowHomePath").trim();if(r.length===0)return!0;let[a]=await t([r]);return a!==void 0&&a.authType!=="apiKey"&&Q(a)}function ye(e,t){if(e!==null)return t.find(r=>r.authEmail===e)}function y(e){return(t=>te(h().ui[e],{...t,className:`ycodium-codex-ui ${typeof t.className=="string"?t.className:""}`}))}var b=y("Button"),H=y("DraftInput"),he=y("Select"),I=y("SelectItem"),Pe=y("SelectPopup"),we=y("SelectTrigger"),xe=y("SelectValue");function ve(){let e=h().i18n.usePluginTranslation();return{t:(t,r)=>e(t,r)}}var{jsx:i,jsxs:s,Fragment:Se}=window.__ycodiumPluginHost.jsxRuntime;function Ae(e){let{t}=ve(),r=h(),{placement:a,instance:c}=e,o=f(e);o.current=e;let[l,S]=B(null),[P,O]=B(!1),N=f(!1),T=f(!1),U=f(null),w=f(0),p=m(c),be=v(c),L=k(c),E=()=>[...o.current.siblings.map(n=>n.instance),...o.current.placement==="edit"?[o.current.instance]:[]],V=()=>r.notify(t("account.directoryUnavailable"),"error"),Ie=n=>{U.current=n.length>0?n:null,o.current.onChange({config:{shadowHomePath:n.length>0?n:void 0}})},Y=n=>{let u=++w.current;C({displayName:n,instances:E(),probe:o.current.probeAccount}).then(g=>{u===w.current&&(g!==void 0?Ie(g):V())})},F=async()=>{if(!N.current){N.current=!0,O(!0);try{let n=await le({siblings:o.current.siblings,probe:o.current.probeAccount});S({probes:n.probes,configuredPaths:n.configuredPaths})}finally{O(!1),N.current=!1}}};A(()=>{a==="add"&&e.active&&F()},[a,e.active]);let X=f(c.displayName?.trim()??"");A(()=>{let n=c.displayName?.trim()??"",u=X.current;X.current=n,!(a!=="add"||!T.current)&&(n.length===0||n===u||d(o.current.instance.config,"shadowHomePath")===(U.current??"")&&Y(n))},[c.displayName,a]);let j=a==="edit"?ye(e.authEmail,e.siblings):void 0,R=ie(c),_=a==="add"&&ce(c),z=a==="edit"&&p==="apiKey",$=j===void 0?void 0:t("account.duplicate",{name:j.displayName}),q=_?t("account.addAndSignIn"):void 0,{onReport:G}=e;A(()=>{G({complete:R,submitLabel:q,signInAfterAdd:_,hidesSignIn:z,notice:$,prepare:async n=>{if(!fe(n))return null;let u=await C({displayName:k(n),instances:E(),probe:o.current.probeAccount});if(u===void 0)throw new Error(t("account.directoryUnavailable"));return{config:{shadowHomePath:u}}}})},[G,R,q,_,z,$]);let Ne=n=>{if(n!==p){if(w.current+=1,!(a==="edit"&&n==="apiKey")){e.onChange(ue(c,n,a));return}(async()=>{let u=await me(c,o.current.probeAccount),g;u&&(g=await C({displayName:L,instances:E(),probe:o.current.probeAccount}),g===void 0&&V()),o.current.onChange({config:{authMode:"apiKey",...g===void 0?{}:{shadowHomePath:g}}})})()}},Te=n=>{w.current+=1;let u=l?.configuredPaths.get(n.accountPath);if(u!==void 0){e.openInstance(u);return}T.current=!1,e.onChange(se(n.accountPath))},Ee=()=>{w.current+=1,T.current=!0,e.onChange(de()),Y(L)},D=l===null?null:ge(l.probes),Re=a==="add"&&p!=="apiKey"?s("div",{className:"grid gap-2","aria-busy":P,children:[P?i("p",{className:"text-xs text-muted-foreground",children:t("account.detecting")}):null,!P&&D?.none!=null?i("p",{className:"text-xs text-muted-foreground",children:t(`account.${D.none}`)}):null,l!==null?pe(l.probes).map(n=>s(b,{variant:"outline","aria-pressed":be===n.accountPath,onClick:()=>Te(n),children:[n.email===void 0?t("account.existing"):t("account.useAccount",{email:n.email}),l.configuredPaths.has(n.accountPath)?`, ${t("account.alreadyAdded")}`:""]},n.accountPath)):null,!P&&D?.unreadable===!0?i("p",{className:"text-xs text-muted-foreground",children:t("account.detectFailed")}):null,i(b,{variant:"outline",onClick:Ee,children:t("account.addAnother")}),i(b,{size:"xs",variant:"ghost",disabled:P,onClick:()=>{F()},children:t("account.retry")})]}):null,K=c.environment.find(n=>n.name===x),_e=s("div",{className:"grid gap-3",children:[s("label",{className:"grid gap-1",children:[i("span",{className:"text-xs font-medium",children:t("account.method")}),s(he,{value:p,onValueChange:n=>Ne(ke(n)),children:[i(we,{"aria-label":t("account.method"),children:i(xe,{children:t(p==="apiKey"?"account.apiKey":p==="chatgpt"?"account.chatgpt":"account.existing")})}),s(Pe,{children:[i(I,{value:"default",children:t("account.existing")}),i(I,{value:"chatgpt",children:t("account.chatgpt")}),i(I,{value:"apiKey",children:t("account.apiKey")})]})]})]}),p==="apiKey"?s(Se,{children:[s("label",{className:"grid gap-1",children:[i("span",{className:"text-xs font-medium",children:t("account.url")}),i(H,{value:d(c.config,"apiBaseUrl"),onCommit:n=>e.onChange({config:{apiBaseUrl:n.trim()}}),spellCheck:!1,"aria-label":t("account.url")})]}),s("label",{className:"grid gap-1",children:[i("span",{className:"text-xs font-medium",children:t("account.key")}),i(H,{value:K?.valueRedacted===!0?"":K?.value??"",type:"password",autoComplete:"off",spellCheck:!1,"aria-label":t("account.key"),placeholder:K?.valueRedacted===!0?t("account.keyStoredPlaceholder"):void 0,onCommit:n=>e.onChange({environment:[{name:x,value:n,sensitive:!0}]})})]}),R?null:i("p",{className:"text-xs text-muted-foreground",children:t("account.apiRequired")})]}):null]});return s("div",{className:"ycodium-codex-ui grid gap-6",children:[Re,_e]})}function ke(e){return e==="chatgpt"||e==="apiKey"?e:"default"}var Ce=`/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
|
|
2
2
|
@layer properties, theme, base, components, utilities;
|
|
3
3
|
@layer properties;
|
|
4
4
|
@layer utilities {
|
|
@@ -61,4 +61,4 @@ var Q=window.__ycodiumPluginHost.modules?.["@ycodium-ai/plugin-api/provider-sett
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
`;function
|
|
64
|
+
`;function Oe(e){let t=r=>s(re,{value:e,children:[i("style",{children:Ce}),i(Ae,{...r})]});return{pages:{},panels:{},views:{[M]:t},viewCapabilities:{[M]:[J]}}}export{Oe as default};
|