@ycodium-ai/agent-codex 0.2.5542 → 0.2.5634
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 +90 -89
- package/package.json +4 -4
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 H(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 i=r==="add"?v(e):null;return t==="apiKey"&&i!==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)])],i=await e.probe(r),c=new Map(t.flatMap(({id:o,path:l})=>{let S=i[r.indexOf(l)];return S?[[S.accountPath,o]]:[]}));return{probes:[...new Map(i.map(o=>[o.accountPath,o])).values()],configuredPaths:c,defaultAccount:i[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[i]=await t([r]);return i!==void 0&&i.authType!=="apiKey"&&Q(i)}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"),k=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:a,jsxs:s,Fragment:Se}=window.__ycodiumPluginHost.jsxRuntime;function Ae(e){let{t}=ve(),r=h(),{placement:i,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=H(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(()=>{i==="add"&&e.active&&F()},[i,e.active]);let X=f(c.displayName?.trim()??"");A(()=>{let n=c.displayName?.trim()??"",u=X.current;X.current=n,!(i!=="add"||!T.current)&&(n.length===0||n===u||d(o.current.instance.config,"shadowHomePath")===(U.current??"")&&Y(n))},[c.displayName,i]);let j=i==="edit"?ye(e.authEmail,e.siblings):void 0,R=ie(c),_=i==="add"&&ce(c),z=i==="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:H(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,!(i==="edit"&&n==="apiKey")){e.onChange(ue(c,n,i));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=i==="add"&&p!=="apiKey"?s("div",{className:"grid gap-2","aria-busy":P,children:[P?a("p",{className:"text-xs text-muted-foreground",children:t("account.detecting")}):null,!P&&D?.none!=null?a("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?a("p",{className:"text-xs text-muted-foreground",children:t("account.detectFailed")}):null,a(b,{variant:"outline",onClick:Ee,children:t("account.addAnother")}),a(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:[a("span",{className:"text-xs font-medium",children:t("account.method")}),s(he,{value:p,onValueChange:n=>Ne(He(n)),children:[a(we,{"aria-label":t("account.method"),children:a(xe,{children:t(p==="apiKey"?"account.apiKey":p==="chatgpt"?"account.chatgpt":"account.existing")})}),s(Pe,{children:[a(I,{value:"default",children:t("account.existing")}),a(I,{value:"chatgpt",children:t("account.chatgpt")}),a(I,{value:"apiKey",children:t("account.apiKey")})]})]})]}),p==="apiKey"?s(Se,{children:[s("label",{className:"grid gap-1",children:[a("span",{className:"text-xs font-medium",children:t("account.url")}),a(k,{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:[a("span",{className:"text-xs font-medium",children:t("account.key")}),a(k,{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:a("p",{className:"text-xs text-muted-foreground",children:t("account.apiRequired")})]}):a("p",{className:"text-xs text-muted-foreground",children:t("account.loginHint")})]});return s("div",{className:"ycodium-codex-ui grid gap-6",children:[Re,_e]})}function He(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:[a("style",{children:Ce}),a(Ae,{...r})]});return{pages:{},panels:{},views:{[M]:t},viewCapabilities:{[M]:[J]}}}export{Oe as default};
|
package/dist/index.js
CHANGED
|
@@ -2,15 +2,36 @@
|
|
|
2
2
|
import { definePlugin } from "@ycodium-ai/plugin-api";
|
|
3
3
|
|
|
4
4
|
// ../../packages/plugin-api/src/version.ts
|
|
5
|
-
var PLUGIN_API_VERSION =
|
|
5
|
+
var PLUGIN_API_VERSION = 178;
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
8
|
import {
|
|
9
|
-
EXECUTOR_EFFECTIVE_PAYLOAD_SCHEMA,
|
|
10
|
-
executorHomeEffectiveValue,
|
|
11
|
-
readExecutorEffectiveRequest
|
|
9
|
+
EXECUTOR_EFFECTIVE_PAYLOAD_SCHEMA as EXECUTOR_EFFECTIVE_PAYLOAD_SCHEMA2,
|
|
10
|
+
executorHomeEffectiveValue as executorHomeEffectiveValue2,
|
|
11
|
+
readExecutorEffectiveRequest as readExecutorEffectiveRequest2
|
|
12
12
|
} from "@ycodium-ai/plugin-api/executor";
|
|
13
13
|
|
|
14
|
+
// ../../packages/ycodium-instance-config/src/programHomeSchema.ts
|
|
15
|
+
var executorEnvelopeFields = {
|
|
16
|
+
enabled: { type: "boolean" },
|
|
17
|
+
customModels: { type: "array" },
|
|
18
|
+
driver: { type: "string" },
|
|
19
|
+
config: { type: "object" },
|
|
20
|
+
environment: { type: "array" }
|
|
21
|
+
};
|
|
22
|
+
function executorProgramField(name, options = {}) {
|
|
23
|
+
return {
|
|
24
|
+
type: "string",
|
|
25
|
+
"x-ycodium-form": {
|
|
26
|
+
titleKey: `form.${name}.title`,
|
|
27
|
+
...options.description === false ? {} : { descriptionKey: `form.${name}.description` },
|
|
28
|
+
...options.placeholder === false ? {} : { placeholderKey: `form.${name}.placeholder` },
|
|
29
|
+
...name === "binaryPath" ? { control: options.control ?? "executable-path" } : {},
|
|
30
|
+
...name === "homePath" || options.machineLocal ? { machineLocal: true } : {}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
14
35
|
// src/card.ts
|
|
15
36
|
var CODEX_DRIVER_KIND = "codex";
|
|
16
37
|
var CODEX_DEFAULT_LAUNCH_ARGS = "app-server";
|
|
@@ -86,26 +107,11 @@ var CODEX_CARD = {
|
|
|
86
107
|
type: "object",
|
|
87
108
|
"x-ycodium-form-order": ["binaryPath", "homePath", "shadowHomePath", "launchArgs"],
|
|
88
109
|
properties: {
|
|
110
|
+
...executorEnvelopeFields,
|
|
89
111
|
authMode: { type: "string", enum: ["default", "chatgpt", "apiKey"] },
|
|
90
112
|
apiBaseUrl: { type: "string" },
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
type: "string",
|
|
94
|
-
"x-ycodium-form": {
|
|
95
|
-
titleKey: "form.binaryPath.title",
|
|
96
|
-
descriptionKey: "form.binaryPath.description",
|
|
97
|
-
placeholderKey: "form.binaryPath.placeholder",
|
|
98
|
-
control: "executable-path"
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
homePath: {
|
|
102
|
-
type: "string",
|
|
103
|
-
"x-ycodium-form": {
|
|
104
|
-
titleKey: "form.homePath.title",
|
|
105
|
-
machineLocal: true,
|
|
106
|
-
placeholderKey: "form.homePath.placeholder"
|
|
107
|
-
}
|
|
108
|
-
},
|
|
113
|
+
binaryPath: executorProgramField("binaryPath"),
|
|
114
|
+
homePath: executorProgramField("homePath", { description: false }),
|
|
109
115
|
shadowHomePath: {
|
|
110
116
|
type: "string",
|
|
111
117
|
"x-ycodium-form": {
|
|
@@ -115,18 +121,7 @@ var CODEX_CARD = {
|
|
|
115
121
|
placeholderKey: "form.shadowHomePath.placeholder"
|
|
116
122
|
}
|
|
117
123
|
},
|
|
118
|
-
launchArgs:
|
|
119
|
-
type: "string",
|
|
120
|
-
"x-ycodium-form": {
|
|
121
|
-
titleKey: "form.launchArgs.title",
|
|
122
|
-
descriptionKey: "form.launchArgs.description",
|
|
123
|
-
placeholderKey: "form.launchArgs.placeholder"
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
customModels: { type: "array" },
|
|
127
|
-
driver: { type: "string" },
|
|
128
|
-
config: { type: "object" },
|
|
129
|
-
environment: { type: "array" }
|
|
124
|
+
launchArgs: executorProgramField("launchArgs")
|
|
130
125
|
},
|
|
131
126
|
additionalProperties: true
|
|
132
127
|
},
|
|
@@ -211,7 +206,12 @@ import * as NodePath2 from "node:path";
|
|
|
211
206
|
// ../../packages/ycodium-instance-config/src/homePath.ts
|
|
212
207
|
import * as NodeOS from "node:os";
|
|
213
208
|
import * as NodePath from "node:path";
|
|
214
|
-
import {
|
|
209
|
+
import {
|
|
210
|
+
EXECUTOR_EFFECTIVE_PAYLOAD_SCHEMA,
|
|
211
|
+
executorHomeEffectiveValue,
|
|
212
|
+
readExecutorEffectiveRequest,
|
|
213
|
+
mergeLaunchEnv
|
|
214
|
+
} from "@ycodium-ai/plugin-api/executor";
|
|
215
215
|
function expandHomePath(value) {
|
|
216
216
|
if (value === "~") return NodeOS.homedir();
|
|
217
217
|
if (value.startsWith("~/") || value.startsWith("~\\")) {
|
|
@@ -2098,8 +2098,8 @@ var openCodexHistory = (input) => waitForJsonlHistory({
|
|
|
2098
2098
|
// src/codexInstance.ts
|
|
2099
2099
|
import * as NodeProcess2 from "node:process";
|
|
2100
2100
|
import {
|
|
2101
|
-
describeExecutorSpawnFailure,
|
|
2102
|
-
ExecutorSpawnRefusedError as
|
|
2101
|
+
describeExecutorSpawnFailure as describeExecutorSpawnFailure2,
|
|
2102
|
+
ExecutorSpawnRefusedError as ExecutorSpawnRefusedError3,
|
|
2103
2103
|
raceAbort as raceAbort2
|
|
2104
2104
|
} from "@ycodium-ai/plugin-api/executor";
|
|
2105
2105
|
|
|
@@ -2184,14 +2184,14 @@ function modelIdFromSelection(selection) {
|
|
|
2184
2184
|
}
|
|
2185
2185
|
function readEnvironment(value) {
|
|
2186
2186
|
if (!Array.isArray(value)) return {};
|
|
2187
|
-
const
|
|
2187
|
+
const entries = [];
|
|
2188
2188
|
for (const entry of value) {
|
|
2189
2189
|
if (!isRecord3(entry)) continue;
|
|
2190
2190
|
const name = readTrimmed(entry["name"]);
|
|
2191
2191
|
if (name.length === 0) continue;
|
|
2192
|
-
|
|
2192
|
+
entries.push([name, readString(entry["value"])]);
|
|
2193
2193
|
}
|
|
2194
|
-
return
|
|
2194
|
+
return Object.fromEntries(entries);
|
|
2195
2195
|
}
|
|
2196
2196
|
function instanceSettings(config) {
|
|
2197
2197
|
if (!isRecord3(config)) return {};
|
|
@@ -2374,33 +2374,49 @@ async function spawnCodexAppServer(input) {
|
|
|
2374
2374
|
return { handle, args };
|
|
2375
2375
|
}
|
|
2376
2376
|
|
|
2377
|
-
// src/
|
|
2377
|
+
// ../../packages/ycodium-instance-config/src/probeProcess.ts
|
|
2378
|
+
import {
|
|
2379
|
+
describeExecutorSpawnFailure,
|
|
2380
|
+
ExecutorSpawnAbortedError as ExecutorSpawnAbortedError2,
|
|
2381
|
+
ExecutorSpawnRefusedError as ExecutorSpawnRefusedError2
|
|
2382
|
+
} from "@ycodium-ai/plugin-api/executor";
|
|
2378
2383
|
import {
|
|
2379
|
-
|
|
2380
|
-
|
|
2384
|
+
isOperationCleanupError,
|
|
2385
|
+
runProcessOperation
|
|
2381
2386
|
} from "@ycodium-ai/plugin-api/process-operation";
|
|
2382
|
-
|
|
2383
|
-
var VERSION_PATTERN = /(?<![\d.])(\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?)/;
|
|
2384
|
-
async function readCodexCliVersion(input) {
|
|
2385
|
-
input.signal?.throwIfAborted();
|
|
2386
|
-
if (input.recipe.binaryPath.length === 0) return null;
|
|
2387
|
+
async function readCliVersionCommand(host, input) {
|
|
2387
2388
|
try {
|
|
2388
|
-
const
|
|
2389
|
-
program: input.
|
|
2389
|
+
const run = await runProcessOperation(host, {
|
|
2390
|
+
program: input.program,
|
|
2390
2391
|
args: ["--version"],
|
|
2391
|
-
owner: { bindingId:
|
|
2392
|
+
owner: { bindingId: host.bindingId },
|
|
2393
|
+
...Object.keys(input.env).length > 0 ? { env: input.env } : {},
|
|
2392
2394
|
signal: input.signal,
|
|
2393
|
-
timeoutMs:
|
|
2395
|
+
timeoutMs: input.timeoutMs,
|
|
2394
2396
|
maxOutputBytes: 64 * 1024
|
|
2395
2397
|
});
|
|
2396
|
-
if (exitCode !== 0) return null;
|
|
2397
|
-
return
|
|
2398
|
+
if (run.exitCode !== 0 && !input.acceptNonzeroExit) return null;
|
|
2399
|
+
return input.parse(run.stdout) ?? input.parse(run.stderr);
|
|
2398
2400
|
} catch (error) {
|
|
2399
|
-
if (isOperationCleanupError(error)) throw error;
|
|
2400
|
-
input.signal?.throwIfAborted();
|
|
2401
|
+
if (isOperationCleanupError(error) || input.signal?.aborted) throw error;
|
|
2401
2402
|
return null;
|
|
2402
2403
|
}
|
|
2403
2404
|
}
|
|
2405
|
+
|
|
2406
|
+
// src/cliVersion.ts
|
|
2407
|
+
var CODEX_VERSION_TIMEOUT_MS = 15e3;
|
|
2408
|
+
var VERSION_PATTERN = /(?<![\d.])(\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?)/;
|
|
2409
|
+
async function readCodexCliVersion(input) {
|
|
2410
|
+
input.signal?.throwIfAborted();
|
|
2411
|
+
if (input.recipe.binaryPath.length === 0) return null;
|
|
2412
|
+
return readCliVersionCommand(input.host, {
|
|
2413
|
+
program: input.recipe.binaryPath,
|
|
2414
|
+
env: input.recipe.environment,
|
|
2415
|
+
signal: input.signal,
|
|
2416
|
+
timeoutMs: CODEX_VERSION_TIMEOUT_MS,
|
|
2417
|
+
parse: (output) => VERSION_PATTERN.exec(output)?.[1] ?? null
|
|
2418
|
+
});
|
|
2419
|
+
}
|
|
2404
2420
|
function missingBinaryDetail(binaryPath) {
|
|
2405
2421
|
const relyOnPath = !/[\\/]/.test(binaryPath);
|
|
2406
2422
|
return `Could not start Codex (${binaryPath}). Check the "Program path" setting of this provider on this machine.` + (relyOnPath ? " The Codex desktop app may not add codex to PATH; enter the full path to the codex executable there." : " Make sure the configured file exists and can be run.");
|
|
@@ -3390,6 +3406,9 @@ function formatCoarseWait(waitMs) {
|
|
|
3390
3406
|
return minutes === 0 ? `${String(hours)}h` : `${String(hours)}h ${String(minutes)}m`;
|
|
3391
3407
|
}
|
|
3392
3408
|
|
|
3409
|
+
// ../../packages/ycodium-credential-account/src/quotaJson.ts
|
|
3410
|
+
var clampPercent = (value) => Math.min(100, Math.max(0, value));
|
|
3411
|
+
|
|
3393
3412
|
// ../../packages/ycodium-instance-config/src/tomlScalar.ts
|
|
3394
3413
|
function readTomlScalar(raw) {
|
|
3395
3414
|
const quoted = /^(["'])(.*?)\1/.exec(raw.trim());
|
|
@@ -3402,7 +3421,6 @@ function readTomlScalar(raw) {
|
|
|
3402
3421
|
var asRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
3403
3422
|
var asFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
3404
3423
|
var asNonEmptyString = (value) => typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
3405
|
-
var clampPercent = (value) => Math.min(100, Math.max(0, value));
|
|
3406
3424
|
var epochSecondsToIso = (value) => {
|
|
3407
3425
|
const seconds = asFiniteNumber(value);
|
|
3408
3426
|
if (seconds === null) return null;
|
|
@@ -6626,29 +6644,7 @@ var codexWorkspaceInventory = async (rpc, cwd) => {
|
|
|
6626
6644
|
|
|
6627
6645
|
// src/signIn.ts
|
|
6628
6646
|
import { raceAbort } from "@ycodium-ai/plugin-api/executor";
|
|
6629
|
-
|
|
6630
|
-
// src/signInLifecycle.ts
|
|
6631
|
-
function signInLifetime(signal) {
|
|
6632
|
-
const controller = new AbortController();
|
|
6633
|
-
const abort = () => controller.abort(signal?.reason);
|
|
6634
|
-
signal?.addEventListener("abort", abort, { once: true });
|
|
6635
|
-
if (signal?.aborted) abort();
|
|
6636
|
-
const timer = setTimeout(
|
|
6637
|
-
() => controller.abort(new Error("Codex sign-in timed out")),
|
|
6638
|
-
10 * 6e4
|
|
6639
|
-
);
|
|
6640
|
-
timer.unref?.();
|
|
6641
|
-
return {
|
|
6642
|
-
signal: controller.signal,
|
|
6643
|
-
close: () => {
|
|
6644
|
-
clearTimeout(timer);
|
|
6645
|
-
signal?.removeEventListener("abort", abort);
|
|
6646
|
-
controller.abort(new Error("Codex sign-in cancelled"));
|
|
6647
|
-
}
|
|
6648
|
-
};
|
|
6649
|
-
}
|
|
6650
|
-
|
|
6651
|
-
// src/signIn.ts
|
|
6647
|
+
import { createSignInLifetime } from "@ycodium-ai/plugin-api/runtime-maintenance";
|
|
6652
6648
|
var DEVICE_CODE_URL = /https?:\/\/\S+/;
|
|
6653
6649
|
var DEVICE_CODE_VALUE = /\b([A-Z0-9]{4,}(?:-[A-Z0-9]{4,})+)\b/;
|
|
6654
6650
|
var deviceCodeUrl = (output) => DEVICE_CODE_URL.exec(output)?.[0];
|
|
@@ -6686,7 +6682,12 @@ async function startCodexSignIn(input) {
|
|
|
6686
6682
|
});
|
|
6687
6683
|
const loginRecipe = { ...input.recipe, authMode: "chatgpt" };
|
|
6688
6684
|
const owner = { bindingId: input.host.bindingId };
|
|
6689
|
-
const lifetime =
|
|
6685
|
+
const lifetime = createSignInLifetime({
|
|
6686
|
+
signal: input.signal,
|
|
6687
|
+
timeoutMs: 10 * 6e4,
|
|
6688
|
+
timeoutMessage: "Codex sign-in timed out",
|
|
6689
|
+
cancelMessage: "Codex sign-in cancelled"
|
|
6690
|
+
});
|
|
6690
6691
|
let appServerFailure;
|
|
6691
6692
|
try {
|
|
6692
6693
|
const tryAppServer = async () => {
|
|
@@ -6986,7 +6987,7 @@ import {
|
|
|
6986
6987
|
mergeLaunchEnv as mergeLaunchEnv3
|
|
6987
6988
|
} from "@ycodium-ai/plugin-api/executor";
|
|
6988
6989
|
import {
|
|
6989
|
-
|
|
6990
|
+
isOperationCleanupError as isOperationCleanupError3,
|
|
6990
6991
|
runProcessOperation as runProcessOperation2
|
|
6991
6992
|
} from "@ycodium-ai/plugin-api/process-operation";
|
|
6992
6993
|
|
|
@@ -7591,7 +7592,7 @@ function createCodexTextGeneration(input) {
|
|
|
7591
7592
|
if (!isRecord2(parsed)) throw new Error("Codex returned invalid structured output.");
|
|
7592
7593
|
return parsed;
|
|
7593
7594
|
} catch (cause) {
|
|
7594
|
-
if (cause
|
|
7595
|
+
if (isOperationCleanupError3(cause)) safeToRemove = false;
|
|
7595
7596
|
throw cause;
|
|
7596
7597
|
}
|
|
7597
7598
|
} finally {
|
|
@@ -8287,7 +8288,7 @@ var createCodexInstance = (config, host, attachments, cache) => {
|
|
|
8287
8288
|
version: null,
|
|
8288
8289
|
models: void 0,
|
|
8289
8290
|
skills: void 0,
|
|
8290
|
-
spawnFailed:
|
|
8291
|
+
spawnFailed: describeExecutorSpawnFailure2(error)
|
|
8291
8292
|
};
|
|
8292
8293
|
}
|
|
8293
8294
|
trackHandle(handle, `${recipe.binaryPath} (probe)`);
|
|
@@ -8309,7 +8310,7 @@ var createCodexInstance = (config, host, attachments, cache) => {
|
|
|
8309
8310
|
input.signal
|
|
8310
8311
|
);
|
|
8311
8312
|
} catch (error) {
|
|
8312
|
-
if (error instanceof
|
|
8313
|
+
if (error instanceof ExecutorSpawnRefusedError3) throw error;
|
|
8313
8314
|
if (input.signal?.aborted) throw error;
|
|
8314
8315
|
return { version, models: void 0, skills: void 0, spawnFailed: null };
|
|
8315
8316
|
} finally {
|
|
@@ -8325,7 +8326,7 @@ var createCodexInstance = (config, host, attachments, cache) => {
|
|
|
8325
8326
|
try {
|
|
8326
8327
|
({ handle } = await spawnCodexAppServer({ host, recipe, layout }));
|
|
8327
8328
|
} catch (error) {
|
|
8328
|
-
if (error instanceof
|
|
8329
|
+
if (error instanceof ExecutorSpawnRefusedError3) {
|
|
8329
8330
|
const borrowed = [...threads.values()].find((entry) => !entry.closing);
|
|
8330
8331
|
if (borrowed !== void 0) return await run(borrowed.rpc);
|
|
8331
8332
|
}
|
|
@@ -8780,11 +8781,11 @@ var index_default = definePlugin({
|
|
|
8780
8781
|
name: "effectiveConfig",
|
|
8781
8782
|
description: "Settings form: the CODEX_HOME an empty path resolves to on this machine.",
|
|
8782
8783
|
scope: "read",
|
|
8783
|
-
payloadSchema:
|
|
8784
|
+
payloadSchema: EXECUTOR_EFFECTIVE_PAYLOAD_SCHEMA2,
|
|
8784
8785
|
handle: async (payload) => {
|
|
8785
|
-
const request =
|
|
8786
|
+
const request = readExecutorEffectiveRequest2(payload);
|
|
8786
8787
|
return {
|
|
8787
|
-
homePath:
|
|
8788
|
+
homePath: executorHomeEffectiveValue2(
|
|
8788
8789
|
"CODEX_HOME",
|
|
8789
8790
|
request,
|
|
8790
8791
|
process.env,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-codex",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5634",
|
|
4
4
|
"description": "Codex executor: Codex CLI over the app-server JSON-RPC protocol.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"tailwindcss": "^4.0.0",
|
|
30
30
|
"typescript": "~6.0.3",
|
|
31
31
|
"vite-plus": "0.2.2",
|
|
32
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
32
|
+
"@ycodium-ai/plugin-api": "0.2.0",
|
|
33
33
|
"ycodium-credential-account": "0.0.0",
|
|
34
|
+
"ycodium-executor-testing": "0.0.0",
|
|
34
35
|
"ycodium-duration-format": "0.0.0",
|
|
35
36
|
"ycodium-instance-config": "0.0.0",
|
|
36
|
-
"ycodium-react-test-harness": "0.0.0",
|
|
37
|
-
"ycodium-executor-testing": "0.0.0",
|
|
38
37
|
"ycodium-jsonl-stream": "0.0.0",
|
|
38
|
+
"ycodium-react-test-harness": "0.0.0",
|
|
39
39
|
"ycodium-text-generation": "0.0.0",
|
|
40
40
|
"ycodium-workspace-path": "0.0.0"
|
|
41
41
|
},
|