codex-relay 1.3.2 → 1.4.1
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 +14 -4
- package/dist/api-schema.js +2 -2
- package/dist/api-schema2.js +76 -1
- package/dist/cli.js +1 -1
- package/dist/paths.js +78 -0
- package/dist/src.js +519 -134
- package/package.json +1 -1
- package/src/api-schema.ts +81 -0
package/README.md
CHANGED
|
@@ -32,21 +32,31 @@ After approval, the phone can list Codex threads, start new work, stream message
|
|
|
32
32
|
|
|
33
33
|
By default, Codex Relay starts a private app-server process. A terminal TUI that was started separately can resume the same saved thread, but it does not receive the relay process's live events.
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
Opt in to Codex's shared app-server:
|
|
36
36
|
|
|
37
37
|
```sh
|
|
38
38
|
npx codex-relay@latest --shared-app-server
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
When a shared app-server is already running, the relay attaches to it instead of starting another one. If the relay's own socket connection resets, it reconnects without deliberately stopping the shared app-server.
|
|
42
|
+
|
|
43
|
+
Then connect a new terminal TUI to the shared app-server. On macOS, Linux, or WSL:
|
|
42
44
|
|
|
43
45
|
```sh
|
|
44
46
|
codex resume --remote unix://
|
|
45
47
|
```
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
On native Windows, use the loopback WebSocket endpoint:
|
|
50
|
+
|
|
51
|
+
```powershell
|
|
52
|
+
codex resume --remote ws://127.0.0.1:8788
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Pass a thread ID after the remote endpoint to open a specific thread. The relay prints the attach command at startup. Mobile and the connected terminal can then observe the same live sessions through one socket-backed app-server. An already-running standalone TUI cannot be converted in place; exit it and reconnect with `--remote`.
|
|
56
|
+
|
|
57
|
+
Shared mode uses Codex's experimental app-server transport. A directly connected terminal TUI has its own WebSocket connection, which the relay cannot observe or reconnect. If that terminal reports a socket reset while the thread continues on mobile, reconnect it with the matching remote endpoint above and append the thread ID if needed.
|
|
48
58
|
|
|
49
|
-
Shared mode requires a recent Codex CLI with
|
|
59
|
+
Shared mode requires a recent Codex CLI with app-server and `resume --remote` support. It uses a Unix socket on macOS, Linux, and WSL, or a loopback-only WebSocket on Windows. If those features are unavailable, update Codex or omit `--shared-app-server` to keep the existing private mode.
|
|
50
60
|
|
|
51
61
|
## Background Mode
|
|
52
62
|
|
package/dist/api-schema.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { AgentSkillSchema, AgentSkillSourceSchema, ApprovalDecisionSchema, ApprovalModeSchema, ArchiveThreadResponseSchema, ChatMessageKindSchema, ChatMessagePromptDetailsSchema, ChatMessageRoleSchema, ChatMessageSchema, ChatMessageStateSchema, CheckoutWorkspaceBranchRequestSchema, CodexModelSchema, CommitPushWorkspaceRequestSchema, ContextWindowUsageSchema, CreateThreadRequestSchema, CreateThreadResponseSchema, EncryptedPayloadSchema, ErrorResponseSchema, ImageAttachmentUploadResponseSchema, InterruptThreadRunResponseSchema, IsoDateTimeSchema, KnownReasoningEffortSchema, ListModelsResponseSchema, ListQueuedThreadInputsResponseSchema, ListSkillsResponseSchema, ListThreadsResponseSchema, ListWorkspaceDirectoriesResponseSchema, ListWorkspaceFilesResponseSchema, PairEncryptedPayloadSchema, PairRequestSchema, PairResponseSchema, PendingInputRequestOptionSchema, PendingInputRequestQuestionSchema, PendingInputRequestSchema, PromptAttachmentSchema, PromptAttachmentSummarySchema, PromptContextInputSchema, PromptContextSchema, PromptSkillSchema, QueuedThreadInputActionResponseSchema, QueuedThreadInputSchema, RateLimitBucketSchema, RateLimitWindowSchema, RateLimitsResponseSchema, ReasoningEffortSchema, ResolveApprovalRequestSchema, ResolveApprovalResponseSchema, RunThreadRequestSchema, RunThreadResponseSchema, RuntimeModeSchema, RuntimePreferencesByWorkspacePathSchema, RuntimePreferencesResponseSchema, RuntimePreferencesSchema, SandboxModeSchema, StatusResponseSchema, StreamThreadRunEventSchema, StreamThreadRunRequestSchema, SubmitThreadInputResponseSchema, ThreadCollaborationModeSchema, ThreadContextWindowResponseSchema, ThreadDetailResponseSchema, ThreadGoalResponseSchema, ThreadGoalSchema, ThreadGoalStatusSchema, ThreadMessageDetailFieldSchema, ThreadMessageDetailResponseSchema, ThreadRunOptionsSchema, ThreadStateSchema, ThreadSummarySchema, UpdateRuntimePreferencesRequestSchema, UpdateThreadGoalRequestSchema, UpdateWorkspaceFileContentRequestSchema, VersionResponseSchema, WORKSPACE_PREVIEW_OPEN_PROTOCOL, WORKSPACE_PREVIEW_TAB_VALUES, WebPreviewTargetSchema, WorkspaceChangesResponseSchema, WorkspaceDirectoryEntrySchema, WorkspaceFileContentResponseSchema, WorkspaceFileMentionSchema, WorkspaceGitActionResponseSchema, WorkspaceMarkdownPreviewTargetSchema, WorkspacePreviewNavigationRequestSchema, WorkspacePreviewTabSchema, WorkspaceSelectionRequestSchema, WorkspaceTailscaleServeRequestSchema, WorkspaceTailscaleServeResponseSchema, WorkspaceTerminalInputRequestSchema, WorkspaceTerminalOutputChunkSchema, WorkspaceTerminalOutputResponseSchema, WorkspaceTerminalResizeRequestSchema, WorkspaceTerminalSessionResponseSchema, WorkspaceTerminalStartRequestSchema, apiPaths, chatMessageDetailsFromPromptContext, createOpenApiDocument, isPromptSkillMarkdownMention, normalizePromptContext, promptMarkdownWithSkills, promptSkillDisplayName, promptSkillMentionLabel, promptSkillMentionMarkdown, promptSkillMentionTextCandidates, stripPromptSkillMentions };
|
|
1
|
+
import { $ as RunThreadResponseSchema, $t as promptSkillMentionTextCandidates, A as PairRequestSchema, At as WorkspaceFileMentionSchema, B as PushNotificationIntentSchema, Bt as WorkspaceTerminalOutputResponseSchema, C as ListModelsResponseSchema, Ct as VersionResponseSchema, D as ListWorkspaceDirectoriesResponseSchema, Dt as WorkspaceChangesResponseSchema, E as ListThreadsResponseSchema, Et as WebPreviewTargetSchema, F as PromptAttachmentSchema, Ft as WorkspaceSelectionRequestSchema, G as RateLimitBucketSchema, Gt as chatMessageDetailsFromPromptContext, H as PushNotificationSettingsResponseSchema, Ht as WorkspaceTerminalSessionResponseSchema, I as PromptAttachmentSummarySchema, It as WorkspaceTailscaleServeRequestSchema, J as ReasoningEffortSchema, Jt as normalizePromptContext, K as RateLimitWindowSchema, Kt as createOpenApiDocument, L as PromptContextInputSchema, Lt as WorkspaceTailscaleServeResponseSchema, M as PendingInputRequestOptionSchema, Mt as WorkspaceMarkdownPreviewTargetSchema, N as PendingInputRequestQuestionSchema, Nt as WorkspacePreviewNavigationRequestSchema, O as ListWorkspaceFilesResponseSchema, Ot as WorkspaceDirectoryEntrySchema, P as PendingInputRequestSchema, Pt as WorkspacePreviewTabSchema, Q as RunThreadRequestSchema, Qt as promptSkillMentionMarkdown, R as PromptContextSchema, Rt as WorkspaceTerminalInputRequestSchema, S as KnownReasoningEffortSchema, St as UpdateWorkspaceFileContentRequestSchema, T as ListSkillsResponseSchema, Tt as WORKSPACE_PREVIEW_TAB_VALUES, U as QueuedThreadInputActionResponseSchema, Ut as WorkspaceTerminalStartRequestSchema, V as PushNotificationPreferencesSchema, Vt as WorkspaceTerminalResizeRequestSchema, W as QueuedThreadInputSchema, Wt as apiPaths, X as ResolveApprovalRequestSchema, Xt as promptSkillDisplayName, Y as RegisterPushNotificationRequestSchema, Yt as promptMarkdownWithSkills, Z as ResolveApprovalResponseSchema, Zt as promptSkillMentionLabel, _ as EncryptedPayloadSchema, _t as ThreadRunOptionsSchema, a as ArchiveThreadResponseSchema, at as StatusResponseSchema, b as InterruptThreadRunResponseSchema, bt as UpdateRuntimePreferencesRequestSchema, c as ChatMessageRoleSchema, ct as SubmitThreadInputResponseSchema, d as CheckoutWorkspaceBranchRequestSchema, dt as ThreadDetailResponseSchema, en as stripPromptSkillMentions, et as RuntimeModeSchema, f as CodexModelSchema, ft as ThreadGoalResponseSchema, g as CreateThreadResponseSchema, gt as ThreadMessageDetailResponseSchema, h as CreateThreadRequestSchema, ht as ThreadMessageDetailFieldSchema, i as ApprovalModeSchema, it as SandboxModeSchema, j as PairResponseSchema, jt as WorkspaceGitActionResponseSchema, k as PairEncryptedPayloadSchema, kt as WorkspaceFileContentResponseSchema, l as ChatMessageSchema, lt as ThreadCollaborationModeSchema, m as ContextWindowUsageSchema, mt as ThreadGoalStatusSchema, n as AgentSkillSourceSchema, nt as RuntimePreferencesResponseSchema, o as ChatMessageKindSchema, ot as StreamThreadRunEventSchema, p as CommitPushWorkspaceRequestSchema, pt as ThreadGoalSchema, q as RateLimitsResponseSchema, qt as isPromptSkillMarkdownMention, r as ApprovalDecisionSchema, rt as RuntimePreferencesSchema, s as ChatMessagePromptDetailsSchema, st as StreamThreadRunRequestSchema, t as AgentSkillSchema, tt as RuntimePreferencesByWorkspacePathSchema, u as ChatMessageStateSchema, ut as ThreadContextWindowResponseSchema, v as ErrorResponseSchema, vt as ThreadStateSchema, w as ListQueuedThreadInputsResponseSchema, wt as WORKSPACE_PREVIEW_OPEN_PROTOCOL, x as IsoDateTimeSchema, xt as UpdateThreadGoalRequestSchema, y as ImageAttachmentUploadResponseSchema, yt as ThreadSummarySchema, z as PromptSkillSchema, zt as WorkspaceTerminalOutputChunkSchema } from "./api-schema2.js";
|
|
2
|
+
export { AgentSkillSchema, AgentSkillSourceSchema, ApprovalDecisionSchema, ApprovalModeSchema, ArchiveThreadResponseSchema, ChatMessageKindSchema, ChatMessagePromptDetailsSchema, ChatMessageRoleSchema, ChatMessageSchema, ChatMessageStateSchema, CheckoutWorkspaceBranchRequestSchema, CodexModelSchema, CommitPushWorkspaceRequestSchema, ContextWindowUsageSchema, CreateThreadRequestSchema, CreateThreadResponseSchema, EncryptedPayloadSchema, ErrorResponseSchema, ImageAttachmentUploadResponseSchema, InterruptThreadRunResponseSchema, IsoDateTimeSchema, KnownReasoningEffortSchema, ListModelsResponseSchema, ListQueuedThreadInputsResponseSchema, ListSkillsResponseSchema, ListThreadsResponseSchema, ListWorkspaceDirectoriesResponseSchema, ListWorkspaceFilesResponseSchema, PairEncryptedPayloadSchema, PairRequestSchema, PairResponseSchema, PendingInputRequestOptionSchema, PendingInputRequestQuestionSchema, PendingInputRequestSchema, PromptAttachmentSchema, PromptAttachmentSummarySchema, PromptContextInputSchema, PromptContextSchema, PromptSkillSchema, PushNotificationIntentSchema, PushNotificationPreferencesSchema, PushNotificationSettingsResponseSchema, QueuedThreadInputActionResponseSchema, QueuedThreadInputSchema, RateLimitBucketSchema, RateLimitWindowSchema, RateLimitsResponseSchema, ReasoningEffortSchema, RegisterPushNotificationRequestSchema, ResolveApprovalRequestSchema, ResolveApprovalResponseSchema, RunThreadRequestSchema, RunThreadResponseSchema, RuntimeModeSchema, RuntimePreferencesByWorkspacePathSchema, RuntimePreferencesResponseSchema, RuntimePreferencesSchema, SandboxModeSchema, StatusResponseSchema, StreamThreadRunEventSchema, StreamThreadRunRequestSchema, SubmitThreadInputResponseSchema, ThreadCollaborationModeSchema, ThreadContextWindowResponseSchema, ThreadDetailResponseSchema, ThreadGoalResponseSchema, ThreadGoalSchema, ThreadGoalStatusSchema, ThreadMessageDetailFieldSchema, ThreadMessageDetailResponseSchema, ThreadRunOptionsSchema, ThreadStateSchema, ThreadSummarySchema, UpdateRuntimePreferencesRequestSchema, UpdateThreadGoalRequestSchema, UpdateWorkspaceFileContentRequestSchema, VersionResponseSchema, WORKSPACE_PREVIEW_OPEN_PROTOCOL, WORKSPACE_PREVIEW_TAB_VALUES, WebPreviewTargetSchema, WorkspaceChangesResponseSchema, WorkspaceDirectoryEntrySchema, WorkspaceFileContentResponseSchema, WorkspaceFileMentionSchema, WorkspaceGitActionResponseSchema, WorkspaceMarkdownPreviewTargetSchema, WorkspacePreviewNavigationRequestSchema, WorkspacePreviewTabSchema, WorkspaceSelectionRequestSchema, WorkspaceTailscaleServeRequestSchema, WorkspaceTailscaleServeResponseSchema, WorkspaceTerminalInputRequestSchema, WorkspaceTerminalOutputChunkSchema, WorkspaceTerminalOutputResponseSchema, WorkspaceTerminalResizeRequestSchema, WorkspaceTerminalSessionResponseSchema, WorkspaceTerminalStartRequestSchema, apiPaths, chatMessageDetailsFromPromptContext, createOpenApiDocument, isPromptSkillMarkdownMention, normalizePromptContext, promptMarkdownWithSkills, promptSkillDisplayName, promptSkillMentionLabel, promptSkillMentionMarkdown, promptSkillMentionTextCandidates, stripPromptSkillMentions };
|
package/dist/api-schema2.js
CHANGED
|
@@ -104,6 +104,20 @@ const RuntimePreferencesResponseSchema = z.object({
|
|
|
104
104
|
threadId: z.string().trim().min(1).optional(),
|
|
105
105
|
workspacePath: z.string().trim().min(1).optional()
|
|
106
106
|
});
|
|
107
|
+
const PushNotificationIntentSchema = z.enum(["turn_terminal", "action_required"]);
|
|
108
|
+
const PushNotificationPreferencesSchema = z.object({
|
|
109
|
+
actionRequired: z.boolean(),
|
|
110
|
+
turnTerminal: z.boolean()
|
|
111
|
+
});
|
|
112
|
+
const RegisterPushNotificationRequestSchema = z.object({
|
|
113
|
+
expoPushToken: z.string().trim().regex(/^(?:Expo|Exponent)PushToken\[[^\]\r\n]{1,512}\]$/),
|
|
114
|
+
platform: z.enum(["android", "ios"]),
|
|
115
|
+
preferences: PushNotificationPreferencesSchema
|
|
116
|
+
});
|
|
117
|
+
const PushNotificationSettingsResponseSchema = z.object({
|
|
118
|
+
preferences: PushNotificationPreferencesSchema,
|
|
119
|
+
registered: z.boolean()
|
|
120
|
+
});
|
|
107
121
|
const CodexModelSchema = z.object({
|
|
108
122
|
id: z.string().min(1),
|
|
109
123
|
model: z.string().min(1),
|
|
@@ -721,6 +735,7 @@ const apiPaths = {
|
|
|
721
735
|
sessionRefresh: "/v1/session/refresh",
|
|
722
736
|
status: "/v1/status",
|
|
723
737
|
preferences: "/v1/preferences",
|
|
738
|
+
pushNotifications: "/v1/notifications/push",
|
|
724
739
|
rateLimits: "/v1/rate-limits",
|
|
725
740
|
models: "/v1/models",
|
|
726
741
|
skills: "/v1/skills",
|
|
@@ -777,6 +792,31 @@ function createOpenApiDocument() {
|
|
|
777
792
|
"400": jsonResponse("ErrorResponse")
|
|
778
793
|
}
|
|
779
794
|
} },
|
|
795
|
+
"/v1/notifications/push": {
|
|
796
|
+
get: {
|
|
797
|
+
summary: "Read push notification settings for this paired device",
|
|
798
|
+
responses: {
|
|
799
|
+
"200": jsonResponse("PushNotificationSettingsResponse"),
|
|
800
|
+
"401": jsonResponse("ErrorResponse")
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
put: {
|
|
804
|
+
summary: "Register push notifications for this paired device",
|
|
805
|
+
requestBody: jsonRequest("RegisterPushNotificationRequest"),
|
|
806
|
+
responses: {
|
|
807
|
+
"200": jsonResponse("PushNotificationSettingsResponse"),
|
|
808
|
+
"400": jsonResponse("ErrorResponse"),
|
|
809
|
+
"401": jsonResponse("ErrorResponse")
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
delete: {
|
|
813
|
+
summary: "Remove push notifications for this paired device",
|
|
814
|
+
responses: {
|
|
815
|
+
"200": jsonResponse("PushNotificationSettingsResponse"),
|
|
816
|
+
"401": jsonResponse("ErrorResponse")
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
},
|
|
780
820
|
"/v1/threads": {
|
|
781
821
|
get: {
|
|
782
822
|
summary: "List locally known threads",
|
|
@@ -1243,6 +1283,41 @@ function createOpenApiDocument() {
|
|
|
1243
1283
|
workspacePath: { type: "string" }
|
|
1244
1284
|
}
|
|
1245
1285
|
},
|
|
1286
|
+
PushNotificationPreferences: {
|
|
1287
|
+
type: "object",
|
|
1288
|
+
required: ["actionRequired", "turnTerminal"],
|
|
1289
|
+
properties: {
|
|
1290
|
+
actionRequired: { type: "boolean" },
|
|
1291
|
+
turnTerminal: { type: "boolean" }
|
|
1292
|
+
}
|
|
1293
|
+
},
|
|
1294
|
+
RegisterPushNotificationRequest: {
|
|
1295
|
+
type: "object",
|
|
1296
|
+
required: [
|
|
1297
|
+
"expoPushToken",
|
|
1298
|
+
"platform",
|
|
1299
|
+
"preferences"
|
|
1300
|
+
],
|
|
1301
|
+
properties: {
|
|
1302
|
+
expoPushToken: {
|
|
1303
|
+
type: "string",
|
|
1304
|
+
pattern: "^(?:Expo|Exponent)PushToken\\[[^\\]\\r\\n]{1,512}\\]$"
|
|
1305
|
+
},
|
|
1306
|
+
platform: {
|
|
1307
|
+
type: "string",
|
|
1308
|
+
enum: ["android", "ios"]
|
|
1309
|
+
},
|
|
1310
|
+
preferences: { $ref: "#/components/schemas/PushNotificationPreferences" }
|
|
1311
|
+
}
|
|
1312
|
+
},
|
|
1313
|
+
PushNotificationSettingsResponse: {
|
|
1314
|
+
type: "object",
|
|
1315
|
+
required: ["preferences", "registered"],
|
|
1316
|
+
properties: {
|
|
1317
|
+
preferences: { $ref: "#/components/schemas/PushNotificationPreferences" },
|
|
1318
|
+
registered: { type: "boolean" }
|
|
1319
|
+
}
|
|
1320
|
+
},
|
|
1246
1321
|
WorkspaceDirectoryEntry: {
|
|
1247
1322
|
type: "object",
|
|
1248
1323
|
required: ["name", "path"],
|
|
@@ -1725,4 +1800,4 @@ function jsonResponse(schemaName) {
|
|
|
1725
1800
|
};
|
|
1726
1801
|
}
|
|
1727
1802
|
//#endregion
|
|
1728
|
-
export {
|
|
1803
|
+
export { RunThreadResponseSchema as $, promptSkillMentionTextCandidates as $t, PairRequestSchema as A, WorkspaceFileMentionSchema as At, PushNotificationIntentSchema as B, WorkspaceTerminalOutputResponseSchema as Bt, ListModelsResponseSchema as C, VersionResponseSchema as Ct, ListWorkspaceDirectoriesResponseSchema as D, WorkspaceChangesResponseSchema as Dt, ListThreadsResponseSchema as E, WebPreviewTargetSchema as Et, PromptAttachmentSchema as F, WorkspaceSelectionRequestSchema as Ft, RateLimitBucketSchema as G, chatMessageDetailsFromPromptContext as Gt, PushNotificationSettingsResponseSchema as H, WorkspaceTerminalSessionResponseSchema as Ht, PromptAttachmentSummarySchema as I, WorkspaceTailscaleServeRequestSchema as It, ReasoningEffortSchema as J, normalizePromptContext as Jt, RateLimitWindowSchema as K, createOpenApiDocument as Kt, PromptContextInputSchema as L, WorkspaceTailscaleServeResponseSchema as Lt, PendingInputRequestOptionSchema as M, WorkspaceMarkdownPreviewTargetSchema as Mt, PendingInputRequestQuestionSchema as N, WorkspacePreviewNavigationRequestSchema as Nt, ListWorkspaceFilesResponseSchema as O, WorkspaceDirectoryEntrySchema as Ot, PendingInputRequestSchema as P, WorkspacePreviewTabSchema as Pt, RunThreadRequestSchema as Q, promptSkillMentionMarkdown as Qt, PromptContextSchema as R, WorkspaceTerminalInputRequestSchema as Rt, KnownReasoningEffortSchema as S, UpdateWorkspaceFileContentRequestSchema as St, ListSkillsResponseSchema as T, WORKSPACE_PREVIEW_TAB_VALUES as Tt, QueuedThreadInputActionResponseSchema as U, WorkspaceTerminalStartRequestSchema as Ut, PushNotificationPreferencesSchema as V, WorkspaceTerminalResizeRequestSchema as Vt, QueuedThreadInputSchema as W, apiPaths as Wt, ResolveApprovalRequestSchema as X, promptSkillDisplayName as Xt, RegisterPushNotificationRequestSchema as Y, promptMarkdownWithSkills as Yt, ResolveApprovalResponseSchema as Z, promptSkillMentionLabel as Zt, EncryptedPayloadSchema as _, ThreadRunOptionsSchema as _t, ArchiveThreadResponseSchema as a, StatusResponseSchema as at, InterruptThreadRunResponseSchema as b, UpdateRuntimePreferencesRequestSchema as bt, ChatMessageRoleSchema as c, SubmitThreadInputResponseSchema as ct, CheckoutWorkspaceBranchRequestSchema as d, ThreadDetailResponseSchema as dt, stripPromptSkillMentions as en, RuntimeModeSchema as et, CodexModelSchema as f, ThreadGoalResponseSchema as ft, CreateThreadResponseSchema as g, ThreadMessageDetailResponseSchema as gt, CreateThreadRequestSchema as h, ThreadMessageDetailFieldSchema as ht, ApprovalModeSchema as i, SandboxModeSchema as it, PairResponseSchema as j, WorkspaceGitActionResponseSchema as jt, PairEncryptedPayloadSchema as k, WorkspaceFileContentResponseSchema as kt, ChatMessageSchema as l, ThreadCollaborationModeSchema as lt, ContextWindowUsageSchema as m, ThreadGoalStatusSchema as mt, AgentSkillSourceSchema as n, RuntimePreferencesResponseSchema as nt, ChatMessageKindSchema as o, StreamThreadRunEventSchema as ot, CommitPushWorkspaceRequestSchema as p, ThreadGoalSchema as pt, RateLimitsResponseSchema as q, isPromptSkillMarkdownMention as qt, ApprovalDecisionSchema as r, RuntimePreferencesSchema as rt, ChatMessagePromptDetailsSchema as s, StreamThreadRunRequestSchema as st, AgentSkillSchema as t, RuntimePreferencesByWorkspacePathSchema as tt, ChatMessageStateSchema as u, ThreadContextWindowResponseSchema as ut, ErrorResponseSchema as v, ThreadStateSchema as vt, ListQueuedThreadInputsResponseSchema as w, WORKSPACE_PREVIEW_OPEN_PROTOCOL as wt, IsoDateTimeSchema as x, UpdateThreadGoalRequestSchema as xt, ImageAttachmentUploadResponseSchema as y, ThreadSummarySchema as yt, PromptSkillSchema as z, WorkspaceTerminalOutputChunkSchema as zt };
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { Wt as apiPaths } from "./api-schema2.js";
|
|
3
3
|
import { n as codexRelayHome, o as getConnectUrlGuidance, r as legacyCodexRelayDataPath, s as createTursoPairingSessionStore, t as codexRelayDataPath } from "./paths.js";
|
|
4
4
|
import { Command } from "@commander-js/extra-typings";
|
|
5
5
|
import qrcode from "qrcode-terminal";
|
package/dist/paths.js
CHANGED
|
@@ -122,6 +122,16 @@ async function createTursoPairingSessionStore(path) {
|
|
|
122
122
|
created_at INTEGER NOT NULL,
|
|
123
123
|
updated_at INTEGER NOT NULL
|
|
124
124
|
);
|
|
125
|
+
|
|
126
|
+
CREATE TABLE IF NOT EXISTS push_notification_subscriptions (
|
|
127
|
+
client_session_id TEXT PRIMARY KEY,
|
|
128
|
+
expo_push_token TEXT NOT NULL,
|
|
129
|
+
platform TEXT NOT NULL,
|
|
130
|
+
turn_terminal_enabled INTEGER NOT NULL,
|
|
131
|
+
action_required_enabled INTEGER NOT NULL,
|
|
132
|
+
created_at INTEGER NOT NULL,
|
|
133
|
+
updated_at INTEGER NOT NULL
|
|
134
|
+
);
|
|
125
135
|
`);
|
|
126
136
|
await ensurePairingSessionColumns();
|
|
127
137
|
async function countActive(now) {
|
|
@@ -178,6 +188,7 @@ async function createTursoPairingSessionStore(path) {
|
|
|
178
188
|
const pendingRow = await transaction.prepare("SELECT COUNT(*) AS count FROM pending_pairings").get();
|
|
179
189
|
await transaction.prepare("DELETE FROM pairing_sessions").run();
|
|
180
190
|
await transaction.prepare("DELETE FROM pending_pairings").run();
|
|
191
|
+
await transaction.prepare("DELETE FROM push_notification_subscriptions").run();
|
|
181
192
|
return {
|
|
182
193
|
pendingPairingsCleared: Number(pendingRow?.count ?? 0),
|
|
183
194
|
sessionsCleared: Number(sessionRow?.count ?? 0)
|
|
@@ -185,6 +196,12 @@ async function createTursoPairingSessionStore(path) {
|
|
|
185
196
|
})();
|
|
186
197
|
},
|
|
187
198
|
countActive,
|
|
199
|
+
async deletePushNotificationSubscription(clientSessionId) {
|
|
200
|
+
await db.prepare("DELETE FROM push_notification_subscriptions WHERE client_session_id = ?").run(clientSessionId);
|
|
201
|
+
},
|
|
202
|
+
async deletePushNotificationSubscriptionsByExpoPushToken(expoPushToken) {
|
|
203
|
+
await db.prepare("DELETE FROM push_notification_subscriptions WHERE expo_push_token = ?").run(expoPushToken);
|
|
204
|
+
},
|
|
188
205
|
async createPendingPairing(pairing) {
|
|
189
206
|
const now = Date.now();
|
|
190
207
|
await db.prepare(`INSERT INTO pending_pairings (
|
|
@@ -227,6 +244,16 @@ async function createTursoPairingSessionStore(path) {
|
|
|
227
244
|
deleteSession,
|
|
228
245
|
deletePendingPairing,
|
|
229
246
|
getPendingPairing,
|
|
247
|
+
async getPushNotificationSubscription(clientSessionId) {
|
|
248
|
+
const row = await db.prepare(`SELECT client_session_id AS clientSessionId,
|
|
249
|
+
expo_push_token AS expoPushToken,
|
|
250
|
+
platform,
|
|
251
|
+
turn_terminal_enabled AS turnTerminal,
|
|
252
|
+
action_required_enabled AS actionRequired
|
|
253
|
+
FROM push_notification_subscriptions
|
|
254
|
+
WHERE client_session_id = ?`).get(clientSessionId);
|
|
255
|
+
return row ? pushNotificationSubscriptionFromRow(row) : void 0;
|
|
256
|
+
},
|
|
230
257
|
async getValidSession(tokenHash, now) {
|
|
231
258
|
const row = await db.prepare(`SELECT client_name AS clientName,
|
|
232
259
|
client_session_id AS clientSessionId,
|
|
@@ -251,9 +278,30 @@ async function createTursoPairingSessionStore(path) {
|
|
|
251
278
|
secureSession: decodeSecureSession(row)
|
|
252
279
|
};
|
|
253
280
|
},
|
|
281
|
+
async listActivePushNotificationSubscriptions(now) {
|
|
282
|
+
return resultRows(await db.prepare(`SELECT subscriptions.client_session_id AS clientSessionId,
|
|
283
|
+
subscriptions.expo_push_token AS expoPushToken,
|
|
284
|
+
subscriptions.platform,
|
|
285
|
+
subscriptions.turn_terminal_enabled AS turnTerminal,
|
|
286
|
+
subscriptions.action_required_enabled AS actionRequired
|
|
287
|
+
FROM push_notification_subscriptions AS subscriptions
|
|
288
|
+
INNER JOIN pairing_sessions AS sessions
|
|
289
|
+
ON sessions.client_session_id = subscriptions.client_session_id
|
|
290
|
+
WHERE sessions.expires_at > ?
|
|
291
|
+
GROUP BY subscriptions.client_session_id`).all(now)).flatMap((row) => {
|
|
292
|
+
const subscription = pushNotificationSubscriptionFromRow(row);
|
|
293
|
+
return subscription ? [subscription] : [];
|
|
294
|
+
});
|
|
295
|
+
},
|
|
254
296
|
async pruneExpired(now) {
|
|
255
297
|
await db.prepare("DELETE FROM pairing_sessions WHERE expires_at <= ?").run(now);
|
|
256
298
|
await db.prepare("DELETE FROM pending_pairings WHERE expires_at <= ?").run(now);
|
|
299
|
+
await db.prepare(`DELETE FROM push_notification_subscriptions
|
|
300
|
+
WHERE NOT EXISTS (
|
|
301
|
+
SELECT 1
|
|
302
|
+
FROM pairing_sessions
|
|
303
|
+
WHERE pairing_sessions.client_session_id = push_notification_subscriptions.client_session_id
|
|
304
|
+
)`).run();
|
|
257
305
|
},
|
|
258
306
|
async rotateSession(oldTokenHash, newTokenHash, session) {
|
|
259
307
|
const now = Date.now();
|
|
@@ -292,6 +340,25 @@ async function createTursoPairingSessionStore(path) {
|
|
|
292
340
|
next_server_counter = ?,
|
|
293
341
|
updated_at = ?
|
|
294
342
|
WHERE token_hash = ?`).run(secure.keyEpoch, secure.mobileToServerKey, secure.serverToMobileKey, secure.lastMobileCounter, secure.nextServerCounter, now, tokenHash);
|
|
343
|
+
},
|
|
344
|
+
async upsertPushNotificationSubscription(subscription) {
|
|
345
|
+
const now = Date.now();
|
|
346
|
+
await db.prepare(`INSERT INTO push_notification_subscriptions (
|
|
347
|
+
client_session_id,
|
|
348
|
+
expo_push_token,
|
|
349
|
+
platform,
|
|
350
|
+
turn_terminal_enabled,
|
|
351
|
+
action_required_enabled,
|
|
352
|
+
created_at,
|
|
353
|
+
updated_at
|
|
354
|
+
)
|
|
355
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
356
|
+
ON CONFLICT(client_session_id) DO UPDATE SET
|
|
357
|
+
expo_push_token = excluded.expo_push_token,
|
|
358
|
+
platform = excluded.platform,
|
|
359
|
+
turn_terminal_enabled = excluded.turn_terminal_enabled,
|
|
360
|
+
action_required_enabled = excluded.action_required_enabled,
|
|
361
|
+
updated_at = excluded.updated_at`).run(subscription.clientSessionId, subscription.expoPushToken, subscription.platform, subscription.turnTerminal ? 1 : 0, subscription.actionRequired ? 1 : 0, now, now);
|
|
295
362
|
}
|
|
296
363
|
};
|
|
297
364
|
async function ensurePairingSessionColumns() {
|
|
@@ -329,6 +396,17 @@ function decodeSecureSession(row) {
|
|
|
329
396
|
serverToMobileKey: toByteArray(row.serverToMobileKey)
|
|
330
397
|
};
|
|
331
398
|
}
|
|
399
|
+
function pushNotificationSubscriptionFromRow(row) {
|
|
400
|
+
const platform = row.platform;
|
|
401
|
+
if (typeof row.clientSessionId !== "string" || typeof row.expoPushToken !== "string" || platform !== "android" && platform !== "ios") return;
|
|
402
|
+
return {
|
|
403
|
+
actionRequired: Number(row.actionRequired) === 1,
|
|
404
|
+
clientSessionId: row.clientSessionId,
|
|
405
|
+
expoPushToken: row.expoPushToken,
|
|
406
|
+
platform,
|
|
407
|
+
turnTerminal: Number(row.turnTerminal) === 1
|
|
408
|
+
};
|
|
409
|
+
}
|
|
332
410
|
function resultRows(result) {
|
|
333
411
|
if (Array.isArray(result)) return result;
|
|
334
412
|
if (result && typeof result === "object" && Array.isArray(result.rows)) return result.rows;
|