@eddyskywalker/dsh-chatgpt-subscription 0.53.0 → 0.55.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 +25 -0
- package/README.md +14 -8
- package/lib/client.js +228 -25
- package/lib/client.js.map +1 -1
- package/lib/{entry-progress-updates-BEkdyDZU.js → entry-progress-updates-CxQewio9.js} +4 -2
- package/lib/index.js +21037 -18892
- package/lib/progress-updates.js +1 -1
- package/lib/types/client/common/host-locale-mirror.d.ts +24 -0
- package/lib/types/client/common/host-locale-mirror.d.ts.map +1 -0
- package/lib/types/client/hub/HubOverview.d.ts.map +1 -1
- package/lib/types/client/hub/providers.d.ts +18 -1
- package/lib/types/client/hub/providers.d.ts.map +1 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/locales-ru/hub.d.ts.map +1 -1
- package/lib/types/client/locales-ru/progress-updates.d.ts.map +1 -1
- package/lib/types/client/locales.d.ts +27 -1
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/progress-updates/locales.d.ts +11 -2
- package/lib/types/client/progress-updates/locales.d.ts.map +1 -1
- package/lib/types/client/progress-updates/settings-binding.d.ts +4 -2
- package/lib/types/client/progress-updates/settings-binding.d.ts.map +1 -1
- package/lib/types/client/progress-updates/settings-section.d.ts.map +1 -1
- package/lib/types/compat.d.ts +35 -16
- package/lib/types/compat.d.ts.map +1 -1
- package/lib/types/host/adapter.d.ts +1 -1
- package/lib/types/host/adapter.d.ts.map +1 -1
- package/lib/types/host/antigravity/adapter.d.ts.map +1 -1
- package/lib/types/host/antigravity/mapper.d.ts +4 -24
- package/lib/types/host/antigravity/mapper.d.ts.map +1 -1
- package/lib/types/host/antigravity/types.d.ts +7 -1
- package/lib/types/host/antigravity/types.d.ts.map +1 -1
- package/lib/types/host/claude/adapter.d.ts.map +1 -1
- package/lib/types/host/claude/client.d.ts +19 -3
- package/lib/types/host/claude/client.d.ts.map +1 -1
- package/lib/types/host/claude/mapper.d.ts +105 -8
- package/lib/types/host/claude/mapper.d.ts.map +1 -1
- package/lib/types/host/claude/model-catalog.d.ts +97 -9
- package/lib/types/host/claude/model-catalog.d.ts.map +1 -1
- package/lib/types/host/claude/types.d.ts +21 -2
- package/lib/types/host/claude/types.d.ts.map +1 -1
- package/lib/types/host/cline-pass/adapter.d.ts +9 -1
- package/lib/types/host/cline-pass/adapter.d.ts.map +1 -1
- package/lib/types/host/cline-pass/mapper.d.ts +18 -0
- package/lib/types/host/cline-pass/mapper.d.ts.map +1 -1
- package/lib/types/host/cline-pass/types.d.ts +8 -2
- package/lib/types/host/cline-pass/types.d.ts.map +1 -1
- package/lib/types/host/codex-account-pool.d.ts.map +1 -1
- package/lib/types/host/codex-catalog.d.ts +9 -0
- package/lib/types/host/codex-catalog.d.ts.map +1 -1
- package/lib/types/host/command-code/adapter.d.ts.map +1 -1
- package/lib/types/host/command-code/mapper.d.ts +44 -2
- package/lib/types/host/command-code/mapper.d.ts.map +1 -1
- package/lib/types/host/command-code/model-catalog.d.ts +53 -11
- package/lib/types/host/command-code/model-catalog.d.ts.map +1 -1
- package/lib/types/host/command-code/routes.d.ts +6 -0
- package/lib/types/host/command-code/routes.d.ts.map +1 -1
- package/lib/types/host/command-code/types.d.ts +24 -3
- package/lib/types/host/command-code/types.d.ts.map +1 -1
- package/lib/types/host/common/account-pool.d.ts +33 -3
- package/lib/types/host/common/account-pool.d.ts.map +1 -1
- package/lib/types/host/common/i18n/en.d.ts +9 -0
- package/lib/types/host/common/i18n/en.d.ts.map +1 -0
- package/lib/types/host/common/i18n/index.d.ts +13 -0
- package/lib/types/host/common/i18n/index.d.ts.map +1 -0
- package/lib/types/host/common/i18n/provider-name.d.ts +10 -0
- package/lib/types/host/common/i18n/provider-name.d.ts.map +1 -0
- package/lib/types/host/common/i18n/ru.d.ts +10 -0
- package/lib/types/host/common/i18n/ru.d.ts.map +1 -0
- package/lib/types/host/common/i18n/runtime.d.ts +54 -0
- package/lib/types/host/common/i18n/runtime.d.ts.map +1 -0
- package/lib/types/host/common/i18n/t.d.ts +38 -0
- package/lib/types/host/common/i18n/t.d.ts.map +1 -0
- package/lib/types/host/common/i18n/zh.d.ts +167 -0
- package/lib/types/host/common/i18n/zh.d.ts.map +1 -0
- package/lib/types/host/common/idle-watchdog.d.ts +27 -7
- package/lib/types/host/common/idle-watchdog.d.ts.map +1 -1
- package/lib/types/host/common/model-request-control.d.ts.map +1 -1
- package/lib/types/host/glm-coding-plan/adapter.d.ts.map +1 -1
- package/lib/types/host/glm-coding-plan/client.d.ts.map +1 -1
- package/lib/types/host/glm-coding-plan/mapper-anthropic.d.ts +111 -31
- package/lib/types/host/glm-coding-plan/mapper-anthropic.d.ts.map +1 -1
- package/lib/types/host/glm-coding-plan/mapper-openai.d.ts.map +1 -1
- package/lib/types/host/glm-coding-plan/model-catalog.d.ts +12 -3
- package/lib/types/host/glm-coding-plan/model-catalog.d.ts.map +1 -1
- package/lib/types/host/glm-coding-plan/oauth.d.ts.map +1 -1
- package/lib/types/host/glm-coding-plan/routes.d.ts.map +1 -1
- package/lib/types/host/glm-coding-plan/types.d.ts +88 -3
- package/lib/types/host/glm-coding-plan/types.d.ts.map +1 -1
- package/lib/types/host/kimi-code/account-pool.d.ts +2 -2
- package/lib/types/host/kimi-code/account-pool.d.ts.map +1 -1
- package/lib/types/host/kimi-code/adapter.d.ts.map +1 -1
- package/lib/types/host/kimi-code/cache-wait.d.ts +28 -6
- package/lib/types/host/kimi-code/cache-wait.d.ts.map +1 -1
- package/lib/types/host/kimi-code/oauth.d.ts +21 -1
- package/lib/types/host/kimi-code/oauth.d.ts.map +1 -1
- package/lib/types/host/kimi-code/types.d.ts +19 -1
- package/lib/types/host/kimi-code/types.d.ts.map +1 -1
- package/lib/types/host/minimax-code/adapter.d.ts.map +1 -1
- package/lib/types/host/minimax-code/types.d.ts +7 -1
- package/lib/types/host/minimax-code/types.d.ts.map +1 -1
- package/lib/types/host/model-catalog.d.ts +14 -0
- package/lib/types/host/model-catalog.d.ts.map +1 -1
- package/lib/types/host/ollama/adapter.d.ts.map +1 -1
- package/lib/types/host/ollama/types.d.ts +10 -0
- package/lib/types/host/ollama/types.d.ts.map +1 -1
- package/lib/types/host/opendesign/adapter.d.ts.map +1 -1
- package/lib/types/host/opendesign/mapper.d.ts +31 -0
- package/lib/types/host/opendesign/mapper.d.ts.map +1 -1
- package/lib/types/host/opendesign/types.d.ts +8 -2
- package/lib/types/host/opendesign/types.d.ts.map +1 -1
- package/lib/types/host/progress-updates/prompt.d.ts +1 -1
- package/lib/types/host/progress-updates/prompt.d.ts.map +1 -1
- package/lib/types/host/qoder/account-pool.d.ts.map +1 -1
- package/lib/types/host/qoder/adapter.d.ts.map +1 -1
- package/lib/types/host/qoder/client.d.ts.map +1 -1
- package/lib/types/host/qoder/mapper.d.ts +9 -0
- package/lib/types/host/qoder/mapper.d.ts.map +1 -1
- package/lib/types/host/qoder/oauth.d.ts.map +1 -1
- package/lib/types/host/qoder/routes.d.ts.map +1 -1
- package/lib/types/host/qoder/token-store.d.ts.map +1 -1
- package/lib/types/host/responses-client.d.ts +22 -2
- package/lib/types/host/responses-client.d.ts.map +1 -1
- package/lib/types/host/responses-mapper.d.ts +44 -4
- package/lib/types/host/responses-mapper.d.ts.map +1 -1
- package/lib/types/host/routes.d.ts.map +1 -1
- package/lib/types/host/step-code/account-pool.d.ts.map +1 -1
- package/lib/types/host/step-code/adapter.d.ts.map +1 -1
- package/lib/types/host/step-code/client.d.ts +8 -0
- package/lib/types/host/step-code/client.d.ts.map +1 -1
- package/lib/types/host/step-code/mapper.d.ts +9 -5
- package/lib/types/host/step-code/mapper.d.ts.map +1 -1
- package/lib/types/host/step-code/model-catalog.d.ts +17 -0
- package/lib/types/host/step-code/model-catalog.d.ts.map +1 -1
- package/lib/types/host/step-code/oauth.d.ts.map +1 -1
- package/lib/types/host/step-code/routes.d.ts.map +1 -1
- package/lib/types/host/step-code/token-store.d.ts.map +1 -1
- package/lib/types/host/wire-auth.d.ts +31 -0
- package/lib/types/host/wire-auth.d.ts.map +1 -1
- package/lib/types/host/workbuddy/account-pool.d.ts.map +1 -1
- package/lib/types/host/workbuddy/adapter.d.ts.map +1 -1
- package/lib/types/host/workbuddy/oauth.d.ts.map +1 -1
- package/lib/types/host/workbuddy/types.d.ts +7 -1
- package/lib/types/host/workbuddy/types.d.ts.map +1 -1
- package/lib/types/index.d.ts +8 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/i18n-contracts.d.ts +35 -0
- package/lib/types/shared/i18n-contracts.d.ts.map +1 -0
- package/lib/types/shared/model-catalog.d.ts +58 -12
- package/lib/types/shared/model-catalog.d.ts.map +1 -1
- package/locale/progress-updates/ru.json +6 -0
- package/package.json +1 -1
|
@@ -49,8 +49,50 @@ export declare function resolveRequestImages(options: GenerateOptions, attachmen
|
|
|
49
49
|
export declare function stripMetaSchema(schema: unknown): Record<string, unknown>;
|
|
50
50
|
/** Build one `/chat/completions` body. */
|
|
51
51
|
export declare function buildOpenAIRequest(options: GenerateOptions, images?: ResolvedRequestImages): Record<string, unknown>;
|
|
52
|
-
/**
|
|
53
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Smallest thinking budget the Anthropic wire accepts.
|
|
54
|
+
*
|
|
55
|
+
* Anthropic refuses a budget below 1024 tokens, so a cap that leaves no room
|
|
56
|
+
* for that one simply omits thinking. This is the wire's own minimum.
|
|
57
|
+
*/
|
|
58
|
+
export declare const MIN_THINKING_BUDGET_TOKENS = 1024;
|
|
59
|
+
/**
|
|
60
|
+
* Visible answer the thinking budget has to leave under the cap.
|
|
61
|
+
*
|
|
62
|
+
* A budget that eats the whole cap leaves the model no room to answer, so the
|
|
63
|
+
* budget never reaches the last {@link MIN_ANSWER_TOKENS} of it. The room is
|
|
64
|
+
* what keeps a small cap from turning the answer into a single token.
|
|
65
|
+
*/
|
|
66
|
+
export declare const MIN_ANSWER_TOKENS = 1024;
|
|
67
|
+
/**
|
|
68
|
+
* Reasoning budget a thinking-enabled request may spend, given its output cap.
|
|
69
|
+
*
|
|
70
|
+
* The budget is the one the effort level asks for, trimmed to fit under the
|
|
71
|
+
* cap. Two floors decide the rest:
|
|
72
|
+
*
|
|
73
|
+
* - it must leave {@link MIN_ANSWER_TOKENS} under the cap for the visible
|
|
74
|
+
* answer, so a budget never eats the whole output and the answer is not
|
|
75
|
+
* squeezed down to a token;
|
|
76
|
+
* - it must be at least {@link MIN_THINKING_BUDGET_TOKENS}, because the wire
|
|
77
|
+
* refuses a budget below its own minimum.
|
|
78
|
+
*
|
|
79
|
+
* A cap that cannot satisfy both gets NO thinking at all: a budget that leaves
|
|
80
|
+
* the answer no room is worse than no thinking.
|
|
81
|
+
*
|
|
82
|
+
* A request with no cap has nothing to fit a budget into, so it gets no
|
|
83
|
+
* thinking either: there is no number to compare the level against, and a
|
|
84
|
+
* budget invented from nothing is the same guess this rule exists to remove.
|
|
85
|
+
*/
|
|
86
|
+
export declare function thinkingBudgetFor(effort: string | undefined, maxTokens: number | undefined): number | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Output cap the Anthropic wire sends when nothing else applies.
|
|
89
|
+
*
|
|
90
|
+
* The Anthropic Messages format requires `max_tokens`, so the wire cannot
|
|
91
|
+
* leave the field out the way the OpenAI-compatible wire does; the official
|
|
92
|
+
* CLI's own answer for a request without a declared cap is 64000, and that is
|
|
93
|
+
* the number used here.
|
|
94
|
+
*/
|
|
95
|
+
export declare const ANTHROPIC_DEFAULT_MAX_TOKENS = 64000;
|
|
54
96
|
/** Build one `/messages` body. */
|
|
55
97
|
export declare function buildAnthropicRequest(options: GenerateOptions, images?: ResolvedRequestImages): Record<string, unknown>;
|
|
56
98
|
/** Build the body for whichever endpoint serves `modelId`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapper.d.ts","sourceRoot":"","sources":["../../../../src/host/command-code/mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAGL,KAAK,oBA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WAAW,EAAE,CAOxE;AAED,kEAAkE;AAClE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAIxE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Command Code model capability table.
|
|
3
3
|
*
|
|
4
|
-
* Transcribed from the official CLI's own model registry
|
|
5
|
-
* `createModelRegistry` over
|
|
4
|
+
* Transcribed from the official CLI's own model registry - the table it builds
|
|
5
|
+
* `createModelRegistry` over - which is the only authoritative source for which
|
|
6
6
|
* models accept image input and which reasoning levels each one exposes: the
|
|
7
7
|
* public `/provider/v1/models` listing carries an id, a display name, and a
|
|
8
8
|
* context length, but says nothing about modalities or reasoning.
|
|
@@ -21,28 +21,70 @@
|
|
|
21
21
|
* `deepseek/deepseek-v4.1-flash` and `deepseek/deepseek-v4-flash-vision-exp` take
|
|
22
22
|
* images, and `z-ai/glm-5.3-flash` takes images while `zai-org/GLM-5.3` does not.
|
|
23
23
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
24
|
+
* THE TABLE BELOW is the registry `command-code@1.88.2` embeds in its CLI
|
|
25
|
+
* bundle (`dist/cli.mjs`), transcribed in full: 106 entries, in registry order.
|
|
26
|
+
* The redacted snapshot of that registry is checked in under
|
|
27
|
+
* `test/fixtures/command-code/official-model-catalog.json`, and
|
|
28
|
+
* `test/command-code-model-catalog.test.ts` compares this table against it
|
|
29
|
+
* entry by entry, so a later refresh that forgets a model fails the suite
|
|
30
|
+
* instead of shipping silently.
|
|
31
|
+
*
|
|
32
|
+
* Two registry facts are NOT carried through verbatim:
|
|
33
|
+
*
|
|
34
|
+
* - the `off` level, which Command Code spells "do not think" and DSH spells
|
|
35
|
+
* `none`. The translation happens in `reasoningEffortsFor` (see `./types.ts`),
|
|
36
|
+
* so the table stays a faithful transcription and keeps `off` where the
|
|
37
|
+
* registry puts it. Sending the literal `off` would be wrong in the other
|
|
38
|
+
* direction too: the OpenAI-family wire has no such level, so it is dropped
|
|
39
|
+
* rather than transmitted (see the request builders in `./mapper.ts`).
|
|
40
|
+
* - the `file` modality, which one model (`meta/muse-wonder-1.0`) declares and
|
|
41
|
+
* which DSH's own modality vocabulary does not carry. The table keeps it, and
|
|
42
|
+
* `inputModalitiesFor` narrows it away at the harness boundary.
|
|
43
|
+
*
|
|
44
|
+
* `maxTokens` is the cap the registry DECLARES, and most entries declare
|
|
45
|
+
* none. A null there means the provider decides the cap, not that the model
|
|
46
|
+
* has a small one, so a request must not invent a number for it (see
|
|
47
|
+
* `declaredMaxOutputTokens` in `./types.ts`).
|
|
31
48
|
*/
|
|
49
|
+
/**
|
|
50
|
+
* One modality the official registry declares for a model.
|
|
51
|
+
*
|
|
52
|
+
* `file` is part of the official vocabulary but not of DSH's: the harness's
|
|
53
|
+
* modality map knows `text` and `image`, and this route sends no file parts, so
|
|
54
|
+
* the registry's `file` never reaches the harness.
|
|
55
|
+
*/
|
|
56
|
+
export type CommandCodeModality = 'text' | 'image' | 'file';
|
|
32
57
|
export interface CommandCodeModelDef {
|
|
33
58
|
id: string;
|
|
34
59
|
name: string;
|
|
35
60
|
/** Accepted request modalities, exactly as the registry declares them. */
|
|
36
|
-
inputModalities:
|
|
61
|
+
inputModalities: CommandCodeModality[];
|
|
37
62
|
/** Selectable reasoning levels; empty when the model exposes none. */
|
|
38
63
|
reasoningEfforts: string[];
|
|
39
64
|
/** Context window the registry declares, when it declares one. */
|
|
40
65
|
contextWindow: number | null;
|
|
41
|
-
/** Output cap the registry declares, when it declares one. */
|
|
66
|
+
/** Output cap the registry declares, when it declares one; null means it declares none. */
|
|
42
67
|
maxTokens: number | null;
|
|
68
|
+
/** Whether the official catalog hides the model from its own picker. */
|
|
69
|
+
hidden: boolean;
|
|
43
70
|
}
|
|
44
71
|
/** Every model the Command Code registry describes, in registry order. */
|
|
45
72
|
export declare const COMMAND_CODE_MODELS: readonly CommandCodeModelDef[];
|
|
46
73
|
/** Registry entry for one model id, or undefined when it describes no such model. */
|
|
47
74
|
export declare function commandCodeModelDef(modelId: string): CommandCodeModelDef | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Model ids the 1.88.2 catalog refresh added to the shipped default selection.
|
|
77
|
+
*
|
|
78
|
+
* The shipped default is the set of models the settings card offers before the
|
|
79
|
+
* user edits it, and a stored selection that still equals it counts as "never
|
|
80
|
+
* edited" (see `resolveEnabledModelIds` in `./routes.ts`). A refresh that
|
|
81
|
+
* changed the default without saying so would make every untouched selection
|
|
82
|
+
* from the previous release look edited, and the models this release adds
|
|
83
|
+
* would stay hidden behind a list nobody touched. These two lists carry that
|
|
84
|
+
* change: the retired ids are the ones the previous default had and this one
|
|
85
|
+
* does not, and the added ids are the ones it gained.
|
|
86
|
+
*/
|
|
87
|
+
export declare const SHIPPED_DEFAULT_ADDED_MODEL_IDS: readonly string[];
|
|
88
|
+
/** Model ids the 1.88.2 catalog refresh dropped from the shipped default selection. */
|
|
89
|
+
export declare const SHIPPED_DEFAULT_RETIRED_MODEL_IDS: readonly string[];
|
|
48
90
|
//# sourceMappingURL=model-catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-catalog.d.ts","sourceRoot":"","sources":["../../../../src/host/command-code/model-catalog.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"model-catalog.d.ts","sourceRoot":"","sources":["../../../../src/host/command-code/model-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;AAE3D,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,0EAA0E;IAC1E,eAAe,EAAE,mBAAmB,EAAE,CAAA;IACtC,sEAAsE;IACtE,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,kEAAkE;IAClE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,2FAA2F;IAC3F,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,wEAAwE;IACxE,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,0EAA0E;AAC1E,eAAO,MAAM,mBAAmB,EAAE,SAAS,mBAAmB,EA27B7D,CAAA;AAED,qFAAqF;AACrF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAEpF;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,+BAA+B,EAAE,SAAS,MAAM,EAe5D,CAAA;AAED,uFAAuF;AACvF,eAAO,MAAM,iCAAiC,EAAE,SAAS,MAAM,EAM9D,CAAA"}
|
|
@@ -11,6 +11,12 @@ import type { CommandCodeApiEnv, CommandCodeWebStatus } from '../../shared/comma
|
|
|
11
11
|
* it cannot know about models the live catalog has since added; treating it as
|
|
12
12
|
* "everything currently offered" keeps a first run from hiding the whole
|
|
13
13
|
* catalog behind an unedited default. Any explicit edit is honoured exactly.
|
|
14
|
+
*
|
|
15
|
+
* The default the PREVIOUS release shipped counts as well: a catalog refresh
|
|
16
|
+
* moves models in and out of the default, and a user who never touched the
|
|
17
|
+
* selection still carries the old list. Calling that list edited would hide
|
|
18
|
+
* every model the refresh added behind a list nobody touched, so the ids the
|
|
19
|
+
* refresh moved are used to rebuild the previous default and compare with it.
|
|
14
20
|
*/
|
|
15
21
|
export declare function resolveEnabledModelIds(stored: readonly string[], catalog: readonly CommandCodeCatalogModel[], enabled?: boolean): string[];
|
|
16
22
|
export interface CommandCodeStatusOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../../src/host/command-code/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,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AAC,EAAE,0BAA0B,EACxC,OAAO,GAAE,wBAA6B,EACtC,WAAW,GAAE,sBAAsB,GAAG,SAA+B,GACpE,OAAO,CAAC,oBAAoB,CAAC,CA+E/B;AAED,2EAA2E;AAC3E,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,mBAAmB,EAC1B,aAAa,EAAE,sBAAsB,EACrC,WAAW,CAAC,EAAE,0BAA0B,EACxC,OAAO,GAAE,wBAA6B,EACtC,WAAW,GAAE,sBAAsB,GAAG,SAA+B,GACpE,MAAM,IAAI,CAkPZ;AAED,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -74,7 +74,13 @@ export declare const QUOTA_CACHE_TTL_MS: number;
|
|
|
74
74
|
export declare const CATALOG_CACHE_TTL_MS: number;
|
|
75
75
|
export declare const DEFAULT_MAX_TOKENS = 32768;
|
|
76
76
|
export declare const DEFAULT_CONTEXT_WINDOW = 128000;
|
|
77
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Idle ceiling for one streaming response before it is declared stalled.
|
|
79
|
+
*
|
|
80
|
+
* Strictly inside the transport's own 300 s stream timeout; see
|
|
81
|
+
* `host/common/idle-watchdog.ts` for the measured basis.
|
|
82
|
+
*/
|
|
83
|
+
export declare const STREAM_IDLE_TIMEOUT_MS = 120000;
|
|
78
84
|
export declare const STREAM_IDLE_TIMEOUT_CODE = "LLM_STREAM_IDLE_TIMEOUT";
|
|
79
85
|
/**
|
|
80
86
|
* Product identity for the provider API's `User-Agent`.
|
|
@@ -180,8 +186,23 @@ export declare function inputModalitiesFor(modelId: string): Array<'text' | 'ima
|
|
|
180
186
|
*/
|
|
181
187
|
export declare function anthropicThinkingBudget(effort: string): number | null;
|
|
182
188
|
/**
|
|
183
|
-
* Output cap
|
|
184
|
-
* declares
|
|
189
|
+
* Output cap the official registry DECLARES for one model, or undefined when it
|
|
190
|
+
* declares none.
|
|
191
|
+
*
|
|
192
|
+
* A registry that declares no cap is not a model with a small cap: it is a model
|
|
193
|
+
* whose cap the provider decides. The table this plugin shipped before carried
|
|
194
|
+
* a hand-written cross-provider guess for those models, and a guess is wrong in
|
|
195
|
+
* both directions - too small truncates the answer, too large is refused by the
|
|
196
|
+
* provider. The official registry is the only authority, so a model that
|
|
197
|
+
* declares nothing there declares nothing on the wire either.
|
|
198
|
+
*/
|
|
199
|
+
export declare function declaredMaxOutputTokens(modelId: string): number | undefined;
|
|
200
|
+
/**
|
|
201
|
+
* Output cap the host reserves against when the caller asks for none.
|
|
202
|
+
*
|
|
203
|
+
* This is HOST metadata: the number the settings card shows and the number a
|
|
204
|
+
* compaction reserves against. It is NOT a wire cap, and a request that carries
|
|
205
|
+
* no cap of its own sends none - see `requestMaxTokens` in `./mapper.ts`.
|
|
185
206
|
*/
|
|
186
207
|
export declare function maxOutputTokensFor(modelId: string): number;
|
|
187
208
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/host/command-code/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAGhG,eAAO,MAAM,WAAW,iBAAiB,CAAA;AACzC,eAAO,MAAM,aAAa,iBAAiB,CAAA;AAE3C,oFAAoF;AACpF,eAAO,MAAM,WAAW,qBAAqB,CAAA;AAC7C,iFAAiF;AACjF,eAAO,MAAM,qBAAqB,aAAa,CAAA;AAC/C,sEAAsE;AACtE,eAAO,MAAM,aAAa,QAAQ,CAAA;AAElC,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAI3D,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAI9D,CAAA;AAED,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,iBAA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AE,GAAG,eAAe,GAAG,SAAS,CAOlH;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAG7D;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,SAAS,CAAA;AAE9C;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAKzF;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,CAO3E;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUrE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE3E;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAKQ,CAAA"}
|
|
@@ -41,6 +41,27 @@ export interface PoolAccountInput<TCredentials, TAccount> {
|
|
|
41
41
|
/** The account this one replaces, when the dedupe key already exists. */
|
|
42
42
|
existing?: TAccount;
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* What one refresh is allowed to spend, as the caller states it.
|
|
46
|
+
*
|
|
47
|
+
* A refresh that fails transiently is normally retried inside the provider's
|
|
48
|
+
* own OAuth layer, and that layer has its own default budget. A caller that
|
|
49
|
+
* ALREADY owns a retry loop must be able to say so: when the harness retries a
|
|
50
|
+
* model request, an inner retry loop multiplies the two budgets, so one
|
|
51
|
+
* upstream hiccup costs the service several times more requests than the
|
|
52
|
+
* caller ever intended.
|
|
53
|
+
*
|
|
54
|
+
* The field is optional everywhere it appears. An absent budget means the
|
|
55
|
+
* provider's own default, so every existing call keeps its behaviour.
|
|
56
|
+
*/
|
|
57
|
+
export interface AccountPoolRefreshOptions {
|
|
58
|
+
/**
|
|
59
|
+
* How many attempts one refresh gets, including the first.
|
|
60
|
+
*
|
|
61
|
+
* A positive integer. Absent means the provider's default.
|
|
62
|
+
*/
|
|
63
|
+
maxAttempts?: number;
|
|
64
|
+
}
|
|
44
65
|
/**
|
|
45
66
|
* Provider-specific behaviour of one account pool.
|
|
46
67
|
*
|
|
@@ -77,8 +98,14 @@ export interface AccountPoolHooks<TCredentials, TAccount extends PoolAccountShap
|
|
|
77
98
|
expiresAt?(credentials: TCredentials): number | undefined;
|
|
78
99
|
/** Whether the credential must be refreshed before the next request. */
|
|
79
100
|
needsRefresh?(credentials: TCredentials, now: number): boolean;
|
|
80
|
-
/**
|
|
81
|
-
|
|
101
|
+
/**
|
|
102
|
+
* Refresh one credential, returning the value to persist back into the pool.
|
|
103
|
+
*
|
|
104
|
+
* The attempt budget the caller stated arrives as the third argument. It is
|
|
105
|
+
* absent when the caller expressed none, and a hook that ignores it keeps
|
|
106
|
+
* whatever budget its own provider defaults to.
|
|
107
|
+
*/
|
|
108
|
+
refresh?(credentials: TCredentials, fetchFn: typeof fetch, options?: AccountPoolRefreshOptions): Promise<TCredentials>;
|
|
82
109
|
/**
|
|
83
110
|
* Classify a failed refresh.
|
|
84
111
|
*
|
|
@@ -499,9 +526,12 @@ export declare class AccountPoolCore<TCredentials, TAccount extends PoolAccountS
|
|
|
499
526
|
* @param excludeIds - accounts already tried for this request, so a retry
|
|
500
527
|
* lands on a different account.
|
|
501
528
|
* @param fetchFn - fetch used by the provider's token refresh.
|
|
529
|
+
* @param forceRefresh - renew even when the stored token still looks usable.
|
|
530
|
+
* @param options - what the refresh may spend, passed down to the provider's
|
|
531
|
+
* refresh hook. Absent means the provider's own default budget.
|
|
502
532
|
* @throws LlmError with `RATE_LIMIT` when every account is cooling down.
|
|
503
533
|
*/
|
|
504
|
-
getEffectiveAccount(excludeIds?: ReadonlySet<string>, fetchFn?: typeof fetch, forceRefresh?: boolean): Promise<{
|
|
534
|
+
getEffectiveAccount(excludeIds?: ReadonlySet<string>, fetchFn?: typeof fetch, forceRefresh?: boolean, options?: AccountPoolRefreshOptions): Promise<{
|
|
505
535
|
account: TAccount;
|
|
506
536
|
credentials: TCredentials;
|
|
507
537
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-pool.d.ts","sourceRoot":"","sources":["../../../../src/host/common/account-pool.ts"],"names":[],"mappings":"AAIA,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"account-pool.d.ts","sourceRoot":"","sources":["../../../../src/host/common/account-pool.ts"],"names":[],"mappings":"AAIA,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEjF,OAAO,EAQL,KAAK,qBAAqB,EAC3B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAEhF,wEAAwE;AACxE,eAAO,MAAM,sBAAsB,QAAS,CAAA;AAK5C,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAAC,YAAY;IAC5C,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,YAAY,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EA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;IAM/B;;;;;OAKG;IACH,SAAS,CAAC,kBAAkB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IAMxD,4EAA4E;IAC5E,OAAO,CAAC,aAAa;IAsBrB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,CAAC,mBAAmB;IAuC3B;;;;;;;;;;;OAWG;IACG,mBAAmB,CACvB,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,OAAO,GAAE,OAAO,KAAa,EAC7B,YAAY,UAAQ,EACpB,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC;QAAE,OAAO,EAAE,QAAQ,CAAC;QAAC,WAAW,EAAE,YAAY,CAAA;KAAE,CAAC;CAiD7D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* English copy for everything the Host says on its own.
|
|
3
|
+
*
|
|
4
|
+
* Typed against the Chinese key set, so a key that exists there and not here is
|
|
5
|
+
* a compile error rather than a raw key name in the interface.
|
|
6
|
+
*/
|
|
7
|
+
import type { HostLocaleKey } from './zh.ts';
|
|
8
|
+
export declare const en: Record<HostLocaleKey, string>;
|
|
9
|
+
//# sourceMappingURL=en.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../../src/host/common/i18n/en.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,eAAO,MAAM,EAAE,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CA2J5C,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-side language support: the runtime the client mirror feeds, the lookup
|
|
3
|
+
* every Host composer reads, and the provider-name table built on it.
|
|
4
|
+
* @module dsh-chatgpt-subscription/host/i18n
|
|
5
|
+
*/
|
|
6
|
+
export { currentLocale, HostLocaleRuntime, hostLocaleRuntime, installHostLocale, } from './runtime.ts';
|
|
7
|
+
export { HOST_LOCALES, interpolate, t, translate } from './t.ts';
|
|
8
|
+
export { localizedProviderName } from './provider-name.ts';
|
|
9
|
+
export type { HostLocaleKey } from './zh.ts';
|
|
10
|
+
export { en } from './en.ts';
|
|
11
|
+
export { ru } from './ru.ts';
|
|
12
|
+
export { zh } from './zh.ts';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/host/common/i18n/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,GACvE,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The name one provider registers under, in the language in force.
|
|
3
|
+
*
|
|
4
|
+
* @param providerId - Id the harness asked about.
|
|
5
|
+
* @param fallback - The adapter's own neutral name, used when this build has no
|
|
6
|
+
* translation for the id (a provider this table does not know).
|
|
7
|
+
* @returns Localized display name, or `fallback`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function localizedProviderName(providerId: string, fallback: string): string;
|
|
10
|
+
//# sourceMappingURL=provider-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-name.d.ts","sourceRoot":"","sources":["../../../../../src/host/common/i18n/provider-name.ts"],"names":[],"mappings":"AAyBA;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGlF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Russian copy for everything the Host says on its own.
|
|
3
|
+
*
|
|
4
|
+
* Terminology follows the client language pack in
|
|
5
|
+
* 'src/client/locales-ru/': "подписка" for a subscription line and the
|
|
6
|
+
* product's own name left untranslated.
|
|
7
|
+
*/
|
|
8
|
+
import type { HostLocaleKey } from './zh.ts';
|
|
9
|
+
export declare const ru: Record<HostLocaleKey, string>;
|
|
10
|
+
//# sourceMappingURL=ru.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ru.d.ts","sourceRoot":"","sources":["../../../../../src/host/common/i18n/ru.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C,eAAO,MAAM,EAAE,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CA2J5C,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one place the Host remembers which language it is answering in.
|
|
3
|
+
*
|
|
4
|
+
* The Host has no locale service: the browser resolves the active language
|
|
5
|
+
* (explicit preference, else the browser's own), and this plugin's client
|
|
6
|
+
* mirrors that resolved value back over its own route. Everything the Host
|
|
7
|
+
* says on its own — a provider name, a quota failure, a progress update —
|
|
8
|
+
* reads the language from here at the moment it speaks, so a switch reaches
|
|
9
|
+
* text that was composed long after the page loaded.
|
|
10
|
+
*
|
|
11
|
+
* Nothing is persisted: the client re-mirrors on every page load, and the
|
|
12
|
+
* default keeps a Host that has never been mirrored on the wording it shipped
|
|
13
|
+
* with. A second client with a different language wins the race described by
|
|
14
|
+
* 'last write wins'; that is a documented limitation, not a bug to scale into
|
|
15
|
+
* a per-session registry.
|
|
16
|
+
* @module dsh-chatgpt-subscription/host/i18n/runtime
|
|
17
|
+
*/
|
|
18
|
+
import { type LocaleId } from '../../../shared/i18n-contracts.ts';
|
|
19
|
+
/** In-memory current language plus its change notification. */
|
|
20
|
+
export declare class HostLocaleRuntime {
|
|
21
|
+
private current;
|
|
22
|
+
private readonly listeners;
|
|
23
|
+
/** The language every Host-side composer should answer in right now. */
|
|
24
|
+
get(): LocaleId;
|
|
25
|
+
/**
|
|
26
|
+
* Adopt a language hint; unsupported values collapse to the default.
|
|
27
|
+
*
|
|
28
|
+
* @param tag - Any tag a caller offers (a route body, a settings value).
|
|
29
|
+
* @returns The language now in force after normalization.
|
|
30
|
+
*/
|
|
31
|
+
set(tag: unknown): LocaleId;
|
|
32
|
+
/**
|
|
33
|
+
* Observe later language changes.
|
|
34
|
+
*
|
|
35
|
+
* @param listener - Called after {@link set} actually changed the language.
|
|
36
|
+
* @returns Unsubscribe.
|
|
37
|
+
*/
|
|
38
|
+
subscribe(listener: () => void): () => void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Hand the runtime to this module.
|
|
42
|
+
*
|
|
43
|
+
* Adapters and routes read the language through {@link currentLocale} instead
|
|
44
|
+
* of threading a runtime through thirteen constructors, and a test that never
|
|
45
|
+
* installs one keeps the plugin's original Chinese wording.
|
|
46
|
+
*
|
|
47
|
+
* @param runtime - The runtime the plugin entry owns, or `undefined` to detach.
|
|
48
|
+
*/
|
|
49
|
+
export declare function installHostLocale(runtime: HostLocaleRuntime | undefined): void;
|
|
50
|
+
/** The language in force, or {@link DEFAULT_LOCALE} when nothing is installed. */
|
|
51
|
+
export declare function currentLocale(): LocaleId;
|
|
52
|
+
/** The installed runtime, when the plugin entry has wired one. */
|
|
53
|
+
export declare function hostLocaleRuntime(): HostLocaleRuntime | undefined;
|
|
54
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../../src/host/common/i18n/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAmC,KAAK,QAAQ,EAAE,MAAM,mCAAmC,CAAA;AAElG,+DAA+D;AAC/D,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAA2B;IAE1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwB;IAElD,wEAAwE;IACxE,GAAG,IAAI,QAAQ;IAIf;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,OAAO,GAAG,QAAQ;IAQ3B;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;CAI5C;AAID;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GAAG,IAAI,CAE9E;AAED,kFAAkF;AAClF,wBAAgB,aAAa,IAAI,QAAQ,CAExC;AAED,kEAAkE;AAClE,wBAAgB,iBAAiB,IAAI,iBAAiB,GAAG,SAAS,CAEjE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lookup and interpolation for the Host's own copy.
|
|
3
|
+
*
|
|
4
|
+
* Kept separate from the runtime so a test can ask for any language directly
|
|
5
|
+
* (`translate('ru', …)`) without installing anything.
|
|
6
|
+
* @module dsh-chatgpt-subscription/host/i18n/t
|
|
7
|
+
*/
|
|
8
|
+
import { type LocaleId } from '../../../shared/i18n-contracts.ts';
|
|
9
|
+
import { type HostLocaleKey } from './zh.ts';
|
|
10
|
+
/**
|
|
11
|
+
* Copy for one key in one language, with `{name}` placeholders filled.
|
|
12
|
+
*
|
|
13
|
+
* @param locale - Language to answer in.
|
|
14
|
+
* @param key - Key from the Chinese source dictionary.
|
|
15
|
+
* @param params - Values for the placeholders the template declares.
|
|
16
|
+
* @returns The rendered copy; a key missing from a language falls back to Chinese.
|
|
17
|
+
*/
|
|
18
|
+
export declare function translate(locale: LocaleId, key: HostLocaleKey, params?: Record<string, unknown>): string;
|
|
19
|
+
/**
|
|
20
|
+
* Copy for one key in the language currently in force.
|
|
21
|
+
*
|
|
22
|
+
* @param key - Key from the Chinese source dictionary.
|
|
23
|
+
* @param params - Values for the placeholders the template declares.
|
|
24
|
+
* @returns The rendered copy.
|
|
25
|
+
*/
|
|
26
|
+
export declare function t(key: HostLocaleKey, params?: Record<string, unknown>): string;
|
|
27
|
+
/**
|
|
28
|
+
* Fill `{name}` placeholders; an absent parameter leaves its placeholder alone
|
|
29
|
+
* so a mis-wired call is visible rather than silently blank.
|
|
30
|
+
*
|
|
31
|
+
* @param template - Copy carrying placeholders.
|
|
32
|
+
* @param params - Values by placeholder name.
|
|
33
|
+
* @returns The rendered copy.
|
|
34
|
+
*/
|
|
35
|
+
export declare function interpolate(template: string, params?: Record<string, unknown>): string;
|
|
36
|
+
/** Every language a Host dictionary exists for; the pack is complete by type. */
|
|
37
|
+
export declare const HOST_LOCALES: readonly LocaleId[];
|
|
38
|
+
//# sourceMappingURL=t.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"t.d.ts","sourceRoot":"","sources":["../../../../../src/host/common/i18n/t.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,mCAAmC,CAAA;AAGpF,OAAO,EAAM,KAAK,aAAa,EAAE,MAAM,SAAS,CAAA;AAKhD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAIxG;AAED;;;;;;GAMG;AACH,wBAAgB,CAAC,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAE9E;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAOtF;AAED,iFAAiF;AACjF,eAAO,MAAM,YAAY,EAAE,SAAS,QAAQ,EAAsB,CAAA"}
|