@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.
- package/README.md +28 -3
- package/dist/cli/index.js +206 -59
- package/dist/domain.d.ts +1 -1
- package/dist/gemini-bridge.d.ts +2 -1
- package/dist/harnesses.d.ts +6 -0
- package/dist/hermes-backend.d.ts +2 -1
- package/dist/inference-gateway.d.ts +2 -1
- package/dist/lib/local-opt-in.d.ts +30 -0
- package/dist/mcp/index.js +4860 -25
- package/dist/provider-request.d.ts +15 -0
- package/dist/provider-stream.d.ts +3 -1
- package/dist/runtime.d.ts +2 -0
- package/dist/serve/index.js +2 -2
- package/openapi.json +1 -1
- package/package.json +4 -3
package/dist/domain.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type RoutingEvent } from "./model-policy-schema";
|
|
|
3
3
|
export { modelPolicySchema, routingEventSchema, routingEventsSchema } from "./model-policy-schema";
|
|
4
4
|
export type { ModelPolicy, RoutingEvent } from "./model-policy-schema";
|
|
5
5
|
export type { AuthStyle } from "./auth";
|
|
6
|
-
export declare const VERSION = "0.
|
|
6
|
+
export declare const VERSION = "0.2.0";
|
|
7
7
|
export declare const harnessSchema: z.ZodEnum<["claude", "codex", "grok", "opencode", "opencode2", "pi", "omp", "dsh", "cline", "hermes", "prime-agent", "gemini", "aider", "kilo"]>;
|
|
8
8
|
export declare const protocolSchema: z.ZodEnum<["anthropic-messages", "openai-responses", "openai-chat", "gemini-generate-content"]>;
|
|
9
9
|
export declare const idSchema: z.ZodString;
|
package/dist/gemini-bridge.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type ProviderRequestTiming } from "./provider-request";
|
|
1
2
|
import type { HarnessLaunchInput } from "./harness-types";
|
|
2
|
-
export declare function geminiBridge(input: HarnessLaunchInput): {
|
|
3
|
+
export declare function geminiBridge(input: HarnessLaunchInput, timing?: ProviderRequestTiming): {
|
|
3
4
|
baseUrl: string;
|
|
4
5
|
token: string;
|
|
5
6
|
cleanup: () => Promise<void>;
|
package/dist/harnesses.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ProviderRequestTiming } from "./provider-request";
|
|
1
2
|
import { type ReasoningEffort } from "./reasoning";
|
|
2
3
|
import type { HarnessId, HarnessLaunchInput, PreparedLaunch } from "./harness-types";
|
|
3
4
|
export declare function detectHarness(harness: HarnessId, override?: string): Promise<{
|
|
@@ -48,4 +49,9 @@ export declare function codexModel(model: HarnessLaunchInput["models"][number],
|
|
|
48
49
|
instructions_variables: null;
|
|
49
50
|
};
|
|
50
51
|
};
|
|
52
|
+
export declare function grokBridge(input: HarnessLaunchInput, timing?: ProviderRequestTiming): {
|
|
53
|
+
baseUrl: string;
|
|
54
|
+
token: string;
|
|
55
|
+
cleanup: () => Promise<void>;
|
|
56
|
+
};
|
|
51
57
|
export declare function prepareHarnessLaunch(input: HarnessLaunchInput): Promise<PreparedLaunch>;
|
package/dist/hermes-backend.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ProviderRequestTiming } from "./provider-request";
|
|
1
2
|
import type { HarnessLaunchInput, PreparedLaunch } from "./harness-types";
|
|
2
3
|
/** Hermes' native runtime names for the three Switcher wire contracts. */
|
|
3
4
|
export declare const hermesApiMode: {
|
|
@@ -10,7 +11,7 @@ export declare const hermesApiMode: {
|
|
|
10
11
|
* Hermes' custom provider client uses Bearer locally; this bridge translates
|
|
11
12
|
* that local credential into the provider's declared upstream header style.
|
|
12
13
|
*/
|
|
13
|
-
export declare function createHermesBridge(input: Pick<HarnessLaunchInput, "baseUrl" | "protocol" | "authStyle" | "model" | "models" | "credential"
|
|
14
|
+
export declare function createHermesBridge(input: Pick<HarnessLaunchInput, "baseUrl" | "protocol" | "authStyle" | "model" | "models" | "credential">, timing?: ProviderRequestTiming): {
|
|
14
15
|
baseUrl: string;
|
|
15
16
|
token: string;
|
|
16
17
|
cleanup: () => Promise<void>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ProviderRequestTiming } from "./provider-request";
|
|
1
2
|
import { type ReasoningEffort } from "./reasoning";
|
|
2
3
|
import type { HarnessLaunchInput } from "./harness-types";
|
|
3
4
|
import { type CompiledModelPolicy } from "./model-policy";
|
|
@@ -18,7 +19,7 @@ type GatewayInput = HarnessLaunchInput & {
|
|
|
18
19
|
onRoutingEvent?: (event: RoutingEvent) => void;
|
|
19
20
|
};
|
|
20
21
|
/** A per-launch credential boundary: the native client never receives the provider key. */
|
|
21
|
-
export declare function createInferenceGateway(input: GatewayInput): {
|
|
22
|
+
export declare function createInferenceGateway(input: GatewayInput, timing?: ProviderRequestTiming): {
|
|
22
23
|
baseUrl: string;
|
|
23
24
|
token: string;
|
|
24
25
|
cleanup: () => Promise<void>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** The deliberate unhosted opt-in, canonical name first. */
|
|
2
|
+
export declare const SWITCHER_LOCAL_OPT_IN_ENV_KEYS: readonly ["HASNA_SWITCHER_LOCAL", "SWITCHER_LOCAL"];
|
|
3
|
+
/** The Keychain item the shared resolver reads for this app (account: HASNA_STATION or the short hostname). */
|
|
4
|
+
export declare const SWITCHER_KEYCHAIN_ITEM = "hasna.credentials.switcher.api-key";
|
|
5
|
+
/** The canonical credentials file, as operators know it. */
|
|
6
|
+
export declare const SWITCHER_CREDENTIALS_FILE = "~/.hasna/switcher/config/credentials";
|
|
7
|
+
export type SwitcherLocalOptInEnv = Record<string, string | undefined>;
|
|
8
|
+
/** True when the operator deliberately asked for the unhosted on-box run. */
|
|
9
|
+
export declare function isSwitcherLocalOptIn(env?: SwitcherLocalOptInEnv): boolean;
|
|
10
|
+
/** Every env name that can configure a Switcher authority or credential, resolver-derived. */
|
|
11
|
+
export declare function switcherAuthorityEnvKeys(): string[];
|
|
12
|
+
/**
|
|
13
|
+
* Does the ENVIRONMENT itself declare a Switcher authority or credential?
|
|
14
|
+
*
|
|
15
|
+
* Deliberately narrower than "does a credential resolve": answering it must not
|
|
16
|
+
* touch the Keychain or the filesystem. A DECLARED variable counts even when
|
|
17
|
+
* blank — Switcher has always let Contracts refuse a blank override loudly
|
|
18
|
+
* rather than fall through to another identity or to local data.
|
|
19
|
+
*/
|
|
20
|
+
export declare function hasSwitcherEnvAuthorityIntent(env?: SwitcherLocalOptInEnv): boolean;
|
|
21
|
+
/** True when this environment should be served by the on-box local run. */
|
|
22
|
+
export declare function selectsSwitcherLocalMode(env?: SwitcherLocalOptInEnv): boolean;
|
|
23
|
+
/** The credential sources a fail-closed refusal names. Never a value. */
|
|
24
|
+
export declare function switcherCredentialSources(env?: SwitcherLocalOptInEnv): string[];
|
|
25
|
+
/** The one-line refusal for "nothing configured": tiers consulted plus the opt-in, never a value. */
|
|
26
|
+
export declare function remoteConfigMissingMessage(env?: SwitcherLocalOptInEnv): string;
|
|
27
|
+
/** Print the LOCAL-mode notice once per process. `write` is a test seam. */
|
|
28
|
+
export declare function announceSwitcherLocalMode(home: string, write?: (line: string) => void): void;
|
|
29
|
+
/** Test seam. */
|
|
30
|
+
export declare function resetSwitcherLocalModeAnnouncement(): void;
|