@eddyskywalker/dsh-chatgpt-subscription 0.2.21 → 0.3.1
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 +100 -0
- package/README.md +115 -1
- package/lib/client.js +2831 -512
- package/lib/client.js.map +1 -1
- package/lib/index.js +9092 -389
- package/lib/types/client/ProviderHubSection.d.ts +15 -0
- package/lib/types/client/ProviderHubSection.d.ts.map +1 -0
- package/lib/types/client/command-code/CommandCodeComposerQuota.d.ts +24 -0
- package/lib/types/client/command-code/CommandCodeComposerQuota.d.ts.map +1 -0
- package/lib/types/client/command-code/CommandCodeSection.d.ts +11 -0
- package/lib/types/client/command-code/CommandCodeSection.d.ts.map +1 -0
- package/lib/types/client/command-code/locales.d.ts +401 -0
- package/lib/types/client/command-code/locales.d.ts.map +1 -0
- package/lib/types/client/index.d.ts +2 -0
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/kimi-code/KimiCodeComposerQuota.d.ts +25 -0
- package/lib/types/client/kimi-code/KimiCodeComposerQuota.d.ts.map +1 -0
- package/lib/types/client/kimi-code/KimiCodeSection.d.ts +11 -0
- package/lib/types/client/kimi-code/KimiCodeSection.d.ts.map +1 -0
- package/lib/types/client/kimi-code/KimiModelCapabilities.d.ts +16 -0
- package/lib/types/client/kimi-code/KimiModelCapabilities.d.ts.map +1 -0
- package/lib/types/client/kimi-code/locales.d.ts +671 -0
- package/lib/types/client/kimi-code/locales.d.ts.map +1 -0
- package/lib/types/client/kimi-code/styles.d.ts +4 -0
- package/lib/types/client/kimi-code/styles.d.ts.map +1 -0
- package/lib/types/client/locales.d.ts +3 -1
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/styles.d.ts.map +1 -1
- package/lib/types/host/command-code/adapter.d.ts +34 -0
- package/lib/types/host/command-code/adapter.d.ts.map +1 -0
- package/lib/types/host/command-code/client.d.ts +99 -0
- package/lib/types/host/command-code/client.d.ts.map +1 -0
- package/lib/types/host/command-code/mapper.d.ts +102 -0
- package/lib/types/host/command-code/mapper.d.ts.map +1 -0
- package/lib/types/host/command-code/model-catalog.d.ts +31 -0
- package/lib/types/host/command-code/model-catalog.d.ts.map +1 -0
- package/lib/types/host/command-code/oauth.d.ts +89 -0
- package/lib/types/host/command-code/oauth.d.ts.map +1 -0
- package/lib/types/host/command-code/plans.d.ts +40 -0
- package/lib/types/host/command-code/plans.d.ts.map +1 -0
- package/lib/types/host/command-code/routes.d.ts +27 -0
- package/lib/types/host/command-code/routes.d.ts.map +1 -0
- package/lib/types/host/command-code/token-store.d.ts +88 -0
- package/lib/types/host/command-code/token-store.d.ts.map +1 -0
- package/lib/types/host/command-code/types.d.ts +138 -0
- package/lib/types/host/command-code/types.d.ts.map +1 -0
- package/lib/types/host/kimi-code/adapter.d.ts +112 -0
- package/lib/types/host/kimi-code/adapter.d.ts.map +1 -0
- package/lib/types/host/kimi-code/client.d.ts +173 -0
- package/lib/types/host/kimi-code/client.d.ts.map +1 -0
- package/lib/types/host/kimi-code/mapper.d.ts +370 -0
- package/lib/types/host/kimi-code/mapper.d.ts.map +1 -0
- package/lib/types/host/kimi-code/modalities.d.ts +94 -0
- package/lib/types/host/kimi-code/modalities.d.ts.map +1 -0
- package/lib/types/host/kimi-code/model-catalog.d.ts +77 -0
- package/lib/types/host/kimi-code/model-catalog.d.ts.map +1 -0
- package/lib/types/host/kimi-code/oauth.d.ts +133 -0
- package/lib/types/host/kimi-code/oauth.d.ts.map +1 -0
- package/lib/types/host/kimi-code/routes.d.ts +26 -0
- package/lib/types/host/kimi-code/routes.d.ts.map +1 -0
- package/lib/types/host/kimi-code/token-store.d.ts +135 -0
- package/lib/types/host/kimi-code/token-store.d.ts.map +1 -0
- package/lib/types/host/kimi-code/types.d.ts +174 -0
- package/lib/types/host/kimi-code/types.d.ts.map +1 -0
- package/lib/types/host/kimi-code/video-store.d.ts +99 -0
- package/lib/types/host/kimi-code/video-store.d.ts.map +1 -0
- package/lib/types/host/kimi-code/video-tool.d.ts +25 -0
- package/lib/types/host/kimi-code/video-tool.d.ts.map +1 -0
- package/lib/types/host/relay-probe.d.ts +161 -0
- package/lib/types/host/relay-probe.d.ts.map +1 -0
- package/lib/types/host/responses-client.d.ts.map +1 -1
- package/lib/types/index.d.ts +13 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/command-code-contracts.d.ts +119 -0
- package/lib/types/shared/command-code-contracts.d.ts.map +1 -0
- package/lib/types/shared/kimi-code-contracts.d.ts +203 -0
- package/lib/types/shared/kimi-code-contracts.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../../src/client/kimi-code/locales.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,kBAAkB,CAAA;AAE3C,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8GL,CAAA;AAEV,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8GL,CAAA;AAEV,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKxB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/client/kimi-code/styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,iCAAiC,CAAA;AAwFtD,uEAAuE;AACvE,wBAAgB,qBAAqB,IAAI,IAAI,CAM5C"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const NS: "dsh-chatgpt-subscription";
|
|
2
2
|
export declare const zh: {
|
|
3
3
|
readonly title: "ChatGPT";
|
|
4
|
+
readonly hubTitle: "订阅服务";
|
|
4
5
|
readonly intro: "使用 ChatGPT 账号登录,在 DSH 中使用订阅可用的模型。";
|
|
5
6
|
readonly account: "账号";
|
|
6
7
|
readonly signedOut: "尚未登录";
|
|
@@ -128,6 +129,7 @@ export type LocaleKey = keyof typeof zh;
|
|
|
128
129
|
export declare const dictionaries: {
|
|
129
130
|
zh: {
|
|
130
131
|
readonly title: "ChatGPT";
|
|
132
|
+
readonly hubTitle: "订阅服务";
|
|
131
133
|
readonly intro: "使用 ChatGPT 账号登录,在 DSH 中使用订阅可用的模型。";
|
|
132
134
|
readonly account: "账号";
|
|
133
135
|
readonly signedOut: "尚未登录";
|
|
@@ -250,6 +252,6 @@ export declare const dictionaries: {
|
|
|
250
252
|
readonly retry: "重试";
|
|
251
253
|
readonly unknown: "未知";
|
|
252
254
|
};
|
|
253
|
-
en: Record<"
|
|
255
|
+
en: Record<"tokens" | "title" | "hubTitle" | "intro" | "account" | "signedOut" | "signedIn" | "plan" | "accountId" | "expires" | "storage" | "storageWindows" | "storageMacKeychain" | "storageLinuxFile" | "storageMemory" | "storageUnavailable" | "securityWindows" | "securityMacKeychain" | "securityLinuxFile" | "securityMemory" | "securityUnavailable" | "signIn" | "signInAgain" | "cancel" | "signOut" | "refreshToken" | "pending" | "popupBlocked" | "continueLogin" | "loading" | "connection" | "provider" | "connectionState" | "connected" | "untested" | "testConnection" | "testing" | "latency" | "models" | "modelsHint" | "proxySettings" | "proxyMode" | "proxyModeHint" | "proxyModeAuto" | "proxyModeCustom" | "proxyModeDirect" | "customProxyUrl" | "customProxyUrlHint" | "customProxyUrlPlaceholder" | "saveProxyUrl" | "proxyDetected" | "proxyDetectedEffective" | "proxyNoneDetected" | "proxyDirectHint" | "enhancements" | "fastMode" | "fastModeHint" | "outputVerbosity" | "outputVerbosityHint" | "verbosityLow" | "verbosityMedium" | "verbosityHigh" | "reasoningSummary" | "reasoningSummaryHint" | "summaryAuto" | "summaryConcise" | "summaryDetailed" | "summaryNone" | "searchProvider" | "searchProviderHint" | "searchProviderDsh" | "searchProviderCodex" | "providerDefault" | "contextWindows" | "contextWindowsHint" | "contextWindow" | "contextWindowInvalid" | "saveContextWindow" | "save" | "quickQuota" | "quickQuotaHint" | "quota" | "quotaIntro" | "refreshQuota" | "refreshing" | "noQuota" | "quotaSignedOut" | "stale" | "updated" | "primary" | "secondary" | "limitWindow" | "used" | "remaining" | "available" | "unavailable" | "unlimited" | "credits" | "monthlySpend" | "resetCredits" | "resetCreditExpires" | "useResetCredit" | "usingResetCredit" | "useResetCreditConfirm" | "resetCreditUsed" | "spendControlReached" | "limit" | "exhausted" | "resets" | "quickQuotaLabel" | "quickQuotaLoading" | "imageToolRunning" | "imageToolDone" | "imageToolFailed" | "image" | "openImage" | "openNamedImage" | "imageLoading" | "imageLoadFailed" | "imagePreviewClose" | "imagePreviewOpenOriginal" | "retry" | "unknown", string>;
|
|
254
256
|
};
|
|
255
257
|
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../src/client/locales.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE,EAAG,0BAAmC,CAAA;AAErD,eAAO,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../src/client/locales.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE,EAAG,0BAAmC,CAAA;AAErD,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4HL,CAAA;AAEV,eAAO,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,OAAO,EAAE,EAAE,MAAM,CA4H9C,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,EAAE,CAAA;AACvC,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAa,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/client/styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/client/styles.ts"],"names":[],"mappings":"AA8GA,wBAAgB,aAAa,IAAI,MAAM,IAAI,CAQ1C"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LlmAdapter, ReasoningEffortId, type GenerateOptions, type LlmModelInfo, type LlmProviderInfo, type LlmResolvedModelInfo, type PreparedAdapterCall, type ResolvedRetryPolicy, type StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
2
|
+
import { FileCredentialStore, FileModelSettingsStore, type CommandCodeCatalogModel, type CommandCodePreferenceStore } from './token-store.ts';
|
|
3
|
+
import { type AttachmentImageReader } from './mapper.ts';
|
|
4
|
+
/** Configured effort when the model supports it, else the adapter's preference order. */
|
|
5
|
+
export declare function resolveDefaultReasoningEffort(efforts: readonly string[], configuredEffort?: string | null): ReasoningEffortId | undefined;
|
|
6
|
+
export interface CommandCodeAdapterOptions {
|
|
7
|
+
fetchFn?: typeof fetch;
|
|
8
|
+
attachments?: AttachmentImageReader;
|
|
9
|
+
/** Live catalog loader seam; defaults to the public `/provider/v1/models` call. */
|
|
10
|
+
loadCatalog?: () => Promise<CommandCodeCatalogModel[]>;
|
|
11
|
+
}
|
|
12
|
+
export declare class CommandCodeAdapter extends LlmAdapter {
|
|
13
|
+
private readonly store;
|
|
14
|
+
private readonly modelSettings;
|
|
15
|
+
private readonly preferences?;
|
|
16
|
+
private readonly options;
|
|
17
|
+
constructor(store?: FileCredentialStore, modelSettings?: FileModelSettingsStore, preferences?: CommandCodePreferenceStore | undefined, options?: CommandCodeAdapterOptions);
|
|
18
|
+
providerInfo(provider: string): LlmProviderInfo;
|
|
19
|
+
providerRetryPolicy(): ResolvedRetryPolicy;
|
|
20
|
+
imageRequestPricing(): undefined;
|
|
21
|
+
private settings;
|
|
22
|
+
/**
|
|
23
|
+
* Catalog for the picker: the live Command Code listing when reachable, the
|
|
24
|
+
* shipped fallback otherwise, narrowed by the user's enabled selection.
|
|
25
|
+
*/
|
|
26
|
+
private catalog;
|
|
27
|
+
private contextWindowFor;
|
|
28
|
+
listModels(provider?: string): Promise<readonly LlmModelInfo[]>;
|
|
29
|
+
resolveModel(provider: string, modelId: string, signal?: AbortSignal): Promise<LlmResolvedModelInfo>;
|
|
30
|
+
prepareCall(provider: string, model: string, signal?: AbortSignal): Promise<PreparedAdapterCall>;
|
|
31
|
+
stream(options: GenerateOptions): AsyncIterable<StreamChunk>;
|
|
32
|
+
private requestStream;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL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C,mBAAmB,IAAI,SAAS;IAIhC,OAAO,CAAC,QAAQ;IAIhB;;;OAGG;YACW,OAAO;IAYrB,OAAO,CAAC,gBAAgB;IAUlB,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC;IAe/D,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA0BpG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO/F,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,aAAa,CAAC,WAAW,CAAC;YAgBpD,aAAa;CAwH7B"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { PROVIDER_ID } from './types.ts';
|
|
2
|
+
import { FileCredentialStore, type CommandCodeCatalogModel } from './token-store.ts';
|
|
3
|
+
import type { CommandCodeAccount, CommandCodeAccountQuota, CommandCodeApiEnv, CommandCodeMeter, CommandCodeUsageWindow } from '../../shared/command-code-contracts.ts';
|
|
4
|
+
export interface CommandCodeRequestOptions {
|
|
5
|
+
fetchFn?: typeof fetch;
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
apiEnv?: CommandCodeApiEnv;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Attribution headers for every Command Code request.
|
|
11
|
+
*
|
|
12
|
+
* The alpha routes are the ones the official CLI calls, so the plugin
|
|
13
|
+
* identifies with the same vocabulary; the provider API only needs the bearer
|
|
14
|
+
* token plus a JSON content type.
|
|
15
|
+
*/
|
|
16
|
+
export declare function commandCodeHeaders(apiKey: string, extra?: Record<string, string>): Record<string, string>;
|
|
17
|
+
/** Map `/alpha/whoami` (or a stored key's own facts) onto the public account DTO. */
|
|
18
|
+
export declare function parseWhoami(payload: unknown, fallback?: Partial<CommandCodeAccount>): CommandCodeAccount;
|
|
19
|
+
/** Resolve the plan id the subscription or credits payload reports, when either does. */
|
|
20
|
+
export declare function parsePlanId(payloads: readonly unknown[]): string | null;
|
|
21
|
+
/**
|
|
22
|
+
* Subscription status such as `active`, `trialing`, or `past_due`.
|
|
23
|
+
*
|
|
24
|
+
* The CLI treats exactly `active`, `trialing`, and `past_due` as entitled, so
|
|
25
|
+
* the status is surfaced rather than swallowed: a card that showed an expired
|
|
26
|
+
* subscription's remaining credits as usable would be worse than showing none.
|
|
27
|
+
*/
|
|
28
|
+
export declare function parseSubscriptionStatus(payload: unknown): string | null;
|
|
29
|
+
/** End of the current billing period, in Unix milliseconds. */
|
|
30
|
+
export declare function parseSubscriptionPeriodEnd(payload: unknown): number | null;
|
|
31
|
+
/**
|
|
32
|
+
* Turn one billing/usage payload into meters.
|
|
33
|
+
*
|
|
34
|
+
* The named blocks the service actually sends are read first, so windows carry
|
|
35
|
+
* their real labels; the generic sweep afterwards still catches any bounded
|
|
36
|
+
* allowance a future payload introduces, rather than reporting nothing.
|
|
37
|
+
*/
|
|
38
|
+
export declare function parseMeters(payload: unknown): CommandCodeMeter[];
|
|
39
|
+
/** Parse an ISO string, Unix seconds, or Unix milliseconds into Unix milliseconds. */
|
|
40
|
+
export declare function parseTimestamp(value: unknown): number | null;
|
|
41
|
+
/** Map `/alpha/usage/summary` onto the windowed allowance DTO. */
|
|
42
|
+
export declare function parseUsageWindows(payload: unknown): CommandCodeUsageWindow[];
|
|
43
|
+
/**
|
|
44
|
+
* Total remaining credits.
|
|
45
|
+
*
|
|
46
|
+
* `/alpha/billing/credits` reports three separate pools rather than one total
|
|
47
|
+
* (`credits.monthlyCredits`, `purchasedCredits`, `freeCredits`), and a plain
|
|
48
|
+
* `credits` lookup only finds the containing object — which is why this used to
|
|
49
|
+
* answer null and the card showed a blank balance. The pools are summed exactly
|
|
50
|
+
* as the CLI sums them; a payload that reports a flat balance still works.
|
|
51
|
+
*/
|
|
52
|
+
/** Exported for the quota regression tests; not part of the route surface. */
|
|
53
|
+
export declare function extractCreditsBalanceForTest(payload: unknown): string | null;
|
|
54
|
+
/** Parse the public `/provider/v1/models` payload. */
|
|
55
|
+
export declare function parseProviderModels(payload: unknown): CommandCodeCatalogModel[];
|
|
56
|
+
/**
|
|
57
|
+
* Fetch the live catalog. The endpoint is public, so this works before sign-in
|
|
58
|
+
* and is what fills the settings card's context-window defaults.
|
|
59
|
+
*/
|
|
60
|
+
export declare function fetchProviderModels(options?: CommandCodeRequestOptions): Promise<CommandCodeCatalogModel[]>;
|
|
61
|
+
/** Cached catalog with a TTL; a failed refresh keeps the previous snapshot. */
|
|
62
|
+
export declare function loadProviderModels(options?: CommandCodeRequestOptions & {
|
|
63
|
+
force?: boolean;
|
|
64
|
+
}): Promise<CommandCodeCatalogModel[]>;
|
|
65
|
+
export declare function getCachedCatalog(): CommandCodeCatalogModel[];
|
|
66
|
+
export declare function clearCachedCatalog(): void;
|
|
67
|
+
/** Effective context window: a saved override wins over the catalog value. */
|
|
68
|
+
export declare function effectiveContextWindow(modelId: string, catalog: readonly CommandCodeCatalogModel[], overrides: Record<string, number>): number;
|
|
69
|
+
export declare function whoami(apiKey: string, options?: CommandCodeRequestOptions): Promise<unknown>;
|
|
70
|
+
/**
|
|
71
|
+
* Verify one API key and read the account facts behind it.
|
|
72
|
+
*
|
|
73
|
+
* This is the single validation point used by manual key entry, by the browser
|
|
74
|
+
* callback, and by the connection test, so a key that cannot answer `whoami`
|
|
75
|
+
* is never stored.
|
|
76
|
+
*/
|
|
77
|
+
export declare function verifyApiKey(apiKey: string, options?: CommandCodeRequestOptions): Promise<CommandCodeAccount>;
|
|
78
|
+
export declare function getCachedQuota(): CommandCodeAccountQuota | undefined;
|
|
79
|
+
export declare function clearCachedQuota(): void;
|
|
80
|
+
/**
|
|
81
|
+
* Read credits, subscriptions, and usage, tolerating a service that answers
|
|
82
|
+
* only some of the three. Every failure is captured as a missing source rather
|
|
83
|
+
* than failing the whole snapshot, because a working credit balance is still
|
|
84
|
+
* worth showing when the usage route is down.
|
|
85
|
+
*/
|
|
86
|
+
export declare function fetchAccountQuota(store?: FileCredentialStore, fetchFn?: typeof fetch, force?: boolean): Promise<CommandCodeAccountQuota>;
|
|
87
|
+
/** Catalog entry list with the exact defaults the settings card renders. */
|
|
88
|
+
export declare function buildModelOptions(catalog: readonly CommandCodeCatalogModel[], enabledModelIds: readonly string[], overrides: Record<string, number>): Array<{
|
|
89
|
+
id: string;
|
|
90
|
+
name: string;
|
|
91
|
+
enabled: boolean;
|
|
92
|
+
defaultContextWindow: number;
|
|
93
|
+
contextWindow: number;
|
|
94
|
+
defaultMaxTokens: number;
|
|
95
|
+
reasoningEfforts?: string[];
|
|
96
|
+
wire: 'openai' | 'anthropic';
|
|
97
|
+
}>;
|
|
98
|
+
export { PROVIDER_ID };
|
|
99
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/host/command-code/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAYL,WAAW,EAWZ,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,mBAAmB,EAAE,KAAK,uBAAuB,EAA+B,MAAM,kBAAkB,CAAA;AAEjH,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,wCAAwC,CAAA;AAI/C,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,OAAO,KAAK,CAAA;IACtB,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,MAAM,CAAC,EAAE,iBAAiB,CAAA;CAC3B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACjC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,C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
|
|
2
|
+
* Provider-wire mapping for the two Command Code provider endpoints.
|
|
3
|
+
*
|
|
4
|
+
* The API serves Anthropic-format models on `/messages` and everything else on
|
|
5
|
+
* `/chat/completions`; it validates the split and rejects a model sent to the
|
|
6
|
+
* wrong endpoint. Both wires are mapped here so one adapter can serve the whole
|
|
7
|
+
* catalog, and both streams are normalized into DSH's block/delta vocabulary.
|
|
8
|
+
*
|
|
9
|
+
* https://commandcode.ai/blog/command-code-provider-api
|
|
10
|
+
*/
|
|
11
|
+
import { type ContentBlock, type GenerateOptions, type StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
12
|
+
import type { AttachmentStore } from '@deepseek-ai/dsh-attachment';
|
|
13
|
+
import type { CommandCodeWire } from '../../shared/command-code-contracts.ts';
|
|
14
|
+
/** Attachment seam this route needs: verified bytes for one durable image. */
|
|
15
|
+
export type AttachmentImageReader = Pick<AttachmentStore, 'readImage'>;
|
|
16
|
+
/** One durable user image resolved for an in-flight request, or proven unreadable. */
|
|
17
|
+
export type ResolvedRequestImage = {
|
|
18
|
+
readonly kind: 'inline';
|
|
19
|
+
readonly mediaType: string;
|
|
20
|
+
readonly data: string;
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: 'unavailable';
|
|
23
|
+
};
|
|
24
|
+
/** Resolved images keyed by durable attachment id; consumed by one request build. */
|
|
25
|
+
export type ResolvedRequestImages = ReadonlyMap<string, ResolvedRequestImage>;
|
|
26
|
+
/**
|
|
27
|
+
* Base64 image payload one request may carry.
|
|
28
|
+
*
|
|
29
|
+
* Both Command Code endpoints are proxies: the body is forwarded to whichever
|
|
30
|
+
* upstream serves the model, so the bound has to hold for the strictest of
|
|
31
|
+
* them. 12 MB matches what this plugin already allows its Gemini route and
|
|
32
|
+
* keeps the conversation text, tool schemas, and system prompt inside the same
|
|
33
|
+
* body.
|
|
34
|
+
*/
|
|
35
|
+
export declare const MAX_REQUEST_IMAGE_BYTES: number;
|
|
36
|
+
/**
|
|
37
|
+
* Replace the oldest inline images with a text placeholder once one request
|
|
38
|
+
* would carry more than {@link MAX_REQUEST_IMAGE_BYTES} of base64 image data.
|
|
39
|
+
* Durable history is untouched; only the request about to be sent changes.
|
|
40
|
+
*/
|
|
41
|
+
export declare function offloadOldestRequestImages(options: GenerateOptions): GenerateOptions;
|
|
42
|
+
/**
|
|
43
|
+
* Read every durable `{ type: 'image', attachment }` block one request carries.
|
|
44
|
+
* An unreadable image resolves to `unavailable` rather than disappearing, so
|
|
45
|
+
* the model is told the picture is missing instead of answering about a blank.
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolveRequestImages(options: GenerateOptions, attachments: AttachmentImageReader | undefined, signal?: AbortSignal): Promise<ResolvedRequestImages>;
|
|
48
|
+
/** Drop the JSON-Schema keywords provider gateways reject or ignore. */
|
|
49
|
+
export declare function stripMetaSchema(schema: unknown): Record<string, unknown>;
|
|
50
|
+
/** Build one `/chat/completions` body. */
|
|
51
|
+
export declare function buildOpenAIRequest(options: GenerateOptions, images?: ResolvedRequestImages): Record<string, unknown>;
|
|
52
|
+
/** Reasoning budget a thinking-enabled request may spend, given its output cap. */
|
|
53
|
+
export declare function thinkingBudgetFor(effort: string | undefined, maxTokens: number): number | undefined;
|
|
54
|
+
/** Build one `/messages` body. */
|
|
55
|
+
export declare function buildAnthropicRequest(options: GenerateOptions, images?: ResolvedRequestImages): Record<string, unknown>;
|
|
56
|
+
/** Build the body for whichever endpoint serves `modelId`. */
|
|
57
|
+
export declare function buildRequest(options: GenerateOptions, wire: CommandCodeWire, images?: ResolvedRequestImages): Record<string, unknown>;
|
|
58
|
+
/** One tool call accumulating across `chat/completions` deltas. */
|
|
59
|
+
interface PendingToolCall {
|
|
60
|
+
blockIndex: number;
|
|
61
|
+
id: string;
|
|
62
|
+
name: string;
|
|
63
|
+
arguments: string;
|
|
64
|
+
started: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface CommandCodeStreamState {
|
|
67
|
+
wire: CommandCodeWire;
|
|
68
|
+
blocks: ContentBlock[];
|
|
69
|
+
current: {
|
|
70
|
+
index: number;
|
|
71
|
+
type: 'text' | 'reasoning';
|
|
72
|
+
text: string;
|
|
73
|
+
} | null;
|
|
74
|
+
/** wire tool index -> accumulating call (OpenAI route). */
|
|
75
|
+
toolCalls: Map<number, PendingToolCall>;
|
|
76
|
+
/** anthropic content-block index -> our block index. */
|
|
77
|
+
contentIndexes: Map<number, number>;
|
|
78
|
+
/** anthropic content index of the block currently open. */
|
|
79
|
+
openContentIndex: number | null;
|
|
80
|
+
hasContent: boolean;
|
|
81
|
+
hasToolCall: boolean;
|
|
82
|
+
finishReason: string | null;
|
|
83
|
+
done: boolean;
|
|
84
|
+
finished: boolean;
|
|
85
|
+
inputTokens: number;
|
|
86
|
+
outputTokens: number;
|
|
87
|
+
cacheReadTokens: number;
|
|
88
|
+
cacheWriteTokens: number;
|
|
89
|
+
reasoningTokens: number;
|
|
90
|
+
sawUsage: boolean;
|
|
91
|
+
}
|
|
92
|
+
export declare function createStreamState(wire: CommandCodeWire): CommandCodeStreamState;
|
|
93
|
+
/** Feed one SSE `data:` payload from `/chat/completions`. */
|
|
94
|
+
export declare function processOpenAIStreamLine(line: string, state: CommandCodeStreamState): StreamChunk[];
|
|
95
|
+
/** Feed one SSE `data:` payload from `/messages`. */
|
|
96
|
+
export declare function processAnthropicStreamLine(line: string, state: CommandCodeStreamState): StreamChunk[];
|
|
97
|
+
/** Flush every open block, then emit usage and the terminal finish. */
|
|
98
|
+
export declare function closeStream(state: CommandCodeStreamState): StreamChunk[];
|
|
99
|
+
/** Model families whose stream never carried a terminal event. */
|
|
100
|
+
export declare function assertStreamComplete(state: CommandCodeStreamState): void;
|
|
101
|
+
export {};
|
|
102
|
+
//# sourceMappingURL=mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapper.d.ts","sourceRoot":"","sources":["../../../../src/host/command-code/mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAEL,KAAK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,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;IACxB,eAAe,EAAE,MAAM,CAAA;IACvB,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,sBAAsB,CAoB/E;AAoCD,6DAA6D;AAC7D,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB,GAAG,WAAW,EAAE,CAkElG;AAsDD,qDAAqD;AACrD,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB,GAAG,WAAW,EAAE,CAgKrG;AAmBD,uEAAuE;AACvE,wBAAgB,WAAW,CAAC,KAAK,EAAE,sBAAsB,GAAG,WAAW,EAAE,CAOxE;AAED,kEAAkE;AAClE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAIxE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command Code model capability table.
|
|
3
|
+
*
|
|
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
|
+
* models accept image input and which reasoning levels each one exposes: the
|
|
7
|
+
* public `/provider/v1/models` listing carries an id, a display name, and a
|
|
8
|
+
* context length, but says nothing about modalities or reasoning.
|
|
9
|
+
*
|
|
10
|
+
* Family heuristics are not a substitute. Within one vendor the split is not
|
|
11
|
+
* derivable from the id: `deepseek/deepseek-v4-flash` is text-only while
|
|
12
|
+
* `deepseek/deepseek-v4.1-flash` and `deepseek/deepseek-v4-flash-vision-exp` take
|
|
13
|
+
* images, and `z-ai/glm-5.3-flash` takes images while `zai-org/GLM-5.3` does not.
|
|
14
|
+
*/
|
|
15
|
+
export interface CommandCodeModelDef {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
/** Accepted request modalities, exactly as the registry declares them. */
|
|
19
|
+
inputModalities: Array<'text' | 'image'>;
|
|
20
|
+
/** Selectable reasoning levels; empty when the model exposes none. */
|
|
21
|
+
reasoningEfforts: string[];
|
|
22
|
+
/** Context window the registry declares, when it declares one. */
|
|
23
|
+
contextWindow: number | null;
|
|
24
|
+
/** Output cap the registry declares, when it declares one. */
|
|
25
|
+
maxTokens: number | null;
|
|
26
|
+
}
|
|
27
|
+
/** Every model the Command Code registry describes, in registry order. */
|
|
28
|
+
export declare const COMMAND_CODE_MODELS: readonly CommandCodeModelDef[];
|
|
29
|
+
/** Registry entry for one model id, or undefined when it describes no such model. */
|
|
30
|
+
export declare function commandCodeModelDef(modelId: string): CommandCodeModelDef | undefined;
|
|
31
|
+
//# sourceMappingURL=model-catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-catalog.d.ts","sourceRoot":"","sources":["../../../../src/host/command-code/model-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,0EAA0E;IAC1E,eAAe,EAAE,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,CAAA;IACxC,sEAAsE;IACtE,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,kEAAkE;IAClE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,8DAA8D;IAC9D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,0EAA0E;AAC1E,eAAO,MAAM,mBAAmB,EAAE,SAAS,mBAAmB,EAilB7D,CAAA;AAED,qFAAqF;AACrF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAEpF"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { type Server } from 'node:http';
|
|
2
|
+
import { FileCredentialStore } from './token-store.ts';
|
|
3
|
+
import type { CommandCodeAccount } from '../../shared/command-code-contracts.ts';
|
|
4
|
+
export type CommandCodeLoginStatus = 'idle' | 'pending' | 'complete' | 'error';
|
|
5
|
+
export interface CommandCodeLoginFlowState {
|
|
6
|
+
status: CommandCodeLoginStatus;
|
|
7
|
+
authUrl?: string;
|
|
8
|
+
startedAt?: number;
|
|
9
|
+
completedAt?: number;
|
|
10
|
+
progress?: string;
|
|
11
|
+
account?: CommandCodeAccount;
|
|
12
|
+
error?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Credential body the studio POSTs back to the loopback callback. */
|
|
15
|
+
export interface CommandCodeCallbackCredentials {
|
|
16
|
+
apiKey: string;
|
|
17
|
+
state: string;
|
|
18
|
+
userId: string;
|
|
19
|
+
userName: string;
|
|
20
|
+
keyName: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function getWebLoginStatus(): CommandCodeLoginFlowState;
|
|
23
|
+
/** Reset the flow so a cancelled attempt cannot keep a later one from starting. */
|
|
24
|
+
export declare function resetWebLogin(): void;
|
|
25
|
+
export declare function openBrowser(url: string): void;
|
|
26
|
+
/** Browser sign-in URL; identical shape to the official CLI's. */
|
|
27
|
+
export declare function buildAuthUrl(input: {
|
|
28
|
+
port: number;
|
|
29
|
+
state: string;
|
|
30
|
+
}): string;
|
|
31
|
+
/** State token the studio must echo back; 32 random bytes, base64url. */
|
|
32
|
+
export declare function generateState(): string;
|
|
33
|
+
/**
|
|
34
|
+
* First free loopback port in the CLI's probe range.
|
|
35
|
+
*
|
|
36
|
+
* The studio receives the port in the callback URL, so any free port works;
|
|
37
|
+
* starting at the CLI's own default keeps behavior identical on a machine where
|
|
38
|
+
* a server-side allowlist is ever introduced.
|
|
39
|
+
*/
|
|
40
|
+
export declare function findAvailablePort(start?: number, attempts?: number): Promise<number>;
|
|
41
|
+
export interface CommandCodeAuthServerHandle {
|
|
42
|
+
server: Server;
|
|
43
|
+
port: number;
|
|
44
|
+
/** Resolves once the studio has posted a credential (or rejects on denial). */
|
|
45
|
+
waitForCredentials: () => Promise<CommandCodeCallbackCredentials>;
|
|
46
|
+
close: () => void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* One-shot loopback server the Command Code studio page posts the freshly
|
|
50
|
+
* minted API key to.
|
|
51
|
+
*
|
|
52
|
+
* The contract is the official CLI's, because the studio page is the same
|
|
53
|
+
* client: the browser POSTs `{apiKey,state,userId,userName,keyName}` as JSON or
|
|
54
|
+
* form data from `https://commandcode.ai`, so the endpoint must answer the
|
|
55
|
+
* cross-origin preflight (including Chrome's private-network request header)
|
|
56
|
+
* and then redirect the tab to a human-readable completion page.
|
|
57
|
+
*
|
|
58
|
+
* @param port - loopback port to bind; the caller resolved a free one.
|
|
59
|
+
* @param expectedState - state token the studio must echo back.
|
|
60
|
+
* @param options - landing grace and clock seams for tests.
|
|
61
|
+
*/
|
|
62
|
+
export declare function createAuthServer(port: number, expectedState: string, options?: {
|
|
63
|
+
landingGraceMs?: number;
|
|
64
|
+
}): Promise<CommandCodeAuthServerHandle>;
|
|
65
|
+
/**
|
|
66
|
+
* Start the browser sign-in.
|
|
67
|
+
*
|
|
68
|
+
* Resolves immediately with the flow state the settings card polls; the
|
|
69
|
+
* credential is validated against `/alpha/whoami` and persisted in the
|
|
70
|
+
* background, exactly like the manual key path, so a key that cannot
|
|
71
|
+
* authenticate is never stored.
|
|
72
|
+
*/
|
|
73
|
+
export declare function beginWebLogin(store: FileCredentialStore, options?: {
|
|
74
|
+
fetchFn?: typeof fetch;
|
|
75
|
+
openBrowser?: (url: string) => void;
|
|
76
|
+
timeoutMs?: number;
|
|
77
|
+
}): Promise<CommandCodeLoginFlowState>;
|
|
78
|
+
/**
|
|
79
|
+
* Persist a manually entered API key after proving it authenticates.
|
|
80
|
+
*
|
|
81
|
+
* Manual entry is the recovery path when the browser flow is unavailable
|
|
82
|
+
* (headless host, blocked popup, or a key minted in Command Code Studio).
|
|
83
|
+
*/
|
|
84
|
+
export declare function saveApiKey(store: FileCredentialStore, apiKey: string, options?: {
|
|
85
|
+
fetchFn?: typeof fetch;
|
|
86
|
+
}): Promise<CommandCodeAccount>;
|
|
87
|
+
/** Stable per-attempt id the settings card can correlate; kept for symmetry with other routes. */
|
|
88
|
+
export declare function newLoginAttemptId(): string;
|
|
89
|
+
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../src/host/command-code/oauth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsC,KAAK,MAAM,EAAuB,MAAM,WAAW,CAAA;AAehG,OAAO,EAAE,mBAAmB,EAA+B,MAAM,kBAAkB,CAAA;AAEnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAA;AAEhF,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAA;AAE9E,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,sBAAsB,CAAA;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,kBAAkB,CAAA;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,sEAAsE;AACtE,MAAM,WAAW,8BAA8B;IAC7C,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB;AAID,wBAAgB,iBAAiB,IAAI,yBAAyB,CAE7D;AAED,mFAAmF;AACnF,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAgB7C;AAED,kEA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
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command Code subscription plans.
|
|
3
|
+
*
|
|
4
|
+
* Transcribed from the official CLI's own plan table, which is the only place
|
|
5
|
+
* the service's `planId` strings are given human names — `/alpha/whoami` says
|
|
6
|
+
* nothing about the plan and `/alpha/billing/subscriptions` only reports the
|
|
7
|
+
* machine id (`individual-goat`), so a card that shows the raw id shows nothing
|
|
8
|
+
* a user recognizes.
|
|
9
|
+
*/
|
|
10
|
+
/** One subscription plan, with the monthly credit allowance the CLI assigns it. */
|
|
11
|
+
export interface CommandCodePlan {
|
|
12
|
+
id: string;
|
|
13
|
+
/** Display name the CLI renders, e.g. `GOAT`. */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Monthly credit allowance the plan grants. */
|
|
16
|
+
monthlyCredits: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Every plan, longest id first.
|
|
20
|
+
*
|
|
21
|
+
* The order matters: the service appends suffixes (`individual-pro-v1`) and
|
|
22
|
+
* shares prefixes across plans (`individual-pro` is a prefix of both
|
|
23
|
+
* `individual-pro-v1` and `individual-provider`), so the match must try the
|
|
24
|
+
* longest id first or `individual-provider` would resolve to `Pro`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const COMMAND_CODE_PLANS: readonly CommandCodePlan[];
|
|
27
|
+
/**
|
|
28
|
+
* Resolve one `planId` string to its plan.
|
|
29
|
+
*
|
|
30
|
+
* The service is not consistent about case or separators, so the id is
|
|
31
|
+
* normalized before matching and the comparison is a prefix test, exactly as
|
|
32
|
+
* the CLI does it.
|
|
33
|
+
*
|
|
34
|
+
* @param planId - raw id from the subscription or credits payload.
|
|
35
|
+
* @returns the matching plan, or null when the id is absent or unrecognized.
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveCommandCodePlan(planId: string | null | undefined): CommandCodePlan | null;
|
|
38
|
+
/** Display name for one plan id, falling back to the raw id so nothing is hidden. */
|
|
39
|
+
export declare function commandCodePlanLabel(planId: string | null | undefined): string | null;
|
|
40
|
+
//# sourceMappingURL=plans.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plans.d.ts","sourceRoot":"","sources":["../../../../src/host/command-code/plans.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,mFAAmF;AACnF,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAA;IACZ,gDAAgD;IAChD,cAAc,EAAE,MAAM,CAAA;CACvB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,eAAe,EASxD,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,eAAe,GAAG,IAAI,CAKhG;AAED,qFAAqF;AACrF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAGrF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import { PROVIDER_ID, PROVIDER_NAME } from './types.ts';
|
|
3
|
+
import { FileCredentialStore, FileModelSettingsStore, type CommandCodeCatalogModel, type CommandCodePreferenceStore } from './token-store.ts';
|
|
4
|
+
import { getCachedCatalog } from './client.ts';
|
|
5
|
+
import type { CommandCodeApiEnv, CommandCodeWebStatus } from '../../shared/command-code-contracts.ts';
|
|
6
|
+
/**
|
|
7
|
+
* The selection the card should show.
|
|
8
|
+
*
|
|
9
|
+
* A stored list that still equals the shipped default has never been edited, so
|
|
10
|
+
* it cannot know about models the live catalog has since added; treating it as
|
|
11
|
+
* "everything currently offered" keeps a first run from hiding the whole
|
|
12
|
+
* catalog behind an unedited default. Any explicit edit is honoured exactly.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveEnabledModelIds(stored: readonly string[], catalog: readonly CommandCodeCatalogModel[]): string[];
|
|
15
|
+
export interface CommandCodeStatusOptions {
|
|
16
|
+
fetchFn?: typeof fetch;
|
|
17
|
+
/** Whether this plugin currently owns the provider route; re-read on every status. */
|
|
18
|
+
serving?: boolean | (() => boolean);
|
|
19
|
+
/** Diagnostic when another plugin owns the provider route; re-read on every status. */
|
|
20
|
+
conflict?: string | null | (() => string | null);
|
|
21
|
+
}
|
|
22
|
+
/** Everything the settings card renders: account, quota, and the model catalog. */
|
|
23
|
+
export declare function getCommandCodeWebStatus(store: FileCredentialStore, modelSettings: FileModelSettingsStore, preferences?: CommandCodePreferenceStore, options?: CommandCodeStatusOptions): Promise<CommandCodeWebStatus>;
|
|
24
|
+
/** Register the Command Code settings routes under `/command-code/api`. */
|
|
25
|
+
export declare function registerCommandCodeRoutes(ctx: Context, store: FileCredentialStore, modelSettings: FileModelSettingsStore, preferences?: CommandCodePreferenceStore, options?: CommandCodeStatusOptions): () => void;
|
|
26
|
+
export { PROVIDER_ID, PROVIDER_NAME, type CommandCodeApiEnv, getCachedCatalog };
|
|
27
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../../src/host/command-code/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,EAAmB,WAAW,EAAE,aAAa,EAAqC,MAAM,YAAY,CAAA;AAC3G,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,KAAK,uBAAuB,EAE5B,KAAK,0BAA0B,EAChC,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAKL,gBAAgB,EAMjB,MAAM,aAAa,CAAA;AAGpB,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAA;AAkErG;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,OAAO,EAAE,SAAS,uBAAuB,EAAE,GAC1C,MAAM,EAAE,CAYV;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,OAAO,KAAK,CAAA;IACtB,sFAAsF;IACtF,OAAO,CAAC,EAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,CAAA;IACnC,uFAAuF;IACvF,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAA;CACjD;AAMD,mFAAmF;AACnF,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,mBAAmB,EAC1B,aAAa,EAAE,sBAAsB,EACrC,WAAW,CAAC,EAAE,0BAA0B,EACxC,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,oBAAoB,CAAC,CAqC/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,GACrC,MAAM,IAAI,CAuIZ;AAED,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { SettingsProvider } from '@deepseek-ai/dsh-settings';
|
|
2
|
+
import type { CommandCodeApiEnv, CommandCodeReasoningEffort } from '../../shared/command-code-contracts.ts';
|
|
3
|
+
import type { CredentialStore } from '../token-store.ts';
|
|
4
|
+
export declare const COMMAND_CODE_PREFERENCES_NAMESPACE = "dsh-command-code";
|
|
5
|
+
export type { CommandCodeReasoningEffort };
|
|
6
|
+
/**
|
|
7
|
+
* One stored Command Code credential.
|
|
8
|
+
*
|
|
9
|
+
* The provider API authenticates with a bearer API key rather than the rotating
|
|
10
|
+
* OAuth pair the other routes in this plugin store, so there is no refresh
|
|
11
|
+
* token and nothing expires. The browser sign-in returns the same key a user
|
|
12
|
+
* can paste by hand, which is why both paths converge on this shape.
|
|
13
|
+
*/
|
|
14
|
+
export interface CommandCodeCredentials {
|
|
15
|
+
/** Bearer key issued by Command Code Studio. Host-only; never sent to a browser. */
|
|
16
|
+
apiKey: string;
|
|
17
|
+
userId?: string;
|
|
18
|
+
userName?: string;
|
|
19
|
+
email?: string;
|
|
20
|
+
keyName?: string;
|
|
21
|
+
organizationName?: string;
|
|
22
|
+
planLabel?: string;
|
|
23
|
+
planId?: string;
|
|
24
|
+
/** Unix milliseconds the key was obtained. */
|
|
25
|
+
authenticatedAt?: number;
|
|
26
|
+
/** Which API deployment the key belongs to. */
|
|
27
|
+
apiEnv?: CommandCodeApiEnv;
|
|
28
|
+
}
|
|
29
|
+
export interface CommandCodeCatalogModel {
|
|
30
|
+
id: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
contextWindow?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface CommandCodeModelSettings {
|
|
35
|
+
enabledModelIds: string[];
|
|
36
|
+
catalogModels: CommandCodeCatalogModel[];
|
|
37
|
+
contextWindowOverrides: Record<string, number>;
|
|
38
|
+
defaultReasoningEffort: CommandCodeReasoningEffort | null;
|
|
39
|
+
}
|
|
40
|
+
export interface CommandCodePreferenceStore {
|
|
41
|
+
status(): CommandCodeModelSettings;
|
|
42
|
+
update(patch: {
|
|
43
|
+
enabledModelIds?: string[];
|
|
44
|
+
contextWindowOverrides?: Record<string, number>;
|
|
45
|
+
defaultReasoningEffort?: CommandCodeReasoningEffort | null;
|
|
46
|
+
}): Promise<CommandCodeModelSettings>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Bind the model selection to the DSH settings document, which is what the
|
|
50
|
+
* settings service can persist durably; the JSON file beside it remains the
|
|
51
|
+
* store used when the plugin runs without a settings provider (headless tests).
|
|
52
|
+
*/
|
|
53
|
+
export declare function registerCommandCodePreferenceStore(settings?: SettingsProvider, fallbackStore?: FileModelSettingsStore): CommandCodePreferenceStore;
|
|
54
|
+
export declare function credentialPath(): string;
|
|
55
|
+
export declare function modelSettingsPath(): string;
|
|
56
|
+
export declare function parseCommandCodeCredentials(value: unknown): CommandCodeCredentials;
|
|
57
|
+
/** Encrypted credential store; the plaintext JSON is only a migration source. */
|
|
58
|
+
export declare class FileCredentialStore {
|
|
59
|
+
private readonly filePath;
|
|
60
|
+
private readonly backend;
|
|
61
|
+
constructor(filePath?: string, backend?: CredentialStore<CommandCodeCredentials>);
|
|
62
|
+
path(): string;
|
|
63
|
+
private serialize;
|
|
64
|
+
private removeLegacy;
|
|
65
|
+
private saveVerified;
|
|
66
|
+
read(): Promise<CommandCodeCredentials | null>;
|
|
67
|
+
write(credentials: CommandCodeCredentials): Promise<void>;
|
|
68
|
+
delete(): Promise<void>;
|
|
69
|
+
}
|
|
70
|
+
/** Plain-JSON model settings used when the settings service is unavailable. */
|
|
71
|
+
export declare class FileModelSettingsStore {
|
|
72
|
+
private readonly filePath;
|
|
73
|
+
constructor(filePath?: string);
|
|
74
|
+
path(): string;
|
|
75
|
+
read(): Promise<CommandCodeModelSettings>;
|
|
76
|
+
write(settings: CommandCodeModelSettings): Promise<void>;
|
|
77
|
+
updateSettings(patch: {
|
|
78
|
+
enabledModelIds?: string[];
|
|
79
|
+
contextWindowOverrides?: Record<string, number>;
|
|
80
|
+
defaultReasoningEffort?: CommandCodeReasoningEffort | null;
|
|
81
|
+
}): Promise<CommandCodeModelSettings>;
|
|
82
|
+
setCatalogModels(catalogModels: CommandCodeCatalogModel[], options?: {
|
|
83
|
+
enabledModelIds?: string[];
|
|
84
|
+
}): Promise<CommandCodeModelSettings>;
|
|
85
|
+
}
|
|
86
|
+
/** Environment the credential was last used against; defaults to the current one. */
|
|
87
|
+
export declare function credentialApiEnv(credentials: CommandCodeCredentials | null): CommandCodeApiEnv;
|
|
88
|
+
//# sourceMappingURL=token-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|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