@hasna/switcher 0.2.20 → 0.2.22
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 +3 -1
- package/dist/claude-context.d.ts +16 -0
- package/dist/claude-desktop.js +95 -95
- package/dist/cli/index.js +148 -60
- package/dist/harness-types.d.ts +6 -0
- package/dist/index.js +96 -96
- package/dist/inference-gateway.d.ts +6 -0
- package/dist/mcp/index.js +100 -100
- package/dist/sdk.js +96 -96
- package/dist/serve/index.js +2 -2
- package/docs/GATEWAY-SERVICE.md +59 -10
- package/openapi.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -621,7 +621,7 @@ Cline uses its native ACP backend with per-launch configuration, durable session
|
|
|
621
621
|
|
|
622
622
|
## Background sessions and the persistent gateway
|
|
623
623
|
|
|
624
|
-
Launches register with one persistent gateway per user on a stable `127.0.0.1` port. A launch's token keeps working for as long as any process it started still runs, including Claude Code's detached background host and its background sessions after `switcher launch` exits. When nothing from the launch remains, the launch ends. For 30 days after that, a request with its token from a process of this user running under a current launch, such as a background session that Claude Code's background host started again, revives it; a copied token used from anywhere else stays refused. For the default `~/.hasna/switcher` home the gateway runs under launchd (macOS) or systemd `--user` (Linux), starts at login, and is installed automatically by the first launch of the installed `switcher`. Other homes and other copies of Switcher use a detached gateway that exits when idle.
|
|
624
|
+
Launches register with one persistent gateway per user on a stable `127.0.0.1` port. A launch's token keeps working for as long as any process it started still runs, including Claude Code's detached background host and its background sessions after `switcher launch` exits. When nothing from the launch remains, the launch ends. For 30 days after that, a request with its token from a process of this user running under a current launch, such as a background session that Claude Code's background host started again, revives it; for a launch without a durable Claude route, a copied token used from anywhere else stays refused, and holding a launch that only its durable route revived does not count as running under a current launch. A Claude launch also writes its route into the session's `--settings` file (mode 0600 in the profile's private session folder), so a session the background host restores after a station restart, or opens from another folder, keeps its route without a current launch. So for 30 days after a Claude launch was last used, the gateway serves its token to any running process of this user that presents it, a shell or script included; another account's process, or a connection the gateway cannot trace, is refused when it would revive an ended launch. While any launch is current, the gateway serves its token on any loopback connection that presents it, without a process check. For the default `~/.hasna/switcher` home the gateway runs under launchd (macOS) or systemd `--user` (Linux), starts at login, and is installed automatically by the first launch of the installed `switcher`. Other homes and other copies of Switcher use a detached gateway that exits when idle.
|
|
625
625
|
|
|
626
626
|
```sh
|
|
627
627
|
switcher gateway status # running, pid, port, launches and login unit
|
|
@@ -715,6 +715,8 @@ Claude Code with a non-Claude model is experimental and unsupported by Anthropic
|
|
|
715
715
|
|
|
716
716
|
For Claude Code using the official DeepSeek Messages endpoint, Switcher defaults `CLAUDE_CODE_AUTO_COMPACT_WINDOW` to `786432`, following [DeepSeek's integration guidance](https://api-docs.deepseek.com/quick_start/agent_integrations/claude_code/). An explicitly set environment value takes precedence. Recognized provider context-overflow errors become a sanitized `prompt is too long` error so the native client can compact or guide recovery; unrelated errors retain the sanitized upstream status. Existing launches must pick up the compaction setting or start a new launch to use this default.
|
|
717
717
|
|
|
718
|
+
When a catalog model declares a context window of at least 1,000,000 tokens, Switcher hands it to Claude Code with Claude's `[1m]` suffix (for example `deepseek-flash[1m]`) in `--model`, the model variables and the picker. Without it, Claude Code treats the model as a 200k-token one and compacts near 168k whatever `CLAUDE_CODE_AUTO_COMPACT_WINDOW` says. Claude strips the suffix before calling the provider, so the provider and the gateway see the catalog id.
|
|
719
|
+
|
|
718
720
|
DeepSeek officially released V4.1 Flash on 2026-09-10. Its API model ID is `deepseek-flash`, as documented in the [official release notes](https://api-docs.deepseek.com/updates/) and [API quick start](https://api-docs.deepseek.com/). New DeepSeek presets include that model with text/image input and tool support, and support Chat Completions, Anthropic Messages, and Responses (for Codex). Saved providers and profiles keep their existing model selections. Configure an existing provider explicitly to adopt the new model:
|
|
719
721
|
|
|
720
722
|
```sh
|
package/dist/claude-context.d.ts
CHANGED
|
@@ -3,3 +3,19 @@
|
|
|
3
3
|
* Inspect the original provider URL: the native URL is a loopback gateway.
|
|
4
4
|
*/
|
|
5
5
|
export declare function claudeContextEnvironment(providerBaseUrl: string, environment?: NodeJS.ProcessEnv): Record<string, string>;
|
|
6
|
+
/** Claude Code treats a model it doesn't know as a 200k-token one and compacts near 168k, even when
|
|
7
|
+
* the provider serves more and CLAUDE_CODE_AUTO_COMPACT_WINDOW is higher (measured on DeepSeek flash,
|
|
8
|
+
* 30.10). The `[1m]` suffix tells it the window is 1M; Claude strips it before calling the provider.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CLAUDE_ONE_MILLION_CONTEXT = 1000000;
|
|
11
|
+
/** The model id Claude Code is given for a catalog entry: with `[1m]` when the catalog declares a
|
|
12
|
+
* window of at least 1M tokens, otherwise unchanged. */
|
|
13
|
+
export declare function claudeNativeModelId(id: string, models: readonly {
|
|
14
|
+
id: string;
|
|
15
|
+
contextWindow?: number;
|
|
16
|
+
}[]): string;
|
|
17
|
+
/** Apply claudeNativeModelId to the model variables of a Claude environment, leaving the rest as is. */
|
|
18
|
+
export declare function claudeNativeModelEnvironment(env: Record<string, string> | undefined, models: readonly {
|
|
19
|
+
id: string;
|
|
20
|
+
contextWindow?: number;
|
|
21
|
+
}[]): Record<string, string>;
|