@hasna/switcher 0.1.5 → 0.1.6
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 +11 -0
- package/dist/catalog.d.ts +1 -0
- package/dist/claude-context.d.ts +5 -0
- package/dist/cli/index.js +410 -27
- package/dist/domain.d.ts +103 -1
- package/dist/generated/api.d.ts +47 -0
- package/dist/index.js +13 -2
- package/dist/mcp/index.js +8 -2
- package/dist/presets.d.ts +14 -0
- package/dist/provider-error.d.ts +2 -0
- package/dist/sdk.d.ts +74 -0
- package/dist/sdk.js +13 -2
- package/dist/serve/index.js +311 -20
- package/openapi.json +268 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -277,6 +277,17 @@ The Claude adapter sets `ANTHROPIC_DEFAULT_MODEL` and the default subagent model
|
|
|
277
277
|
|
|
278
278
|
Claude Code with a non-Claude model is experimental and unsupported by Anthropic. Codex requires Responses, not Chat Completions. Upstream reasoning, tool schemas, context limits and stateless Responses behavior still need provider-specific validation. Switcher never silently falls back to a different provider.
|
|
279
279
|
|
|
280
|
+
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.
|
|
281
|
+
|
|
282
|
+
New DeepSeek presets include `deepseek-v4.1-flash-expires-on-0910` as an additional preview model with `expiresOn: "2026-09-10"`. The provider's normal model discovery stays active. To register an unlisted model on an existing provider:
|
|
283
|
+
|
|
284
|
+
```sh
|
|
285
|
+
switcher models add my-provider vendor/preview --name "Preview" --expires-on 2026-09-10
|
|
286
|
+
switcher models my-provider --refresh
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
`--expires-on` is optional and accepts a real `YYYY-MM-DD` date. Dates are inclusive in UTC: `2026-09-10` becomes expired at `2026-09-11T00:00:00Z`. This is operator metadata, not a guarantee of provider uptime. Expired models remain visible in `switcher models` with `expired: true` and `codingEligible: false`; new launches, policy roles, native picker catalogs and subsequent gateway requests reject them. Existing processes are not stopped. `models add` appends to the provider's optional `additionalModels` array; entries merge by model ID with discovered or manual models and override only supplied metadata. A duplicate additional entry is rejected; use a versioned `providers update --file` to edit it. Remote catalogs can also supply `expiresOn` or `expires_on`. `manualModels` continues to replace discovery when explicitly configured.
|
|
290
|
+
|
|
280
291
|
For a provider without discovery, use `providers add ID --file provider.json` with `manualModels`. Each model needs `id` and `name`; optional fields are `contextWindow`, `maxOutputTokens`, `inputModalities`, `outputModalities`, `supportedParameters`, and `available`. Use `catalogBaseUrl` and `modelsPath` for a separate discovery root/path; CLI equivalents are `--catalog-url` and `--models-path`. Use `catalogFormat: "ollama"` for `/api/tags`. Mistral presets select a capability-aware parser, including archived status. Together presets select its native bare-array parser. Fireworks requires `--catalog-account-id ID` or an explicit catalog URL and retains count evidence across its paginated account catalog. DashScope requires an explicit region/workspace `--catalog-url` with `--catalog-format dashscope`. Z.AI currently requires an explicit catalog or manual models because its documented API has no model-list contract. MiniMax defaults to its `.cn` Open Platform endpoints; use an explicit authority and credential reference for another product or region. A different authenticated catalog origin requires an explicit `catalogCredentialEnv`; a public catalog can declare `catalogAuthStyle: "none"`. Standard credential aliases are resolved only for the matching built-in provider origin. The default parser follows Anthropic-style `has_more/last_id` pagination and otherwise expects an OpenAI-style `data` array. HTTP redirects are rejected.
|
|
281
292
|
|
|
282
293
|
Grok uses a per-launch authenticated loopback bridge because its environment overlay cannot define providers. The bridge serves model metadata and forwards the selected protocol unchanged. It holds upstream credentials only in memory; Grok receives an ephemeral local token. The same bridge handles credentialless endpoints and OpenCode auth-header mismatches. Bridged requests are limited to 4 MiB and four minutes. Grok resumes retain the selected profile model. Use `-- --resume SESSION_ID -p PROMPT` for headless continuation, or omit the prompt and type after the interactive session loads. Interactive resume with an inline positional prompt is rejected because the native client can send it before applying the selected model. Grok 1.0.13 passed source and installed development CLI resume checks against a controlled Messages fixture and live DeepSeek Flash. OpenCode's provider identity stays stable across temporary bridge ports; `-- run --session SESSION_ID PROMPT` resumes with fresh launch settings. The installed beta-19157 passed two-process Messages resume checks against a controlled local upstream and live DeepSeek Flash, including a proof-file read and preserved history. Other provider/protocol and registry-release cells remain tracked separately in COMPATIBILITY.md.
|
package/dist/catalog.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { type Catalog, type Provider, type ProviderInput } from "./domain";
|
|
2
2
|
export type CatalogCredentialResolver = (provider: ProviderInput) => Promise<string | undefined>;
|
|
3
|
+
/** Add operator metadata only after remote pagination counts have been reconciled. */
|
|
3
4
|
export declare function discover(provider: Provider, env?: Record<string, string | undefined>, resolveCredential?: CatalogCredentialResolver): Promise<Catalog>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Keep enough room for Claude's next turn and compaction request on DeepSeek.
|
|
2
|
+
* https://api-docs.deepseek.com/quick_start/agent_integrations/claude_code/
|
|
3
|
+
* Inspect the original provider URL: the native URL is a loopback gateway.
|
|
4
|
+
*/
|
|
5
|
+
export declare function claudeContextEnvironment(providerBaseUrl: string, environment?: NodeJS.ProcessEnv): Record<string, string>;
|