@hellcoder/companion 0.119.0 → 0.120.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-TD9AO1Er.js → AgentsPage-V7NBPNSh.js} +5 -5
- package/dist/assets/CronManager-CGfXlVZS.js +1 -0
- package/dist/assets/{DashboardPage-CQc0PLwb.js → DashboardPage-N7MWZiJQ.js} +1 -1
- package/dist/assets/{IntegrationsPage-ChVMH0yi.js → IntegrationsPage-DRP477b0.js} +1 -1
- package/dist/assets/{LinearOAuthSettingsPage-Bb7Tu4o3.js → LinearOAuthSettingsPage-CPW4TQuD.js} +1 -1
- package/dist/assets/{LinearSettingsPage-BxKEO7CY.js → LinearSettingsPage-BwVTEKqs.js} +1 -1
- package/dist/assets/{MagicUIDashboard-j4axrj9-.js → MagicUIDashboard-exuRY5LQ.js} +1 -1
- package/dist/assets/MagicUIView-AKoy6jOb.js +1 -0
- package/dist/assets/{Playground-DlNnNZL_.js → Playground-BiEa7THU.js} +6 -6
- package/dist/assets/{PromptsPage-C-VOgj-R.js → PromptsPage-BYtZdliB.js} +1 -1
- package/dist/assets/{RunsPage-Ce99iVIk.js → RunsPage-DD6KPNKm.js} +1 -1
- package/dist/assets/{SandboxManager-ZtcsgPxE.js → SandboxManager-C8tBjBXY.js} +1 -1
- package/dist/assets/SettingsPage-77tDzDuD.js +1 -0
- package/dist/assets/{TailscalePage-C61E10pR.js → TailscalePage-B0TbcOPL.js} +1 -1
- package/dist/assets/index-BM8QkiV8.js +140 -0
- package/dist/assets/index-CUfPwiv5.css +1 -0
- package/dist/assets/{sw-register-NM2AysKf.js → sw-register-Cr16zatT.js} +1 -1
- package/dist/index.html +2 -2
- 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/CronManager-DQXJXJO2.js +0 -1
- package/dist/assets/MagicUIView-D6jNdxHM.js +0 -1
- package/dist/assets/SettingsPage-QEkLsk5w.js +0 -1
- package/dist/assets/index-CnVoJw43.js +0 -140
- package/dist/assets/index-DB85gIpd.css +0 -1
|
@@ -1,60 +1,105 @@
|
|
|
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 { AddConversationListenerParams } from "./AddConversationListenerParams";
|
|
5
|
-
import type { ArchiveConversationParams } from "./ArchiveConversationParams";
|
|
6
|
-
import type { CancelLoginChatGptParams } from "./CancelLoginChatGptParams";
|
|
7
|
-
import type { ExecOneOffCommandParams } from "./ExecOneOffCommandParams";
|
|
8
|
-
import type { ForkConversationParams } from "./ForkConversationParams";
|
|
9
4
|
import type { FuzzyFileSearchParams } from "./FuzzyFileSearchParams";
|
|
10
5
|
import type { GetAuthStatusParams } from "./GetAuthStatusParams";
|
|
11
6
|
import type { GetConversationSummaryParams } from "./GetConversationSummaryParams";
|
|
12
7
|
import type { GitDiffToRemoteParams } from "./GitDiffToRemoteParams";
|
|
13
8
|
import type { InitializeParams } from "./InitializeParams";
|
|
14
|
-
import type { InterruptConversationParams } from "./InterruptConversationParams";
|
|
15
|
-
import type { ListConversationsParams } from "./ListConversationsParams";
|
|
16
|
-
import type { LoginApiKeyParams } from "./LoginApiKeyParams";
|
|
17
|
-
import type { NewConversationParams } from "./NewConversationParams";
|
|
18
|
-
import type { RemoveConversationListenerParams } from "./RemoveConversationListenerParams";
|
|
19
9
|
import type { RequestId } from "./RequestId";
|
|
20
|
-
import type {
|
|
21
|
-
import type { SendUserMessageParams } from "./SendUserMessageParams";
|
|
22
|
-
import type { SendUserTurnParams } from "./SendUserTurnParams";
|
|
23
|
-
import type { SetDefaultModelParams } from "./SetDefaultModelParams";
|
|
10
|
+
import type { AppsInstalledParams } from "./v2/AppsInstalledParams";
|
|
24
11
|
import type { AppsListParams } from "./v2/AppsListParams";
|
|
12
|
+
import type { AppsReadParams } from "./v2/AppsReadParams";
|
|
25
13
|
import type { CancelLoginAccountParams } from "./v2/CancelLoginAccountParams";
|
|
26
14
|
import type { CommandExecParams } from "./v2/CommandExecParams";
|
|
15
|
+
import type { CommandExecResizeParams } from "./v2/CommandExecResizeParams";
|
|
16
|
+
import type { CommandExecTerminateParams } from "./v2/CommandExecTerminateParams";
|
|
17
|
+
import type { CommandExecWriteParams } from "./v2/CommandExecWriteParams";
|
|
27
18
|
import type { ConfigBatchWriteParams } from "./v2/ConfigBatchWriteParams";
|
|
28
19
|
import type { ConfigReadParams } from "./v2/ConfigReadParams";
|
|
29
20
|
import type { ConfigValueWriteParams } from "./v2/ConfigValueWriteParams";
|
|
21
|
+
import type { ConsumeAccountRateLimitResetCreditParams } from "./v2/ConsumeAccountRateLimitResetCreditParams";
|
|
22
|
+
import type { ExperimentalFeatureEnablementSetParams } from "./v2/ExperimentalFeatureEnablementSetParams";
|
|
30
23
|
import type { ExperimentalFeatureListParams } from "./v2/ExperimentalFeatureListParams";
|
|
24
|
+
import type { ExternalAgentConfigDetectParams } from "./v2/ExternalAgentConfigDetectParams";
|
|
25
|
+
import type { ExternalAgentConfigImportHistoryRecordParams } from "./v2/ExternalAgentConfigImportHistoryRecordParams";
|
|
26
|
+
import type { ExternalAgentConfigImportParams } from "./v2/ExternalAgentConfigImportParams";
|
|
31
27
|
import type { FeedbackUploadParams } from "./v2/FeedbackUploadParams";
|
|
28
|
+
import type { FsCopyParams } from "./v2/FsCopyParams";
|
|
29
|
+
import type { FsCreateDirectoryParams } from "./v2/FsCreateDirectoryParams";
|
|
30
|
+
import type { FsGetMetadataParams } from "./v2/FsGetMetadataParams";
|
|
31
|
+
import type { FsReadDirectoryParams } from "./v2/FsReadDirectoryParams";
|
|
32
|
+
import type { FsReadFileParams } from "./v2/FsReadFileParams";
|
|
33
|
+
import type { FsRemoveParams } from "./v2/FsRemoveParams";
|
|
34
|
+
import type { FsUnwatchParams } from "./v2/FsUnwatchParams";
|
|
35
|
+
import type { FsWatchParams } from "./v2/FsWatchParams";
|
|
36
|
+
import type { FsWriteFileParams } from "./v2/FsWriteFileParams";
|
|
32
37
|
import type { GetAccountParams } from "./v2/GetAccountParams";
|
|
38
|
+
import type { GetAccountRateLimitsParams } from "./v2/GetAccountRateLimitsParams";
|
|
39
|
+
import type { GetAccountTokenUsageParams } from "./v2/GetAccountTokenUsageParams";
|
|
40
|
+
import type { HooksListParams } from "./v2/HooksListParams";
|
|
33
41
|
import type { ListMcpServerStatusParams } from "./v2/ListMcpServerStatusParams";
|
|
34
42
|
import type { LoginAccountParams } from "./v2/LoginAccountParams";
|
|
43
|
+
import type { MarketplaceAddParams } from "./v2/MarketplaceAddParams";
|
|
44
|
+
import type { MarketplaceRemoveParams } from "./v2/MarketplaceRemoveParams";
|
|
45
|
+
import type { MarketplaceUpgradeParams } from "./v2/MarketplaceUpgradeParams";
|
|
46
|
+
import type { McpResourceReadParams } from "./v2/McpResourceReadParams";
|
|
35
47
|
import type { McpServerOauthLoginParams } from "./v2/McpServerOauthLoginParams";
|
|
48
|
+
import type { McpServerToolCallParams } from "./v2/McpServerToolCallParams";
|
|
36
49
|
import type { ModelListParams } from "./v2/ModelListParams";
|
|
50
|
+
import type { ModelProviderCapabilitiesReadParams } from "./v2/ModelProviderCapabilitiesReadParams";
|
|
51
|
+
import type { PermissionProfileListParams } from "./v2/PermissionProfileListParams";
|
|
52
|
+
import type { PluginInstallParams } from "./v2/PluginInstallParams";
|
|
53
|
+
import type { PluginInstalledParams } from "./v2/PluginInstalledParams";
|
|
54
|
+
import type { PluginListParams } from "./v2/PluginListParams";
|
|
55
|
+
import type { PluginReadParams } from "./v2/PluginReadParams";
|
|
56
|
+
import type { PluginReconcileParams } from "./v2/PluginReconcileParams";
|
|
57
|
+
import type { PluginShareCheckoutParams } from "./v2/PluginShareCheckoutParams";
|
|
58
|
+
import type { PluginShareDeleteParams } from "./v2/PluginShareDeleteParams";
|
|
59
|
+
import type { PluginShareListParams } from "./v2/PluginShareListParams";
|
|
60
|
+
import type { PluginShareSaveParams } from "./v2/PluginShareSaveParams";
|
|
61
|
+
import type { PluginShareUpdateTargetsParams } from "./v2/PluginShareUpdateTargetsParams";
|
|
62
|
+
import type { PluginSkillReadParams } from "./v2/PluginSkillReadParams";
|
|
63
|
+
import type { PluginUninstallParams } from "./v2/PluginUninstallParams";
|
|
37
64
|
import type { ReviewStartParams } from "./v2/ReviewStartParams";
|
|
65
|
+
import type { SendAddCreditsNudgeEmailParams } from "./v2/SendAddCreditsNudgeEmailParams";
|
|
38
66
|
import type { SkillsConfigWriteParams } from "./v2/SkillsConfigWriteParams";
|
|
67
|
+
import type { SkillsExtraRootsSetParams } from "./v2/SkillsExtraRootsSetParams";
|
|
39
68
|
import type { SkillsListParams } from "./v2/SkillsListParams";
|
|
40
|
-
import type {
|
|
41
|
-
import type { SkillsRemoteWriteParams } from "./v2/SkillsRemoteWriteParams";
|
|
69
|
+
import type { ThreadApproveGuardianDeniedActionParams } from "./v2/ThreadApproveGuardianDeniedActionParams";
|
|
42
70
|
import type { ThreadArchiveParams } from "./v2/ThreadArchiveParams";
|
|
43
71
|
import type { ThreadCompactStartParams } from "./v2/ThreadCompactStartParams";
|
|
72
|
+
import type { ThreadDeleteParams } from "./v2/ThreadDeleteParams";
|
|
44
73
|
import type { ThreadForkParams } from "./v2/ThreadForkParams";
|
|
74
|
+
import type { ThreadGoalClearParams } from "./v2/ThreadGoalClearParams";
|
|
75
|
+
import type { ThreadGoalGetParams } from "./v2/ThreadGoalGetParams";
|
|
76
|
+
import type { ThreadGoalSetParams } from "./v2/ThreadGoalSetParams";
|
|
77
|
+
import type { ThreadInjectItemsParams } from "./v2/ThreadInjectItemsParams";
|
|
78
|
+
import type { ThreadItemsListParams } from "./v2/ThreadItemsListParams";
|
|
45
79
|
import type { ThreadListParams } from "./v2/ThreadListParams";
|
|
46
80
|
import type { ThreadLoadedListParams } from "./v2/ThreadLoadedListParams";
|
|
81
|
+
import type { ThreadMetadataUpdateParams } from "./v2/ThreadMetadataUpdateParams";
|
|
47
82
|
import type { ThreadReadParams } from "./v2/ThreadReadParams";
|
|
48
83
|
import type { ThreadResumeParams } from "./v2/ThreadResumeParams";
|
|
84
|
+
import type { ThreadRevertParams } from "./v2/ThreadRevertParams";
|
|
49
85
|
import type { ThreadRollbackParams } from "./v2/ThreadRollbackParams";
|
|
86
|
+
import type { ThreadSectionCreateParams } from "./v2/ThreadSectionCreateParams";
|
|
87
|
+
import type { ThreadSectionDeleteParams } from "./v2/ThreadSectionDeleteParams";
|
|
88
|
+
import type { ThreadSectionListParams } from "./v2/ThreadSectionListParams";
|
|
89
|
+
import type { ThreadSectionMoveParams } from "./v2/ThreadSectionMoveParams";
|
|
90
|
+
import type { ThreadSectionUpdateParams } from "./v2/ThreadSectionUpdateParams";
|
|
50
91
|
import type { ThreadSetNameParams } from "./v2/ThreadSetNameParams";
|
|
92
|
+
import type { ThreadShellCommandParams } from "./v2/ThreadShellCommandParams";
|
|
51
93
|
import type { ThreadStartParams } from "./v2/ThreadStartParams";
|
|
94
|
+
import type { ThreadTurnsListParams } from "./v2/ThreadTurnsListParams";
|
|
52
95
|
import type { ThreadUnarchiveParams } from "./v2/ThreadUnarchiveParams";
|
|
96
|
+
import type { ThreadUnsubscribeParams } from "./v2/ThreadUnsubscribeParams";
|
|
53
97
|
import type { TurnInterruptParams } from "./v2/TurnInterruptParams";
|
|
54
98
|
import type { TurnStartParams } from "./v2/TurnStartParams";
|
|
55
99
|
import type { TurnSteerParams } from "./v2/TurnSteerParams";
|
|
100
|
+
import type { WindowsSandboxSetupStartParams } from "./v2/WindowsSandboxSetupStartParams";
|
|
56
101
|
|
|
57
102
|
/**
|
|
58
103
|
* Request from the client to the server.
|
|
59
104
|
*/
|
|
60
|
-
export type ClientRequest ={ "method": "initialize", id: RequestId, params: InitializeParams, } | { "method": "thread/start", id: RequestId, params: ThreadStartParams, } | { "method": "thread/resume", id: RequestId, params: ThreadResumeParams, } | { "method": "thread/fork", id: RequestId, params: ThreadForkParams, } | { "method": "thread/archive", id: RequestId, params: ThreadArchiveParams, } | { "method": "thread/name/set", id: RequestId, params: ThreadSetNameParams, } | { "method": "thread/unarchive", id: RequestId, params: ThreadUnarchiveParams, } | { "method": "thread/compact/start", id: RequestId, params: ThreadCompactStartParams, } | { "method": "thread/rollback", id: RequestId, params: ThreadRollbackParams, } | { "method": "thread/list", id: RequestId, params: ThreadListParams, } | { "method": "thread/loaded/list", id: RequestId, params: ThreadLoadedListParams, } | { "method": "thread/read", id: RequestId, params: ThreadReadParams, } | { "method": "skills/list", id: RequestId, params: SkillsListParams, } | { "method": "skills/
|
|
105
|
+
export type ClientRequest ={ "method": "initialize", id: RequestId, params: InitializeParams, } | { "method": "thread/start", id: RequestId, params: ThreadStartParams, } | { "method": "thread/resume", id: RequestId, params: ThreadResumeParams, } | { "method": "thread/fork", id: RequestId, params: ThreadForkParams, } | { "method": "thread/archive", id: RequestId, params: ThreadArchiveParams, } | { "method": "thread/delete", id: RequestId, params: ThreadDeleteParams, } | { "method": "thread/unsubscribe", id: RequestId, params: ThreadUnsubscribeParams, } | { "method": "thread/name/set", id: RequestId, params: ThreadSetNameParams, } | { "method": "thread/goal/set", id: RequestId, params: ThreadGoalSetParams, } | { "method": "thread/goal/get", id: RequestId, params: ThreadGoalGetParams, } | { "method": "thread/goal/clear", id: RequestId, params: ThreadGoalClearParams, } | { "method": "thread/metadata/update", id: RequestId, params: ThreadMetadataUpdateParams, } | { "method": "thread/section/move", id: RequestId, params: ThreadSectionMoveParams, } | { "method": "thread/unarchive", id: RequestId, params: ThreadUnarchiveParams, } | { "method": "thread/compact/start", id: RequestId, params: ThreadCompactStartParams, } | { "method": "thread/shellCommand", id: RequestId, params: ThreadShellCommandParams, } | { "method": "thread/approveGuardianDeniedAction", id: RequestId, params: ThreadApproveGuardianDeniedActionParams, } | { "method": "thread/rollback", id: RequestId, params: ThreadRollbackParams, } | { "method": "thread/revert", id: RequestId, params: ThreadRevertParams, } | { "method": "thread/list", id: RequestId, params: ThreadListParams, } | { "method": "threadSection/list", id: RequestId, params: ThreadSectionListParams, } | { "method": "threadSection/create", id: RequestId, params: ThreadSectionCreateParams, } | { "method": "threadSection/update", id: RequestId, params: ThreadSectionUpdateParams, } | { "method": "threadSection/delete", id: RequestId, params: ThreadSectionDeleteParams, } | { "method": "thread/loaded/list", id: RequestId, params: ThreadLoadedListParams, } | { "method": "thread/read", id: RequestId, params: ThreadReadParams, } | { "method": "thread/turns/list", id: RequestId, params: ThreadTurnsListParams, } | { "method": "thread/items/list", id: RequestId, params: ThreadItemsListParams, } | { "method": "thread/inject_items", id: RequestId, params: ThreadInjectItemsParams, } | { "method": "skills/list", id: RequestId, params: SkillsListParams, } | { "method": "skills/extraRoots/set", id: RequestId, params: SkillsExtraRootsSetParams, } | { "method": "hooks/list", id: RequestId, params: HooksListParams, } | { "method": "marketplace/add", id: RequestId, params: MarketplaceAddParams, } | { "method": "marketplace/remove", id: RequestId, params: MarketplaceRemoveParams, } | { "method": "marketplace/upgrade", id: RequestId, params: MarketplaceUpgradeParams, } | { "method": "plugin/list", id: RequestId, params: PluginListParams, } | { "method": "plugin/installed", id: RequestId, params: PluginInstalledParams, } | { "method": "plugin/reconcile", id: RequestId, params: PluginReconcileParams, } | { "method": "plugin/read", id: RequestId, params: PluginReadParams, } | { "method": "plugin/skill/read", id: RequestId, params: PluginSkillReadParams, } | { "method": "plugin/share/save", id: RequestId, params: PluginShareSaveParams, } | { "method": "plugin/share/updateTargets", id: RequestId, params: PluginShareUpdateTargetsParams, } | { "method": "plugin/share/list", id: RequestId, params: PluginShareListParams, } | { "method": "plugin/share/checkout", id: RequestId, params: PluginShareCheckoutParams, } | { "method": "plugin/share/delete", id: RequestId, params: PluginShareDeleteParams, } | { "method": "app/read", id: RequestId, params: AppsReadParams, } | { "method": "app/list", id: RequestId, params: AppsListParams, } | { "method": "app/installed", id: RequestId, params: AppsInstalledParams, } | { "method": "fs/readFile", id: RequestId, params: FsReadFileParams, } | { "method": "fs/writeFile", id: RequestId, params: FsWriteFileParams, } | { "method": "fs/createDirectory", id: RequestId, params: FsCreateDirectoryParams, } | { "method": "fs/getMetadata", id: RequestId, params: FsGetMetadataParams, } | { "method": "fs/readDirectory", id: RequestId, params: FsReadDirectoryParams, } | { "method": "fs/remove", id: RequestId, params: FsRemoveParams, } | { "method": "fs/copy", id: RequestId, params: FsCopyParams, } | { "method": "fs/watch", id: RequestId, params: FsWatchParams, } | { "method": "fs/unwatch", id: RequestId, params: FsUnwatchParams, } | { "method": "skills/config/write", id: RequestId, params: SkillsConfigWriteParams, } | { "method": "plugin/install", id: RequestId, params: PluginInstallParams, } | { "method": "plugin/uninstall", id: RequestId, params: PluginUninstallParams, } | { "method": "turn/start", id: RequestId, params: TurnStartParams, } | { "method": "turn/steer", id: RequestId, params: TurnSteerParams, } | { "method": "turn/interrupt", id: RequestId, params: TurnInterruptParams, } | { "method": "review/start", id: RequestId, params: ReviewStartParams, } | { "method": "model/list", id: RequestId, params: ModelListParams, } | { "method": "modelProvider/capabilities/read", id: RequestId, params: ModelProviderCapabilitiesReadParams, } | { "method": "experimentalFeature/list", id: RequestId, params: ExperimentalFeatureListParams, } | { "method": "permissionProfile/list", id: RequestId, params: PermissionProfileListParams, } | { "method": "experimentalFeature/enablement/set", id: RequestId, params: ExperimentalFeatureEnablementSetParams, } | { "method": "mcpServer/oauth/login", id: RequestId, params: McpServerOauthLoginParams, } | { "method": "config/mcpServer/reload", id: RequestId, params: undefined, } | { "method": "mcpServerStatus/list", id: RequestId, params: ListMcpServerStatusParams, } | { "method": "mcpServer/resource/read", id: RequestId, params: McpResourceReadParams, } | { "method": "mcpServer/tool/call", id: RequestId, params: McpServerToolCallParams, } | { "method": "windowsSandbox/setupStart", id: RequestId, params: WindowsSandboxSetupStartParams, } | { "method": "windowsSandbox/readiness", id: RequestId, params: undefined, } | { "method": "account/login/start", id: RequestId, params: LoginAccountParams, } | { "method": "account/login/cancel", id: RequestId, params: CancelLoginAccountParams, } | { "method": "account/logout", id: RequestId, params: undefined, } | { "method": "account/rateLimits/read", id: RequestId, params?: GetAccountRateLimitsParams | undefined, } | { "method": "account/rateLimitResetCredit/consume", id: RequestId, params: ConsumeAccountRateLimitResetCreditParams, } | { "method": "account/usage/read", id: RequestId, params?: GetAccountTokenUsageParams | undefined, } | { "method": "account/workspaceMessages/read", id: RequestId, params: undefined, } | { "method": "account/sendAddCreditsNudgeEmail", id: RequestId, params: SendAddCreditsNudgeEmailParams, } | { "method": "feedback/upload", id: RequestId, params: FeedbackUploadParams, } | { "method": "command/exec", id: RequestId, params: CommandExecParams, } | { "method": "command/exec/write", id: RequestId, params: CommandExecWriteParams, } | { "method": "command/exec/terminate", id: RequestId, params: CommandExecTerminateParams, } | { "method": "command/exec/resize", id: RequestId, params: CommandExecResizeParams, } | { "method": "config/read", id: RequestId, params: ConfigReadParams, } | { "method": "externalAgentConfig/detect", id: RequestId, params: ExternalAgentConfigDetectParams, } | { "method": "externalAgentConfig/import", id: RequestId, params: ExternalAgentConfigImportParams, } | { "method": "externalAgentConfig/import/recordHistory", id: RequestId, params: ExternalAgentConfigImportHistoryRecordParams, } | { "method": "externalAgentConfig/import/readHistories", id: RequestId, params: undefined, } | { "method": "config/value/write", id: RequestId, params: ConfigValueWriteParams, } | { "method": "config/batchWrite", id: RequestId, params: ConfigBatchWriteParams, } | { "method": "configRequirements/read", id: RequestId, params: undefined, } | { "method": "account/read", id: RequestId, params: GetAccountParams, } | { "method": "getConversationSummary", id: RequestId, params: GetConversationSummaryParams, } | { "method": "gitDiffToRemote", id: RequestId, params: GitDiffToRemoteParams, } | { "method": "getAuthStatus", id: RequestId, params: GetAuthStatusParams, } | { "method": "fuzzyFileSearch", id: RequestId, params: FuzzyFileSearchParams, };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Codex protocol snapshot used by offline compatibility tests.
|
|
2
2
|
|
|
3
3
|
Source repository: `https://github.com/openai/codex`
|
|
4
|
-
Source commit: `
|
|
4
|
+
Source commit: `0e9589ffae082437e6793e8c24900e876dfdf86a`
|
|
5
5
|
|
|
6
6
|
Copied files (stored as `.txt` snapshots to avoid TypeScript import resolution in this repo):
|
|
7
7
|
- `codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts` -> `ClientRequest.ts.txt`
|
|
@@ -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{r as a,a as j,j as e,t as z,H as _,I as B,J as K,K as U,F as Y}from"./index-CnVoJw43.js";function W(s,p,c=!0){a.useEffect(()=>{if(!c)return;function d(o){s.some(m=>m.current&&m.current.contains(o.target))||p()}return document.addEventListener("pointerdown",d),()=>document.removeEventListener("pointerdown",d)},[s,p,c])}function J(s){const p=s-Date.now();if(p<=0)return"now";const c=Math.floor(p/6e4);if(c<60)return`in ${c}m`;const d=Math.floor(c/60);return d<24?`in ${d}h`:`in ${Math.floor(d/24)}d`}function F(s,p){if(!p)return"One-time";const c=s.trim().split(/\s+/);if(c.length!==5)return s;const[d,o,g,m,x]=c;if(s==="* * * * *")return"Every minute";if(o==="*"&&g==="*"&&m==="*"&&x==="*"&&d.startsWith("*/")){const l=parseInt(d.slice(2),10);return l===1?"Every minute":`Every ${l} minutes`}if(d==="0"&&g==="*"&&m==="*"&&x==="*"){if(o==="*")return"Every hour";if(o.startsWith("*/")){const l=parseInt(o.slice(2),10);return l===1?"Every hour":`Every ${l} hours`}}if(g==="*"&&m==="*"&&d!=="*"&&o!=="*"&&!o.includes("/")&&!o.includes(",")){const l=parseInt(o,10),y=parseInt(d,10);if(!isNaN(l)&&!isNaN(y)){const u=l>=12?"PM":"AM",w=l===0?12:l>12?l-12:l,r=y.toString().padStart(2,"0"),v=`${w}:${r} ${u}`;if(x==="*")return`Every day at ${v}`;if(x==="1-5")return`Weekdays at ${v}`;if(x==="0,6")return`Weekends at ${v}`}}return s}const $={name:"",prompt:"",recurring:!0,schedule:"0 8 * * *",oneTimeDate:"",backendType:"claude",model:B("claude"),cwd:""},q=[{label:"Every hour",value:"0 * * * *"},{label:"Every day at 8am",value:"0 8 * * *"},{label:"Every 2 hours",value:"0 */2 * * *"},{label:"Weekdays at 9am",value:"0 9 * * 1-5"}];function X({onClose:s,embedded:p=!1}){const[c,d]=a.useState([]),[o,g]=a.useState(!0),[m,x]=a.useState(""),[l,y]=a.useState(null),[u,w]=a.useState($),[r,v]=a.useState($),[h,M]=a.useState(!1),[f,S]=a.useState(!1),[k,E]=a.useState(new Set),n=a.useCallback(()=>{j.listCronJobs().then(d).catch(()=>{}).finally(()=>g(!1))},[]);a.useEffect(()=>{n();const t=setInterval(n,1e4);return()=>clearInterval(t)},[n]);async function C(){const t=r.name.trim(),i=r.prompt.trim();if(!t||!i)return;M(!0),x("");let N=r.schedule;!r.recurring&&r.oneTimeDate&&(N=new Date(r.oneTimeDate).toISOString());try{await j.createCronJob({name:t,prompt:i,schedule:N,recurring:r.recurring,backendType:r.backendType,model:r.model.trim()||void 0,cwd:r.cwd.trim()||void 0}),v($),S(!1),n()}catch(b){x(b instanceof Error?b.message:String(b))}finally{M(!1)}}function R(t){y(t.id),w({name:t.name,prompt:t.prompt,recurring:t.recurring,schedule:t.schedule,oneTimeDate:"",backendType:t.backendType,model:t.model,cwd:t.cwd}),x("")}function D(){y(null),x("")}async function L(){if(!l)return;const t=u.name.trim(),i=u.prompt.trim();if(!t||!i)return;let N=u.schedule;!u.recurring&&u.oneTimeDate&&(N=new Date(u.oneTimeDate).toISOString());try{await j.updateCronJob(l,{name:t,prompt:i,schedule:N,recurring:u.recurring,backendType:u.backendType,model:u.model.trim()||void 0,cwd:u.cwd.trim()||void 0}),y(null),x(""),n()}catch(b){x(b instanceof Error?b.message:String(b))}}async function A(t){try{await j.deleteCronJob(t),l===t&&y(null),n()}catch(i){x(i instanceof Error?i.message:String(i))}}async function I(t){try{await j.toggleCronJob(t),n()}catch(i){x(i instanceof Error?i.message:String(i))}}async function P(t){E(i=>new Set(i).add(t));try{await j.runCronJob(t),n()}catch(i){x(i instanceof Error?i.message:String(i))}finally{E(i=>{const N=new Set(i);return N.delete(t),N})}}if(p)return e.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto",children:e.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[e.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Scheduled Tasks"}),e.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Run autonomous Claude Code or Codex sessions on a schedule."})]})}),e.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[e.jsx("div",{className:"flex-1"}),e.jsxs("button",{onClick:()=>S(!f),className:`flex items-center gap-1.5 px-3.5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer shrink-0 ${f?"bg-cc-active text-cc-fg":"bg-cc-primary hover:bg-cc-primary-hover text-white"}`,children:[e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:f?e.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):e.jsx("path",{d:"M12 5v14M5 12h14"})}),e.jsx("span",{className:"hidden sm:inline",children:f?"Cancel":"New Task"})]})]}),f&&e.jsxs("div",{className:"mb-6 rounded-xl bg-cc-card p-4 sm:p-5 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[e.jsx(T,{form:r,onChange:v}),e.jsx("p",{className:"text-[10px] text-cc-muted",children:"Scheduled tasks run with full autonomy (bypassPermissions)"}),m&&f&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:m}),e.jsx("div",{className:"flex items-center justify-end pt-1",children:e.jsx("button",{onClick:C,disabled:!r.name.trim()||!r.prompt.trim()||h,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${r.name.trim()&&r.prompt.trim()&&!h?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:h?"Creating...":"Create"})})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:[e.jsxs("span",{children:[c.length," task",c.length!==1?"s":""]}),c.filter(t=>t.enabled).length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-cc-border",children:"·"}),e.jsxs("span",{children:[c.filter(t=>t.enabled).length," active"]})]})]}),o?e.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading scheduled tasks..."}):c.length===0?e.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No scheduled tasks yet."}):e.jsx("div",{className:"space-y-1",children:c.map(t=>l===t.id?e.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[e.jsx(T,{form:u,onChange:w}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:D,className:"px-3 py-2.5 min-h-[44px] text-sm rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"}),e.jsx("button",{onClick:()=>void L(),className:"px-4 py-2.5 min-h-[44px] text-sm rounded-lg font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Save"})]})]},t.id):e.jsx(G,{job:t,isRunning:k.has(t.id),onStartEdit:()=>R(t),onDelete:()=>void A(t.id),onToggle:()=>void I(t.id),onRunNow:()=>void P(t.id)},t.id))}),m&&!f&&e.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:m})]})});const O=m&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:m}),H=o?e.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading scheduled tasks..."}):c.length===0?e.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No scheduled tasks yet."}):e.jsx("div",{className:"space-y-3",children:c.map(t=>e.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1 truncate",children:t.name}),e.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${t.backendType==="codex"?"text-blue-500 bg-blue-500/10":"text-[#5BA8A0] bg-[#5BA8A0]/10"}`,children:t.backendType==="codex"?"Codex":"Claude"}),t.consecutiveFailures>0&&e.jsxs("span",{className:"text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 text-cc-error bg-cc-error/10",children:[t.consecutiveFailures," fail",t.consecutiveFailures!==1?"s":""]}),e.jsx("button",{onClick:()=>I(t.id),className:`relative w-10 h-6 rounded-full transition-colors cursor-pointer shrink-0 ${t.enabled?"bg-cc-primary":"bg-cc-border"}`,title:t.enabled?"Disable":"Enable",children:e.jsx("span",{className:`absolute top-[3px] w-[18px] h-[18px] rounded-full bg-white transition-transform ${t.enabled?"left-[19px]":"left-[3px]"}`})}),l===t.id?e.jsx("button",{onClick:D,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>P(t.id),disabled:k.has(t.id),className:`text-xs px-2 py-1.5 min-h-[44px] cursor-pointer ${k.has(t.id)?"text-cc-muted cursor-not-allowed":"text-cc-primary hover:text-cc-primary-hover"}`,children:k.has(t.id)?"Running...":"Run Now"}),e.jsx("button",{onClick:()=>R(t),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),e.jsx("button",{onClick:()=>A(t.id),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),l===t.id&&e.jsxs("div",{className:"px-3 py-3 space-y-2.5",children:[e.jsx(T,{form:u,onChange:w}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:L,className:"px-4 py-2.5 min-h-[44px] text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white rounded-lg transition-colors cursor-pointer",children:"Save"}),e.jsx("button",{onClick:D,className:"px-3 py-2.5 min-h-[44px] text-sm font-medium text-cc-muted hover:text-cc-fg rounded-lg transition-colors cursor-pointer",children:"Cancel"})]})]}),l!==t.id&&e.jsxs("div",{className:"px-3 py-2.5 space-y-1.5",children:[e.jsx("div",{className:"text-xs text-cc-muted truncate",title:t.prompt,children:t.prompt}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-cc-muted",children:[e.jsx("span",{children:F(t.schedule,t.recurring)}),t.nextRunAt!=null&&t.enabled&&e.jsxs("span",{children:["Next: ",J(t.nextRunAt)]}),t.lastRunAt!=null&&e.jsxs("span",{className:"flex items-center gap-1",children:["Last: ",z(t.lastRunAt),t.consecutiveFailures===0?e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success",children:e.jsx("path",{d:"M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2.5-2.5a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z"})}):e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-error",children:e.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})]}),t.totalRuns>0&&e.jsxs("span",{children:[t.totalRuns," run",t.totalRuns!==1?"s":""]}),t.cwd&&e.jsx("span",{className:"font-mono-code truncate max-w-[200px]",title:t.cwd,children:t.cwd})]})]})]},t.id))}),V=e.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[e.jsxs("button",{onClick:()=>S(!f),className:"w-full flex items-center gap-2 px-3 py-2.5 cursor-pointer hover:bg-cc-hover transition-colors",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`w-3 h-3 text-cc-muted transition-transform ${f?"rotate-90":""}`,children:e.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Scheduled Task"})]}),f&&e.jsxs("div",{className:"px-3 py-3 space-y-2.5",children:[e.jsx(T,{form:r,onChange:v}),e.jsx("div",{className:"text-[10px] text-cc-muted",children:"Scheduled tasks run with full autonomy (bypassPermissions)"}),e.jsx("button",{onClick:C,disabled:!r.name.trim()||!r.prompt.trim()||h,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${r.name.trim()&&r.prompt.trim()&&!h?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:h?"Creating...":"Create"})]})]}),Z=e.jsxs("div",{className:"w-full max-w-2xl max-h-[90dvh] sm:max-h-[80dvh] mx-0 sm:mx-4 flex flex-col bg-cc-bg rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Scheduled Tasks"}),e.jsx("p",{className:"text-xs text-cc-muted mt-0.5",children:"Run autonomous Claude Code or Codex sessions on a schedule"})]}),s&&e.jsx("button",{onClick:s,className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:e.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[O,H,V]})]});return _.createPortal(e.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:s,children:Z}),document.body)}function G({job:s,isRunning:p,onStartEdit:c,onDelete:d,onToggle:o,onRunNow:g}){return e.jsxs("div",{className:"group flex items-start gap-3 px-3 py-3 min-h-[44px] rounded-lg hover:bg-cc-hover/60 transition-colors",children:[e.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 6v6l4 2"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:s.name}),e.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${s.backendType==="codex"?"text-blue-500 bg-blue-500/10":"text-[#5BA8A0] bg-[#5BA8A0]/10"}`,children:s.backendType==="codex"?"Codex":"Claude"}),s.consecutiveFailures>0&&e.jsxs("span",{className:"text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 text-cc-error bg-cc-error/10",children:[s.consecutiveFailures," fail",s.consecutiveFailures!==1?"s":""]}),!s.enabled&&e.jsx("span",{className:"text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 text-cc-muted bg-cc-hover",children:"Paused"})]}),e.jsx("p",{className:"mt-0.5 text-xs text-cc-muted line-clamp-1 leading-relaxed",children:s.prompt}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5 mt-1 text-[11px] text-cc-muted",children:[e.jsx("span",{children:F(s.schedule,s.recurring)}),s.nextRunAt!=null&&s.enabled&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-cc-border",children:"·"}),e.jsxs("span",{children:["Next ",J(s.nextRunAt)]})]}),s.lastRunAt!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-cc-border",children:"·"}),e.jsxs("span",{className:"flex items-center gap-0.5",children:["Last ",z(s.lastRunAt),s.consecutiveFailures===0?e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-success",children:e.jsx("path",{d:"M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2.5-2.5a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z"})}):e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-error",children:e.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})]})]}),s.totalRuns>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-cc-border",children:"·"}),e.jsxs("span",{children:[s.totalRuns," run",s.totalRuns!==1?"s":""]})]})]})]}),e.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{onClick:o,className:`relative w-9 h-5 rounded-full transition-colors cursor-pointer shrink-0 ${s.enabled?"bg-cc-primary":"bg-cc-border"}`,title:s.enabled?"Disable":"Enable",children:e.jsx("span",{className:`absolute top-[2px] w-4 h-4 rounded-full bg-white transition-transform ${s.enabled?"left-[17px]":"left-[2px]"}`})}),e.jsx("button",{onClick:g,disabled:p,className:`p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md transition-colors cursor-pointer ${p?"text-cc-muted cursor-not-allowed":"text-cc-primary hover:bg-cc-primary/10"}`,"aria-label":"Run now",title:p?"Running...":"Run now",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"w-3.5 h-3.5",children:e.jsx("path",{d:"M8 5v14l11-7z"})})}),e.jsx("button",{onClick:c,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer","aria-label":"Edit",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[e.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),e.jsx("button",{onClick:d,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer","aria-label":"Delete",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:e.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14Z"})})})]})]})}function T({form:s,onChange:p}){const c=n=>p({...s,...n}),[d,o]=a.useState(null),[g,m]=a.useState(!1),x=a.useRef(null),[l,y]=a.useState(!1),[u,w]=a.useState(!1),r=a.useRef(null),v=d||K(s.backendType),h=v.find(n=>n.value===s.model)||v[0];a.useEffect(()=>{o(null),s.backendType==="codex"&&j.getBackendModels(s.backendType).then(n=>{if(n.length>0){const C=U(n);o(C),C.some(R=>R.value===s.model)||c({model:C[0].value})}}).catch(()=>{})},[s.backendType]),a.useEffect(()=>{s.model||c({model:B(s.backendType)})},[]);const M=a.useMemo(()=>[x],[]),f=a.useCallback(()=>m(!1),[]);W(M,f,g);const S=a.useMemo(()=>[r],[]),k=a.useCallback(()=>w(!1),[]);W(S,k,u);const E=s.cwd?s.cwd.split("/").pop()||s.cwd:"Select folder";return e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("input",{type:"text",value:s.name,onChange:n=>c({name:n.target.value}),placeholder:"Task name (e.g. Daily test suite)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),e.jsx("textarea",{value:s.prompt,onChange:n=>c({prompt:n.target.value}),placeholder:"Prompt for the session (e.g. Run the test suite and fix any failures)",rows:4,className:"w-full px-3 py-2.5 text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 resize-y transition-shadow",style:{minHeight:"100px"}}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{onClick:()=>c({recurring:!0}),className:`px-2.5 py-2 min-h-[44px] text-xs font-medium rounded-lg transition-colors cursor-pointer ${s.recurring?"bg-cc-primary text-white":"bg-cc-hover text-cc-muted hover:text-cc-fg"}`,children:"Recurring"}),e.jsx("button",{onClick:()=>c({recurring:!1}),className:`px-2.5 py-2 min-h-[44px] text-xs font-medium rounded-lg transition-colors cursor-pointer ${s.recurring?"bg-cc-hover text-cc-muted hover:text-cc-fg":"bg-cc-primary text-white"}`,children:"One-time"})]}),s.recurring?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"flex flex-wrap gap-1.5",children:q.map(n=>e.jsx("button",{onClick:()=>c({schedule:n.value}),className:`px-2.5 py-2 min-h-[44px] text-xs font-medium rounded-md transition-colors cursor-pointer ${s.schedule===n.value?"bg-cc-primary/20 text-cc-primary":"bg-cc-hover text-cc-muted hover:text-cc-fg"}`,children:n.label},n.value))}),e.jsx("input",{type:"text",value:s.schedule,onChange:n=>c({schedule:n.target.value}),placeholder:"Cron expression (e.g. 0 8 * * *)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),e.jsx("div",{className:"text-[10px] text-cc-muted",children:F(s.schedule,!0)})]}):e.jsx("input",{type:"datetime-local",value:s.oneTimeDate,onChange:n=>c({oneTimeDate:n.target.value}),className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsxs("div",{className:"relative",ref:r,children:[e.jsxs("button",{onClick:()=>w(!u),className:"flex items-center gap-1.5 px-2.5 py-2 min-h-[44px] text-xs font-medium text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[e.jsx("span",{children:s.backendType==="codex"?"Codex":"Claude Code"}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:e.jsx("path",{d:"M4 6l4 4 4-4"})})]}),u&&e.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card rounded-xl shadow-lg z-10 py-1",children:[{value:"claude",label:"Claude Code"},{value:"codex",label:"Codex"}].map(n=>e.jsx("button",{onClick:()=>{c({backendType:n.value,model:B(n.value)}),w(!1)},className:`w-full px-3 py-2.5 min-h-[44px] text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${n.value===s.backendType?"text-cc-primary font-medium":"text-cc-fg"}`,children:n.label},n.value))})]}),e.jsxs("div",{className:"relative",ref:x,children:[e.jsxs("button",{onClick:()=>m(!g),className:"flex items-center gap-1.5 px-2.5 py-2 min-h-[44px] text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[e.jsx("span",{children:h==null?void 0:h.icon}),e.jsx("span",{children:h==null?void 0:h.label}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:e.jsx("path",{d:"M4 6l4 4 4-4"})})]}),g&&e.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-52 bg-cc-card rounded-xl shadow-lg z-10 py-1",children:v.map(n=>e.jsxs("button",{onClick:()=>{c({model:n.value}),m(!1)},className:`w-full px-3 py-2.5 min-h-[44px] text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${n.value===s.model?"text-cc-primary font-medium":"text-cc-fg"}`,children:[e.jsx("span",{children:n.icon}),n.label]},n.value))})]}),e.jsxs("button",{onClick:()=>y(!0),className:"flex items-center gap-1.5 px-2.5 py-2 min-h-[44px] text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-60",children:e.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),e.jsx("span",{className:"max-w-[200px] truncate font-mono-code",children:E}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:e.jsx("path",{d:"M4 6l4 4 4-4"})})]}),l&&e.jsx(Y,{initialPath:s.cwd||"",onSelect:n=>c({cwd:n}),onClose:()=>y(!1)})]})]})}export{X as CronManager};
|
|
@@ -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-CnVoJw43.js";import{d as P,t as D,M as E}from"./MagicUIDashboard-j4axrj9-.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};
|