@eddyskywalker/dsh-chatgpt-subscription 0.4.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 +56 -0
- package/README.md +67 -1
- package/lib/client.js +2255 -742
- package/lib/client.js.map +1 -1
- package/lib/index.js +17139 -12058
- package/lib/types/client/CodexSubscriptionSection.d.ts +1 -1
- package/lib/types/client/CodexSubscriptionSection.d.ts.map +1 -1
- package/lib/types/client/ProviderHubSection.d.ts.map +1 -1
- package/lib/types/client/antigravity/AntigravitySection.d.ts.map +1 -1
- package/lib/types/client/antigravity/locales.d.ts +24 -192
- package/lib/types/client/antigravity/locales.d.ts.map +1 -1
- package/lib/types/client/api.d.ts +13 -1
- package/lib/types/client/api.d.ts.map +1 -1
- package/lib/types/client/command-code/CommandCodeSection.d.ts.map +1 -1
- package/lib/types/client/command-code/locales.d.ts +66 -201
- package/lib/types/client/command-code/locales.d.ts.map +1 -1
- package/lib/types/client/common/AccountPoolSection.d.ts +55 -0
- package/lib/types/client/common/AccountPoolSection.d.ts.map +1 -0
- package/lib/types/client/common/account-pool-labels.d.ts +43 -0
- package/lib/types/client/common/account-pool-labels.d.ts.map +1 -0
- package/lib/types/client/common/styles.d.ts +11 -0
- package/lib/types/client/common/styles.d.ts.map +1 -0
- package/lib/types/client/index.d.ts +1 -0
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/kimi-code/KimiCodeSection.d.ts.map +1 -1
- package/lib/types/client/kimi-code/locales.d.ts +63 -336
- package/lib/types/client/kimi-code/locales.d.ts.map +1 -1
- package/lib/types/client/locales.d.ts +41 -1
- package/lib/types/client/locales.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/antigravity/account-pool.d.ts +15 -5
- package/lib/types/host/antigravity/account-pool.d.ts.map +1 -1
- package/lib/types/host/antigravity/routes.d.ts.map +1 -1
- package/lib/types/host/codex-account-pool.d.ts +64 -0
- package/lib/types/host/codex-account-pool.d.ts.map +1 -0
- package/lib/types/host/command-code/account-pool.d.ts +60 -0
- package/lib/types/host/command-code/account-pool.d.ts.map +1 -0
- package/lib/types/host/command-code/adapter.d.ts +11 -1
- package/lib/types/host/command-code/adapter.d.ts.map +1 -1
- package/lib/types/host/command-code/client.d.ts +17 -1
- package/lib/types/host/command-code/client.d.ts.map +1 -1
- package/lib/types/host/command-code/oauth.d.ts +4 -1
- package/lib/types/host/command-code/oauth.d.ts.map +1 -1
- package/lib/types/host/command-code/routes.d.ts +11 -2
- package/lib/types/host/command-code/routes.d.ts.map +1 -1
- package/lib/types/host/common/account-pool.d.ts +197 -0
- package/lib/types/host/common/account-pool.d.ts.map +1 -0
- package/lib/types/host/common/home.d.ts +8 -0
- package/lib/types/host/common/home.d.ts.map +1 -0
- package/lib/types/host/kimi-code/account-pool.d.ts +48 -0
- package/lib/types/host/kimi-code/account-pool.d.ts.map +1 -0
- package/lib/types/host/kimi-code/adapter.d.ts +10 -1
- package/lib/types/host/kimi-code/adapter.d.ts.map +1 -1
- package/lib/types/host/kimi-code/client.d.ts +16 -0
- package/lib/types/host/kimi-code/client.d.ts.map +1 -1
- package/lib/types/host/kimi-code/oauth.d.ts +2 -0
- package/lib/types/host/kimi-code/oauth.d.ts.map +1 -1
- package/lib/types/host/kimi-code/routes.d.ts +10 -2
- package/lib/types/host/kimi-code/routes.d.ts.map +1 -1
- package/lib/types/host/oauth-service.d.ts +41 -2
- package/lib/types/host/oauth-service.d.ts.map +1 -1
- package/lib/types/host/preset-sync.d.ts +7 -1
- package/lib/types/host/preset-sync.d.ts.map +1 -1
- package/lib/types/host/responses-client.d.ts +15 -0
- package/lib/types/host/responses-client.d.ts.map +1 -1
- package/lib/types/host/routes.d.ts +2 -1
- package/lib/types/host/routes.d.ts.map +1 -1
- package/lib/types/host/usage-service.d.ts +15 -0
- package/lib/types/host/usage-service.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 +10 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/account-pool-contracts.d.ts +55 -0
- package/lib/types/shared/account-pool-contracts.d.ts.map +1 -0
- package/lib/types/shared/antigravity-contracts.d.ts +4 -10
- package/lib/types/shared/antigravity-contracts.d.ts.map +1 -1
- package/lib/types/shared/command-code-contracts.d.ts +14 -0
- package/lib/types/shared/command-code-contracts.d.ts.map +1 -1
- package/lib/types/shared/contracts.d.ts +6 -0
- package/lib/types/shared/contracts.d.ts.map +1 -1
- package/lib/types/shared/kimi-code-contracts.d.ts +14 -0
- package/lib/types/shared/kimi-code-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,90 @@
|
|
|
1
|
+
import type { WorkBuddyAccount, WorkBuddyAccountQuota, WorkBuddyMeter } from '../../shared/workbuddy-contracts.ts';
|
|
2
|
+
import { PROVIDER_ID, PROVIDER_NAME } from './types.ts';
|
|
3
|
+
import { FileCredentialStore, type WorkBuddyCredentials } from './token-store.ts';
|
|
4
|
+
import type { WorkBuddyModelEntry } from './model-catalog.ts';
|
|
5
|
+
export interface WorkBuddyRequestOptions {
|
|
6
|
+
fetchFn?: typeof fetch;
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Attribution and identity headers for one backend request.
|
|
11
|
+
*
|
|
12
|
+
* The gateway gates on this header set: the international deployment answers
|
|
13
|
+
* 401 without the CLI user agent and matching `Origin`/`Referer`, and both
|
|
14
|
+
* deployments read the account identity headers rather than deriving it from
|
|
15
|
+
* the bearer token alone.
|
|
16
|
+
*/
|
|
17
|
+
export declare function workBuddyHeaders(credentials: Pick<WorkBuddyCredentials, 'accessToken' | 'domain' | 'uid' | 'enterpriseId' | 'backend'>, extra?: Record<string, string>): Record<string, string>;
|
|
18
|
+
/**
|
|
19
|
+
* Refresh an access token against the endpoint the official IDE uses.
|
|
20
|
+
*
|
|
21
|
+
* The response carries a whole new `auth` block rather than just a token, so it
|
|
22
|
+
* is merged over the current one: fields the endpoint omits (the domain, the
|
|
23
|
+
* refresh lifetime) must survive, or the next refresh would lose its target.
|
|
24
|
+
*/
|
|
25
|
+
export declare function refreshCredentials(credentials: WorkBuddyCredentials, options?: WorkBuddyRequestOptions): Promise<WorkBuddyCredentials>;
|
|
26
|
+
/** Public account facts for the settings card. */
|
|
27
|
+
export declare function accountFromCredentials(credentials: WorkBuddyCredentials): WorkBuddyAccount;
|
|
28
|
+
/**
|
|
29
|
+
* Parse one `/v3/config` payload's model list.
|
|
30
|
+
*
|
|
31
|
+
* Each entry carries the facts this route needs directly, so nothing is
|
|
32
|
+
* inferred from the model's name. Image-generation tools (`tags` naming
|
|
33
|
+
* `text-to-image`/`image-to-image`) are skipped: they are not chat models and
|
|
34
|
+
* carry no context window.
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseConfigModels(payload: unknown, region: WorkBuddyCredentials['region']): WorkBuddyModelEntry[];
|
|
37
|
+
export declare function getCachedCatalog(): WorkBuddyModelEntry[];
|
|
38
|
+
export declare function clearCachedCatalog(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Fetch the live catalog for one account.
|
|
41
|
+
*
|
|
42
|
+
* The gateway is the authority on capabilities, so a successful read replaces
|
|
43
|
+
* the shipped table entirely; a failure returns an empty list and the caller
|
|
44
|
+
* falls back, which keeps a first run usable before sign-in.
|
|
45
|
+
*/
|
|
46
|
+
export declare function fetchConfigCatalog(credentials: WorkBuddyCredentials, options?: WorkBuddyRequestOptions): Promise<WorkBuddyModelEntry[]>;
|
|
47
|
+
/** Cached catalog with a TTL; a failed refresh keeps the previous snapshot. */
|
|
48
|
+
export declare function loadConfigCatalog(credentials: WorkBuddyCredentials, options?: WorkBuddyRequestOptions & {
|
|
49
|
+
force?: boolean;
|
|
50
|
+
}): Promise<WorkBuddyModelEntry[]>;
|
|
51
|
+
/** Parse one `Capacity*` account record into the public quota shape. */
|
|
52
|
+
export interface ParsedBilling {
|
|
53
|
+
packageName: string | null;
|
|
54
|
+
totalCredits: number | null;
|
|
55
|
+
remainingCredits: number | null;
|
|
56
|
+
cycleUsedCredits: number | null;
|
|
57
|
+
cycleCredits: number | null;
|
|
58
|
+
cycleStartsAt: number | null;
|
|
59
|
+
cycleEndsAt: number | null;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Parse the billing payload's account list.
|
|
63
|
+
*
|
|
64
|
+
* The response nests as `data.Response.Data.Accounts[]`; each entry describes
|
|
65
|
+
* one purchased package with its own capacity counters. The first entry is the
|
|
66
|
+
* active subscription, and the totals are summed across all of them because a
|
|
67
|
+
* user can hold several packages at once.
|
|
68
|
+
*/
|
|
69
|
+
export declare function parseBilling(payload: unknown): ParsedBilling;
|
|
70
|
+
/**
|
|
71
|
+
* Parse a cycle boundary.
|
|
72
|
+
*
|
|
73
|
+
* The service sends these as local-time strings without a zone
|
|
74
|
+
* (`2026-09-01 00:00:00`), which `Date.parse` reads as local time — the same
|
|
75
|
+
* reading the IDE's own panel uses, so the card agrees with it.
|
|
76
|
+
*/
|
|
77
|
+
export declare function parseCycleTime(value: unknown): number | null;
|
|
78
|
+
/** Turn a parsed billing snapshot into the meters the card renders. */
|
|
79
|
+
export declare function billingMeters(billing: ParsedBilling): WorkBuddyMeter[];
|
|
80
|
+
export declare function getCachedQuota(): WorkBuddyAccountQuota | undefined;
|
|
81
|
+
export declare function clearCachedQuota(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Read the account's credit allowance.
|
|
84
|
+
*
|
|
85
|
+
* Only one billing route exists here, so a failure is a real failure rather
|
|
86
|
+
* than a partially-answered snapshot: the caller decides whether to surface it.
|
|
87
|
+
*/
|
|
88
|
+
export declare function fetchAccountQuota(store?: FileCredentialStore, fetchFn?: typeof fetch, force?: boolean, accountId?: string | null, hiddenAccountIds?: readonly string[]): Promise<WorkBuddyAccountQuota>;
|
|
89
|
+
export { PROVIDER_ID, PROVIDER_NAME };
|
|
90
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/host/workbuddy/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACf,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EAgBL,WAAW,EACX,aAA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AAO,CAAA;CAAO,GAC1D,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAiChC;AAeD,wEAAwE;AACxE,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,aAAa,CAwC5D;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAQ5D;AAED,uEAAuE;AACvE,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,cAAc,EAAE,CAmCtE;AAOD,wBAAgB,cAAc,IAAI,qBAAqB,GAAG,SAAS,CAElE;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAKvC;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,sBAA4B,EACjC,OAAO,GAAE,OAAO,KAAa,EAC7B,KAAK,UAAQ,EACb,SAAS,GAAE,MAAM,GAAG,IAAW,EAC/B,gBAAgB,GAAE,SAAS,MAAM,EAAO,GACvC,OAAO,CAAC,qBAAqB,CAAC,CAmEhC;AAED,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire mapping for the WorkBuddy / CodeBuddy subscription chat endpoint.
|
|
3
|
+
*
|
|
4
|
+
* The endpoint is OpenAI Chat Completions shaped, but with three measured
|
|
5
|
+
* deviations from the OpenAI default that this module exists to absorb:
|
|
6
|
+
*
|
|
7
|
+
* 1. **Stream only.** `stream: false` answers 400 `code 11101`. The request
|
|
8
|
+
* builder therefore always sends `stream: true`, and there is no
|
|
9
|
+
* non-streaming code path to keep in sync.
|
|
10
|
+
* 2. **A leading system message is mandatory on the international backend.**
|
|
11
|
+
* A request whose first message is a user turn answers 400 `code 11128`
|
|
12
|
+
* ("first message is not system prompt"). {@link buildChatRequest} injects
|
|
13
|
+
* one when the caller supplied none, so a hand-built one-shot request cannot
|
|
14
|
+
* trip this.
|
|
15
|
+
* 3. **Reasoning rides `delta.reasoning_content`,** not OpenAI's
|
|
16
|
+
* `reasoning_summary`, and is emitted as its own DSH reasoning block.
|
|
17
|
+
*/
|
|
18
|
+
import { type ContentBlock, type GenerateOptions, type StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
19
|
+
import type { AttachmentStore } from '@deepseek-ai/dsh-attachment';
|
|
20
|
+
/**
|
|
21
|
+
* The system prompt every request must open with.
|
|
22
|
+
*
|
|
23
|
+
* The international backend rejects a request whose first message is not a
|
|
24
|
+
* system turn, so this stands in when the caller supplies no prompt at all. It
|
|
25
|
+
* is deliberately neutral: it must not change model behaviour beyond satisfying
|
|
26
|
+
* the shape check.
|
|
27
|
+
*/
|
|
28
|
+
declare const IMPLICIT_SYSTEM_PROMPT = "You are a helpful assistant.";
|
|
29
|
+
/** Attachment seam this route needs: verified bytes for one durable image. */
|
|
30
|
+
export type AttachmentImageReader = Pick<AttachmentStore, 'readImage'>;
|
|
31
|
+
/** One durable user image resolved for an in-flight request, or proven unreadable. */
|
|
32
|
+
export type ResolvedRequestImage = {
|
|
33
|
+
readonly kind: 'inline';
|
|
34
|
+
readonly mediaType: string;
|
|
35
|
+
readonly data: string;
|
|
36
|
+
} | {
|
|
37
|
+
readonly kind: 'unavailable';
|
|
38
|
+
};
|
|
39
|
+
/** Resolved images keyed by durable attachment id; consumed by one request build. */
|
|
40
|
+
export type ResolvedRequestImages = ReadonlyMap<string, ResolvedRequestImage>;
|
|
41
|
+
/**
|
|
42
|
+
* Base64 image payload one request may carry.
|
|
43
|
+
*
|
|
44
|
+
* The subscription proxies to several upstream vendors, so the bound has to
|
|
45
|
+
* hold for the strictest of them. 12 MB matches what this plugin's other
|
|
46
|
+
* routes allow and keeps the conversation text and tool schemas in the same
|
|
47
|
+
* body.
|
|
48
|
+
*/
|
|
49
|
+
export declare const MAX_REQUEST_IMAGE_BYTES: number;
|
|
50
|
+
/**
|
|
51
|
+
* Replace the oldest inline images with a text placeholder once one request
|
|
52
|
+
* would carry more than {@link MAX_REQUEST_IMAGE_BYTES} of base64 image data.
|
|
53
|
+
* Durable history is untouched; only the request about to be sent changes.
|
|
54
|
+
*/
|
|
55
|
+
export declare function offloadOldestRequestImages(options: GenerateOptions): GenerateOptions;
|
|
56
|
+
/**
|
|
57
|
+
* Read every durable `{ type: 'image', attachment }` block one request carries.
|
|
58
|
+
* An unreadable image resolves to `unavailable` rather than disappearing, so
|
|
59
|
+
* the model is told the picture is missing instead of answering about a blank.
|
|
60
|
+
*/
|
|
61
|
+
export declare function resolveRequestImages(options: GenerateOptions, attachments: AttachmentImageReader | undefined, signal?: AbortSignal): Promise<ResolvedRequestImages>;
|
|
62
|
+
/** Drop the JSON-Schema keywords provider gateways reject or ignore. */
|
|
63
|
+
export declare function stripMetaSchema(schema: unknown): Record<string, unknown>;
|
|
64
|
+
/**
|
|
65
|
+
* Build one `/v2/chat/completions` body.
|
|
66
|
+
*
|
|
67
|
+
* Always `stream: true`: the endpoint rejects a non-streaming request outright
|
|
68
|
+
* (400 `code 11101`), so there is no second shape to produce.
|
|
69
|
+
*/
|
|
70
|
+
export declare function buildChatRequest(options: GenerateOptions, images?: ResolvedRequestImages): Record<string, unknown>;
|
|
71
|
+
interface PendingToolCall {
|
|
72
|
+
blockIndex: number;
|
|
73
|
+
id: string;
|
|
74
|
+
name: string;
|
|
75
|
+
arguments: string;
|
|
76
|
+
started: boolean;
|
|
77
|
+
}
|
|
78
|
+
export interface WorkBuddyStreamState {
|
|
79
|
+
blocks: ContentBlock[];
|
|
80
|
+
current: {
|
|
81
|
+
index: number;
|
|
82
|
+
type: 'text' | 'reasoning';
|
|
83
|
+
text: string;
|
|
84
|
+
} | null;
|
|
85
|
+
/** wire tool index -> accumulating call. */
|
|
86
|
+
toolCalls: Map<number, PendingToolCall>;
|
|
87
|
+
hasContent: boolean;
|
|
88
|
+
hasToolCall: boolean;
|
|
89
|
+
finishReason: string | null;
|
|
90
|
+
/** The `[DONE]` sentinel arrived. */
|
|
91
|
+
done: boolean;
|
|
92
|
+
/** Terminal chunks were already emitted. */
|
|
93
|
+
finished: boolean;
|
|
94
|
+
inputTokens: number;
|
|
95
|
+
outputTokens: number;
|
|
96
|
+
cacheReadTokens: number;
|
|
97
|
+
reasoningTokens: number;
|
|
98
|
+
sawUsage: boolean;
|
|
99
|
+
}
|
|
100
|
+
export declare function createStreamState(): WorkBuddyStreamState;
|
|
101
|
+
/** Feed one SSE line from `/v2/chat/completions`. */
|
|
102
|
+
export declare function processStreamLine(line: string, state: WorkBuddyStreamState): StreamChunk[];
|
|
103
|
+
/** Flush every open block, then emit usage and the terminal finish. */
|
|
104
|
+
export declare function closeStream(state: WorkBuddyStreamState): StreamChunk[];
|
|
105
|
+
/**
|
|
106
|
+
* A stream that ends without a terminal event is truncated, not complete.
|
|
107
|
+
*
|
|
108
|
+
* The endpoint always terminates with either `finish_reason` or `[DONE]`, so
|
|
109
|
+
* their absence means the connection dropped mid-answer and the partial text
|
|
110
|
+
* must not be presented as a finished reply.
|
|
111
|
+
*/
|
|
112
|
+
export declare function assertStreamComplete(state: WorkBuddyStreamState): void;
|
|
113
|
+
export { IMPLICIT_SYSTEM_PROMPT };
|
|
114
|
+
//# sourceMappingURL=mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapper.d.ts","sourceRoot":"","sources":["../../../../src/host/workbuddy/mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;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WorkBuddy / CodeBuddy subscription.
|
|
3
|
+
*
|
|
4
|
+
* The subscription exposes no `/v1/models`-style listing on the chat host
|
|
5
|
+
* (that path answers 404), but the gateway does publish an **authoritative
|
|
6
|
+
* catalog** at `GET /v3/config`, which the official CLI reads at startup. That
|
|
7
|
+
* payload carries each model's real context window, output cap, image support,
|
|
8
|
+
* and the exact reasoning ladder it accepts — so this route prefers the live
|
|
9
|
+
* catalog and keeps the table below only as an offline fallback.
|
|
10
|
+
*
|
|
11
|
+
* The fallback is a verbatim transcription of a live `/v3/config` read, not
|
|
12
|
+
* hand-written guesses: an earlier revision of this file guessed context
|
|
13
|
+
* windows from vendor marketing and was wrong in both directions (`glm-5.3`
|
|
14
|
+
* and `kimi-k3` are 1M, not 200K/256K). Where the two regions disagree, the
|
|
15
|
+
* larger maximum is kept while the served default comes from whichever region
|
|
16
|
+
* reported one.
|
|
17
|
+
*
|
|
18
|
+
* `regions` is a routing fact, not a preference: asking a region for a model it
|
|
19
|
+
* does not serve answers 400 `code 11102`.
|
|
20
|
+
*
|
|
21
|
+
* A second `code 11102` source was measured and is deliberately NOT filtered
|
|
22
|
+
* out here: the gateway lists models the *current account* is not entitled to
|
|
23
|
+
* call (on a free plan, `glm-5.0`, `glm-4.7`, `glm-4.6`, `glm-4.6v`,
|
|
24
|
+
* `kimi-k2-thinking`, `hy4-preview-x` and `minimax-m2.5` all advertise a context
|
|
25
|
+
* window and then answer 11102). Those entries are kept because the gating is
|
|
26
|
+
* per-account, not per-model — a paid plan may serve them — and because the
|
|
27
|
+
* shipped default selection excludes them anyway. The adapter's failure message
|
|
28
|
+
* names this case so a user knows to pick another model rather than to retry.
|
|
29
|
+
*
|
|
30
|
+
* `reasoningEfforts` carries the ladder a model accepts, transcribed from the
|
|
31
|
+
* gateway's own declaration. `/v3/config` uses two shapes and they were once
|
|
32
|
+
* conflated, in opposite directions: a lone `{ effort: 'high' }` (no
|
|
33
|
+
* `supportedEfforts`) first became a one-entry ladder, which rejected a
|
|
34
|
+
* caller's explicit `low`; widening it to every level this route can name then
|
|
35
|
+
* advertised `minimal`/`xhigh` on a model that has three. Such a model accepts
|
|
36
|
+
* exactly `low`/`high`/`max` (measured on `deepseek-v4.1-flash`), the same
|
|
37
|
+
* three the gateway declares explicitly for `glm-5.3-flash` and
|
|
38
|
+
* `kimi-k2.8-preview`, and routes any other value into the nearest of them.
|
|
39
|
+
*/
|
|
40
|
+
import type { WorkBuddyRegion } from '../../shared/workbuddy-contracts.ts';
|
|
41
|
+
export interface WorkBuddyModelEntry {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
/**
|
|
45
|
+
* Context length the gateway serves **by default** for this model.
|
|
46
|
+
*
|
|
47
|
+
* This route sends no explicit context-length parameter, so this is the
|
|
48
|
+
* figure DSH's compaction and overflow decisions must use. It is not always
|
|
49
|
+
* the model's maximum: the gateway reports both (for example
|
|
50
|
+
* `deepseek-v4.1-flash` serves 300000 by default and allows 1000000).
|
|
51
|
+
*/
|
|
52
|
+
contextWindow: number;
|
|
53
|
+
/** Largest context length the model accepts when one is requested. */
|
|
54
|
+
maxContextWindow: number;
|
|
55
|
+
/** Output cap requested when the caller omits one. */
|
|
56
|
+
maxTokens: number;
|
|
57
|
+
/** Regions whose backend serves this id. */
|
|
58
|
+
regions: readonly WorkBuddyRegion[];
|
|
59
|
+
/** Whether the model accepts image input. */
|
|
60
|
+
supportsImage: boolean;
|
|
61
|
+
/** Reasoning ladder the model accepts; empty for a non-reasoning model. */
|
|
62
|
+
reasoningEfforts: readonly string[];
|
|
63
|
+
/** Level this route selects when the caller names none. */
|
|
64
|
+
defaultReasoningEffort: string | null;
|
|
65
|
+
/** Whether the model can be asked to skip thinking entirely. */
|
|
66
|
+
canDisableThinking: boolean;
|
|
67
|
+
/** One-line note shown beside the model in the settings card. */
|
|
68
|
+
description: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Offline fallback catalog, transcribed from a live `/v3/config` read.
|
|
72
|
+
*
|
|
73
|
+
* Used when the gateway cannot be reached (first run before sign-in, or a
|
|
74
|
+
* network failure); a reachable gateway always wins.
|
|
75
|
+
*/
|
|
76
|
+
export declare const FALLBACK_MODELS: readonly WorkBuddyModelEntry[];
|
|
77
|
+
/**
|
|
78
|
+
* Models the picker offers on a fresh install.
|
|
79
|
+
*
|
|
80
|
+
* Deliberately short: the catalog holds every id the subscription serves, and
|
|
81
|
+
* the picker is far more usable with the handful of general-purpose models. The
|
|
82
|
+
* card lets a user add the rest, and a first-run default expands to everything
|
|
83
|
+
* the account's region can actually call.
|
|
84
|
+
*/
|
|
85
|
+
export declare const DEFAULT_VISIBLE_MODEL_IDS: readonly string[];
|
|
86
|
+
/** Every id the fallback knows, in declaration order. */
|
|
87
|
+
export declare const WORKBUDDY_MODEL_IDS: readonly string[];
|
|
88
|
+
/**
|
|
89
|
+
* Resolve one entry from a catalog.
|
|
90
|
+
*
|
|
91
|
+
* An unknown id resolves to a synthetic text-only entry rather than the first
|
|
92
|
+
* catalog row: reporting a real model's capabilities for an id it does not
|
|
93
|
+
* describe would mis-declare image support and route a request to a 400.
|
|
94
|
+
*/
|
|
95
|
+
export declare function resolveWorkBuddyModel(id: string, catalog?: readonly WorkBuddyModelEntry[]): WorkBuddyModelEntry;
|
|
96
|
+
/** Whether one catalog knows this exact id. */
|
|
97
|
+
export declare function isWorkBuddyModelId(id: unknown, catalog?: readonly WorkBuddyModelEntry[]): id is string;
|
|
98
|
+
/** Models an account in `region` can actually call, in catalog order. */
|
|
99
|
+
export declare function modelsForRegion(region: WorkBuddyRegion, catalog?: readonly WorkBuddyModelEntry[]): WorkBuddyModelEntry[];
|
|
100
|
+
/** Whether one model accepts image input. */
|
|
101
|
+
export declare function workBuddyModelSupportsImage(id: string, catalog?: readonly WorkBuddyModelEntry[]): boolean;
|
|
102
|
+
/** Reasoning ladder one model accepts. */
|
|
103
|
+
export declare function workBuddyReasoningEfforts(id: string, catalog?: readonly WorkBuddyModelEntry[]): readonly string[];
|
|
104
|
+
/** Output cap requested when the caller omits one. */
|
|
105
|
+
export declare function maxOutputTokensFor(id: string, catalog?: readonly WorkBuddyModelEntry[]): number;
|
|
106
|
+
/** Context window assumed when no override is saved. */
|
|
107
|
+
export declare function defaultContextWindowFor(id: string, catalog?: readonly WorkBuddyModelEntry[]): number;
|
|
108
|
+
//# sourceMappingURL=model-catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-catalog.d.ts","sourceRoot":"","sources":["../../../../src/host/workbuddy/model-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAI1E,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ;;;;;;;OAOG;IACH,aAAa,EAAE,MAAM,CAAA;IACrB,sEAAsE;IACtE,gBAAgB,EAAE,MAAM,CAAA;IACxB,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAA;IACjB,4CAA4C;IAC5C,OAAO,EAAE,SAAS,eAAe,EAAE,CAAA;IACnC,6CAA6C;IAC7C,aAAa,EAAE,OAAO,CAAA;IACtB,2EAA2E;IAC3E,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC,2DAA2D;IAC3D,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAA;IACrC,gEAAgE;IAChE,kBAAkB,EAAE,OAAO,CAAA;IAC3B,iEAAiE;IACjE,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,mBAAmB,EAgjBzD,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAKtD,CAAA;AAED,yDAAyD;AACzD,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAA6C,CAAA;AAE9F;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,SAAS,mBAAmB,EAAoB,GACxD,mBAAmB,CA0BrB;AAED,+CAA+C;AAC/C,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,OAAO,EACX,OAAO,GAAE,SAAS,mBAAmB,EAAoB,GACxD,EAAE,IAAI,MAAM,CAEd;AAED,yEAAyE;AACzE,wBAAgB,eAAe,CAC7B,MAAM,EAAE,eAAe,EACvB,OAAO,GAAE,SAAS,mBAAmB,EAAoB,GACxD,mBAAmB,EAAE,CAEvB;AAED,6CAA6C;AAC7C,wBAAgB,2BAA2B,CACzC,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,SAAS,mBAAmB,EAAoB,GACxD,OAAO,CAET;AAED,0CAA0C;AAC1C,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,SAAS,mBAAmB,EAAoB,GACxD,SAAS,MAAM,EAAE,CAEnB;AAED,sDAAsD;AACtD,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,SAAS,mBAAmB,EAAoB,GACxD,MAAM,CAER;AAED,wDAAwD;AACxD,wBAAgB,uBAAuB,CACrC,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,SAAS,mBAAmB,EAAoB,GACxD,MAAM,CAER"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FileCredentialStore, type WorkBuddyCredentials } from './token-store.ts';
|
|
2
|
+
import type { WorkBuddyRegion } from '../../shared/workbuddy-contracts.ts';
|
|
3
|
+
export type WorkBuddyLoginStatus = 'idle' | 'pending' | 'complete' | 'error';
|
|
4
|
+
export interface WorkBuddyLoginFlowState {
|
|
5
|
+
status: WorkBuddyLoginStatus;
|
|
6
|
+
region?: WorkBuddyRegion;
|
|
7
|
+
authUrl?: string;
|
|
8
|
+
progress?: string;
|
|
9
|
+
accountId?: string;
|
|
10
|
+
startedAt?: number;
|
|
11
|
+
completedAt?: number;
|
|
12
|
+
error?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function getWebLoginStatus(): WorkBuddyLoginFlowState;
|
|
15
|
+
export declare function resetWebLogin(): void;
|
|
16
|
+
export interface WorkBuddyLoginAttempt {
|
|
17
|
+
state: string;
|
|
18
|
+
authUrl: string;
|
|
19
|
+
region: WorkBuddyRegion;
|
|
20
|
+
domain: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function requestLoginState(region: WorkBuddyRegion, fetchFn?: typeof fetch, signal?: AbortSignal): Promise<WorkBuddyLoginAttempt>;
|
|
23
|
+
/** Parse the successful token-poll shape while accepting the two observed wrappers. */
|
|
24
|
+
export declare function parseLoginCredential(payload: unknown, attempt: WorkBuddyLoginAttempt): WorkBuddyCredentials | null;
|
|
25
|
+
export declare function pollLogin(attempt: WorkBuddyLoginAttempt, fetchFn?: typeof fetch, signal?: AbortSignal): Promise<WorkBuddyCredentials | null>;
|
|
26
|
+
/** Where a completed sign-in is written; the default is this line's own store. */
|
|
27
|
+
export interface WorkBuddyLoginOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Persist the completed credential.
|
|
30
|
+
*
|
|
31
|
+
* The account pool owns routing, so it is what a completed sign-in must reach;
|
|
32
|
+
* the default writes to the credential store alone, which is what a caller
|
|
33
|
+
* running without a pool needs.
|
|
34
|
+
*/
|
|
35
|
+
onSave?: (credentials: WorkBuddyCredentials) => Promise<unknown>;
|
|
36
|
+
}
|
|
37
|
+
export declare function beginWebLogin(store: FileCredentialStore, region: WorkBuddyRegion, fetchFn?: typeof fetch, options?: WorkBuddyLoginOptions): Promise<WorkBuddyLoginFlowState>;
|
|
38
|
+
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../src/host/workbuddy/oauth.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,mBAAmB,EAAE,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C,EAAE,CAAC,WAAW,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CACjE;AAED,wBAAsB,aAAa,CACjC,KAAK,EAAE,mBAAmB,EAC1B,MAAM,EAAE,eAAe,EACvB,OAAO,GAAE,OAAO,KAAa,EAC7B,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,uBAAuB,CAAC,CAmClC"}
|
|
@@ -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,aAAa,CAAA;AACpB,OAAO,EASL,KAAK,mBAAmB,EACzB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAEV,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,qCAAqC,CAAA;AAG5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,m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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,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAIpG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAIxD,OAAO,EAGL,YAAY,EAEb,MAAM,YAAY,CAAA;AAEnB,eAAO,MAAM,+BAA+B,kBA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