@eddyskywalker/dsh-chatgpt-subscription 0.34.0 → 0.36.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 +76 -110
- package/README.md +6 -6
- package/lib/client.js +2741 -2177
- package/lib/client.js.map +1 -1
- package/lib/index.js +3224 -9314
- 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 +2 -5
- package/lib/types/client/antigravity/locales.d.ts.map +1 -1
- package/lib/types/client/claude/ClaudeSection.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/claude/useClaudeSection.d.ts.map +1 -1
- package/lib/types/client/cline-pass/ClinePassSection.d.ts.map +1 -1
- 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/CommandCodeSection.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 +2 -2
- package/lib/types/client/common/line-locale.d.ts +21 -0
- package/lib/types/client/common/line-locale.d.ts.map +1 -0
- 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/GlmCodingPlanSection.d.ts.map +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 +1 -1
- 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 +0 -2
- 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/KimiModelCapabilities.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-ru/account-pool.d.ts +11 -0
- package/lib/types/client/locales-ru/account-pool.d.ts.map +1 -0
- package/lib/types/client/locales-ru/antigravity.d.ts +10 -0
- package/lib/types/client/locales-ru/antigravity.d.ts.map +1 -0
- package/lib/types/client/locales-ru/claude.d.ts +3 -0
- package/lib/types/client/locales-ru/claude.d.ts.map +1 -0
- package/lib/types/client/locales-ru/cline-pass.d.ts +11 -0
- package/lib/types/client/locales-ru/cline-pass.d.ts.map +1 -0
- package/lib/types/client/locales-ru/command-code.d.ts +9 -0
- package/lib/types/client/locales-ru/command-code.d.ts.map +1 -0
- package/lib/types/client/locales-ru/glm-coding-plan.d.ts +10 -0
- package/lib/types/client/locales-ru/glm-coding-plan.d.ts.map +1 -0
- package/lib/types/client/locales-ru/hub.d.ts +3 -0
- package/lib/types/client/locales-ru/hub.d.ts.map +1 -0
- package/lib/types/client/locales-ru/index.d.ts +27 -0
- package/lib/types/client/locales-ru/index.d.ts.map +1 -0
- package/lib/types/client/locales-ru/kimi-code.d.ts +10 -0
- package/lib/types/client/locales-ru/kimi-code.d.ts.map +1 -0
- package/lib/types/client/locales-ru/minimax-code.d.ts +9 -0
- package/lib/types/client/locales-ru/minimax-code.d.ts.map +1 -0
- package/lib/types/client/locales-ru/ollama.d.ts +10 -0
- package/lib/types/client/locales-ru/ollama.d.ts.map +1 -0
- package/lib/types/client/locales-ru/opendesign.d.ts +10 -0
- package/lib/types/client/locales-ru/opendesign.d.ts.map +1 -0
- package/lib/types/client/locales-ru/progress-updates.d.ts +8 -0
- package/lib/types/client/locales-ru/progress-updates.d.ts.map +1 -0
- package/lib/types/client/locales-ru/qoder.d.ts +11 -0
- package/lib/types/client/locales-ru/qoder.d.ts.map +1 -0
- package/lib/types/client/locales-ru/step-code.d.ts +9 -0
- package/lib/types/client/locales-ru/step-code.d.ts.map +1 -0
- 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/OllamaSection.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/OpenDesignSection.d.ts +4 -3
- package/lib/types/client/opendesign/OpenDesignSection.d.ts.map +1 -1
- package/lib/types/client/opendesign/locales.d.ts +108 -48
- package/lib/types/client/opendesign/locales.d.ts.map +1 -1
- package/lib/types/client/opendesign/styles.d.ts.map +1 -1
- package/lib/types/client/qoder/QoderSection.d.ts +3 -2
- package/lib/types/client/qoder/QoderSection.d.ts.map +1 -1
- package/lib/types/client/qoder/locales.d.ts +1 -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/StepCodeSection.d.ts.map +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/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/client.d.ts +53 -0
- package/lib/types/host/opendesign/client.d.ts.map +1 -1
- package/lib/types/host/opendesign/routes.d.ts +4 -3
- package/lib/types/host/opendesign/routes.d.ts.map +1 -1
- package/lib/types/host/opendesign/types.d.ts +10 -0
- package/lib/types/host/opendesign/types.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 +0 -6
- 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 +35 -2
- package/lib/types/shared/opendesign-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/locales.d.ts.map +0 -1
- 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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../../src/client/workbuddy/locales.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,kBAAkB,CAAA;AAE3C,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0GL,CAAA;AAEV,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0GL,CAAA;AAEV,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKxB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,EAAE,CAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const STYLE_ID = "dsh-workbuddy-settings-style";
|
|
2
|
-
/**
|
|
3
|
-
* WorkBuddy-only additions to the shared settings design system.
|
|
4
|
-
*
|
|
5
|
-
* The base control styles (`.dsha-page`, `.dsha-group`, `.dsha-models`, the
|
|
6
|
-
* account card, …) come from the stylesheet the sibling routes install, in the
|
|
7
|
-
* same order the client installs them, so this file declares only what stays
|
|
8
|
-
* unique to this card: the mono credential paths and the login-progress line.
|
|
9
|
-
*
|
|
10
|
-
* Everything this tab used to declare locally — the per-model capability line
|
|
11
|
-
* and the account-region headings — is gone: the model pill is name-only like
|
|
12
|
-
* every sibling tab, and the account card is the shared one.
|
|
13
|
-
*/
|
|
14
|
-
export declare function installWorkBuddyStyles(): void;
|
|
15
|
-
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/client/workbuddy/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,iCAAiC,CAAA;AAEtD;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAsB7C"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import type { AccountRotationStrategy } from '../../shared/account-pool-contracts.ts';
|
|
2
|
-
import type { WorkBuddyAccount, WorkBuddyAccountQuota, WorkBuddyAccountSummaryDto, WorkBuddyCheckinSettings, WorkBuddyGuardrailsDto, WorkBuddyModelOption, WorkBuddyOutboundSetting, WorkBuddyReasoningEffort, WorkBuddyWebStatus } from '../../shared/workbuddy-contracts.ts';
|
|
3
|
-
import { type AccountPoolLabels } from '../common/account-pool-labels.ts';
|
|
4
|
-
/** The seats the settings hub hands the card; both optional, so a bare render works. */
|
|
5
|
-
export interface WorkBuddySectionProps {
|
|
6
|
-
onModelChange?: () => void;
|
|
7
|
-
loadModelDirectory?: () => void;
|
|
8
|
-
}
|
|
9
|
-
interface ConnectionPayload {
|
|
10
|
-
connected: boolean;
|
|
11
|
-
account: WorkBuddyAccount | null;
|
|
12
|
-
latencyMs: number;
|
|
13
|
-
model: string;
|
|
14
|
-
checkedAt: number;
|
|
15
|
-
}
|
|
16
|
-
/** One selectable default reasoning level, with the models that declare it. */
|
|
17
|
-
export interface ReasoningEffortChoice {
|
|
18
|
-
value: WorkBuddyReasoningEffort;
|
|
19
|
-
/** Model names that accept this level, in catalog order. */
|
|
20
|
-
models: string[];
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Reasoning levels the default-effort control may offer.
|
|
24
|
-
*
|
|
25
|
-
* The levels come from what this account's models actually declare — never from
|
|
26
|
-
* the shipped enum alone. The setting is one global default applied to whichever
|
|
27
|
-
* model a conversation uses, so the list is their union; each entry carries the
|
|
28
|
-
* models behind it, and a level only some models accept is labelled as such.
|
|
29
|
-
* Order follows {@link WORKBUDDY_REASONING_EFFORTS}, which is the escalating
|
|
30
|
-
* order the upstream ladder uses.
|
|
31
|
-
*/
|
|
32
|
-
export declare function reasoningEffortChoices(models: WorkBuddyModelOption[]): ReasoningEffortChoice[];
|
|
33
|
-
/**
|
|
34
|
-
* Whether a saved default is unusable for every model on this account.
|
|
35
|
-
*
|
|
36
|
-
* The adapter drops a level the chosen model does not accept instead of sending
|
|
37
|
-
* it, so a value that no model declares silently does nothing. Reporting it is
|
|
38
|
-
* what keeps that from looking like the setting was applied.
|
|
39
|
-
*/
|
|
40
|
-
export declare function unsupportedReasoningEffort(configured: WorkBuddyReasoningEffort | null | undefined, models: WorkBuddyModelOption[]): WorkBuddyReasoningEffort | null;
|
|
41
|
-
/**
|
|
42
|
-
* Everything the card's view consumes, grouped by kind.
|
|
43
|
-
*
|
|
44
|
-
* Returned as one named shape instead of one status blob: a reader can see at a
|
|
45
|
-
* glance what the hook tracks, what it computes from a status answer, and what
|
|
46
|
-
* the view is allowed to ask it to do.
|
|
47
|
-
*/
|
|
48
|
-
export interface WorkBuddySectionView {
|
|
49
|
-
/** Values that change as the card runs. */
|
|
50
|
-
state: {
|
|
51
|
-
/** Last status answer; null until the first read lands. */
|
|
52
|
-
status: WorkBuddyWebStatus | null;
|
|
53
|
-
/** True until the first status read settles, whatever its outcome. */
|
|
54
|
-
loading: boolean;
|
|
55
|
-
/** Id of the action in flight, or null; every disabled control reads it. */
|
|
56
|
-
busy: string | null;
|
|
57
|
-
/** The failure the card's error strip shows. */
|
|
58
|
-
error: string | null;
|
|
59
|
-
/** Result of the last explicit connection test. */
|
|
60
|
-
connection: ConnectionPayload | null;
|
|
61
|
-
/** Line the host reports while a regional sign-in is being polled. */
|
|
62
|
-
loginProgress: string | null;
|
|
63
|
-
/** One free-text capacity draft per model, keyed by model id. */
|
|
64
|
-
contextDrafts: Record<string, string>;
|
|
65
|
-
/** Model id whose context-window save or restore is in flight. */
|
|
66
|
-
savingModel: string | null;
|
|
67
|
-
};
|
|
68
|
-
/** Facts read straight off the current status answer. */
|
|
69
|
-
derived: {
|
|
70
|
-
/** Every account row the shared pool card lists. */
|
|
71
|
-
poolAccounts: WorkBuddyAccountSummaryDto[];
|
|
72
|
-
/** Levels this account's models declare, each with the models behind it. */
|
|
73
|
-
effortChoices: ReasoningEffortChoice[];
|
|
74
|
-
/** Every catalog model, enabled or not; the effort labels count them. */
|
|
75
|
-
allModels: WorkBuddyModelOption[];
|
|
76
|
-
/**
|
|
77
|
-
* A saved default no current model declares, when there is one.
|
|
78
|
-
*
|
|
79
|
-
* The adapter drops a level the chosen model does not accept, so reporting
|
|
80
|
-
* this is what keeps an inert setting from looking applied.
|
|
81
|
-
*/
|
|
82
|
-
strayEffort: WorkBuddyReasoningEffort | null;
|
|
83
|
-
/** Models the context-window editor offers: the enabled ones only. */
|
|
84
|
-
contextModels: WorkBuddyModelOption[];
|
|
85
|
-
/** How many stored overrides exist, whether or not a row still shows them. */
|
|
86
|
-
overrideCount: number;
|
|
87
|
-
/** The displayed account's quota snapshot, when the host has one. */
|
|
88
|
-
quota: WorkBuddyAccountQuota | null | undefined;
|
|
89
|
-
/** Whether a credential is signed in; every authenticated control reads it. */
|
|
90
|
-
authenticated: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* A failed status read with no answer to fall back on.
|
|
93
|
-
*
|
|
94
|
-
* A failed read leaves `status` null, which must NOT be rendered as "no
|
|
95
|
-
* credential found": that claims a credential problem when the real cause is
|
|
96
|
-
* an unreachable route.
|
|
97
|
-
*/
|
|
98
|
-
unreachable: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* The line's dictionary, handed to the shared pool card as one object.
|
|
101
|
-
*
|
|
102
|
-
* The hook already owns it for its own sentences, so the view takes the same
|
|
103
|
-
* object from here rather than reaching for a second import.
|
|
104
|
-
*/
|
|
105
|
-
poolLabels: AccountPoolLabels;
|
|
106
|
-
};
|
|
107
|
-
/** Everything the view can trigger. */
|
|
108
|
-
actions: {
|
|
109
|
-
/** Start a regional sign-in; its flow is polled until it settles. */
|
|
110
|
-
login(region: 'cn' | 'intl'): Promise<void>;
|
|
111
|
-
/** Re-read the credentials the host can find on this machine. */
|
|
112
|
-
rescan(): Promise<void>;
|
|
113
|
-
/**
|
|
114
|
-
* One account action, whether it is a pool action (`set-primary`, `hide`,
|
|
115
|
-
* `restore`, `relogin`, `clear-cooldown`) or a credential action (`delete`).
|
|
116
|
-
* The host route dispatches on `action`.
|
|
117
|
-
*/
|
|
118
|
-
accountAction(action: string, accountId: string): Promise<void>;
|
|
119
|
-
/** Delete one plugin-owned credential, after the user confirms. */
|
|
120
|
-
deleteAccount(accountId: string): Promise<void>;
|
|
121
|
-
setStrategy(strategy: AccountRotationStrategy): Promise<void>;
|
|
122
|
-
testConnection(): Promise<void>;
|
|
123
|
-
refreshQuota(): Promise<void>;
|
|
124
|
-
/** Run the daily check-in for every eligible account, now. */
|
|
125
|
-
checkinNow(): Promise<void>;
|
|
126
|
-
/** Patch the check-in preference; omitted fields keep their stored value. */
|
|
127
|
-
updateCheckin(checkin: Partial<WorkBuddyCheckinSettings>): Promise<void>;
|
|
128
|
-
toggleModel(modelId: string, enabled: boolean): Promise<void>;
|
|
129
|
-
setAllModels(enabled: boolean): Promise<void>;
|
|
130
|
-
updateEffort(effort: WorkBuddyReasoningEffort | null): Promise<void>;
|
|
131
|
-
refreshCatalog(): Promise<void>;
|
|
132
|
-
saveContextWindow(modelId: string): Promise<void>;
|
|
133
|
-
resetContextWindow(modelId: string): Promise<void>;
|
|
134
|
-
resetAllContextWindows(): Promise<void>;
|
|
135
|
-
/** Edit one capacity draft mid-typing; the editor never parses it. */
|
|
136
|
-
updateContextDraft(modelId: string, draft: string): void;
|
|
137
|
-
/** Switch which client identity chat requests present. */
|
|
138
|
-
updateOutboundIdentity(setting: WorkBuddyOutboundSetting): Promise<void>;
|
|
139
|
-
/** Arm, change or clear the local quota guardrails. */
|
|
140
|
-
updateGuardrails(guardrails: Partial<WorkBuddyGuardrailsDto>): Promise<void>;
|
|
141
|
-
/** Store the desktop client's at-rest key so sealed credentials can be read. */
|
|
142
|
-
saveAtRestKey(key: string): Promise<void>;
|
|
143
|
-
/** Forget that key; sealed accounts become unreadable again. */
|
|
144
|
-
clearAtRestKey(): Promise<void>;
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
export declare function useWorkBuddySection({ onModelChange, loadModelDirectory }: WorkBuddySectionProps): WorkBuddySectionView;
|
|
148
|
-
export {};
|
|
149
|
-
//# sourceMappingURL=useWorkBuddySection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useWorkBuddySection.d.ts","sourceRoot":"","sources":["../../../../src/client/workbuddy/useWorkBuddySection.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAA;AACrF,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,EACrB,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,qCAAqC,CAAA;AAE5C,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AASxF,wFAAwF;AACxF,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAA;CAChC;AA+BD,UAAU,iBAAiB;IACzB,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAA;IAChC,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;CAClB;AAYD,+EAA+E;AAC/E,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,wBAAwB,CAAA;IAC/B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O,CAAC,IAAI,CAAC,CAAA;QAC/B,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;QACjD,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;QAClD,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;QACvC,sEAAsE;QACtE,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;QACxD,0DAA0D;QAC1D,sBAAsB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;QACxE,uDAAuD;QACvD,gBAAgB,CAAC,UAAU,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;QAC5E,gFAAgF;QAChF,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;QACzC,gEAAgE;QAChE,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;KAChC,CAAA;CACF;AAED,wBAAgB,mBAAmB,CAAC,EAAE,aAAa,EAAE,kBAAkB,EAAE,EAAE,qBAAqB,GAAG,oBAAoB,CA8gBtH"}
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WorkBuddy's account pool.
|
|
3
|
-
*
|
|
4
|
-
* This line is the one that adopts accounts it does not own: alongside the
|
|
5
|
-
* accounts a user signs in through this plugin, it reads the CodeBuddy desktop
|
|
6
|
-
* client's own `*.info` credentials so an existing IDE sign-in needs no second
|
|
7
|
-
* login. Both kinds take part in scheduling through the shared
|
|
8
|
-
* {@link AccountPoolCore}, and the difference is enforced here:
|
|
9
|
-
*
|
|
10
|
-
* - **managed** accounts were signed in through this plugin. They live in the
|
|
11
|
-
* pool's encrypted storage and may be deleted.
|
|
12
|
-
* - **desktop** accounts belong to the IDE. Their credential is re-read from the
|
|
13
|
-
* IDE's file on every pick, because the IDE rotates it on its own schedule and
|
|
14
|
-
* a cached copy would go stale; they are never deleted, only hidden.
|
|
15
|
-
*/
|
|
16
|
-
import { AccountPoolCore, type PoolAccountShape, type PoolData } from '../common/account-pool.ts';
|
|
17
|
-
import type { CredentialStore } from '../token-store.ts';
|
|
18
|
-
import { FileCredentialStore, type WorkBuddyCredentials } from './token-store.ts';
|
|
19
|
-
import type { WorkBuddyAccountQuota, WorkBuddyAccountSummaryDto, WorkBuddyRegion } from '../../shared/workbuddy-contracts.ts';
|
|
20
|
-
import type { PoolAccountQuotaDto } from '../../shared/account-pool-contracts.ts';
|
|
21
|
-
/** One pooled WorkBuddy account: the credential plus the facts the card renders. */
|
|
22
|
-
export interface WorkBuddyPoolAccount extends PoolAccountShape<WorkBuddyCredentials> {
|
|
23
|
-
region: WorkBuddyRegion;
|
|
24
|
-
nickname?: string;
|
|
25
|
-
uin?: string;
|
|
26
|
-
/** Which store owns the credential; only managed accounts may be deleted. */
|
|
27
|
-
source: 'desktop' | 'managed';
|
|
28
|
-
/** IDE file a desktop account came from; absent for managed accounts. */
|
|
29
|
-
sourceFile?: string;
|
|
30
|
-
}
|
|
31
|
-
/** Encrypted pool file this line owns. */
|
|
32
|
-
export declare function workBuddyPoolPath(): string;
|
|
33
|
-
/**
|
|
34
|
-
* Validate and normalize one whole pool document.
|
|
35
|
-
*
|
|
36
|
-
* A record whose credential is unusable is dropped rather than repaired: the
|
|
37
|
-
* account can always be adopted again from its file or by signing in again, and
|
|
38
|
-
* keeping a credential-less row would offer the user an account nothing can use.
|
|
39
|
-
*/
|
|
40
|
-
export declare function parseWorkBuddyPoolData(value: unknown): PoolData<WorkBuddyPoolAccount>;
|
|
41
|
-
/**
|
|
42
|
-
* One cached snapshot as the shared account card renders it.
|
|
43
|
-
*
|
|
44
|
-
* Only what the DTO states is published: every meter that measured a share
|
|
45
|
-
* becomes a window, and a meter that measured none is dropped rather than drawn
|
|
46
|
-
* at 0 — which would claim an unspent allowance no reading supports.
|
|
47
|
-
*
|
|
48
|
-
* Exported for the pool's regression tests; the card only reaches it through
|
|
49
|
-
* the summary hook.
|
|
50
|
-
*/
|
|
51
|
-
export declare function workBuddyPoolQuota(snapshot: WorkBuddyAccountQuota): PoolAccountQuotaDto | undefined;
|
|
52
|
-
export interface WorkBuddyAccountPoolOptions {
|
|
53
|
-
/** Credential store the desktop scan reads through; the pool owns scheduling. */
|
|
54
|
-
store?: FileCredentialStore;
|
|
55
|
-
/** Test seam; production builds the platform backend from the pool path. */
|
|
56
|
-
backend?: CredentialStore<PoolData<WorkBuddyPoolAccount>>;
|
|
57
|
-
maxAccounts?: number;
|
|
58
|
-
/**
|
|
59
|
-
* The settings selection: the account the user pinned and the ones hidden.
|
|
60
|
-
*
|
|
61
|
-
* Read on every pick rather than captured once, because both change from the
|
|
62
|
-
* settings card while the adapter is serving requests.
|
|
63
|
-
*/
|
|
64
|
-
selection?: () => {
|
|
65
|
-
selectedAccountId: string | null;
|
|
66
|
-
hiddenAccountIds: readonly string[];
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* WorkBuddy's account pool.
|
|
71
|
-
*
|
|
72
|
-
* Desktop accounts are adopted into the pool so they can be scheduled and
|
|
73
|
-
* cooled down like any other, but they stay owned by the IDE: the pool refreshes
|
|
74
|
-
* their credential from the IDE's own file on every pick, and deletion is
|
|
75
|
-
* refused for them.
|
|
76
|
-
*/
|
|
77
|
-
export declare class WorkBuddyAccountPool extends AccountPoolCore<WorkBuddyCredentials, WorkBuddyPoolAccount, WorkBuddyAccountSummaryDto> {
|
|
78
|
-
private readonly store;
|
|
79
|
-
private readonly options_selection;
|
|
80
|
-
/**
|
|
81
|
-
* Older settings key → the id the account has now.
|
|
82
|
-
*
|
|
83
|
-
* A pin or a hide written before the identity fix names its account by the
|
|
84
|
-
* old name-derived key. Kept in step by {@link read}, which every routing
|
|
85
|
-
* decision goes through, so the mapping is never stale when it is consulted.
|
|
86
|
-
*/
|
|
87
|
-
private readonly legacyIds;
|
|
88
|
-
/**
|
|
89
|
-
* Per-model parks, in memory only: account id → model → the instant it lifts.
|
|
90
|
-
*
|
|
91
|
-
* The subscription meters an account × MODEL over a 24h window (429 `code
|
|
92
|
-
* 6004` names when it lifts), so cooling the whole ACCOUNT for one exhausted
|
|
93
|
-
* model throws away every other model that account can still serve. Process
|
|
94
|
-
* local on purpose, like the sibling gateway's model cooldowns: the window is
|
|
95
|
-
* short, and a restart re-measures it with the first request rather than
|
|
96
|
-
* trusting a stale timestamp.
|
|
97
|
-
*/
|
|
98
|
-
private readonly modelCooldowns;
|
|
99
|
-
constructor(options?: WorkBuddyAccountPoolOptions);
|
|
100
|
-
/**
|
|
101
|
-
* Load the pool, refreshing the legacy-key index on the way.
|
|
102
|
-
*
|
|
103
|
-
* Every routing decision and mutation goes through this method before it
|
|
104
|
-
* consults the settings selection, so building the index here is what keeps
|
|
105
|
-
* a pin written before the identity fix resolvable when
|
|
106
|
-
* {@link resolveSelectionId} is asked for it.
|
|
107
|
-
*/
|
|
108
|
-
protected loadPoolData(): Promise<PoolData<WorkBuddyPoolAccount>>;
|
|
109
|
-
/** Map a settings key from before the identity fix onto the account's real id. */
|
|
110
|
-
private resolveSelectionId;
|
|
111
|
-
/**
|
|
112
|
-
* Adopt any desktop credential the pool does not know yet.
|
|
113
|
-
*
|
|
114
|
-
* The IDE's directory is the source of truth for its own accounts, so a
|
|
115
|
-
* credential that appears there joins the pool. Nothing is ever removed: a
|
|
116
|
-
* file that disappears (the IDE signed out, a profile was moved) leaves the
|
|
117
|
-
* account in place, where the user can hide or delete the managed ones.
|
|
118
|
-
*/
|
|
119
|
-
syncDesktopAccounts(): Promise<WorkBuddyAccountSummaryDto[]>;
|
|
120
|
-
/**
|
|
121
|
-
* A stale `authStatus` is cleared once the credential in force has moved on.
|
|
122
|
-
*
|
|
123
|
-
* The marker records that ONE token was refused; it does not record that the
|
|
124
|
-
* sign-in is gone. This line can still produce it from a token-endpoint
|
|
125
|
-
* refusal, and the copy that refusal was about can be replaced afterwards by
|
|
126
|
-
* whoever owns it — the IDE rotates a desktop account's token on its own
|
|
127
|
-
* schedule, and the daily check-in renews a managed one and writes it back to
|
|
128
|
-
* this plugin's store. Nothing else in the system ever revisits an
|
|
129
|
-
* `authStatus`, so without this a row stays out of rotation for good and the
|
|
130
|
-
* card keeps saying "需要重新登录" for an account that is signed in.
|
|
131
|
-
*
|
|
132
|
-
* The verdict is re-checked against what the store holds NOW: a row whose
|
|
133
|
-
* account has a DIFFERENT, unexpired token is routable again and adopts it,
|
|
134
|
-
* while a row still holding the refused token keeps its marker — that one
|
|
135
|
-
* really does need a sign-in.
|
|
136
|
-
*/
|
|
137
|
-
private healStaleAuthFailures;
|
|
138
|
-
/** Account summaries, with a marker the credentials have outlived cleared. */
|
|
139
|
-
listAccounts(): Promise<WorkBuddyAccountSummaryDto[]>;
|
|
140
|
-
/**
|
|
141
|
-
* Pick an account, healing a stale marker first.
|
|
142
|
-
*
|
|
143
|
-
* The healing belongs on the request path, not only on the card: an account
|
|
144
|
-
* marked expired is excluded by the core's eligibility rule, so until the
|
|
145
|
-
* marker is gone the next request is answered with "全部 N 个账号都需要重新登录"
|
|
146
|
-
* for a credential the store has already replaced.
|
|
147
|
-
*/
|
|
148
|
-
getEffectiveAccount(excludeIds?: ReadonlySet<string>, fetchFn?: typeof fetch, forceRefresh?: boolean): Promise<{
|
|
149
|
-
account: WorkBuddyPoolAccount;
|
|
150
|
-
credentials: WorkBuddyCredentials;
|
|
151
|
-
}>;
|
|
152
|
-
/**
|
|
153
|
-
* Pick the account for the next request.
|
|
154
|
-
*
|
|
155
|
-
* A desktop account's credential is re-read from the IDE's file first: the IDE
|
|
156
|
-
* refreshes its own token, so the copy the pool adopted can be older than what
|
|
157
|
-
* is on disk.
|
|
158
|
-
*/
|
|
159
|
-
getEffectiveCredential(excludeIds?: ReadonlySet<string>, fetchFn?: typeof fetch, model?: string): Promise<{
|
|
160
|
-
account: WorkBuddyPoolAccount;
|
|
161
|
-
credentials: WorkBuddyCredentials;
|
|
162
|
-
}>;
|
|
163
|
-
/**
|
|
164
|
-
* Park ONE model on one account; every other model keeps serving.
|
|
165
|
-
*
|
|
166
|
-
* Returns the instant the park lifts, or undefined for a non-positive
|
|
167
|
-
* duration (which clears any existing park rather than extending it).
|
|
168
|
-
*/
|
|
169
|
-
markModelCooldown(accountId: string, model: string, durationMs: number): number | undefined;
|
|
170
|
-
/** When this account's park on this model lifts, or undefined when it may serve. */
|
|
171
|
-
modelCooldownUntil(accountId: string, model: string, now?: number): number | undefined;
|
|
172
|
-
/**
|
|
173
|
-
* The models this account is parked on right now, with the instant each park
|
|
174
|
-
* lifts.
|
|
175
|
-
*
|
|
176
|
-
* Only LIVE parks are reported: a window that has passed is dropped here, so
|
|
177
|
-
* the card never shows a model that may already serve. The lift instant is
|
|
178
|
-
* the one the upstream named, stored verbatim by
|
|
179
|
-
* {@link markModelCooldown}; it is never recomputed from a duration that has
|
|
180
|
-
* since drifted, because a re-derived instant would drift with it.
|
|
181
|
-
*/
|
|
182
|
-
private liveModelCooldowns;
|
|
183
|
-
/**
|
|
184
|
-
* Clear one account's cooldown AND the models it is parked on.
|
|
185
|
-
*
|
|
186
|
-
* The card's "reset cooldown" button promises the account is usable again. A
|
|
187
|
-
* model park is a cooldown too — the account stays eligible, but it still
|
|
188
|
-
* refuses the model the request wants — so leaving the park behind would
|
|
189
|
-
* report a reset that did not happen, and the park would outlive the only
|
|
190
|
-
* control the user has over it.
|
|
191
|
-
*
|
|
192
|
-
* The base write comes first: it is the half that can fail, and a failed
|
|
193
|
-
* write must leave the account's state as it was rather than half-cleared.
|
|
194
|
-
*/
|
|
195
|
-
clearCooldown(accountId: string): Promise<void>;
|
|
196
|
-
/** Accounts currently parked on one model, with lifted entries pruned on the way. */
|
|
197
|
-
private parkedAccountIds;
|
|
198
|
-
/**
|
|
199
|
-
* Whether another account besides `triedAccountIds` can serve THIS model.
|
|
200
|
-
*
|
|
201
|
-
* The plain {@link hasAnotherAvailableAccount} answers for any model, so a
|
|
202
|
-
* rotation loop that consulted it would keep trying while every remaining
|
|
203
|
-
* account is parked on the model it is asking for — turning one exhausted
|
|
204
|
-
* window into a burst of refused requests.
|
|
205
|
-
*/
|
|
206
|
-
hasAnotherAvailableAccountFor(triedAccountIds: ReadonlySet<string>, model: string): Promise<boolean>;
|
|
207
|
-
/**
|
|
208
|
-
* Whether an account may serve a request.
|
|
209
|
-
*
|
|
210
|
-
* A hidden account keeps its place, its alias and its history, but the user
|
|
211
|
-
* has taken it out of this plugin's rotation, so it is not eligible.
|
|
212
|
-
*/
|
|
213
|
-
protected isEligible(account: WorkBuddyPoolAccount, now: number, triedAccountIds?: ReadonlySet<string>): boolean;
|
|
214
|
-
private selection;
|
|
215
|
-
/**
|
|
216
|
-
* Add or re-authorize one account, settling its identity first.
|
|
217
|
-
*
|
|
218
|
-
* A completed browser sign-in states the display name but not always the uid,
|
|
219
|
-
* while the IDE's own file for the same account states the uid. Passing the
|
|
220
|
-
* raw response through would key the login under the name and the file under
|
|
221
|
-
* the uid, so the pool would hold the same account twice — the duplicate this
|
|
222
|
-
* fix exists to remove. Resolving from the credential's own token before the
|
|
223
|
-
* dedupe key is computed is what makes the two paths agree.
|
|
224
|
-
*/
|
|
225
|
-
addAccount(credentials: WorkBuddyCredentials, alias?: string): Promise<WorkBuddyPoolAccount>;
|
|
226
|
-
/**
|
|
227
|
-
* Remove one account inside a transaction.
|
|
228
|
-
*
|
|
229
|
-
* A desktop account is refused: the plugin does not own that credential file,
|
|
230
|
-
* so removing it from the pool would strand the IDE's session while telling
|
|
231
|
-
* the user their account was deleted. Hiding is the supported action there.
|
|
232
|
-
*/
|
|
233
|
-
protected deleteAccountFromPool(data: PoolData<WorkBuddyPoolAccount>, accountId: string): void;
|
|
234
|
-
}
|
|
235
|
-
//# sourceMappingURL=account-pool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"account-pool.d.ts","sourceRo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W,EAAE,oBAAoB,CAAA;KAAE,CAAC;IAgChF;;;;;OAKG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAY3F,oFAAoF;IACpF,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,SAAa,GAAG,MAAM,GAAG,SAAS;IAK1F;;;;;;;;;OASG;IACH,OAAO,CAAC,kBAAkB;IAc1B;;;;;;;;;;;OAWG;IACY,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9D,qFAAqF;IACrF,OAAO,CAAC,gBAAgB;IAWxB;;;;;;;OAOG;IACG,6BAA6B,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAM1G;;;;;OAKG;cACgB,UAAU,CAC3B,OAAO,EAAE,oBAAoB,EAC7B,GAAG,EAAE,MAAM,EACX,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GACpC,OAAO;IAUV,OAAO,CAAC,SAAS;IAIjB;;;;;;;;;OASG;IACY,UAAU,CAAC,WAAW,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAI3G;;;;;;OAMG;cACgB,qBAAqB,CAAC,IAAI,EAAE,QAAQ,CAAC,oBAAoB,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;CAMxG"}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { LlmAdapter, LlmError, ReasoningEffortId, type GenerateOptions, type LlmModelInfo, type LlmProviderInfo, type LlmResolvedModelInfo, type PreparedAdapterCall, type ResolvedRetryPolicy, type StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
2
|
-
import { PROVIDER_ID, PROVIDER_NAME } from './types.ts';
|
|
3
|
-
import { FileCredentialStore, FileModelSettingsStore, type WorkBuddyPreferenceStore } from './token-store.ts';
|
|
4
|
-
import { type WorkBuddyModelEntry } from './model-catalog.ts';
|
|
5
|
-
import { type AttachmentImageReader } from './mapper.ts';
|
|
6
|
-
import type { WorkBuddyCredentials } from './token-store.ts';
|
|
7
|
-
import type { WorkBuddyAccountPool } from './account-pool.ts';
|
|
8
|
-
import { type WorkBuddyUsageLedger } from './guardrails.ts';
|
|
9
|
-
/**
|
|
10
|
-
* Effort this route materializes when the caller names none.
|
|
11
|
-
*
|
|
12
|
-
* Preference order: the user's configured level when the model accepts it,
|
|
13
|
-
* otherwise the level the gateway's own catalog declares for that model (the
|
|
14
|
-
* same default the official CLI applies), otherwise nothing — which leaves the
|
|
15
|
-
* provider's own default in charge. A configured level the model does not
|
|
16
|
-
* accept is ignored rather than sent, since the endpoint rejects an unsupported
|
|
17
|
-
* level with `code 11150`.
|
|
18
|
-
*/
|
|
19
|
-
export declare function resolveDefaultReasoningEffort(efforts: readonly string[], configuredEffort?: string | null, modelDefaultEffort?: string | null): ReasoningEffortId | undefined;
|
|
20
|
-
/** Cooldown a 429 imposes when the service names no reset instant. */
|
|
21
|
-
export declare const POOL_COOLDOWN_MS: number;
|
|
22
|
-
export interface WorkBuddyAdapterOptions {
|
|
23
|
-
/**
|
|
24
|
-
* Per-account daily token counters behind the local guardrails.
|
|
25
|
-
*
|
|
26
|
-
* Absent means the guardrails cannot be evaluated, so a deployment without it
|
|
27
|
-
* never refuses a request for a reason nothing is counting.
|
|
28
|
-
*/
|
|
29
|
-
usageLedger?: WorkBuddyUsageLedger;
|
|
30
|
-
fetchFn?: typeof fetch;
|
|
31
|
-
attachments?: AttachmentImageReader;
|
|
32
|
-
/** Live catalog loader seam; defaults to the gateway `/v3/config` call. */
|
|
33
|
-
loadCatalog?: (credentials: WorkBuddyCredentials) => Promise<WorkBuddyModelEntry[]>;
|
|
34
|
-
/**
|
|
35
|
-
* Multi-account pool this adapter rotates through.
|
|
36
|
-
*
|
|
37
|
-
* Absent leaves the line on its single-credential path, which is what the
|
|
38
|
-
* headless tests and any caller that predates the pool use.
|
|
39
|
-
*/
|
|
40
|
-
accountPool?: WorkBuddyAccountPool;
|
|
41
|
-
}
|
|
42
|
-
export declare class WorkBuddyAdapter extends LlmAdapter {
|
|
43
|
-
private readonly store;
|
|
44
|
-
private readonly modelSettings;
|
|
45
|
-
private readonly preferences?;
|
|
46
|
-
private readonly options;
|
|
47
|
-
/** Null keeps the pre-pool single-credential path. */
|
|
48
|
-
private readonly accountPool;
|
|
49
|
-
constructor(store?: FileCredentialStore, modelSettings?: FileModelSettingsStore, preferences?: WorkBuddyPreferenceStore | undefined, options?: WorkBuddyAdapterOptions);
|
|
50
|
-
providerInfo(provider: string): LlmProviderInfo;
|
|
51
|
-
providerRetryPolicy(): ResolvedRetryPolicy;
|
|
52
|
-
imageRequestPricing(): undefined;
|
|
53
|
-
private settings;
|
|
54
|
-
private credentials;
|
|
55
|
-
/**
|
|
56
|
-
* Catalog for the picker: the live gateway listing when reachable, the
|
|
57
|
-
* shipped table otherwise.
|
|
58
|
-
*
|
|
59
|
-
* The gateway is the authority on capabilities, so its answer replaces the
|
|
60
|
-
* fallback rather than merging with it — a model whose context window changed
|
|
61
|
-
* upstream must not keep a stale local value.
|
|
62
|
-
*/
|
|
63
|
-
private catalog;
|
|
64
|
-
/**
|
|
65
|
-
* Models the picker may offer.
|
|
66
|
-
*
|
|
67
|
-
* The catalog is filtered by the account's own region: asking a region for a
|
|
68
|
-
* model it does not serve answers 400 `code 11102`, so offering one would
|
|
69
|
-
* hand the user a model that cannot work.
|
|
70
|
-
*/
|
|
71
|
-
listModels(provider?: string): Promise<readonly LlmModelInfo[]>;
|
|
72
|
-
resolveModel(provider: string, modelId: string, signal?: AbortSignal): Promise<LlmResolvedModelInfo>;
|
|
73
|
-
prepareCall(provider: string, model: string, signal?: AbortSignal): Promise<PreparedAdapterCall>;
|
|
74
|
-
stream(options: GenerateOptions): AsyncIterable<StreamChunk>;
|
|
75
|
-
/**
|
|
76
|
-
* Effort this request should carry, or `undefined` to send none.
|
|
77
|
-
*
|
|
78
|
-
* Order: the caller's explicit choice, then the user's configured level, then
|
|
79
|
-
* the level the gateway catalog declares for this model. The last step
|
|
80
|
-
* matters because the endpoint returns an **empty `reasoning_content`** when
|
|
81
|
-
* no `reasoning_effort` is present, even for a reasoning-only model: measured
|
|
82
|
-
* on `deepseek-v4.1-flash`, the same prompt yields 0 reasoning characters
|
|
83
|
-
* with no field and 130-215 with one. Omitting it therefore silently drops
|
|
84
|
-
* the model's thinking instead of letting the provider pick, so the catalog's
|
|
85
|
-
* own default (which is what the official CLI sends) is materialized here.
|
|
86
|
-
*
|
|
87
|
-
* A candidate the model does not accept is discarded rather than sent, since
|
|
88
|
-
* the endpoint rejects an unsupported level with `code 11150`.
|
|
89
|
-
*/
|
|
90
|
-
/**
|
|
91
|
-
* Accounts the LOCAL guardrails refuse for this model right now.
|
|
92
|
-
*
|
|
93
|
-
* Reads only numbers this plugin already owns — the billing snapshot's
|
|
94
|
-
* remaining credits and this line's own token counters — so it never becomes a
|
|
95
|
-
* second, disagreeing source of truth about the upstream allowance.
|
|
96
|
-
*/
|
|
97
|
-
private guardrailBlockedAccounts;
|
|
98
|
-
private effortFor;
|
|
99
|
-
private requestStream;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Map one failed HTTP response onto a DSH failure.
|
|
103
|
-
*
|
|
104
|
-
* The subscription reports its own conditions inside a JSON `code` while the
|
|
105
|
-
* status line stays generic, so the body is read for the specific cases the
|
|
106
|
-
* status alone cannot express — notably the quota signal, whose message carries
|
|
107
|
-
* the instant the allowance resets.
|
|
108
|
-
*/
|
|
109
|
-
export declare function classifyFailure(status: number, detail: string, headers?: Headers): LlmError;
|
|
110
|
-
/**
|
|
111
|
-
* The reset instant a quota refusal names, as a delay from now.
|
|
112
|
-
*
|
|
113
|
-
* A 24h allowance that is exhausted answers 429 / `code 6004` with the wall
|
|
114
|
-
* clock it lifts — but only in the MESSAGE, never in a header, and in two
|
|
115
|
-
* realm-specific wordings (measured: intl "… resets at 2026-09-20 10:50:48
|
|
116
|
-
* UTC+8", cn "… 将在 2026-10-09 14:44:59 UTC+8 重置"). Reading the status alone
|
|
117
|
-
* therefore loses the only fact that says how long the account is out, and the
|
|
118
|
-
* pool parks a 24-hour limit for five minutes before trying it again.
|
|
119
|
-
*
|
|
120
|
-
* Deliberately tolerant, in the same direction as their gateway: an unparseable
|
|
121
|
-
* body yields `undefined` (callers keep their default cooldown) rather than an
|
|
122
|
-
* error, because this runs on a failure path. An absent `UTC±h` marker means
|
|
123
|
-
* UTC, which is how the sibling implementation reads it too.
|
|
124
|
-
*/
|
|
125
|
-
export declare function readRateLimitReset(detail: string, now?: number): number | undefined;
|
|
126
|
-
/** Read the subscription's own numeric error code out of a response body. */
|
|
127
|
-
export declare function readErrorCode(detail: string): number | null;
|
|
128
|
-
export { PROVIDER_ID, PROVIDER_NAME };
|
|
129
|
-
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/host/workbuddy/adapter.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,iBAAiB,EAEjB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAGL,WAAW,EACX,aAAa,EAGd,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EAEtB,KAAK,wBAAwB,EAC9B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAQL,KAAK,mBAAmB,EACzB,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAQL,KAAK,qBAAqB,EAC3B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