@eddyskywalker/dsh-chatgpt-subscription 0.5.0 → 0.6.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 +34 -1
- package/README.md +67 -1
- package/lib/client.js +1566 -222
- package/lib/client.js.map +1 -1
- package/lib/index.js +4882 -1114
- package/lib/types/client/ProviderHubSection.d.ts.map +1 -1
- package/lib/types/client/common/AccountPoolSection.d.ts +14 -0
- package/lib/types/client/common/AccountPoolSection.d.ts.map +1 -1
- package/lib/types/client/index.d.ts +1 -0
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/workbuddy/WorkBuddyComposerQuota.d.ts +26 -0
- package/lib/types/client/workbuddy/WorkBuddyComposerQuota.d.ts.map +1 -0
- package/lib/types/client/workbuddy/WorkBuddySection.d.ts +41 -0
- package/lib/types/client/workbuddy/WorkBuddySection.d.ts.map +1 -0
- package/lib/types/client/workbuddy/locales.d.ts +563 -0
- package/lib/types/client/workbuddy/locales.d.ts.map +1 -0
- package/lib/types/client/workbuddy/styles.d.ts +11 -0
- package/lib/types/client/workbuddy/styles.d.ts.map +1 -0
- package/lib/types/host/common/account-pool.d.ts +18 -0
- package/lib/types/host/common/account-pool.d.ts.map +1 -1
- package/lib/types/host/workbuddy/account-pool.d.ts +106 -0
- package/lib/types/host/workbuddy/account-pool.d.ts.map +1 -0
- package/lib/types/host/workbuddy/adapter.d.ts +97 -0
- package/lib/types/host/workbuddy/adapter.d.ts.map +1 -0
- package/lib/types/host/workbuddy/client.d.ts +90 -0
- package/lib/types/host/workbuddy/client.d.ts.map +1 -0
- package/lib/types/host/workbuddy/mapper.d.ts +114 -0
- package/lib/types/host/workbuddy/mapper.d.ts.map +1 -0
- package/lib/types/host/workbuddy/model-catalog.d.ts +108 -0
- package/lib/types/host/workbuddy/model-catalog.d.ts.map +1 -0
- package/lib/types/host/workbuddy/oauth.d.ts +38 -0
- package/lib/types/host/workbuddy/oauth.d.ts.map +1 -0
- package/lib/types/host/workbuddy/routes.d.ts +33 -0
- package/lib/types/host/workbuddy/routes.d.ts.map +1 -0
- package/lib/types/host/workbuddy/token-store.d.ts +216 -0
- package/lib/types/host/workbuddy/token-store.d.ts.map +1 -0
- package/lib/types/host/workbuddy/types.d.ts +127 -0
- package/lib/types/host/workbuddy/types.d.ts.map +1 -0
- package/lib/types/index.d.ts +5 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/account-pool-contracts.d.ts +8 -0
- package/lib/types/shared/account-pool-contracts.d.ts.map +1 -1
- package/lib/types/shared/workbuddy-contracts.d.ts +204 -0
- package/lib/types/shared/workbuddy-contracts.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import { DEFAULT_CONTEXT_WINDOW, PROVIDER_ID, PROVIDER_NAME } from './types.ts';
|
|
3
|
+
import { FileCredentialStore, FileModelSettingsStore, type WorkBuddyPreferenceStore } from './token-store.ts';
|
|
4
|
+
import { getCachedQuota } from './client.ts';
|
|
5
|
+
import { type WorkBuddyModelEntry } from './model-catalog.ts';
|
|
6
|
+
import type { WorkBuddyModelOption, WorkBuddyWebStatus } from '../../shared/workbuddy-contracts.ts';
|
|
7
|
+
import type { WorkBuddyAccountPool } from './account-pool.ts';
|
|
8
|
+
/**
|
|
9
|
+
* The selection the card should show.
|
|
10
|
+
*
|
|
11
|
+
* A stored list that still equals the shipped default has never been edited, so
|
|
12
|
+
* it cannot know about models the catalog has since added; treating it as
|
|
13
|
+
* "everything this account can call" keeps a first run from hiding models
|
|
14
|
+
* behind an unedited default. Any explicit edit is honoured exactly.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveEnabledModelIds(stored: readonly string[], available: readonly string[], enabled?: boolean): string[];
|
|
17
|
+
/** Build the model options the settings card renders, in catalog order. */
|
|
18
|
+
export declare function buildModelOptions(catalog: readonly WorkBuddyModelEntry[], available: readonly string[], enabledModelIds: readonly string[], overrides: Record<string, number>): WorkBuddyModelOption[];
|
|
19
|
+
export interface WorkBuddyStatusOptions {
|
|
20
|
+
fetchFn?: typeof fetch;
|
|
21
|
+
/** Whether this plugin currently owns the provider route; re-read on every status. */
|
|
22
|
+
serving?: boolean | (() => boolean);
|
|
23
|
+
/** Diagnostic when another plugin owns the provider route; re-read on every status. */
|
|
24
|
+
conflict?: string | null | (() => string | null);
|
|
25
|
+
/** Multi-account pool this line schedules through; absent keeps the single-account card. */
|
|
26
|
+
accountPool?: WorkBuddyAccountPool;
|
|
27
|
+
}
|
|
28
|
+
/** Everything the settings card renders: account, quota, and the model catalog. */
|
|
29
|
+
export declare function getWorkBuddyWebStatus(store: FileCredentialStore, modelSettings: FileModelSettingsStore, preferences?: WorkBuddyPreferenceStore, options?: WorkBuddyStatusOptions): Promise<WorkBuddyWebStatus>;
|
|
30
|
+
/** Register the WorkBuddy settings routes under `/workbuddy/api`. */
|
|
31
|
+
export declare function registerWorkBuddyRoutes(ctx: Context, store: FileCredentialStore, modelSettings: FileModelSettingsStore, preferences?: WorkBuddyPreferenceStore, options?: WorkBuddyStatusOptions): () => void;
|
|
32
|
+
export { PROVIDER_ID, PROVIDER_NAME, DEFAULT_CONTEXT_WINDOW, getCachedQuota, type WorkBuddyModelOption, type WorkBuddyWebStatus, };
|
|
33
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../../src/host/workbuddy/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,EAGL,sBAAsB,EACtB,WAAW,EACX,aAAa,EAEd,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EAEtB,KAAK,wBAAwB,EAC9B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAKL,cAAc,EAIf,MAAM,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EAAE,wBAAwB,EACtC,OAAO,GAAE,sBAA2B,GACnC,MAAM,IAAI,CAiVZ;AAED,OAAO,EACL,WAAW,EACX,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACxB,CAAA"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import type { SettingsProvider } from '@deepseek-ai/dsh-settings';
|
|
2
|
+
import type { WorkBuddyReasoningEffort, WorkBuddyRegion } from '../../shared/workbuddy-contracts.ts';
|
|
3
|
+
import type { CredentialStore } from '../token-store.ts';
|
|
4
|
+
import { isIntlDomain } from './types.ts';
|
|
5
|
+
export declare const WORKBUDDY_PREFERENCES_NAMESPACE = "dsh-workbuddy";
|
|
6
|
+
export type { WorkBuddyReasoningEffort };
|
|
7
|
+
/**
|
|
8
|
+
* One WorkBuddy credential, parsed from a CodeBuddy desktop `*.info` file.
|
|
9
|
+
*
|
|
10
|
+
* These files are the IDE's own credential store, not this plugin's: the plugin
|
|
11
|
+
* reads them so a user who is already signed in to the IDE needs no second
|
|
12
|
+
* login. A refreshed token is written back so both clients stay valid instead of
|
|
13
|
+
* racing each other with a rotating refresh token.
|
|
14
|
+
*/
|
|
15
|
+
export interface WorkBuddyCredentials {
|
|
16
|
+
/** Bearer token for the chat and billing APIs. Host-only. */
|
|
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
|
+
/** Region the account belongs to; decides which backend serves it. */
|
|
23
|
+
region: WorkBuddyRegion;
|
|
24
|
+
/** Auth domain recorded in the file, e.g. `copilot.tencent.com`. */
|
|
25
|
+
domain: string;
|
|
26
|
+
/** Backend base URL derived from {@link domain}. */
|
|
27
|
+
backend: string;
|
|
28
|
+
uid?: string;
|
|
29
|
+
nickname?: string;
|
|
30
|
+
uin?: string;
|
|
31
|
+
accountType?: string;
|
|
32
|
+
enterpriseId?: string;
|
|
33
|
+
/** Absolute path of the `*.info` file this credential came from. */
|
|
34
|
+
sourceFile: string;
|
|
35
|
+
/** File modification time when it was read, so a stale cache is detectable. */
|
|
36
|
+
sourceMtimeMs: number;
|
|
37
|
+
/** Which store owns the secret; only managed credentials may be deleted. */
|
|
38
|
+
source: 'desktop' | 'managed';
|
|
39
|
+
}
|
|
40
|
+
export interface WorkBuddyModelSettings {
|
|
41
|
+
enabled?: boolean;
|
|
42
|
+
enabledModelIds: string[];
|
|
43
|
+
contextWindowOverrides: Record<string, number>;
|
|
44
|
+
defaultReasoningEffort: WorkBuddyReasoningEffort | null;
|
|
45
|
+
/** Stable account key selected by the user; null keeps automatic selection. */
|
|
46
|
+
selectedAccountId: string | null;
|
|
47
|
+
/** Desktop accounts hidden from this plugin without deleting CodeBuddy files. */
|
|
48
|
+
hiddenAccountIds: string[];
|
|
49
|
+
}
|
|
50
|
+
export interface WorkBuddyPreferenceStore {
|
|
51
|
+
status(): WorkBuddyModelSettings;
|
|
52
|
+
update(patch: {
|
|
53
|
+
enabled?: boolean;
|
|
54
|
+
enabledModelIds?: string[];
|
|
55
|
+
contextWindowOverrides?: Record<string, number>;
|
|
56
|
+
defaultReasoningEffort?: WorkBuddyReasoningEffort | null;
|
|
57
|
+
selectedAccountId?: string | null;
|
|
58
|
+
hiddenAccountIds?: string[];
|
|
59
|
+
}): Promise<WorkBuddyModelSettings>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Bind the model selection to the DSH settings document, which is what the
|
|
63
|
+
* settings service persists durably; the JSON file beside it remains the store
|
|
64
|
+
* used when the plugin runs without a settings provider (headless tests).
|
|
65
|
+
*/
|
|
66
|
+
export declare function registerWorkBuddyPreferenceStore(settings?: SettingsProvider, fallbackStore?: FileModelSettingsStore): WorkBuddyPreferenceStore;
|
|
67
|
+
/**
|
|
68
|
+
* Credential directory the CodeBuddy desktop client writes to.
|
|
69
|
+
*
|
|
70
|
+
* `CODEBUDDY_AUTH_DIR` overrides it, matching the environment variable the
|
|
71
|
+
* official tooling honours, which is also what makes the scan testable without
|
|
72
|
+
* touching a real profile.
|
|
73
|
+
*/
|
|
74
|
+
export declare function codeBuddyAuthDir(): string;
|
|
75
|
+
/** Plugin settings file, used when no settings service is present. */
|
|
76
|
+
export declare function modelSettingsPath(): string;
|
|
77
|
+
/** Encrypted account pool for credentials added through this plugin. */
|
|
78
|
+
export declare function managedCredentialsPath(): string;
|
|
79
|
+
/**
|
|
80
|
+
* Parse one CodeBuddy `*.info` payload.
|
|
81
|
+
*
|
|
82
|
+
* Only the fields this plugin needs are read; the file also carries the IDE's
|
|
83
|
+
* own account bookkeeping, which is deliberately left untouched. A file without
|
|
84
|
+
* a usable access token is rejected rather than half-accepted, so the scanner
|
|
85
|
+
* can move on to the next candidate.
|
|
86
|
+
*/
|
|
87
|
+
export declare function parseCredentialFile(value: unknown, sourceFile: string, sourceMtimeMs?: number): WorkBuddyCredentials;
|
|
88
|
+
/** Whether a credential is at or near expiry; refreshed a minute early. */
|
|
89
|
+
export declare function isExpired(credentials: WorkBuddyCredentials, now?: number): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Stable public key for selecting an account without exposing a token or tying
|
|
92
|
+
* the preference to a timestamped snapshot filename.
|
|
93
|
+
*/
|
|
94
|
+
export declare function workBuddyAccountId(credentials: Pick<WorkBuddyCredentials, 'region' | 'uid' | 'uin' | 'nickname' | 'domain'>): string;
|
|
95
|
+
/** Strict parser for credentials owned by the plugin's encrypted pool. */
|
|
96
|
+
export declare function parseManagedCredentials(value: unknown): WorkBuddyCredentials[];
|
|
97
|
+
/**
|
|
98
|
+
* Scan the CodeBuddy auth directory for usable credentials.
|
|
99
|
+
*
|
|
100
|
+
* Every `*.info` file is considered; unreadable or malformed ones are skipped
|
|
101
|
+
* rather than failing the whole scan, because the directory routinely holds
|
|
102
|
+
* expired snapshots next to the live credential.
|
|
103
|
+
*/
|
|
104
|
+
export declare function scanCredentials(dir?: string): Promise<WorkBuddyCredentials[]>;
|
|
105
|
+
/** Encrypted credentials added through the WorkBuddy settings page. */
|
|
106
|
+
export declare class ManagedCredentialStore {
|
|
107
|
+
private readonly filePath;
|
|
108
|
+
private readonly backend;
|
|
109
|
+
constructor(filePath?: string, backend?: CredentialStore<{
|
|
110
|
+
version: 1;
|
|
111
|
+
accounts: WorkBuddyCredentials[];
|
|
112
|
+
}>);
|
|
113
|
+
path(): string;
|
|
114
|
+
private serialize;
|
|
115
|
+
list(): Promise<WorkBuddyCredentials[]>;
|
|
116
|
+
add(credentials: WorkBuddyCredentials): Promise<void>;
|
|
117
|
+
update(credentials: WorkBuddyCredentials): Promise<void>;
|
|
118
|
+
delete(accountId: string): Promise<boolean>;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Credential store backed by the CodeBuddy desktop client's own auth files.
|
|
122
|
+
*
|
|
123
|
+
* The plugin does not own these files, so there is nothing to encrypt here: the
|
|
124
|
+
* secret is the IDE's, already on disk, and the only write this store performs
|
|
125
|
+
* is an atomic write-back of a refreshed token so the IDE does not lose its
|
|
126
|
+
* session. Tokens are never sent to a browser.
|
|
127
|
+
*/
|
|
128
|
+
export declare class FileCredentialStore {
|
|
129
|
+
private readonly dir;
|
|
130
|
+
/** How long a scan result is reused before the directory is re-read. */
|
|
131
|
+
private readonly cacheTtlMs;
|
|
132
|
+
private readonly managed;
|
|
133
|
+
private cached;
|
|
134
|
+
private scannedAt;
|
|
135
|
+
/** Serializes refresh/write-back per account; different accounts never share a token. */
|
|
136
|
+
private readonly refreshInFlight;
|
|
137
|
+
constructor(dir?: string,
|
|
138
|
+
/** How long a scan result is reused before the directory is re-read. */
|
|
139
|
+
cacheTtlMs?: number, managed?: ManagedCredentialStore);
|
|
140
|
+
/** Directory this store scans. */
|
|
141
|
+
directory(): string;
|
|
142
|
+
/** Human-readable storage description for the settings card. */
|
|
143
|
+
path(): string;
|
|
144
|
+
managedPath(): string;
|
|
145
|
+
/** Read the selected credential, or the best visible candidate in automatic mode. */
|
|
146
|
+
read(options?: {
|
|
147
|
+
force?: boolean;
|
|
148
|
+
accountId?: string | null;
|
|
149
|
+
hiddenAccountIds?: readonly string[];
|
|
150
|
+
}): Promise<WorkBuddyCredentials | null>;
|
|
151
|
+
/** Whether a cached credential's source file is unchanged on disk. */
|
|
152
|
+
private isStillCurrent;
|
|
153
|
+
/**
|
|
154
|
+
* All distinct usable accounts, best credential first.
|
|
155
|
+
*
|
|
156
|
+
* The desktop directory keeps historical snapshots. They are credentials for
|
|
157
|
+
* the same account, not additional account choices, so only the first (best)
|
|
158
|
+
* candidate for each stable account id is exposed.
|
|
159
|
+
*/
|
|
160
|
+
list(): Promise<WorkBuddyCredentials[]>;
|
|
161
|
+
/**
|
|
162
|
+
* Desktop credentials only, best first.
|
|
163
|
+
*
|
|
164
|
+
* The account pool adopts these so the IDE's own sign-ins take part in
|
|
165
|
+
* scheduling. Unlike {@link list} this never mixes in managed accounts:
|
|
166
|
+
* only the desktop set is re-adopted when the IDE changes its directory.
|
|
167
|
+
*/
|
|
168
|
+
discoverDesktopCredentials(): Promise<WorkBuddyCredentials[]>;
|
|
169
|
+
/**
|
|
170
|
+
* Re-read one desktop credential file.
|
|
171
|
+
*
|
|
172
|
+
* A pooled desktop account must serve the IDE's current token rather than
|
|
173
|
+
* the copy taken when it was adopted, because the IDE rotates that token on
|
|
174
|
+
* its own schedule. Returns null when the file is gone or unreadable.
|
|
175
|
+
*/
|
|
176
|
+
readDesktopFile(filePath: string): Promise<WorkBuddyCredentials | null>;
|
|
177
|
+
addManaged(credentials: WorkBuddyCredentials): Promise<void>;
|
|
178
|
+
deleteManaged(accountId: string): Promise<boolean>;
|
|
179
|
+
/** Forget the cached scan; the next read re-reads the directory. */
|
|
180
|
+
invalidate(): void;
|
|
181
|
+
/**
|
|
182
|
+
* Return a credential whose access token is valid, refreshing it first when
|
|
183
|
+
* it is at or near expiry.
|
|
184
|
+
*
|
|
185
|
+
* Concurrent callers share one refresh: the refresh token rotates, so two
|
|
186
|
+
* simultaneous refreshes would invalidate each other.
|
|
187
|
+
*/
|
|
188
|
+
ensureFresh(credentials: WorkBuddyCredentials, refresh: (current: WorkBuddyCredentials) => Promise<WorkBuddyCredentials>): Promise<WorkBuddyCredentials>;
|
|
189
|
+
/**
|
|
190
|
+
* Persist a refreshed token back into the IDE's own credential file.
|
|
191
|
+
*
|
|
192
|
+
* Only the `auth` block is rewritten, and the write is atomic so a crash
|
|
193
|
+
* cannot leave the IDE with a half-written file. A failure here is not fatal
|
|
194
|
+
* to the in-flight request: the refreshed token still works for this process,
|
|
195
|
+
* and the next scan simply finds the older token on disk.
|
|
196
|
+
*/
|
|
197
|
+
writeBack(credentials: WorkBuddyCredentials): Promise<void>;
|
|
198
|
+
}
|
|
199
|
+
/** Plain-JSON model settings used when the settings service is unavailable. */
|
|
200
|
+
export declare class FileModelSettingsStore {
|
|
201
|
+
private readonly filePath;
|
|
202
|
+
constructor(filePath?: string);
|
|
203
|
+
path(): string;
|
|
204
|
+
read(): Promise<WorkBuddyModelSettings>;
|
|
205
|
+
write(settings: WorkBuddyModelSettings): Promise<void>;
|
|
206
|
+
updateSettings(patch: {
|
|
207
|
+
enabled?: boolean;
|
|
208
|
+
enabledModelIds?: string[];
|
|
209
|
+
contextWindowOverrides?: Record<string, number>;
|
|
210
|
+
defaultReasoningEffort?: WorkBuddyReasoningEffort | null;
|
|
211
|
+
selectedAccountId?: string | null;
|
|
212
|
+
hiddenAccountIds?: string[];
|
|
213
|
+
}): Promise<WorkBuddyModelSettings>;
|
|
214
|
+
}
|
|
215
|
+
export { isIntlDomain };
|
|
216
|
+
//# sourceMappingURL=token-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-store.d.ts","sourceRoot":"","sources":["../../../../src/host/workbuddy/token-store.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAiB,MAAM,2BAA2B,CAAA;AAGhF,OAAO,KAAK,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,EAAE,wBAAwB,GAAG,IAAI,CAAA;QACxD,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACjC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;KAC5B,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAsBpC;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static facts about the WorkBuddy / CodeBuddy subscription backend.
|
|
3
|
+
*
|
|
4
|
+
* WorkBuddy is Tencent's CodeBuddy IDE subscription. Its model backend is a
|
|
5
|
+
* plain OpenAI-compatible `/chat/completions` endpoint that the official IDE
|
|
6
|
+
* calls directly; this plugin speaks the same wire instead of going through a
|
|
7
|
+
* converter process.
|
|
8
|
+
*
|
|
9
|
+
* Everything asserted here was measured against a live subscription (see the
|
|
10
|
+
* comments on each constant); the surprising constraints are that the endpoint
|
|
11
|
+
* is **stream-only** and that the international region requires the first
|
|
12
|
+
* message to be a system prompt.
|
|
13
|
+
*/
|
|
14
|
+
import type { WorkBuddyRegion } from '../../shared/workbuddy-contracts.ts';
|
|
15
|
+
export declare const PROVIDER_ID = "workbuddy-subscription";
|
|
16
|
+
export declare const PROVIDER_NAME = "WorkBuddy\uFF08CodeBuddy \u8BA2\u9605\uFF09";
|
|
17
|
+
/** Domestic backend. */
|
|
18
|
+
export declare const CN_BACKEND = "https://copilot.tencent.com";
|
|
19
|
+
/**
|
|
20
|
+
* Domains whose accounts live on a region-specific backend.
|
|
21
|
+
*
|
|
22
|
+
* A credential's `auth.domain` decides both the backend host and the region:
|
|
23
|
+
* `*.workbuddy.ai` / `*.codebuddy.ai` are international, anything else is the
|
|
24
|
+
* domestic `copilot.tencent.com` deployment.
|
|
25
|
+
*/
|
|
26
|
+
export declare const INTL_DOMAIN_SUFFIXES: readonly [".workbuddy.ai", ".codebuddy.ai"];
|
|
27
|
+
/** Default auth domain when a credential does not record one. */
|
|
28
|
+
export declare const DEFAULT_DOMAIN = "www.codebuddy.cn";
|
|
29
|
+
/** Chat surface, appended to a region backend. */
|
|
30
|
+
export declare const CHAT_PATH = "/v2/chat/completions";
|
|
31
|
+
/**
|
|
32
|
+
* Gateway configuration/catalog surface.
|
|
33
|
+
*
|
|
34
|
+
* This is where the real model list lives: the chat host answers 404 to
|
|
35
|
+
* `/v1/models`, but `/v3/config` returns every model with its context window,
|
|
36
|
+
* output cap, image support, and accepted reasoning ladder. The official CLI
|
|
37
|
+
* reads it at startup.
|
|
38
|
+
*/
|
|
39
|
+
export declare const CONFIG_PATH = "/v3/config";
|
|
40
|
+
/** Token refresh surface; the official IDE posts the refresh token here. */
|
|
41
|
+
export declare const REFRESH_PATH = "/v2/plugin/auth/token/refresh";
|
|
42
|
+
/** Billing/allowance surface; answers the per-package credit picture. */
|
|
43
|
+
export declare const BILLING_PATH = "/billing/meter/get-user-resource";
|
|
44
|
+
/** Browser authorization state and credential-poll surfaces used by the CLI. */
|
|
45
|
+
export declare const LOGIN_STATE_PATH = "/v2/plugin/auth/state";
|
|
46
|
+
export declare const LOGIN_TOKEN_PATH = "/v2/plugin/auth/token";
|
|
47
|
+
export declare const LOGIN_PLATFORM = "cli";
|
|
48
|
+
export declare const LOGIN_PENDING_CODE = 11217;
|
|
49
|
+
export declare const LOGIN_POLL_INTERVAL_MS = 1500;
|
|
50
|
+
export declare const LOGIN_TIMEOUT_MS: number;
|
|
51
|
+
/**
|
|
52
|
+
* User-Agent every request carries.
|
|
53
|
+
*
|
|
54
|
+
* Measured: `CodeBuddyIDE` is accepted by the chat endpoint but rejected by
|
|
55
|
+
* `/v3/config` with 400 `code 12403` ("check ua, get coding copilot version
|
|
56
|
+
* error"), and the international chat endpoint answers 401 to it outright. The
|
|
57
|
+
* CLI identity is accepted by all three surfaces on both regions, so it is the
|
|
58
|
+
* single identity this route uses rather than switching per endpoint.
|
|
59
|
+
*/
|
|
60
|
+
export declare const CLIENT_USER_AGENT = "CLI/2.63.2 CodeBuddy/2.63.2";
|
|
61
|
+
/** Client identity headers the gateway gates on. */
|
|
62
|
+
export declare const HEADER_USER_ID = "x-user-id";
|
|
63
|
+
export declare const HEADER_ENTERPRISE_ID = "x-enterprise-id";
|
|
64
|
+
export declare const HEADER_TENANT_ID = "x-tenant-id";
|
|
65
|
+
export declare const HEADER_DOMAIN = "x-domain";
|
|
66
|
+
export declare const HEADER_PRODUCT = "x-product";
|
|
67
|
+
export declare const HEADER_IDE_NAME = "x-ide-name";
|
|
68
|
+
export declare const HEADER_REQUESTED_WITH = "x-requested-with";
|
|
69
|
+
export declare const CLIENT_PRODUCT = "SaaS";
|
|
70
|
+
/** Refresh-token header the token endpoint reads. */
|
|
71
|
+
export declare const HEADER_REFRESH_TOKEN = "x-refresh-token";
|
|
72
|
+
/** Refresh origin marker; `workbuddy` for the .ai domains, `plugin` otherwise. */
|
|
73
|
+
export declare const HEADER_REFRESH_SOURCE = "x-auth-refresh-source";
|
|
74
|
+
/** Timeouts and cache lifetimes. */
|
|
75
|
+
export declare const DISCOVERY_TIMEOUT_MS = 20000;
|
|
76
|
+
export declare const CHAT_TIMEOUT_MS = 300000;
|
|
77
|
+
export declare const QUOTA_CACHE_TTL_MS: number;
|
|
78
|
+
export declare const STREAM_IDLE_TIMEOUT_MS = 300000;
|
|
79
|
+
export declare const STREAM_IDLE_TIMEOUT_CODE = "LLM_STREAM_IDLE_TIMEOUT";
|
|
80
|
+
export declare const DEFAULT_MAX_TOKENS = 32768;
|
|
81
|
+
export declare const DEFAULT_CONTEXT_WINDOW = 128000;
|
|
82
|
+
/**
|
|
83
|
+
* Output cap for the models the catalog does not pin individually.
|
|
84
|
+
*
|
|
85
|
+
* The subscription models are served by several upstream vendors whose own
|
|
86
|
+
* published caps differ; this is the conservative ceiling the request builder
|
|
87
|
+
* uses when nothing more specific is known.
|
|
88
|
+
*/
|
|
89
|
+
export declare const FALLBACK_MAX_TOKENS = 32768;
|
|
90
|
+
/** Subscription backend error codes, all measured. */
|
|
91
|
+
export declare const ERROR_CODE: {
|
|
92
|
+
/** Request parameters rejected (bad image payload, unsupported field). */
|
|
93
|
+
readonly BAD_REQUEST: 11101;
|
|
94
|
+
/** Model not served in this region — a wrong-region request. */
|
|
95
|
+
readonly MODEL_UNAVAILABLE: 11102;
|
|
96
|
+
/** Message history violates the required shape (missing leading system prompt). */
|
|
97
|
+
readonly SECURITY_BLOCKED: 11128;
|
|
98
|
+
/** Provider rejected the parameters, e.g. an unsupported image for that model. */
|
|
99
|
+
readonly PROVIDER_REJECTED: 11133;
|
|
100
|
+
/** Upstream vendor error. */
|
|
101
|
+
readonly UPSTREAM_ERROR: 11134;
|
|
102
|
+
/** Image could not be decoded or is not an accepted format. */
|
|
103
|
+
readonly INVALID_IMAGE: 11135;
|
|
104
|
+
/** Unsupported reasoning effort value. */
|
|
105
|
+
readonly INVALID_REASONING: 11150;
|
|
106
|
+
/** Usage exceeds the frequency limit; the message carries the reset instant. */
|
|
107
|
+
readonly RATE_LIMITED: 6004;
|
|
108
|
+
/** Generic usage-limit signal seen alongside 429s. */
|
|
109
|
+
readonly USAGE_LIMIT: 14003;
|
|
110
|
+
};
|
|
111
|
+
/** Whether an auth domain belongs to the international deployment. */
|
|
112
|
+
export declare function isIntlDomain(domain: string): boolean;
|
|
113
|
+
/** Region one credential belongs to, decided by its auth domain. */
|
|
114
|
+
export declare function regionForDomain(domain: string): WorkBuddyRegion;
|
|
115
|
+
/**
|
|
116
|
+
* Backend base URL for an auth domain.
|
|
117
|
+
*
|
|
118
|
+
* International accounts are served from the same apex as their auth domain
|
|
119
|
+
* (`www.workbuddy.ai`, `www.codebuddy.ai`); everything else uses the domestic
|
|
120
|
+
* gateway.
|
|
121
|
+
*/
|
|
122
|
+
export declare function backendForDomain(domain: string): string;
|
|
123
|
+
/** Refresh-source marker the token endpoint expects for one domain. */
|
|
124
|
+
export declare function refreshSourceForDomain(domain: string): string;
|
|
125
|
+
/** `www.workbuddy.ai` / `www.codebuddy.ai` origin used for CORS headers. */
|
|
126
|
+
export declare function originForDomain(domain: string): string;
|
|
127
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/host/workbuddy/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAI1E,eAAO,MAAM,WAAW,2BAA2B,CAAA;AACnD,eAAO,MAAM,aAAa,gDAA4B,CAAA;AAEtD,wBAAwB;AACxB,eAAO,MAAM,UAAU,gCAAgC,CAAA;AAEvD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,6CAA8C,CAAA;AAE/E,iEAAiE;AACjE,eAAO,MAAM,cAAc,qBAAqB,CAAA;AAEhD,kDAAkD;AAClD,eAAO,MAAM,SAAS,yBAAyB,CAAA;AAC/C;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,eAAe,CAAA;AACvC,4EAA4E;AAC5E,eAAO,MAAM,YAAY,kCAAkC,CAAA;AAC3D,yEAAyE;AACzE,eAAO,MAAM,YAAY,qCAAqC,CAAA;AAC9D,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,0BAA0B,CAAA;AACvD,eAAO,MAAM,gBAAgB,0BAA0B,CAAA;AACvD,eAAO,MAAM,cAAc,QAAQ,CAAA;AACnC,eAAO,MAAM,kBAAkB,QAAQ,CAAA;AACvC,eAAO,MAAM,sBAAsB,OAAQ,CAAA;AAC3C,eAAO,MAAM,gBAAgB,QAAgB,CAAA;AAE7C;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,gCAAgC,CAAA;AAE9D,oDAAoD;AACpD,eAAO,MAAM,cAAc,cAAc,CAAA;AACzC,eAAO,MAAM,oBAAoB,oBAAoB,CAAA;AACrD,eAAO,MAAM,gBAAgB,gBAAgB,CAAA;AAC7C,eAAO,MAAM,aAAa,aAAa,CAAA;AACvC,eAAO,MAAM,cAAc,cAAc,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CredentialStore as KimiCodeCredentialStore, FileModelSettingsStore
|
|
|
70
70
|
export { beginWebLogin as beginKimiCodeLogin, ensureAccessToken as ensureKimiCodeAccessToken, getWebLoginStatus as getKimiCodeLoginStatus, refreshAccessToken as refreshKimiCodeToken, requestDeviceAuthorization as requestKimiCodeDeviceAuthorization, } from './host/kimi-code/oauth.ts';
|
|
71
71
|
export { fetchAccountQuota as fetchKimiCodeQuota, fetchUserInfo as fetchKimiCodeUserInfo, loadProviderModels as loadKimiCodeModels, clearCachedQuota as clearKimiCodeQuota, getCachedQuota as getKimiCodeQuota, } from './host/kimi-code/client.ts';
|
|
72
72
|
export { getKimiCodeWebStatus, registerKimiCodeRoutes } from './host/kimi-code/routes.ts';
|
|
73
|
+
export { WorkBuddyAdapter, classifyFailure as classifyWorkBuddyFailure } from './host/workbuddy/adapter.ts';
|
|
74
|
+
export { FileCredentialStore as WorkBuddyCredentialStore, FileModelSettingsStore as WorkBuddyModelSettingsStore, codeBuddyAuthDir, modelSettingsPath as workBuddyModelSettingsPath, parseCredentialFile as parseWorkBuddyCredential, registerWorkBuddyPreferenceStore, scanCredentials as scanWorkBuddyCredentials, } from './host/workbuddy/token-store.ts';
|
|
75
|
+
export { fetchAccountQuota as fetchWorkBuddyQuota, clearCachedQuota as clearWorkBuddyQuota, getCachedQuota as getWorkBuddyQuota, clearCachedCatalog as clearWorkBuddyCatalog, loadConfigCatalog as loadWorkBuddyModels, parseConfigModels as parseWorkBuddyConfigModels, refreshCredentials as refreshWorkBuddyCredentials, parseBilling as parseWorkBuddyBilling, } from './host/workbuddy/client.ts';
|
|
76
|
+
export { getWorkBuddyWebStatus, registerWorkBuddyRoutes } from './host/workbuddy/routes.ts';
|
|
77
|
+
export { FALLBACK_MODELS as WORKBUDDY_MODELS, WORKBUDDY_MODEL_IDS, resolveWorkBuddyModel, modelsForRegion as workBuddyModelsForRegion, } from './host/workbuddy/model-catalog.ts';
|
|
73
78
|
export { KimiCodeAccountPool, kimiCodePoolPath, parseKimiCodePoolData, type KimiCodePoolAccount, } from './host/kimi-code/account-pool.ts';
|
|
74
79
|
export { KIMI_CODE_MODELS, kimiCodeModelDef, } from './host/kimi-code/model-catalog.ts';
|
|
75
80
|
export { FileCredentialStore, FileModelSettingsStore, credentialPath, modelSettingsPath, } from './host/antigravity/token-store.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
|
+
{"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;AA+FxC,yDAAyD;AACzD,MAAM,WAAW,MAAM;IACrB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;OAIG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAA;IACpC,qFAAqF;IACrF,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B;;;;;;OAMG;IACH,yBAAyB,CAAC,EAAE,MAAM,EAAE,CAAA;IACpC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,SAAS,GAAG,YAAY,CAAA;CAC9C;AAED,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,MAAM,CAM3B,CAAA;AAEF,eAAO,MAAM,MAAM,UAAqE,CAAA;AAExF,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,GAAE,MAAW,GAAG,IAAI,CAgbnE;AAED,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,UAAU,EACV,wBAAwB,EACxB,iBAAiB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,mBAAmB,EACxC,iBAAiB,IAAI,0BAA0B,EAC/C,kBAAkB,IAAI,2BAA2B,EACjD,YAAY,IAAI,qBAAqB,GACtC,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AAC3F,OAAO,EACL,eAAe,IAAI,gBAAgB,EACnC,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,IAAI,wBAAwB,GAC5C,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,mBAAmB,GACzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,iBAAiB,GAClB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AACrE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAClG,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -37,6 +37,14 @@ export interface PoolAccountSummaryDto {
|
|
|
37
37
|
authFailedReason?: string;
|
|
38
38
|
/** Unix milliseconds the stored access token expires, when the provider has one. */
|
|
39
39
|
expiresAt?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the card may offer to delete this account.
|
|
42
|
+
*
|
|
43
|
+
* Absent means deletable, which is what every account this plugin signed in
|
|
44
|
+
* is. A provider that adopts accounts it does not own sets this to false so
|
|
45
|
+
* the card offers its own action instead of destroying someone else's file.
|
|
46
|
+
*/
|
|
47
|
+
removable?: boolean;
|
|
40
48
|
}
|
|
41
49
|
/** The pool slice every provider status DTO carries. */
|
|
42
50
|
export interface AccountPoolStatusDto {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-pool-contracts.d.ts","sourceRoot":"","sources":["../../../src/shared/account-pool-contracts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG,YAAY,GAAG,aAAa,GAAG,QAAQ,CAAA;AAE7E;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,CAAA;AAE5D,2EAA2E;AAC3E,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,mFAAmF;IACnF,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,iBAAiB,CAAA;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,oFAAoF;IACpF,SAAS,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"account-pool-contracts.d.ts","sourceRoot":"","sources":["../../../src/shared/account-pool-contracts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG,YAAY,GAAG,aAAa,GAAG,QAAQ,CAAA;AAE7E;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,CAAA;AAE5D,2EAA2E;AAC3E,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,mFAAmF;IACnF,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,iBAAiB,CAAA;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,oFAAoF;IACpF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,wDAAwD;AACxD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,qBAAqB,EAAE,CAAA;IACjC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gBAAgB,EAAE,uBAAuB,CAAA;CAC1C"}
|