@mars-sea/dsh-commandcode-provider 0.10.5 → 0.11.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 +47 -0
- package/README.md +8 -4
- package/README.zh-CN.md +6 -3
- package/lib/client.js +2336 -193
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +108 -7
- package/lib/index.js +2180 -715
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { Context } from "@deepseek-ai/cordis";
|
|
|
7
7
|
import { AttachmentStore } from "@deepseek-ai/dsh-attachment";
|
|
8
8
|
import { CommandDefinition } from "@deepseek-ai/dsh-commands";
|
|
9
9
|
//#region src/adapter.d.ts
|
|
10
|
-
declare const COMMAND_CODE_CLI_VERSION = "1.
|
|
10
|
+
declare const COMMAND_CODE_CLI_VERSION = "1.54.0";
|
|
11
11
|
declare const DEFAULT_API_BASE = "https://api.commandcode.ai";
|
|
12
12
|
declare const DEFAULT_GENERATE_MAX_TOKENS = 64000;
|
|
13
13
|
declare const DEFAULT_MAX_OUTPUT_TOKENS = 65536;
|
|
@@ -126,15 +126,36 @@ interface CommandCodeCredits {
|
|
|
126
126
|
monthlyCredits: number;
|
|
127
127
|
purchasedCredits: number;
|
|
128
128
|
freeCredits: number;
|
|
129
|
-
/**
|
|
130
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Whether the endpoint actually published a monthly balance. The scalar
|
|
131
|
+
* above defaults to 0 for shape stability, which is a LIE about an omitted
|
|
132
|
+
* field — and a false "0 left, fully consumed" on the dashboard. Consumers
|
|
133
|
+
* that render the figure must check this first: an explicit `false` means
|
|
134
|
+
* "not reported", not "nothing left".
|
|
135
|
+
*
|
|
136
|
+
* Optional on purpose. `undefined` means the flag itself was never recorded —
|
|
137
|
+
* an older Host half, or a frame from before this field existed — and is read
|
|
138
|
+
* as "assume reported", which is the behavior that shipped. Only an explicit
|
|
139
|
+
* `false` from a Host that knows the balance was omitted suppresses the
|
|
140
|
+
* figure, so a cross-version pair does not lose a real balance.
|
|
141
|
+
*/
|
|
142
|
+
monthlyReported?: boolean;
|
|
143
|
+
purchasedReported?: boolean;
|
|
144
|
+
freeReported?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Five-hour rolling window limits, absent when the endpoint reported no such
|
|
147
|
+
* window. Absence is NOT "a window with no cap": a reported window with
|
|
148
|
+
* `cap === 0` is uncapped spend, while an absent one was never reported at
|
|
149
|
+
* all, and only the un-reported case must keep a figure off the dashboard.
|
|
150
|
+
*/
|
|
151
|
+
fiveHour?: {
|
|
131
152
|
used: number;
|
|
132
153
|
cap: number;
|
|
133
154
|
exceeded: boolean;
|
|
134
155
|
resetAt: number;
|
|
135
156
|
};
|
|
136
|
-
/** Weekly window limits. */
|
|
137
|
-
weekly
|
|
157
|
+
/** Weekly window limits; absent under the same rule as {@link fiveHour}. */
|
|
158
|
+
weekly?: {
|
|
138
159
|
used: number;
|
|
139
160
|
cap: number;
|
|
140
161
|
exceeded: boolean;
|
|
@@ -670,8 +691,11 @@ declare const KNOWN_DEALS: Readonly<Record<string, KnownDeal>>;
|
|
|
670
691
|
* weekday, full price) **Monday to Friday only**; the other 17 hours of a
|
|
671
692
|
* weekday and every hour of Saturday/Sunday (UTC) are off-peak at half price.
|
|
672
693
|
* The V4 Flash Vision (exp) variant (command-code@1.32.0) shares the V4 Flash
|
|
673
|
-
*
|
|
674
|
-
*
|
|
694
|
+
* rates exactly — $0.15/$0.60 off-peak and $0.30/$1.20 peak, per the page's own
|
|
695
|
+
* `timeOfDay` block, not merely 2× its own off-peak figures: a rate that is
|
|
696
|
+
* internally consistent can still be the wrong row, which is why the vendored
|
|
697
|
+
* price table (`./model-prices.ts`) is synced from the page and not hand-kept.
|
|
698
|
+
* The picker shows the
|
|
675
699
|
* *current* state as a compact
|
|
676
700
|
* label (`Peak`/`Half`) matching the English noun style of the other markers
|
|
677
701
|
* (`Image`, `FREE`), so a developer can tell at a glance whether calling the
|
|
@@ -790,6 +814,69 @@ interface CommandCodeCatalogModel {
|
|
|
790
814
|
interface CommandCodeCatalog {
|
|
791
815
|
models: CommandCodeCatalogModel[];
|
|
792
816
|
}
|
|
817
|
+
/**
|
|
818
|
+
* One model's per-token rates, in USD per 1,000,000 tokens — the unit the
|
|
819
|
+
* official pricing page publishes in.
|
|
820
|
+
*/
|
|
821
|
+
interface CommandCodeModelRates {
|
|
822
|
+
/** Uncached (billed) input tokens. */
|
|
823
|
+
inputCost: number;
|
|
824
|
+
/** Completion tokens. */
|
|
825
|
+
outputCost: number;
|
|
826
|
+
/** Input tokens served from the provider's cache. */
|
|
827
|
+
cacheReadCost: number;
|
|
828
|
+
/**
|
|
829
|
+
* Input tokens written into the provider's cache. Present for a minority of
|
|
830
|
+
* models — the page publishes no cache-write rate for the rest, whose
|
|
831
|
+
* cache-write tokens are therefore UNPRICED. Do not substitute a multiple of
|
|
832
|
+
* the input rate for a missing value.
|
|
833
|
+
*/
|
|
834
|
+
cacheWriteCost?: number;
|
|
835
|
+
}
|
|
836
|
+
/** One whole-request context band; maxContext is inclusive, absent on the last band. */
|
|
837
|
+
interface CommandCodeContextTier extends CommandCodeModelRates {
|
|
838
|
+
maxContext?: number;
|
|
839
|
+
}
|
|
840
|
+
/** One model's rates plus the peak-hour override for time-of-day models. */
|
|
841
|
+
interface CommandCodeModelPrice extends CommandCodeModelRates {
|
|
842
|
+
/**
|
|
843
|
+
* Lookup key: the catalog model id when a catalog model maps to this row,
|
|
844
|
+
* otherwise the pricing page's own slug. A session reports catalog ids, so
|
|
845
|
+
* this is the primary key the browser looks up by.
|
|
846
|
+
*/
|
|
847
|
+
id: string;
|
|
848
|
+
/** The pricing page's slug for this row — the secondary lookup key. */
|
|
849
|
+
slug: string;
|
|
850
|
+
/**
|
|
851
|
+
* Rates charged inside the peak windows. The row's own top-level rates are
|
|
852
|
+
* the off-peak rates, so a row WITH this block is time-of-day priced and a
|
|
853
|
+
* row without it is flat-priced.
|
|
854
|
+
*/
|
|
855
|
+
peak?: CommandCodeModelRates;
|
|
856
|
+
contextTiers?: CommandCodeContextTier[];
|
|
857
|
+
/**
|
|
858
|
+
* Whether the model costs nothing on every plan right now (a free deal or a
|
|
859
|
+
* `:free` catalog variant). Served explicitly at zero rates so a surface can
|
|
860
|
+
* say "free" rather than showing nothing.
|
|
861
|
+
*/
|
|
862
|
+
free?: boolean;
|
|
863
|
+
}
|
|
864
|
+
/** The price-table Remote result: every known model's rates. */
|
|
865
|
+
interface CommandCodePriceTable {
|
|
866
|
+
/**
|
|
867
|
+
* Every priced model, keyed by {@link CommandCodeModelPrice.id} (catalog id
|
|
868
|
+
* first, pricing slug as the fallback) and carrying its slug as a second
|
|
869
|
+
* lookup key. A model absent from this list has no known price and must
|
|
870
|
+
* render no cost at all rather than a guess.
|
|
871
|
+
*/
|
|
872
|
+
models: CommandCodeModelPrice[];
|
|
873
|
+
/**
|
|
874
|
+
* Peak-pricing windows as `[startHour, endHour)` in UTC, end-exclusive,
|
|
875
|
+
* applying Monday–Friday only. Shipped with the table so the browser prices
|
|
876
|
+
* against the Host snapshot's schedule instead of restating it.
|
|
877
|
+
*/
|
|
878
|
+
peakHours: Array<[number, number]>;
|
|
879
|
+
}
|
|
793
880
|
//#endregion
|
|
794
881
|
//#region src/command-locales.d.ts
|
|
795
882
|
/**
|
|
@@ -915,6 +1002,13 @@ interface CommandCodeUsageDeps<C extends CommandCodeConnectionOptions = CommandC
|
|
|
915
1002
|
* editors degrade to the empty state.
|
|
916
1003
|
*/
|
|
917
1004
|
listModels?: () => Promise<CommandCodeCatalog>;
|
|
1005
|
+
/**
|
|
1006
|
+
* Price-table source for the composer's session-cost figure. Defaults to the
|
|
1007
|
+
* vendored snapshot, so the endpoint can never silently serve an empty table
|
|
1008
|
+
* — an unpriced cost is the failure this feature is meant to remove. Override
|
|
1009
|
+
* only to stub it in a test.
|
|
1010
|
+
*/
|
|
1011
|
+
prices?: () => CommandCodePriceTable;
|
|
918
1012
|
/**
|
|
919
1013
|
* The browser-login flow (wired by the plugin entry). Absent means the
|
|
920
1014
|
* login endpoints answer `idle` / reject with a plain message — the page's
|
|
@@ -949,6 +1043,13 @@ declare class CommandCodeUsageService<C extends CommandCodeConnectionOptions = C
|
|
|
949
1043
|
* the live list instead of typed by hand.
|
|
950
1044
|
*/
|
|
951
1045
|
models(): Promise<CommandCodeCatalog>;
|
|
1046
|
+
/**
|
|
1047
|
+
* The model price table the composer prices an in-progress session with.
|
|
1048
|
+
* Static vendored data (the official pricing page's rates), served Host-side
|
|
1049
|
+
* so the browser bundle never carries a copy that could drift from the
|
|
1050
|
+
* snapshot, and so a price update reaches an open page without a rebuild.
|
|
1051
|
+
*/
|
|
1052
|
+
prices(): Promise<CommandCodePriceTable>;
|
|
952
1053
|
/**
|
|
953
1054
|
* Start (or rejoin) a browser-login attempt and return its fresh status —
|
|
954
1055
|
* `waiting` carrying the Studio URL. Rejects when the flow cannot start
|