codex-relay 1.0.4 → 1.0.6
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/LICENSE +190 -0
- package/README.md +3 -2
- package/dist/api-schema.js +2 -2
- package/dist/api-schema2.js +41 -3
- package/dist/cli.js +97 -4
- package/dist/paths.js +425 -3
- package/dist/src.js +226 -321
- package/package.json +5 -3
- package/src/api-schema.ts +61 -1
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex-relay",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Local Codex Relay CLI bridge for the Codex Relay mobile app.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
8
|
+
"url": "git+https://github.com/codex-relay/codex-relay.git",
|
|
8
9
|
"directory": "packages/codex-relay"
|
|
9
10
|
},
|
|
10
11
|
"bin": {
|
|
@@ -34,11 +35,12 @@
|
|
|
34
35
|
"dependencies": {
|
|
35
36
|
"@commander-js/extra-typings": "^14.0.0",
|
|
36
37
|
"@hono/node-server": "^1.19.6",
|
|
38
|
+
"@lydell/node-pty": "1.2.0-beta.12",
|
|
37
39
|
"@modelcontextprotocol/sdk": "^1.24.0",
|
|
38
40
|
"@noble/ciphers": "2.2.0",
|
|
39
41
|
"@noble/curves": "2.2.0",
|
|
40
42
|
"@noble/hashes": "2.2.0",
|
|
41
|
-
"@openai/codex-sdk": "^0.
|
|
43
|
+
"@openai/codex-sdk": "^0.130.0",
|
|
42
44
|
"@tursodatabase/database": "^0.5.3",
|
|
43
45
|
"base64-js": "1.5.1",
|
|
44
46
|
"commander": "^14.0.3",
|
package/src/api-schema.ts
CHANGED
|
@@ -352,7 +352,7 @@ export const WorkspaceGitActionResponseSchema = z.object({
|
|
|
352
352
|
output: z.string().default(""),
|
|
353
353
|
});
|
|
354
354
|
|
|
355
|
-
export const WORKSPACE_PREVIEW_TAB_VALUES = ["git", "files", "markdown", "web"] as const;
|
|
355
|
+
export const WORKSPACE_PREVIEW_TAB_VALUES = ["git", "files", "markdown", "web", "ssh"] as const;
|
|
356
356
|
|
|
357
357
|
export const WorkspacePreviewTabSchema = z.enum(WORKSPACE_PREVIEW_TAB_VALUES);
|
|
358
358
|
|
|
@@ -399,8 +399,51 @@ export const WorkspacePreviewNavigationRequestSchema = z.discriminatedUnion("tab
|
|
|
399
399
|
tab: z.literal("web"),
|
|
400
400
|
target: WebPreviewTargetSchema.optional(),
|
|
401
401
|
}),
|
|
402
|
+
WorkspacePreviewOpenBaseSchema.extend({
|
|
403
|
+
tab: z.literal("ssh"),
|
|
404
|
+
}),
|
|
402
405
|
]);
|
|
403
406
|
|
|
407
|
+
export const WorkspaceTerminalStartRequestSchema = WorkspaceSelectionRequestSchema.extend({
|
|
408
|
+
cols: z.number().int().min(2).max(300).default(80),
|
|
409
|
+
rows: z.number().int().min(2).max(120).default(24),
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
export const WorkspaceTerminalOutputChunkSchema = z.object({
|
|
413
|
+
data: z.string(),
|
|
414
|
+
seq: z.number().int().nonnegative(),
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
export const WorkspaceTerminalSessionResponseSchema = z.object({
|
|
418
|
+
cols: z.number().int().positive(),
|
|
419
|
+
rows: z.number().int().positive(),
|
|
420
|
+
sessionId: z.string().min(1),
|
|
421
|
+
startedAt: IsoDateTimeSchema,
|
|
422
|
+
workspacePath: z.string().min(1),
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
export const WorkspaceTerminalOutputResponseSchema = z.object({
|
|
426
|
+
chunks: z.array(WorkspaceTerminalOutputChunkSchema),
|
|
427
|
+
exitCode: z.number().int().nullable().optional(),
|
|
428
|
+
exitedAt: IsoDateTimeSchema.optional(),
|
|
429
|
+
nextSeq: z.number().int().nonnegative(),
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
export const WorkspaceTerminalInputRequestSchema = z
|
|
433
|
+
.union([
|
|
434
|
+
z.object({ data: z.string().min(1) }),
|
|
435
|
+
z.object({ input: z.string().min(1) }),
|
|
436
|
+
z.string().min(1),
|
|
437
|
+
])
|
|
438
|
+
.transform((payload) => ({
|
|
439
|
+
data: typeof payload === "string" ? payload : "data" in payload ? payload.data : payload.input,
|
|
440
|
+
}));
|
|
441
|
+
|
|
442
|
+
export const WorkspaceTerminalResizeRequestSchema = z.object({
|
|
443
|
+
cols: z.number().int().min(2).max(300),
|
|
444
|
+
rows: z.number().int().min(2).max(120),
|
|
445
|
+
});
|
|
446
|
+
|
|
404
447
|
export const PairRequestSchema = z.object({
|
|
405
448
|
clientSessionId: z.string().trim().min(1).max(120).optional(),
|
|
406
449
|
clientName: z.string().trim().min(1).max(80).optional(),
|
|
@@ -669,6 +712,13 @@ export type WorkspaceMarkdownPreviewTarget = z.infer<typeof WorkspaceMarkdownPre
|
|
|
669
712
|
export type WorkspacePreviewNavigationRequest = z.infer<
|
|
670
713
|
typeof WorkspacePreviewNavigationRequestSchema
|
|
671
714
|
>;
|
|
715
|
+
export type WorkspaceTerminalStartRequest = z.infer<typeof WorkspaceTerminalStartRequestSchema>;
|
|
716
|
+
export type WorkspaceTerminalSessionResponse = z.infer<
|
|
717
|
+
typeof WorkspaceTerminalSessionResponseSchema
|
|
718
|
+
>;
|
|
719
|
+
export type WorkspaceTerminalOutputResponse = z.infer<typeof WorkspaceTerminalOutputResponseSchema>;
|
|
720
|
+
export type WorkspaceTerminalInputRequest = z.infer<typeof WorkspaceTerminalInputRequestSchema>;
|
|
721
|
+
export type WorkspaceTerminalResizeRequest = z.infer<typeof WorkspaceTerminalResizeRequestSchema>;
|
|
672
722
|
export type WebPreviewTarget = z.infer<typeof WebPreviewTargetSchema>;
|
|
673
723
|
export type PairRequest = z.infer<typeof PairRequestSchema>;
|
|
674
724
|
export type PairResponse = z.infer<typeof PairResponseSchema>;
|
|
@@ -906,6 +956,7 @@ export const apiPaths = {
|
|
|
906
956
|
pair: "/v1/pair",
|
|
907
957
|
pairApproval: (approvalCode: string) => `/v1/pair/${encodeURIComponent(approvalCode)}`,
|
|
908
958
|
pairApprove: "/v1/pair/approve",
|
|
959
|
+
sessionsClear: "/v1/sessions/clear",
|
|
909
960
|
sessionRefresh: "/v1/session/refresh",
|
|
910
961
|
status: "/v1/status",
|
|
911
962
|
preferences: "/v1/preferences",
|
|
@@ -918,6 +969,15 @@ export const apiPaths = {
|
|
|
918
969
|
workspaceChanges: "/v1/workspace/changes",
|
|
919
970
|
workspaceCheckout: "/v1/workspace/checkout",
|
|
920
971
|
workspaceCommitPush: "/v1/workspace/commit-push",
|
|
972
|
+
workspaceTerminalSessions: "/v1/workspace/terminal/sessions",
|
|
973
|
+
workspaceTerminalSession: (sessionId: string) =>
|
|
974
|
+
`/v1/workspace/terminal/sessions/${encodeURIComponent(sessionId)}`,
|
|
975
|
+
workspaceTerminalInput: (sessionId: string) =>
|
|
976
|
+
`/v1/workspace/terminal/sessions/${encodeURIComponent(sessionId)}/input`,
|
|
977
|
+
workspaceTerminalOutput: (sessionId: string) =>
|
|
978
|
+
`/v1/workspace/terminal/sessions/${encodeURIComponent(sessionId)}/output`,
|
|
979
|
+
workspaceTerminalResize: (sessionId: string) =>
|
|
980
|
+
`/v1/workspace/terminal/sessions/${encodeURIComponent(sessionId)}/resize`,
|
|
921
981
|
imageAttachments: "/v1/attachments/images",
|
|
922
982
|
imageAttachment: (attachmentId: string) =>
|
|
923
983
|
`/v1/attachments/images/${encodeURIComponent(attachmentId)}`,
|