codex-relay 1.0.3 → 1.0.5
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/README.md +3 -2
- package/dist/api-schema.js +2 -2
- package/dist/api-schema2.js +179 -2
- package/dist/cli.js +97 -4
- package/dist/paths.js +425 -3
- package/dist/src.js +635 -350
- package/package.json +2 -2
- package/src/api-schema.ts +175 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex-relay",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Local Codex Relay CLI bridge for the Codex Relay mobile app.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@noble/ciphers": "2.2.0",
|
|
39
39
|
"@noble/curves": "2.2.0",
|
|
40
40
|
"@noble/hashes": "2.2.0",
|
|
41
|
-
"@openai/codex-sdk": "^0.
|
|
41
|
+
"@openai/codex-sdk": "^0.130.0",
|
|
42
42
|
"@tursodatabase/database": "^0.5.3",
|
|
43
43
|
"base64-js": "1.5.1",
|
|
44
44
|
"commander": "^14.0.3",
|
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,12 +897,16 @@ 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",
|
|
825
906
|
pair: "/v1/pair",
|
|
826
907
|
pairApproval: (approvalCode: string) => `/v1/pair/${encodeURIComponent(approvalCode)}`,
|
|
827
908
|
pairApprove: "/v1/pair/approve",
|
|
909
|
+
sessionsClear: "/v1/sessions/clear",
|
|
828
910
|
sessionRefresh: "/v1/session/refresh",
|
|
829
911
|
status: "/v1/status",
|
|
830
912
|
preferences: "/v1/preferences",
|
|
@@ -832,6 +914,7 @@ export const apiPaths = {
|
|
|
832
914
|
models: "/v1/models",
|
|
833
915
|
skills: "/v1/skills",
|
|
834
916
|
workspaceFiles: "/v1/workspace/files",
|
|
917
|
+
workspaceFileContent: "/v1/workspace/file",
|
|
835
918
|
workspaceDirectories: "/v1/workspace-directories",
|
|
836
919
|
workspaceChanges: "/v1/workspace/changes",
|
|
837
920
|
workspaceCheckout: "/v1/workspace/checkout",
|
|
@@ -950,6 +1033,37 @@ export function createOpenApiDocument() {
|
|
|
950
1033
|
},
|
|
951
1034
|
},
|
|
952
1035
|
},
|
|
1036
|
+
"/v1/workspace/files": {
|
|
1037
|
+
get: {
|
|
1038
|
+
summary: "List files under the configured workspace",
|
|
1039
|
+
responses: {
|
|
1040
|
+
"200": jsonResponse("ListWorkspaceFilesResponse"),
|
|
1041
|
+
"400": jsonResponse("ErrorResponse"),
|
|
1042
|
+
"502": jsonResponse("ErrorResponse"),
|
|
1043
|
+
},
|
|
1044
|
+
},
|
|
1045
|
+
},
|
|
1046
|
+
"/v1/workspace/file": {
|
|
1047
|
+
get: {
|
|
1048
|
+
summary: "Read a workspace file preview",
|
|
1049
|
+
responses: {
|
|
1050
|
+
"200": jsonResponse("WorkspaceFileContentResponse"),
|
|
1051
|
+
"400": jsonResponse("ErrorResponse"),
|
|
1052
|
+
"404": jsonResponse("ErrorResponse"),
|
|
1053
|
+
"502": jsonResponse("ErrorResponse"),
|
|
1054
|
+
},
|
|
1055
|
+
},
|
|
1056
|
+
put: {
|
|
1057
|
+
summary: "Update a workspace text file",
|
|
1058
|
+
requestBody: jsonRequest("UpdateWorkspaceFileContentRequest"),
|
|
1059
|
+
responses: {
|
|
1060
|
+
"200": jsonResponse("WorkspaceFileContentResponse"),
|
|
1061
|
+
"400": jsonResponse("ErrorResponse"),
|
|
1062
|
+
"404": jsonResponse("ErrorResponse"),
|
|
1063
|
+
"502": jsonResponse("ErrorResponse"),
|
|
1064
|
+
},
|
|
1065
|
+
},
|
|
1066
|
+
},
|
|
953
1067
|
"/v1/threads/{threadId}/runs": {
|
|
954
1068
|
post: {
|
|
955
1069
|
summary: "Run a prompt on a Codex thread",
|
|
@@ -1055,6 +1169,7 @@ export function createOpenApiDocument() {
|
|
|
1055
1169
|
state: { $ref: "#/components/schemas/ThreadState" },
|
|
1056
1170
|
messageCount: { type: "integer", minimum: 0 },
|
|
1057
1171
|
model: { type: "string" },
|
|
1172
|
+
serviceTier: { type: "string" },
|
|
1058
1173
|
runtimeMode: { $ref: "#/components/schemas/RuntimeMode" },
|
|
1059
1174
|
approvalPolicy: { type: "string", enum: ["on-request", "on-failure", "never"] },
|
|
1060
1175
|
sandboxMode: {
|
|
@@ -1111,6 +1226,7 @@ export function createOpenApiDocument() {
|
|
|
1111
1226
|
required: ["runtimeMode"],
|
|
1112
1227
|
properties: {
|
|
1113
1228
|
model: { type: "string" },
|
|
1229
|
+
serviceTier: { type: "string" },
|
|
1114
1230
|
runtimeMode: {
|
|
1115
1231
|
type: "string",
|
|
1116
1232
|
enum: ["default", "auto", "full-access", "on-request"],
|
|
@@ -1128,6 +1244,7 @@ export function createOpenApiDocument() {
|
|
|
1128
1244
|
threadId: { type: "string" },
|
|
1129
1245
|
workspacePath: { type: "string" },
|
|
1130
1246
|
model: { type: "string", nullable: true },
|
|
1247
|
+
serviceTier: { type: "string", nullable: true },
|
|
1131
1248
|
runtimeMode: {
|
|
1132
1249
|
type: "string",
|
|
1133
1250
|
enum: ["default", "auto", "full-access", "on-request"],
|
|
@@ -1173,6 +1290,64 @@ export function createOpenApiDocument() {
|
|
|
1173
1290
|
},
|
|
1174
1291
|
},
|
|
1175
1292
|
},
|
|
1293
|
+
WorkspaceFileMention: {
|
|
1294
|
+
type: "object",
|
|
1295
|
+
required: ["directory", "kind", "name", "path"],
|
|
1296
|
+
properties: {
|
|
1297
|
+
directory: { type: "string" },
|
|
1298
|
+
kind: { type: "string", enum: ["directory", "file"] },
|
|
1299
|
+
name: { type: "string" },
|
|
1300
|
+
path: { type: "string" },
|
|
1301
|
+
},
|
|
1302
|
+
},
|
|
1303
|
+
ListWorkspaceFilesResponse: {
|
|
1304
|
+
type: "object",
|
|
1305
|
+
required: ["directory", "files", "parentDirectory", "query", "workspacePath"],
|
|
1306
|
+
properties: {
|
|
1307
|
+
directory: { type: "string" },
|
|
1308
|
+
files: {
|
|
1309
|
+
type: "array",
|
|
1310
|
+
items: { $ref: "#/components/schemas/WorkspaceFileMention" },
|
|
1311
|
+
},
|
|
1312
|
+
parentDirectory: { type: "string", nullable: true },
|
|
1313
|
+
query: { type: "string" },
|
|
1314
|
+
workspacePath: { type: "string" },
|
|
1315
|
+
},
|
|
1316
|
+
},
|
|
1317
|
+
WorkspaceFileContentResponse: {
|
|
1318
|
+
type: "object",
|
|
1319
|
+
required: [
|
|
1320
|
+
"binary",
|
|
1321
|
+
"content",
|
|
1322
|
+
"directory",
|
|
1323
|
+
"language",
|
|
1324
|
+
"name",
|
|
1325
|
+
"path",
|
|
1326
|
+
"size",
|
|
1327
|
+
"truncated",
|
|
1328
|
+
"workspacePath",
|
|
1329
|
+
],
|
|
1330
|
+
properties: {
|
|
1331
|
+
binary: { type: "boolean" },
|
|
1332
|
+
content: { type: "string" },
|
|
1333
|
+
directory: { type: "string" },
|
|
1334
|
+
language: { type: "string" },
|
|
1335
|
+
name: { type: "string" },
|
|
1336
|
+
path: { type: "string" },
|
|
1337
|
+
size: { type: "integer", minimum: 0 },
|
|
1338
|
+
truncated: { type: "boolean" },
|
|
1339
|
+
workspacePath: { type: "string" },
|
|
1340
|
+
},
|
|
1341
|
+
},
|
|
1342
|
+
UpdateWorkspaceFileContentRequest: {
|
|
1343
|
+
type: "object",
|
|
1344
|
+
required: ["content", "path"],
|
|
1345
|
+
properties: {
|
|
1346
|
+
content: { type: "string", maxLength: 1048576 },
|
|
1347
|
+
path: { type: "string" },
|
|
1348
|
+
workspacePath: { type: "string" },
|
|
1349
|
+
},
|
|
1350
|
+
},
|
|
1176
1351
|
CreateThreadRequest: {
|
|
1177
1352
|
type: "object",
|
|
1178
1353
|
properties: {
|