Refresh Codex app-server protocol bindings
Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
1916ac6d55
commit
ddae737d6f
7 files changed
+3680
-1789
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import { assert, it } from "@effect/vitest";
|
||||
|
||||
import { mapCodexModelCapabilities } from "./CodexProvider.ts";
|
||||
|
||||
it("maps current Codex model capability fields", () => {
|
||||
const capabilities = mapCodexModelCapabilities({
|
||||
additionalSpeedTiers: [],
|
||||
defaultReasoningEffort: "super-high",
|
||||
description: "Test model",
|
||||
displayName: "GPT Test",
|
||||
hidden: false,
|
||||
id: "gpt-test",
|
||||
isDefault: true,
|
||||
model: "gpt-test",
|
||||
serviceTiers: [
|
||||
{
|
||||
id: "fast",
|
||||
name: "Fast",
|
||||
description: "Lower latency responses.",
|
||||
},
|
||||
],
|
||||
supportedReasoningEfforts: [
|
||||
{
|
||||
description: "Maximum reasoning",
|
||||
reasoningEffort: "super-high",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(capabilities.optionDescriptors, [
|
||||
{
|
||||
id: "reasoningEffort",
|
||||
label: "Reasoning",
|
||||
type: "select",
|
||||
options: [{ id: "super-high", label: "super-high", isDefault: true }],
|
||||
currentValue: "super-high",
|
||||
},
|
||||
{
|
||||
id: "fastMode",
|
||||
label: "Fast",
|
||||
description: "Lower latency responses.",
|
||||
type: "boolean",
|
||||
},
|
||||
]);
|
||||
});
|
||||
@@ -17,6 +17,7 @@ import type {
|
||||
ServerProvider,
|
||||
ServerProviderState,
|
||||
ModelCapabilities,
|
||||
ProviderOptionDescriptor,
|
||||
ServerProviderModel,
|
||||
ServerProviderSkill,
|
||||
} from "@t3tools/contracts";
|
||||
@@ -44,7 +45,7 @@ export interface CodexAppServerProviderSnapshot {
|
||||
readonly skills: ReadonlyArray<ServerProviderSkill>;
|
||||
}
|
||||
|
||||
const REASONING_EFFORT_LABELS: Record<CodexSchema.V2ModelListResponse__ReasoningEffort, string> = {
|
||||
const REASONING_EFFORT_LABELS: Readonly<Record<string, string>> = {
|
||||
none: "None",
|
||||
minimal: "Minimal",
|
||||
low: "Low",
|
||||
@@ -53,6 +54,10 @@ const REASONING_EFFORT_LABELS: Record<CodexSchema.V2ModelListResponse__Reasoning
|
||||
xhigh: "Extra High",
|
||||
};
|
||||
|
||||
function reasoningEffortLabel(reasoningEffort: string): string {
|
||||
return REASONING_EFFORT_LABELS[reasoningEffort] ?? reasoningEffort;
|
||||
}
|
||||
|
||||
function codexAccountAuthLabel(account: CodexSchema.V2GetAccountResponse["account"]) {
|
||||
if (!account) return undefined;
|
||||
if (account.type === "apiKey") return "OpenAI API Key";
|
||||
@@ -93,46 +98,47 @@ function codexAccountEmail(account: CodexSchema.V2GetAccountResponse["account"])
|
||||
return account.email;
|
||||
}
|
||||
|
||||
function mapCodexModelCapabilities(
|
||||
export function mapCodexModelCapabilities(
|
||||
model: CodexSchema.V2ModelListResponse__Model,
|
||||
): ModelCapabilities {
|
||||
const reasoningOptions = model.supportedReasoningEfforts.map(({ reasoningEffort }) =>
|
||||
reasoningEffort === model.defaultReasoningEffort
|
||||
? {
|
||||
id: reasoningEffort,
|
||||
label: REASONING_EFFORT_LABELS[reasoningEffort],
|
||||
label: reasoningEffortLabel(reasoningEffort),
|
||||
isDefault: true,
|
||||
}
|
||||
: {
|
||||
id: reasoningEffort,
|
||||
label: REASONING_EFFORT_LABELS[reasoningEffort],
|
||||
label: reasoningEffortLabel(reasoningEffort),
|
||||
},
|
||||
);
|
||||
const defaultReasoning = reasoningOptions.find((option) => option.isDefault)?.id;
|
||||
const supportsFastMode = (model.additionalSpeedTiers ?? []).includes("fast");
|
||||
const fastServiceTier = model.serviceTiers?.find((tier) => tier.id === "fast");
|
||||
const supportsFastMode =
|
||||
fastServiceTier !== undefined || (model.additionalSpeedTiers ?? []).includes("fast");
|
||||
const optionDescriptors: ProviderOptionDescriptor[] = [];
|
||||
|
||||
if (reasoningOptions.length > 0) {
|
||||
optionDescriptors.push({
|
||||
id: "reasoningEffort",
|
||||
label: "Reasoning",
|
||||
type: "select",
|
||||
options: reasoningOptions,
|
||||
...(defaultReasoning ? { currentValue: defaultReasoning } : {}),
|
||||
});
|
||||
}
|
||||
if (supportsFastMode) {
|
||||
optionDescriptors.push({
|
||||
id: "fastMode",
|
||||
label: fastServiceTier?.name ?? "Fast Mode",
|
||||
...(fastServiceTier?.description ? { description: fastServiceTier.description } : {}),
|
||||
type: "boolean",
|
||||
});
|
||||
}
|
||||
|
||||
return createModelCapabilities({
|
||||
optionDescriptors: [
|
||||
...(reasoningOptions.length > 0
|
||||
? [
|
||||
{
|
||||
id: "reasoningEffort",
|
||||
label: "Reasoning",
|
||||
type: "select" as const,
|
||||
options: reasoningOptions,
|
||||
...(defaultReasoning ? { currentValue: defaultReasoning } : {}),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(supportsFastMode
|
||||
? [
|
||||
{
|
||||
id: "fastMode",
|
||||
label: "Fast Mode",
|
||||
type: "boolean" as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
],
|
||||
optionDescriptors,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
} from "effect/unstable/http";
|
||||
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
|
||||
|
||||
const UPSTREAM_REF = "07b695190f30a450e4921f71f77473e564395c59";
|
||||
const UPSTREAM_REF = "b39f943a634a6e7ba86c3d6e8cf6d5f35e612566";
|
||||
const USER_AGENT = "effect-codex-app-server-generator";
|
||||
const GITHUB_API_BASE =
|
||||
"https://api.github.com/repos/openai/codex/contents/codex-rs/app-server-protocol";
|
||||
@@ -348,6 +348,7 @@ function resolveResponseTypeName(
|
||||
const overrides: Record<string, string> = {
|
||||
"account/logout": "LogoutAccountResponse",
|
||||
"account/rateLimits/read": "GetAccountRateLimitsResponse",
|
||||
"account/usage/read": "GetAccountTokenUsageResponse",
|
||||
"config/batchWrite": "ConfigWriteResponse",
|
||||
"config/mcpServer/reload": "McpServerRefreshResponse",
|
||||
"config/value/write": "ConfigWriteResponse",
|
||||
@@ -745,14 +746,16 @@ const generateFiles = Effect.fn("generateFiles")(function* () {
|
||||
yield* Effect.log(`Generated Codex App Server schemas from ${UPSTREAM_REF}`);
|
||||
|
||||
yield* Effect.service(ChildProcessSpawner.ChildProcessSpawner).pipe(
|
||||
Effect.flatMap((spawner) => spawner.spawn(ChildProcess.make("bun", ["oxfmt", generatedDir]))),
|
||||
Effect.flatMap((spawner) =>
|
||||
spawner.spawn(ChildProcess.make("vp", ["fmt", generatedDir, "--write"])),
|
||||
),
|
||||
Effect.flatMap((child) => child.exitCode),
|
||||
Effect.tap((code) =>
|
||||
code === 0
|
||||
? Effect.void
|
||||
: Effect.fail(
|
||||
new GeneratorError({
|
||||
detail: `oxfmt failed with exit code ${code}`,
|
||||
detail: `vp fmt failed with exit code ${code}`,
|
||||
}),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// This file is generated by the effect-codex-app-server package. Do not edit manually.
|
||||
// Upstream protocol ref: 07b695190f30a450e4921f71f77473e564395c59
|
||||
// Upstream protocol ref: b39f943a634a6e7ba86c3d6e8cf6d5f35e612566
|
||||
|
||||
import * as CodexSchema from "./schema.gen.ts";
|
||||
|
||||
@@ -9,8 +9,12 @@ export const CLIENT_REQUEST_METHODS = {
|
||||
"thread/resume": "thread/resume",
|
||||
"thread/fork": "thread/fork",
|
||||
"thread/archive": "thread/archive",
|
||||
"thread/delete": "thread/delete",
|
||||
"thread/unsubscribe": "thread/unsubscribe",
|
||||
"thread/name/set": "thread/name/set",
|
||||
"thread/goal/set": "thread/goal/set",
|
||||
"thread/goal/get": "thread/goal/get",
|
||||
"thread/goal/clear": "thread/goal/clear",
|
||||
"thread/metadata/update": "thread/metadata/update",
|
||||
"thread/unarchive": "thread/unarchive",
|
||||
"thread/compact/start": "thread/compact/start",
|
||||
@@ -22,16 +26,19 @@ export const CLIENT_REQUEST_METHODS = {
|
||||
"thread/read": "thread/read",
|
||||
"thread/inject_items": "thread/inject_items",
|
||||
"skills/list": "skills/list",
|
||||
"skills/extraRoots/set": "skills/extraRoots/set",
|
||||
"hooks/list": "hooks/list",
|
||||
"marketplace/add": "marketplace/add",
|
||||
"marketplace/remove": "marketplace/remove",
|
||||
"marketplace/upgrade": "marketplace/upgrade",
|
||||
"plugin/list": "plugin/list",
|
||||
"plugin/installed": "plugin/installed",
|
||||
"plugin/read": "plugin/read",
|
||||
"plugin/skill/read": "plugin/skill/read",
|
||||
"plugin/share/save": "plugin/share/save",
|
||||
"plugin/share/updateTargets": "plugin/share/updateTargets",
|
||||
"plugin/share/list": "plugin/share/list",
|
||||
"plugin/share/checkout": "plugin/share/checkout",
|
||||
"plugin/share/delete": "plugin/share/delete",
|
||||
"app/list": "app/list",
|
||||
"fs/readFile": "fs/readFile",
|
||||
@@ -53,6 +60,7 @@ export const CLIENT_REQUEST_METHODS = {
|
||||
"model/list": "model/list",
|
||||
"modelProvider/capabilities/read": "modelProvider/capabilities/read",
|
||||
"experimentalFeature/list": "experimentalFeature/list",
|
||||
"permissionProfile/list": "permissionProfile/list",
|
||||
"experimentalFeature/enablement/set": "experimentalFeature/enablement/set",
|
||||
"mcpServer/oauth/login": "mcpServer/oauth/login",
|
||||
"config/mcpServer/reload": "config/mcpServer/reload",
|
||||
@@ -65,6 +73,7 @@ export const CLIENT_REQUEST_METHODS = {
|
||||
"account/login/cancel": "account/login/cancel",
|
||||
"account/logout": "account/logout",
|
||||
"account/rateLimits/read": "account/rateLimits/read",
|
||||
"account/usage/read": "account/usage/read",
|
||||
"account/sendAddCreditsNudgeEmail": "account/sendAddCreditsNudgeEmail",
|
||||
"feedback/upload": "feedback/upload",
|
||||
"command/exec": "command/exec",
|
||||
@@ -96,6 +105,7 @@ export const SERVER_REQUEST_METHODS = {
|
||||
"item/permissions/requestApproval": "item/permissions/requestApproval",
|
||||
"item/tool/call": "item/tool/call",
|
||||
"account/chatgptAuthTokens/refresh": "account/chatgptAuthTokens/refresh",
|
||||
"attestation/generate": "attestation/generate",
|
||||
applyPatchApproval: "applyPatchApproval",
|
||||
execCommandApproval: "execCommandApproval",
|
||||
} as const;
|
||||
@@ -105,12 +115,14 @@ export const SERVER_NOTIFICATION_METHODS = {
|
||||
"thread/started": "thread/started",
|
||||
"thread/status/changed": "thread/status/changed",
|
||||
"thread/archived": "thread/archived",
|
||||
"thread/deleted": "thread/deleted",
|
||||
"thread/unarchived": "thread/unarchived",
|
||||
"thread/closed": "thread/closed",
|
||||
"skills/changed": "skills/changed",
|
||||
"thread/name/updated": "thread/name/updated",
|
||||
"thread/goal/updated": "thread/goal/updated",
|
||||
"thread/goal/cleared": "thread/goal/cleared",
|
||||
"thread/settings/updated": "thread/settings/updated",
|
||||
"thread/tokenUsage/updated": "thread/tokenUsage/updated",
|
||||
"turn/started": "turn/started",
|
||||
"hook/started": "hook/started",
|
||||
@@ -148,6 +160,7 @@ export const SERVER_NOTIFICATION_METHODS = {
|
||||
"thread/compacted": "thread/compacted",
|
||||
"model/rerouted": "model/rerouted",
|
||||
"model/verification": "model/verification",
|
||||
"turn/moderationMetadata": "turn/moderationMetadata",
|
||||
warning: "warning",
|
||||
guardianWarning: "guardianWarning",
|
||||
deprecationNotice: "deprecationNotice",
|
||||
@@ -178,8 +191,12 @@ export interface ClientRequestParamsByMethod {
|
||||
readonly "thread/resume": CodexSchema.V2ThreadResumeParams;
|
||||
readonly "thread/fork": CodexSchema.V2ThreadForkParams;
|
||||
readonly "thread/archive": CodexSchema.V2ThreadArchiveParams;
|
||||
readonly "thread/delete": CodexSchema.V2ThreadDeleteParams;
|
||||
readonly "thread/unsubscribe": CodexSchema.V2ThreadUnsubscribeParams;
|
||||
readonly "thread/name/set": CodexSchema.V2ThreadSetNameParams;
|
||||
readonly "thread/goal/set": CodexSchema.V2ThreadGoalSetParams;
|
||||
readonly "thread/goal/get": CodexSchema.V2ThreadGoalGetParams;
|
||||
readonly "thread/goal/clear": CodexSchema.V2ThreadGoalClearParams;
|
||||
readonly "thread/metadata/update": CodexSchema.V2ThreadMetadataUpdateParams;
|
||||
readonly "thread/unarchive": CodexSchema.V2ThreadUnarchiveParams;
|
||||
readonly "thread/compact/start": CodexSchema.V2ThreadCompactStartParams;
|
||||
@@ -191,16 +208,19 @@ export interface ClientRequestParamsByMethod {
|
||||
readonly "thread/read": CodexSchema.V2ThreadReadParams;
|
||||
readonly "thread/inject_items": CodexSchema.V2ThreadInjectItemsParams;
|
||||
readonly "skills/list": CodexSchema.V2SkillsListParams;
|
||||
readonly "skills/extraRoots/set": CodexSchema.V2SkillsExtraRootsSetParams;
|
||||
readonly "hooks/list": CodexSchema.V2HooksListParams;
|
||||
readonly "marketplace/add": CodexSchema.V2MarketplaceAddParams;
|
||||
readonly "marketplace/remove": CodexSchema.V2MarketplaceRemoveParams;
|
||||
readonly "marketplace/upgrade": CodexSchema.V2MarketplaceUpgradeParams;
|
||||
readonly "plugin/list": CodexSchema.V2PluginListParams;
|
||||
readonly "plugin/installed": CodexSchema.V2PluginInstalledParams;
|
||||
readonly "plugin/read": CodexSchema.V2PluginReadParams;
|
||||
readonly "plugin/skill/read": CodexSchema.V2PluginSkillReadParams;
|
||||
readonly "plugin/share/save": CodexSchema.V2PluginShareSaveParams;
|
||||
readonly "plugin/share/updateTargets": CodexSchema.V2PluginShareUpdateTargetsParams;
|
||||
readonly "plugin/share/list": CodexSchema.V2PluginShareListParams;
|
||||
readonly "plugin/share/checkout": CodexSchema.V2PluginShareCheckoutParams;
|
||||
readonly "plugin/share/delete": CodexSchema.V2PluginShareDeleteParams;
|
||||
readonly "app/list": CodexSchema.V2AppsListParams;
|
||||
readonly "fs/readFile": CodexSchema.V2FsReadFileParams;
|
||||
@@ -222,6 +242,7 @@ export interface ClientRequestParamsByMethod {
|
||||
readonly "model/list": CodexSchema.V2ModelListParams;
|
||||
readonly "modelProvider/capabilities/read": CodexSchema.V2ModelProviderCapabilitiesReadParams;
|
||||
readonly "experimentalFeature/list": CodexSchema.V2ExperimentalFeatureListParams;
|
||||
readonly "permissionProfile/list": CodexSchema.V2PermissionProfileListParams;
|
||||
readonly "experimentalFeature/enablement/set": CodexSchema.V2ExperimentalFeatureEnablementSetParams;
|
||||
readonly "mcpServer/oauth/login": CodexSchema.V2McpServerOauthLoginParams;
|
||||
readonly "config/mcpServer/reload": undefined;
|
||||
@@ -234,6 +255,7 @@ export interface ClientRequestParamsByMethod {
|
||||
readonly "account/login/cancel": CodexSchema.V2CancelLoginAccountParams;
|
||||
readonly "account/logout": undefined;
|
||||
readonly "account/rateLimits/read": undefined;
|
||||
readonly "account/usage/read": undefined;
|
||||
readonly "account/sendAddCreditsNudgeEmail": CodexSchema.V2SendAddCreditsNudgeEmailParams;
|
||||
readonly "feedback/upload": CodexSchema.V2FeedbackUploadParams;
|
||||
readonly "command/exec": CodexSchema.V2CommandExecParams;
|
||||
@@ -259,8 +281,12 @@ export interface ClientRequestResponsesByMethod {
|
||||
readonly "thread/resume": CodexSchema.V2ThreadResumeResponse;
|
||||
readonly "thread/fork": CodexSchema.V2ThreadForkResponse;
|
||||
readonly "thread/archive": CodexSchema.V2ThreadArchiveResponse;
|
||||
readonly "thread/delete": CodexSchema.V2ThreadDeleteResponse;
|
||||
readonly "thread/unsubscribe": CodexSchema.V2ThreadUnsubscribeResponse;
|
||||
readonly "thread/name/set": CodexSchema.V2ThreadSetNameResponse;
|
||||
readonly "thread/goal/set": CodexSchema.V2ThreadGoalSetResponse;
|
||||
readonly "thread/goal/get": CodexSchema.V2ThreadGoalGetResponse;
|
||||
readonly "thread/goal/clear": CodexSchema.V2ThreadGoalClearResponse;
|
||||
readonly "thread/metadata/update": CodexSchema.V2ThreadMetadataUpdateResponse;
|
||||
readonly "thread/unarchive": CodexSchema.V2ThreadUnarchiveResponse;
|
||||
readonly "thread/compact/start": CodexSchema.V2ThreadCompactStartResponse;
|
||||
@@ -272,16 +298,19 @@ export interface ClientRequestResponsesByMethod {
|
||||
readonly "thread/read": CodexSchema.V2ThreadReadResponse;
|
||||
readonly "thread/inject_items": CodexSchema.V2ThreadInjectItemsResponse;
|
||||
readonly "skills/list": CodexSchema.V2SkillsListResponse;
|
||||
readonly "skills/extraRoots/set": CodexSchema.V2SkillsExtraRootsSetResponse;
|
||||
readonly "hooks/list": CodexSchema.V2HooksListResponse;
|
||||
readonly "marketplace/add": CodexSchema.V2MarketplaceAddResponse;
|
||||
readonly "marketplace/remove": CodexSchema.V2MarketplaceRemoveResponse;
|
||||
readonly "marketplace/upgrade": CodexSchema.V2MarketplaceUpgradeResponse;
|
||||
readonly "plugin/list": CodexSchema.V2PluginListResponse;
|
||||
readonly "plugin/installed": CodexSchema.V2PluginInstalledResponse;
|
||||
readonly "plugin/read": CodexSchema.V2PluginReadResponse;
|
||||
readonly "plugin/skill/read": CodexSchema.V2PluginSkillReadResponse;
|
||||
readonly "plugin/share/save": CodexSchema.V2PluginShareSaveResponse;
|
||||
readonly "plugin/share/updateTargets": CodexSchema.V2PluginShareUpdateTargetsResponse;
|
||||
readonly "plugin/share/list": CodexSchema.V2PluginShareListResponse;
|
||||
readonly "plugin/share/checkout": CodexSchema.V2PluginShareCheckoutResponse;
|
||||
readonly "plugin/share/delete": CodexSchema.V2PluginShareDeleteResponse;
|
||||
readonly "app/list": CodexSchema.V2AppsListResponse;
|
||||
readonly "fs/readFile": CodexSchema.V2FsReadFileResponse;
|
||||
@@ -303,6 +332,7 @@ export interface ClientRequestResponsesByMethod {
|
||||
readonly "model/list": CodexSchema.V2ModelListResponse;
|
||||
readonly "modelProvider/capabilities/read": CodexSchema.V2ModelProviderCapabilitiesReadResponse;
|
||||
readonly "experimentalFeature/list": CodexSchema.V2ExperimentalFeatureListResponse;
|
||||
readonly "permissionProfile/list": CodexSchema.V2PermissionProfileListResponse;
|
||||
readonly "experimentalFeature/enablement/set": CodexSchema.V2ExperimentalFeatureEnablementSetResponse;
|
||||
readonly "mcpServer/oauth/login": CodexSchema.V2McpServerOauthLoginResponse;
|
||||
readonly "config/mcpServer/reload": CodexSchema.V2McpServerRefreshResponse;
|
||||
@@ -315,6 +345,7 @@ export interface ClientRequestResponsesByMethod {
|
||||
readonly "account/login/cancel": CodexSchema.V2CancelLoginAccountResponse;
|
||||
readonly "account/logout": CodexSchema.V2LogoutAccountResponse;
|
||||
readonly "account/rateLimits/read": CodexSchema.V2GetAccountRateLimitsResponse;
|
||||
readonly "account/usage/read": CodexSchema.V2GetAccountTokenUsageResponse;
|
||||
readonly "account/sendAddCreditsNudgeEmail": CodexSchema.V2SendAddCreditsNudgeEmailResponse;
|
||||
readonly "feedback/upload": CodexSchema.V2FeedbackUploadResponse;
|
||||
readonly "command/exec": CodexSchema.V2CommandExecResponse;
|
||||
@@ -346,6 +377,7 @@ export interface ServerRequestParamsByMethod {
|
||||
readonly "item/permissions/requestApproval": CodexSchema.PermissionsRequestApprovalParams;
|
||||
readonly "item/tool/call": CodexSchema.DynamicToolCallParams;
|
||||
readonly "account/chatgptAuthTokens/refresh": CodexSchema.ChatgptAuthTokensRefreshParams;
|
||||
readonly "attestation/generate": CodexSchema.AttestationGenerateParams;
|
||||
readonly applyPatchApproval: CodexSchema.ApplyPatchApprovalParams;
|
||||
readonly execCommandApproval: CodexSchema.ExecCommandApprovalParams;
|
||||
}
|
||||
@@ -358,6 +390,7 @@ export interface ServerRequestResponsesByMethod {
|
||||
readonly "item/permissions/requestApproval": CodexSchema.PermissionsRequestApprovalResponse;
|
||||
readonly "item/tool/call": CodexSchema.DynamicToolCallResponse;
|
||||
readonly "account/chatgptAuthTokens/refresh": CodexSchema.ChatgptAuthTokensRefreshResponse;
|
||||
readonly "attestation/generate": CodexSchema.AttestationGenerateResponse;
|
||||
readonly applyPatchApproval: CodexSchema.ApplyPatchApprovalResponse;
|
||||
readonly execCommandApproval: CodexSchema.ExecCommandApprovalResponse;
|
||||
}
|
||||
@@ -367,12 +400,14 @@ export interface ServerNotificationParamsByMethod {
|
||||
readonly "thread/started": CodexSchema.V2ThreadStartedNotification;
|
||||
readonly "thread/status/changed": CodexSchema.V2ThreadStatusChangedNotification;
|
||||
readonly "thread/archived": CodexSchema.V2ThreadArchivedNotification;
|
||||
readonly "thread/deleted": CodexSchema.V2ThreadDeletedNotification;
|
||||
readonly "thread/unarchived": CodexSchema.V2ThreadUnarchivedNotification;
|
||||
readonly "thread/closed": CodexSchema.V2ThreadClosedNotification;
|
||||
readonly "skills/changed": CodexSchema.V2SkillsChangedNotification;
|
||||
readonly "thread/name/updated": CodexSchema.V2ThreadNameUpdatedNotification;
|
||||
readonly "thread/goal/updated": CodexSchema.V2ThreadGoalUpdatedNotification;
|
||||
readonly "thread/goal/cleared": CodexSchema.V2ThreadGoalClearedNotification;
|
||||
readonly "thread/settings/updated": CodexSchema.V2ThreadSettingsUpdatedNotification;
|
||||
readonly "thread/tokenUsage/updated": CodexSchema.V2ThreadTokenUsageUpdatedNotification;
|
||||
readonly "turn/started": CodexSchema.V2TurnStartedNotification;
|
||||
readonly "hook/started": CodexSchema.V2HookStartedNotification;
|
||||
@@ -410,6 +445,7 @@ export interface ServerNotificationParamsByMethod {
|
||||
readonly "thread/compacted": CodexSchema.V2ContextCompactedNotification;
|
||||
readonly "model/rerouted": CodexSchema.V2ModelReroutedNotification;
|
||||
readonly "model/verification": CodexSchema.V2ModelVerificationNotification;
|
||||
readonly "turn/moderationMetadata": CodexSchema.V2TurnModerationMetadataNotification;
|
||||
readonly warning: CodexSchema.V2WarningNotification;
|
||||
readonly guardianWarning: CodexSchema.V2GuardianWarningNotification;
|
||||
readonly deprecationNotice: CodexSchema.V2DeprecationNoticeNotification;
|
||||
@@ -435,8 +471,12 @@ export const CLIENT_REQUEST_PARAMS = {
|
||||
"thread/resume": CodexSchema.V2ThreadResumeParams,
|
||||
"thread/fork": CodexSchema.V2ThreadForkParams,
|
||||
"thread/archive": CodexSchema.V2ThreadArchiveParams,
|
||||
"thread/delete": CodexSchema.V2ThreadDeleteParams,
|
||||
"thread/unsubscribe": CodexSchema.V2ThreadUnsubscribeParams,
|
||||
"thread/name/set": CodexSchema.V2ThreadSetNameParams,
|
||||
"thread/goal/set": CodexSchema.V2ThreadGoalSetParams,
|
||||
"thread/goal/get": CodexSchema.V2ThreadGoalGetParams,
|
||||
"thread/goal/clear": CodexSchema.V2ThreadGoalClearParams,
|
||||
"thread/metadata/update": CodexSchema.V2ThreadMetadataUpdateParams,
|
||||
"thread/unarchive": CodexSchema.V2ThreadUnarchiveParams,
|
||||
"thread/compact/start": CodexSchema.V2ThreadCompactStartParams,
|
||||
@@ -448,16 +488,19 @@ export const CLIENT_REQUEST_PARAMS = {
|
||||
"thread/read": CodexSchema.V2ThreadReadParams,
|
||||
"thread/inject_items": CodexSchema.V2ThreadInjectItemsParams,
|
||||
"skills/list": CodexSchema.V2SkillsListParams,
|
||||
"skills/extraRoots/set": CodexSchema.V2SkillsExtraRootsSetParams,
|
||||
"hooks/list": CodexSchema.V2HooksListParams,
|
||||
"marketplace/add": CodexSchema.V2MarketplaceAddParams,
|
||||
"marketplace/remove": CodexSchema.V2MarketplaceRemoveParams,
|
||||
"marketplace/upgrade": CodexSchema.V2MarketplaceUpgradeParams,
|
||||
"plugin/list": CodexSchema.V2PluginListParams,
|
||||
"plugin/installed": CodexSchema.V2PluginInstalledParams,
|
||||
"plugin/read": CodexSchema.V2PluginReadParams,
|
||||
"plugin/skill/read": CodexSchema.V2PluginSkillReadParams,
|
||||
"plugin/share/save": CodexSchema.V2PluginShareSaveParams,
|
||||
"plugin/share/updateTargets": CodexSchema.V2PluginShareUpdateTargetsParams,
|
||||
"plugin/share/list": CodexSchema.V2PluginShareListParams,
|
||||
"plugin/share/checkout": CodexSchema.V2PluginShareCheckoutParams,
|
||||
"plugin/share/delete": CodexSchema.V2PluginShareDeleteParams,
|
||||
"app/list": CodexSchema.V2AppsListParams,
|
||||
"fs/readFile": CodexSchema.V2FsReadFileParams,
|
||||
@@ -479,6 +522,7 @@ export const CLIENT_REQUEST_PARAMS = {
|
||||
"model/list": CodexSchema.V2ModelListParams,
|
||||
"modelProvider/capabilities/read": CodexSchema.V2ModelProviderCapabilitiesReadParams,
|
||||
"experimentalFeature/list": CodexSchema.V2ExperimentalFeatureListParams,
|
||||
"permissionProfile/list": CodexSchema.V2PermissionProfileListParams,
|
||||
"experimentalFeature/enablement/set": CodexSchema.V2ExperimentalFeatureEnablementSetParams,
|
||||
"mcpServer/oauth/login": CodexSchema.V2McpServerOauthLoginParams,
|
||||
"config/mcpServer/reload": undefined,
|
||||
@@ -491,6 +535,7 @@ export const CLIENT_REQUEST_PARAMS = {
|
||||
"account/login/cancel": CodexSchema.V2CancelLoginAccountParams,
|
||||
"account/logout": undefined,
|
||||
"account/rateLimits/read": undefined,
|
||||
"account/usage/read": undefined,
|
||||
"account/sendAddCreditsNudgeEmail": CodexSchema.V2SendAddCreditsNudgeEmailParams,
|
||||
"feedback/upload": CodexSchema.V2FeedbackUploadParams,
|
||||
"command/exec": CodexSchema.V2CommandExecParams,
|
||||
@@ -516,8 +561,12 @@ export const CLIENT_REQUEST_RESPONSES = {
|
||||
"thread/resume": CodexSchema.V2ThreadResumeResponse,
|
||||
"thread/fork": CodexSchema.V2ThreadForkResponse,
|
||||
"thread/archive": CodexSchema.V2ThreadArchiveResponse,
|
||||
"thread/delete": CodexSchema.V2ThreadDeleteResponse,
|
||||
"thread/unsubscribe": CodexSchema.V2ThreadUnsubscribeResponse,
|
||||
"thread/name/set": CodexSchema.V2ThreadSetNameResponse,
|
||||
"thread/goal/set": CodexSchema.V2ThreadGoalSetResponse,
|
||||
"thread/goal/get": CodexSchema.V2ThreadGoalGetResponse,
|
||||
"thread/goal/clear": CodexSchema.V2ThreadGoalClearResponse,
|
||||
"thread/metadata/update": CodexSchema.V2ThreadMetadataUpdateResponse,
|
||||
"thread/unarchive": CodexSchema.V2ThreadUnarchiveResponse,
|
||||
"thread/compact/start": CodexSchema.V2ThreadCompactStartResponse,
|
||||
@@ -529,16 +578,19 @@ export const CLIENT_REQUEST_RESPONSES = {
|
||||
"thread/read": CodexSchema.V2ThreadReadResponse,
|
||||
"thread/inject_items": CodexSchema.V2ThreadInjectItemsResponse,
|
||||
"skills/list": CodexSchema.V2SkillsListResponse,
|
||||
"skills/extraRoots/set": CodexSchema.V2SkillsExtraRootsSetResponse,
|
||||
"hooks/list": CodexSchema.V2HooksListResponse,
|
||||
"marketplace/add": CodexSchema.V2MarketplaceAddResponse,
|
||||
"marketplace/remove": CodexSchema.V2MarketplaceRemoveResponse,
|
||||
"marketplace/upgrade": CodexSchema.V2MarketplaceUpgradeResponse,
|
||||
"plugin/list": CodexSchema.V2PluginListResponse,
|
||||
"plugin/installed": CodexSchema.V2PluginInstalledResponse,
|
||||
"plugin/read": CodexSchema.V2PluginReadResponse,
|
||||
"plugin/skill/read": CodexSchema.V2PluginSkillReadResponse,
|
||||
"plugin/share/save": CodexSchema.V2PluginShareSaveResponse,
|
||||
"plugin/share/updateTargets": CodexSchema.V2PluginShareUpdateTargetsResponse,
|
||||
"plugin/share/list": CodexSchema.V2PluginShareListResponse,
|
||||
"plugin/share/checkout": CodexSchema.V2PluginShareCheckoutResponse,
|
||||
"plugin/share/delete": CodexSchema.V2PluginShareDeleteResponse,
|
||||
"app/list": CodexSchema.V2AppsListResponse,
|
||||
"fs/readFile": CodexSchema.V2FsReadFileResponse,
|
||||
@@ -560,6 +612,7 @@ export const CLIENT_REQUEST_RESPONSES = {
|
||||
"model/list": CodexSchema.V2ModelListResponse,
|
||||
"modelProvider/capabilities/read": CodexSchema.V2ModelProviderCapabilitiesReadResponse,
|
||||
"experimentalFeature/list": CodexSchema.V2ExperimentalFeatureListResponse,
|
||||
"permissionProfile/list": CodexSchema.V2PermissionProfileListResponse,
|
||||
"experimentalFeature/enablement/set": CodexSchema.V2ExperimentalFeatureEnablementSetResponse,
|
||||
"mcpServer/oauth/login": CodexSchema.V2McpServerOauthLoginResponse,
|
||||
"config/mcpServer/reload": CodexSchema.V2McpServerRefreshResponse,
|
||||
@@ -572,6 +625,7 @@ export const CLIENT_REQUEST_RESPONSES = {
|
||||
"account/login/cancel": CodexSchema.V2CancelLoginAccountResponse,
|
||||
"account/logout": CodexSchema.V2LogoutAccountResponse,
|
||||
"account/rateLimits/read": CodexSchema.V2GetAccountRateLimitsResponse,
|
||||
"account/usage/read": CodexSchema.V2GetAccountTokenUsageResponse,
|
||||
"account/sendAddCreditsNudgeEmail": CodexSchema.V2SendAddCreditsNudgeEmailResponse,
|
||||
"feedback/upload": CodexSchema.V2FeedbackUploadResponse,
|
||||
"command/exec": CodexSchema.V2CommandExecResponse,
|
||||
@@ -603,6 +657,7 @@ export const SERVER_REQUEST_PARAMS = {
|
||||
"item/permissions/requestApproval": CodexSchema.PermissionsRequestApprovalParams,
|
||||
"item/tool/call": CodexSchema.DynamicToolCallParams,
|
||||
"account/chatgptAuthTokens/refresh": CodexSchema.ChatgptAuthTokensRefreshParams,
|
||||
"attestation/generate": CodexSchema.AttestationGenerateParams,
|
||||
applyPatchApproval: CodexSchema.ApplyPatchApprovalParams,
|
||||
execCommandApproval: CodexSchema.ExecCommandApprovalParams,
|
||||
} as const;
|
||||
@@ -615,6 +670,7 @@ export const SERVER_REQUEST_RESPONSES = {
|
||||
"item/permissions/requestApproval": CodexSchema.PermissionsRequestApprovalResponse,
|
||||
"item/tool/call": CodexSchema.DynamicToolCallResponse,
|
||||
"account/chatgptAuthTokens/refresh": CodexSchema.ChatgptAuthTokensRefreshResponse,
|
||||
"attestation/generate": CodexSchema.AttestationGenerateResponse,
|
||||
applyPatchApproval: CodexSchema.ApplyPatchApprovalResponse,
|
||||
execCommandApproval: CodexSchema.ExecCommandApprovalResponse,
|
||||
} as const;
|
||||
@@ -624,12 +680,14 @@ export const SERVER_NOTIFICATION_PARAMS = {
|
||||
"thread/started": CodexSchema.V2ThreadStartedNotification,
|
||||
"thread/status/changed": CodexSchema.V2ThreadStatusChangedNotification,
|
||||
"thread/archived": CodexSchema.V2ThreadArchivedNotification,
|
||||
"thread/deleted": CodexSchema.V2ThreadDeletedNotification,
|
||||
"thread/unarchived": CodexSchema.V2ThreadUnarchivedNotification,
|
||||
"thread/closed": CodexSchema.V2ThreadClosedNotification,
|
||||
"skills/changed": CodexSchema.V2SkillsChangedNotification,
|
||||
"thread/name/updated": CodexSchema.V2ThreadNameUpdatedNotification,
|
||||
"thread/goal/updated": CodexSchema.V2ThreadGoalUpdatedNotification,
|
||||
"thread/goal/cleared": CodexSchema.V2ThreadGoalClearedNotification,
|
||||
"thread/settings/updated": CodexSchema.V2ThreadSettingsUpdatedNotification,
|
||||
"thread/tokenUsage/updated": CodexSchema.V2ThreadTokenUsageUpdatedNotification,
|
||||
"turn/started": CodexSchema.V2TurnStartedNotification,
|
||||
"hook/started": CodexSchema.V2HookStartedNotification,
|
||||
@@ -669,6 +727,7 @@ export const SERVER_NOTIFICATION_PARAMS = {
|
||||
"thread/compacted": CodexSchema.V2ContextCompactedNotification,
|
||||
"model/rerouted": CodexSchema.V2ModelReroutedNotification,
|
||||
"model/verification": CodexSchema.V2ModelVerificationNotification,
|
||||
"turn/moderationMetadata": CodexSchema.V2TurnModerationMetadataNotification,
|
||||
warning: CodexSchema.V2WarningNotification,
|
||||
guardianWarning: CodexSchema.V2GuardianWarningNotification,
|
||||
deprecationNotice: CodexSchema.V2DeprecationNoticeNotification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// This file is generated by the effect-codex-app-server package. Do not edit manually.
|
||||
// Upstream protocol ref: 07b695190f30a450e4921f71f77473e564395c59
|
||||
// Upstream protocol ref: b39f943a634a6e7ba86c3d6e8cf6d5f35e612566
|
||||
|
||||
import * as CodexSchema from "./schema.gen.ts";
|
||||
|
||||
@@ -74,6 +74,7 @@ export const v2 = {
|
||||
GetAccountParams: CodexSchema.V2GetAccountParams,
|
||||
GetAccountRateLimitsResponse: CodexSchema.V2GetAccountRateLimitsResponse,
|
||||
GetAccountResponse: CodexSchema.V2GetAccountResponse,
|
||||
GetAccountTokenUsageResponse: CodexSchema.V2GetAccountTokenUsageResponse,
|
||||
GuardianWarningNotification: CodexSchema.V2GuardianWarningNotification,
|
||||
HookCompletedNotification: CodexSchema.V2HookCompletedNotification,
|
||||
HooksListParams: CodexSchema.V2HooksListParams,
|
||||
@@ -112,13 +113,19 @@ export const v2 = {
|
||||
ModelProviderCapabilitiesReadResponse: CodexSchema.V2ModelProviderCapabilitiesReadResponse,
|
||||
ModelReroutedNotification: CodexSchema.V2ModelReroutedNotification,
|
||||
ModelVerificationNotification: CodexSchema.V2ModelVerificationNotification,
|
||||
PermissionProfileListParams: CodexSchema.V2PermissionProfileListParams,
|
||||
PermissionProfileListResponse: CodexSchema.V2PermissionProfileListResponse,
|
||||
PlanDeltaNotification: CodexSchema.V2PlanDeltaNotification,
|
||||
PluginInstalledParams: CodexSchema.V2PluginInstalledParams,
|
||||
PluginInstalledResponse: CodexSchema.V2PluginInstalledResponse,
|
||||
PluginInstallParams: CodexSchema.V2PluginInstallParams,
|
||||
PluginInstallResponse: CodexSchema.V2PluginInstallResponse,
|
||||
PluginListParams: CodexSchema.V2PluginListParams,
|
||||
PluginListResponse: CodexSchema.V2PluginListResponse,
|
||||
PluginReadParams: CodexSchema.V2PluginReadParams,
|
||||
PluginReadResponse: CodexSchema.V2PluginReadResponse,
|
||||
PluginShareCheckoutParams: CodexSchema.V2PluginShareCheckoutParams,
|
||||
PluginShareCheckoutResponse: CodexSchema.V2PluginShareCheckoutResponse,
|
||||
PluginShareDeleteParams: CodexSchema.V2PluginShareDeleteParams,
|
||||
PluginShareDeleteResponse: CodexSchema.V2PluginShareDeleteResponse,
|
||||
PluginShareListParams: CodexSchema.V2PluginShareListParams,
|
||||
@@ -146,6 +153,8 @@ export const v2 = {
|
||||
SkillsChangedNotification: CodexSchema.V2SkillsChangedNotification,
|
||||
SkillsConfigWriteParams: CodexSchema.V2SkillsConfigWriteParams,
|
||||
SkillsConfigWriteResponse: CodexSchema.V2SkillsConfigWriteResponse,
|
||||
SkillsExtraRootsSetParams: CodexSchema.V2SkillsExtraRootsSetParams,
|
||||
SkillsExtraRootsSetResponse: CodexSchema.V2SkillsExtraRootsSetResponse,
|
||||
SkillsListParams: CodexSchema.V2SkillsListParams,
|
||||
SkillsListResponse: CodexSchema.V2SkillsListResponse,
|
||||
TerminalInteractionNotification: CodexSchema.V2TerminalInteractionNotification,
|
||||
@@ -158,9 +167,18 @@ export const v2 = {
|
||||
ThreadClosedNotification: CodexSchema.V2ThreadClosedNotification,
|
||||
ThreadCompactStartParams: CodexSchema.V2ThreadCompactStartParams,
|
||||
ThreadCompactStartResponse: CodexSchema.V2ThreadCompactStartResponse,
|
||||
ThreadDeletedNotification: CodexSchema.V2ThreadDeletedNotification,
|
||||
ThreadDeleteParams: CodexSchema.V2ThreadDeleteParams,
|
||||
ThreadDeleteResponse: CodexSchema.V2ThreadDeleteResponse,
|
||||
ThreadForkParams: CodexSchema.V2ThreadForkParams,
|
||||
ThreadForkResponse: CodexSchema.V2ThreadForkResponse,
|
||||
ThreadGoalClearedNotification: CodexSchema.V2ThreadGoalClearedNotification,
|
||||
ThreadGoalClearParams: CodexSchema.V2ThreadGoalClearParams,
|
||||
ThreadGoalClearResponse: CodexSchema.V2ThreadGoalClearResponse,
|
||||
ThreadGoalGetParams: CodexSchema.V2ThreadGoalGetParams,
|
||||
ThreadGoalGetResponse: CodexSchema.V2ThreadGoalGetResponse,
|
||||
ThreadGoalSetParams: CodexSchema.V2ThreadGoalSetParams,
|
||||
ThreadGoalSetResponse: CodexSchema.V2ThreadGoalSetResponse,
|
||||
ThreadGoalUpdatedNotification: CodexSchema.V2ThreadGoalUpdatedNotification,
|
||||
ThreadInjectItemsParams: CodexSchema.V2ThreadInjectItemsParams,
|
||||
ThreadInjectItemsResponse: CodexSchema.V2ThreadInjectItemsResponse,
|
||||
@@ -189,6 +207,7 @@ export const v2 = {
|
||||
ThreadRollbackResponse: CodexSchema.V2ThreadRollbackResponse,
|
||||
ThreadSetNameParams: CodexSchema.V2ThreadSetNameParams,
|
||||
ThreadSetNameResponse: CodexSchema.V2ThreadSetNameResponse,
|
||||
ThreadSettingsUpdatedNotification: CodexSchema.V2ThreadSettingsUpdatedNotification,
|
||||
ThreadShellCommandParams: CodexSchema.V2ThreadShellCommandParams,
|
||||
ThreadShellCommandResponse: CodexSchema.V2ThreadShellCommandResponse,
|
||||
ThreadStartedNotification: CodexSchema.V2ThreadStartedNotification,
|
||||
@@ -205,6 +224,7 @@ export const v2 = {
|
||||
TurnDiffUpdatedNotification: CodexSchema.V2TurnDiffUpdatedNotification,
|
||||
TurnInterruptParams: CodexSchema.V2TurnInterruptParams,
|
||||
TurnInterruptResponse: CodexSchema.V2TurnInterruptResponse,
|
||||
TurnModerationMetadataNotification: CodexSchema.V2TurnModerationMetadataNotification,
|
||||
TurnPlanUpdatedNotification: CodexSchema.V2TurnPlanUpdatedNotification,
|
||||
TurnStartedNotification: CodexSchema.V2TurnStartedNotification,
|
||||
TurnStartParams: CodexSchema.V2TurnStartParams,
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -10,6 +10,8 @@ import { assert, it } from "@effect/vitest";
|
||||
|
||||
import * as CodexError from "./errors.ts";
|
||||
import * as CodexProtocol from "./protocol.ts";
|
||||
import * as CodexRpc from "./rpc.ts";
|
||||
import * as CodexSchema from "./schema.ts";
|
||||
import { makeInMemoryStdio } from "./_internal/stdio.ts";
|
||||
const encodeUnknownJsonString = Schema.encodeUnknownSync(Schema.UnknownFromJsonString);
|
||||
|
||||
@@ -18,8 +20,28 @@ const encoder = new TextEncoder();
|
||||
const encodeJsonl = (value: unknown) => encoder.encode(`${encodeUnknownJsonString(value)}\n`);
|
||||
|
||||
const decodeJson = Schema.decodeEffect(Schema.UnknownFromJsonString);
|
||||
const decodeAccountTokenUsageResponse = Schema.decodeUnknownEffect(
|
||||
CodexRpc.CLIENT_REQUEST_RESPONSES["account/usage/read"],
|
||||
);
|
||||
|
||||
it.layer(NodeServices.layer)("effect-codex-app-server protocol", (it) => {
|
||||
it.effect("maps account usage responses to the upstream token usage schema", () =>
|
||||
Effect.gen(function* () {
|
||||
assert.strictEqual(
|
||||
CodexRpc.CLIENT_REQUEST_RESPONSES["account/usage/read"],
|
||||
CodexSchema.V2GetAccountTokenUsageResponse,
|
||||
);
|
||||
const decoded = yield* decodeAccountTokenUsageResponse({
|
||||
dailyUsageBuckets: [{ startDate: "2026-06-10", tokens: 42 }],
|
||||
summary: { lifetimeTokens: 42 },
|
||||
});
|
||||
assert.deepEqual(decoded, {
|
||||
dailyUsageBuckets: [{ startDate: "2026-06-10", tokens: 42 }],
|
||||
summary: { lifetimeTokens: 42 },
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect(
|
||||
"encodes requests without a jsonrpc field and routes inbound requests and notifications",
|
||||
() =>
|
||||
|
||||
Reference in new issue
Block a user