Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

CodexProvider.ts

719 lines22.6 KB

1import * as DateTime from "effect/DateTime";
2import * as Duration from "effect/Duration";
3import * as Effect from "effect/Effect";
4import * as Layer from "effect/Layer";
5import * as Option from "effect/Option";
6import * as Result from "effect/Result";
7import * as Schema from "effect/Schema";
8import * as Scope from "effect/Scope";
9import * as Types from "effect/Types";
10import * as ChildProcess from "effect/unstable/process/ChildProcess";
11import * as ChildProcessSpawner from "effect/unstable/process/ChildProcessSpawner";
12import * as CodexClient from "effect-codex-app-server/client";
13import * as CodexSchema from "effect-codex-app-server/schema";
14import * as CodexErrors from "effect-codex-app-server/errors";
15​
16import type {
17 CodexSettings,
18 ServerProvider,
19 ServerProviderState,
20 ModelCapabilities,
21 ProviderOptionDescriptor,
22 ServerProviderModel,
23 ServerProviderSkill,
24} from "@t3tools/contracts";
25import { PREFERRED_DEFAULT_CODEX_MODELS, ServerSettingsError } from "@t3tools/contracts";
26​
27import { createModelCapabilities } from "@t3tools/shared/model";
28import { resolveSpawnCommand } from "@t3tools/shared/shell";
29import { codexAppServerArgs, resolveCodexLaunchArgs } from "./codexLaunchArgs.ts";
30import {
31 AUTH_PROBE_TIMEOUT_MS,
32 buildServerProvider,
33 COMPACT_SLASH_COMMAND,
34 type ServerProviderDraft,
35} from "../providerSnapshot.ts";
36import { expandHomePath } from "../../pathExpansion.ts";
37import { makeUnavailableUsageLimits } from "../providerUsageLimits.ts";
38import {
39 codexRateLimitsFailureMessage,
40 codexRateLimitsToLimits,
41 type CodexRateLimitSnapshot,
42} from "./codexUsageLimits.ts";
43import packageJson from "../../../package.json" with { type: "json" };
44const isCodexAppServerSpawnError = Schema.is(CodexErrors.CodexAppServerSpawnError);
45const RATE_LIMITS_PROBE_TIMEOUT_MS = 3_000;
46​
47type CodexRateLimitsProbe =
48 | { readonly snapshot: CodexRateLimitSnapshot }
49 | { readonly failure: string };
50​
51const CODEX_APP_SERVER_PROBE_FORCE_KILL_AFTER = "2 seconds" as const;
52​
53const CODEX_PRESENTATION = {
54 displayName: "Codex",
55 showInteractionModeToggle: true,
56} as const;
57​
58export interface CodexAppServerProviderSnapshot {
59 readonly account: CodexSchema.V2GetAccountResponse;
60 readonly rateLimits?: CodexRateLimitsProbe;
61 readonly version: string | undefined;
62 readonly models: ReadonlyArray<ServerProviderModel>;
63 readonly skills: ReadonlyArray<ServerProviderSkill>;
65​
66const REASONING_EFFORT_LABELS: Readonly<Record<string, string>> = {
67 none: "None",
68 minimal: "Minimal",
69 low: "Low",
70 medium: "Medium",
71 high: "High",
72 xhigh: "Extra High",
73 max: "Max",
74 ultra: "Ultra",
75};
76​
77const DEFAULT_SERVICE_TIER_ID = "default";
78​
79function reasoningEffortLabel(reasoningEffort: string): string {
80 return REASONING_EFFORT_LABELS[reasoningEffort] ?? reasoningEffort;
82​
83function codexAccountAuthLabel(account: CodexSchema.V2GetAccountResponse["account"]) {
84 if (!account) return undefined;
85 if (account.type === "apiKey") return "OpenAI API Key";
86 if (account.type === "amazonBedrock") return "Amazon Bedrock";
87 if (account.type !== "chatgpt") return undefined;
88 return codexPlanLabel(account.planType);
90​
91/** Shared with usage-limit sources, which report the same `planType` slugs. */
92export function codexPlanLabel(planType: string | null | undefined): string | undefined {
93 switch (planType) {
94 case "free":
95 return "ChatGPT Free Subscription";
96 case "go":
97 return "ChatGPT Go Subscription";
98 case "plus":
99 return "ChatGPT Plus Subscription";
100 case "pro":
101 return "ChatGPT Pro 20x Subscription";
102 case "prolite":
103 return "ChatGPT Pro 5x Subscription";
104 case "team":
105 return "ChatGPT Team Subscription";
106 case "self_serve_business_prolite":
107 case "self_serve_business_usage_based":
108 case "business":
109 return "ChatGPT Business Subscription";
110 case "ent26":
111 case "enterprise_cbp_automation":
112 case "enterprise_cbp_usage_based":
113 case "enterprise":
114 return "ChatGPT Enterprise Subscription";
115 case "edu":
116 case "edu_plus":
117 case "edu_pro":
118 return "ChatGPT Edu Subscription";
119 case "unknown":
120 return "ChatGPT Subscription";
121 default:
122 return undefined;
123 }
125​
126function codexAccountEmail(account: CodexSchema.V2GetAccountResponse["account"]) {
127 if (!account || account.type !== "chatgpt") return undefined;
128 return account.email;
130​
131export function mapCodexModelCapabilities(
132 model: CodexSchema.V2ModelListResponse__Model,
133): ModelCapabilities {
134 const reasoningOptions = model.supportedReasoningEfforts.map(({ reasoningEffort }) =>
135 reasoningEffort === model.defaultReasoningEffort
136 ? {
137 id: reasoningEffort,
138 label: reasoningEffortLabel(reasoningEffort),
139 isDefault: true,
140 }
141 : {
142 id: reasoningEffort,
143 label: reasoningEffortLabel(reasoningEffort),
144 },
145 );
146 const defaultReasoning = reasoningOptions.find((option) => option.isDefault)?.id;
147 const serviceTiers =
148 model.serviceTiers && model.serviceTiers.length > 0
149 ? model.serviceTiers
150 : (model.additionalSpeedTiers ?? []).map((id) => ({
151 id,
152 name: id === "fast" ? "Fast" : id,
153 description: "",
154 }));
155 const catalogDefaultServiceTier = serviceTiers.some(
156 (tier) => tier.id === model.defaultServiceTier,
157 )
158 ? model.defaultServiceTier
159 : null;
160 const defaultServiceTier = catalogDefaultServiceTier ?? DEFAULT_SERVICE_TIER_ID;
161 const optionDescriptors: ProviderOptionDescriptor[] = [];
162​
163 if (reasoningOptions.length > 0) {
164 optionDescriptors.push({
165 id: "reasoningEffort",
166 label: "Reasoning",
167 type: "select",
168 options: reasoningOptions,
169 ...(defaultReasoning ? { currentValue: defaultReasoning } : {}),
170 });
171 }
172 if (serviceTiers.length > 0) {
173 optionDescriptors.push({
174 id: "serviceTier",
175 label: "Service Tier",
176 type: "select",
177 options: [
178 {
179 id: DEFAULT_SERVICE_TIER_ID,
180 label: "Standard",
181 ...(defaultServiceTier === DEFAULT_SERVICE_TIER_ID ? { isDefault: true } : {}),
182 },
183 ...serviceTiers.map((tier) => ({
184 id: tier.id,
185 label: tier.name,
186 ...(tier.description ? { description: tier.description } : {}),
187 ...(defaultServiceTier === tier.id ? { isDefault: true } : {}),
188 })),
189 ],
190 currentValue: defaultServiceTier,
191 });
192 }
193​
194 return createModelCapabilities({
195 optionDescriptors,
196 });
198​
199const toDisplayName = (model: CodexSchema.V2ModelListResponse__Model): string => {
200 // Capitalize 'gpt' to 'GPT-' and capitalize any letter following a dash
201 return model.displayName
202 .replace(/^gpt/i, "GPT") // Handle start with 'gpt' or 'GPT'
203 .replace(/-([a-z])/g, (_, c) => "-" + c.toUpperCase());
204};
205​
206function parseCodexModelListResponse(
207 response: CodexSchema.V2ModelListResponse,
208): ReadonlyArray<ServerProviderModel> {
209 return response.data.map((model) => ({
210 slug: model.model,
211 name: toDisplayName(model),
212 isCustom: false,
213 ...(model.isDefault ? { isDefault: true } : {}),
214 capabilities: mapCodexModelCapabilities(model),
215 }));
217​
218/**
219 * Prefer our own default-model ranking when one of the preferred slugs is in
220 * the live catalog; otherwise keep whatever Codex itself flagged as default.
221 */
222export function applyPreferredCodexDefaultModel(
223 models: ReadonlyArray<ServerProviderModel>,
224): ReadonlyArray<ServerProviderModel> {
225 const preferredSlug = PREFERRED_DEFAULT_CODEX_MODELS.find((slug) =>
226 models.some((model) => model.slug === slug && !model.isCustom),
227 );
228 if (!preferredSlug) {
229 return models;
230 }
231 return models.map((model) => {
232 if (model.slug === preferredSlug) {
233 return model.isDefault ? model : { ...model, isDefault: true };
234 }
235 if (!model.isDefault) {
236 return model;
237 }
238 const { isDefault: _isDefault, ...rest } = model;
239 return rest;
240 });
242​
243function appendCustomCodexModels(
244 models: ReadonlyArray<ServerProviderModel>,
245 customModels: ReadonlyArray<string>,
246): ReadonlyArray<ServerProviderModel> {
247 if (customModels.length === 0) {
248 return models;
249 }
250​
251 const seen = new Set(models.map((model) => model.slug));
252 const fallbackCapabilities = models.find((model) => model.capabilities)?.capabilities ?? null;
253 const customEntries: ServerProviderModel[] = [];
254 for (const rawModel of customModels) {
255 const slug = rawModel.trim();
256 if (!slug || seen.has(slug)) {
257 continue;
258 }
259 seen.add(slug);
260 customEntries.push({
261 slug,
262 name: slug,
263 isCustom: true,
264 capabilities: fallbackCapabilities,
265 });
266 }
267 return customEntries.length === 0 ? models : [...models, ...customEntries];
269​
270function parseCodexSkillsListResponse(
271 response: CodexSchema.V2SkillsListResponse,
272 cwd: string,
273): ReadonlyArray<ServerProviderSkill> {
274 const matchingEntry = response.data.find((entry) => entry.cwd === cwd);
275 const skills = matchingEntry
276 ? matchingEntry.skills
277 : response.data.flatMap((entry) => entry.skills);
278​
279 return skills.map((skill) => {
280 const shortDescription =
281 skill.shortDescription ?? skill.interface?.shortDescription ?? undefined;
282​
283 const parsedSkill: Types.Mutable<ServerProviderSkill> = {
284 name: skill.name,
285 path: skill.path,
286 enabled: skill.enabled,
287 };
288​
289 if (skill.description) {
290 parsedSkill.description = skill.description;
291 }
292 if (skill.scope) {
293 parsedSkill.scope = skill.scope;
294 }
295 if (skill.interface?.displayName) {
296 parsedSkill.displayName = skill.interface.displayName;
297 }
298 if (shortDescription) {
299 parsedSkill.shortDescription = shortDescription;
300 }
301​
302 return parsedSkill;
303 });
305​
306const requestAllCodexModels = Effect.fn("requestAllCodexModels")(function* (
307 client: CodexClient.CodexAppServerClient["Service"],
308) {
309 const models: ServerProviderModel[] = [];
310 let cursor: string | null | undefined = undefined;
311​
312 do {
313 const response: CodexSchema.V2ModelListResponse = yield* client.request(
314 "model/list",
315 cursor ? { cursor } : {},
316 );
317 models.push(...parseCodexModelListResponse(response));
318 cursor = response.nextCursor;
319 } while (cursor);
320​
321 return models;
322});
323​
324export function buildCodexInitializeParams(): CodexSchema.V1InitializeParams {
325 return {
326 clientInfo: {
327 name: "t3code_desktop",
328 title: "T3 Code Desktop",
329 version: packageJson.version,
330 },
331 capabilities: {
332 experimentalApi: true,
333 },
334 };
336​
337const probeCodexAppServerProvider = Effect.fn("probeCodexAppServerProvider")(function* (input: {
338 readonly binaryPath: string;
339 readonly homePath?: string;
340 readonly launchArgs?: string;
341 readonly cwd: string;
342 readonly customModels?: ReadonlyArray<string>;
343 readonly environment?: NodeJS.ProcessEnv;
344}) {
345 // `~` is not shell-expanded when env vars are set via `child_process.spawn`,
346 // so `CODEX_HOME=~/.codex_work` would reach codex verbatim and trip
347 // "CODEX_HOME points to '~/.codex_work', but that path does not exist".
348 // Expand here for parity with `CodexTextGeneration`/`CodexSessionRuntime`.
349 const resolvedHomePath = input.homePath ? expandHomePath(input.homePath) : undefined;
350 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
351 const environment = {
352 ...input.environment,
353 ...(resolvedHomePath ? { CODEX_HOME: resolvedHomePath } : {}),
354 };
355 const spawnCommand = yield* resolveSpawnCommand(
356 input.binaryPath,
357 codexAppServerArgs(input.launchArgs),
358 {
359 env: environment,
360 extendEnv: true,
361 },
362 );
363 const child = yield* spawner
364 .spawn(
365 ChildProcess.make(spawnCommand.command, spawnCommand.args, {
366 cwd: input.cwd,
367 env: environment,
368 extendEnv: true,
369 forceKillAfter: CODEX_APP_SERVER_PROBE_FORCE_KILL_AFTER,
370 shell: spawnCommand.shell,
371 }),
372 )
373 .pipe(
374 Effect.mapError(
375 (cause) =>
376 new CodexErrors.CodexAppServerSpawnError({
377 command: `${input.binaryPath} app-server`,
378 cause,
379 }),
380 ),
381 );
382 const clientContext = yield* Layer.build(CodexClient.layerChildProcess(child));
383 const client = yield* Effect.service(CodexClient.CodexAppServerClient).pipe(
384 Effect.provide(clientContext),
385 );
386​
387 const initialize = yield* client.request("initialize", {
388 clientInfo: {
389 name: "t3code_desktop",
390 title: "T3 Code Desktop",
391 version: "0.1.0",
392 },
393 capabilities: {
394 experimentalApi: true,
395 },
396 });
397 yield* client.notify("initialized", undefined);
398​
399 // Extract the version string after the first '/' in userAgent, up to the next space or the end
400 const versionMatch = initialize.userAgent.match(/\/([^\s]+)/);
401 const version = versionMatch ? versionMatch[1] : undefined;
402​
403 const accountResponse = yield* client.request("account/read", {});
404 if (!accountResponse.account && accountResponse.requiresOpenaiAuth) {
405 return {
406 account: accountResponse,
407 version,
408 models: appendCustomCodexModels([], input.customModels ?? []),
409 skills: [],
410 } satisfies CodexAppServerProviderSnapshot;
411 }
412​
413 const [skillsResponse, models, rateLimits] = yield* Effect.all(
414 [
415 client.request("skills/list", {
416 cwds: [input.cwd],
417 }),
418 requestAllCodexModels(client),
419 // Usage is an enrichment: a failure or a slow answer degrades to "no
420 // usage this probe" rather than costing the account and models.
421 client.request("account/rateLimits/read", undefined).pipe(
422 Effect.map((response): CodexRateLimitsProbe => ({ snapshot: response.rateLimits })),
423 Effect.timeoutOption(Duration.millis(RATE_LIMITS_PROBE_TIMEOUT_MS)),
424 Effect.map(
425 Option.getOrElse((): CodexRateLimitsProbe => ({
426 failure: "Codex did not answer the usage request.",
427 })),
428 ),
429 Effect.catch((error) =>
430 Effect.logDebug("Codex rate-limit read failed.", { cause: error }).pipe(
431 Effect.as<CodexRateLimitsProbe>({ failure: codexRateLimitsFailureMessage(error) }),
432 ),
433 ),
434 ),
435 ],
436 { concurrency: "unbounded" },
437 );
438​
439 return {
440 account: accountResponse,
441 rateLimits,
442 version,
443 models: applyPreferredCodexDefaultModel(
444 appendCustomCodexModels(models, input.customModels ?? []),
445 ),
446 skills: parseCodexSkillsListResponse(skillsResponse, input.cwd),
447 } satisfies CodexAppServerProviderSnapshot;
448});
449​
450export const probeCodexSkillsForCwd = Effect.fn("probeCodexSkillsForCwd")(function* (input: {
451 readonly binaryPath: string;
452 readonly homePath?: string;
453 readonly launchArgs?: string;
454 readonly cwd: string;
455 readonly environment?: NodeJS.ProcessEnv;
456}) {
457 const resolvedHomePath = input.homePath ? expandHomePath(input.homePath) : undefined;
458 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
459 const environment = {
460 ...input.environment,
461 ...(resolvedHomePath ? { CODEX_HOME: resolvedHomePath } : {}),
462 };
463 const spawnCommand = yield* resolveSpawnCommand(
464 input.binaryPath,
465 codexAppServerArgs(input.launchArgs),
466 { env: environment, extendEnv: true },
467 );
468 const child = yield* spawner
469 .spawn(
470 ChildProcess.make(spawnCommand.command, spawnCommand.args, {
471 cwd: input.cwd,
472 env: environment,
473 extendEnv: true,
474 forceKillAfter: CODEX_APP_SERVER_PROBE_FORCE_KILL_AFTER,
475 shell: spawnCommand.shell,
476 }),
477 )
478 .pipe(
479 Effect.mapError(
480 (cause) =>
481 new CodexErrors.CodexAppServerSpawnError({
482 command: `${input.binaryPath} app-server`,
483 cause,
484 }),
485 ),
486 );
487 const clientContext = yield* Layer.build(CodexClient.layerChildProcess(child));
488 const client = yield* Effect.service(CodexClient.CodexAppServerClient).pipe(
489 Effect.provide(clientContext),
490 );
491 yield* client.request("initialize", buildCodexInitializeParams());
492 yield* client.notify("initialized", undefined);
493 const skillsResponse = yield* client.request("skills/list", { cwds: [input.cwd] });
494 return parseCodexSkillsListResponse(skillsResponse, input.cwd);
495});
496​
497const emptyCodexModelsFromSettings = (codexSettings: CodexSettings): ServerProvider["models"] => {
498 const models = new Set<string>();
499 for (const model of codexSettings.customModels) {
500 const trimmed = model.trim();
501 if (trimmed.length > 0) {
502 models.add(trimmed);
503 }
504 }
505 return Array.from(models, (model) => ({
506 slug: model,
507 name: model,
508 isCustom: true,
509 capabilities: null,
510 }));
511};
512​
513const makePendingCodexProvider = (
514 codexSettings: CodexSettings,
515): Effect.Effect<ServerProviderDraft> =>
516 Effect.gen(function* () {
517 const checkedAt = yield* Effect.map(DateTime.now, DateTime.formatIso);
518 const models = emptyCodexModelsFromSettings(codexSettings);
519​
520 if (!codexSettings.enabled) {
521 return buildServerProvider({
522 presentation: CODEX_PRESENTATION,
523 enabled: false,
524 checkedAt,
525 models,
526 skills: [],
527 probe: {
528 installed: false,
529 version: null,
530 status: "warning",
531 auth: { status: "unknown" },
532 message: "Codex is disabled in T3 Code settings.",
533 },
534 });
535 }
536​
537 return buildServerProvider({
538 presentation: CODEX_PRESENTATION,
539 enabled: true,
540 checkedAt,
541 models,
542 skills: [],
543 probe: {
544 installed: false,
545 version: null,
546 status: "warning",
547 auth: { status: "unknown" },
548 message: "Codex provider status has not been checked in this session yet.",
549 },
550 });
551 });
552​
553function accountProbeStatus(account: CodexAppServerProviderSnapshot["account"]): {
554 readonly status: Exclude<ServerProviderState, "disabled">;
555 readonly auth: ServerProvider["auth"];
556 readonly message?: string;
557} {
558 const authLabel = codexAccountAuthLabel(account.account);
559 const authEmail = codexAccountEmail(account.account);
560 const auth = {
561 status: account.account ? ("authenticated" as const) : ("unknown" as const),
562 ...(account.account?.type ? { type: account.account?.type } : {}),
563 ...(authLabel ? { label: authLabel } : {}),
564 ...(authEmail ? { email: authEmail } : {}),
565 } satisfies ServerProvider["auth"];
566​
567 if (account.account) {
568 return { status: "ready", auth };
569 }
570​
571 if (account.requiresOpenaiAuth) {
572 return {
573 status: "error",
574 auth: { status: "unauthenticated" },
575 message: "Codex CLI is not authenticated. Run `codex login` and try again.",
576 };
577 }
578​
579 return { status: "ready", auth };
581​
582export const checkCodexProviderStatus = Effect.fn("checkCodexProviderStatus")(function* (
583 codexSettings: CodexSettings,
584 probe: (input: {
585 readonly binaryPath: string;
586 readonly homePath?: string;
587 readonly launchArgs?: string;
588 readonly cwd: string;
589 readonly customModels: ReadonlyArray<string>;
590 readonly environment?: NodeJS.ProcessEnv;
591 }) => Effect.Effect<
592 CodexAppServerProviderSnapshot,
593 CodexErrors.CodexAppServerError,
594 ChildProcessSpawner.ChildProcessSpawner | Scope.Scope
595 > = probeCodexAppServerProvider,
596 environment?: NodeJS.ProcessEnv,
597): Effect.fn.Return<
598 ServerProviderDraft,
599 ServerSettingsError,
600 ChildProcessSpawner.ChildProcessSpawner
601> {
602 const resolvedEnvironment = environment ?? process.env;
603 const checkedAt = DateTime.formatIso(yield* DateTime.now);
604 const emptyModels = emptyCodexModelsFromSettings(codexSettings);
605​
606 if (!codexSettings.enabled) {
607 return buildServerProvider({
608 presentation: CODEX_PRESENTATION,
609 enabled: false,
610 checkedAt,
611 models: emptyModels,
612 skills: [],
613 probe: {
614 installed: false,
615 version: null,
616 status: "warning",
617 auth: { status: "unknown" },
618 message: "Codex is disabled in T3 Code settings.",
619 },
620 });
621 }
622​
623 const probeResult = yield* probe({
624 binaryPath: codexSettings.binaryPath,
625 homePath: codexSettings.homePath,
626 launchArgs: resolveCodexLaunchArgs(codexSettings.launchArgs, resolvedEnvironment),
627 cwd: process.cwd(),
628 customModels: codexSettings.customModels,
629 environment: resolvedEnvironment,
630 }).pipe(
631 Effect.scoped,
632 Effect.timeoutOption(Duration.millis(AUTH_PROBE_TIMEOUT_MS)),
633 Effect.result,
634 );
635​
636 if (Result.isFailure(probeResult)) {
637 const error = probeResult.failure;
638 const installed = !isCodexAppServerSpawnError(error);
639 return buildServerProvider({
640 presentation: CODEX_PRESENTATION,
641 enabled: codexSettings.enabled,
642 checkedAt,
643 models: emptyModels,
644 skills: [],
645 probe: {
646 installed,
647 version: null,
648 status: "error",
649 auth: { status: "unknown" },
650 message: installed
651 ? `Codex app-server provider probe failed: ${error.message}.`
652 : "Codex CLI (`codex`) was not found on PATH.",
653 },
654 });
655 }
656​
657 if (Option.isNone(probeResult.success)) {
658 return buildServerProvider({
659 presentation: CODEX_PRESENTATION,
660 enabled: codexSettings.enabled,
661 checkedAt,
662 models: emptyModels,
663 skills: [],
664 probe: {
665 installed: true,
666 version: null,
667 status: "error",
668 auth: { status: "unknown" },
669 message: "Timed out while checking Codex app-server provider status.",
670 },
671 });
672 }
673​
674 const snapshot = probeResult.success.value;
675 const accountStatus = accountProbeStatus(snapshot.account);
676 const usageLimits =
677 snapshot.account.account?.type === "apiKey"
678 ? makeUnavailableUsageLimits({ checkedAt, reason: "unsupported" })
679 : snapshot.rateLimits === undefined || "failure" in snapshot.rateLimits
680 ? makeUnavailableUsageLimits({
681 checkedAt,
682 reason: "probeFailed",
683 ...(snapshot.rateLimits ? { message: snapshot.rateLimits.failure } : {}),
684 })
685 : codexRateLimitsToLimits({ snapshot: snapshot.rateLimits.snapshot, checkedAt });
686​
687 return buildServerProvider({
688 presentation: CODEX_PRESENTATION,
689 enabled: codexSettings.enabled,
690 checkedAt,
691 models: snapshot.models,
692 skills: snapshot.skills,
693 slashCommands: [
694 COMPACT_SLASH_COMMAND,
695 {
696 name: "feedback",
697 description: "Send this thread and Codex logs to OpenAI",
698 input: { hint: "Describe the issue (optional)" },
699 },
700 ],
701 probe: {
702 installed: true,
703 version: snapshot.version ?? null,
704 status: accountStatus.status,
705 auth: accountStatus.auth,
706 ...(accountStatus.message ? { message: accountStatus.message } : {}),
707 usageLimits,
708 },
709 });
710});
711​
712// NOTE: the singleton `CodexProviderLive` Layer has been removed as part of
713// the per-instance-driver refactor. `CodexDriver.create()` builds a managed
714// snapshot per instance (each with its own `CodexSettings`) and hands the
715// resulting `ServerProviderShape` back as `ProviderInstance.snapshot`.
716//
717// The `makePendingCodexProvider` and `checkCodexProviderStatus` helpers are
718// re-exported for use by `CodexDriver`.
719export { makePendingCodexProvider };