dsh-opencode-go 0.1.24 → 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 +66 -12
- package/README.md +172 -79
- package/THIRD_PARTY_NOTICES.md +6 -2
- package/assets/icon.png +0 -0
- package/docs/advanced.en.md +32 -35
- package/docs/advanced.md +33 -35
- package/docs/assets/logo-dark.png +0 -0
- package/docs/assets/logo-light.png +0 -0
- 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 +61 -119
- package/docs/independent-package.md +4 -2
- package/docs/usage-analytics.en.md +57 -0
- package/docs/usage-analytics.md +57 -0
- package/docs/verification.md +51 -917
- package/lib/build-info.json +1 -1
- package/lib/client.js +3429 -2618
- package/lib/free-http-worker.js +32 -0
- package/lib/index.js +5135 -3746
- package/lib/types/accounts.d.ts +96 -31
- package/lib/types/adapter.d.ts +63 -51
- package/lib/types/analytics.d.ts +35 -0
- package/lib/types/catalog.d.ts +109 -44
- package/lib/types/client/AnalyticsDialog.d.ts +18 -0
- package/lib/types/client/Section.d.ts +41 -7
- package/lib/types/client/UsagePill.d.ts +15 -6
- package/lib/types/client/controller.d.ts +178 -0
- package/lib/types/client/dashboard-copy.d.ts +58 -0
- package/lib/types/client/index.d.ts +18 -12
- package/lib/types/client/{locales.d.ts → presentation.d.ts} +97 -9
- package/lib/types/config.d.ts +14 -15
- package/lib/types/contracts.d.ts +338 -0
- package/lib/types/conversion.d.ts +155 -0
- 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 +8 -40
- package/lib/types/pricing.d.ts +29 -0
- package/lib/types/sdk-types.d.ts +1540 -2902
- package/lib/types/transport.d.ts +71 -0
- package/lib/vendor-licenses.txt +55 -31
- package/package.json +77 -78
- package/docs/assets/usage-panel.png +0 -0
- package/docs/fork-review-2026-09-25.md +0 -191
- package/docs/native-call-comparison-v020-rc2.md +0 -116
- package/lib/types/account-manager.d.ts +0 -25
- package/lib/types/account-operations.d.ts +0 -31
- package/lib/types/account-policy.d.ts +0 -16
- package/lib/types/account-recovery.d.ts +0 -2
- package/lib/types/account-selection.d.ts +0 -30
- package/lib/types/account-service.d.ts +0 -12
- package/lib/types/accounts-contract.d.ts +0 -38
- package/lib/types/call-trace.d.ts +0 -54
- package/lib/types/catalog-manager.d.ts +0 -20
- package/lib/types/client/AccountsCard.d.ts +0 -19
- package/lib/types/client/ModelEditor.d.ts +0 -20
- package/lib/types/client/accounts-controller.d.ts +0 -71
- package/lib/types/client/hint-mark.d.ts +0 -17
- package/lib/types/client/host-compat.d.ts +0 -7
- package/lib/types/client/host-primitives.d.ts +0 -11
- package/lib/types/client/section-controller.d.ts +0 -202
- package/lib/types/client/settings.d.ts +0 -18
- package/lib/types/client/staged-form.d.ts +0 -201
- package/lib/types/client/usage.d.ts +0 -4
- package/lib/types/config-contract.d.ts +0 -70
- package/lib/types/conversion/config.d.ts +0 -4
- package/lib/types/conversion/context.d.ts +0 -56
- package/lib/types/conversion/image-offload.d.ts +0 -13
- package/lib/types/conversion/image-pool.d.ts +0 -24
- package/lib/types/conversion/index.d.ts +0 -5
- package/lib/types/conversion/replay.d.ts +0 -66
- package/lib/types/conversion/stream.d.ts +0 -44
- package/lib/types/gateway-diagnostics.d.ts +0 -23
- package/lib/types/gateway-error.d.ts +0 -2
- package/lib/types/gateway-url.d.ts +0 -6
- package/lib/types/google-fetch.d.ts +0 -6
- package/lib/types/host-settings.d.ts +0 -11
- package/lib/types/json-response.d.ts +0 -14
- package/lib/types/metadata-cache.d.ts +0 -12
- package/lib/types/model-metadata.d.ts +0 -21
- package/lib/types/models-contract.d.ts +0 -66
- package/lib/types/models.d.ts +0 -13
- package/lib/types/protocol-contract.d.ts +0 -5
- package/lib/types/protocol-policy.d.ts +0 -4
- package/lib/types/provider-identity.d.ts +0 -4
- package/lib/types/proxy-url.d.ts +0 -2
- package/lib/types/proxy.d.ts +0 -11
- package/lib/types/reasoning.d.ts +0 -40
- package/lib/types/remote-contract.d.ts +0 -3
- package/lib/types/remotes.d.ts +0 -3
- package/lib/types/request-budget.d.ts +0 -12
- package/lib/types/request-control.d.ts +0 -2
- package/lib/types/settings-bridge.d.ts +0 -22
- package/lib/types/usage-contract.d.ts +0 -35
- package/lib/types/usage-display.d.ts +0 -4
- package/lib/types/usage.d.ts +0 -27
- /package/lib/types/{google-generative-ai.d.ts → google.d.ts} +0 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol';
|
|
3
|
+
import { type SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
4
|
+
import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
5
|
+
import { type ModelSource, type OpencodeGoSettings, type OpencodeGoModelLimits, type GoAccount, type GoModel, type GoModelCatalog, type GoUsage, type AccountCommand, type SettingsWriteResult } from '../contracts.ts';
|
|
6
|
+
export type { OpencodeGoSettings, OpencodeGoModelLimit, OpencodeGoModelLimits } from '../contracts.ts';
|
|
7
|
+
export declare const OPENCODE_GO_NS = "llm-opencode-go";
|
|
8
|
+
export declare const TEXT_FIELDS: readonly ["usageDisplay", "usagePillStyle", "showSidebarQuota", "baseURL", "freeBaseURL", "proxyURL", "refreshMinutes", "streamIdleTimeoutMs", "maxImages", "maxRequestImageBytes", "requestImagePixelBudget", "requestImageMaxBytes"];
|
|
9
|
+
export type TextField = typeof TEXT_FIELDS[number];
|
|
10
|
+
export declare const editableKeys: readonly ["usageDisplay", "usagePillStyle", "showSidebarQuota", "baseURL", "freeBaseURL", "proxyURL", "refreshMinutes", "streamIdleTimeoutMs", "maxImages", "maxRequestImageBytes", "requestImagePixelBudget", "requestImageMaxBytes", "modelLimits"];
|
|
11
|
+
export type EditableField = typeof editableKeys[number];
|
|
12
|
+
export interface FieldState {
|
|
13
|
+
text: string;
|
|
14
|
+
overridden: boolean;
|
|
15
|
+
invalid: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface FormActions {
|
|
18
|
+
edit(field: TextField, text: string): void;
|
|
19
|
+
editModelLimits(value: OpencodeGoModelLimits): void;
|
|
20
|
+
resetField(field: EditableField): void;
|
|
21
|
+
save(): void;
|
|
22
|
+
discard(): void;
|
|
23
|
+
}
|
|
24
|
+
interface FormShell {
|
|
25
|
+
available: boolean;
|
|
26
|
+
writable: boolean;
|
|
27
|
+
dirty: boolean;
|
|
28
|
+
invalid: boolean;
|
|
29
|
+
saving: boolean;
|
|
30
|
+
failed: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** The gateway's model listing as the page reports it. */
|
|
33
|
+
export type OpencodeGoModels =
|
|
34
|
+
/** Not asked for yet; the page asks once it mounts. */
|
|
35
|
+
{
|
|
36
|
+
readonly status: 'idle';
|
|
37
|
+
}
|
|
38
|
+
/** A listing request is outstanding. */
|
|
39
|
+
| {
|
|
40
|
+
readonly status: 'loading';
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The gateway answered: a count/preview for the compact summary plus every
|
|
44
|
+
* discovered entry used by the capacity editor.
|
|
45
|
+
*/
|
|
46
|
+
| {
|
|
47
|
+
readonly status: 'ready';
|
|
48
|
+
readonly count: number;
|
|
49
|
+
readonly preview: readonly string[];
|
|
50
|
+
readonly entries: readonly GoModel[];
|
|
51
|
+
readonly stale?: boolean;
|
|
52
|
+
readonly message?: string;
|
|
53
|
+
readonly refreshing?: boolean;
|
|
54
|
+
readonly sources?: GoModelCatalog['sources'];
|
|
55
|
+
}
|
|
56
|
+
/** The listing could not be read; `message` is the Host's own diagnostic. */
|
|
57
|
+
| {
|
|
58
|
+
readonly status: 'failed';
|
|
59
|
+
readonly message?: string;
|
|
60
|
+
readonly sources?: GoModelCatalog['sources'];
|
|
61
|
+
};
|
|
62
|
+
/** A failure on one source must not hide the other source's usable models. */
|
|
63
|
+
export declare function modelsForSource(models: OpencodeGoModels, source: ModelSource): OpencodeGoModels;
|
|
64
|
+
export type ExecuteAccountCommand = (command: AccountCommand) => Promise<SettingsWriteResult>;
|
|
65
|
+
export interface GoAccountView extends GoAccount {
|
|
66
|
+
configured?: boolean;
|
|
67
|
+
writable?: boolean;
|
|
68
|
+
usage?: GoUsage;
|
|
69
|
+
updatedAt?: number;
|
|
70
|
+
stale?: boolean;
|
|
71
|
+
loading?: boolean;
|
|
72
|
+
failed?: boolean;
|
|
73
|
+
/** Why the last quota read failed, safe to show: it carries no credential value. */
|
|
74
|
+
problem?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface GoAccountsState {
|
|
77
|
+
entries: readonly GoAccountView[];
|
|
78
|
+
activeRef: string;
|
|
79
|
+
autoSwitch: boolean;
|
|
80
|
+
busy: boolean;
|
|
81
|
+
blocked: boolean;
|
|
82
|
+
refreshing: boolean;
|
|
83
|
+
failure?: 'write' | 'cleanup' | 'remove' | 'read';
|
|
84
|
+
}
|
|
85
|
+
export interface GoAccountsActions {
|
|
86
|
+
loadAccounts: () => void;
|
|
87
|
+
addAccount: (name: string, key: string) => Promise<boolean>;
|
|
88
|
+
/** A newly opened addition form owns a fresh ID; retries keep its existing ID. */
|
|
89
|
+
resetAddition?: () => void;
|
|
90
|
+
renameAccount: (ref: string, name: string) => Promise<boolean>;
|
|
91
|
+
removeAccount: (ref: string) => Promise<boolean>;
|
|
92
|
+
selectAccount: (ref: string) => Promise<boolean>;
|
|
93
|
+
setAutoSwitch: (next: boolean) => Promise<boolean>;
|
|
94
|
+
replaceAccountKey: (ref: string, key: string) => Promise<boolean>;
|
|
95
|
+
/** Move one account to a new position; the first row becomes the preferred account. */
|
|
96
|
+
moveAccount: (ref: string, toIndex: number) => Promise<boolean>;
|
|
97
|
+
}
|
|
98
|
+
export interface OpencodeGoSectionState extends FormShell {
|
|
99
|
+
accounts: GoAccountsState;
|
|
100
|
+
enabled: boolean;
|
|
101
|
+
usageDisplay: FieldState;
|
|
102
|
+
showSidebarQuota: FieldState;
|
|
103
|
+
usagePillStyle: FieldState;
|
|
104
|
+
modelVisibility: Readonly<Record<string, boolean>>;
|
|
105
|
+
pickerSaving: boolean;
|
|
106
|
+
pickerFailed: boolean;
|
|
107
|
+
baseURL: FieldState;
|
|
108
|
+
freeBaseURL: FieldState;
|
|
109
|
+
proxyURL: FieldState;
|
|
110
|
+
refreshMinutes: FieldState;
|
|
111
|
+
streamIdleTimeoutMs: FieldState;
|
|
112
|
+
maxImages: FieldState;
|
|
113
|
+
maxRequestImageBytes: FieldState;
|
|
114
|
+
requestImagePixelBudget: FieldState;
|
|
115
|
+
requestImageMaxBytes: FieldState;
|
|
116
|
+
models: OpencodeGoModels;
|
|
117
|
+
modelLimits: Omit<FieldState, 'text'>;
|
|
118
|
+
modelLimitDraft: OpencodeGoModelLimits;
|
|
119
|
+
}
|
|
120
|
+
export interface OpencodeGoSectionFace extends FormActions, GoAccountsActions {
|
|
121
|
+
hooks: {
|
|
122
|
+
opencodeGo: SnapshotStore<OpencodeGoSectionState>;
|
|
123
|
+
};
|
|
124
|
+
loadModels(): void;
|
|
125
|
+
setEnabled(next: boolean): void;
|
|
126
|
+
setModelEnabled(id: string, next: boolean): void;
|
|
127
|
+
}
|
|
128
|
+
/** One controller owns the page's typed drafts and immediate account operations. */
|
|
129
|
+
export declare class OpencodeGoSectionController {
|
|
130
|
+
private readonly scope;
|
|
131
|
+
private readonly ctx;
|
|
132
|
+
private readonly readModels;
|
|
133
|
+
private readonly readUsage;
|
|
134
|
+
private readonly executeAccountCommand;
|
|
135
|
+
private readonly drafts;
|
|
136
|
+
private readonly store;
|
|
137
|
+
private readonly unsubscribe;
|
|
138
|
+
private saving;
|
|
139
|
+
private failed;
|
|
140
|
+
private pickerSaving;
|
|
141
|
+
private pickerFailed;
|
|
142
|
+
private models;
|
|
143
|
+
private modelsRequest;
|
|
144
|
+
private face;
|
|
145
|
+
private accountRows;
|
|
146
|
+
private accountBusy;
|
|
147
|
+
private accountRefreshing;
|
|
148
|
+
private accountFailure;
|
|
149
|
+
private accountEpoch;
|
|
150
|
+
private accountsIdentity;
|
|
151
|
+
private accountsLoaded;
|
|
152
|
+
private disposed;
|
|
153
|
+
private addition;
|
|
154
|
+
constructor(scope: ConfigForm<OpencodeGoSettings>, ctx: ClientContext, readModels?: () => Promise<RemoteResult<GoModelCatalog>>, readUsage?: (ref: string) => Promise<GoUsage>, executeAccountCommand?: ExecuteAccountCommand);
|
|
155
|
+
dispose(): void;
|
|
156
|
+
private publish;
|
|
157
|
+
private blocked;
|
|
158
|
+
private stored;
|
|
159
|
+
private value;
|
|
160
|
+
private field;
|
|
161
|
+
private plan;
|
|
162
|
+
private projection;
|
|
163
|
+
private edit;
|
|
164
|
+
save(): Promise<void>;
|
|
165
|
+
setEnabled(next: boolean): Promise<void>;
|
|
166
|
+
setModelEnabled(id: string, next: boolean): Promise<void>;
|
|
167
|
+
private writePickerSetting;
|
|
168
|
+
inject(): OpencodeGoSectionFace;
|
|
169
|
+
loadModels(): void;
|
|
170
|
+
accountState(): GoAccountsState;
|
|
171
|
+
syncAccounts(): void;
|
|
172
|
+
refreshCredential(ref: string): void;
|
|
173
|
+
refreshAccounts(): Promise<void>;
|
|
174
|
+
/** Mark every account row as unreadable with the Host's own diagnostic. */
|
|
175
|
+
private markUnreadable;
|
|
176
|
+
accountActions(): GoAccountsActions;
|
|
177
|
+
private runAccountAction;
|
|
178
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** Copy local to workspace history, following the active host locale. */
|
|
2
|
+
export declare const historyEn: {
|
|
3
|
+
readonly account: "Viewing account";
|
|
4
|
+
readonly noAccounts: "Add an account to view workspace history.";
|
|
5
|
+
readonly scope: "All workspace clients · UTC calendar days";
|
|
6
|
+
readonly requests: "Requests";
|
|
7
|
+
readonly tokens: "Tokens";
|
|
8
|
+
readonly amount: "Usage amount";
|
|
9
|
+
readonly cacheHit: "Cache hit rate";
|
|
10
|
+
readonly input: "Input";
|
|
11
|
+
readonly output: "Output";
|
|
12
|
+
readonly cacheRead: "Cache read";
|
|
13
|
+
readonly cacheWrite: "Cache write";
|
|
14
|
+
readonly dailyAverage: "Daily average";
|
|
15
|
+
readonly models: "models";
|
|
16
|
+
readonly activeDays: "active days";
|
|
17
|
+
readonly trend: "Daily activity";
|
|
18
|
+
readonly trendHint: "Select a day to inspect its usage.";
|
|
19
|
+
readonly tokensMode: "Token breakdown";
|
|
20
|
+
readonly requestsMode: "Request count";
|
|
21
|
+
readonly chartHelp: "Arrow keys move between days. Click or tap to pin a day; Escape clears it.";
|
|
22
|
+
readonly selectDay: "Hover, focus or tap a bar for daily details.";
|
|
23
|
+
readonly ranking: "Model distribution";
|
|
24
|
+
readonly rankingHint: "Compare models across this workspace.";
|
|
25
|
+
readonly details: "Model details";
|
|
26
|
+
readonly model: "Model";
|
|
27
|
+
readonly share: "Token share";
|
|
28
|
+
readonly allModels: "Show all models";
|
|
29
|
+
readonly fewerModels: "Show fewer models";
|
|
30
|
+
readonly export: "Export CSV";
|
|
31
|
+
readonly exporting: "Exporting…";
|
|
32
|
+
readonly exportFailed: "Could not export this range. Please retry.";
|
|
33
|
+
readonly refresh: "Refresh history";
|
|
34
|
+
readonly refreshed: "Updated";
|
|
35
|
+
readonly refreshing: "Refreshing official history…";
|
|
36
|
+
readonly stale: "Refresh failed. Showing the last successful result for this account and range.";
|
|
37
|
+
readonly loading: "Loading official workspace history…";
|
|
38
|
+
readonly empty: "No recorded usage in this range.";
|
|
39
|
+
readonly failed: "Could not load workspace history.";
|
|
40
|
+
readonly retry: "Try again";
|
|
41
|
+
readonly permission: "This key cannot read history. Check its Usage read permission in OpenCode Console.";
|
|
42
|
+
readonly credentials: "The selected account has no usable key. Update it in account settings.";
|
|
43
|
+
readonly unsupported: "History is available for the official OpenCode gateway. This account uses another gateway.";
|
|
44
|
+
readonly pending: "OpenCode is still preparing daily summaries. Please try again shortly.";
|
|
45
|
+
readonly invalid: "OpenCode returned an unreadable history response. Please retry.";
|
|
46
|
+
readonly quota: "Current allowance";
|
|
47
|
+
readonly quotaUnavailable: "Allowance unavailable";
|
|
48
|
+
readonly rolling: "5 hours";
|
|
49
|
+
readonly weekly: "Weekly";
|
|
50
|
+
readonly monthly: "Monthly";
|
|
51
|
+
readonly resets: "Resets";
|
|
52
|
+
readonly amountHint: "Official usage amount is not a receipt or an extra charge for Go.";
|
|
53
|
+
readonly lagHint: "Daily summaries may lag recent requests. Anonymous Free usage may not appear.";
|
|
54
|
+
readonly exportHint: "CSV includes member and service-account fields supplied by Console.";
|
|
55
|
+
};
|
|
56
|
+
export type HistoryCopy = Record<keyof typeof historyEn, string>;
|
|
57
|
+
export declare const historyZh: HistoryCopy;
|
|
58
|
+
export declare function historyCopy(locale?: string): HistoryCopy;
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* listing, and the adapter knobs behind the page's advanced disclosure. The
|
|
6
|
-
* Host settings and credential contracts stay behind their existing wire APIs.
|
|
7
|
-
*/
|
|
8
|
-
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
9
|
-
import { en } from './locales.ts';
|
|
1
|
+
import type { Context as ClientContext, Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
3
|
+
import { type OpencodeGoSettings, type ExecuteAccountCommand } from './controller.ts';
|
|
4
|
+
import { en } from './presentation.ts';
|
|
10
5
|
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
6
|
+
interface SlotMap {
|
|
7
|
+
'sidebar.footer.action': {
|
|
8
|
+
kind: 'list';
|
|
9
|
+
scope: 'root';
|
|
10
|
+
owner: {
|
|
11
|
+
wide: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}
|
|
11
15
|
interface LocaleNamespaceMap {
|
|
12
16
|
/** The OpenCode Go settings page copy. */
|
|
13
17
|
'settings.opencode-go': keyof typeof en;
|
|
14
18
|
}
|
|
15
19
|
}
|
|
16
20
|
export type { OpencodeGoSectionProps } from './Section.tsx';
|
|
17
|
-
export type { OpencodeGoSectionState, OpencodeGoSettings } from './
|
|
18
|
-
export { OPENCODE_GO_NS } from './
|
|
19
|
-
export type { OpencodeGoKey } from './
|
|
21
|
+
export type { OpencodeGoSectionState, OpencodeGoSettings } from './controller.ts';
|
|
22
|
+
export { OPENCODE_GO_NS } from './controller.ts';
|
|
23
|
+
export type { OpencodeGoKey } from './presentation.ts';
|
|
20
24
|
/**
|
|
21
25
|
* Required services (cordis fiber inject). The target slot is declared by
|
|
22
26
|
* ui-settings' apply, whose activation order relative to this one is NOT
|
|
@@ -32,3 +36,5 @@ export declare const inject: string[];
|
|
|
32
36
|
* @param ctx - client root context.
|
|
33
37
|
*/
|
|
34
38
|
export declare function apply(ctx: ClientContext): void;
|
|
39
|
+
export declare function accountCommands(ctx: Context): ExecuteAccountCommand;
|
|
40
|
+
export declare function registerUsagePill(ctx: Context, settings: ConfigForm<OpencodeGoSettings>, selectAccount?: (ref: string) => Promise<boolean>): void;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** English and Chinese copy and the shared, Host-following presentation tokens. */
|
|
2
|
+
import { type CSSProperties } from 'react';
|
|
1
3
|
/** Copy dictionaries for the OpenCode Go settings page. English is the key-set source of truth. */
|
|
2
4
|
export declare const en: {
|
|
3
5
|
accountsTitle: string;
|
|
@@ -27,6 +29,8 @@ export declare const en: {
|
|
|
27
29
|
accountSwitchBack: string;
|
|
28
30
|
accountSwitchHint: string;
|
|
29
31
|
accountSwitchFailed: string;
|
|
32
|
+
sidebarNextAccount: string;
|
|
33
|
+
sidebarAnalytics: string;
|
|
30
34
|
accountFallbackQuota: string;
|
|
31
35
|
accountFallbackCredential: string;
|
|
32
36
|
accountsSummary: string;
|
|
@@ -58,7 +62,43 @@ export declare const en: {
|
|
|
58
62
|
usageRefreshFailed: string;
|
|
59
63
|
usageLastUpdated: string;
|
|
60
64
|
usageRetry: string;
|
|
65
|
+
usageRefresh: string;
|
|
61
66
|
usageRefreshing: string;
|
|
67
|
+
analyticsOpen: string;
|
|
68
|
+
analyticsTitle: string;
|
|
69
|
+
analyticsSubtitle: string;
|
|
70
|
+
analyticsClose: string;
|
|
71
|
+
analyticsRange: string;
|
|
72
|
+
analyticsRangeToday: string;
|
|
73
|
+
analyticsRange7d: string;
|
|
74
|
+
analyticsRange30d: string;
|
|
75
|
+
analyticsRange90d: string;
|
|
76
|
+
analyticsRefresh: string;
|
|
77
|
+
analyticsRetry: string;
|
|
78
|
+
analyticsLoading: string;
|
|
79
|
+
analyticsEmpty: string;
|
|
80
|
+
analyticsFailed: string;
|
|
81
|
+
analyticsRequests: string;
|
|
82
|
+
analyticsTokens: string;
|
|
83
|
+
analyticsSpend: string;
|
|
84
|
+
analyticsByModel: string;
|
|
85
|
+
analyticsByDay: string;
|
|
86
|
+
analyticsInput: string;
|
|
87
|
+
analyticsOutput: string;
|
|
88
|
+
analyticsCacheRead: string;
|
|
89
|
+
analyticsQuota: string;
|
|
90
|
+
analyticsQuotaHint: string;
|
|
91
|
+
analyticsQuotaFailed: string;
|
|
92
|
+
analyticsChartSpend: string;
|
|
93
|
+
analyticsChartTokens: string;
|
|
94
|
+
analyticsKicker: string;
|
|
95
|
+
analyticsModel: string;
|
|
96
|
+
analyticsCost: string;
|
|
97
|
+
analyticsShare: string;
|
|
98
|
+
analyticsCacheHit: string;
|
|
99
|
+
analyticsDailyAverage: string;
|
|
100
|
+
analyticsPeak: string;
|
|
101
|
+
analyticsTotal: string;
|
|
62
102
|
nav: string;
|
|
63
103
|
title: string;
|
|
64
104
|
titleLabel: string;
|
|
@@ -75,18 +115,21 @@ export declare const en: {
|
|
|
75
115
|
keyMissing: string;
|
|
76
116
|
keyNotWritable: string;
|
|
77
117
|
modelsLabel: string;
|
|
118
|
+
modelSourcesLabel: string;
|
|
119
|
+
modelsGoTab: string;
|
|
120
|
+
modelsFreeTab: string;
|
|
121
|
+
modelsGoSource: string;
|
|
122
|
+
modelsFreeSource: string;
|
|
78
123
|
modelsRefresh: string;
|
|
79
124
|
modelsLoading: string;
|
|
80
125
|
modelsFailed: string;
|
|
81
126
|
modelsStale: string;
|
|
82
|
-
modelsMetadataFailed: string;
|
|
83
|
-
modelsListingSource: string;
|
|
84
|
-
modelsMetadataSource: string;
|
|
85
127
|
modelsSourceFailed: string;
|
|
86
128
|
modelsSourceCurrent: string;
|
|
87
129
|
modelsSourceNeverFetched: string;
|
|
88
130
|
modelsSourceUpdated: string;
|
|
89
131
|
modelsRefreshing: string;
|
|
132
|
+
modelsRefreshingShort: string;
|
|
90
133
|
modelsEmpty: string;
|
|
91
134
|
limitsLabel: string;
|
|
92
135
|
limitsHint: string;
|
|
@@ -102,6 +145,7 @@ export declare const en: {
|
|
|
102
145
|
thinkingBudgetAdd: string;
|
|
103
146
|
thinkingBudgetRemove: string;
|
|
104
147
|
capacityDefault: string;
|
|
148
|
+
capacityDefaultCapped: string;
|
|
105
149
|
capacityMissing: string;
|
|
106
150
|
modalityLabel: string;
|
|
107
151
|
modalityText: string;
|
|
@@ -117,7 +161,6 @@ export declare const en: {
|
|
|
117
161
|
configurationMissing: string;
|
|
118
162
|
configurationMissingHint: string;
|
|
119
163
|
configurationUnavailable: string;
|
|
120
|
-
configurationUnavailableHint: string;
|
|
121
164
|
pickerFailed: string;
|
|
122
165
|
deprecatedBadge: string;
|
|
123
166
|
deprecatedHint: string;
|
|
@@ -138,7 +181,17 @@ export declare const en: {
|
|
|
138
181
|
limitsOutputLabel: string;
|
|
139
182
|
advancedResetAll: string;
|
|
140
183
|
advancedLabel: string;
|
|
141
|
-
|
|
184
|
+
groupUsage: string;
|
|
185
|
+
usageAppearanceLabel: string;
|
|
186
|
+
usageAppearanceReset: string;
|
|
187
|
+
showSidebarQuotaLabel: string;
|
|
188
|
+
showSidebarQuotaSummary: string;
|
|
189
|
+
showSidebarQuotaHint: string;
|
|
190
|
+
usagePillStyleLabel: string;
|
|
191
|
+
usagePillStyleHint: string;
|
|
192
|
+
usagePillStylePreviewHint: string;
|
|
193
|
+
usagePillStyle_badge: string;
|
|
194
|
+
usagePillStyle_plain: string;
|
|
142
195
|
groupConnection: string;
|
|
143
196
|
groupCacheTimeouts: string;
|
|
144
197
|
groupImages: string;
|
|
@@ -148,10 +201,8 @@ export declare const en: {
|
|
|
148
201
|
usageDisplay_auto: string;
|
|
149
202
|
usageDisplay_always: string;
|
|
150
203
|
usageDisplay_off: string;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
protocolOverridesAuto: string;
|
|
154
|
-
protocolOverridesResponses: string;
|
|
204
|
+
freeBaseURLLabel: string;
|
|
205
|
+
freeBaseURLHint: string;
|
|
155
206
|
baseURLLabel: string;
|
|
156
207
|
baseURLHint: string;
|
|
157
208
|
proxyURLLabel: string;
|
|
@@ -183,3 +234,40 @@ export declare const en: {
|
|
|
183
234
|
export declare const zh: typeof en;
|
|
184
235
|
/** Every copy key this page's dictionaries must supply. */
|
|
185
236
|
export type OpencodeGoKey = keyof typeof en;
|
|
237
|
+
/** Warm paper/charcoal surfaces shared by every plugin-owned view. */
|
|
238
|
+
export interface GoThemeTokens {
|
|
239
|
+
readonly bg: string;
|
|
240
|
+
readonly surface: string;
|
|
241
|
+
readonly surface2: string;
|
|
242
|
+
readonly border: string;
|
|
243
|
+
readonly text: string;
|
|
244
|
+
readonly muted: string;
|
|
245
|
+
readonly accent: string;
|
|
246
|
+
readonly accent2: string;
|
|
247
|
+
readonly accentSoft: string;
|
|
248
|
+
readonly onAccent: string;
|
|
249
|
+
readonly cacheRead: string;
|
|
250
|
+
readonly cacheWrite: string;
|
|
251
|
+
readonly shadow: string;
|
|
252
|
+
readonly success: string;
|
|
253
|
+
readonly warning: string;
|
|
254
|
+
readonly danger: string;
|
|
255
|
+
}
|
|
256
|
+
/** One visual language in the Host's two color schemes; no separate preference. */
|
|
257
|
+
export declare const GO_THEME_TOKENS: Record<'dark' | 'light', GoThemeTokens>;
|
|
258
|
+
/**
|
|
259
|
+
* Follow the Host's light/dark scheme. The layout presenter marks a dark body
|
|
260
|
+
* with `data-ds-dark-theme`; the attribute is observed so switching the Host
|
|
261
|
+
* theme updates the surfaces without a reload.
|
|
262
|
+
*/
|
|
263
|
+
export declare function useHostScheme(): 'dark' | 'light';
|
|
264
|
+
/** The unified tokens for the Host's current scheme. */
|
|
265
|
+
export declare function useGoThemeTokens(): GoThemeTokens;
|
|
266
|
+
/**
|
|
267
|
+
* Inline custom properties consumed by settings, quota surfaces and history.
|
|
268
|
+
* Prefer installed Anthropic families; system fallbacks keep other machines
|
|
269
|
+
* offline-capable without distributing the user's local font files.
|
|
270
|
+
* @param tokens - the active palette.
|
|
271
|
+
* @returns a style object carrying every `--go-*` variable.
|
|
272
|
+
*/
|
|
273
|
+
export declare function themeStyle(tokens: GoThemeTokens): CSSProperties;
|
package/lib/types/config.d.ts
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration schema for the OpenCode Go adapter plugin. The section is
|
|
3
|
-
* installed under the `llm-opencode-go` settings namespace on DSH 0.1.5/0.1.6.
|
|
4
|
-
* DSH 0.1.7 edits the `opencode-go` profile entry through live references.
|
|
5
|
-
* Both paths update field by field without a restart. Self-contained constraints
|
|
6
|
-
* (URL shape, numeric bounds) fail at load for the composition layer and
|
|
7
|
-
* refuse the write for the settings layer.
|
|
8
|
-
*
|
|
9
|
-
* @module dsh-llm-opencode-go/config
|
|
10
|
-
*/
|
|
1
|
+
/** Live profile configuration, validation and settings presentation. */
|
|
11
2
|
import z from '@deepseek-ai/schemastery';
|
|
12
|
-
import type
|
|
13
|
-
|
|
3
|
+
import { type OpencodeGoConfig } from './contracts.ts';
|
|
4
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
5
|
+
export type { OpencodeGoConfig, OpencodeGoModelLimit, OpencodeGoModelLimits } from './contracts.ts';
|
|
14
6
|
/** Environment variable resolving the OpenCode API key. */
|
|
15
7
|
export declare const DEFAULT_API_KEY_ENV = "OPENCODE_API_KEY";
|
|
16
8
|
/** Successful refresh lifetime; failed refreshes retry sooner and explicit discovery revalidates immediately. */
|
|
@@ -19,9 +11,13 @@ export declare const DEFAULT_REFRESH_MINUTES = 60;
|
|
|
19
11
|
export declare const DEFAULT_STREAM_IDLE_TIMEOUT_MS = 300000;
|
|
20
12
|
export declare const DEFAULT_REQUEST_PREPARATION_TIMEOUT_MS = 60000;
|
|
21
13
|
export declare const DEFAULT_REQUEST_TIMEOUT_MS: number;
|
|
22
|
-
/** Plain values used by
|
|
14
|
+
/** Plain configuration values used by validation and direct adapter consumers. */
|
|
23
15
|
export declare const PlainConfig: z<OpencodeGoConfig>;
|
|
24
|
-
/**
|
|
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;
|
|
20
|
+
/** The Loader retains these references when profile fields change. */
|
|
25
21
|
export type LiveConfig = {
|
|
26
22
|
[K in keyof OpencodeGoConfig]-?: {
|
|
27
23
|
get(): OpencodeGoConfig[K];
|
|
@@ -37,7 +33,7 @@ export declare function readConfig(config: LiveConfig): OpencodeGoConfig;
|
|
|
37
33
|
* @param raw - the configured base URL.
|
|
38
34
|
* @returns the current gateway base URL without trailing slashes.
|
|
39
35
|
*/
|
|
40
|
-
export declare function assertBaseURL(raw: string): string;
|
|
36
|
+
export declare function assertBaseURL(raw: string, field?: 'baseURL' | 'freeBaseURL'): string;
|
|
41
37
|
/**
|
|
42
38
|
* Reject a selected credential reference that is not a bare environment
|
|
43
39
|
* variable name. The schema pattern above fails the composition layer and the
|
|
@@ -46,3 +42,6 @@ export declare function assertBaseURL(raw: string): string;
|
|
|
46
42
|
* @param raw - the configured credential reference.
|
|
47
43
|
*/
|
|
48
44
|
export declare function assertApiKeyEnv(raw: string): void;
|
|
45
|
+
export declare function validateGoConfig(value: OpencodeGoConfig): void;
|
|
46
|
+
/** DSH profile forms edit the plugin's live Config fields directly. */
|
|
47
|
+
export declare function installHostSettings(ctx: Context): void;
|