heyhank 0.1.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/README.md +40 -0
- package/bin/cli.ts +168 -0
- package/bin/ctl.ts +528 -0
- package/bin/generate-token.ts +28 -0
- package/dist/apple-touch-icon.png +0 -0
- package/dist/assets/AgentsPage-BPhirnCe.js +7 -0
- package/dist/assets/AssistantPage-DJ-cMQfb.js +1 -0
- package/dist/assets/CronManager-DDbz-yiT.js +1 -0
- package/dist/assets/HelpPage-DMfkzERp.js +1 -0
- package/dist/assets/IntegrationsPage-CrOitCmJ.js +1 -0
- package/dist/assets/MediaPage-CE5rdvkC.js +1 -0
- package/dist/assets/PlatformDashboard-Do6F0O2p.js +1 -0
- package/dist/assets/Playground-Fc5cdc5p.js +109 -0
- package/dist/assets/ProcessPanel-CslEiZkI.js +2 -0
- package/dist/assets/PromptsPage-D2EhsdNO.js +4 -0
- package/dist/assets/RunsPage-C5BZF5Rx.js +1 -0
- package/dist/assets/SandboxManager-a1AVI5q2.js +8 -0
- package/dist/assets/SettingsPage-DirhjQrJ.js +51 -0
- package/dist/assets/SocialMediaPage-DBuM28vD.js +1 -0
- package/dist/assets/TailscalePage-CHiFhZXF.js +1 -0
- package/dist/assets/TelephonyPage-x0VV0fOo.js +1 -0
- package/dist/assets/TerminalPage-Drwyrnfd.js +1 -0
- package/dist/assets/gemini-audio-t-TSU-To.js +17 -0
- package/dist/assets/gemini-live-client-C7rqAW7G.js +166 -0
- package/dist/assets/index-C8M_PUmX.css +32 -0
- package/dist/assets/index-CEqZnThB.js +204 -0
- package/dist/assets/sw-register-LSSpj6RU.js +1 -0
- package/dist/assets/time-ago-B6r_l9u1.js +1 -0
- package/dist/assets/workbox-window.prod.es5-BIl4cyR9.js +2 -0
- package/dist/favicon-32-original.png +0 -0
- package/dist/favicon-32.png +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/favicon.svg +8 -0
- package/dist/fonts/MesloLGSNerdFontMono-Bold.woff2 +0 -0
- package/dist/fonts/MesloLGSNerdFontMono-Regular.woff2 +0 -0
- package/dist/heyhank-mascot-poster.png +0 -0
- package/dist/heyhank-mascot.mp4 +0 -0
- package/dist/heyhank-mascot.webm +0 -0
- package/dist/icon-192-original.png +0 -0
- package/dist/icon-192.png +0 -0
- package/dist/icon-512-original.png +0 -0
- package/dist/icon-512.png +0 -0
- package/dist/index.html +21 -0
- package/dist/logo-192.png +0 -0
- package/dist/logo-512.png +0 -0
- package/dist/logo-codex.svg +14 -0
- package/dist/logo-docker.svg +4 -0
- package/dist/logo-original.png +0 -0
- package/dist/logo.png +0 -0
- package/dist/logo.svg +14 -0
- package/dist/manifest.json +24 -0
- package/dist/push-sw.js +34 -0
- package/dist/sw.js +1 -0
- package/dist/workbox-d2a0910a.js +1 -0
- package/package.json +109 -0
- package/server/agent-cron-migrator.ts +85 -0
- package/server/agent-executor.ts +357 -0
- package/server/agent-store.ts +185 -0
- package/server/agent-timeout.ts +107 -0
- package/server/agent-types.ts +122 -0
- package/server/ai-validation-settings.ts +37 -0
- package/server/ai-validator.ts +181 -0
- package/server/anthropic-provider-migration.ts +48 -0
- package/server/assistant-store.ts +272 -0
- package/server/auth-manager.ts +150 -0
- package/server/auto-approve.ts +153 -0
- package/server/auto-namer.ts +36 -0
- package/server/backend-adapter.ts +54 -0
- package/server/cache-headers.ts +61 -0
- package/server/calendar-service.ts +434 -0
- package/server/claude-adapter.ts +889 -0
- package/server/claude-container-auth.ts +30 -0
- package/server/claude-session-discovery.ts +157 -0
- package/server/claude-session-history.ts +410 -0
- package/server/cli-launcher.ts +1303 -0
- package/server/codex-adapter.ts +3027 -0
- package/server/codex-container-auth.ts +24 -0
- package/server/codex-home.ts +27 -0
- package/server/codex-ws-proxy.cjs +226 -0
- package/server/commands-discovery.ts +81 -0
- package/server/constants.ts +7 -0
- package/server/container-manager.ts +1053 -0
- package/server/cost-tracker.ts +222 -0
- package/server/cron-scheduler.ts +243 -0
- package/server/cron-store.ts +148 -0
- package/server/cron-types.ts +63 -0
- package/server/email-service.ts +354 -0
- package/server/env-manager.ts +161 -0
- package/server/event-bus-types.ts +75 -0
- package/server/event-bus.ts +124 -0
- package/server/execution-store.ts +170 -0
- package/server/federation/node-connection.ts +190 -0
- package/server/federation/node-manager.ts +366 -0
- package/server/federation/node-store.ts +86 -0
- package/server/federation/node-types.ts +121 -0
- package/server/fs-utils.ts +15 -0
- package/server/git-utils.ts +421 -0
- package/server/github-pr.ts +379 -0
- package/server/google-media.ts +342 -0
- package/server/image-pull-manager.ts +279 -0
- package/server/index.ts +491 -0
- package/server/internal-ai.ts +237 -0
- package/server/kill-switch.ts +99 -0
- package/server/llm-providers.ts +342 -0
- package/server/logger.ts +259 -0
- package/server/mcp-registry.ts +401 -0
- package/server/message-bus.ts +271 -0
- package/server/message-delivery.ts +128 -0
- package/server/metrics-collector.ts +350 -0
- package/server/metrics-types.ts +108 -0
- package/server/middleware/managed-auth.ts +195 -0
- package/server/novnc-proxy.ts +99 -0
- package/server/path-resolver.ts +186 -0
- package/server/paths.ts +13 -0
- package/server/pr-poller.ts +162 -0
- package/server/prompt-manager.ts +211 -0
- package/server/protocol/claude-upstream/README.md +19 -0
- package/server/protocol/claude-upstream/sdk.d.ts.txt +1943 -0
- package/server/protocol/codex-upstream/ClientNotification.ts.txt +5 -0
- package/server/protocol/codex-upstream/ClientRequest.ts.txt +60 -0
- package/server/protocol/codex-upstream/README.md +18 -0
- package/server/protocol/codex-upstream/ServerNotification.ts.txt +41 -0
- package/server/protocol/codex-upstream/ServerRequest.ts.txt +16 -0
- package/server/protocol/codex-upstream/v2/DynamicToolCallParams.ts.txt +6 -0
- package/server/protocol/codex-upstream/v2/DynamicToolCallResponse.ts.txt +6 -0
- package/server/protocol-monitor.ts +50 -0
- package/server/provider-manager.ts +111 -0
- package/server/provider-registry.ts +393 -0
- package/server/push-notifications.ts +221 -0
- package/server/recorder.ts +374 -0
- package/server/recording-hub/compat-validator.ts +284 -0
- package/server/recording-hub/diagnostics.ts +299 -0
- package/server/recording-hub/hub-config.ts +19 -0
- package/server/recording-hub/hub-routes.ts +236 -0
- package/server/recording-hub/hub-store.ts +265 -0
- package/server/recording-hub/replay-adapter.ts +207 -0
- package/server/relay-client.ts +320 -0
- package/server/reminder-scheduler.ts +38 -0
- package/server/replay.ts +78 -0
- package/server/routes/agent-routes.ts +264 -0
- package/server/routes/assistant-routes.ts +90 -0
- package/server/routes/cron-routes.ts +103 -0
- package/server/routes/env-routes.ts +95 -0
- package/server/routes/federation-routes.ts +76 -0
- package/server/routes/fs-routes.ts +622 -0
- package/server/routes/git-routes.ts +97 -0
- package/server/routes/llm-routes.ts +166 -0
- package/server/routes/media-routes.ts +135 -0
- package/server/routes/metrics-routes.ts +13 -0
- package/server/routes/platform-routes.ts +1379 -0
- package/server/routes/prompt-routes.ts +67 -0
- package/server/routes/provider-routes.ts +109 -0
- package/server/routes/sandbox-routes.ts +127 -0
- package/server/routes/settings-routes.ts +285 -0
- package/server/routes/skills-routes.ts +100 -0
- package/server/routes/socialmedia-routes.ts +208 -0
- package/server/routes/system-routes.ts +228 -0
- package/server/routes/tailscale-routes.ts +22 -0
- package/server/routes/telephony-routes.ts +259 -0
- package/server/routes.ts +1379 -0
- package/server/sandbox-manager.ts +168 -0
- package/server/service.ts +718 -0
- package/server/session-creation-service.ts +457 -0
- package/server/session-git-info.ts +104 -0
- package/server/session-names.ts +67 -0
- package/server/session-orchestrator.ts +824 -0
- package/server/session-state-machine.ts +207 -0
- package/server/session-store.ts +146 -0
- package/server/session-types.ts +511 -0
- package/server/settings-manager.ts +149 -0
- package/server/shared-context.ts +157 -0
- package/server/socialmedia/adapter.ts +15 -0
- package/server/socialmedia/adapters/ayrshare-adapter.ts +169 -0
- package/server/socialmedia/adapters/buffer-adapter.ts +299 -0
- package/server/socialmedia/adapters/postiz-adapter.ts +298 -0
- package/server/socialmedia/manager.ts +227 -0
- package/server/socialmedia/store.ts +98 -0
- package/server/socialmedia/types.ts +89 -0
- package/server/tailscale-manager.ts +451 -0
- package/server/telephony/audio-bridge.ts +331 -0
- package/server/telephony/call-manager.ts +457 -0
- package/server/telephony/call-types.ts +108 -0
- package/server/telephony/telephony-store.ts +119 -0
- package/server/terminal-manager.ts +240 -0
- package/server/update-checker.ts +192 -0
- package/server/usage-limits.ts +225 -0
- package/server/web-push.d.ts +51 -0
- package/server/worktree-tracker.ts +84 -0
- package/server/ws-auth.ts +41 -0
- package/server/ws-bridge-browser-ingest.ts +72 -0
- package/server/ws-bridge-browser.ts +112 -0
- package/server/ws-bridge-cli-ingest.ts +81 -0
- package/server/ws-bridge-codex.ts +266 -0
- package/server/ws-bridge-controls.ts +20 -0
- package/server/ws-bridge-persist.ts +66 -0
- package/server/ws-bridge-publish.ts +79 -0
- package/server/ws-bridge-replay.ts +61 -0
- package/server/ws-bridge-types.ts +121 -0
- package/server/ws-bridge.ts +1240 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
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
|
+
import type { FuzzyFileSearchParams } from "./FuzzyFileSearchParams";
|
|
10
|
+
import type { GetAuthStatusParams } from "./GetAuthStatusParams";
|
|
11
|
+
import type { GetConversationSummaryParams } from "./GetConversationSummaryParams";
|
|
12
|
+
import type { GitDiffToRemoteParams } from "./GitDiffToRemoteParams";
|
|
13
|
+
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
|
+
import type { RequestId } from "./RequestId";
|
|
20
|
+
import type { ResumeConversationParams } from "./ResumeConversationParams";
|
|
21
|
+
import type { SendUserMessageParams } from "./SendUserMessageParams";
|
|
22
|
+
import type { SendUserTurnParams } from "./SendUserTurnParams";
|
|
23
|
+
import type { SetDefaultModelParams } from "./SetDefaultModelParams";
|
|
24
|
+
import type { AppsListParams } from "./v2/AppsListParams";
|
|
25
|
+
import type { CancelLoginAccountParams } from "./v2/CancelLoginAccountParams";
|
|
26
|
+
import type { CommandExecParams } from "./v2/CommandExecParams";
|
|
27
|
+
import type { ConfigBatchWriteParams } from "./v2/ConfigBatchWriteParams";
|
|
28
|
+
import type { ConfigReadParams } from "./v2/ConfigReadParams";
|
|
29
|
+
import type { ConfigValueWriteParams } from "./v2/ConfigValueWriteParams";
|
|
30
|
+
import type { ExperimentalFeatureListParams } from "./v2/ExperimentalFeatureListParams";
|
|
31
|
+
import type { FeedbackUploadParams } from "./v2/FeedbackUploadParams";
|
|
32
|
+
import type { GetAccountParams } from "./v2/GetAccountParams";
|
|
33
|
+
import type { ListMcpServerStatusParams } from "./v2/ListMcpServerStatusParams";
|
|
34
|
+
import type { LoginAccountParams } from "./v2/LoginAccountParams";
|
|
35
|
+
import type { McpServerOauthLoginParams } from "./v2/McpServerOauthLoginParams";
|
|
36
|
+
import type { ModelListParams } from "./v2/ModelListParams";
|
|
37
|
+
import type { ReviewStartParams } from "./v2/ReviewStartParams";
|
|
38
|
+
import type { SkillsConfigWriteParams } from "./v2/SkillsConfigWriteParams";
|
|
39
|
+
import type { SkillsListParams } from "./v2/SkillsListParams";
|
|
40
|
+
import type { SkillsRemoteReadParams } from "./v2/SkillsRemoteReadParams";
|
|
41
|
+
import type { SkillsRemoteWriteParams } from "./v2/SkillsRemoteWriteParams";
|
|
42
|
+
import type { ThreadArchiveParams } from "./v2/ThreadArchiveParams";
|
|
43
|
+
import type { ThreadCompactStartParams } from "./v2/ThreadCompactStartParams";
|
|
44
|
+
import type { ThreadForkParams } from "./v2/ThreadForkParams";
|
|
45
|
+
import type { ThreadListParams } from "./v2/ThreadListParams";
|
|
46
|
+
import type { ThreadLoadedListParams } from "./v2/ThreadLoadedListParams";
|
|
47
|
+
import type { ThreadReadParams } from "./v2/ThreadReadParams";
|
|
48
|
+
import type { ThreadResumeParams } from "./v2/ThreadResumeParams";
|
|
49
|
+
import type { ThreadRollbackParams } from "./v2/ThreadRollbackParams";
|
|
50
|
+
import type { ThreadSetNameParams } from "./v2/ThreadSetNameParams";
|
|
51
|
+
import type { ThreadStartParams } from "./v2/ThreadStartParams";
|
|
52
|
+
import type { ThreadUnarchiveParams } from "./v2/ThreadUnarchiveParams";
|
|
53
|
+
import type { TurnInterruptParams } from "./v2/TurnInterruptParams";
|
|
54
|
+
import type { TurnStartParams } from "./v2/TurnStartParams";
|
|
55
|
+
import type { TurnSteerParams } from "./v2/TurnSteerParams";
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Request from the client to the server.
|
|
59
|
+
*/
|
|
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/remote/read", id: RequestId, params: SkillsRemoteReadParams, } | { "method": "skills/remote/write", id: RequestId, params: SkillsRemoteWriteParams, } | { "method": "app/list", id: RequestId, params: AppsListParams, } | { "method": "skills/config/write", id: RequestId, params: SkillsConfigWriteParams, } | { "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": "experimentalFeature/list", id: RequestId, params: ExperimentalFeatureListParams, } | { "method": "mcpServer/oauth/login", id: RequestId, params: McpServerOauthLoginParams, } | { "method": "config/mcpServer/reload", id: RequestId, params: undefined, } | { "method": "mcpServerStatus/list", id: RequestId, params: ListMcpServerStatusParams, } | { "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: undefined, } | { "method": "feedback/upload", id: RequestId, params: FeedbackUploadParams, } | { "method": "command/exec", id: RequestId, params: CommandExecParams, } | { "method": "config/read", id: RequestId, params: ConfigReadParams, } | { "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": "newConversation", id: RequestId, params: NewConversationParams, } | { "method": "getConversationSummary", id: RequestId, params: GetConversationSummaryParams, } | { "method": "listConversations", id: RequestId, params: ListConversationsParams, } | { "method": "resumeConversation", id: RequestId, params: ResumeConversationParams, } | { "method": "forkConversation", id: RequestId, params: ForkConversationParams, } | { "method": "archiveConversation", id: RequestId, params: ArchiveConversationParams, } | { "method": "sendUserMessage", id: RequestId, params: SendUserMessageParams, } | { "method": "sendUserTurn", id: RequestId, params: SendUserTurnParams, } | { "method": "interruptConversation", id: RequestId, params: InterruptConversationParams, } | { "method": "addConversationListener", id: RequestId, params: AddConversationListenerParams, } | { "method": "removeConversationListener", id: RequestId, params: RemoveConversationListenerParams, } | { "method": "gitDiffToRemote", id: RequestId, params: GitDiffToRemoteParams, } | { "method": "loginApiKey", id: RequestId, params: LoginApiKeyParams, } | { "method": "loginChatGpt", id: RequestId, params: undefined, } | { "method": "cancelLoginChatGpt", id: RequestId, params: CancelLoginChatGptParams, } | { "method": "logoutChatGpt", id: RequestId, params: undefined, } | { "method": "getAuthStatus", id: RequestId, params: GetAuthStatusParams, } | { "method": "getUserSavedConfig", id: RequestId, params: undefined, } | { "method": "setDefaultModel", id: RequestId, params: SetDefaultModelParams, } | { "method": "getUserAgent", id: RequestId, params: undefined, } | { "method": "userInfo", id: RequestId, params: undefined, } | { "method": "fuzzyFileSearch", id: RequestId, params: FuzzyFileSearchParams, } | { "method": "execOneOffCommand", id: RequestId, params: ExecOneOffCommandParams, };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Codex protocol snapshot used by offline compatibility tests.
|
|
2
|
+
|
|
3
|
+
Source repository: `https://github.com/openai/codex`
|
|
4
|
+
Source commit: `e5e40e2d4b2b815b1d3af9b866aff97002356c8d`
|
|
5
|
+
|
|
6
|
+
Copied files (stored as `.txt` snapshots to avoid TypeScript import resolution in this repo):
|
|
7
|
+
- `codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts` -> `ClientRequest.ts.txt`
|
|
8
|
+
- `codex-rs/app-server-protocol/schema/typescript/ServerRequest.ts` -> `ServerRequest.ts.txt`
|
|
9
|
+
- `codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts` -> `ServerNotification.ts.txt`
|
|
10
|
+
- `codex-rs/app-server-protocol/schema/typescript/ClientNotification.ts` -> `ClientNotification.ts.txt`
|
|
11
|
+
- `codex-rs/app-server-protocol/schema/typescript/v2/DynamicToolCallParams.ts` -> `v2/DynamicToolCallParams.ts.txt`
|
|
12
|
+
- `codex-rs/app-server-protocol/schema/typescript/v2/DynamicToolCallResponse.ts` -> `v2/DynamicToolCallResponse.ts.txt`
|
|
13
|
+
|
|
14
|
+
Refresh these files with:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
./scripts/sync-codex-protocol.sh
|
|
18
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { AuthStatusChangeNotification } from "./AuthStatusChangeNotification";
|
|
5
|
+
import type { FuzzyFileSearchSessionUpdatedNotification } from "./FuzzyFileSearchSessionUpdatedNotification";
|
|
6
|
+
import type { LoginChatGptCompleteNotification } from "./LoginChatGptCompleteNotification";
|
|
7
|
+
import type { SessionConfiguredNotification } from "./SessionConfiguredNotification";
|
|
8
|
+
import type { AccountLoginCompletedNotification } from "./v2/AccountLoginCompletedNotification";
|
|
9
|
+
import type { AccountRateLimitsUpdatedNotification } from "./v2/AccountRateLimitsUpdatedNotification";
|
|
10
|
+
import type { AccountUpdatedNotification } from "./v2/AccountUpdatedNotification";
|
|
11
|
+
import type { AgentMessageDeltaNotification } from "./v2/AgentMessageDeltaNotification";
|
|
12
|
+
import type { AppListUpdatedNotification } from "./v2/AppListUpdatedNotification";
|
|
13
|
+
import type { CommandExecutionOutputDeltaNotification } from "./v2/CommandExecutionOutputDeltaNotification";
|
|
14
|
+
import type { ConfigWarningNotification } from "./v2/ConfigWarningNotification";
|
|
15
|
+
import type { ContextCompactedNotification } from "./v2/ContextCompactedNotification";
|
|
16
|
+
import type { DeprecationNoticeNotification } from "./v2/DeprecationNoticeNotification";
|
|
17
|
+
import type { ErrorNotification } from "./v2/ErrorNotification";
|
|
18
|
+
import type { FileChangeOutputDeltaNotification } from "./v2/FileChangeOutputDeltaNotification";
|
|
19
|
+
import type { ItemCompletedNotification } from "./v2/ItemCompletedNotification";
|
|
20
|
+
import type { ItemStartedNotification } from "./v2/ItemStartedNotification";
|
|
21
|
+
import type { McpServerOauthLoginCompletedNotification } from "./v2/McpServerOauthLoginCompletedNotification";
|
|
22
|
+
import type { McpToolCallProgressNotification } from "./v2/McpToolCallProgressNotification";
|
|
23
|
+
import type { PlanDeltaNotification } from "./v2/PlanDeltaNotification";
|
|
24
|
+
import type { RawResponseItemCompletedNotification } from "./v2/RawResponseItemCompletedNotification";
|
|
25
|
+
import type { ReasoningSummaryPartAddedNotification } from "./v2/ReasoningSummaryPartAddedNotification";
|
|
26
|
+
import type { ReasoningSummaryTextDeltaNotification } from "./v2/ReasoningSummaryTextDeltaNotification";
|
|
27
|
+
import type { ReasoningTextDeltaNotification } from "./v2/ReasoningTextDeltaNotification";
|
|
28
|
+
import type { TerminalInteractionNotification } from "./v2/TerminalInteractionNotification";
|
|
29
|
+
import type { ThreadNameUpdatedNotification } from "./v2/ThreadNameUpdatedNotification";
|
|
30
|
+
import type { ThreadStartedNotification } from "./v2/ThreadStartedNotification";
|
|
31
|
+
import type { ThreadTokenUsageUpdatedNotification } from "./v2/ThreadTokenUsageUpdatedNotification";
|
|
32
|
+
import type { TurnCompletedNotification } from "./v2/TurnCompletedNotification";
|
|
33
|
+
import type { TurnDiffUpdatedNotification } from "./v2/TurnDiffUpdatedNotification";
|
|
34
|
+
import type { TurnPlanUpdatedNotification } from "./v2/TurnPlanUpdatedNotification";
|
|
35
|
+
import type { TurnStartedNotification } from "./v2/TurnStartedNotification";
|
|
36
|
+
import type { WindowsWorldWritableWarningNotification } from "./v2/WindowsWorldWritableWarningNotification";
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Notification sent from the server to the client.
|
|
40
|
+
*/
|
|
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": "windows/worldWritableWarning", "params": WindowsWorldWritableWarningNotification } | { "method": "account/login/completed", "params": AccountLoginCompletedNotification } | { "method": "authStatusChange", "params": AuthStatusChangeNotification } | { "method": "loginChatGptComplete", "params": LoginChatGptCompleteNotification } | { "method": "sessionConfigured", "params": SessionConfiguredNotification };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { ApplyPatchApprovalParams } from "./ApplyPatchApprovalParams";
|
|
5
|
+
import type { ExecCommandApprovalParams } from "./ExecCommandApprovalParams";
|
|
6
|
+
import type { RequestId } from "./RequestId";
|
|
7
|
+
import type { ChatgptAuthTokensRefreshParams } from "./v2/ChatgptAuthTokensRefreshParams";
|
|
8
|
+
import type { CommandExecutionRequestApprovalParams } from "./v2/CommandExecutionRequestApprovalParams";
|
|
9
|
+
import type { DynamicToolCallParams } from "./v2/DynamicToolCallParams";
|
|
10
|
+
import type { FileChangeRequestApprovalParams } from "./v2/FileChangeRequestApprovalParams";
|
|
11
|
+
import type { ToolRequestUserInputParams } from "./v2/ToolRequestUserInputParams";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Request initiated from the server and sent to the client.
|
|
15
|
+
*/
|
|
16
|
+
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": "item/tool/call", id: RequestId, params: DynamicToolCallParams, } | { "method": "account/chatgptAuthTokens/refresh", id: RequestId, params: ChatgptAuthTokensRefreshParams, } | { "method": "applyPatchApproval", id: RequestId, params: ApplyPatchApprovalParams, } | { "method": "execCommandApproval", id: RequestId, params: ExecCommandApprovalParams, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { JsonValue } from "../serde_json/JsonValue";
|
|
5
|
+
|
|
6
|
+
export type DynamicToolCallParams = { threadId: string, turnId: string, callId: string, tool: string, arguments: JsonValue, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
|
2
|
+
|
|
3
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
4
|
+
import type { DynamicToolCallOutputContentItem } from "./DynamicToolCallOutputContentItem";
|
|
5
|
+
|
|
6
|
+
export type DynamicToolCallResponse = { contentItems: Array<DynamicToolCallOutputContentItem>, success: boolean, };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { log } from "./logger.js";
|
|
2
|
+
|
|
3
|
+
type BackendName = "claude" | "codex";
|
|
4
|
+
type Direction = "incoming" | "outgoing";
|
|
5
|
+
type MessageKind = "message" | "notification" | "request" | "parse_error";
|
|
6
|
+
|
|
7
|
+
interface ProtocolDriftOptions {
|
|
8
|
+
backend: BackendName;
|
|
9
|
+
sessionId: string;
|
|
10
|
+
direction: Direction;
|
|
11
|
+
messageKind: MessageKind;
|
|
12
|
+
messageName: string;
|
|
13
|
+
keys?: string[];
|
|
14
|
+
rawPreview?: string;
|
|
15
|
+
blockedForSafety?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function truncate(value: string, max = 240): string {
|
|
19
|
+
return value.length > max ? `${value.slice(0, max)}...` : value;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function reportProtocolDrift(
|
|
23
|
+
seen: Set<string>,
|
|
24
|
+
options: ProtocolDriftOptions,
|
|
25
|
+
emitError?: (message: string) => void,
|
|
26
|
+
): void {
|
|
27
|
+
const dedupeKey = [
|
|
28
|
+
options.backend,
|
|
29
|
+
options.direction,
|
|
30
|
+
options.messageKind,
|
|
31
|
+
options.messageName,
|
|
32
|
+
].join(":");
|
|
33
|
+
if (seen.has(dedupeKey)) return;
|
|
34
|
+
seen.add(dedupeKey);
|
|
35
|
+
|
|
36
|
+
log.warn("protocol-monitor", "Backend protocol drift detected", {
|
|
37
|
+
backend: options.backend,
|
|
38
|
+
sessionId: options.sessionId,
|
|
39
|
+
direction: options.direction,
|
|
40
|
+
messageKind: options.messageKind,
|
|
41
|
+
messageName: options.messageName,
|
|
42
|
+
keys: options.keys,
|
|
43
|
+
rawPreview: options.rawPreview ? truncate(options.rawPreview) : undefined,
|
|
44
|
+
blockedForSafety: options.blockedForSafety,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
emitError?.(
|
|
48
|
+
`${options.backend === "codex" ? "Codex" : "Claude"} protocol drift: unsupported ${options.direction} ${options.messageKind} "${options.messageName}". HeyHank may need an update.`,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider config storage — persists user's provider credentials to ~/.heyhank/providers.json
|
|
3
|
+
*/
|
|
4
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { homedir } from "node:os";
|
|
7
|
+
import { getProviderById } from "./provider-registry.js";
|
|
8
|
+
|
|
9
|
+
export interface ProviderConfig {
|
|
10
|
+
providerId: string;
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
envValues: Record<string, string>;
|
|
13
|
+
customModel?: string;
|
|
14
|
+
createdAt: number;
|
|
15
|
+
updatedAt: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const DATA_DIR = join(homedir(), ".heyhank");
|
|
19
|
+
const PROVIDERS_FILE = join(DATA_DIR, "providers.json");
|
|
20
|
+
|
|
21
|
+
function ensureDir(): void {
|
|
22
|
+
if (!existsSync(DATA_DIR)) mkdirSync(DATA_DIR, { recursive: true });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function readAll(): ProviderConfig[] {
|
|
26
|
+
if (!existsSync(PROVIDERS_FILE)) return [];
|
|
27
|
+
try {
|
|
28
|
+
const raw = readFileSync(PROVIDERS_FILE, "utf-8");
|
|
29
|
+
const data = JSON.parse(raw);
|
|
30
|
+
return Array.isArray(data) ? data : [];
|
|
31
|
+
} catch {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function writeAll(configs: ProviderConfig[]): void {
|
|
37
|
+
ensureDir();
|
|
38
|
+
writeFileSync(PROVIDERS_FILE, JSON.stringify(configs, null, 2), { mode: 0o600 });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function listProviderConfigs(): ProviderConfig[] {
|
|
42
|
+
return readAll();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function getProviderConfig(providerId: string): ProviderConfig | null {
|
|
46
|
+
return readAll().find((c) => c.providerId === providerId) ?? null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function upsertProviderConfig(
|
|
50
|
+
providerId: string,
|
|
51
|
+
patch: { enabled?: boolean; envValues?: Record<string, string>; customModel?: string },
|
|
52
|
+
): ProviderConfig {
|
|
53
|
+
const def = getProviderById(providerId);
|
|
54
|
+
if (!def) throw new Error(`Unknown provider: ${providerId}`);
|
|
55
|
+
|
|
56
|
+
const configs = readAll();
|
|
57
|
+
const idx = configs.findIndex((c) => c.providerId === providerId);
|
|
58
|
+
const now = Date.now();
|
|
59
|
+
|
|
60
|
+
if (idx >= 0) {
|
|
61
|
+
const existing = configs[idx];
|
|
62
|
+
configs[idx] = {
|
|
63
|
+
...existing,
|
|
64
|
+
enabled: patch.enabled ?? existing.enabled,
|
|
65
|
+
envValues: patch.envValues ? { ...existing.envValues, ...patch.envValues } : existing.envValues,
|
|
66
|
+
customModel: patch.customModel !== undefined ? patch.customModel : existing.customModel,
|
|
67
|
+
updatedAt: now,
|
|
68
|
+
};
|
|
69
|
+
writeAll(configs);
|
|
70
|
+
return configs[idx];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const newConfig: ProviderConfig = {
|
|
74
|
+
providerId,
|
|
75
|
+
enabled: patch.enabled ?? true,
|
|
76
|
+
envValues: patch.envValues ?? {},
|
|
77
|
+
customModel: patch.customModel,
|
|
78
|
+
createdAt: now,
|
|
79
|
+
updatedAt: now,
|
|
80
|
+
};
|
|
81
|
+
configs.push(newConfig);
|
|
82
|
+
writeAll(configs);
|
|
83
|
+
return newConfig;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function deleteProviderConfig(providerId: string): boolean {
|
|
87
|
+
const configs = readAll();
|
|
88
|
+
const filtered = configs.filter((c) => c.providerId !== providerId);
|
|
89
|
+
if (filtered.length === configs.length) return false;
|
|
90
|
+
writeAll(filtered);
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function getProviderEnvVars(providerId: string): Record<string, string> | null {
|
|
95
|
+
const config = getProviderConfig(providerId);
|
|
96
|
+
if (!config || !config.enabled) return null;
|
|
97
|
+
|
|
98
|
+
const def = getProviderById(providerId);
|
|
99
|
+
if (!def) return null;
|
|
100
|
+
|
|
101
|
+
const env: Record<string, string> = {};
|
|
102
|
+
for (const field of def.envFields) {
|
|
103
|
+
const val = config.envValues[field.key];
|
|
104
|
+
if (val) env[field.key] = val;
|
|
105
|
+
}
|
|
106
|
+
return Object.keys(env).length > 0 ? env : null;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function getEnabledProviders(): ProviderConfig[] {
|
|
110
|
+
return readAll().filter((c) => c.enabled);
|
|
111
|
+
}
|