@hasna/switcher 0.1.8 → 0.1.9

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 CHANGED
@@ -47,6 +47,139 @@ switcher --help
47
47
  switcher doctor
48
48
  ```
49
49
 
50
+ ## ChatGPT desktop with a provider
51
+
52
+ From 0.1.9, use the installed macOS ChatGPT app with a selected provider and model:
53
+
54
+ ```sh
55
+ switcher launch chatgpt --provider deepseek --model deepseek-flash
56
+ switcher launch chatgpt --provider openrouter --model anthropic/claude-sonnet-4.6
57
+ switcher launch chatgpt --provider my-provider --model my-model
58
+ switcher launch chatgpt --provider deepseek --model deepseek-flash --dry-run
59
+ switcher launch chatgpt --provider deepseek --model deepseek-flash --reasoning max \
60
+ --dangerously-bypass-approvals-and-sandbox
61
+ ```
62
+
63
+ This runs **local Codex conversations inside the unified ChatGPT app** through
64
+ Switcher's provider gateway. ChatGPT cloud Chat/Work, Preview Edit and other
65
+ account-only features use their own service and are outside this routing path.
66
+ The classic ChatGPT app (`com.openai.chat`) cannot use this launcher. The current
67
+ unified ChatGPT app and its former Codex name (`com.openai.codex`) are supported;
68
+ the bundled Codex runtime must meet the Codex CLI minimum above.
69
+
70
+ Providers must support the Responses protocol and the selected model's tool
71
+ calling. DeepSeek, OpenRouter, OpenAI and other Responses-compatible presets
72
+ use the same provider/model catalog and credential bindings as terminal Codex.
73
+ Use `switcher models PROVIDER` to find exact model IDs. Custom providers can be
74
+ registered with `switcher providers add NAME --url URL --protocol openai-responses`.
75
+ There is no automatic conversion from Chat Completions or Anthropic Messages.
76
+
77
+ For third-party Responses endpoints, Switcher converts the desktop's unpaired
78
+ `codex_app` task-message outputs to ordinary user input, preserving their full
79
+ text and images. This supports creating a task and sending follow-up messages
80
+ without the missing-`call_id` errors from strict providers. Paired tool results
81
+ keep their original format; OpenAI's own endpoint receives native messages.
82
+
83
+ `--reasoning EFFORT` sets the initial effort (also supported for direct terminal
84
+ Codex launches). DeepSeek's picker exposes none, low, high and max; its Responses
85
+ API maps minimal to low and medium/xhigh to high. Other models can declare an
86
+ exact `reasoningEfforts` array through `models add/update --file FILE`. An explicit
87
+ effort also enables that choice for models whose catalog omits effort metadata;
88
+ the provider must support it. The app can change effort per conversation, and
89
+ routing events record the value actually sent upstream.
90
+
91
+ `--dangerously-bypass-approvals-and-sandbox` explicitly selects full access:
92
+ commands can edit files and use the network without approval prompts or a
93
+ sandbox. Without that flag, desktop launches start with workspace-write and
94
+ on-request approvals. These are startup defaults; the app's own permission
95
+ controls and managed requirements still apply. Start a new conversation after
96
+ changing launch defaults; existing conversations can retain their own settings.
97
+
98
+ Switcher starts a separate app instance with persistent provider/model state
99
+ under `~/.hasna/switcher/state/desktop/PROFILE`. Your regular ChatGPT app and its
100
+ signed-in state are preserved. Each profile retains its own local conversations
101
+ and preferences across launches; it does not copy the regular app's login or
102
+ conversation history. A second launch of the same active profile is refused.
103
+ Keep the launching terminal running until you quit that instance: Switcher owns
104
+ its inference gateway and stops its own app process on interruption or timeout.
105
+
106
+ Upstream API keys remain in the Switcher gateway. Only a temporary loopback
107
+ credential reaches the child; its private auth file is removed after exit.
108
+ Switcher refuses to overwrite authentication added manually to a provider
109
+ profile. It does not modify or re-sign the installed app. Select a nonstandard
110
+ installation with `--app-path /absolute/path/ChatGPT.app`; native CLI arguments,
111
+ `--executable` and `--backend` are not accepted for desktop launches.
112
+
113
+ `--dry-run` validates app detection and provider/model discovery without opening
114
+ the app. The SDK offers local installation discovery through `detectChatGPTApp()`;
115
+ provider/profile/catalog operations continue to use the existing HTTP API.
116
+
117
+ The opt-in `test:native-chatgpt-runtime` script exercises the installed app's
118
+ bundled runtime against a real provider using a fresh isolated profile. Set
119
+ `SWITCHER_NATIVE_CHATGPT_PROVIDER` and `SWITCHER_NATIVE_CHATGPT_MODEL` to run it.
120
+ It verifies selected-model configuration, direct responses, delegated task
121
+ creation, follow-up delivery, and history replay against the real provider.
122
+ It is separate from visual desktop acceptance.
123
+
124
+ References: [OpenAI custom provider configuration](https://learn.chatgpt.com/docs/config-file/config-advanced),
125
+ [community desktop custom-model profiles](https://github.com/ademisler/codex-desktop-custom-models),
126
+ [reported signed-in provider routing issue](https://github.com/openai/codex/issues/37245),
127
+ and [Preview Edit routing limitation](https://github.com/openai/codex/issues/37315),
128
+ and [DeepSeek thinking controls](https://api-docs.deepseek.com/guides/thinking_mode/).
129
+
130
+ ## Claude desktop with a provider
131
+
132
+ ```sh
133
+ switcher launch claude-desktop --provider deepseek --model deepseek-flash
134
+ switcher launch claude-desktop --provider my-messages-provider --model vendor/model
135
+ switcher launch claude-desktop --provider deepseek --model deepseek-flash --dry-run
136
+ ```
137
+
138
+ Requires macOS and Claude desktop 1.52386.0 or newer. This uses the app's
139
+ supported third-party gateway mode and its own downloaded Claude Code engine;
140
+ a separately installed Claude Code CLI is not required. `launch claude` keeps
141
+ launching the terminal CLI. `detectClaudeDesktopApp()` is available in the SDK.
142
+
143
+ The provider must implement Anthropic Messages, including streaming and tool
144
+ calling for the chosen model. DeepSeek and compatible gateway presets select
145
+ the Messages endpoint automatically. Saved provider IDs retain their explicit
146
+ protocol. Switcher does not convert Chat Completions or Responses into Messages.
147
+ A configured provider works in both desktop apps when it offers both required
148
+ APIs; a preset's existence is not proof that every model supports every feature.
149
+
150
+ Claude uses its vendor-supported `~/Library/Application Support/Claude-3p`
151
+ profile, separate from the regular signed-in Claude profile. Only one third-party
152
+ instance can run at a time; quit it before switching providers. Switcher adds a
153
+ temporary configuration-library entry, leases that profile, and restores the
154
+ previous selection on exit. Its conversations remain in Claude-3p. Configuration
155
+ changes made outside Switcher are preserved and reported for review. Managed
156
+ Claude configurations are not overridden. No app patching, re-signing or
157
+ restricted development flags are used.
158
+
159
+ The selected model fills Claude's normal, planning and fast model slots using
160
+ explicit gateway aliases. `--role-model planning=MODEL` and `--role-model
161
+ fast=MODEL` can select different models from the same provider. The gateway
162
+ records the actual upstream model. Display labels identify your provider model;
163
+ the aliases do not change that model into an Anthropic model.
164
+
165
+ Choose effort and permissions in Claude's own controls; the model must support
166
+ what Claude sends. Switcher's `--reasoning` and
167
+ `--dangerously-bypass-approvals-and-sandbox` flags currently apply to Codex and
168
+ ChatGPT, and are rejected for Claude desktop. Cowork and account-dependent
169
+ features retain their native requirements. Only a temporary scoped loopback
170
+ credential is written to the private configuration file; the upstream provider
171
+ key stays in Switcher. Keep Switcher running while using the launched instance.
172
+
173
+ Live acceptance on macOS used DeepSeek `deepseek-flash`: ChatGPT local Codex
174
+ returned the requested test marker with reasoning and Full access visible;
175
+ Claude's third-party chat returned its requested marker, with successful gateway
176
+ traces identifying `deepseek-flash`. Other compatible providers have adapter
177
+ coverage, not a claim of live acceptance on every model.
178
+
179
+ References: [Claude third-party gateway](https://claude.com/docs/third-party/claude-desktop/gateway),
180
+ [configuration library and model tiers](https://claude.com/docs/third-party/claude-desktop/configuration),
181
+ and [CC Switch's Claude desktop integration](https://github.com/Chenx-13/cc_switch/blob/main/docs/user-manual/en/2-providers/2.6-claude-desktop.md).
182
+
50
183
  ## Direct launch
51
184
 
52
185
  The direct launch flow is available from 0.1.1. The additional OMP, DeepSeek Harness, Cline, Hermes, Prime Agent, legacy OpenCode, Kilo, Gemini CLI and Aider adapters are introduced in 0.1.2. Version 0.1.0 requires explicit API/provider/profile setup.
@@ -0,0 +1,5 @@
1
+ import type { PreparedLaunch } from "./harness-types";
2
+ import type { ChatGPTInstallation } from "./desktop-apps";
3
+ /** Separate desktop state from the signed-in app. The upstream credential stays
4
+ * in the parent gateway. SQLite releases the profile lease even after a crash. */
5
+ export declare function prepareChatGPTLaunch(native: PreparedLaunch, app: ChatGPTInstallation, stateDir: string, sessionDir: string): Promise<PreparedLaunch>;
@@ -0,0 +1,11 @@
1
+ import type { ClaudeDesktopInstallation } from "./desktop-apps";
2
+ import type { HarnessLaunchInput, PreparedLaunch } from "./harness-types";
3
+ export declare const claudeDesktopDataDirectory: () => string;
4
+ type DesktopSystem = {
5
+ userData: string;
6
+ assertAvailable: () => Promise<void>;
7
+ };
8
+ /** Use the vendor-supported local configuration library, preserving the prior
9
+ * selection. The signed app rejects custom userData development overrides. */
10
+ export declare function prepareClaudeDesktopLaunch(input: HarnessLaunchInput, app: ClaudeDesktopInstallation, sessionDir: string, system?: DesktopSystem): Promise<PreparedLaunch>;
11
+ export {};