@eddyskywalker/dsh-chatgpt-subscription 0.33.0 → 0.35.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 +96 -110
- package/README.md +51 -110
- package/lib/client.js +5301 -5413
- package/lib/client.js.map +1 -1
- package/lib/index.js +30296 -32529
- 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/locales.d.ts +2 -5
- package/lib/types/client/antigravity/locales.d.ts.map +1 -1
- package/lib/types/client/claude/locales.d.ts +2 -5
- package/lib/types/client/claude/locales.d.ts.map +1 -1
- package/lib/types/client/claude/styles.d.ts +2 -2
- package/lib/types/client/cline-pass/locales.d.ts +0 -6
- package/lib/types/client/cline-pass/locales.d.ts.map +1 -1
- package/lib/types/client/command-code/locales.d.ts +2 -5
- package/lib/types/client/command-code/locales.d.ts.map +1 -1
- package/lib/types/client/common/AccountPoolSection.d.ts +3 -2
- package/lib/types/client/common/AccountPoolSection.d.ts.map +1 -1
- package/lib/types/client/common/account-pool-labels.d.ts +0 -2
- package/lib/types/client/common/account-pool-labels.d.ts.map +1 -1
- package/lib/types/client/common/format.d.ts +12 -2
- package/lib/types/client/common/format.d.ts.map +1 -1
- package/lib/types/client/common/styles.d.ts.map +1 -1
- package/lib/types/client/glm-coding-plan/GlmCodingPlanSection.d.ts +1 -1
- package/lib/types/client/glm-coding-plan/locales.d.ts +2 -5
- package/lib/types/client/glm-coding-plan/locales.d.ts.map +1 -1
- package/lib/types/client/glm-coding-plan/styles.d.ts +3 -2
- package/lib/types/client/glm-coding-plan/styles.d.ts.map +1 -1
- package/lib/types/client/glm-coding-plan/useGlmCodingPlanSection.d.ts.map +1 -1
- package/lib/types/client/hub/UpdateCheck.d.ts +9 -0
- package/lib/types/client/hub/UpdateCheck.d.ts.map +1 -0
- package/lib/types/client/hub/brand-icons.d.ts +2 -2
- package/lib/types/client/hub/brand-icons.d.ts.map +1 -1
- package/lib/types/client/hub/brand-svg.d.ts +0 -4
- package/lib/types/client/hub/brand-svg.d.ts.map +1 -1
- package/lib/types/client/hub/hub-styles.d.ts.map +1 -1
- package/lib/types/client/hub/providers.d.ts.map +1 -1
- package/lib/types/client/index.d.ts +2 -2
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/kimi-code/locales.d.ts +2 -5
- package/lib/types/client/kimi-code/locales.d.ts.map +1 -1
- package/lib/types/client/locales.d.ts +39 -3
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/minimax-code/locales.d.ts +2 -5
- package/lib/types/client/minimax-code/locales.d.ts.map +1 -1
- package/lib/types/client/minimax-code/useMinimaxCodeSection.d.ts +2 -2
- package/lib/types/client/minimax-code/useMinimaxCodeSection.d.ts.map +1 -1
- package/lib/types/client/ollama/locales.d.ts +0 -6
- package/lib/types/client/ollama/locales.d.ts.map +1 -1
- package/lib/types/client/opendesign/OpenDesignComposerQuota.d.ts +20 -0
- package/lib/types/client/opendesign/OpenDesignComposerQuota.d.ts.map +1 -0
- package/lib/types/client/opendesign/OpenDesignSection.d.ts +18 -0
- package/lib/types/client/opendesign/OpenDesignSection.d.ts.map +1 -0
- package/lib/types/client/opendesign/api.d.ts +45 -0
- package/lib/types/client/opendesign/api.d.ts.map +1 -0
- package/lib/types/client/opendesign/locales.d.ts +683 -0
- package/lib/types/client/{workbuddy → opendesign}/locales.d.ts.map +1 -1
- package/lib/types/client/opendesign/styles.d.ts +11 -0
- package/lib/types/client/opendesign/styles.d.ts.map +1 -0
- package/lib/types/client/qoder/QoderSection.d.ts +13 -3
- package/lib/types/client/qoder/QoderSection.d.ts.map +1 -1
- package/lib/types/client/qoder/locales.d.ts +7 -3
- package/lib/types/client/qoder/locales.d.ts.map +1 -1
- package/lib/types/client/qoder/useQoderSection.d.ts.map +1 -1
- package/lib/types/client/step-code/StepCodeComposerQuota.d.ts +2 -2
- package/lib/types/client/step-code/StepCodeSection.d.ts +1 -1
- package/lib/types/client/step-code/locales.d.ts +2 -5
- package/lib/types/client/step-code/locales.d.ts.map +1 -1
- package/lib/types/client/step-code/styles.d.ts +1 -1
- package/lib/types/client/step-code/useStepCodeSection.d.ts.map +1 -1
- package/lib/types/host/claude/account-pool.d.ts +2 -2
- package/lib/types/host/claude/account-pool.d.ts.map +1 -1
- package/lib/types/host/claude/routes.d.ts +1 -1
- package/lib/types/host/common/capabilities.d.ts.map +1 -1
- package/lib/types/host/common/credential-read-cache.d.ts +2 -3
- package/lib/types/host/common/credential-read-cache.d.ts.map +1 -1
- package/lib/types/host/common/model-request-control.d.ts +1 -1
- package/lib/types/host/common/model-request-control.d.ts.map +1 -1
- package/lib/types/host/common/request-diagnostics.d.ts +2 -2
- package/lib/types/host/common/request-diagnostics.d.ts.map +1 -1
- package/lib/types/host/glm-coding-plan/mapper-openai.d.ts +1 -1
- package/lib/types/host/glm-coding-plan/model-catalog.d.ts +4 -4
- package/lib/types/host/kimi-code/adapter.d.ts +31 -0
- package/lib/types/host/kimi-code/adapter.d.ts.map +1 -1
- package/lib/types/host/kimi-code/mapper.d.ts +8 -0
- package/lib/types/host/kimi-code/mapper.d.ts.map +1 -1
- package/lib/types/host/kimi-code/types.d.ts +92 -0
- package/lib/types/host/kimi-code/types.d.ts.map +1 -1
- package/lib/types/host/minimax-code/account-pool.d.ts +6 -7
- package/lib/types/host/minimax-code/account-pool.d.ts.map +1 -1
- package/lib/types/host/minimax-code/checkin.d.ts +7 -8
- package/lib/types/host/minimax-code/checkin.d.ts.map +1 -1
- package/lib/types/host/minimax-code/routes.d.ts +1 -1
- package/lib/types/host/opendesign/account-pool.d.ts +54 -0
- package/lib/types/host/opendesign/account-pool.d.ts.map +1 -0
- package/lib/types/host/opendesign/adapter.d.ts +69 -0
- package/lib/types/host/opendesign/adapter.d.ts.map +1 -0
- package/lib/types/host/opendesign/catalog.d.ts +44 -0
- package/lib/types/host/opendesign/catalog.d.ts.map +1 -0
- package/lib/types/host/opendesign/client.d.ts +148 -0
- package/lib/types/host/opendesign/client.d.ts.map +1 -0
- package/lib/types/host/opendesign/line.d.ts +49 -0
- package/lib/types/host/opendesign/line.d.ts.map +1 -0
- package/lib/types/host/opendesign/mapper.d.ts +128 -0
- package/lib/types/host/opendesign/mapper.d.ts.map +1 -0
- package/lib/types/host/opendesign/oauth.d.ts +105 -0
- package/lib/types/host/opendesign/oauth.d.ts.map +1 -0
- package/lib/types/host/opendesign/routes.d.ts +74 -0
- package/lib/types/host/opendesign/routes.d.ts.map +1 -0
- package/lib/types/host/opendesign/token-store.d.ts +154 -0
- package/lib/types/host/opendesign/token-store.d.ts.map +1 -0
- package/lib/types/host/opendesign/types.d.ts +180 -0
- package/lib/types/host/opendesign/types.d.ts.map +1 -0
- package/lib/types/host/qoder/adapter.d.ts +26 -2
- package/lib/types/host/qoder/adapter.d.ts.map +1 -1
- package/lib/types/host/qoder/client.d.ts +112 -0
- package/lib/types/host/qoder/client.d.ts.map +1 -1
- package/lib/types/host/qoder/model-catalog.d.ts +52 -6
- package/lib/types/host/qoder/model-catalog.d.ts.map +1 -1
- package/lib/types/host/qoder/routes.d.ts +23 -0
- package/lib/types/host/qoder/routes.d.ts.map +1 -1
- package/lib/types/host/qoder/token-store.d.ts +56 -7
- package/lib/types/host/qoder/token-store.d.ts.map +1 -1
- package/lib/types/host/step-code/adapter.d.ts +1 -1
- package/lib/types/host/step-code/client.d.ts +1 -1
- package/lib/types/host/step-code/mapper.d.ts +3 -3
- package/lib/types/host/step-code/oauth.d.ts +1 -1
- package/lib/types/host/update-check.d.ts +118 -0
- package/lib/types/host/update-check.d.ts.map +1 -0
- package/lib/types/index.d.ts +11 -7
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/account-pool-contracts.d.ts +0 -24
- package/lib/types/shared/account-pool-contracts.d.ts.map +1 -1
- package/lib/types/shared/hub-contracts.d.ts +1 -1
- package/lib/types/shared/hub-contracts.d.ts.map +1 -1
- package/lib/types/shared/minimax-code-contracts.d.ts +2 -2
- package/lib/types/shared/opendesign-contracts.d.ts +159 -0
- package/lib/types/shared/opendesign-contracts.d.ts.map +1 -0
- package/lib/types/shared/qoder-contracts.d.ts +40 -1
- package/lib/types/shared/qoder-contracts.d.ts.map +1 -1
- package/lib/types/shared/update-contracts.d.ts +124 -0
- package/lib/types/shared/update-contracts.d.ts.map +1 -0
- package/package.json +1 -1
- package/lib/types/client/workbuddy/WorkBuddyComposerQuota.d.ts +0 -22
- package/lib/types/client/workbuddy/WorkBuddyComposerQuota.d.ts.map +0 -1
- package/lib/types/client/workbuddy/WorkBuddySection.d.ts +0 -50
- package/lib/types/client/workbuddy/WorkBuddySection.d.ts.map +0 -1
- package/lib/types/client/workbuddy/locales.d.ts +0 -635
- package/lib/types/client/workbuddy/styles.d.ts +0 -15
- package/lib/types/client/workbuddy/styles.d.ts.map +0 -1
- package/lib/types/client/workbuddy/useWorkBuddySection.d.ts +0 -149
- package/lib/types/client/workbuddy/useWorkBuddySection.d.ts.map +0 -1
- package/lib/types/host/workbuddy/account-pool.d.ts +0 -235
- package/lib/types/host/workbuddy/account-pool.d.ts.map +0 -1
- package/lib/types/host/workbuddy/adapter.d.ts +0 -129
- package/lib/types/host/workbuddy/adapter.d.ts.map +0 -1
- package/lib/types/host/workbuddy/atrest.d.ts +0 -98
- package/lib/types/host/workbuddy/atrest.d.ts.map +0 -1
- package/lib/types/host/workbuddy/checkin.d.ts +0 -150
- package/lib/types/host/workbuddy/checkin.d.ts.map +0 -1
- package/lib/types/host/workbuddy/client.d.ts +0 -169
- package/lib/types/host/workbuddy/client.d.ts.map +0 -1
- package/lib/types/host/workbuddy/dsml.d.ts +0 -55
- package/lib/types/host/workbuddy/dsml.d.ts.map +0 -1
- package/lib/types/host/workbuddy/guardrails.d.ts +0 -111
- package/lib/types/host/workbuddy/guardrails.d.ts.map +0 -1
- package/lib/types/host/workbuddy/identity.d.ts +0 -71
- package/lib/types/host/workbuddy/identity.d.ts.map +0 -1
- package/lib/types/host/workbuddy/mapper.d.ts +0 -131
- package/lib/types/host/workbuddy/mapper.d.ts.map +0 -1
- package/lib/types/host/workbuddy/model-catalog.d.ts +0 -217
- package/lib/types/host/workbuddy/model-catalog.d.ts.map +0 -1
- package/lib/types/host/workbuddy/oauth.d.ts +0 -47
- package/lib/types/host/workbuddy/oauth.d.ts.map +0 -1
- package/lib/types/host/workbuddy/outbound-identity.d.ts +0 -66
- package/lib/types/host/workbuddy/outbound-identity.d.ts.map +0 -1
- package/lib/types/host/workbuddy/routes.d.ts +0 -56
- package/lib/types/host/workbuddy/routes.d.ts.map +0 -1
- package/lib/types/host/workbuddy/token-store.d.ts +0 -360
- package/lib/types/host/workbuddy/token-store.d.ts.map +0 -1
- package/lib/types/host/workbuddy/types.d.ts +0 -161
- package/lib/types/host/workbuddy/types.d.ts.map +0 -1
- package/lib/types/shared/workbuddy-contracts.d.ts +0 -353
- package/lib/types/shared/workbuddy-contracts.d.ts.map +0 -1
|
@@ -1,131 +0,0 @@
|
|
|
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. Note that the same code is also the gateway's channel-verification
|
|
15
|
-
* refusal (`msg: "conversation id missing"`), which the conversation header
|
|
16
|
-
* group this route sends is what satisfies — see `conversationHeaders` in
|
|
17
|
-
* `client.ts`. A history that is already correct can still answer 11128 for
|
|
18
|
-
* that second reason, so the code alone does not implicate the messages.
|
|
19
|
-
* 3. **Reasoning rides `delta.reasoning_content`,** not OpenAI's
|
|
20
|
-
* `reasoning_summary`, and is emitted as its own DSH reasoning block.
|
|
21
|
-
*/
|
|
22
|
-
import { type OutboundContentBlock, type GenerateOptions, type StreamChunk } from '../common/llm-compat.ts';
|
|
23
|
-
import type { AttachmentStore } from '@deepseek-ai/dsh-attachment';
|
|
24
|
-
export declare function sanitizeText(text: string): string;
|
|
25
|
-
/**
|
|
26
|
-
* The system prompt every request must open with.
|
|
27
|
-
*
|
|
28
|
-
* The international backend rejects a request whose first message is not a
|
|
29
|
-
* system turn, so this stands in when the caller supplies no prompt at all. It
|
|
30
|
-
* is deliberately neutral: it must not change model behaviour beyond satisfying
|
|
31
|
-
* the shape check.
|
|
32
|
-
*/
|
|
33
|
-
declare const IMPLICIT_SYSTEM_PROMPT = "You are a helpful assistant.";
|
|
34
|
-
/** Attachment seam this route needs: verified bytes for one durable image. */
|
|
35
|
-
export type AttachmentImageReader = Pick<AttachmentStore, 'readImage'>;
|
|
36
|
-
/** One durable user image resolved for an in-flight request, or proven unreadable. */
|
|
37
|
-
export type ResolvedRequestImage = {
|
|
38
|
-
readonly kind: 'inline';
|
|
39
|
-
readonly mediaType: string;
|
|
40
|
-
readonly data: string;
|
|
41
|
-
} | {
|
|
42
|
-
readonly kind: 'unavailable';
|
|
43
|
-
};
|
|
44
|
-
/** Resolved images keyed by durable attachment id; consumed by one request build. */
|
|
45
|
-
export type ResolvedRequestImages = ReadonlyMap<string, ResolvedRequestImage>;
|
|
46
|
-
/**
|
|
47
|
-
* Base64 image payload one request may carry.
|
|
48
|
-
*
|
|
49
|
-
* The subscription proxies to several upstream vendors, so the bound has to
|
|
50
|
-
* hold for the strictest of them. 12 MB matches what this plugin's other
|
|
51
|
-
* routes allow and keeps the conversation text and tool schemas in the same
|
|
52
|
-
* body.
|
|
53
|
-
*/
|
|
54
|
-
export declare const MAX_REQUEST_IMAGE_BYTES: number;
|
|
55
|
-
/**
|
|
56
|
-
* Replace the oldest inline images with a text placeholder once one request
|
|
57
|
-
* would carry more than {@link MAX_REQUEST_IMAGE_BYTES} of base64 image data.
|
|
58
|
-
* Durable history is untouched; only the request about to be sent changes.
|
|
59
|
-
*/
|
|
60
|
-
export declare function offloadOldestRequestImages(options: GenerateOptions): GenerateOptions;
|
|
61
|
-
/**
|
|
62
|
-
* Read every durable `{ type: 'image', attachment }` block one request carries.
|
|
63
|
-
* An unreadable image resolves to `unavailable` rather than disappearing, so
|
|
64
|
-
* the model is told the picture is missing instead of answering about a blank.
|
|
65
|
-
*/
|
|
66
|
-
export declare function resolveRequestImages(options: GenerateOptions, attachments: AttachmentImageReader | undefined, signal?: AbortSignal): Promise<ResolvedRequestImages>;
|
|
67
|
-
/** Drop the JSON-Schema keywords provider gateways reject or ignore. */
|
|
68
|
-
export declare function stripMetaSchema(schema: unknown): Record<string, unknown>;
|
|
69
|
-
/**
|
|
70
|
-
* Build one `/v2/chat/completions` body.
|
|
71
|
-
*
|
|
72
|
-
* Always `stream: true`: the endpoint rejects a non-streaming request outright
|
|
73
|
-
* (400 `code 11101`), so there is no second shape to produce.
|
|
74
|
-
*/
|
|
75
|
-
export declare function buildChatRequest(options: GenerateOptions, images?: ResolvedRequestImages): Record<string, unknown>;
|
|
76
|
-
interface PendingToolCall {
|
|
77
|
-
blockIndex: number;
|
|
78
|
-
id: string;
|
|
79
|
-
name: string;
|
|
80
|
-
arguments: string;
|
|
81
|
-
started: boolean;
|
|
82
|
-
}
|
|
83
|
-
export interface WorkBuddyStreamState {
|
|
84
|
-
blocks: OutboundContentBlock[];
|
|
85
|
-
current: {
|
|
86
|
-
index: number;
|
|
87
|
-
type: 'text' | 'reasoning';
|
|
88
|
-
text: string;
|
|
89
|
-
} | null;
|
|
90
|
-
/** wire tool index -> accumulating call. */
|
|
91
|
-
toolCalls: Map<number, PendingToolCall>;
|
|
92
|
-
hasContent: boolean;
|
|
93
|
-
hasToolCall: boolean;
|
|
94
|
-
finishReason: string | null;
|
|
95
|
-
/** The `[DONE]` sentinel arrived. */
|
|
96
|
-
done: boolean;
|
|
97
|
-
/** Terminal chunks were already emitted. */
|
|
98
|
-
finished: boolean;
|
|
99
|
-
inputTokens: number;
|
|
100
|
-
outputTokens: number;
|
|
101
|
-
cacheReadTokens: number;
|
|
102
|
-
cacheWriteTokens: number;
|
|
103
|
-
reasoningTokens: number;
|
|
104
|
-
sawUsage: boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Text held back while it may still turn into a printed tool call.
|
|
107
|
-
*
|
|
108
|
-
* `holding` is set once a `<` that could open a call region was seen; the
|
|
109
|
-
* buffer then grows until the region closes (or the cap is hit), and is
|
|
110
|
-
* resolved into prose or calls exactly once.
|
|
111
|
-
*/
|
|
112
|
-
printed: {
|
|
113
|
-
pending: string;
|
|
114
|
-
holding: boolean;
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
export declare function createStreamState(): WorkBuddyStreamState;
|
|
118
|
-
/** Feed one SSE line from `/v2/chat/completions`. */
|
|
119
|
-
export declare function processStreamLine(line: string, state: WorkBuddyStreamState): StreamChunk[];
|
|
120
|
-
/** Flush every open block, then emit usage and the terminal finish. */
|
|
121
|
-
export declare function closeStream(state: WorkBuddyStreamState): StreamChunk[];
|
|
122
|
-
/**
|
|
123
|
-
* A stream that ends without a terminal event is truncated, not complete.
|
|
124
|
-
*
|
|
125
|
-
* The endpoint always terminates with either `finish_reason` or `[DONE]`, so
|
|
126
|
-
* their absence means the connection dropped mid-answer and the partial text
|
|
127
|
-
* must not be presented as a finished reply.
|
|
128
|
-
*/
|
|
129
|
-
export declare function assertStreamComplete(state: WorkBuddyStreamState): void;
|
|
130
|
-
export { IMPLICIT_SYSTEM_PROMPT };
|
|
131
|
-
//# sourceMappingURL=mapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mapper.d.ts","sourceRoot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E,CAiF1F;AAuED,uEAAuE;AACvE,wBAAgB,WAAW,CAAC,KAAK,EAAE,oBAAoB,GAAG,WAAW,EAAE,CAOtE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAItE;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAA"}
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Model catalog for the 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).
|
|
15
|
-
*
|
|
16
|
-
* One entry serves both regions, so a model the regions disagree about needs a
|
|
17
|
-
* merged figure. The rule is asymmetric on purpose: the **larger maximum** is
|
|
18
|
-
* kept, while the **served default** and the **output cap** take the **smaller**
|
|
19
|
-
* of the two. Over-declaring either one is a hard failure — DSH would send a
|
|
20
|
-
* request the gateway rejects — whereas under-declaring only compresses a
|
|
21
|
-
* conversation earlier than needed, and both remain overridable per model from
|
|
22
|
-
* the settings card. Measured disagreements (`glm-5.3-flash`, `glm-5.3`,
|
|
23
|
-
* `glm-5.2`, `kimi-k2.8-preview` served 300000/48000/48000/32000 by intl
|
|
24
|
-
* against 1000000/64000/64000/64000 by cn) are reconciled that way.
|
|
25
|
-
*
|
|
26
|
-
* The regions also do not serve the same ids. intl added `glm-5.3-flash` and
|
|
27
|
-
* keeps `gemini-3.5-flash`, `kimi-k3` and the `*-model` aliases to itself; cn
|
|
28
|
-
* keeps `glm-5.3-flash`, `kimi-k3-1` and its own `-x` variants.
|
|
29
|
-
*
|
|
30
|
-
* `regions` is a routing fact, not a preference: asking a region for a model it
|
|
31
|
-
* does not serve answers 400 `code 11102`.
|
|
32
|
-
*
|
|
33
|
-
* A second `code 11102` source was measured and is deliberately NOT filtered
|
|
34
|
-
* out here: the gateway lists models the *current account* is not entitled to
|
|
35
|
-
* call (on a free plan, `glm-5.0`, `glm-4.7`, `glm-4.6`, `glm-4.6v`,
|
|
36
|
-
* `kimi-k2-thinking`, `hy4-preview-x` and `minimax-m2.5` all advertise a context
|
|
37
|
-
* window and then answer 11102). Those entries are kept because the gating is
|
|
38
|
-
* per-account, not per-model — a paid plan may serve them — and because the
|
|
39
|
-
* shipped default selection excludes them anyway. The adapter's failure message
|
|
40
|
-
* names this case so a user knows to pick another model rather than to retry.
|
|
41
|
-
*
|
|
42
|
-
* `credits` is the consumption multiplier the same payload publishes as a
|
|
43
|
-
* string (`x0.79 credits` on cn, `x6.67` on intl), stored here in the bare
|
|
44
|
-
* numeric form the settings card renders. It is kept per region because the two
|
|
45
|
-
* backends do not always agree — measured 2026-10-09, `deepseek-v4.1-flash`
|
|
46
|
-
* is `0.11` on cn against `0.00` on intl — and a key is written only for a
|
|
47
|
-
* region that actually published one (every `gpt-5.x` and `gpt-6-astra` is
|
|
48
|
-
* intl-only, the `minimax` and `glm-5.0`/`glm-4.x` rows carry no intl key).
|
|
49
|
-
* An empty string (`default-model`) means no rate was declared at all, so that
|
|
50
|
-
* row has no `credits` field rather than a zeroed one: a guessed rate on a
|
|
51
|
-
* spend figure is worse than a missing one.
|
|
52
|
-
*
|
|
53
|
-
* `reasoningEfforts` carries the ladder a model accepts, transcribed from the
|
|
54
|
-
* gateway's own declaration. `/v3/config` uses two shapes and they were once
|
|
55
|
-
* conflated, in opposite directions: a lone `{ effort: 'high' }` (no
|
|
56
|
-
* `supportedEfforts`) first became a one-entry ladder, which rejected a
|
|
57
|
-
* caller's explicit `low`; widening it to every level this route can name then
|
|
58
|
-
* advertised `minimal`/`xhigh` on a model that has three. Such a model accepts
|
|
59
|
-
* exactly `low`/`high`/`max` (measured on `deepseek-v4.1-flash`), the same
|
|
60
|
-
* three the gateway declares explicitly for `glm-5.3-flash` and
|
|
61
|
-
* `kimi-k2.8-preview`, and routes any other value into the nearest of them.
|
|
62
|
-
*/
|
|
63
|
-
import type { WorkBuddyModelCredits, WorkBuddyRegion } from '../../shared/workbuddy-contracts.ts';
|
|
64
|
-
export interface WorkBuddyModelEntry {
|
|
65
|
-
id: string;
|
|
66
|
-
name: string;
|
|
67
|
-
/**
|
|
68
|
-
* Context length the gateway serves **by default** for this model.
|
|
69
|
-
*
|
|
70
|
-
* This route sends no explicit context-length parameter, so this is the
|
|
71
|
-
* figure DSH's compaction and overflow decisions must use. It is not always
|
|
72
|
-
* the model's maximum: the gateway reports both (for example
|
|
73
|
-
* `deepseek-v4.1-flash` serves 300000 by default and allows 1000000).
|
|
74
|
-
*/
|
|
75
|
-
contextWindow: number;
|
|
76
|
-
/** Largest context length the model accepts when one is requested. */
|
|
77
|
-
maxContextWindow: number;
|
|
78
|
-
/** Output cap requested when the caller omits one. */
|
|
79
|
-
maxTokens: number;
|
|
80
|
-
/** Regions whose backend serves this id. */
|
|
81
|
-
regions: readonly WorkBuddyRegion[];
|
|
82
|
-
/**
|
|
83
|
-
* Consumption multiplier per region, as `/v3/config` publishes it.
|
|
84
|
-
*
|
|
85
|
-
* Optional on purpose: the multiplier is the one field the gateway may omit
|
|
86
|
-
* for a model it otherwise describes (`default-model` ships an empty string),
|
|
87
|
-
* so every catalog literal in this repo — test fixtures and the live parser
|
|
88
|
-
* alike — must stay valid without it. Absent therefore means "nothing usable
|
|
89
|
-
* was published", never "zero": `x0.00` is a real declaration and is kept.
|
|
90
|
-
*/
|
|
91
|
-
credits?: WorkBuddyModelCredits;
|
|
92
|
-
/** Whether the model accepts image input. */
|
|
93
|
-
supportsImage: boolean;
|
|
94
|
-
/** Reasoning ladder the model accepts; empty for a non-reasoning model. */
|
|
95
|
-
reasoningEfforts: readonly string[];
|
|
96
|
-
/** Level this route selects when the caller names none. */
|
|
97
|
-
defaultReasoningEffort: string | null;
|
|
98
|
-
/** Whether the model can be asked to skip thinking entirely. */
|
|
99
|
-
canDisableThinking: boolean;
|
|
100
|
-
/** One-line note shown beside the model in the settings card. */
|
|
101
|
-
description: string;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Models the gateway serves but does not publish in `/v3/config`.
|
|
105
|
-
*
|
|
106
|
-
* The catalog is a published list, not the served one: measured on the
|
|
107
|
-
* international backend, `gpt-6-sol`, `gpt-6-luna` and `gemini-3.8-flash` all
|
|
108
|
-
* answer a normal streaming completion with 200 while being absent from
|
|
109
|
-
* `/v3/config` entirely, and a reachable gateway *replaces* the shipped table
|
|
110
|
-
* with that list. Without these rows the picker would simply never show them, so
|
|
111
|
-
* they are declared here and merged into a live catalog too
|
|
112
|
-
* ({@link withUnpublishedModels}) rather than living in the fallback alone.
|
|
113
|
-
*
|
|
114
|
-
* What each row records, and how it was established, differs by field:
|
|
115
|
-
*
|
|
116
|
-
* - **Existence, the reasoning ladder, image support** were measured against the
|
|
117
|
-
* live endpoint, not inferred from the name. A rejected level answers 400
|
|
118
|
-
* `code 11133` with `extError` `400002`; `gpt-6-sol` takes exactly the ladder
|
|
119
|
-
* `gpt-6-astra` publishes (`minimal` refused, `low`/`medium`/`high`/`xhigh`/
|
|
120
|
-
* `max` accepted) and both accept a 1x1 PNG.
|
|
121
|
-
* - **Context window, output cap and `canDisableThinking` are inherited from the
|
|
122
|
-
* published sibling in the same family** — `gpt-6-astra` for `gpt-6-sol` and
|
|
123
|
-
* `gpt-6-luna`, `gemini-3.5-flash` for `gemini-3.8-flash`. They are marked
|
|
124
|
-
* here rather than measured because the gateway publishes nothing for these
|
|
125
|
-
* ids and offers no cheap way to read the real figure: it accepts a
|
|
126
|
-
* `max_tokens` larger than any published window (even for `gpt-6-astra`, whose
|
|
127
|
-
* own catalog caps at 128000), so the number is neither enforced nor
|
|
128
|
-
* discoverable from the request side.
|
|
129
|
-
*
|
|
130
|
-
* Every field stays overridable per model from the settings card, and an
|
|
131
|
-
* inherited window errs low rather than high: over-declaring overflows the
|
|
132
|
-
* gateway mid-session, while under-declaring only compresses earlier.
|
|
133
|
-
*/
|
|
134
|
-
export declare const UNPUBLISHED_MODELS: readonly WorkBuddyModelEntry[];
|
|
135
|
-
/**
|
|
136
|
-
* Offline fallback catalog, transcribed from a live `/v3/config` read.
|
|
137
|
-
*
|
|
138
|
-
* Used when the gateway cannot be reached (first run before sign-in, or a
|
|
139
|
-
* network failure); a reachable gateway always wins.
|
|
140
|
-
*/
|
|
141
|
-
export declare const FALLBACK_MODELS: readonly WorkBuddyModelEntry[];
|
|
142
|
-
/**
|
|
143
|
-
* Models the picker offers on a fresh install.
|
|
144
|
-
*
|
|
145
|
-
* Deliberately short: the catalog holds every id the subscription serves, and
|
|
146
|
-
* the picker is far more usable with the handful of general-purpose models. The
|
|
147
|
-
* card lets a user add the rest, and a first-run default expands to everything
|
|
148
|
-
* the account's region can actually call.
|
|
149
|
-
*/
|
|
150
|
-
export declare const DEFAULT_VISIBLE_MODEL_IDS: readonly string[];
|
|
151
|
-
/** Every id the fallback knows, in declaration order. */
|
|
152
|
-
export declare const WORKBUDDY_MODEL_IDS: readonly string[];
|
|
153
|
-
/**
|
|
154
|
-
* Add the served-but-unpublished models to a live `/v3/config` catalog.
|
|
155
|
-
*
|
|
156
|
-
* A reachable gateway replaces the shipped table with the list it publishes, so
|
|
157
|
-
* a model it serves without listing ({@link UNPUBLISHED_MODELS}) would drop out
|
|
158
|
-
* of the picker the moment the catalog loads. Merging here keeps it offered.
|
|
159
|
-
*
|
|
160
|
-
* A published entry always wins: the gateway is the authority on anything it
|
|
161
|
-
* does describe, so these rows only fill ids the payload is silent about.
|
|
162
|
-
*/
|
|
163
|
-
export declare function withUnpublishedModels(catalog: readonly WorkBuddyModelEntry[], region: WorkBuddyRegion): WorkBuddyModelEntry[];
|
|
164
|
-
/**
|
|
165
|
-
* Resolve one entry from a catalog.
|
|
166
|
-
*
|
|
167
|
-
* An unknown id resolves to a synthetic text-only entry rather than the first
|
|
168
|
-
* catalog row: reporting a real model's capabilities for an id it does not
|
|
169
|
-
* describe would mis-declare image support and route a request to a 400.
|
|
170
|
-
*/
|
|
171
|
-
export declare function resolveWorkBuddyModel(id: string, catalog?: readonly WorkBuddyModelEntry[]): WorkBuddyModelEntry;
|
|
172
|
-
/** Whether one catalog knows this exact id. */
|
|
173
|
-
export declare function isWorkBuddyModelId(id: unknown, catalog?: readonly WorkBuddyModelEntry[]): id is string;
|
|
174
|
-
/** The vendor family one model belongs to. */
|
|
175
|
-
export declare function workBuddyModelVendor(id: string): string;
|
|
176
|
-
/**
|
|
177
|
-
* Group a list so every vendor's models sit together.
|
|
178
|
-
*
|
|
179
|
-
* Families appear in the order their first model does — the catalog decides
|
|
180
|
-
* which vendor leads, not this function — and each family is ordered newest
|
|
181
|
-
* generation first.
|
|
182
|
-
*/
|
|
183
|
-
export declare function groupWorkBuddyModelsByVendor<T extends {
|
|
184
|
-
id: string;
|
|
185
|
-
}>(models: readonly T[]): T[];
|
|
186
|
-
/**
|
|
187
|
-
* Models an account in `region` can actually call, grouped by vendor.
|
|
188
|
-
*
|
|
189
|
-
* Grouped here rather than in the settings card because this is also what the
|
|
190
|
-
* request path resolves against: one ordering rule, so the picker and the
|
|
191
|
-
* adapter can never disagree about which models a region offers.
|
|
192
|
-
*/
|
|
193
|
-
export declare function modelsForRegion(region: WorkBuddyRegion, catalog?: readonly WorkBuddyModelEntry[]): WorkBuddyModelEntry[];
|
|
194
|
-
/** Whether one model accepts image input. */
|
|
195
|
-
export declare function workBuddyModelSupportsImage(id: string, catalog?: readonly WorkBuddyModelEntry[]): boolean;
|
|
196
|
-
/**
|
|
197
|
-
* Reasoning ladder one model accepts, plus `none` when its trace can be turned off.
|
|
198
|
-
*
|
|
199
|
-
* The ladder in the catalog is what the model ACCEPTS, so `none` never appears
|
|
200
|
-
* in it; `canDisableThinking` is the separate statement that switching thinking
|
|
201
|
-
* off is allowed, and this is the single place that turns it into the one level
|
|
202
|
-
* the picker can offer. Callers that need the ladder alone read the entry.
|
|
203
|
-
*/
|
|
204
|
-
export declare function workBuddyReasoningEfforts(id: string, catalog?: readonly WorkBuddyModelEntry[]): readonly string[];
|
|
205
|
-
/**
|
|
206
|
-
* Consumption multiplier per region one model publishes.
|
|
207
|
-
*
|
|
208
|
-
* Read through {@link resolveWorkBuddyModel} like the other accessors, so an id
|
|
209
|
-
* no catalog describes reports `{}` — "no rate published" rather than a rate
|
|
210
|
-
* of zero.
|
|
211
|
-
*/
|
|
212
|
-
export declare function workBuddyModelCredits(id: string, catalog?: readonly WorkBuddyModelEntry[]): WorkBuddyModelCredits;
|
|
213
|
-
/** Output cap requested when the caller omits one. */
|
|
214
|
-
export declare function maxOutputTokensFor(id: string, catalog?: readonly WorkBuddyModelEntry[]): number;
|
|
215
|
-
/** Context window assumed when no override is saved. */
|
|
216
|
-
export declare function defaultContextWindowFor(id: string, catalog?: readonly WorkBuddyModelEntry[]): number;
|
|
217
|
-
//# sourceMappingURL=model-catalog.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model-catalog.d.ts","sourceRoot":"","sources":["../../../../src/host/workbuddy/model-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAIjG,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ;;;;;;;OAOG;IACH,aAA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BAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAMvD;AAwCD;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,EAAE,CAWhG;AAED;;;;;;GAMG;AACH,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;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,SAAS,mBAAmB,EAAoB,GACxD,SAAS,MAAM,EAAE,CAInB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,SAAS,mBAAmB,EAAoB,GACxD,qBAAqB,CAEvB;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"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { FileCredentialStore, type WorkBuddyCredentials } from './token-store.ts';
|
|
2
|
-
import { type WorkBuddyTokenIdentity } from './identity.ts';
|
|
3
|
-
import type { WorkBuddyRegion } from '../../shared/workbuddy-contracts.ts';
|
|
4
|
-
export type WorkBuddyLoginStatus = 'idle' | 'pending' | 'complete' | 'error';
|
|
5
|
-
export interface WorkBuddyLoginFlowState {
|
|
6
|
-
status: WorkBuddyLoginStatus;
|
|
7
|
-
region?: WorkBuddyRegion;
|
|
8
|
-
authUrl?: string;
|
|
9
|
-
progress?: string;
|
|
10
|
-
accountId?: string;
|
|
11
|
-
startedAt?: number;
|
|
12
|
-
completedAt?: number;
|
|
13
|
-
error?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare function getWebLoginStatus(): WorkBuddyLoginFlowState;
|
|
16
|
-
export declare function resetWebLogin(): void;
|
|
17
|
-
export interface WorkBuddyLoginAttempt {
|
|
18
|
-
state: string;
|
|
19
|
-
authUrl: string;
|
|
20
|
-
region: WorkBuddyRegion;
|
|
21
|
-
domain: string;
|
|
22
|
-
}
|
|
23
|
-
export declare function requestLoginState(region: WorkBuddyRegion, fetchFn?: typeof fetch, signal?: AbortSignal): Promise<WorkBuddyLoginAttempt>;
|
|
24
|
-
/** Parse the successful token-poll shape while accepting the two observed wrappers. */
|
|
25
|
-
export declare function parseLoginCredential(payload: unknown, attempt: WorkBuddyLoginAttempt): WorkBuddyCredentials | null;
|
|
26
|
-
export declare function pollLogin(attempt: WorkBuddyLoginAttempt, fetchFn?: typeof fetch, signal?: AbortSignal): Promise<WorkBuddyCredentials | null>;
|
|
27
|
-
/** Where a completed sign-in is written; the default is this line's own store. */
|
|
28
|
-
export interface WorkBuddyLoginOptions {
|
|
29
|
-
/**
|
|
30
|
-
* Persist the completed credential.
|
|
31
|
-
*
|
|
32
|
-
* The account pool owns routing, so it is what a completed sign-in must reach;
|
|
33
|
-
* the default writes to the credential store alone, which is what a caller
|
|
34
|
-
* running without a pool needs.
|
|
35
|
-
*/
|
|
36
|
-
onSave?: (credentials: WorkBuddyCredentials) => Promise<unknown>;
|
|
37
|
-
/**
|
|
38
|
-
* Resolve the signed-in account's identity before it is saved.
|
|
39
|
-
*
|
|
40
|
-
* The token response does not say which account it belongs to, so the default
|
|
41
|
-
* reads it from the account endpoint; a test can replace this, and a caller
|
|
42
|
-
* that already knows the identity can skip the extra request.
|
|
43
|
-
*/
|
|
44
|
-
resolveIdentity?: (credentials: WorkBuddyCredentials) => Promise<WorkBuddyTokenIdentity | null>;
|
|
45
|
-
}
|
|
46
|
-
export declare function beginWebLogin(store: FileCredentialStore, region: WorkBuddyRegion, fetchFn?: typeof fetch, options?: WorkBuddyLoginOptions): Promise<WorkBuddyLoginFlowState>;
|
|
47
|
-
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../src/host/workbuddy/oauth.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,mBAAmB,EAAsB,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACrG,OAAO,EAAwB,KAAK,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAEjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAE1E,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAA;AAE5E,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,oBAAoB,CAAA;IAC5B,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAKD,wBAAgB,iBAAiB,IAAI,uBAAuB,CAE3D;AAED,wBAAgB,aAAa,IAAI,IAAI,CAIpC;AA0CD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,eAAe,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,eAAe,EACvB,OAAO,GAAE,OAAO,KAAa,EAC7B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,qBAAqB,CAAC,CAwBhC;AAED,uFAAuF;AACvF,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,qBAAqB,GAAG,oBAAoB,GAAG,IAAI,CAoClH;AAED,wBAAsB,SAAS,CAC7B,OAAO,EAAE,qBAAqB,EAC9B,OAAO,GAAE,OAAO,KAAa,EAC7B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CActC;AAED,kFAAkF;AAClF,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAChE;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,CAAC,WAAW,EAAE,oBAAoB,KAAK,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAA;CAChG;AA8BD,wBAAsB,aAAa,CACjC,KAAK,EAAE,mBAAmB,EAC1B,MAAM,EAAE,eAAe,EACvB,OAAO,GAAE,OAAO,KAAa,EAC7B,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,uBAAuB,CAAC,CAuClC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Outbound client identities this route can present.
|
|
3
|
-
*
|
|
4
|
-
* The subscription gateway gates on client identity, and it gates DIFFERENTLY
|
|
5
|
-
* per surface: measured on this route, `CodeBuddyIDE` is rejected by
|
|
6
|
-
* `/v3/config` with 400 `code 12403` ("check ua") and 401'd outright by the
|
|
7
|
-
* international chat endpoint, which is why the CLI identity is what the line
|
|
8
|
-
* ships and has always used.
|
|
9
|
-
*
|
|
10
|
-
* Two more identities exist on the same backend, and workbuddy2api-hub has
|
|
11
|
-
* captured what the real clients send (their `wb_identity.py`, measured
|
|
12
|
-
* 2026-10-16 with mitmproxy against the international desktop build 5.8.4):
|
|
13
|
-
*
|
|
14
|
-
* desktop `WorkBuddy/5.8.4 workbuddy-ai/5.8.4 CLI/2.161.0`
|
|
15
|
-
* + `X-IDE-Type/Name: WorkBuddy`, `X-IDE-Version`, `X-Agent-Intent: craft`
|
|
16
|
-
* + `X-Agent-Purpose: conversation`, `X-Agent-Type: main`, trace headers
|
|
17
|
-
* vscode `VSCode/1.119.0 WorkBuddy/4.9.29177644`
|
|
18
|
-
* + `X-IDE-Type/Name: VSCode`, `X-IDE-Version`, `X-Product-Version`, `X-Env-ID`
|
|
19
|
-
* cli `CLI/<v> CodeBuddy/<v>` + `X-IDE-Type/Name: CLI`
|
|
20
|
-
*
|
|
21
|
-
* `cli` is deliberately kept byte-identical to what this line sends today
|
|
22
|
-
* (including the `CodeBuddyIDE` IDE name, which is what was actually measured
|
|
23
|
-
* to work here) so the default cannot regress; the other two are opt-in
|
|
24
|
-
* attempts.
|
|
25
|
-
*
|
|
26
|
-
* Quota is NOT per identity: the subscription meters an account × model over a
|
|
27
|
-
* 24h window (429 `code 6004`), so switching identity cannot create allowance.
|
|
28
|
-
* What it can do is give each account a stable, plausible client — the same
|
|
29
|
-
* reason the gateway projects one device per account.
|
|
30
|
-
*/
|
|
31
|
-
import type { WorkBuddyOutboundProduct, WorkBuddyOutboundSetting } from '../../shared/workbuddy-contracts.ts';
|
|
32
|
-
export type { WorkBuddyOutboundProduct, WorkBuddyOutboundSetting };
|
|
33
|
-
/** Everything the settings card may offer, in display order. */
|
|
34
|
-
export declare const OUTBOUND_PRODUCTS: readonly WorkBuddyOutboundProduct[];
|
|
35
|
-
/** Shipped default: the identity this line already ships and measured working. */
|
|
36
|
-
export declare const DEFAULT_OUTBOUND_SETTING: WorkBuddyOutboundSetting;
|
|
37
|
-
/** Narrow a stored or patched value into a supported preference. */
|
|
38
|
-
export declare function normalizeOutboundSetting(value: unknown): WorkBuddyOutboundSetting;
|
|
39
|
-
/**
|
|
40
|
-
* Which identity one account uses.
|
|
41
|
-
*
|
|
42
|
-
* `auto` assigns by hashing the account key, so an account keeps the same
|
|
43
|
-
* client for its whole life — the one property that matters for a device
|
|
44
|
-
* fingerprint — while a pool as a whole spreads over the available clients.
|
|
45
|
-
*/
|
|
46
|
-
export declare function resolveOutboundProduct(setting: WorkBuddyOutboundSetting, accountKey: string): WorkBuddyOutboundProduct;
|
|
47
|
-
/**
|
|
48
|
-
* A stable pseudo-device id for one account.
|
|
49
|
-
*
|
|
50
|
-
* Same derivation as the measured clients (`derive_id`: md5 of `salt:uid`
|
|
51
|
-
* reshaped into a UUID), so the value is a well-formed v4-shaped machine id
|
|
52
|
-
* that never changes for an account and never collides between accounts. A
|
|
53
|
-
* per-PROCESS id would be worse than none here: it would present every account
|
|
54
|
-
* in the pool as the same machine.
|
|
55
|
-
*/
|
|
56
|
-
export declare function deriveMachineId(uid: string): string;
|
|
57
|
-
/** Identity-specific headers and user agent for one request. */
|
|
58
|
-
export interface OutboundIdentity {
|
|
59
|
-
product: WorkBuddyOutboundProduct;
|
|
60
|
-
userAgent: string;
|
|
61
|
-
/** Extra or overriding headers; `conversation` supplies the ids already minted. */
|
|
62
|
-
headers(conversation: Readonly<Record<string, string>>): Record<string, string>;
|
|
63
|
-
}
|
|
64
|
-
/** Resolve the identity block for one product on one region. */
|
|
65
|
-
export declare function outboundIdentity(product: WorkBuddyOutboundProduct, region: 'cn' | 'intl', uid: string): OutboundIdentity;
|
|
66
|
-
//# sourceMappingURL=outbound-identity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"outbound-identity.d.ts","sourceRoot":"","sources":["../../../../src/host/workbuddy/outbound-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,qCAAqC,CAAA;AAE5C,YAAY,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,CAAA;AAElE,gEAAgE;AAChE,eAAO,MAAM,iBAAiB,EAAE,SAAS,wBAAwB,EAAmC,CAAA;AAEpG,kFAAkF;AAClF,eAAO,MAAM,wBAAwB,EAAE,wBAAgC,CAAA;AAEvE,oEAAoE;AACpE,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB,CAKjF;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,wBAAwB,EACjC,UAAU,EAAE,MAAM,GACjB,wBAAwB,CAK1B;AAqBD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAInD;AAoBD,gEAAgE;AAChE,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,wBAAwB,CAAA;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,mFAAmF;IACnF,OAAO,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChF;AAED,gEAAgE;AAChE,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,wBAAwB,EACjC,MAAM,EAAE,IAAI,GAAG,MAAM,EACrB,GAAG,EAAE,MAAM,GACV,gBAAgB,CA4ClB"}
|
|
@@ -1,56 +0,0 @@
|
|
|
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 WorkBuddyAtRestKeyStore, 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 { WorkBuddyCheckinService } from './checkin.ts';
|
|
8
|
-
import type { WorkBuddyAccountPool } from './account-pool.ts';
|
|
9
|
-
/**
|
|
10
|
-
* The selection the card should show.
|
|
11
|
-
*
|
|
12
|
-
* A stored list that still equals the shipped default has never been edited, so
|
|
13
|
-
* it cannot know about models the catalog has since added; treating it as
|
|
14
|
-
* "everything this account can call" keeps a first run from hiding models
|
|
15
|
-
* behind an unedited default. Any explicit edit is honoured exactly.
|
|
16
|
-
*/
|
|
17
|
-
export declare function resolveEnabledModelIds(stored: readonly string[], available: readonly string[], enabled?: boolean): string[];
|
|
18
|
-
/**
|
|
19
|
-
* Build the model options the settings card renders.
|
|
20
|
-
*
|
|
21
|
-
* Order comes from the caller, which passes a vendor-grouped list so a family
|
|
22
|
-
* is not interleaved with the next one; this preserves whatever order it is
|
|
23
|
-
* given rather than imposing a second one.
|
|
24
|
-
*
|
|
25
|
-
* `credits` is passed through whole, every region the entry carries. Trimming
|
|
26
|
-
* it to one account's region is tempting and wrong: this DTO is also read with
|
|
27
|
-
* no account in hand (the harness resolves a model list before a credential is
|
|
28
|
-
* chosen), and such a caller would be told nothing rather than everything. The
|
|
29
|
-
* region key the reader actually has is already on each entry as `regions`, so
|
|
30
|
-
* picking a value is the renderer's job, not this one's.
|
|
31
|
-
*/
|
|
32
|
-
export declare function buildModelOptions(catalog: readonly WorkBuddyModelEntry[], available: readonly string[], enabledModelIds: readonly string[], overrides: Record<string, number>): WorkBuddyModelOption[];
|
|
33
|
-
export interface WorkBuddyStatusOptions {
|
|
34
|
-
fetchFn?: typeof fetch;
|
|
35
|
-
/** Whether this plugin currently owns the provider route; re-read on every status. */
|
|
36
|
-
serving?: boolean | (() => boolean);
|
|
37
|
-
/** Diagnostic when another plugin owns the provider route; re-read on every status. */
|
|
38
|
-
conflict?: string | null | (() => string | null);
|
|
39
|
-
/** Multi-account pool this line schedules through; absent keeps the single-account card. */
|
|
40
|
-
accountPool?: WorkBuddyAccountPool;
|
|
41
|
-
/** Daily check-in scheduler; absent leaves the card's check-in row empty. */
|
|
42
|
-
checkin?: Pick<WorkBuddyCheckinService, 'tick' | 'summary'>;
|
|
43
|
-
/**
|
|
44
|
-
* Storage for the `$wbEncrypted` at-rest key.
|
|
45
|
-
*
|
|
46
|
-
* Absent hides the whole control: without it a pasted key could not be
|
|
47
|
-
* remembered, and offering the field anyway would lose it on restart.
|
|
48
|
-
*/
|
|
49
|
-
atRestKey?: Pick<WorkBuddyAtRestKeyStore, 'adopt' | 'clear' | 'load' | 'path'>;
|
|
50
|
-
}
|
|
51
|
-
/** Everything the settings card renders: account, quota, and the model catalog. */
|
|
52
|
-
export declare function getWorkBuddyWebStatus(store: FileCredentialStore, modelSettings: FileModelSettingsStore, preferences?: WorkBuddyPreferenceStore, options?: WorkBuddyStatusOptions): Promise<WorkBuddyWebStatus>;
|
|
53
|
-
/** Register the WorkBuddy settings routes under `/workbuddy/api`. */
|
|
54
|
-
export declare function registerWorkBuddyRoutes(ctx: Context, store: FileCredentialStore, modelSettings: FileModelSettingsStore, preferences?: WorkBuddyPreferenceStore, options?: WorkBuddyStatusOptions): () => void;
|
|
55
|
-
export { PROVIDER_ID, PROVIDER_NAME, DEFAULT_CONTEXT_WINDOW, getCachedQuota, type WorkBuddyModelOption, type WorkBuddyWebStatus, };
|
|
56
|
-
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;AAIlD,OAAO,EAGL,sBAAsB,EACtB,WAAW,EACX,aAAa,EAEd,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EAGtB,KAAK,uBAAuB,EAE5B,KAAK,wBAAwB,EAC9B,MAAM,kBAAkB,CAAA;AAIzB,OAAO,EAKL,cAAc,EAKf,MAAM,aAAa,CAAA;AACpB,OAAO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