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