@eddyskywalker/dsh-chatgpt-subscription 0.2.20 → 0.3.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/CHANGELOG.md +79 -0
- package/README.md +116 -1
- package/lib/client.js +2825 -512
- package/lib/client.js.map +1 -1
- package/lib/index.js +8758 -352
- package/lib/types/client/ProviderHubSection.d.ts +15 -0
- package/lib/types/client/ProviderHubSection.d.ts.map +1 -0
- package/lib/types/client/command-code/CommandCodeComposerQuota.d.ts +24 -0
- package/lib/types/client/command-code/CommandCodeComposerQuota.d.ts.map +1 -0
- package/lib/types/client/command-code/CommandCodeSection.d.ts +11 -0
- package/lib/types/client/command-code/CommandCodeSection.d.ts.map +1 -0
- package/lib/types/client/command-code/locales.d.ts +401 -0
- package/lib/types/client/command-code/locales.d.ts.map +1 -0
- package/lib/types/client/index.d.ts +2 -0
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/kimi-code/KimiCodeComposerQuota.d.ts +25 -0
- package/lib/types/client/kimi-code/KimiCodeComposerQuota.d.ts.map +1 -0
- package/lib/types/client/kimi-code/KimiCodeSection.d.ts +11 -0
- package/lib/types/client/kimi-code/KimiCodeSection.d.ts.map +1 -0
- package/lib/types/client/kimi-code/KimiModelCapabilities.d.ts +16 -0
- package/lib/types/client/kimi-code/KimiModelCapabilities.d.ts.map +1 -0
- package/lib/types/client/kimi-code/locales.d.ts +665 -0
- package/lib/types/client/kimi-code/locales.d.ts.map +1 -0
- package/lib/types/client/kimi-code/styles.d.ts +4 -0
- package/lib/types/client/kimi-code/styles.d.ts.map +1 -0
- package/lib/types/client/locales.d.ts +3 -1
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/styles.d.ts.map +1 -1
- package/lib/types/host/antigravity/adapter.d.ts +2 -0
- package/lib/types/host/antigravity/adapter.d.ts.map +1 -1
- package/lib/types/host/antigravity/mapper.d.ts +51 -2
- package/lib/types/host/antigravity/mapper.d.ts.map +1 -1
- package/lib/types/host/command-code/adapter.d.ts +34 -0
- package/lib/types/host/command-code/adapter.d.ts.map +1 -0
- package/lib/types/host/command-code/client.d.ts +99 -0
- package/lib/types/host/command-code/client.d.ts.map +1 -0
- package/lib/types/host/command-code/mapper.d.ts +102 -0
- package/lib/types/host/command-code/mapper.d.ts.map +1 -0
- package/lib/types/host/command-code/model-catalog.d.ts +31 -0
- package/lib/types/host/command-code/model-catalog.d.ts.map +1 -0
- package/lib/types/host/command-code/oauth.d.ts +89 -0
- package/lib/types/host/command-code/oauth.d.ts.map +1 -0
- package/lib/types/host/command-code/plans.d.ts +40 -0
- package/lib/types/host/command-code/plans.d.ts.map +1 -0
- package/lib/types/host/command-code/routes.d.ts +27 -0
- package/lib/types/host/command-code/routes.d.ts.map +1 -0
- package/lib/types/host/command-code/token-store.d.ts +88 -0
- package/lib/types/host/command-code/token-store.d.ts.map +1 -0
- package/lib/types/host/command-code/types.d.ts +138 -0
- package/lib/types/host/command-code/types.d.ts.map +1 -0
- package/lib/types/host/kimi-code/adapter.d.ts +112 -0
- package/lib/types/host/kimi-code/adapter.d.ts.map +1 -0
- package/lib/types/host/kimi-code/client.d.ts +161 -0
- package/lib/types/host/kimi-code/client.d.ts.map +1 -0
- package/lib/types/host/kimi-code/mapper.d.ts +334 -0
- package/lib/types/host/kimi-code/mapper.d.ts.map +1 -0
- package/lib/types/host/kimi-code/modalities.d.ts +94 -0
- package/lib/types/host/kimi-code/modalities.d.ts.map +1 -0
- package/lib/types/host/kimi-code/model-catalog.d.ts +77 -0
- package/lib/types/host/kimi-code/model-catalog.d.ts.map +1 -0
- package/lib/types/host/kimi-code/oauth.d.ts +133 -0
- package/lib/types/host/kimi-code/oauth.d.ts.map +1 -0
- package/lib/types/host/kimi-code/routes.d.ts +26 -0
- package/lib/types/host/kimi-code/routes.d.ts.map +1 -0
- package/lib/types/host/kimi-code/token-store.d.ts +135 -0
- package/lib/types/host/kimi-code/token-store.d.ts.map +1 -0
- package/lib/types/host/kimi-code/types.d.ts +174 -0
- package/lib/types/host/kimi-code/types.d.ts.map +1 -0
- package/lib/types/host/relay-probe.d.ts +161 -0
- package/lib/types/host/relay-probe.d.ts.map +1 -0
- package/lib/types/host/responses-client.d.ts.map +1 -1
- package/lib/types/index.d.ts +13 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/command-code-contracts.d.ts +119 -0
- package/lib/types/shared/command-code-contracts.d.ts.map +1 -0
- package/lib/types/shared/kimi-code-contracts.d.ts +203 -0
- package/lib/types/shared/kimi-code-contracts.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import { PROVIDER_ID, PROVIDER_NAME } from './types.ts';
|
|
3
|
+
import { FileCredentialStore, FileModelSettingsStore, type KimiCodeCatalogModel, type KimiCodePreferenceStore } from './token-store.ts';
|
|
4
|
+
import { type KimiCodeWebStatus } from '../../shared/kimi-code-contracts.ts';
|
|
5
|
+
/**
|
|
6
|
+
* The selection the card should show.
|
|
7
|
+
*
|
|
8
|
+
* A stored list that still equals the shipped default has never been edited, so
|
|
9
|
+
* it cannot know about models the live catalog has since added; treating it as
|
|
10
|
+
* "everything currently offered" keeps a first run from hiding the whole
|
|
11
|
+
* catalog behind an unedited default. Any explicit edit is honoured exactly.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveEnabledModelIds(stored: readonly string[], catalog: readonly KimiCodeCatalogModel[]): string[];
|
|
14
|
+
export interface KimiCodeStatusOptions {
|
|
15
|
+
fetchFn?: typeof fetch;
|
|
16
|
+
/** Whether this plugin currently owns the provider route; re-read on every status. */
|
|
17
|
+
serving?: boolean | (() => boolean);
|
|
18
|
+
/** Diagnostic when another plugin owns the provider route; re-read on every status. */
|
|
19
|
+
conflict?: string | null | (() => string | null);
|
|
20
|
+
}
|
|
21
|
+
/** Everything the settings card renders: account, quota, and the model catalog. */
|
|
22
|
+
export declare function getKimiCodeWebStatus(store: FileCredentialStore, modelSettings: FileModelSettingsStore, preferences?: KimiCodePreferenceStore, options?: KimiCodeStatusOptions): Promise<KimiCodeWebStatus>;
|
|
23
|
+
/** Register the Kimi Code settings routes under `/kimi-code/api`. */
|
|
24
|
+
export declare function registerKimiCodeRoutes(ctx: Context, store: FileCredentialStore, modelSettings: FileModelSettingsStore, preferences?: KimiCodePreferenceStore, options?: KimiCodeStatusOptions): () => void;
|
|
25
|
+
export { PROVIDER_ID, PROVIDER_NAME };
|
|
26
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../../src/host/kimi-code/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,EAEL,WAAW,EACX,aAAa,EAId,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EAEtB,KAAK,oBAAoB,EAEzB,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAA;AAazB,OAAO,EAML,KAAK,iBAAiB,EACvB,MAAM,qCAAqC,CAAA;AAqE5C;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,OAAO,EAAE,SAAS,oBAAoB,EAAE,GACvC,MAAM,EAAE,CAYV;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,OAAO,KAAK,CAAA;IACtB,sFAAsF;IACtF,OAAO,CAAC,EAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,CAAA;IACnC,uFAAuF;IACvF,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAA;CACjD;AAMD,mFAAmF;AACnF,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,mBAAmB,EAC1B,aAAa,EAAE,sBAAsB,EACrC,WAAW,CAAC,EAAE,uBAAuB,EACrC,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,iBAAiB,CAAC,CA0C5B;AAQD,qEAAqE;AACrE,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,mBAAmB,EAC1B,aAAa,EAAE,sBAAsB,EACrC,WAAW,CAAC,EAAE,uBAAuB,EACrC,OAAO,GAAE,qBAA0B,GAClC,MAAM,IAAI,CA+JZ;AAED,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { SettingsProvider } from '@deepseek-ai/dsh-settings';
|
|
2
|
+
import type { KimiCodeReasoningEffort, KimiCodeRegion } from '../../shared/kimi-code-contracts.ts';
|
|
3
|
+
import type { CredentialStore } from '../token-store.ts';
|
|
4
|
+
import { DEFAULT_OAUTH_HOST } from './types.ts';
|
|
5
|
+
export declare const KIMI_CODE_PREFERENCES_NAMESPACE = "dsh-kimi-code";
|
|
6
|
+
export type { KimiCodeReasoningEffort };
|
|
7
|
+
/**
|
|
8
|
+
* One stored Kimi Code credential.
|
|
9
|
+
*
|
|
10
|
+
* Kimi Code is an OAuth subscription: the bearer pair rotates, so both tokens
|
|
11
|
+
* are kept and the access token is refreshed shortly before it expires. The
|
|
12
|
+
* remaining fields are non-secret account facts the settings card renders
|
|
13
|
+
* without another round trip.
|
|
14
|
+
*/
|
|
15
|
+
export interface KimiCodeCredentials {
|
|
16
|
+
/** Bearer access token for the coding API. Host-only; never sent to a browser. */
|
|
17
|
+
accessToken: string;
|
|
18
|
+
/** Rotating refresh token. Host-only. */
|
|
19
|
+
refreshToken: string;
|
|
20
|
+
/** Unix milliseconds the access token stops being valid. */
|
|
21
|
+
expiresAt: number;
|
|
22
|
+
/** Lifetime the token endpoint reported, in seconds. */
|
|
23
|
+
expiresIn: number;
|
|
24
|
+
scope?: string;
|
|
25
|
+
tokenType?: string;
|
|
26
|
+
/** Region the credential was issued in; decides which hosts are used. */
|
|
27
|
+
region: KimiCodeRegion;
|
|
28
|
+
/** OAuth host the credential came from, so a refresh targets the same one. */
|
|
29
|
+
oauthHost: string;
|
|
30
|
+
/** Coding API base URL the credential was issued for, without /v1. */
|
|
31
|
+
baseUrl: string;
|
|
32
|
+
userId?: string;
|
|
33
|
+
nickname?: string;
|
|
34
|
+
email?: string;
|
|
35
|
+
planName?: string;
|
|
36
|
+
/** Unix milliseconds the credential was obtained. */
|
|
37
|
+
authenticatedAt?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface KimiCodeCatalogModel {
|
|
40
|
+
id: string;
|
|
41
|
+
name?: string;
|
|
42
|
+
contextWindow?: number;
|
|
43
|
+
reasoningEfforts?: string[];
|
|
44
|
+
defaultReasoningEffort?: string;
|
|
45
|
+
inputModalities?: Array<'text' | 'image' | 'video'>;
|
|
46
|
+
protocol?: 'openai' | 'anthropic';
|
|
47
|
+
/** Whether the model also accepts video input (reported; DSH cannot send it). */
|
|
48
|
+
supportsVideo?: boolean;
|
|
49
|
+
/** One-line description from the official model table. */
|
|
50
|
+
description?: string;
|
|
51
|
+
/** Subscription tier the model needs, when not every member has it. */
|
|
52
|
+
minimumPlan?: string | null;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the model supports dynamically loaded tools.
|
|
55
|
+
*
|
|
56
|
+
* K3 advertises this: extra tool definitions can be injected mid-conversation
|
|
57
|
+
* as a system message carrying a `tools` array, keeping the top-level list
|
|
58
|
+
* small and stable. DSH has no equivalent concept, so this is reported for
|
|
59
|
+
* information rather than acted on.
|
|
60
|
+
*/
|
|
61
|
+
supportsDynamicTools?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface KimiCodeModelSettings {
|
|
64
|
+
enabledModelIds: string[];
|
|
65
|
+
catalogModels: KimiCodeCatalogModel[];
|
|
66
|
+
contextWindowOverrides: Record<string, number>;
|
|
67
|
+
defaultReasoningEffort: KimiCodeReasoningEffort | null;
|
|
68
|
+
}
|
|
69
|
+
export interface KimiCodePreferenceStore {
|
|
70
|
+
status(): KimiCodeModelSettings;
|
|
71
|
+
update(patch: {
|
|
72
|
+
enabledModelIds?: string[];
|
|
73
|
+
contextWindowOverrides?: Record<string, number>;
|
|
74
|
+
defaultReasoningEffort?: KimiCodeReasoningEffort | null;
|
|
75
|
+
}): Promise<KimiCodeModelSettings>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Bind the model selection to the DSH settings document, which is what the
|
|
79
|
+
* settings service can persist durably; the JSON file beside it remains the
|
|
80
|
+
* store used when the plugin runs without a settings provider (headless tests).
|
|
81
|
+
*/
|
|
82
|
+
export declare function registerKimiCodePreferenceStore(settings?: SettingsProvider, fallbackStore?: FileModelSettingsStore): KimiCodePreferenceStore;
|
|
83
|
+
export declare function credentialPath(): string;
|
|
84
|
+
export declare function modelSettingsPath(): string;
|
|
85
|
+
/** File the install channel uses to pin a region before the first login. */
|
|
86
|
+
export declare function regionMarkerPath(): string;
|
|
87
|
+
/**
|
|
88
|
+
* Stable per-installation device id the managed service expects.
|
|
89
|
+
*
|
|
90
|
+
* The official client writes this once and reuses it; it is not a secret, only
|
|
91
|
+
* an identity marker, so it lives beside the other plugin state.
|
|
92
|
+
*/
|
|
93
|
+
export declare function deviceIdPath(): string;
|
|
94
|
+
export declare function parseKimiCodeCredentials(value: unknown): KimiCodeCredentials;
|
|
95
|
+
/** Encrypted credential store; the plaintext JSON is only a migration source. */
|
|
96
|
+
export declare class FileCredentialStore {
|
|
97
|
+
private readonly filePath;
|
|
98
|
+
private readonly backend;
|
|
99
|
+
constructor(filePath?: string, backend?: CredentialStore<KimiCodeCredentials>);
|
|
100
|
+
path(): string;
|
|
101
|
+
private serialize;
|
|
102
|
+
private removeLegacy;
|
|
103
|
+
private saveVerified;
|
|
104
|
+
read(): Promise<KimiCodeCredentials | null>;
|
|
105
|
+
write(credentials: KimiCodeCredentials): Promise<void>;
|
|
106
|
+
delete(): Promise<void>;
|
|
107
|
+
}
|
|
108
|
+
/** Plain-JSON model settings used when the settings service is unavailable. */
|
|
109
|
+
export declare class FileModelSettingsStore {
|
|
110
|
+
private readonly filePath;
|
|
111
|
+
constructor(filePath?: string);
|
|
112
|
+
path(): string;
|
|
113
|
+
read(): Promise<KimiCodeModelSettings>;
|
|
114
|
+
write(settings: KimiCodeModelSettings): Promise<void>;
|
|
115
|
+
updateSettings(patch: {
|
|
116
|
+
enabledModelIds?: string[];
|
|
117
|
+
contextWindowOverrides?: Record<string, number>;
|
|
118
|
+
defaultReasoningEffort?: KimiCodeReasoningEffort | null;
|
|
119
|
+
}): Promise<KimiCodeModelSettings>;
|
|
120
|
+
setCatalogModels(catalogModels: KimiCodeCatalogModel[], options?: {
|
|
121
|
+
enabledModelIds?: string[];
|
|
122
|
+
}): Promise<KimiCodeModelSettings>;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Resolve the region this installation belongs to.
|
|
126
|
+
*
|
|
127
|
+
* Read locally, never probed: an environment pin wins, then the marker file the
|
|
128
|
+
* install channel may have written, then the default. A region only selects
|
|
129
|
+
* hosts, so an unknown marker is ignored rather than fatal.
|
|
130
|
+
*/
|
|
131
|
+
export declare function resolveRegion(env?: NodeJS.ProcessEnv): Promise<KimiCodeRegion>;
|
|
132
|
+
/** Remember a region choice so a later status call reports the same one. */
|
|
133
|
+
export declare function persistRegion(region: KimiCodeRegion): Promise<void>;
|
|
134
|
+
export { DEFAULT_OAUTH_HOST };
|
|
135
|
+
//# sourceMappingURL=token-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-store.d.ts","sourceRoot":"","sources":["../../../../src/host/kimi-code/token-store.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAiB,MAAM,2BAA2B,CAAA;AAGhF,OAAO,KAAK,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AAElG,OAAO,KAAK,EAAE,eAAe,EAAE,MAA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/code); it is a
|
|
5
|
+
* different system from the pay-as-you-go Moonshot Open Platform, and its keys
|
|
6
|
+
* and base URLs are not interchangeable. The facts below are transcribed from
|
|
7
|
+
* the official CLI sources and documentation:
|
|
8
|
+
*
|
|
9
|
+
* - the OAuth device flow lives on auth.kimi.com and is implemented by
|
|
10
|
+
* MoonshotAI/kimi-cli in src/kimi_cli/auth/oauth.py;
|
|
11
|
+
* - the managed provider is configured as type "kimi", an OpenAI-compatible
|
|
12
|
+
* client, against https://api.kimi.com/coding/v1;
|
|
13
|
+
* - the same service documents https://api.kimi.com/coding/ as an Anthropic
|
|
14
|
+
* Messages base URL for third-party tools;
|
|
15
|
+
* - account quota comes from GET /coding/v1/usages.
|
|
16
|
+
*
|
|
17
|
+
* See https://www.kimi.com/code/docs/en/kimi-code/models.html and
|
|
18
|
+
* https://www.kimi.com/code/docs/en/kimi-code/error-reference.html
|
|
19
|
+
*/
|
|
20
|
+
import type { KimiCodeReasoningEffort, KimiCodeRegion, KimiCodeWire } from '../../shared/kimi-code-contracts.ts';
|
|
21
|
+
export declare const PROVIDER_ID = "kimi-code";
|
|
22
|
+
export declare const PROVIDER_NAME = "Kimi Code";
|
|
23
|
+
/**
|
|
24
|
+
* OAuth client id the official Kimi CLI registers.
|
|
25
|
+
*
|
|
26
|
+
* The device flow has no client secret: the client id alone identifies the
|
|
27
|
+
* public client, exactly as RFC 8628 intends for a device that cannot keep one.
|
|
28
|
+
*/
|
|
29
|
+
export declare const KIMI_CODE_CLIENT_ID = "17e5f671-d194-4dfb-9706-5516cb48c098";
|
|
30
|
+
/** OAuth host serving /api/oauth/device_authorization and /api/oauth/token. */
|
|
31
|
+
export declare const DEFAULT_OAUTH_HOST = "https://auth.kimi.com";
|
|
32
|
+
/** Device authorization endpoint (RFC 8628 section 3.1). */
|
|
33
|
+
export declare const DEVICE_AUTHORIZATION_PATH = "/api/oauth/device_authorization";
|
|
34
|
+
/** Token endpoint for both the device-code grant and refresh (RFC 8628 section 3.4). */
|
|
35
|
+
export declare const OAUTH_TOKEN_PATH = "/api/oauth/token";
|
|
36
|
+
/** Grant type the device-code polling request declares. */
|
|
37
|
+
export declare const DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
38
|
+
/** Host set per region; a global account is served by the .ai properties. */
|
|
39
|
+
export declare const REGION_HOSTS: Record<KimiCodeRegion, {
|
|
40
|
+
oauth: string;
|
|
41
|
+
coding: string;
|
|
42
|
+
}>;
|
|
43
|
+
/** OpenAI-compatible prefix; append /chat/completions or /models. */
|
|
44
|
+
export declare const OPENAI_API_PREFIX = "/v1";
|
|
45
|
+
export declare const USER_AGENT = "dsh-chatgpt-subscription (+https://github.com/Aa728848/dsh-chatgpt-subscription)";
|
|
46
|
+
/**
|
|
47
|
+
* Product markers the managed service recognizes.
|
|
48
|
+
*
|
|
49
|
+
* The official client identifies itself as kimi_cli and reports a stable
|
|
50
|
+
* per-installation device id; sending the same vocabulary keeps the subscription
|
|
51
|
+
* endpoints answering the way they do for the official CLI.
|
|
52
|
+
*/
|
|
53
|
+
export declare const MSH_PLATFORM = "kimi_code_cli";
|
|
54
|
+
export declare const HEADER_MSH_PLATFORM = "x-msh-platform";
|
|
55
|
+
export declare const HEADER_MSH_VERSION = "x-msh-version";
|
|
56
|
+
export declare const HEADER_MSH_DEVICE_NAME = "x-msh-device-name";
|
|
57
|
+
export declare const HEADER_MSH_DEVICE_MODEL = "x-msh-device-model";
|
|
58
|
+
export declare const HEADER_MSH_OS_VERSION = "x-msh-os-version";
|
|
59
|
+
export declare const HEADER_MSH_DEVICE_ID = "x-msh-device-id";
|
|
60
|
+
/** Version the plugin reports to the managed service's telemetry headers. */
|
|
61
|
+
export declare const MSH_VERSION = "1.0.0";
|
|
62
|
+
/**
|
|
63
|
+
* Refresh timing, copied from the official client.
|
|
64
|
+
*
|
|
65
|
+
* A token is refreshed once it is within max(300s, expires_in * 0.5) of expiry,
|
|
66
|
+
* so a short-lived token is replaced early enough to never be used while stale.
|
|
67
|
+
*/
|
|
68
|
+
export declare const MIN_REFRESH_THRESHOLD_SECONDS = 300;
|
|
69
|
+
export declare const REFRESH_THRESHOLD_RATIO = 0.5;
|
|
70
|
+
/** How long a rejected refresh token is remembered before a new attempt. */
|
|
71
|
+
export declare const UNAUTHORIZED_REFRESH_RETRY_COOLDOWN_MS = 300000;
|
|
72
|
+
/** Attempts one refresh gets before the stored credential is declared dead. */
|
|
73
|
+
export declare const REFRESH_MAX_RETRIES = 3;
|
|
74
|
+
/** Exponential backoff base for a retryable refresh failure. */
|
|
75
|
+
export declare const REFRESH_BACKOFF_BASE_MS = 1000;
|
|
76
|
+
/** Device-flow polling defaults when the service omits them. */
|
|
77
|
+
export declare const DEFAULT_DEVICE_INTERVAL_SECONDS = 5;
|
|
78
|
+
export declare const DEFAULT_DEVICE_EXPIRES_SECONDS = 600;
|
|
79
|
+
/** Local timeouts and cache lifetimes. */
|
|
80
|
+
export declare const DISCOVERY_TIMEOUT_MS = 15000;
|
|
81
|
+
export declare const LOGIN_TIMEOUT_MS: number;
|
|
82
|
+
export declare const QUOTA_CACHE_TTL_MS: number;
|
|
83
|
+
export declare const CATALOG_CACHE_TTL_MS: number;
|
|
84
|
+
/** Output cap used when neither the registry nor the live catalog states one. */
|
|
85
|
+
export declare const DEFAULT_MAX_TOKENS = 32768;
|
|
86
|
+
export declare const DEFAULT_CONTEXT_WINDOW = 262144;
|
|
87
|
+
export declare const STREAM_IDLE_TIMEOUT_MS = 300000;
|
|
88
|
+
export declare const STREAM_IDLE_TIMEOUT_CODE = "LLM_STREAM_IDLE_TIMEOUT";
|
|
89
|
+
/**
|
|
90
|
+
* Resolve the managed OAuth host.
|
|
91
|
+
*
|
|
92
|
+
* The official client lets an environment variable pin the host for testing or
|
|
93
|
+
* for a private deployment; the region then supplies the default.
|
|
94
|
+
*/
|
|
95
|
+
export declare function oauthHost(region?: KimiCodeRegion): string;
|
|
96
|
+
/**
|
|
97
|
+
* Resolve the coding API base URL without a trailing slash or version.
|
|
98
|
+
*
|
|
99
|
+
* The official client reads KIMI_CODE_BASE_URL, which already includes /v1;
|
|
100
|
+
* this plugin keeps the prefix separate so both dialects can be built from one
|
|
101
|
+
* value. An override that carries /v1 has it stripped exactly once.
|
|
102
|
+
*/
|
|
103
|
+
export declare function codingBaseUrl(region?: KimiCodeRegion): string;
|
|
104
|
+
/** OpenAI-compatible request URL for one endpoint suffix. */
|
|
105
|
+
export declare function openAIUrl(suffix: string, region?: KimiCodeRegion): string;
|
|
106
|
+
/** Anthropic-compatible request URL for one endpoint suffix, such as /v1/messages. */
|
|
107
|
+
export declare function anthropicUrl(suffix: string, region?: KimiCodeRegion): string;
|
|
108
|
+
/**
|
|
109
|
+
* Path the Anthropic-compatible Messages endpoint is posted to.
|
|
110
|
+
*
|
|
111
|
+
* The managed service exposes its Anthropic surface behind the beta gateway,
|
|
112
|
+
* exactly as the official client's `client.beta.messages.create` call does.
|
|
113
|
+
*/
|
|
114
|
+
export declare const ANTHROPIC_MESSAGES_PATH = "/v1/messages?beta=true";
|
|
115
|
+
/** Anthropic protocol revision the managed service documents. */
|
|
116
|
+
export declare const ANTHROPIC_VERSION = "2023-06-01";
|
|
117
|
+
/**
|
|
118
|
+
* Which wire dialect a model id is served over.
|
|
119
|
+
*
|
|
120
|
+
* The managed service speaks both protocols for every model, so the choice is a
|
|
121
|
+
* client preference rather than a per-model constraint. The OpenAI dialect is
|
|
122
|
+
* the default because that is what the official CLI configures for the managed
|
|
123
|
+
* provider.
|
|
124
|
+
*/
|
|
125
|
+
export declare function wireForModel(_modelId: string): KimiCodeWire;
|
|
126
|
+
/** Thinking levels one model advertises, from the static registry. */
|
|
127
|
+
export declare function reasoningEffortsFor(modelId: string): string[];
|
|
128
|
+
/**
|
|
129
|
+
* Accepted request modalities for one model.
|
|
130
|
+
*
|
|
131
|
+
* An unknown model falls back to text-only, matching the sibling routes: DSH
|
|
132
|
+
* turns a false "no images" into a visible placeholder the user can correct,
|
|
133
|
+
* while a false "images accepted" sends bytes to an endpoint that rejects the
|
|
134
|
+
* whole request.
|
|
135
|
+
*/
|
|
136
|
+
export declare function inputModalitiesFor(modelId: string): Array<'text' | 'image' | 'video'>;
|
|
137
|
+
/**
|
|
138
|
+
* Room a request must leave below its context window.
|
|
139
|
+
*
|
|
140
|
+
* The service rejects a request whose prompt plus requested output exceeds the
|
|
141
|
+
* model's window ("Your request exceeded model token limit: 262144"), so the
|
|
142
|
+
* output cap is derived from the window rather than fixed. 4,096 tokens is the
|
|
143
|
+
* headroom reserved for the prompt on a request that declares no size — the same
|
|
144
|
+
* shape the official client's completion budgeting uses.
|
|
145
|
+
*/
|
|
146
|
+
export declare const CONTEXT_HEADROOM_TOKENS = 4096;
|
|
147
|
+
/**
|
|
148
|
+
* Output cap one request asks for when the caller omits one.
|
|
149
|
+
*
|
|
150
|
+
* The K3 family reasons by default and `reasoning_content` is billed as output,
|
|
151
|
+
* so a fixed 32K cap silently truncates a long `max`-effort turn mid-thought and
|
|
152
|
+
* returns a `length` finish — the official client instead caps output at the
|
|
153
|
+
* model's context window (clamped to window − prompt). The declared floor is
|
|
154
|
+
* kept as a minimum so a small window cannot starve the answer.
|
|
155
|
+
*/
|
|
156
|
+
export declare function maxOutputTokensFor(modelId: string, contextWindow?: number): number;
|
|
157
|
+
/**
|
|
158
|
+
* Reduce the requested output cap so prompt + output fit the window.
|
|
159
|
+
*
|
|
160
|
+
* `estimatedInputTokens` is the caller's own size estimate; when it is absent
|
|
161
|
+
* the cap is left alone rather than guessed at, because under-asking truncates
|
|
162
|
+
* reasoning while over-asking is rejected outright — the service is the final
|
|
163
|
+
* authority and only it knows the real prompt size.
|
|
164
|
+
*/
|
|
165
|
+
export declare function clampOutputToContext(requested: number, contextWindow: number, estimatedInputTokens?: number): number;
|
|
166
|
+
/** Reasoning levels the whole route understands, for route-level validation. */
|
|
167
|
+
export declare function isKimiCodeReasoningEffort(value: unknown): value is KimiCodeReasoningEffort;
|
|
168
|
+
/** Context window used before the live catalog has answered. */
|
|
169
|
+
export declare const FALLBACK_MODELS: ReadonlyArray<{
|
|
170
|
+
id: string;
|
|
171
|
+
name: string;
|
|
172
|
+
contextWindow: number;
|
|
173
|
+
}>;
|
|
174
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/host/kimi-code/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAGhH,eAAO,MAAM,WAAW,cAAc,CAAA;AACtC,eAAO,MAAM,aAAa,cAAc,CAAA;AAExC;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,yCAAyC,CAAA;AAEzE,+EAA+E;AAC/E,eAAO,MAAM,kBAAkB,0BAA0B,CAAA;AAEzD,4DAA4D;AAC5D,eAAO,MAAM,yBAAyB,oCAAoC,CAAA;AAC1E,wFAAwF;AACxF,eAAO,MAAM,gBAAgB,qBAAqB,CAAA;AAClD,2DAA2D;AAC3D,eAAO,MAAM,sBAAsB,iDAAiD,CAAA;AAEpF,6EAA6E;AAC7E,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,cAAc,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CASlF,CAAA;AAED,qEAAqE;AACrE,eAAO,MAAM,iBAAiB,QAAQ,CAAA;AAEtC,eAAO,MAAM,UAAU,qFAAqF,CAAA;AAE5G;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,kBAAkB,CAAA;AAC3C,eAAO,MAAM,mBAAmB,mBAAmB,CAAA;AACnD,eAAO,MAAM,kBAAkB,kBAAkB,CAAA;AACjD,eAAO,MAAM,sBAAsB,sBAAsB,CAAA;AACzD,eAAO,MAAM,uBAAuB,uBAAuB,CAAA;AAC3D,eAAO,MAAM,qBAAqB,qBAAqB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EAAiE;AACjE,eAAO,MAAM,iBAAiB,eAAe,CAAA;AAE7C;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAE3D;AAED,sEAAsE;AACtE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAE7D;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,CAKrF;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,OAAQ,CAAA;AAE5C;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAKlF;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,oBAAoB,CAAC,EAAE,MAAM,GAC5B,MAAM,CAKR;AAED,gFAAgF;AAChF,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,uBAAuB,CAE1F;AAED,gEAAgE;AAChE,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CACY,CAAA"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only diagnostic probe for the child→parent subagent relay.
|
|
3
|
+
*
|
|
4
|
+
* The probe answers one question with evidence: when a continuable child tells
|
|
5
|
+
* its parent it finished (`send_message` or the runtime settlement notice),
|
|
6
|
+
* what did the parent's side actually do — was the message inserted into the
|
|
7
|
+
* inbox, claimed, turned into a model request, and did that turn produce any
|
|
8
|
+
* visible content? It observes durable session events plus the live Agent
|
|
9
|
+
* snapshot and writes metadata-only lines: never prompt text, never file
|
|
10
|
+
* contents, never credentials. The only message text it copies is a bounded
|
|
11
|
+
* excerpt of a tool result that matches a known delivery-failure marker.
|
|
12
|
+
*
|
|
13
|
+
* It is inert unless {@link RELAY_PROBE_ENV} is truthy, it never throws into the
|
|
14
|
+
* host (a diagnostic must not break the deployment), and it writes nothing but
|
|
15
|
+
* the log file.
|
|
16
|
+
*
|
|
17
|
+
* @module dsh-chatgpt-subscription/relay-probe
|
|
18
|
+
*/
|
|
19
|
+
/** Environment switch: any of `1`, `true`, `yes`, `on` enables the probe. */
|
|
20
|
+
export declare const RELAY_PROBE_ENV = "DSH_CHATGPT_SUBSCRIPTION_RELAY_PROBE";
|
|
21
|
+
/** Environment override for the log path (default `$DSH_HOME/relay-probe.log`). */
|
|
22
|
+
export declare const RELAY_PROBE_FILE_ENV = "DSH_CHATGPT_SUBSCRIPTION_RELAY_PROBE_FILE";
|
|
23
|
+
/** Default log file name inside the DSH home. */
|
|
24
|
+
export declare const RELAY_PROBE_FILE_NAME = "relay-probe.log";
|
|
25
|
+
/** A probe log is truncated once it grows past this size. */
|
|
26
|
+
export declare const RELAY_PROBE_MAX_BYTES: number;
|
|
27
|
+
/** Message source kinds that cross the child→parent delivery boundary. */
|
|
28
|
+
export declare const RELAY_SOURCE_KINDS: readonly string[];
|
|
29
|
+
/** One Session as this probe reads it. */
|
|
30
|
+
export interface ProbeSession {
|
|
31
|
+
readonly id: string;
|
|
32
|
+
/** A real Session header carries many more fields; only two are read here. */
|
|
33
|
+
readonly header?: {
|
|
34
|
+
readonly origin?: unknown;
|
|
35
|
+
readonly parentSession?: unknown;
|
|
36
|
+
readonly [key: string]: unknown;
|
|
37
|
+
} | undefined;
|
|
38
|
+
}
|
|
39
|
+
/** One durable session event as this probe reads it. */
|
|
40
|
+
export interface ProbeEvent {
|
|
41
|
+
readonly type?: unknown;
|
|
42
|
+
readonly seq?: unknown;
|
|
43
|
+
readonly data?: unknown;
|
|
44
|
+
}
|
|
45
|
+
/** Live Agent fields this probe snapshots (never mutated). */
|
|
46
|
+
export interface ProbeAgent {
|
|
47
|
+
readonly status?: unknown;
|
|
48
|
+
readonly inbox?: {
|
|
49
|
+
readonly nextStep?: readonly unknown[];
|
|
50
|
+
readonly nextTurn?: readonly unknown[];
|
|
51
|
+
} | undefined;
|
|
52
|
+
}
|
|
53
|
+
/** Registry lookup for the live Agent behind a Session id. */
|
|
54
|
+
export interface AgentsLookup {
|
|
55
|
+
get(id: string): ProbeAgent | undefined;
|
|
56
|
+
}
|
|
57
|
+
/** Where probe lines go. */
|
|
58
|
+
export interface RelayProbeSink {
|
|
59
|
+
write(line: string): void;
|
|
60
|
+
}
|
|
61
|
+
/** Construction inputs for {@link RelayProbe}. */
|
|
62
|
+
export interface RelayProbeOptions {
|
|
63
|
+
readonly sink: RelayProbeSink;
|
|
64
|
+
readonly agents?: AgentsLookup | undefined;
|
|
65
|
+
readonly clock?: (() => number) | undefined;
|
|
66
|
+
readonly maxObservedSessions?: number | undefined;
|
|
67
|
+
}
|
|
68
|
+
/** The Context surface {@link installRelayProbe} needs. */
|
|
69
|
+
export interface RelayProbeContext {
|
|
70
|
+
on(event: 'session/event', listener: (session: ProbeSession, event: ProbeEvent) => void): unknown;
|
|
71
|
+
get?(name: string): unknown;
|
|
72
|
+
logger?: {
|
|
73
|
+
info(message: string): void;
|
|
74
|
+
} | undefined;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Observes delivery boundaries and the parent turns they should produce.
|
|
78
|
+
*
|
|
79
|
+
* Every method is fail-open: an unexpected shape is dropped, never thrown.
|
|
80
|
+
*/
|
|
81
|
+
export declare class RelayProbe {
|
|
82
|
+
private readonly options;
|
|
83
|
+
private readonly observed;
|
|
84
|
+
private readonly started;
|
|
85
|
+
private readonly clock;
|
|
86
|
+
private readonly maxObserved;
|
|
87
|
+
private seen;
|
|
88
|
+
/** Count of observations dropped by the fail-open boundary. */
|
|
89
|
+
failures: number;
|
|
90
|
+
constructor(options: RelayProbeOptions);
|
|
91
|
+
/** Observe one durable session event. */
|
|
92
|
+
observe(session: ProbeSession, event: ProbeEvent): void;
|
|
93
|
+
private step;
|
|
94
|
+
/** A delivery entering (or leaving) the parent's inbox. */
|
|
95
|
+
private onSplice;
|
|
96
|
+
/** A message committed to the session surface — for a relay, the claim. */
|
|
97
|
+
private onUserMessage;
|
|
98
|
+
/** A child attempting to report to its parent. */
|
|
99
|
+
private onToolCall;
|
|
100
|
+
/** A tool result that may be a refused delivery. */
|
|
101
|
+
private onToolResult;
|
|
102
|
+
private toolResultText;
|
|
103
|
+
private observedRequest;
|
|
104
|
+
private turnReason;
|
|
105
|
+
private formTag;
|
|
106
|
+
/** Live snapshot of the Agent behind this Session, when it is resident. */
|
|
107
|
+
private agentState;
|
|
108
|
+
private pending;
|
|
109
|
+
private watch;
|
|
110
|
+
private line;
|
|
111
|
+
/** One startup line so a captured file says which process wrote it. */
|
|
112
|
+
head(path: string): void;
|
|
113
|
+
/** Sessions currently under observation. */
|
|
114
|
+
get observedCount(): number;
|
|
115
|
+
/** Event sequence number of the last observed event, when present. */
|
|
116
|
+
mark(seq: unknown): void;
|
|
117
|
+
/** Last observed durable sequence number, when the log carried one. */
|
|
118
|
+
get lastSeq(): number | undefined;
|
|
119
|
+
}
|
|
120
|
+
/** Where the probe reads a fallback value from, beside the process environment. */
|
|
121
|
+
export interface RelayProbeEnvOptions {
|
|
122
|
+
/**
|
|
123
|
+
* An env-file consulted after the process environment. Defaults to no file so
|
|
124
|
+
* a caller (or a test) never reads configuration behind the injected
|
|
125
|
+
* environment's back; {@link relayProbeEnvFile} names the deployment default.
|
|
126
|
+
*/
|
|
127
|
+
readonly envFile?: string | null;
|
|
128
|
+
/** DSH home used for the default log path and env file. */
|
|
129
|
+
readonly home?: string;
|
|
130
|
+
}
|
|
131
|
+
/** The deployment's env file, `$DSH_HOME/.env`, as the proxy settings already read it. */
|
|
132
|
+
export declare function relayProbeEnvFile(home?: string): string;
|
|
133
|
+
/**
|
|
134
|
+
* Read one probe key from the process environment, then from the env file.
|
|
135
|
+
* The key is always one of this module's own constants, so it is safe to
|
|
136
|
+
* interpolate into the lookup pattern.
|
|
137
|
+
* @param key - constant probe key.
|
|
138
|
+
* @param env - environment to read first.
|
|
139
|
+
* @param options - optional env-file fallback and DSH home.
|
|
140
|
+
* @returns the trimmed value, or undefined when neither source sets one.
|
|
141
|
+
*/
|
|
142
|
+
export declare function relayProbeEnvValue(key: string, env: Record<string, string | undefined>, options?: RelayProbeEnvOptions): string | undefined;
|
|
143
|
+
/** Whether the environment enables the probe. */
|
|
144
|
+
export declare function relayProbeEnabled(env?: Record<string, string | undefined>, options?: RelayProbeEnvOptions): boolean;
|
|
145
|
+
/** Resolve the probe log path from the environment. */
|
|
146
|
+
export declare function relayProbeLogPath(env?: Record<string, string | undefined>, options?: RelayProbeEnvOptions): string;
|
|
147
|
+
/** Append-only file sink that truncates itself past a size cap. */
|
|
148
|
+
export declare function createFileRelayProbeSink(options: {
|
|
149
|
+
path: string;
|
|
150
|
+
maxBytes?: number;
|
|
151
|
+
}): RelayProbeSink;
|
|
152
|
+
/**
|
|
153
|
+
* Subscribe the probe to durable session events.
|
|
154
|
+
* @param ctx - host context (or its probe-facing subset).
|
|
155
|
+
* @param options - sink, optional agent lookup, and optional clock.
|
|
156
|
+
* @returns the disposer that detaches the listener.
|
|
157
|
+
*/
|
|
158
|
+
export declare function installRelayProbe(ctx: RelayProbeContext, options: RelayProbeOptions & {
|
|
159
|
+
path?: string;
|
|
160
|
+
}): () => void;
|
|
161
|
+
//# sourceMappingURL=relay-probe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-probe.d.ts","sourceRoot":"","sources":["../../../src/host/relay-probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,6EAA6E;AAC7E,eAAO,MAAM,eAAe,yCAAyC,CAAA;AAErE,mFAAmF;AACnF,eAAO,MAAM,oBAAoB,8CAA8C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eAAe,CAAC,EAAE,MAAM,oBAAoB,GAAG,IAAI,CAAA;IACnD,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAA;IACxB,gBAAgB,CAAC,EAAE,MAAM,qBAAqB,GAAG,IAAI,CAAA;CACtD;AAED,qBAAa,eAAe;IAQxB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAR9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAW;IACnC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAY;IACjD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAmC;IACnE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IACxC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAoC;gBAGlD,KAAK,EAAE,YAAY,EACnB,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC,EAChH,OAAO,GAAE,sBAA2B;IAUtC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAsB;IAE9C,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,aAAa,CAAC,WAAW,CAAC;YA6CrD,IAAI;YAYJ,OAAO;CAsBtB;AAWD,wBAAuB,oBAAoB,CACzC,QAAQ,EAAE,QAAQ,EAClB,MAAM,CAAC,EAAE,WAAW,EACpB,qBAAqB,GAAE,WAAW,CAAC,MAAM,CAAa,GACrD,aAAa,CAAC,WAAW,CAAC,CAwQ5B"}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export interface Config {
|
|
|
20
20
|
export declare const Config: z<Config>;
|
|
21
21
|
export declare const inject: string[];
|
|
22
22
|
export declare function apply(ctx: Context, pluginConfig?: Config): void;
|
|
23
|
+
export { RELAY_PROBE_ENV, RELAY_PROBE_FILE_ENV, RELAY_PROBE_FILE_NAME, RELAY_PROBE_MAX_BYTES, RELAY_SOURCE_KINDS, RelayProbe, createFileRelayProbeSink, installRelayProbe, relayProbeEnabled, relayProbeEnvFile, relayProbeEnvValue, relayProbeLogPath, } from './host/relay-probe.ts';
|
|
24
|
+
export type { AgentsLookup, ProbeAgent, ProbeEvent, ProbeSession, RelayProbeContext, RelayProbeOptions, RelayProbeSink, } from './host/relay-probe.ts';
|
|
23
25
|
export { ProxyManager, detectSystemProxy } from './host/proxy-manager.ts';
|
|
24
26
|
export { SUBAGENT_MODEL_SELECTION_NAMESPACE, SUBAGENT_POLICY_EVENT, authorizedRoutesFor, createSubagentAuthorization, delegationDenialReason, installSubagentModelAuthorization, normalizeDelegationToolNames, parseAllowedRoutes, policyRoutesOf, subagentModelSelectionPreference, unauthorizedRouteReason, validateAuthorizationScope, validateDelegationToolNames, } from './host/subagent-model-authorization.ts';
|
|
25
27
|
export { OAuthService } from './host/oauth-service.ts';
|
|
@@ -36,6 +38,17 @@ export { LinuxFileTokenStore } from './host/token-store-linux.ts';
|
|
|
36
38
|
export { WindowsDpapiTokenStore } from './host/token-store-windows.ts';
|
|
37
39
|
export type { TokenStore, StoredOAuthCredentials } from './host/token-store.ts';
|
|
38
40
|
export { AntigravityAdapter } from './host/antigravity/adapter.ts';
|
|
41
|
+
export { CommandCodeAdapter } from './host/command-code/adapter.ts';
|
|
42
|
+
export { FileCredentialStore as CommandCodeCredentialStore, FileModelSettingsStore as CommandCodeModelSettingsStore, credentialPath as commandCodeCredentialPath, modelSettingsPath as commandCodeModelSettingsPath, registerCommandCodePreferenceStore, } from './host/command-code/token-store.ts';
|
|
43
|
+
export { beginWebLogin as startCommandCodeLogin, getWebLoginStatus as getCommandCodeLoginStatus, saveApiKey as saveCommandCodeApiKey, } from './host/command-code/oauth.ts';
|
|
44
|
+
export { getCommandCodeWebStatus, registerCommandCodeRoutes } from './host/command-code/routes.ts';
|
|
45
|
+
export { fetchAccountQuota as fetchCommandCodeQuota, clearCachedQuota as clearCommandCodeQuota, getCachedQuota as getCommandCodeQuota, loadProviderModels as loadCommandCodeModels, } from './host/command-code/client.ts';
|
|
46
|
+
export { KimiCodeAdapter, classifyKimiFailure, KIMI_CODE_RETRY_POLICY_CONFIG } from './host/kimi-code/adapter.ts';
|
|
47
|
+
export { FileCredentialStore as KimiCodeCredentialStore, FileModelSettingsStore as KimiCodeModelSettingsStore, credentialPath as kimiCodeCredentialPath, modelSettingsPath as kimiCodeModelSettingsPath, registerKimiCodePreferenceStore, resolveRegion as resolveKimiCodeRegion, } from './host/kimi-code/token-store.ts';
|
|
48
|
+
export { beginWebLogin as beginKimiCodeLogin, ensureAccessToken as ensureKimiCodeAccessToken, getWebLoginStatus as getKimiCodeLoginStatus, refreshAccessToken as refreshKimiCodeToken, requestDeviceAuthorization as requestKimiCodeDeviceAuthorization, } from './host/kimi-code/oauth.ts';
|
|
49
|
+
export { fetchAccountQuota as fetchKimiCodeQuota, fetchUserInfo as fetchKimiCodeUserInfo, loadProviderModels as loadKimiCodeModels, clearCachedQuota as clearKimiCodeQuota, getCachedQuota as getKimiCodeQuota, } from './host/kimi-code/client.ts';
|
|
50
|
+
export { getKimiCodeWebStatus, registerKimiCodeRoutes } from './host/kimi-code/routes.ts';
|
|
51
|
+
export { KIMI_CODE_MODELS, kimiCodeModelDef, } from './host/kimi-code/model-catalog.ts';
|
|
39
52
|
export { FileCredentialStore, FileModelSettingsStore, credentialPath, modelSettingsPath, } from './host/antigravity/token-store.ts';
|
|
40
53
|
export { loginAndSave, beginWebLogin, refreshAntigravityToken } from './host/antigravity/oauth.ts';
|
|
41
54
|
export { clearCachedQuota, fetchAccountQuota, getCachedQuota } from './host/antigravity/client.ts';
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,CAAC,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"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