@hasna/switcher 0.1.9 → 0.2.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.
@@ -0,0 +1,15 @@
1
+ /** Internal timing injection keeps streaming regressions fast without CLI knobs. */
2
+ export type ProviderRequestTiming = {
3
+ idleTimeoutMs?: number;
4
+ };
5
+ /** Bound upstream inactivity, without charging downstream backpressure as idle. */
6
+ export declare function createProviderRequest(requestSignal: AbortSignal, abortSignal: AbortSignal, timing?: ProviderRequestTiming): {
7
+ fetchOptions: {
8
+ signal: AbortSignal;
9
+ timeout: false;
10
+ };
11
+ run: <T>(operation: () => Promise<T>) => Promise<T>;
12
+ finish: () => void;
13
+ timedOut: () => boolean;
14
+ };
15
+ export type ProviderRequest = ReturnType<typeof createProviderRequest>;
@@ -1,4 +1,5 @@
1
1
  import type { HarnessLaunchInput } from "./harness-types";
2
+ import type { ProviderRequest } from "./provider-request";
2
3
  /** Recognize whole SSE terminal events, never marker text inside a delta. */
3
4
  export declare function terminalEventObserver(protocol: HarnessLaunchInput["protocol"], contentType: string | null): (chunk: Uint8Array) => boolean;
4
5
  /** One lifecycle for all bridges: terminal SSE, caller cancellation, and real failure. */
@@ -9,8 +10,9 @@ export declare function proxyProviderStream(input: {
9
10
  abort: AbortController;
10
11
  closing: () => boolean;
11
12
  release: () => void;
13
+ activity?: ProviderRequest;
12
14
  inspect?: (chunk: Uint8Array, done?: boolean) => void;
13
- interrupted?: () => void;
15
+ interrupted?: (reason: "stream_interrupted" | "provider_idle_timeout") => void;
14
16
  }): {
15
17
  stream: ReadableStream<Uint8Array>;
16
18
  cancel: () => Promise<void>;
package/dist/runtime.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { SwitcherClient } from "./sdk";
2
2
  import type { CatalogCredentialResolver } from "./catalog";
3
+ /** The refusal code when no Switcher API credential is configured and the local opt-in is not set. */
4
+ export declare const REMOTE_API_CONFIG_MISSING = "remote_api_config_missing";
3
5
  export declare function switcherHome(env?: NodeJS.ProcessEnv): string;
4
6
  export declare function privateDirectory(path: string): Promise<void>;
5
7
  /** Data access always uses HTTP, including the per-command owned local service. */
@@ -67,7 +67,7 @@ function canonicalPolicyJSON(value) {
67
67
  }
68
68
 
69
69
  // src/domain.ts
70
- var VERSION = "0.1.9";
70
+ var VERSION = "0.2.0";
71
71
  var harnessSchema = z3.enum(["claude", "codex", "grok", "opencode", "opencode2", "pi", "omp", "dsh", "cline", "hermes", "prime-agent", "gemini", "aider", "kilo"]);
72
72
  var protocolSchema = z3.enum(["anthropic-messages", "openai-responses", "openai-chat", "gemini-generate-content"]);
73
73
  var idSchema = z3.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}$/);
@@ -837,7 +837,7 @@ var openapi_default = {
837
837
  openapi: "3.0.3",
838
838
  info: {
839
839
  title: "Switcher API",
840
- version: "0.1.9",
840
+ version: "0.2.0",
841
841
  description: "Authenticated provider/profile/catalog control plane. Launches run locally; the API never returns provider credentials."
842
842
  },
843
843
  security: [
package/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.0.3",
3
3
  "info": {
4
4
  "title": "Switcher API",
5
- "version": "0.1.9",
5
+ "version": "0.2.0",
6
6
  "description": "Authenticated provider/profile/catalog control plane. Launches run locally; the API never returns provider credentials."
7
7
  },
8
8
  "security": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/switcher",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "Universal provider and model switcher for coding harnesses with an API, SDK and self-hosted storage",
6
6
  "license": "Apache-2.0",
@@ -60,7 +60,8 @@
60
60
  "test:native-opencode-legacy": "bun scripts/test-native-opencode-legacy.ts",
61
61
  "test:native-kilo": "bun scripts/test-native-kilo.ts",
62
62
  "test:native-kilo-lifecycle": "bun scripts/test-native-kilo-lifecycle.ts",
63
- "test:native-chatgpt-runtime": "bun scripts/test-native-chatgpt-runtime.ts"
63
+ "test:native-chatgpt-runtime": "bun scripts/test-native-chatgpt-runtime.ts",
64
+ "test:native-chatgpt-tools": "bun scripts/test-native-chatgpt-tools.ts"
64
65
  },
65
66
  "devDependencies": {
66
67
  "@types/bun": "1.3.14",
@@ -77,7 +78,7 @@
77
78
  },
78
79
  "repository": {
79
80
  "type": "git",
80
- "url": "git+https://github.com/hasna/apps.git",
81
+ "url": "https://github.com/hasna/apps.git",
81
82
  "directory": "apps/switcher"
82
83
  },
83
84
  "homepage": "https://github.com/hasna/apps/tree/main/apps/switcher",