@hellcoder/companion 0.119.1 → 0.121.0
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/assets/{AgentsPage-E73zA-6k.js → AgentsPage-ClW7bWRx.js} +5 -5
- package/dist/assets/{CronManager-Dbz9rad2.js → CronManager-CNRhJ7JU.js} +1 -1
- package/dist/assets/{DashboardPage-Dk4z826H.js → DashboardPage-Ch_HQGg0.js} +1 -1
- package/dist/assets/{IntegrationsPage-C7cQyPBt.js → IntegrationsPage-BHj_BEVr.js} +1 -1
- package/dist/assets/{LinearOAuthSettingsPage-BG4-JYjD.js → LinearOAuthSettingsPage-B5U70sHB.js} +1 -1
- package/dist/assets/{LinearSettingsPage-CBbKNZVH.js → LinearSettingsPage-CVmZKj9l.js} +1 -1
- package/dist/assets/{MagicUIDashboard-DpxmzOIx.js → MagicUIDashboard-5nBMuLS8.js} +1 -1
- package/dist/assets/MagicUIView-CdHkHIEh.js +1 -0
- package/dist/assets/Playground-Dpfq4KMB.js +121 -0
- package/dist/assets/{PromptsPage-C7vU_XHW.js → PromptsPage-BHtp_9DW.js} +1 -1
- package/dist/assets/{RunsPage-BsIYybEZ.js → RunsPage-bbhhFNkd.js} +1 -1
- package/dist/assets/{SandboxManager-DKcCgC-r.js → SandboxManager-b3xCX8cU.js} +1 -1
- package/dist/assets/SettingsPage-CEOoHbQk.js +1 -0
- package/dist/assets/{TailscalePage-BhGXhs0h.js → TailscalePage-C1bGGkFU.js} +1 -1
- package/dist/assets/index-_VjPWGkx.js +141 -0
- package/dist/assets/{sw-register-CWqt9RnE.js → sw-register-2ITbAS9w.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/server/codex-app-server.ts +61 -0
- package/server/codex-auth.test.ts +254 -0
- package/server/codex-auth.ts +315 -0
- package/server/codex-models.ts +2 -43
- package/server/protocol/codex-upstream/ClientRequest.ts.txt +62 -17
- package/server/protocol/codex-upstream/README.md +1 -1
- package/server/protocol/codex-upstream/ServerNotification.ts.txt +52 -4
- package/server/protocol/codex-upstream/ServerRequest.ts.txt +4 -1
- package/server/protocol/codex-upstream/v2/DynamicToolCallParams.ts.txt +1 -1
- package/server/routes/codex-auth-routes.test.ts +115 -0
- package/server/routes/codex-auth-routes.ts +49 -0
- package/server/routes.ts +2 -0
- package/dist/assets/MagicUIView-wrboravS.js +0 -1
- package/dist/assets/Playground-BdB18EpN.js +0 -121
- package/dist/assets/SettingsPage-BIvJyPOd.js +0 -1
- package/dist/assets/index-C0oFg9YU.js +0 -140
|
@@ -1,41 +1,89 @@
|
|
|
1
1
|
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
2
|
|
|
3
3
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
-
import type {
|
|
4
|
+
import type { FuzzyFileSearchSessionCompletedNotification } from "./FuzzyFileSearchSessionCompletedNotification";
|
|
5
5
|
import type { FuzzyFileSearchSessionUpdatedNotification } from "./FuzzyFileSearchSessionUpdatedNotification";
|
|
6
|
-
import type { LoginChatGptCompleteNotification } from "./LoginChatGptCompleteNotification";
|
|
7
|
-
import type { SessionConfiguredNotification } from "./SessionConfiguredNotification";
|
|
8
6
|
import type { AccountLoginCompletedNotification } from "./v2/AccountLoginCompletedNotification";
|
|
9
7
|
import type { AccountRateLimitsUpdatedNotification } from "./v2/AccountRateLimitsUpdatedNotification";
|
|
10
8
|
import type { AccountUpdatedNotification } from "./v2/AccountUpdatedNotification";
|
|
11
9
|
import type { AgentMessageDeltaNotification } from "./v2/AgentMessageDeltaNotification";
|
|
12
10
|
import type { AppListUpdatedNotification } from "./v2/AppListUpdatedNotification";
|
|
11
|
+
import type { AuthRecoveryNotification } from "./v2/AuthRecoveryNotification";
|
|
12
|
+
import type { CommandExecOutputDeltaNotification } from "./v2/CommandExecOutputDeltaNotification";
|
|
13
13
|
import type { CommandExecutionOutputDeltaNotification } from "./v2/CommandExecutionOutputDeltaNotification";
|
|
14
14
|
import type { ConfigWarningNotification } from "./v2/ConfigWarningNotification";
|
|
15
15
|
import type { ContextCompactedNotification } from "./v2/ContextCompactedNotification";
|
|
16
16
|
import type { DeprecationNoticeNotification } from "./v2/DeprecationNoticeNotification";
|
|
17
|
+
import type { EnvironmentConnectionNotification } from "./v2/EnvironmentConnectionNotification";
|
|
17
18
|
import type { ErrorNotification } from "./v2/ErrorNotification";
|
|
19
|
+
import type { ExternalAgentConfigImportCompletedNotification } from "./v2/ExternalAgentConfigImportCompletedNotification";
|
|
20
|
+
import type { ExternalAgentConfigImportProgressNotification } from "./v2/ExternalAgentConfigImportProgressNotification";
|
|
18
21
|
import type { FileChangeOutputDeltaNotification } from "./v2/FileChangeOutputDeltaNotification";
|
|
22
|
+
import type { FileChangePatchUpdatedNotification } from "./v2/FileChangePatchUpdatedNotification";
|
|
23
|
+
import type { FsChangedNotification } from "./v2/FsChangedNotification";
|
|
24
|
+
import type { GuardianWarningNotification } from "./v2/GuardianWarningNotification";
|
|
25
|
+
import type { HookCompletedNotification } from "./v2/HookCompletedNotification";
|
|
26
|
+
import type { HookStartedNotification } from "./v2/HookStartedNotification";
|
|
19
27
|
import type { ItemCompletedNotification } from "./v2/ItemCompletedNotification";
|
|
28
|
+
import type { ItemGuardianApprovalReviewCompletedNotification } from "./v2/ItemGuardianApprovalReviewCompletedNotification";
|
|
29
|
+
import type { ItemGuardianApprovalReviewStartedNotification } from "./v2/ItemGuardianApprovalReviewStartedNotification";
|
|
20
30
|
import type { ItemStartedNotification } from "./v2/ItemStartedNotification";
|
|
31
|
+
import type { McpServerEventStreamNotification } from "./v2/McpServerEventStreamNotification";
|
|
21
32
|
import type { McpServerOauthLoginCompletedNotification } from "./v2/McpServerOauthLoginCompletedNotification";
|
|
33
|
+
import type { McpServerStatusUpdatedNotification } from "./v2/McpServerStatusUpdatedNotification";
|
|
22
34
|
import type { McpToolCallProgressNotification } from "./v2/McpToolCallProgressNotification";
|
|
35
|
+
import type { ModelReroutedNotification } from "./v2/ModelReroutedNotification";
|
|
36
|
+
import type { ModelSafetyBufferingUpdatedNotification } from "./v2/ModelSafetyBufferingUpdatedNotification";
|
|
37
|
+
import type { ModelVerificationNotification } from "./v2/ModelVerificationNotification";
|
|
23
38
|
import type { PlanDeltaNotification } from "./v2/PlanDeltaNotification";
|
|
39
|
+
import type { ProcessExitedNotification } from "./v2/ProcessExitedNotification";
|
|
40
|
+
import type { ProcessOutputDeltaNotification } from "./v2/ProcessOutputDeltaNotification";
|
|
41
|
+
import type { ProjectChangedNotification } from "./v2/ProjectChangedNotification";
|
|
42
|
+
import type { RawResponseCompletedNotification } from "./v2/RawResponseCompletedNotification";
|
|
24
43
|
import type { RawResponseItemCompletedNotification } from "./v2/RawResponseItemCompletedNotification";
|
|
25
44
|
import type { ReasoningSummaryPartAddedNotification } from "./v2/ReasoningSummaryPartAddedNotification";
|
|
26
45
|
import type { ReasoningSummaryTextDeltaNotification } from "./v2/ReasoningSummaryTextDeltaNotification";
|
|
27
46
|
import type { ReasoningTextDeltaNotification } from "./v2/ReasoningTextDeltaNotification";
|
|
47
|
+
import type { RemoteControlStatusChangedNotification } from "./v2/RemoteControlStatusChangedNotification";
|
|
48
|
+
import type { ServerRequestResolvedNotification } from "./v2/ServerRequestResolvedNotification";
|
|
49
|
+
import type { SkillsChangedNotification } from "./v2/SkillsChangedNotification";
|
|
50
|
+
import type { StrictReviewRequiredNotification } from "./v2/StrictReviewRequiredNotification";
|
|
28
51
|
import type { TerminalInteractionNotification } from "./v2/TerminalInteractionNotification";
|
|
52
|
+
import type { ThreadArchivedNotification } from "./v2/ThreadArchivedNotification";
|
|
53
|
+
import type { ThreadClosedNotification } from "./v2/ThreadClosedNotification";
|
|
54
|
+
import type { ThreadDeletedNotification } from "./v2/ThreadDeletedNotification";
|
|
55
|
+
import type { ThreadGoalClearedNotification } from "./v2/ThreadGoalClearedNotification";
|
|
56
|
+
import type { ThreadGoalUpdatedNotification } from "./v2/ThreadGoalUpdatedNotification";
|
|
29
57
|
import type { ThreadNameUpdatedNotification } from "./v2/ThreadNameUpdatedNotification";
|
|
58
|
+
import type { ThreadProjectUpdatedNotification } from "./v2/ThreadProjectUpdatedNotification";
|
|
59
|
+
import type { ThreadQueueChangedNotification } from "./v2/ThreadQueueChangedNotification";
|
|
60
|
+
import type { ThreadRealtimeClosedNotification } from "./v2/ThreadRealtimeClosedNotification";
|
|
61
|
+
import type { ThreadRealtimeErrorNotification } from "./v2/ThreadRealtimeErrorNotification";
|
|
62
|
+
import type { ThreadRealtimeItemAddedNotification } from "./v2/ThreadRealtimeItemAddedNotification";
|
|
63
|
+
import type { ThreadRealtimeItemCompletedNotification } from "./v2/ThreadRealtimeItemCompletedNotification";
|
|
64
|
+
import type { ThreadRealtimeItemStartedNotification } from "./v2/ThreadRealtimeItemStartedNotification";
|
|
65
|
+
import type { ThreadRealtimeItemTranscriptDeltaNotification } from "./v2/ThreadRealtimeItemTranscriptDeltaNotification";
|
|
66
|
+
import type { ThreadRealtimeOutputAudioDeltaNotification } from "./v2/ThreadRealtimeOutputAudioDeltaNotification";
|
|
67
|
+
import type { ThreadRealtimeSdpNotification } from "./v2/ThreadRealtimeSdpNotification";
|
|
68
|
+
import type { ThreadRealtimeStartedNotification } from "./v2/ThreadRealtimeStartedNotification";
|
|
69
|
+
import type { ThreadRealtimeTranscriptDeltaNotification } from "./v2/ThreadRealtimeTranscriptDeltaNotification";
|
|
70
|
+
import type { ThreadRealtimeTranscriptDoneNotification } from "./v2/ThreadRealtimeTranscriptDoneNotification";
|
|
71
|
+
import type { ThreadRevertedNotification } from "./v2/ThreadRevertedNotification";
|
|
72
|
+
import type { ThreadSettingsUpdatedNotification } from "./v2/ThreadSettingsUpdatedNotification";
|
|
30
73
|
import type { ThreadStartedNotification } from "./v2/ThreadStartedNotification";
|
|
74
|
+
import type { ThreadStatusChangedNotification } from "./v2/ThreadStatusChangedNotification";
|
|
31
75
|
import type { ThreadTokenUsageUpdatedNotification } from "./v2/ThreadTokenUsageUpdatedNotification";
|
|
76
|
+
import type { ThreadUnarchivedNotification } from "./v2/ThreadUnarchivedNotification";
|
|
32
77
|
import type { TurnCompletedNotification } from "./v2/TurnCompletedNotification";
|
|
33
78
|
import type { TurnDiffUpdatedNotification } from "./v2/TurnDiffUpdatedNotification";
|
|
79
|
+
import type { TurnModerationMetadataNotification } from "./v2/TurnModerationMetadataNotification";
|
|
34
80
|
import type { TurnPlanUpdatedNotification } from "./v2/TurnPlanUpdatedNotification";
|
|
35
81
|
import type { TurnStartedNotification } from "./v2/TurnStartedNotification";
|
|
82
|
+
import type { WarningNotification } from "./v2/WarningNotification";
|
|
83
|
+
import type { WindowsSandboxSetupCompletedNotification } from "./v2/WindowsSandboxSetupCompletedNotification";
|
|
36
84
|
import type { WindowsWorldWritableWarningNotification } from "./v2/WindowsWorldWritableWarningNotification";
|
|
37
85
|
|
|
38
86
|
/**
|
|
39
87
|
* Notification sent from the server to the client.
|
|
40
88
|
*/
|
|
41
|
-
export type ServerNotification = { "method": "error", "params": ErrorNotification } | { "method": "thread/started", "params": ThreadStartedNotification } | { "method": "thread/name/updated", "params": ThreadNameUpdatedNotification } | { "method": "thread/tokenUsage/updated", "params": ThreadTokenUsageUpdatedNotification } | { "method": "turn/started", "params": TurnStartedNotification } | { "method": "turn/completed", "params": TurnCompletedNotification } | { "method": "turn/diff/updated", "params": TurnDiffUpdatedNotification } | { "method": "turn/plan/updated", "params": TurnPlanUpdatedNotification } | { "method": "item/started", "params": ItemStartedNotification } | { "method": "item/completed", "params": ItemCompletedNotification } | { "method": "rawResponseItem/completed", "params": RawResponseItemCompletedNotification } | { "method": "item/agentMessage/delta", "params": AgentMessageDeltaNotification } | { "method": "item/plan/delta", "params": PlanDeltaNotification } | { "method": "item/commandExecution/outputDelta", "params": CommandExecutionOutputDeltaNotification } | { "method": "item/commandExecution/terminalInteraction", "params": TerminalInteractionNotification } | { "method": "item/fileChange/outputDelta", "params": FileChangeOutputDeltaNotification } | { "method": "item/mcpToolCall/progress", "params": McpToolCallProgressNotification } | { "method": "mcpServer/oauthLogin/completed", "params": McpServerOauthLoginCompletedNotification } | { "method": "account/updated", "params": AccountUpdatedNotification } | { "method": "account/rateLimits/updated", "params": AccountRateLimitsUpdatedNotification } | { "method": "app/list/updated", "params": AppListUpdatedNotification } | { "method": "item/reasoning/summaryTextDelta", "params": ReasoningSummaryTextDeltaNotification } | { "method": "item/reasoning/summaryPartAdded", "params": ReasoningSummaryPartAddedNotification } | { "method": "item/reasoning/textDelta", "params": ReasoningTextDeltaNotification } | { "method": "thread/compacted", "params": ContextCompactedNotification } | { "method": "deprecationNotice", "params": DeprecationNoticeNotification } | { "method": "configWarning", "params": ConfigWarningNotification } | { "method": "fuzzyFileSearch/sessionUpdated", "params": FuzzyFileSearchSessionUpdatedNotification } | { "method": "
|
|
89
|
+
export type ServerNotification = { "method": "error", "params": ErrorNotification } | { "method": "thread/started", "params": ThreadStartedNotification } | { "method": "thread/status/changed", "params": ThreadStatusChangedNotification } | { "method": "thread/archived", "params": ThreadArchivedNotification } | { "method": "thread/deleted", "params": ThreadDeletedNotification } | { "method": "thread/unarchived", "params": ThreadUnarchivedNotification } | { "method": "thread/closed", "params": ThreadClosedNotification } | { "method": "thread/reverted", "params": ThreadRevertedNotification } | { "method": "skills/changed", "params": SkillsChangedNotification } | { "method": "thread/name/updated", "params": ThreadNameUpdatedNotification } | { "method": "thread/goal/updated", "params": ThreadGoalUpdatedNotification } | { "method": "thread/goal/cleared", "params": ThreadGoalClearedNotification } | { "method": "thread/queue/changed", "params": ThreadQueueChangedNotification } | { "method": "project/changed", "params": ProjectChangedNotification } | { "method": "thread/project/updated", "params": ThreadProjectUpdatedNotification } | { "method": "thread/environment/connected", "params": EnvironmentConnectionNotification } | { "method": "thread/environment/disconnected", "params": EnvironmentConnectionNotification } | { "method": "thread/settings/updated", "params": ThreadSettingsUpdatedNotification } | { "method": "thread/tokenUsage/updated", "params": ThreadTokenUsageUpdatedNotification } | { "method": "turn/started", "params": TurnStartedNotification } | { "method": "hook/started", "params": HookStartedNotification } | { "method": "turn/completed", "params": TurnCompletedNotification } | { "method": "hook/completed", "params": HookCompletedNotification } | { "method": "turn/diff/updated", "params": TurnDiffUpdatedNotification } | { "method": "turn/plan/updated", "params": TurnPlanUpdatedNotification } | { "method": "item/started", "params": ItemStartedNotification } | { "method": "item/autoApprovalReview/started", "params": ItemGuardianApprovalReviewStartedNotification } | { "method": "item/autoApprovalReview/completed", "params": ItemGuardianApprovalReviewCompletedNotification } | { "method": "autoApprovalReview/strictReviewRequired", "params": StrictReviewRequiredNotification } | { "method": "item/completed", "params": ItemCompletedNotification } | { "method": "rawResponseItem/completed", "params": RawResponseItemCompletedNotification } | { "method": "rawResponse/completed", "params": RawResponseCompletedNotification } | { "method": "item/agentMessage/delta", "params": AgentMessageDeltaNotification } | { "method": "item/plan/delta", "params": PlanDeltaNotification } | { "method": "command/exec/outputDelta", "params": CommandExecOutputDeltaNotification } | { "method": "process/outputDelta", "params": ProcessOutputDeltaNotification } | { "method": "process/exited", "params": ProcessExitedNotification } | { "method": "item/commandExecution/outputDelta", "params": CommandExecutionOutputDeltaNotification } | { "method": "item/commandExecution/terminalInteraction", "params": TerminalInteractionNotification } | { "method": "item/fileChange/outputDelta", "params": FileChangeOutputDeltaNotification } | { "method": "item/fileChange/patchUpdated", "params": FileChangePatchUpdatedNotification } | { "method": "serverRequest/resolved", "params": ServerRequestResolvedNotification } | { "method": "item/mcpToolCall/progress", "params": McpToolCallProgressNotification } | { "method": "mcpServer/oauthLogin/completed", "params": McpServerOauthLoginCompletedNotification } | { "method": "mcpServer/startupStatus/updated", "params": McpServerStatusUpdatedNotification } | { "method": "mcpServer/event/stream/notification", "params": McpServerEventStreamNotification } | { "method": "account/updated", "params": AccountUpdatedNotification } | { "method": "account/rateLimits/updated", "params": AccountRateLimitsUpdatedNotification } | { "method": "app/list/updated", "params": AppListUpdatedNotification } | { "method": "remoteControl/status/changed", "params": RemoteControlStatusChangedNotification } | { "method": "externalAgentConfig/import/progress", "params": ExternalAgentConfigImportProgressNotification } | { "method": "externalAgentConfig/import/completed", "params": ExternalAgentConfigImportCompletedNotification } | { "method": "fs/changed", "params": FsChangedNotification } | { "method": "item/reasoning/summaryTextDelta", "params": ReasoningSummaryTextDeltaNotification } | { "method": "item/reasoning/summaryPartAdded", "params": ReasoningSummaryPartAddedNotification } | { "method": "item/reasoning/textDelta", "params": ReasoningTextDeltaNotification } | { "method": "thread/compacted", "params": ContextCompactedNotification } | { "method": "model/rerouted", "params": ModelReroutedNotification } | { "method": "model/verification", "params": ModelVerificationNotification } | { "method": "modelProvider/authRecoveryStarted", "params": AuthRecoveryNotification } | { "method": "modelProvider/authRecoveryCompleted", "params": AuthRecoveryNotification } | { "method": "turn/moderationMetadata", "params": TurnModerationMetadataNotification } | { "method": "model/safetyBuffering/updated", "params": ModelSafetyBufferingUpdatedNotification } | { "method": "warning", "params": WarningNotification } | { "method": "guardianWarning", "params": GuardianWarningNotification } | { "method": "deprecationNotice", "params": DeprecationNoticeNotification } | { "method": "configWarning", "params": ConfigWarningNotification } | { "method": "fuzzyFileSearch/sessionUpdated", "params": FuzzyFileSearchSessionUpdatedNotification } | { "method": "fuzzyFileSearch/sessionCompleted", "params": FuzzyFileSearchSessionCompletedNotification } | { "method": "thread/realtime/started", "params": ThreadRealtimeStartedNotification } | { "method": "thread/realtime/itemAdded", "params": ThreadRealtimeItemAddedNotification } | { "method": "thread/realtime/item/started", "params": ThreadRealtimeItemStartedNotification } | { "method": "thread/realtime/item/transcript/delta", "params": ThreadRealtimeItemTranscriptDeltaNotification } | { "method": "thread/realtime/item/completed", "params": ThreadRealtimeItemCompletedNotification } | { "method": "thread/realtime/transcript/delta", "params": ThreadRealtimeTranscriptDeltaNotification } | { "method": "thread/realtime/transcript/done", "params": ThreadRealtimeTranscriptDoneNotification } | { "method": "thread/realtime/outputAudio/delta", "params": ThreadRealtimeOutputAudioDeltaNotification } | { "method": "thread/realtime/sdp", "params": ThreadRealtimeSdpNotification } | { "method": "thread/realtime/error", "params": ThreadRealtimeErrorNotification } | { "method": "thread/realtime/closed", "params": ThreadRealtimeClosedNotification } | { "method": "windows/worldWritableWarning", "params": WindowsWorldWritableWarningNotification } | { "method": "windowsSandbox/setupCompleted", "params": WindowsSandboxSetupCompletedNotification } | { "method": "account/login/completed", "params": AccountLoginCompletedNotification };
|
|
@@ -4,13 +4,16 @@
|
|
|
4
4
|
import type { ApplyPatchApprovalParams } from "./ApplyPatchApprovalParams";
|
|
5
5
|
import type { ExecCommandApprovalParams } from "./ExecCommandApprovalParams";
|
|
6
6
|
import type { RequestId } from "./RequestId";
|
|
7
|
+
import type { AttestationGenerateParams } from "./v2/AttestationGenerateParams";
|
|
7
8
|
import type { ChatgptAuthTokensRefreshParams } from "./v2/ChatgptAuthTokensRefreshParams";
|
|
8
9
|
import type { CommandExecutionRequestApprovalParams } from "./v2/CommandExecutionRequestApprovalParams";
|
|
9
10
|
import type { DynamicToolCallParams } from "./v2/DynamicToolCallParams";
|
|
10
11
|
import type { FileChangeRequestApprovalParams } from "./v2/FileChangeRequestApprovalParams";
|
|
12
|
+
import type { McpServerElicitationRequestParams } from "./v2/McpServerElicitationRequestParams";
|
|
13
|
+
import type { PermissionsRequestApprovalParams } from "./v2/PermissionsRequestApprovalParams";
|
|
11
14
|
import type { ToolRequestUserInputParams } from "./v2/ToolRequestUserInputParams";
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* Request initiated from the server and sent to the client.
|
|
15
18
|
*/
|
|
16
|
-
export type ServerRequest =
|
|
19
|
+
export type ServerRequest ={ "method": "item/commandExecution/requestApproval", id: RequestId, params: CommandExecutionRequestApprovalParams, } | { "method": "item/fileChange/requestApproval", id: RequestId, params: FileChangeRequestApprovalParams, } | { "method": "item/tool/requestUserInput", id: RequestId, params: ToolRequestUserInputParams, } | { "method": "mcpServer/elicitation/request", id: RequestId, params: McpServerElicitationRequestParams, } | { "method": "item/permissions/requestApproval", id: RequestId, params: PermissionsRequestApprovalParams, } | { "method": "item/tool/call", id: RequestId, params: DynamicToolCallParams, } | { "method": "account/chatgptAuthTokens/refresh", id: RequestId, params: ChatgptAuthTokensRefreshParams, } | { "method": "attestation/generate", id: RequestId, params: AttestationGenerateParams, } | { "method": "applyPatchApproval", id: RequestId, params: ApplyPatchApprovalParams, } | { "method": "execCommandApproval", id: RequestId, params: ExecCommandApprovalParams, };
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
4
|
import type { JsonValue } from "../serde_json/JsonValue";
|
|
5
5
|
|
|
6
|
-
export type DynamicToolCallParams = { threadId: string, turnId: string, callId: string, tool: string, arguments: JsonValue, };
|
|
6
|
+
export type DynamicToolCallParams = { threadId: string, turnId: string, callId: string, namespace: string | null, tool: string, arguments: JsonValue, };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { vi, describe, it, expect, beforeEach } from "vitest";
|
|
2
|
+
|
|
3
|
+
vi.mock("../codex-auth.js", () => ({
|
|
4
|
+
getAccountStatus: vi.fn(),
|
|
5
|
+
getLoginStatus: vi.fn(),
|
|
6
|
+
startDeviceLogin: vi.fn(),
|
|
7
|
+
cancelLogin: vi.fn(),
|
|
8
|
+
logout: vi.fn(),
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
import { Hono } from "hono";
|
|
12
|
+
import {
|
|
13
|
+
getAccountStatus, getLoginStatus, startDeviceLogin, cancelLogin, logout,
|
|
14
|
+
} from "../codex-auth.js";
|
|
15
|
+
import { registerCodexAuthRoutes } from "./codex-auth-routes.js";
|
|
16
|
+
|
|
17
|
+
const mockAccount = vi.mocked(getAccountStatus);
|
|
18
|
+
const mockLoginStatus = vi.mocked(getLoginStatus);
|
|
19
|
+
const mockStart = vi.mocked(startDeviceLogin);
|
|
20
|
+
const mockCancel = vi.mocked(cancelLogin);
|
|
21
|
+
const mockLogout = vi.mocked(logout);
|
|
22
|
+
|
|
23
|
+
function createApp() {
|
|
24
|
+
const api = new Hono();
|
|
25
|
+
registerCodexAuthRoutes(api);
|
|
26
|
+
return api;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
vi.clearAllMocks();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe("GET /codex/auth/account", () => {
|
|
34
|
+
it("returns the current account status", async () => {
|
|
35
|
+
const status = {
|
|
36
|
+
cliAvailable: true, authenticated: true, method: "chatgpt" as const,
|
|
37
|
+
email: "user@example.com", planType: "pro",
|
|
38
|
+
};
|
|
39
|
+
mockAccount.mockResolvedValue(status);
|
|
40
|
+
|
|
41
|
+
const res = await createApp().request("/codex/auth/account");
|
|
42
|
+
|
|
43
|
+
expect(res.status).toBe(200);
|
|
44
|
+
expect(await res.json()).toEqual(status);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe("GET /codex/auth/login", () => {
|
|
49
|
+
it("returns the pending login status for the client to poll", async () => {
|
|
50
|
+
const status = {
|
|
51
|
+
state: "pending" as const,
|
|
52
|
+
userCode: "ABCD-1234",
|
|
53
|
+
verificationUrl: "https://auth.openai.com/codex/device",
|
|
54
|
+
};
|
|
55
|
+
mockLoginStatus.mockReturnValue(status);
|
|
56
|
+
|
|
57
|
+
const res = await createApp().request("/codex/auth/login");
|
|
58
|
+
|
|
59
|
+
expect(await res.json()).toEqual(status);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe("POST /codex/auth/login", () => {
|
|
64
|
+
it("starts a device login and returns the user code", async () => {
|
|
65
|
+
mockStart.mockResolvedValue({
|
|
66
|
+
state: "pending", userCode: "ABCD-1234",
|
|
67
|
+
verificationUrl: "https://auth.openai.com/codex/device",
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const res = await createApp().request("/codex/auth/login", { method: "POST" });
|
|
71
|
+
|
|
72
|
+
expect(res.status).toBe(200);
|
|
73
|
+
expect(await res.json()).toMatchObject({ state: "pending", userCode: "ABCD-1234" });
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("returns 200 with an error field when starting fails, so the client keeps the detail", async () => {
|
|
77
|
+
// The frontend post() helper throws away the body on non-2xx, so structured
|
|
78
|
+
// failures are deliberately reported as 200 (same convention as tailscale).
|
|
79
|
+
mockStart.mockRejectedValue(new Error("Codex CLI not found on PATH"));
|
|
80
|
+
|
|
81
|
+
const res = await createApp().request("/codex/auth/login", { method: "POST" });
|
|
82
|
+
|
|
83
|
+
expect(res.status).toBe(200);
|
|
84
|
+
expect(await res.json()).toEqual({ state: "error", error: "Codex CLI not found on PATH" });
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe("POST /codex/auth/login/cancel", () => {
|
|
89
|
+
it("cancels the in-flight login", async () => {
|
|
90
|
+
mockCancel.mockResolvedValue({ state: "canceled" });
|
|
91
|
+
|
|
92
|
+
const res = await createApp().request("/codex/auth/login/cancel", { method: "POST" });
|
|
93
|
+
|
|
94
|
+
expect(await res.json()).toEqual({ state: "canceled" });
|
|
95
|
+
expect(mockCancel).toHaveBeenCalled();
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
describe("POST /codex/auth/logout", () => {
|
|
100
|
+
it("signs the account out", async () => {
|
|
101
|
+
mockLogout.mockResolvedValue({ ok: true });
|
|
102
|
+
|
|
103
|
+
const res = await createApp().request("/codex/auth/logout", { method: "POST" });
|
|
104
|
+
|
|
105
|
+
expect(await res.json()).toEqual({ ok: true });
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it("passes through a logout failure reason", async () => {
|
|
109
|
+
mockLogout.mockResolvedValue({ ok: false, error: "boom" });
|
|
110
|
+
|
|
111
|
+
const res = await createApp().request("/codex/auth/logout", { method: "POST" });
|
|
112
|
+
|
|
113
|
+
expect(await res.json()).toEqual({ ok: false, error: "boom" });
|
|
114
|
+
});
|
|
115
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Hono } from "hono";
|
|
2
|
+
import {
|
|
3
|
+
cancelLogin,
|
|
4
|
+
getAccountStatus,
|
|
5
|
+
getLoginStatus,
|
|
6
|
+
logout,
|
|
7
|
+
startDeviceLogin,
|
|
8
|
+
} from "../codex-auth.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Codex ChatGPT-subscription auth, driven from Settings instead of an SSH
|
|
12
|
+
* session. The login is a device-code flow: POST /start returns a user code and
|
|
13
|
+
* a verification URL, the client polls GET /login until it resolves.
|
|
14
|
+
*
|
|
15
|
+
* Following the tailscale-routes convention, failures that carry useful
|
|
16
|
+
* structure are returned as 200 with an `error` field rather than a non-2xx
|
|
17
|
+
* status, so the frontend `post()` helper doesn't throw the detail away.
|
|
18
|
+
*/
|
|
19
|
+
export function registerCodexAuthRoutes(api: Hono): void {
|
|
20
|
+
// Current account (spawns a short-lived app-server to ask Codex directly).
|
|
21
|
+
api.get("/codex/auth/account", async (c) => {
|
|
22
|
+
return c.json(await getAccountStatus());
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Poll target for an in-flight (or just-finished) login.
|
|
26
|
+
api.get("/codex/auth/login", (c) => {
|
|
27
|
+
return c.json(getLoginStatus());
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Begin a device-code login. Idempotent while one is in flight.
|
|
31
|
+
api.post("/codex/auth/login", async (c) => {
|
|
32
|
+
try {
|
|
33
|
+
return c.json(await startDeviceLogin());
|
|
34
|
+
} catch (e) {
|
|
35
|
+
return c.json({
|
|
36
|
+
state: "error" as const,
|
|
37
|
+
error: e instanceof Error ? e.message : String(e),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
api.post("/codex/auth/login/cancel", async (c) => {
|
|
43
|
+
return c.json(await cancelLogin());
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
api.post("/codex/auth/logout", async (c) => {
|
|
47
|
+
return c.json(await logout());
|
|
48
|
+
});
|
|
49
|
+
}
|
package/server/routes.ts
CHANGED
|
@@ -36,6 +36,7 @@ import { registerLinearRoutes, fetchLinearTeamStates } from "./routes/linear-rou
|
|
|
36
36
|
import { registerLinearConnectionRoutes } from "./routes/linear-connection-routes.js";
|
|
37
37
|
import { getConnection, resolveApiKey } from "./linear-connections.js";
|
|
38
38
|
import { registerLinearOAuthConnectionRoutes } from "./routes/linear-oauth-connection-routes.js";
|
|
39
|
+
import { registerCodexAuthRoutes } from "./routes/codex-auth-routes.js";
|
|
39
40
|
import { getSettings } from "./settings-manager.js";
|
|
40
41
|
import { discoverClaudeSessions } from "./claude-session-discovery.js";
|
|
41
42
|
import { getClaudeSessionHistoryPage } from "./claude-session-history.js";
|
|
@@ -1276,6 +1277,7 @@ export function createRoutes(
|
|
|
1276
1277
|
|
|
1277
1278
|
registerPromptRoutes(api);
|
|
1278
1279
|
registerSettingsRoutes(api);
|
|
1280
|
+
registerCodexAuthRoutes(api);
|
|
1279
1281
|
registerDashboardRoutes(api, {
|
|
1280
1282
|
listCompanionSessions: () => launcher.listSessions(),
|
|
1281
1283
|
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as l,r as s,c as k,j as r,D as M,M as R,P as _,C}from"./index-C0oFg9YU.js";import{d as P,t as D,M as E}from"./MagicUIDashboard-DpxmzOIx.js";const N=4e3;function A({sessionId:t}){const u=l(e=>e.pendingPermissions.get(t)),h=l(e=>e.removePermission),m=l(e=>e.connectionStatus.get(t)??"disconnected"),x=l(e=>e.cliConnected.get(t)??!1),i=s.useMemo(()=>u?Array.from(u.values()):[],[u]),[a,g]=s.useState(new Set),f=s.useRef(new Set),c=s.useRef(new Map);s.useEffect(()=>{for(const e of i){const n=e.request_id;f.current.has(n)||a.has(n)||c.current.has(n)||c.current.set(n,setTimeout(()=>{c.current.delete(n),f.current.has(n)||g(o=>new Set(o).add(n))},N))}for(const[e,n]of c.current)i.some(o=>o.request_id===e)||(clearTimeout(n),c.current.delete(e))},[i,a]),s.useEffect(()=>()=>{for(const e of c.current.values())clearTimeout(e);c.current.clear()},[]);const b=s.useCallback(e=>{f.current.add(e);const n=c.current.get(e);n&&(clearTimeout(n),c.current.delete(e))},[]),v=s.useCallback((e,n)=>{var d;const o=(d=l.getState().pendingPermissions.get(t))==null?void 0:d.get(e);o&&(k(t,P(o,n)),h(t,e))},[t,h]),w=s.useCallback(()=>{g(e=>{var o;const n=new Set(e);for(const d of((o=l.getState().pendingPermissions.get(t))==null?void 0:o.values())??[])n.add(d.request_id);return n})},[t]),j=s.useMemo(()=>i.filter(e=>!a.has(e.request_id)).map(D),[i,a]),p=s.useMemo(()=>i.filter(e=>a.has(e.request_id)),[i,a]),S=m==="connected"&&!x;return r.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[(S||m==="disconnected")&&r.jsxs("div",{className:"px-4 py-1.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-2",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-warning animate-[pulse-dot_1.5s_ease-in-out_infinite] shrink-0"}),r.jsx("span",{className:"text-xs text-cc-warning font-medium",children:m==="disconnected"?"Reconnecting to session…":"CLI disconnected — switch to Standard view to reconnect"})]}),r.jsx("div",{className:"h-36 shrink-0 border-b border-cc-border relative overflow-hidden","aria-label":"Raw session output",children:r.jsx(M,{value:"compact",children:r.jsx(R,{sessionId:t})})}),r.jsx("div",{className:"flex-1 min-h-0 relative bg-cc-bg",children:r.jsx(E,{sessionId:t,decisions:j,onDecisionAck:b,onDecisionResponse:v,onRuntimeError:w})}),p.length>0&&r.jsx("div",{className:"shrink-0 max-h-[50dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:p.map(e=>r.jsx(_,{permission:e,sessionId:t},e.request_id))}),r.jsx(C,{sessionId:t})]})}export{A as MagicUIView};
|