codex-relay 1.0.2 → 1.0.4
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/dist/api-schema.js +2 -2
- package/dist/api-schema2.js +178 -2
- package/dist/cli.js +1 -1
- package/dist/src.js +611 -41
- package/package.json +1 -1
- package/src/api-schema.ts +174 -0
package/package.json
CHANGED
package/src/api-schema.ts
CHANGED
|
@@ -42,6 +42,7 @@ export const VersionResponseSchema = z.object({
|
|
|
42
42
|
|
|
43
43
|
export const ThreadRunOptionsSchema = z.object({
|
|
44
44
|
model: z.string().trim().min(1).optional(),
|
|
45
|
+
serviceTier: z.string().trim().min(1).optional(),
|
|
45
46
|
runtimeMode: RuntimeModeSchema.optional(),
|
|
46
47
|
approvalPolicy: ApprovalModeSchema.optional(),
|
|
47
48
|
sandboxMode: SandboxModeSchema.optional(),
|
|
@@ -51,6 +52,7 @@ export const ThreadRunOptionsSchema = z.object({
|
|
|
51
52
|
|
|
52
53
|
export const RuntimePreferencesSchema = z.object({
|
|
53
54
|
model: z.string().trim().min(1).optional(),
|
|
55
|
+
serviceTier: z.string().trim().min(1).optional(),
|
|
54
56
|
runtimeMode: RuntimeModeSchema.default("default"),
|
|
55
57
|
reasoningEffort: ReasoningEffortSchema.optional(),
|
|
56
58
|
});
|
|
@@ -62,6 +64,7 @@ export const RuntimePreferencesByWorkspacePathSchema = z.record(
|
|
|
62
64
|
|
|
63
65
|
export const UpdateRuntimePreferencesRequestSchema = z.object({
|
|
64
66
|
model: z.string().trim().min(1).nullable().optional(),
|
|
67
|
+
serviceTier: z.string().trim().min(1).nullable().optional(),
|
|
65
68
|
runtimeMode: RuntimeModeSchema.optional(),
|
|
66
69
|
reasoningEffort: ReasoningEffortSchema.nullable().optional(),
|
|
67
70
|
threadId: z.string().trim().min(1).optional(),
|
|
@@ -83,6 +86,15 @@ export const CodexModelSchema = z.object({
|
|
|
83
86
|
isDefault: z.boolean().default(false),
|
|
84
87
|
defaultReasoningEffort: ReasoningEffortSchema.optional(),
|
|
85
88
|
supportedReasoningEfforts: z.array(ReasoningEffortSchema).default([]),
|
|
89
|
+
serviceTiers: z
|
|
90
|
+
.array(
|
|
91
|
+
z.object({
|
|
92
|
+
id: z.string().min(1),
|
|
93
|
+
name: z.string().min(1),
|
|
94
|
+
description: z.string().optional(),
|
|
95
|
+
}),
|
|
96
|
+
)
|
|
97
|
+
.default([]),
|
|
86
98
|
});
|
|
87
99
|
|
|
88
100
|
export const AgentSkillSourceSchema = z.enum(["workspace", "personal", "system", "plugin"]);
|
|
@@ -176,11 +188,31 @@ export const WorkspaceFileMentionSchema = z.object({
|
|
|
176
188
|
});
|
|
177
189
|
|
|
178
190
|
export const ListWorkspaceFilesResponseSchema = z.object({
|
|
191
|
+
directory: z.string(),
|
|
179
192
|
files: z.array(WorkspaceFileMentionSchema),
|
|
193
|
+
parentDirectory: z.string().nullable(),
|
|
180
194
|
query: z.string(),
|
|
181
195
|
workspacePath: z.string().min(1),
|
|
182
196
|
});
|
|
183
197
|
|
|
198
|
+
export const WorkspaceFileContentResponseSchema = z.object({
|
|
199
|
+
binary: z.boolean(),
|
|
200
|
+
content: z.string(),
|
|
201
|
+
directory: z.string(),
|
|
202
|
+
language: z.string(),
|
|
203
|
+
name: z.string().min(1),
|
|
204
|
+
path: z.string().min(1),
|
|
205
|
+
size: z.number().int().nonnegative(),
|
|
206
|
+
truncated: z.boolean(),
|
|
207
|
+
workspacePath: z.string().min(1),
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
export const UpdateWorkspaceFileContentRequestSchema = z.object({
|
|
211
|
+
content: z.string().max(1024 * 1024),
|
|
212
|
+
path: z.string().trim().min(1),
|
|
213
|
+
workspacePath: z.string().trim().min(1).optional(),
|
|
214
|
+
});
|
|
215
|
+
|
|
184
216
|
export const PendingInputRequestOptionSchema = z.object({
|
|
185
217
|
label: z.string().min(1),
|
|
186
218
|
description: z.string().optional(),
|
|
@@ -220,6 +252,7 @@ export const ThreadSummarySchema = z.object({
|
|
|
220
252
|
updatedAt: IsoDateTimeSchema,
|
|
221
253
|
state: ThreadStateSchema,
|
|
222
254
|
model: z.string().optional(),
|
|
255
|
+
serviceTier: z.string().optional(),
|
|
223
256
|
runtimeMode: RuntimeModeSchema.optional(),
|
|
224
257
|
approvalPolicy: ApprovalModeSchema.optional(),
|
|
225
258
|
sandboxMode: SandboxModeSchema.optional(),
|
|
@@ -319,6 +352,18 @@ export const WorkspaceGitActionResponseSchema = z.object({
|
|
|
319
352
|
output: z.string().default(""),
|
|
320
353
|
});
|
|
321
354
|
|
|
355
|
+
export const WORKSPACE_PREVIEW_TAB_VALUES = ["git", "files", "markdown", "web"] as const;
|
|
356
|
+
|
|
357
|
+
export const WorkspacePreviewTabSchema = z.enum(WORKSPACE_PREVIEW_TAB_VALUES);
|
|
358
|
+
|
|
359
|
+
export const WorkspaceMarkdownPreviewTargetSchema = z.object({
|
|
360
|
+
name: z.string().trim().min(1).optional(),
|
|
361
|
+
path: z.string().trim().min(1),
|
|
362
|
+
workspacePath: z.string().trim().min(1).optional(),
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
export const WORKSPACE_PREVIEW_OPEN_PROTOCOL = "workspace-preview.open" as const;
|
|
366
|
+
|
|
322
367
|
export const WebPreviewTargetSchema = z.object({
|
|
323
368
|
kind: z.literal("web"),
|
|
324
369
|
url: z.string().url(),
|
|
@@ -329,6 +374,33 @@ export const WebPreviewTargetSchema = z.object({
|
|
|
329
374
|
detectedAt: IsoDateTimeSchema,
|
|
330
375
|
});
|
|
331
376
|
|
|
377
|
+
const WorkspacePreviewOpenBaseSchema = z.object({
|
|
378
|
+
protocol: z.literal(WORKSPACE_PREVIEW_OPEN_PROTOCOL),
|
|
379
|
+
workspacePath: z.string().trim().min(1).optional(),
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
export const WorkspacePreviewNavigationRequestSchema = z.discriminatedUnion("tab", [
|
|
383
|
+
WorkspacePreviewOpenBaseSchema.extend({
|
|
384
|
+
tab: z.literal("git"),
|
|
385
|
+
}),
|
|
386
|
+
WorkspacePreviewOpenBaseSchema.extend({
|
|
387
|
+
tab: z.literal("files"),
|
|
388
|
+
target: z
|
|
389
|
+
.object({
|
|
390
|
+
path: z.string().trim().min(1).optional(),
|
|
391
|
+
})
|
|
392
|
+
.optional(),
|
|
393
|
+
}),
|
|
394
|
+
WorkspacePreviewOpenBaseSchema.extend({
|
|
395
|
+
tab: z.literal("markdown"),
|
|
396
|
+
target: WorkspaceMarkdownPreviewTargetSchema,
|
|
397
|
+
}),
|
|
398
|
+
WorkspacePreviewOpenBaseSchema.extend({
|
|
399
|
+
tab: z.literal("web"),
|
|
400
|
+
target: WebPreviewTargetSchema.optional(),
|
|
401
|
+
}),
|
|
402
|
+
]);
|
|
403
|
+
|
|
332
404
|
export const PairRequestSchema = z.object({
|
|
333
405
|
clientSessionId: z.string().trim().min(1).max(120).optional(),
|
|
334
406
|
clientName: z.string().trim().min(1).max(80).optional(),
|
|
@@ -592,6 +664,11 @@ export type WorkspaceSelectionRequest = z.infer<typeof WorkspaceSelectionRequest
|
|
|
592
664
|
export type CheckoutWorkspaceBranchRequest = z.infer<typeof CheckoutWorkspaceBranchRequestSchema>;
|
|
593
665
|
export type CommitPushWorkspaceRequest = z.infer<typeof CommitPushWorkspaceRequestSchema>;
|
|
594
666
|
export type WorkspaceGitActionResponse = z.infer<typeof WorkspaceGitActionResponseSchema>;
|
|
667
|
+
export type WorkspacePreviewTab = z.infer<typeof WorkspacePreviewTabSchema>;
|
|
668
|
+
export type WorkspaceMarkdownPreviewTarget = z.infer<typeof WorkspaceMarkdownPreviewTargetSchema>;
|
|
669
|
+
export type WorkspacePreviewNavigationRequest = z.infer<
|
|
670
|
+
typeof WorkspacePreviewNavigationRequestSchema
|
|
671
|
+
>;
|
|
595
672
|
export type WebPreviewTarget = z.infer<typeof WebPreviewTargetSchema>;
|
|
596
673
|
export type PairRequest = z.infer<typeof PairRequestSchema>;
|
|
597
674
|
export type PairResponse = z.infer<typeof PairResponseSchema>;
|
|
@@ -619,6 +696,7 @@ export type ArchiveThreadResponse = z.infer<typeof ArchiveThreadResponseSchema>;
|
|
|
619
696
|
export type ListModelsResponse = z.infer<typeof ListModelsResponseSchema>;
|
|
620
697
|
export type ListSkillsResponse = z.infer<typeof ListSkillsResponseSchema>;
|
|
621
698
|
export type ListWorkspaceFilesResponse = z.infer<typeof ListWorkspaceFilesResponseSchema>;
|
|
699
|
+
export type WorkspaceFileContentResponse = z.infer<typeof WorkspaceFileContentResponseSchema>;
|
|
622
700
|
|
|
623
701
|
export function normalizePromptContext(input?: {
|
|
624
702
|
attachments?: PromptAttachment[] | null;
|
|
@@ -819,6 +897,9 @@ export type ThreadDetailResponse = z.infer<typeof ThreadDetailResponseSchema>;
|
|
|
819
897
|
export type ThreadMessageDetailField = z.infer<typeof ThreadMessageDetailFieldSchema>;
|
|
820
898
|
export type ThreadMessageDetailResponse = z.infer<typeof ThreadMessageDetailResponseSchema>;
|
|
821
899
|
export type StreamThreadRunEvent = z.infer<typeof StreamThreadRunEventSchema>;
|
|
900
|
+
export type UpdateWorkspaceFileContentRequest = z.infer<
|
|
901
|
+
typeof UpdateWorkspaceFileContentRequestSchema
|
|
902
|
+
>;
|
|
822
903
|
|
|
823
904
|
export const apiPaths = {
|
|
824
905
|
version: "/version",
|
|
@@ -832,6 +913,7 @@ export const apiPaths = {
|
|
|
832
913
|
models: "/v1/models",
|
|
833
914
|
skills: "/v1/skills",
|
|
834
915
|
workspaceFiles: "/v1/workspace/files",
|
|
916
|
+
workspaceFileContent: "/v1/workspace/file",
|
|
835
917
|
workspaceDirectories: "/v1/workspace-directories",
|
|
836
918
|
workspaceChanges: "/v1/workspace/changes",
|
|
837
919
|
workspaceCheckout: "/v1/workspace/checkout",
|
|
@@ -950,6 +1032,37 @@ export function createOpenApiDocument() {
|
|
|
950
1032
|
},
|
|
951
1033
|
},
|
|
952
1034
|
},
|
|
1035
|
+
"/v1/workspace/files": {
|
|
1036
|
+
get: {
|
|
1037
|
+
summary: "List files under the configured workspace",
|
|
1038
|
+
responses: {
|
|
1039
|
+
"200": jsonResponse("ListWorkspaceFilesResponse"),
|
|
1040
|
+
"400": jsonResponse("ErrorResponse"),
|
|
1041
|
+
"502": jsonResponse("ErrorResponse"),
|
|
1042
|
+
},
|
|
1043
|
+
},
|
|
1044
|
+
},
|
|
1045
|
+
"/v1/workspace/file": {
|
|
1046
|
+
get: {
|
|
1047
|
+
summary: "Read a workspace file preview",
|
|
1048
|
+
responses: {
|
|
1049
|
+
"200": jsonResponse("WorkspaceFileContentResponse"),
|
|
1050
|
+
"400": jsonResponse("ErrorResponse"),
|
|
1051
|
+
"404": jsonResponse("ErrorResponse"),
|
|
1052
|
+
"502": jsonResponse("ErrorResponse"),
|
|
1053
|
+
},
|
|
1054
|
+
},
|
|
1055
|
+
put: {
|
|
1056
|
+
summary: "Update a workspace text file",
|
|
1057
|
+
requestBody: jsonRequest("UpdateWorkspaceFileContentRequest"),
|
|
1058
|
+
responses: {
|
|
1059
|
+
"200": jsonResponse("WorkspaceFileContentResponse"),
|
|
1060
|
+
"400": jsonResponse("ErrorResponse"),
|
|
1061
|
+
"404": jsonResponse("ErrorResponse"),
|
|
1062
|
+
"502": jsonResponse("ErrorResponse"),
|
|
1063
|
+
},
|
|
1064
|
+
},
|
|
1065
|
+
},
|
|
953
1066
|
"/v1/threads/{threadId}/runs": {
|
|
954
1067
|
post: {
|
|
955
1068
|
summary: "Run a prompt on a Codex thread",
|
|
@@ -1055,6 +1168,7 @@ export function createOpenApiDocument() {
|
|
|
1055
1168
|
state: { $ref: "#/components/schemas/ThreadState" },
|
|
1056
1169
|
messageCount: { type: "integer", minimum: 0 },
|
|
1057
1170
|
model: { type: "string" },
|
|
1171
|
+
serviceTier: { type: "string" },
|
|
1058
1172
|
runtimeMode: { $ref: "#/components/schemas/RuntimeMode" },
|
|
1059
1173
|
approvalPolicy: { type: "string", enum: ["on-request", "on-failure", "never"] },
|
|
1060
1174
|
sandboxMode: {
|
|
@@ -1111,6 +1225,7 @@ export function createOpenApiDocument() {
|
|
|
1111
1225
|
required: ["runtimeMode"],
|
|
1112
1226
|
properties: {
|
|
1113
1227
|
model: { type: "string" },
|
|
1228
|
+
serviceTier: { type: "string" },
|
|
1114
1229
|
runtimeMode: {
|
|
1115
1230
|
type: "string",
|
|
1116
1231
|
enum: ["default", "auto", "full-access", "on-request"],
|
|
@@ -1128,6 +1243,7 @@ export function createOpenApiDocument() {
|
|
|
1128
1243
|
threadId: { type: "string" },
|
|
1129
1244
|
workspacePath: { type: "string" },
|
|
1130
1245
|
model: { type: "string", nullable: true },
|
|
1246
|
+
serviceTier: { type: "string", nullable: true },
|
|
1131
1247
|
runtimeMode: {
|
|
1132
1248
|
type: "string",
|
|
1133
1249
|
enum: ["default", "auto", "full-access", "on-request"],
|
|
@@ -1173,6 +1289,64 @@ export function createOpenApiDocument() {
|
|
|
1173
1289
|
},
|
|
1174
1290
|
},
|
|
1175
1291
|
},
|
|
1292
|
+
WorkspaceFileMention: {
|
|
1293
|
+
type: "object",
|
|
1294
|
+
required: ["directory", "kind", "name", "path"],
|
|
1295
|
+
properties: {
|
|
1296
|
+
directory: { type: "string" },
|
|
1297
|
+
kind: { type: "string", enum: ["directory", "file"] },
|
|
1298
|
+
name: { type: "string" },
|
|
1299
|
+
path: { type: "string" },
|
|
1300
|
+
},
|
|
1301
|
+
},
|
|
1302
|
+
ListWorkspaceFilesResponse: {
|
|
1303
|
+
type: "object",
|
|
1304
|
+
required: ["directory", "files", "parentDirectory", "query", "workspacePath"],
|
|
1305
|
+
properties: {
|
|
1306
|
+
directory: { type: "string" },
|
|
1307
|
+
files: {
|
|
1308
|
+
type: "array",
|
|
1309
|
+
items: { $ref: "#/components/schemas/WorkspaceFileMention" },
|
|
1310
|
+
},
|
|
1311
|
+
parentDirectory: { type: "string", nullable: true },
|
|
1312
|
+
query: { type: "string" },
|
|
1313
|
+
workspacePath: { type: "string" },
|
|
1314
|
+
},
|
|
1315
|
+
},
|
|
1316
|
+
WorkspaceFileContentResponse: {
|
|
1317
|
+
type: "object",
|
|
1318
|
+
required: [
|
|
1319
|
+
"binary",
|
|
1320
|
+
"content",
|
|
1321
|
+
"directory",
|
|
1322
|
+
"language",
|
|
1323
|
+
"name",
|
|
1324
|
+
"path",
|
|
1325
|
+
"size",
|
|
1326
|
+
"truncated",
|
|
1327
|
+
"workspacePath",
|
|
1328
|
+
],
|
|
1329
|
+
properties: {
|
|
1330
|
+
binary: { type: "boolean" },
|
|
1331
|
+
content: { type: "string" },
|
|
1332
|
+
directory: { type: "string" },
|
|
1333
|
+
language: { type: "string" },
|
|
1334
|
+
name: { type: "string" },
|
|
1335
|
+
path: { type: "string" },
|
|
1336
|
+
size: { type: "integer", minimum: 0 },
|
|
1337
|
+
truncated: { type: "boolean" },
|
|
1338
|
+
workspacePath: { type: "string" },
|
|
1339
|
+
},
|
|
1340
|
+
},
|
|
1341
|
+
UpdateWorkspaceFileContentRequest: {
|
|
1342
|
+
type: "object",
|
|
1343
|
+
required: ["content", "path"],
|
|
1344
|
+
properties: {
|
|
1345
|
+
content: { type: "string", maxLength: 1048576 },
|
|
1346
|
+
path: { type: "string" },
|
|
1347
|
+
workspacePath: { type: "string" },
|
|
1348
|
+
},
|
|
1349
|
+
},
|
|
1176
1350
|
CreateThreadRequest: {
|
|
1177
1351
|
type: "object",
|
|
1178
1352
|
properties: {
|