dsh-coding-subscription-oauth 0.6.5 → 0.7.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 +13 -2
- package/CONTRIBUTING.md +1 -1
- package/INSTALL.md +12 -8
- package/README.de.md +5 -5
- package/README.es.md +5 -5
- package/README.fr.md +5 -5
- package/README.ja.md +5 -5
- package/README.ko.md +5 -5
- package/README.md +7 -6
- package/README.pt-BR.md +5 -5
- package/README.ru.md +5 -5
- package/README.zh-CN.md +7 -6
- package/compatibility/dsh-bom.json +8 -2
- package/docs/00-project-rules.md +3 -2
- package/docs/02-architecture.md +5 -5
- package/docs/02-architecture.zh-CN.md +5 -5
- package/lib/auth-routes.d.ts +10 -1
- package/lib/auth-routes.d.ts.map +1 -1
- package/lib/bin.js +483 -50
- package/lib/bin.js.map +4 -4
- package/lib/client.js +5 -5
- package/lib/client.js.map +4 -4
- package/lib/compatibility.d.ts +0 -1
- package/lib/compatibility.d.ts.map +1 -1
- package/lib/gateway-protocol.d.ts +3 -3
- package/lib/gateway-protocol.d.ts.map +1 -1
- package/lib/grok-errors.d.ts +2 -2
- package/lib/grok-errors.d.ts.map +1 -1
- package/lib/http-json.d.ts +2 -2
- package/lib/http-json.d.ts.map +1 -1
- package/lib/ids.d.ts +4 -0
- package/lib/ids.d.ts.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +677 -163
- package/lib/index.js.map +4 -4
- package/lib/kimi-errors.d.ts +2 -2
- package/lib/kimi-errors.d.ts.map +1 -1
- package/lib/oauth-session.d.ts +2 -0
- package/lib/oauth-session.d.ts.map +1 -1
- package/lib/session.d.ts +2 -0
- package/lib/session.d.ts.map +1 -1
- package/lib/store.d.ts +73 -1
- package/lib/store.d.ts.map +1 -1
- package/package.json +6 -8
- package/lib/runtime/gateway-protocol.d.ts +0 -47
- package/lib/runtime/gateway-protocol.d.ts.map +0 -1
- package/lib/runtime/grok-errors.d.ts +0 -13
- package/lib/runtime/grok-errors.d.ts.map +0 -1
- package/lib/runtime/http-json.d.ts +0 -10
- package/lib/runtime/http-json.d.ts.map +0 -1
- package/lib/runtime/kimi-errors.d.ts +0 -13
- package/lib/runtime/kimi-errors.d.ts.map +0 -1
package/lib/kimi-errors.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/** Compatibility facade — implementation lives in `
|
|
2
|
-
export { isMisclassifiedContextWindowError, remapAuthFailureIfContextOverflow, } from "
|
|
1
|
+
/** Compatibility facade — implementation lives in published `dsh-coding-oauth-core`. */
|
|
2
|
+
export { isMisclassifiedContextWindowError, remapAuthFailureIfContextOverflow, } from "dsh-coding-oauth-core/kimi-errors";
|
|
3
3
|
//# sourceMappingURL=kimi-errors.d.ts.map
|
package/lib/kimi-errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kimi-errors.d.ts","sourceRoot":"","sources":["../../src/kimi-errors.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"kimi-errors.d.ts","sourceRoot":"","sources":["../../src/kimi-errors.ts"],"names":[],"mappings":"AAAA,wFAAwF;AAExF,OAAO,EACN,iCAAiC,EACjC,iCAAiC,GACjC,MAAM,mCAAmC,CAAC"}
|
package/lib/oauth-session.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export declare class OAuthProviderSession {
|
|
|
33
33
|
* Called after an upstream 401 rejected a locally-valid token.
|
|
34
34
|
*/
|
|
35
35
|
invalidateAccessToken(): Promise<void>;
|
|
36
|
+
/** Refresh host discovery after an account switch/remove without a full logout. */
|
|
37
|
+
notifyCredentialChange(): void;
|
|
36
38
|
storedCredential(): Promise<OAuthCredential | undefined>;
|
|
37
39
|
logout(): Promise<void>;
|
|
38
40
|
private writeCache;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-session.d.ts","sourceRoot":"","sources":["../../src/oauth-session.ts"],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AAI,KAAK,CAAC,GAAG,CAAC,EAAE;IAS7B,QAAQ,IAAI,QAAQ;IAId,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAQjC,iBAAiB,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxD,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAMtC,KAAK,CAAC,WAAW,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;IAMxD,kBAAkB,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAOvD;;;OAGG;IACG,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5C,mFAAmF;IACnF,sBAAsB,IAAI,IAAI;IAIxB,gBAAgB,IAAI,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAKxD,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;YAaf,UAAU;CAWxB"}
|
package/lib/session.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ export declare class GrokBuildSession {
|
|
|
34
34
|
* Called after an upstream 401 rejected a locally-valid token.
|
|
35
35
|
*/
|
|
36
36
|
invalidateAccessToken(): Promise<void>;
|
|
37
|
+
/** Refresh host discovery after an account switch/remove without a full logout. */
|
|
38
|
+
notifyCredentialChange(): void;
|
|
37
39
|
logout(): Promise<void>;
|
|
38
40
|
private writeCache;
|
|
39
41
|
}
|
package/lib/session.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/session.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjF,OAAO,EACN,KAAK,aAAa,EAKlB,MAAM,cAAc,CAAC;AAItB,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAsDtD,4EAA4E;AAC5E,qBA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
2
|
* Owner-only persistent OAuth credential storage for coding-subscription routes.
|
|
3
3
|
* @module dsh-coding-subscription-oauth/store
|
|
4
4
|
*/
|
|
5
|
-
import type { Credential, CredentialInfo, CredentialStore } from "@earendil-works/pi-ai";
|
|
5
|
+
import type { Credential, CredentialInfo, CredentialStore, OAuthCredential } from "@earendil-works/pi-ai";
|
|
6
|
+
/** On-disk multi-account format. Readers still accept v1 and migrate under lock. */
|
|
7
|
+
declare const AUTH_FORMAT_VERSION: 2;
|
|
8
|
+
/** Operator-owned account hard cap (Settings + store). Aligned with Hub. */
|
|
9
|
+
export declare const OAUTH_MAX_ACCOUNTS = 8;
|
|
10
|
+
/** How a login or import writes into the multi-account document. */
|
|
11
|
+
export type LoginPersistMode = "add" | "overwrite-active";
|
|
12
|
+
export interface LoginPersistOptions {
|
|
13
|
+
mode: LoginPersistMode;
|
|
14
|
+
confirmOverwrite?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** Non-empty account id; max 128; restricted charset for path-safe operator labels. */
|
|
17
|
+
export type AccountId = string;
|
|
18
|
+
export interface AccountRecord {
|
|
19
|
+
id: AccountId;
|
|
20
|
+
label?: string;
|
|
21
|
+
credential: OAuthCredential;
|
|
22
|
+
createdAt: number;
|
|
23
|
+
}
|
|
24
|
+
export interface AuthDocumentV2 {
|
|
25
|
+
version: typeof AUTH_FORMAT_VERSION;
|
|
26
|
+
activeAccountId: AccountId;
|
|
27
|
+
accounts: AccountRecord[];
|
|
28
|
+
}
|
|
29
|
+
/** Non-secret row for Settings account lists. Never includes tokens. */
|
|
30
|
+
export interface AccountSummary {
|
|
31
|
+
id: AccountId;
|
|
32
|
+
label?: string;
|
|
33
|
+
expires: number;
|
|
34
|
+
accountId?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function isValidAccountId(value: unknown): value is AccountId;
|
|
37
|
+
/**
|
|
38
|
+
* Prefer provider `credential.accountId` when path-safe; otherwise mint a unique
|
|
39
|
+
* operator id so multiple anonymous logins do not collide on `legacy`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveAccountIdForCredential(credential: OAuthCredential): AccountId;
|
|
6
42
|
/** Resolve one private OAuth document path beneath DSH_HOME. */
|
|
7
43
|
export declare function oauthCredentialPath(basename: string, dshHome?: string): string;
|
|
8
44
|
/** Resolve the legacy Grok Build OAuth document path. */
|
|
@@ -10,11 +46,14 @@ export declare function grokBuildAuthPath(dshHome?: string): string;
|
|
|
10
46
|
/**
|
|
11
47
|
* File-backed pi-ai store scoped to exactly one provider id. Separate provider
|
|
12
48
|
* files prevent one corrupted or rotated credential from affecting another.
|
|
49
|
+
* On disk the file may hold up to eight operator-owned accounts; CredentialStore
|
|
50
|
+
* methods always project the active account only.
|
|
13
51
|
*/
|
|
14
52
|
export declare class OAuthCredentialFileStore implements CredentialStore {
|
|
15
53
|
readonly providerId: string;
|
|
16
54
|
private readonly label;
|
|
17
55
|
readonly filename: string;
|
|
56
|
+
private loginPersist;
|
|
18
57
|
constructor(providerId: string, filename: string, label: string);
|
|
19
58
|
private readCurrent;
|
|
20
59
|
/**
|
|
@@ -23,11 +62,22 @@ export declare class OAuthCredentialFileStore implements CredentialStore {
|
|
|
23
62
|
* Unsafe/symlink/wrong-owner/too-large files still throw.
|
|
24
63
|
*/
|
|
25
64
|
private loadCurrent;
|
|
65
|
+
private loadDocument;
|
|
26
66
|
/** Refuse a dest that became unsafe after the lock was taken and before rename. */
|
|
27
67
|
private assertDestinationReplaceable;
|
|
68
|
+
private writeDocument;
|
|
69
|
+
private nextDocumentAfterLogin;
|
|
70
|
+
private mutateDocument;
|
|
28
71
|
read(providerId: string): Promise<Credential | undefined>;
|
|
29
72
|
list(): Promise<readonly CredentialInfo[]>;
|
|
30
73
|
modify(providerId: string, fn: (current: Credential | undefined) => Promise<Credential | undefined>): Promise<Credential | undefined>;
|
|
74
|
+
/**
|
|
75
|
+
* Redirect `modify` writes (pi-ai `models.login`) through multi-account upsert
|
|
76
|
+
* semantics for the duration of `fn`.
|
|
77
|
+
*/
|
|
78
|
+
runLoginPersist<T>(options: LoginPersistOptions, fn: () => Promise<T>): Promise<T>;
|
|
79
|
+
/** Persist a login/import credential without going through pi-ai `modify`. */
|
|
80
|
+
persistLoginCredential(credential: OAuthCredential, options: LoginPersistOptions): Promise<void>;
|
|
31
81
|
/**
|
|
32
82
|
* Force the next `getAuth()` to refresh by backdating `expires` into the past.
|
|
33
83
|
* Used after an upstream 401: the stored access token was rejected even though
|
|
@@ -38,9 +88,31 @@ export declare class OAuthCredentialFileStore implements CredentialStore {
|
|
|
38
88
|
*/
|
|
39
89
|
invalidate(providerId: string): Promise<boolean>;
|
|
40
90
|
delete(providerId: string): Promise<void>;
|
|
91
|
+
/** Read-only account list for Settings / API. Never includes tokens. */
|
|
92
|
+
listAccounts(): Promise<readonly AccountSummary[]>;
|
|
93
|
+
getActiveAccountId(): Promise<string | undefined>;
|
|
94
|
+
/**
|
|
95
|
+
* Read one account's credential without changing activeAccountId.
|
|
96
|
+
* Used by the optional quota-aware pool proxy for sticky per-request routing.
|
|
97
|
+
*/
|
|
98
|
+
readAccount(id: string): Promise<OAuthCredential | undefined>;
|
|
99
|
+
/**
|
|
100
|
+
* Serialized refresh/write for one account id. Does not move activeAccountId.
|
|
101
|
+
* Returns undefined when the account is absent (caller treats as missing credential).
|
|
102
|
+
*/
|
|
103
|
+
modifyAccount(id: string, fn: (current: Credential | undefined) => Promise<Credential | undefined>): Promise<Credential | undefined>;
|
|
104
|
+
setActiveAccount(id: string): Promise<void>;
|
|
105
|
+
upsertAccount(input: {
|
|
106
|
+
id: string;
|
|
107
|
+
label?: string;
|
|
108
|
+
credential: OAuthCredential;
|
|
109
|
+
makeActive?: boolean;
|
|
110
|
+
}): Promise<void>;
|
|
111
|
+
removeAccount(id: string): Promise<void>;
|
|
41
112
|
}
|
|
42
113
|
/** Legacy-named store retained for existing imports and credential migration. */
|
|
43
114
|
export declare class GrokBuildCredentialStore extends OAuthCredentialFileStore {
|
|
44
115
|
constructor(filename?: string);
|
|
45
116
|
}
|
|
117
|
+
export {};
|
|
46
118
|
//# sourceMappingURL=store.d.ts.map
|
package/lib/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAI1G,oFAAoF;AACpF,QAAA,MAAM,mBAAmB,EAAG,CAAU,CAAC;AAEvC,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAMpC,oEAAoE;AACpE,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,kBAAkB,CAAC;AAE1D,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,gBAAgB,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,uFAAuF;AACvF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B,MAAM,WAAW,aAAa;IAC7B,EAAE,EAAE,SAAS,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,eAAe,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC9B,OAAO,EAAE,OAAO,mBAAmB,CAAC;IACpC,eAAe,EAAE,SAAS,CAAC;IAC3B,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC1B;AAED,wEAAwE;AACxE,MAAM,WAAW,cAAc;IAC9B,EAAE,EAAE,SAAS,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,E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kimi Code, Claude Code. Fixes AUTH API key is invalid, INVALID_REPLAY_STATE, grok-4.6 xhigh, Kimi Bearer vs x-api-key.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"scripts": {
|
|
43
43
|
"check:bom": "node build/verify-dsh-bom.mjs",
|
|
44
44
|
"assert:node": "node scripts/assert-node.mjs",
|
|
45
|
-
"assert:
|
|
45
|
+
"assert:oauth-core": "node scripts/assert-oauth-core.mjs",
|
|
46
46
|
"clean": "node build/clean.mjs",
|
|
47
47
|
"typecheck": "tsc -b tsconfig.host.json tsconfig.client.json",
|
|
48
48
|
"build:server": "tsc -p tsconfig.build.json && tsc -p tsconfig.dts-bin.json && node build/build-server.mjs",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"test:watch": "vitest",
|
|
54
54
|
"test:coverage": "vitest run --coverage",
|
|
55
55
|
"lint": "biome check",
|
|
56
|
-
"check:next": "pnpm run assert:node && pnpm run assert:
|
|
57
|
-
"check": "pnpm run assert:node && pnpm run assert:
|
|
56
|
+
"check:next": "pnpm run assert:node && pnpm run assert:oauth-core && pnpm run check:bom && pnpm run lint && pnpm run typecheck && pnpm run test",
|
|
57
|
+
"check": "pnpm run assert:node && pnpm run assert:oauth-core && pnpm run lint && pnpm run release:build && pnpm run test",
|
|
58
58
|
"release:promote": "node build/promote-release.mjs",
|
|
59
59
|
"release:verify": "node build/verify-release.mjs",
|
|
60
60
|
"release:build": "pnpm run build:artifacts && pnpm run release:promote",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"release:publish": "node scripts/release-publish.mjs",
|
|
65
65
|
"verify:deployed": "node scripts/verify-deployed-catalog.mjs",
|
|
66
66
|
"smoke:deployed": "node scripts/smoke-deployed-routes.mjs",
|
|
67
|
+
"smoke:dsh-alpha": "node scripts/smoke-dsh-alpha.mjs",
|
|
67
68
|
"prepack": "pnpm run release:build"
|
|
68
69
|
},
|
|
69
70
|
"exports": {
|
|
@@ -117,7 +118,6 @@
|
|
|
117
118
|
"@deepseek-ai/dsh-atomic-write": "0.1.1-rc.2",
|
|
118
119
|
"@deepseek-ai/dsh-attachment": "0.1.1-rc.2",
|
|
119
120
|
"@deepseek-ai/dsh-client-locale": "0.1.1-rc.2",
|
|
120
|
-
"@deepseek-ai/dsh-client-runtime": "0.1.1-rc.2",
|
|
121
121
|
"@deepseek-ai/dsh-client-ui-settings": "0.1.1-rc.2",
|
|
122
122
|
"@deepseek-ai/dsh-client-ui-slots": "0.1.1-rc.2",
|
|
123
123
|
"@deepseek-ai/dsh-client-web": "0.1.1-rc.2",
|
|
@@ -139,7 +139,6 @@
|
|
|
139
139
|
},
|
|
140
140
|
"client": {
|
|
141
141
|
"inject": [
|
|
142
|
-
"@deepseek-ai/dsh-client-runtime",
|
|
143
142
|
"@deepseek-ai/dsh-client-ui-settings",
|
|
144
143
|
"@deepseek-ai/dsh-client-locale"
|
|
145
144
|
],
|
|
@@ -147,7 +146,7 @@
|
|
|
147
146
|
}
|
|
148
147
|
},
|
|
149
148
|
"dependencies": {
|
|
150
|
-
"dsh-coding-oauth-core": "0.1.
|
|
149
|
+
"dsh-coding-oauth-core": "0.1.2",
|
|
151
150
|
"undici": "7.29.0"
|
|
152
151
|
},
|
|
153
152
|
"peerDependencies": {
|
|
@@ -198,7 +197,6 @@
|
|
|
198
197
|
"@deepseek-ai/dsh-atomic-write": "0.1.1-rc.2",
|
|
199
198
|
"@deepseek-ai/dsh-attachment": "0.1.1-rc.2",
|
|
200
199
|
"@deepseek-ai/dsh-client-locale": "0.1.1-rc.2",
|
|
201
|
-
"@deepseek-ai/dsh-client-runtime": "0.1.1-rc.2",
|
|
202
200
|
"@deepseek-ai/dsh-client-ui-settings": "0.1.1-rc.2",
|
|
203
201
|
"@deepseek-ai/dsh-client-ui-slots": "0.1.1-rc.2",
|
|
204
202
|
"@deepseek-ai/dsh-client-web": "0.1.1-rc.2",
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared request/stream types for the local coding-subscription gateway.
|
|
3
|
-
* @module dsh-coding-oauth-core/gateway-protocol
|
|
4
|
-
*/
|
|
5
|
-
export interface GatewayToolCall {
|
|
6
|
-
id: string;
|
|
7
|
-
name: string;
|
|
8
|
-
arguments: string;
|
|
9
|
-
}
|
|
10
|
-
export interface GatewayTool {
|
|
11
|
-
name: string;
|
|
12
|
-
description: string;
|
|
13
|
-
parameters: Record<string, unknown>;
|
|
14
|
-
}
|
|
15
|
-
export interface GatewayChatMessage {
|
|
16
|
-
role: string;
|
|
17
|
-
content: string;
|
|
18
|
-
tool_calls?: readonly GatewayToolCall[];
|
|
19
|
-
reasoning_content?: string;
|
|
20
|
-
tool_call_id?: string;
|
|
21
|
-
tool_name?: string;
|
|
22
|
-
}
|
|
23
|
-
export interface GatewayCompletionRequest {
|
|
24
|
-
model: string;
|
|
25
|
-
messages: readonly GatewayChatMessage[];
|
|
26
|
-
tools?: readonly GatewayTool[];
|
|
27
|
-
reasoning?: string;
|
|
28
|
-
}
|
|
29
|
-
export type GatewayStreamPart = {
|
|
30
|
-
type: "text";
|
|
31
|
-
text: string;
|
|
32
|
-
} | {
|
|
33
|
-
type: "thinking";
|
|
34
|
-
text: string;
|
|
35
|
-
} | {
|
|
36
|
-
type: "tool_call";
|
|
37
|
-
index: number;
|
|
38
|
-
id: string;
|
|
39
|
-
name: string;
|
|
40
|
-
arguments: string;
|
|
41
|
-
} | {
|
|
42
|
-
type: "done";
|
|
43
|
-
finish: "stop" | "tool_calls" | "length";
|
|
44
|
-
};
|
|
45
|
-
export type GatewayThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
46
|
-
export declare function isThinkingLevel(value: string): value is GatewayThinkingLevel;
|
|
47
|
-
//# sourceMappingURL=gateway-protocol.d.ts.map
|
|
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GAAG,YAAY,GAAG,QAAQ,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAEnG,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,oBAAoB,CAU5E"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* xAI / Grok Build error remapping shared by Hub and Subscription.
|
|
3
|
-
* @module dsh-coding-oauth-core/grok-errors
|
|
4
|
-
*/
|
|
5
|
-
export declare function isXaiCapacityError(detail: string): boolean;
|
|
6
|
-
export declare function remapXaiCapacityFailure(failure: {
|
|
7
|
-
message: string;
|
|
8
|
-
code: string;
|
|
9
|
-
}): {
|
|
10
|
-
message: string;
|
|
11
|
-
code: string;
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=grok-errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grok-errors.d.ts","sourceRoot":"","sources":["../../../src/runtime/grok-errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IACpF,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACb,CAGA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { IncomingMessage } from "node:http";
|
|
2
|
-
export declare const JSON_BODY_LIMIT_BYTES: number;
|
|
3
|
-
export declare class JsonRequestError extends Error {
|
|
4
|
-
readonly statusCode: 400 | 413;
|
|
5
|
-
constructor(statusCode: 400 | 413, message: string);
|
|
6
|
-
}
|
|
7
|
-
/** Read one JSON request body with a strict in-memory ceiling. */
|
|
8
|
-
export declare function readJsonRequest(request: IncomingMessage, limit?: number): Promise<unknown>;
|
|
9
|
-
export declare function requestErrorStatus(error: unknown, fallback: number): number;
|
|
10
|
-
//# sourceMappingURL=http-json.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-json.d.ts","sourceRoot":"","sources":["../../../src/runtime/http-json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,eAAO,MAAM,qBAAqB,QAAY,CAAC;AAE/C,qBAAa,gBAAiB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,UAAU,EAAE,GAAG,GAAG,GAAG,CAAC;gBAEnB,UAAU,EAAE,GAAG,GAAG,GAAG,EAAE,OAAO,EAAE,MAAM;CAKlD;AASD,kEAAkE;AAClE,wBAAgB,eAAe,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,SAAwB,GAAG,OAAO,CAAC,OAAO,CAAC,CAuDzG;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE3E"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Kimi Code error remapping shared by Hub and Subscription.
|
|
3
|
-
* @module dsh-coding-oauth-core/kimi-errors
|
|
4
|
-
*/
|
|
5
|
-
export declare function isMisclassifiedContextWindowError(detail: string): boolean;
|
|
6
|
-
export declare function remapAuthFailureIfContextOverflow(failure: {
|
|
7
|
-
message: string;
|
|
8
|
-
code: string;
|
|
9
|
-
}): {
|
|
10
|
-
message: string;
|
|
11
|
-
code: string;
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=kimi-errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kimi-errors.d.ts","sourceRoot":"","sources":["../../../src/runtime/kimi-errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEzE;AAED,wBAAgB,iCAAiC,CAAC,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAC9F,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACb,CAGA"}
|