dsh-opencode-go 0.2.0 → 0.2.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/README.en.md +20 -18
- package/README.md +26 -18
- package/THIRD_PARTY_NOTICES.md +5 -1
- package/docs/advanced.en.md +17 -13
- package/docs/advanced.md +18 -13
- package/docs/assets/usage-history-desktop.jpg +0 -0
- package/docs/assets/usage-history-mobile.jpg +0 -0
- package/docs/assets/usage-history-models.jpg +0 -0
- package/docs/development.md +23 -9
- package/docs/usage-analytics.en.md +34 -85
- package/docs/usage-analytics.md +34 -85
- package/docs/verification.md +50 -13
- package/lib/build-info.json +1 -1
- package/lib/client.js +2111 -2257
- package/lib/free-http-worker.js +32 -0
- package/lib/index.js +3078 -1899
- package/lib/types/accounts.d.ts +2 -2
- package/lib/types/adapter.d.ts +24 -9
- package/lib/types/analytics.d.ts +22 -332
- package/lib/types/catalog.d.ts +35 -76
- package/lib/types/client/AnalyticsDialog.d.ts +11 -18
- package/lib/types/client/Section.d.ts +3 -13
- package/lib/types/client/UsagePill.d.ts +10 -3
- package/lib/types/client/controller.d.ts +10 -8
- package/lib/types/client/dashboard-copy.d.ts +58 -0
- package/lib/types/client/index.d.ts +9 -0
- package/lib/types/client/presentation.d.ts +36 -72
- package/lib/types/config.d.ts +5 -1
- package/lib/types/contracts.d.ts +80 -25
- package/lib/types/conversion.d.ts +10 -2
- package/lib/types/free-channel.d.ts +21 -0
- package/lib/types/free-http-worker.d.ts +1 -0
- package/lib/types/free-policy.d.ts +4 -0
- package/lib/types/free-protocol.d.ts +16 -0
- package/lib/types/free-runtime.d.ts +2 -0
- package/lib/types/free-socks-tunnel.d.ts +4 -0
- package/lib/types/free-transport.d.ts +19 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/pricing.d.ts +29 -0
- package/lib/types/sdk-types.d.ts +1577 -2890
- package/lib/types/transport.d.ts +13 -5
- package/lib/vendor-licenses.txt +79 -55
- package/package.json +4 -4
- package/docs/assets/usage-panel.png +0 -0
package/lib/types/config.d.ts
CHANGED
|
@@ -13,6 +13,10 @@ export declare const DEFAULT_REQUEST_PREPARATION_TIMEOUT_MS = 60000;
|
|
|
13
13
|
export declare const DEFAULT_REQUEST_TIMEOUT_MS: number;
|
|
14
14
|
/** Plain configuration values used by validation and direct adapter consumers. */
|
|
15
15
|
export declare const PlainConfig: z<OpencodeGoConfig>;
|
|
16
|
+
/** Derive defaults from the same schema used by persisted profile settings. */
|
|
17
|
+
export declare const DEFAULT_CONFIG: Readonly<OpencodeGoConfig>;
|
|
18
|
+
/** Fill omitted profile fields and normalize the legacy official gateway. */
|
|
19
|
+
export declare function normalizeConfig(value?: Partial<OpencodeGoConfig>): OpencodeGoConfig;
|
|
16
20
|
/** The Loader retains these references when profile fields change. */
|
|
17
21
|
export type LiveConfig = {
|
|
18
22
|
[K in keyof OpencodeGoConfig]-?: {
|
|
@@ -29,7 +33,7 @@ export declare function readConfig(config: LiveConfig): OpencodeGoConfig;
|
|
|
29
33
|
* @param raw - the configured base URL.
|
|
30
34
|
* @returns the current gateway base URL without trailing slashes.
|
|
31
35
|
*/
|
|
32
|
-
export declare function assertBaseURL(raw: string): string;
|
|
36
|
+
export declare function assertBaseURL(raw: string, field?: 'baseURL' | 'freeBaseURL'): string;
|
|
33
37
|
/**
|
|
34
38
|
* Reject a selected credential reference that is not a bare environment
|
|
35
39
|
* variable name. The schema pattern above fails the composition layer and the
|
package/lib/types/contracts.d.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
/** Browser-safe configuration, account metadata and RPC wire contracts. */
|
|
2
2
|
import type { RemoteResult, TypertRemoteContribution } from '@deepseek-ai/dsh-typert-protocol';
|
|
3
|
-
import type { AnalyticsFailureReason, AnalyticsQuery, AnalyticsReport } from './analytics.ts';
|
|
4
3
|
/** Public DSH route and the private SDK transport have separate identities. */
|
|
5
4
|
export declare const PROVIDER_ID = "dsh-opencode-go";
|
|
6
5
|
export declare const DISPLAY_NAME = "DSH OpenCode Go";
|
|
6
|
+
export declare const FREE_PROVIDER_ID = "dsh-opencode-free";
|
|
7
|
+
export declare const FREE_DISPLAY_NAME = "DSH OpenCode Free";
|
|
8
|
+
export type ModelSource = 'go' | 'free';
|
|
9
|
+
/** Go keeps its legacy keys; Free owns a separate settings namespace. */
|
|
10
|
+
export declare function modelSettingsKey(model: {
|
|
11
|
+
id: string;
|
|
12
|
+
source?: ModelSource;
|
|
13
|
+
}): string;
|
|
7
14
|
export declare const SDK_PROVIDER_ID = "opencode-go";
|
|
8
15
|
/** Public Go discovery/usage base; inference uses the documented protocol-specific siblings. */
|
|
9
16
|
export declare const DEFAULT_BASE_URL = "https://opencode.ai/inference/go/v1";
|
|
17
|
+
export declare const DEFAULT_FREE_BASE_URL = "https://opencode.ai/inference/v1";
|
|
10
18
|
/**
|
|
11
19
|
* Migrate the legacy official address before any request is constructed.
|
|
12
20
|
*/
|
|
@@ -17,6 +25,9 @@ export declare function assertProxyURL(raw: string | undefined): string;
|
|
|
17
25
|
export declare const USAGE_DISPLAY_MODES: readonly ["auto", "always", "off"];
|
|
18
26
|
export type UsageDisplayMode = typeof USAGE_DISPLAY_MODES[number];
|
|
19
27
|
export declare const DEFAULT_USAGE_DISPLAY: UsageDisplayMode;
|
|
28
|
+
export declare const USAGE_PILL_STYLES: readonly ["badge", "plain"];
|
|
29
|
+
export type UsagePillStyle = typeof USAGE_PILL_STYLES[number];
|
|
30
|
+
export declare const DEFAULT_USAGE_PILL_STYLE: UsagePillStyle;
|
|
20
31
|
/** Client-safe account metadata. Secrets stay in the host credential service. */
|
|
21
32
|
export type GoAccount = {
|
|
22
33
|
id: string;
|
|
@@ -67,19 +78,19 @@ export type OpencodeGoModelLimits = Record<string, OpencodeGoModelLimit | null>;
|
|
|
67
78
|
/** Runtime configuration for one plugin mount. */
|
|
68
79
|
export interface OpencodeGoConfig {
|
|
69
80
|
/**
|
|
70
|
-
* Whether this
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* it back on. Independent of the credential: a key present while this is
|
|
74
|
-
* false registers nothing.
|
|
81
|
+
* Whether this plugin serves Go and Free. False withdraws both routes and
|
|
82
|
+
* their models without unloading the settings page. Go additionally requires
|
|
83
|
+
* a usable configured key; Free supports public access.
|
|
75
84
|
*/
|
|
76
85
|
enabled: boolean;
|
|
77
|
-
/** Usage pill visibility; auto follows
|
|
86
|
+
/** Usage pill visibility; auto follows only the selected Go route. */
|
|
78
87
|
usageDisplay: UsageDisplayMode;
|
|
88
|
+
/** Show quota in the sidebar independently of the selected conversation model. */
|
|
89
|
+
showSidebarQuota: boolean;
|
|
90
|
+
/** Appearance of the conversation input's quota trigger. */
|
|
91
|
+
usagePillStyle: UsagePillStyle;
|
|
79
92
|
/** Per-model picker switches; absent entries default to enabled unless deprecated. */
|
|
80
93
|
modelVisibility?: Record<string, boolean>;
|
|
81
|
-
/** Experimental opt-in routing; omitted/null entries follow the catalog. */
|
|
82
|
-
protocolOverrides?: GoProtocolOverrides;
|
|
83
94
|
/** Legacy credential reference, kept in sync with the first/current account. */
|
|
84
95
|
apiKeyEnv: string;
|
|
85
96
|
/** The first account is current; subsequent accounts are tried in order. */
|
|
@@ -88,6 +99,8 @@ export interface OpencodeGoConfig {
|
|
|
88
99
|
autoSwitch?: boolean;
|
|
89
100
|
/** Discovery/usage base; the official Go gateway selects inference endpoints by protocol. */
|
|
90
101
|
baseURL: string;
|
|
102
|
+
/** Platform discovery base; only explicitly free chat models are served. */
|
|
103
|
+
freeBaseURL: string;
|
|
91
104
|
/** Optional HTTP(S) or SOCKS5 proxy; blank uses the default network transport. */
|
|
92
105
|
proxyURL: string;
|
|
93
106
|
/** Request/picker cache lifetime in minutes; explicit discovery bypasses it. */
|
|
@@ -111,13 +124,9 @@ export interface OpencodeGoConfig {
|
|
|
111
124
|
}
|
|
112
125
|
/** Settings snapshots may omit fields inherited from their base layer. */
|
|
113
126
|
export type OpencodeGoSettings = Partial<OpencodeGoConfig>;
|
|
114
|
-
/** The supported experimental override surface, shared with the settings UI. */
|
|
115
|
-
export declare const RESPONSES_OVERRIDE_MODEL = "deepseek-v4.1-flash";
|
|
116
|
-
export type GoProtocolOverrides = Partial<Record<typeof RESPONSES_OVERRIDE_MODEL, 'openai-responses' | null>>;
|
|
117
|
-
/** Null selects catalog routing even when a lower settings layer overrides it. */
|
|
118
|
-
export declare function assertProtocolOverrides(value: unknown): asserts value is GoProtocolOverrides | undefined;
|
|
119
127
|
export interface GoModel {
|
|
120
128
|
id: string;
|
|
129
|
+
source?: ModelSource;
|
|
121
130
|
name?: string;
|
|
122
131
|
contextWindow?: number;
|
|
123
132
|
maxTokens?: number;
|
|
@@ -125,7 +134,7 @@ export interface GoModel {
|
|
|
125
134
|
reasoningBudget?: ThinkingBudgetRange;
|
|
126
135
|
deprecated?: boolean;
|
|
127
136
|
releaseDate?: string;
|
|
128
|
-
/** Input modalities
|
|
137
|
+
/** Input modalities the gateway declares, in {@link INPUT_MODALITIES} order. */
|
|
129
138
|
inputModalities?: readonly InputModality[];
|
|
130
139
|
/** Advertised by the gateway but lacking a usable protocol and capability configuration. */
|
|
131
140
|
configurationMissing?: boolean;
|
|
@@ -135,14 +144,13 @@ export interface ThinkingBudgetRange {
|
|
|
135
144
|
max: number;
|
|
136
145
|
}
|
|
137
146
|
/**
|
|
138
|
-
* Input modalities this page can name
|
|
139
|
-
* an unknown token is dropped rather than rendered as an untranslatable chip.
|
|
147
|
+
* Input modalities this page can name; MIME types are normalized to these tokens.
|
|
140
148
|
*/
|
|
141
149
|
export declare const INPUT_MODALITIES: readonly ["text", "image", "audio", "video", "pdf"];
|
|
142
150
|
export type InputModality = typeof INPUT_MODALITIES[number];
|
|
143
151
|
/**
|
|
144
152
|
* Normalize one `modalities.input` array into display order.
|
|
145
|
-
* @param value - the raw declaration
|
|
153
|
+
* @param value - the raw gateway declaration or Host response.
|
|
146
154
|
* @returns the declared modalities in {@link INPUT_MODALITIES} order, or
|
|
147
155
|
* `undefined` when nothing recognizable was declared.
|
|
148
156
|
*/
|
|
@@ -160,12 +168,12 @@ export interface GoModelCatalog {
|
|
|
160
168
|
readonly error?: string;
|
|
161
169
|
/** Optional for clients reading an older Host response. Timestamps are Unix milliseconds. */
|
|
162
170
|
readonly sources?: {
|
|
163
|
-
readonly
|
|
164
|
-
readonly
|
|
171
|
+
readonly go: GoCatalogSourceStatus;
|
|
172
|
+
readonly free: GoCatalogSourceStatus;
|
|
165
173
|
};
|
|
166
174
|
}
|
|
167
175
|
/** Missing configuration cannot be enabled; configured models follow explicit switches or lifecycle defaults. */
|
|
168
|
-
export declare function isModelEnabled(model: Pick<GoModel, 'id' | 'deprecated' | 'configurationMissing'>, modelVisibility?: Readonly<Record<string, boolean>>): boolean;
|
|
176
|
+
export declare function isModelEnabled(model: Pick<GoModel, 'id' | 'source' | 'deprecated' | 'configurationMissing'>, modelVisibility?: Readonly<Record<string, boolean>>): boolean;
|
|
169
177
|
export declare function validReleaseDate(value: unknown): value is string;
|
|
170
178
|
/** Calendar dates are supplied without a timezone; compare UTC dates consistently. */
|
|
171
179
|
export declare function isNewModel(model: GoModel, now?: number): boolean;
|
|
@@ -250,26 +258,73 @@ declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
|
250
258
|
}
|
|
251
259
|
export declare const accountsRemote: TypertRemoteContribution;
|
|
252
260
|
export type SettingsWriteResult = 'applied' | 'rejected' | 'unknown';
|
|
253
|
-
export type
|
|
261
|
+
export type AnalyticsRange = 'today' | '7d' | '30d' | '90d';
|
|
262
|
+
export interface AnalyticsQuery {
|
|
263
|
+
accountRef: string;
|
|
264
|
+
range: AnalyticsRange;
|
|
265
|
+
refresh?: boolean;
|
|
266
|
+
}
|
|
267
|
+
/** Exact nonnegative integers on the wire; one USD is 100,000,000 micro cents. */
|
|
268
|
+
export interface AnalyticsTotals {
|
|
269
|
+
requests: string;
|
|
270
|
+
inputTokens: string;
|
|
271
|
+
outputTokens: string;
|
|
272
|
+
cacheReadTokens: string;
|
|
273
|
+
cacheWrite5mTokens: string;
|
|
274
|
+
cacheWrite1hTokens: string;
|
|
275
|
+
cacheWriteTokens: string;
|
|
276
|
+
tokens: string;
|
|
277
|
+
costMicroCents: string;
|
|
278
|
+
}
|
|
279
|
+
export interface AnalyticsModelRow extends AnalyticsTotals {
|
|
280
|
+
provider: string;
|
|
281
|
+
model: string;
|
|
282
|
+
}
|
|
283
|
+
export interface AnalyticsDayRow extends AnalyticsTotals {
|
|
284
|
+
day: string;
|
|
285
|
+
}
|
|
286
|
+
export interface AnalyticsReport {
|
|
287
|
+
accountRef: string;
|
|
288
|
+
/** Opaque account, credential and network identity; contains no credential material. */
|
|
289
|
+
source: string;
|
|
290
|
+
generatedAt: number;
|
|
291
|
+
period: AnalyticsRange;
|
|
292
|
+
range: {
|
|
293
|
+
from: number;
|
|
294
|
+
to: number;
|
|
295
|
+
};
|
|
296
|
+
timeZone: 'UTC';
|
|
297
|
+
totals: AnalyticsTotals;
|
|
298
|
+
byModel: AnalyticsModelRow[];
|
|
299
|
+
byDay: AnalyticsDayRow[];
|
|
300
|
+
}
|
|
301
|
+
export interface AnalyticsExport {
|
|
302
|
+
filename: string;
|
|
303
|
+
csv: string;
|
|
304
|
+
}
|
|
305
|
+
export type AnalyticsFailureReason = 'invalid-query' | 'unknown-account' | 'missing-credential' | 'credential-unavailable' | 'unsupported-gateway' | 'invalid-proxy' | 'permission-denied' | 'upstream' | 'network' | 'timeout' | 'invalid-response';
|
|
254
306
|
/**
|
|
255
|
-
* Validate one
|
|
256
|
-
* optional knobs without breaking an older Host.
|
|
307
|
+
* Validate one account-scoped official history query.
|
|
257
308
|
* @param value - raw RPC argument.
|
|
258
309
|
* @returns the validated query.
|
|
259
310
|
*/
|
|
260
311
|
export declare function parseAnalyticsQuery(value: unknown): AnalyticsQuery;
|
|
261
|
-
/**
|
|
312
|
+
/** Keep the browser wire response limited to validated aggregate fields. */
|
|
262
313
|
export declare function parseAnalyticsReport(value: unknown): AnalyticsReport;
|
|
314
|
+
export declare function parseAnalyticsExport(value: unknown): AnalyticsExport;
|
|
263
315
|
declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
264
316
|
interface RemoteErrorDetailsMap {
|
|
265
317
|
'opencode-go/analytics-unavailable': {
|
|
266
318
|
readonly reason: AnalyticsFailureReason;
|
|
267
319
|
readonly retryable: boolean;
|
|
320
|
+
readonly retainPrevious?: boolean;
|
|
321
|
+
readonly source?: string;
|
|
268
322
|
};
|
|
269
323
|
}
|
|
270
324
|
interface TypertRemoteNamespaceMap {
|
|
271
325
|
opencodeGoAnalytics: {
|
|
272
326
|
read(query: AnalyticsQuery, signal?: AbortSignal): Promise<RemoteResult<AnalyticsReport>>;
|
|
327
|
+
exportCsv(query: AnalyticsQuery, signal?: AbortSignal): Promise<RemoteResult<AnalyticsExport>>;
|
|
273
328
|
};
|
|
274
329
|
}
|
|
275
330
|
}
|
|
@@ -31,7 +31,13 @@ export interface PiAiReplayResponse {
|
|
|
31
31
|
/** Provider-native effort for historical replay; absence is preserved. */
|
|
32
32
|
providerThinkingLevel?: string;
|
|
33
33
|
stopReason: AssistantMessage['stopReason'];
|
|
34
|
+
/** Measured context footprint for the next turn's SDK output-token clamp. */
|
|
35
|
+
usage?: Pick<PiUsage, 'input' | 'output' | 'cacheRead' | 'cacheWrite' | 'totalTokens'>;
|
|
36
|
+
/** Fingerprint of the request prefix and this reply that the usage measured. */
|
|
37
|
+
usageContext?: string;
|
|
34
38
|
}
|
|
39
|
+
/** Capture one converted request before the SDK can mutate it while streaming. */
|
|
40
|
+
export declare function piContextUsageKey(context: PiContext, provider: string, model: string): string;
|
|
35
41
|
/**
|
|
36
42
|
* Project a successful pi-ai response into the minimal durable replay state.
|
|
37
43
|
* The per-block half is index-aligned with the streamed blocks (pi-ai content
|
|
@@ -40,9 +46,10 @@ export interface PiAiReplayResponse {
|
|
|
40
46
|
* @param message - completed native pi-ai assistant response.
|
|
41
47
|
* @param requestedModel - request identity stored in the assistant source; defaults to the native model.
|
|
42
48
|
* @param requestedProvider - DSH route stored in the assistant source; defaults to the native provider.
|
|
49
|
+
* @param usageContext - fingerprint of the request that produced this response.
|
|
43
50
|
* @returns the versioned lossless-JSON replay projection.
|
|
44
51
|
*/
|
|
45
|
-
export declare function toPiReplayState(message: AssistantMessage, requestedModel?: string, requestedProvider?: string): ReplayEnvelope;
|
|
52
|
+
export declare function toPiReplayState(message: AssistantMessage, requestedModel?: string, requestedProvider?: string, usageContext?: string): ReplayEnvelope;
|
|
46
53
|
/**
|
|
47
54
|
* Convert one durable Harness assistant message into pi-ai history.
|
|
48
55
|
*
|
|
@@ -139,9 +146,10 @@ export declare function mapStopReason(message: AssistantMessage, contextWindow?:
|
|
|
139
146
|
* @param requestedModel - request model identity recorded for durable replay.
|
|
140
147
|
* @param requestedProvider - DSH provider identity recorded for durable replay.
|
|
141
148
|
* @param reservedMaxTokens - requested output allowance before SDK context clamping.
|
|
149
|
+
* @param usageContext - fingerprint of the request whose usage may budget a later turn.
|
|
142
150
|
* @returns the harness chunks, ending with measured `usage` then `finish`;
|
|
143
151
|
* failures with no measured tokens omit usage to preserve context pressure. Throws
|
|
144
152
|
* `LlmError` (`STREAM_CLOSED`) if the source ends without a terminal event.
|
|
145
153
|
*/
|
|
146
|
-
export declare function toStreamChunks(events: AsyncIterable<AssistantMessageEvent>, contextWindow?: number, callerSignal?: AbortSignal, requestedModel?: string, requestedProvider?: string, reservedMaxTokens?: number): AsyncGenerator<StreamChunk>;
|
|
154
|
+
export declare function toStreamChunks(events: AsyncIterable<AssistantMessageEvent>, contextWindow?: number, callerSignal?: AbortSignal, requestedModel?: string, requestedProvider?: string, reservedMaxTokens?: number, usageContext?: string): AsyncGenerator<StreamChunk>;
|
|
147
155
|
export { DEFAULT_MAX_REQUEST_IMAGE_BYTES, DEFAULT_REQUEST_IMAGE_MAX_BYTES, DEFAULT_REQUEST_IMAGE_PIXEL_BUDGET, } from './contracts.ts';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { OpencodeGoConfig } from './contracts.ts';
|
|
2
|
+
type Network = Pick<OpencodeGoConfig, 'freeBaseURL' | 'proxyURL'>;
|
|
3
|
+
export interface FreeAttemptTicket {
|
|
4
|
+
key: string;
|
|
5
|
+
sequence: number;
|
|
6
|
+
}
|
|
7
|
+
export interface FreeAttemptResult {
|
|
8
|
+
outcome: 'success' | 'error' | 'aborted';
|
|
9
|
+
code?: string;
|
|
10
|
+
retryAt?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare class FreeChannelState {
|
|
13
|
+
private readonly entries;
|
|
14
|
+
private sequence;
|
|
15
|
+
private key;
|
|
16
|
+
cooldownUntil(config: Network): number | undefined;
|
|
17
|
+
assertReady(config: Network): void;
|
|
18
|
+
begin(config: Network): FreeAttemptTicket;
|
|
19
|
+
finish(ticket: FreeAttemptTicket, result: FreeAttemptResult): void;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Free-specific error semantics; Go account classification remains unchanged. */
|
|
2
|
+
export declare function classifyFreeGatewayError(status: number, body: string): string | undefined;
|
|
3
|
+
/** Parse delta-seconds or HTTP-date, accounting for a server clock when supplied. */
|
|
4
|
+
export declare function retryAfterDeadline(value: string | null, now?: number, serverDate?: string | null): number | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Private stdin/stdout protocol; request credentials never enter argv or files. */
|
|
2
|
+
export interface FreeHttpRequest {
|
|
3
|
+
url: string;
|
|
4
|
+
method: string;
|
|
5
|
+
headers: [string, string][];
|
|
6
|
+
body?: string;
|
|
7
|
+
redirect: RequestRedirect;
|
|
8
|
+
proxy?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface FreeHttpResponse {
|
|
11
|
+
status: number;
|
|
12
|
+
statusText: string;
|
|
13
|
+
headers: [string, string][];
|
|
14
|
+
url: string;
|
|
15
|
+
redirected: boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const OPENCODE_FREE_USER_AGENT = "opencode/latest/2.2.5/cli";
|
|
2
|
+
export declare class FreeBunTransport {
|
|
3
|
+
private readonly options;
|
|
4
|
+
private readonly shutdown;
|
|
5
|
+
private readonly workers;
|
|
6
|
+
private readonly requests;
|
|
7
|
+
private readonly waiters;
|
|
8
|
+
private active;
|
|
9
|
+
constructor(options?: {
|
|
10
|
+
executable?: () => string;
|
|
11
|
+
workerPath?: () => string;
|
|
12
|
+
maxConcurrent?: number;
|
|
13
|
+
});
|
|
14
|
+
forProxy(raw?: string): typeof globalThis.fetch;
|
|
15
|
+
private acquire;
|
|
16
|
+
private fetchRequest;
|
|
17
|
+
private response;
|
|
18
|
+
dispose(): Promise<void>;
|
|
19
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare module '@deepseek-ai/cordis' {
|
|
|
7
7
|
}
|
|
8
8
|
export { OpencodeGoAdapter } from './adapter.ts';
|
|
9
9
|
export type { OpencodeGoAdapterOptions, OpencodeGoImageAccess, GoAccountSettlement } from './adapter.ts';
|
|
10
|
-
export { DEFAULT_BASE_URL, DISPLAY_NAME, PROVIDER_ID, OpencodeGoCatalog, discoverCatalogModels, readLiveModelIds, } from './catalog.ts';
|
|
10
|
+
export { DEFAULT_BASE_URL, DEFAULT_FREE_BASE_URL, DISPLAY_NAME, PROVIDER_ID, FREE_DISPLAY_NAME, FREE_PROVIDER_ID, OpencodeGoCatalog, discoverCatalogModels, readLiveModelIds, } from './catalog.ts';
|
|
11
11
|
export { Config, PlainConfig, assertBaseURL } from './config.ts';
|
|
12
12
|
export { assertProxyURL } from './contracts.ts';
|
|
13
13
|
export type { OpencodeGoConfig } from './config.ts';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Strict gateway tariff validation for model discovery and Free eligibility. */
|
|
2
|
+
import type { ModelCost } from './sdk-types.ts';
|
|
3
|
+
type Comparison<T> = {
|
|
4
|
+
in?: T[];
|
|
5
|
+
eq?: T;
|
|
6
|
+
gt?: T;
|
|
7
|
+
gte?: T;
|
|
8
|
+
lt?: T;
|
|
9
|
+
lte?: T;
|
|
10
|
+
};
|
|
11
|
+
export interface PricingCondition {
|
|
12
|
+
all?: PricingCondition[];
|
|
13
|
+
any?: PricingCondition[];
|
|
14
|
+
utc_days?: Comparison<string>;
|
|
15
|
+
utc_hours?: Comparison<string>;
|
|
16
|
+
date?: Comparison<string>;
|
|
17
|
+
}
|
|
18
|
+
export interface PriceMultiplier {
|
|
19
|
+
when: PricingCondition;
|
|
20
|
+
factor: number;
|
|
21
|
+
}
|
|
22
|
+
export interface ParsedCost {
|
|
23
|
+
cost: ModelCost;
|
|
24
|
+
multipliers?: PriceMultiplier[];
|
|
25
|
+
free: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Missing base prices or malformed optional components invalidate the entire tariff. */
|
|
28
|
+
export declare function readModelCost(value: unknown): ParsedCost | undefined;
|
|
29
|
+
export {};
|