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.
Files changed (44) hide show
  1. package/README.en.md +20 -18
  2. package/README.md +26 -18
  3. package/THIRD_PARTY_NOTICES.md +5 -1
  4. package/docs/advanced.en.md +17 -13
  5. package/docs/advanced.md +18 -13
  6. package/docs/assets/usage-history-desktop.jpg +0 -0
  7. package/docs/assets/usage-history-mobile.jpg +0 -0
  8. package/docs/assets/usage-history-models.jpg +0 -0
  9. package/docs/development.md +23 -9
  10. package/docs/usage-analytics.en.md +34 -85
  11. package/docs/usage-analytics.md +34 -85
  12. package/docs/verification.md +50 -13
  13. package/lib/build-info.json +1 -1
  14. package/lib/client.js +2111 -2257
  15. package/lib/free-http-worker.js +32 -0
  16. package/lib/index.js +3078 -1899
  17. package/lib/types/accounts.d.ts +2 -2
  18. package/lib/types/adapter.d.ts +24 -9
  19. package/lib/types/analytics.d.ts +22 -332
  20. package/lib/types/catalog.d.ts +35 -76
  21. package/lib/types/client/AnalyticsDialog.d.ts +11 -18
  22. package/lib/types/client/Section.d.ts +3 -13
  23. package/lib/types/client/UsagePill.d.ts +10 -3
  24. package/lib/types/client/controller.d.ts +10 -8
  25. package/lib/types/client/dashboard-copy.d.ts +58 -0
  26. package/lib/types/client/index.d.ts +9 -0
  27. package/lib/types/client/presentation.d.ts +36 -72
  28. package/lib/types/config.d.ts +5 -1
  29. package/lib/types/contracts.d.ts +80 -25
  30. package/lib/types/conversion.d.ts +10 -2
  31. package/lib/types/free-channel.d.ts +21 -0
  32. package/lib/types/free-http-worker.d.ts +1 -0
  33. package/lib/types/free-policy.d.ts +4 -0
  34. package/lib/types/free-protocol.d.ts +16 -0
  35. package/lib/types/free-runtime.d.ts +2 -0
  36. package/lib/types/free-socks-tunnel.d.ts +4 -0
  37. package/lib/types/free-transport.d.ts +19 -0
  38. package/lib/types/index.d.ts +1 -1
  39. package/lib/types/pricing.d.ts +29 -0
  40. package/lib/types/sdk-types.d.ts +1577 -2890
  41. package/lib/types/transport.d.ts +13 -5
  42. package/lib/vendor-licenses.txt +79 -55
  43. package/package.json +4 -4
  44. package/docs/assets/usage-panel.png +0 -0
@@ -1,6 +1,6 @@
1
1
  import { type LlmDiscoveredModel } from '@deepseek-ai/dsh-llm';
2
2
  import type { Api, Model, ModelThinkingLevel, ThinkingBudgets, ThinkingLevelMap, Provider } from './sdk-types.ts';
3
- import { type ThinkingBudgetRange, type GoModel, type OpencodeGoConfig, type GoModelCatalog } from './contracts.ts';
3
+ import { type ThinkingBudgetRange, type GoModel, type OpencodeGoConfig, type ModelSource, type GoModelCatalog } from './contracts.ts';
4
4
  import { type ProxyTransport } from './transport.ts';
5
5
  import type { Context } from '@deepseek-ai/cordis';
6
6
  import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
@@ -11,8 +11,6 @@ export declare const NATIVE_THINKING_FLAGS: ReadonlySet<string>;
11
11
  export declare function supportsThinkingBudget(api: Api, compat: Model<Api>['compat']): boolean;
12
12
  export declare function reasoningBudgetRange(model: Model<Api>): ThinkingBudgetRange | undefined;
13
13
  export declare function unsupportedThinkingLevels(): ThinkingLevelMap;
14
- /** Exact model/protocol controls verified against OpenCode Go. */
15
- export declare function withGatewayReasoning(model: Model<Api>): Model<Api>;
16
14
  export declare function reasoningChoices(model: Model<Api>): readonly {
17
15
  id: string;
18
16
  name: string;
@@ -42,117 +40,78 @@ export declare function reasoningRequest(intent: ReasoningIntent): {
42
40
  thinkingBudgets?: ThinkingBudgets;
43
41
  onPayload: (payload: unknown) => unknown;
44
42
  };
45
- export declare const MODEL_METADATA_URL = "https://models.dev/api.json";
46
- /** Lifecycle and capability data the online catalog adds to a gateway listing. */
47
43
  export type ModelDetails = Pick<GoModel, 'deprecated' | 'releaseDate' | 'inputModalities'> & {
48
- /**
49
- * Present only when the upstream cost block is missing or carries a malformed
50
- * component: its zeros are then indistinguishable from a genuinely free model,
51
- * so analytics must treat the model as unpriced instead of pricing it at 0.
52
- * A published block with legal components stays unmarked even when all zero.
53
- */
54
44
  readonly costKnown?: false;
55
45
  };
56
- export interface ModelMetadata {
46
+ export interface ModelDirectory {
57
47
  readonly models: ReadonlyMap<string, Model<Api>>;
58
48
  readonly details: ReadonlyMap<string, ModelDetails>;
59
49
  readonly errors: ReadonlyMap<string, string>;
50
+ readonly warning?: string;
60
51
  }
61
- /** Select documented official protocol endpoints while preserving custom gateway prefixes. */
62
- export declare function modelBaseURL(api: Api, baseURL: string): string;
63
- /** Shared Responses defaults for declared models and explicit protocol overrides. */
64
- export declare function responsesCompatibility(): NonNullable<Model<'openai-responses'>['compat']>;
65
- /**
66
- * Only read the opencode-go record. Online endpoints, headers and credentials
67
- * are deliberately ignored: protocol endpoints are selected on the configured gateway.
68
- * A bad entry is isolated instead of discarding every other model.
69
- */
70
- export declare function readModelMetadata(body: unknown, baseURL: string, builtin: ReadonlyMap<string, Model<Api>>): ModelMetadata;
71
- export declare const MODEL_METADATA_MAX_BYTES: number;
72
- export interface CachedMetadata {
52
+ /** Official listings own their protocol endpoints; custom gateways keep their prefix. */
53
+ export declare function modelBaseURL(api: Api, baseURL: string, declared?: unknown, source?: ModelSource): string;
54
+ export declare function readLiveModelIds(body: unknown, onInvalidRows?: (warning: string) => void): readonly string[];
55
+ export declare function readModelDirectory(body: unknown, baseURL: string, source?: ModelSource): ModelDirectory;
56
+ export declare const MODEL_LISTING_MAX_BYTES: number;
57
+ export interface CachedDirectory {
73
58
  readonly body: unknown;
74
59
  readonly etag?: string;
75
- /** Last successful download or HTTP 304 verification. */
76
60
  readonly savedAtMs: number;
77
61
  }
78
- export declare function metadataCachePath(): string;
79
- /** Only persist validators that can safely become an HTTP request header. */
80
- export declare function metadataETag(value: unknown): string | undefined;
81
- export declare function readMetadataCache(path: string): Promise<CachedMetadata | undefined>;
82
- export declare function writeMetadataCache(path: string, value: CachedMetadata): Promise<boolean>;
83
- /** Resolve a request's wire model without mutating the shared metadata catalog. */
84
- export declare function withProtocolOverride(model: Model<Api>, config: OpencodeGoConfig): Model<Api>;
85
- export { PROVIDER_ID, DISPLAY_NAME } from './contracts.ts';
86
- export { DEFAULT_BASE_URL } from './contracts.ts';
62
+ export declare function catalogCachePath(source?: ModelSource): string;
63
+ export declare function catalogETag(value: unknown): string | undefined;
64
+ export declare function readCatalogCache(path: string, sourceURL: string): Promise<CachedDirectory | undefined>;
65
+ export declare function writeCatalogCache(path: string, sourceURL: string, value: CachedDirectory): Promise<boolean>;
66
+ export { PROVIDER_ID, DISPLAY_NAME, FREE_PROVIDER_ID, FREE_DISPLAY_NAME, DEFAULT_BASE_URL, DEFAULT_FREE_BASE_URL } from './contracts.ts';
87
67
  export interface CatalogSnapshot {
88
- readonly details: ModelMetadata['details'];
68
+ readonly source: ModelSource;
69
+ readonly details: ModelDirectory['details'];
89
70
  readonly models: ReadonlyMap<string, Model<Api>>;
90
- /** Advertised ids with missing/unsupported metadata stay visible with a diagnostic. */
91
71
  readonly unavailable: ReadonlyMap<string, string>;
92
72
  readonly provider: Provider;
93
73
  readonly live: boolean;
94
- readonly metadataLive: boolean;
95
- /** Retained for explicit discovery; runtime callers may still use the last catalog. */
96
- readonly listingFailure?: unknown;
97
- readonly listingWarning?: string;
98
- readonly metadataFailure?: unknown;
99
- /** Last successful fetch or revalidation, not the time of a failed attempt. */
100
- readonly listingUpdatedAtMs?: number;
101
- readonly metadataUpdatedAtMs?: number;
74
+ readonly failure?: unknown;
75
+ readonly warning?: string;
76
+ readonly updatedAtMs?: number;
102
77
  readonly fetchedAtMs: number;
103
78
  }
104
- /** A valid empty listing means the gateway serves nothing; malformed replies are failures. */
105
- export declare function readLiveModelIds(body: unknown, onInvalidRows?: (warning: string) => void): readonly string[];
106
- /** Runtime requests reuse a snapshot; discovery revalidates it. Concurrent reads coalesce. */
79
+ /** One gateway owns its membership, disk cache, validator, refresh and failure backoff. */
107
80
  export declare class OpencodeGoCatalog {
108
81
  private readonly baseURL;
109
82
  private readonly refreshMs;
110
83
  private readonly onFallback;
111
- /** Kept for API compatibility; now reports unconfigured ids rather than hiding them. */
112
84
  private readonly onOmitted;
113
85
  private readonly onRefresh;
114
86
  private readonly fetcher?;
115
87
  private readonly onWarning?;
88
+ readonly source: ModelSource;
116
89
  private served;
117
90
  private pending;
118
- /** A cold runtime read can use disk metadata while the shared online refresh runs. */
119
- private cachedPending;
120
91
  private initialized;
121
- private readonly cachePath;
122
- private metadata;
123
- private metadataBody;
124
- private metadataETag;
125
- private metadataUpdatedAtMs;
126
- private failures;
92
+ private cached;
93
+ private startupCache;
127
94
  private refreshAtMs;
128
- constructor(baseURL: string, refreshMs: number, onFallback: (detail: {
95
+ private failures;
96
+ private readonly url;
97
+ private readonly cachePath;
98
+ constructor(baseURL: string, refreshMs: number, onFallback?: (detail: {
129
99
  url: string;
130
100
  error: unknown;
131
101
  kept: number;
132
- }) => void,
133
- /** Kept for API compatibility; now reports unconfigured ids rather than hiding them. */
134
- onOmitted: (ids: readonly string[]) => void, onRefresh?: () => void, fetcher?: typeof globalThis.fetch | undefined, onWarning?: ((warning: string) => void) | undefined);
102
+ }) => void, onOmitted?: (ids: readonly string[]) => void, onRefresh?: () => void, fetcher?: typeof globalThis.fetch | undefined, onWarning?: ((warning: string) => void) | undefined, source?: ModelSource);
135
103
  snapshot(force?: boolean, signal?: AbortSignal): Promise<CatalogSnapshot>;
136
- private restoreMetadata;
137
- private readSnapshot;
138
- private currentSnapshot;
139
- private startRefresh;
140
- /** Conditional HTTP requests save bandwidth while still checking for updated metadata. */
141
- private refreshMetadata;
142
- private persistMetadata;
143
- /** Gateway ids decide membership; online metadata decides how to call each model. */
104
+ private empty;
144
105
  private build;
145
- /** New or previously unconfigured ids get a fresh lookup even during the runtime TTL. */
106
+ private restore;
107
+ private refresh;
146
108
  forModel(id: string, signal?: AbortSignal): Promise<CatalogSnapshot>;
147
109
  }
148
- /** Explicit discovery always revalidates both sources, including during the runtime TTL. */
149
110
  export declare function discoverCatalogModels(catalog: OpencodeGoCatalog): Promise<readonly LlmDiscoveredModel[]>;
150
- /** Settings expose the same retained catalog as requests, with a failed-refresh diagnostic. */
151
- export declare function discoverSettingsModels(catalog: OpencodeGoCatalog): Promise<GoModelCatalog>;
152
- /** One mount owns discovery; inference, settings and pickers share its snapshots. */
111
+ export declare function discoverSettingsModels(catalog: OpencodeGoCatalog, freeCatalog?: OpencodeGoCatalog): Promise<GoModelCatalog>;
153
112
  export declare class GoCatalogManager {
154
113
  private readonly options;
155
- private current;
114
+ private readonly current;
156
115
  constructor(options: {
157
116
  transport: ProxyTransport;
158
117
  onFallback?: (detail: {
@@ -164,13 +123,13 @@ export declare class GoCatalogManager {
164
123
  onRefresh?: () => void;
165
124
  onWarning?: (warning: string) => void;
166
125
  });
167
- forConfig(config: OpencodeGoConfig): OpencodeGoCatalog;
126
+ forConfig(config: OpencodeGoConfig, source?: ModelSource): OpencodeGoCatalog;
168
127
  }
169
- /** Uses the same gateway snapshot as the adapter, including models hidden from pickers. */
170
128
  export declare class GoModelsService extends TypertRemoteService {
171
129
  private readonly options;
172
130
  constructor(ctx: Context, options: {
173
131
  catalog: () => OpencodeGoCatalog;
132
+ freeCatalog?: () => OpencodeGoCatalog;
174
133
  onRefresh?: () => void;
175
134
  });
176
135
  read(): Promise<GoModelCatalog>;
@@ -1,25 +1,18 @@
1
- import type { AnalyticsQuery, AnalyticsReport, GoUsage } from '../contracts.ts';
1
+ import type { AnalyticsExport, AnalyticsQuery, AnalyticsReport, GoAccount, GoUsage } from '../contracts.ts';
2
2
  import { type en } from './presentation.ts';
3
- type AnalyticsKey = keyof typeof en;
3
+ export declare function historyNumber(value: string, locale?: string, compact?: boolean): string;
4
+ /** Keep micro-cents exact through rounding: one dollar is 100,000,000 units. */
5
+ export declare function historyMoney(value: string, locale?: string): string;
4
6
  export interface AnalyticsDialogProps {
5
7
  open: boolean;
6
8
  onClose: () => void;
7
- /** The signal reaches the Host's cancellation parameter (review M4). */
8
9
  readAnalytics: (query: AnalyticsQuery, signal?: AbortSignal) => Promise<AnalyticsReport>;
9
- readQuota?: () => Promise<GoUsage>;
10
- t: (key: AnalyticsKey) => string;
10
+ exportAnalytics?: (query: AnalyticsQuery, signal?: AbortSignal) => Promise<AnalyticsExport>;
11
+ readQuota?: (ref: string) => Promise<GoUsage>;
12
+ accounts: readonly GoAccount[];
13
+ activeRef: string;
14
+ contextKey?: string | number;
15
+ t: (key: keyof typeof en) => string;
11
16
  getLocale?: () => string;
12
17
  }
13
- /**
14
- * Shared usage dashboard, opened from the composer pill and the settings card.
15
- * It scans only when opened or when the range asks for it; closing the modal
16
- * aborts the request. The window end is frozen once per open, so repeated
17
- * requests inside one open share the Host's dedup key (review P5/S5), a range
18
- * already seen in this open renders instantly and revalidates in the
19
- * background (review P17), and while a scan runs the previous results stay
20
- * visible under the newly selected range with an explicit annotation
21
- * (review P19). Every number shown here comes from the same Host report as
22
- * before; only the presentation and the palette are new.
23
- */
24
- export declare function AnalyticsDialog({ open, onClose, readAnalytics, readQuota, t, getLocale }: AnalyticsDialogProps): import("react").JSX.Element;
25
- export {};
18
+ export declare function AnalyticsDialog(props: AnalyticsDialogProps): import("react").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { type en } from './presentation.ts';
2
- import { type ReactNode } from 'react';
3
2
  import type { GoAccountsActions, GoAccountsState, OpencodeGoModelLimit, OpencodeGoModelLimits, OpencodeGoModels, OpencodeGoSectionFace } from './controller.ts';
3
+ import { type ModelSource } from '../contracts.ts';
4
4
  import type { InjectFace } from '@deepseek-ai/dsh-client-ui-slots';
5
5
  export declare function HintMark(props: {
6
6
  hint: string;
@@ -9,15 +9,6 @@ export declare function HintText(props: {
9
9
  id: string;
10
10
  hint: string;
11
11
  }): import("react").JSX.Element;
12
- /**
13
- * The one place a style is chosen: four previews, each a miniature of the
14
- * surface it selects, on the Settings page. The picker lives here rather than in
15
- * the pill or the dashboard so a working session never changes its own look.
16
- * @param props.t - copy lookup.
17
- */
18
- export declare function ThemePicker({ t }: {
19
- t: (key: keyof typeof en) => string;
20
- }): import("react").JSX.Element;
21
12
  type AccountTranslate = (key: keyof typeof en, params?: Record<string, unknown>) => string;
22
13
  /**
23
14
  * The account card: a folded header that summarizes the set, and one row per
@@ -37,7 +28,8 @@ export declare function AccountsCard({ state, actions, writable, t, locale }: {
37
28
  type ModelTranslate = (key: keyof typeof en, params?: Record<string, unknown>) => string;
38
29
  export declare function hasCapacityOverride(limit: OpencodeGoModelLimit | null | undefined): boolean;
39
30
  /** Per-model switches apply immediately; capacity edits stay in the staged form. */
40
- export declare function ModelEditor({ models, draft, modelVisibility, t, locale, disabled, visibilitySaving, filterAction, onEdit, onModelEnabled }: {
31
+ export declare function ModelEditor({ source, models, draft, modelVisibility, t, locale, disabled, visibilitySaving, onEdit, onModelEnabled }: {
32
+ source?: ModelSource;
41
33
  models: OpencodeGoModels;
42
34
  draft: OpencodeGoModelLimits;
43
35
  modelVisibility: Readonly<Record<string, boolean>>;
@@ -45,8 +37,6 @@ export declare function ModelEditor({ models, draft, modelVisibility, t, locale,
45
37
  locale?: string;
46
38
  disabled: boolean;
47
39
  visibilitySaving: boolean;
48
- /** Optional control pinned to the right of the filter row, such as a refresh. */
49
- filterAction?: ReactNode;
50
40
  onEdit: (next: OpencodeGoModelLimits) => void;
51
41
  onModelEnabled: (id: string, enabled: boolean) => void;
52
42
  }): import("react").JSX.Element;
@@ -1,18 +1,25 @@
1
1
  import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
2
2
  import type { ModelDirectoryState } from '@deepseek-ai/dsh-client-ui-model-selection/client';
3
- import { type GoUsage, type AnalyticsQuery, type AnalyticsReport } from '../contracts.ts';
3
+ import { type GoUsage, type AnalyticsQuery, type AnalyticsReport, type AnalyticsExport } from '../contracts.ts';
4
4
  import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
5
5
  import type { OpencodeGoSettings } from './controller.ts';
6
6
  export interface UsagePillProps {
7
7
  directory: SnapshotStore<ModelDirectoryState>;
8
8
  settings: ConfigForm<OpencodeGoSettings>;
9
9
  readUsage: () => Promise<GoUsage>;
10
+ readAccountUsage?: (ref: string) => Promise<GoUsage>;
10
11
  /** Optional so an embedded/test render can omit the dashboard. */
11
12
  readAnalytics?: (query: AnalyticsQuery, signal?: AbortSignal) => Promise<AnalyticsReport>;
13
+ exportAnalytics?: (query: AnalyticsQuery, signal?: AbortSignal) => Promise<AnalyticsExport>;
12
14
  t: (key: string) => string;
13
15
  getLocale?: () => string;
14
16
  credentialChanges?: SnapshotStore<number>;
15
17
  selectAccount?: (ref: string) => Promise<boolean>;
16
18
  }
17
- /** Only a visible, enabled pill mounts the usage poller. */
18
- export declare function UsagePill({ directory, settings, credentialChanges, ...props }: UsagePillProps): import("react").JSX.Element | null;
19
+ /** A root sidebar entry receives its width mode from the host slot owner. */
20
+ export type SidebarQuotaProps = Omit<UsagePillProps, 'directory'> & {
21
+ wide: boolean;
22
+ };
23
+ /** Only a visible, enabled input indicator mounts the usage poller. */
24
+ export declare function UsagePill({ directory, ...props }: UsagePillProps): import("react").JSX.Element;
25
+ export declare function SidebarQuota({ wide, ...props }: SidebarQuotaProps): import("react").JSX.Element;
@@ -2,12 +2,13 @@ import type { Context as ClientContext } from '@deepseek-ai/cordis';
2
2
  import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol';
3
3
  import { type SnapshotStore } from '@deepseek-ai/dsh-client-store';
4
4
  import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
5
- import { type OpencodeGoSettings, type OpencodeGoModelLimits, type GoAccount, type GoModel, type GoModelCatalog, type GoUsage, type AnalyticsQuery, type AnalyticsReport, type AccountCommand, type SettingsWriteResult } from '../contracts.ts';
5
+ import { type ModelSource, type OpencodeGoSettings, type OpencodeGoModelLimits, type GoAccount, type GoModel, type GoModelCatalog, type GoUsage, type AccountCommand, type SettingsWriteResult } from '../contracts.ts';
6
6
  export type { OpencodeGoSettings, OpencodeGoModelLimit, OpencodeGoModelLimits } from '../contracts.ts';
7
7
  export declare const OPENCODE_GO_NS = "llm-opencode-go";
8
- export declare const TEXT_FIELDS: readonly ["usageDisplay", "protocolOverrides", "baseURL", "proxyURL", "refreshMinutes", "streamIdleTimeoutMs", "maxImages", "maxRequestImageBytes", "requestImagePixelBudget", "requestImageMaxBytes"];
8
+ export declare const TEXT_FIELDS: readonly ["usageDisplay", "usagePillStyle", "showSidebarQuota", "baseURL", "freeBaseURL", "proxyURL", "refreshMinutes", "streamIdleTimeoutMs", "maxImages", "maxRequestImageBytes", "requestImagePixelBudget", "requestImageMaxBytes"];
9
9
  export type TextField = typeof TEXT_FIELDS[number];
10
- export type EditableField = TextField | 'modelLimits';
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];
11
12
  export interface FieldState {
12
13
  text: string;
13
14
  overridden: boolean;
@@ -58,6 +59,8 @@ export type OpencodeGoModels =
58
59
  readonly message?: string;
59
60
  readonly sources?: GoModelCatalog['sources'];
60
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;
61
64
  export type ExecuteAccountCommand = (command: AccountCommand) => Promise<SettingsWriteResult>;
62
65
  export interface GoAccountView extends GoAccount {
63
66
  configured?: boolean;
@@ -96,11 +99,13 @@ export interface OpencodeGoSectionState extends FormShell {
96
99
  accounts: GoAccountsState;
97
100
  enabled: boolean;
98
101
  usageDisplay: FieldState;
99
- protocolOverrides: FieldState;
102
+ showSidebarQuota: FieldState;
103
+ usagePillStyle: FieldState;
100
104
  modelVisibility: Readonly<Record<string, boolean>>;
101
105
  pickerSaving: boolean;
102
106
  pickerFailed: boolean;
103
107
  baseURL: FieldState;
108
+ freeBaseURL: FieldState;
104
109
  proxyURL: FieldState;
105
110
  refreshMinutes: FieldState;
106
111
  streamIdleTimeoutMs: FieldState;
@@ -117,8 +122,6 @@ export interface OpencodeGoSectionFace extends FormActions, GoAccountsActions {
117
122
  opencodeGo: SnapshotStore<OpencodeGoSectionState>;
118
123
  };
119
124
  loadModels(): void;
120
- readAnalytics(query: AnalyticsQuery, signal?: AbortSignal): Promise<AnalyticsReport>;
121
- readQuota(ref: string): Promise<GoUsage>;
122
125
  setEnabled(next: boolean): void;
123
126
  setModelEnabled(id: string, next: boolean): void;
124
127
  }
@@ -129,7 +132,6 @@ export declare class OpencodeGoSectionController {
129
132
  private readonly readModels;
130
133
  private readonly readUsage;
131
134
  private readonly executeAccountCommand;
132
- private readonly readAnalytics;
133
135
  private readonly drafts;
134
136
  private readonly store;
135
137
  private readonly unsubscribe;
@@ -149,7 +151,7 @@ export declare class OpencodeGoSectionController {
149
151
  private accountsLoaded;
150
152
  private disposed;
151
153
  private addition;
152
- constructor(scope: ConfigForm<OpencodeGoSettings>, ctx: ClientContext, readModels?: () => Promise<RemoteResult<GoModelCatalog>>, readUsage?: (ref: string) => Promise<GoUsage>, executeAccountCommand?: ExecuteAccountCommand, readAnalytics?: (query: AnalyticsQuery, signal?: AbortSignal) => Promise<AnalyticsReport>);
154
+ constructor(scope: ConfigForm<OpencodeGoSettings>, ctx: ClientContext, readModels?: () => Promise<RemoteResult<GoModelCatalog>>, readUsage?: (ref: string) => Promise<GoUsage>, executeAccountCommand?: ExecuteAccountCommand);
153
155
  dispose(): void;
154
156
  private publish;
155
157
  private blocked;
@@ -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;
@@ -3,6 +3,15 @@ import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
3
3
  import { type OpencodeGoSettings, type ExecuteAccountCommand } from './controller.ts';
4
4
  import { en } from './presentation.ts';
5
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
+ }
6
15
  interface LocaleNamespaceMap {
7
16
  /** The OpenCode Go settings page copy. */
8
17
  'settings.opencode-go': keyof typeof en;
@@ -1,4 +1,4 @@
1
- /** English and Chinese copy, palette tokens and local theme preferences. */
1
+ /** English and Chinese copy and the shared, Host-following presentation tokens. */
2
2
  import { type CSSProperties } from 'react';
3
3
  /** Copy dictionaries for the OpenCode Go settings page. English is the key-set source of truth. */
4
4
  export declare const en: {
@@ -29,6 +29,8 @@ export declare const en: {
29
29
  accountSwitchBack: string;
30
30
  accountSwitchHint: string;
31
31
  accountSwitchFailed: string;
32
+ sidebarNextAccount: string;
33
+ sidebarAnalytics: string;
32
34
  accountFallbackQuota: string;
33
35
  accountFallbackCredential: string;
34
36
  accountsSummary: string;
@@ -60,6 +62,7 @@ export declare const en: {
60
62
  usageRefreshFailed: string;
61
63
  usageLastUpdated: string;
62
64
  usageRetry: string;
65
+ usageRefresh: string;
63
66
  usageRefreshing: string;
64
67
  analyticsOpen: string;
65
68
  analyticsTitle: string;
@@ -74,51 +77,21 @@ export declare const en: {
74
77
  analyticsRetry: string;
75
78
  analyticsLoading: string;
76
79
  analyticsEmpty: string;
77
- analyticsUnsupported: string;
78
80
  analyticsFailed: string;
79
81
  analyticsRequests: string;
80
82
  analyticsTokens: string;
81
83
  analyticsSpend: string;
82
- analyticsCoverage: string;
83
- analyticsSessions: string;
84
- analyticsSeconds: string;
85
- analyticsSummaries: string;
86
- analyticsUnsettled: string;
87
84
  analyticsByModel: string;
88
85
  analyticsByDay: string;
89
86
  analyticsInput: string;
90
87
  analyticsOutput: string;
91
88
  analyticsCacheRead: string;
92
- analyticsPriced: string;
93
- analyticsUnpriced: string;
94
- analyticsMissing: string;
95
- analyticsFailedSessions: string;
96
- analyticsUnattributed: string;
97
- analyticsUnread: string;
98
- analyticsScanSegments: string;
99
- analyticsStaleResults: string;
100
- analyticsTruncated: string;
101
- analyticsScanMore: string;
102
- analyticsPriceSource: string;
103
- analyticsNotInvoice: string;
104
- analyticsPricingUnavailable: string;
105
- analyticsLegacy: string;
106
- analyticsCardTitle: string;
107
- analyticsCardHint: string;
108
- analyticsBoardLabel: string;
109
- analyticsOpenBoard: string;
110
89
  analyticsQuota: string;
111
90
  analyticsQuotaHint: string;
112
91
  analyticsQuotaFailed: string;
113
92
  analyticsChartSpend: string;
114
93
  analyticsChartTokens: string;
115
94
  analyticsKicker: string;
116
- analyticsLead: string;
117
- analyticsLeadTop: string;
118
- analyticsComposition: string;
119
- analyticsCompositionHint: string;
120
- analyticsCompositionOther: string;
121
- analyticsCompositionFree: string;
122
95
  analyticsModel: string;
123
96
  analyticsCost: string;
124
97
  analyticsShare: string;
@@ -126,12 +99,6 @@ export declare const en: {
126
99
  analyticsDailyAverage: string;
127
100
  analyticsPeak: string;
128
101
  analyticsTotal: string;
129
- themeLabel: string;
130
- themeSilentBlack: string;
131
- themeGraphite: string;
132
- themeSeaSalt: string;
133
- themeWarmSand: string;
134
- themeHint: string;
135
102
  nav: string;
136
103
  title: string;
137
104
  titleLabel: string;
@@ -148,18 +115,21 @@ export declare const en: {
148
115
  keyMissing: string;
149
116
  keyNotWritable: string;
150
117
  modelsLabel: string;
118
+ modelSourcesLabel: string;
119
+ modelsGoTab: string;
120
+ modelsFreeTab: string;
121
+ modelsGoSource: string;
122
+ modelsFreeSource: string;
151
123
  modelsRefresh: string;
152
124
  modelsLoading: string;
153
125
  modelsFailed: string;
154
126
  modelsStale: string;
155
- modelsMetadataFailed: string;
156
- modelsListingSource: string;
157
- modelsMetadataSource: string;
158
127
  modelsSourceFailed: string;
159
128
  modelsSourceCurrent: string;
160
129
  modelsSourceNeverFetched: string;
161
130
  modelsSourceUpdated: string;
162
131
  modelsRefreshing: string;
132
+ modelsRefreshingShort: string;
163
133
  modelsEmpty: string;
164
134
  limitsLabel: string;
165
135
  limitsHint: string;
@@ -175,6 +145,7 @@ export declare const en: {
175
145
  thinkingBudgetAdd: string;
176
146
  thinkingBudgetRemove: string;
177
147
  capacityDefault: string;
148
+ capacityDefaultCapped: string;
178
149
  capacityMissing: string;
179
150
  modalityLabel: string;
180
151
  modalityText: string;
@@ -190,7 +161,6 @@ export declare const en: {
190
161
  configurationMissing: string;
191
162
  configurationMissingHint: string;
192
163
  configurationUnavailable: string;
193
- configurationUnavailableHint: string;
194
164
  pickerFailed: string;
195
165
  deprecatedBadge: string;
196
166
  deprecatedHint: string;
@@ -211,7 +181,17 @@ export declare const en: {
211
181
  limitsOutputLabel: string;
212
182
  advancedResetAll: string;
213
183
  advancedLabel: string;
214
- groupUsageProtocol: string;
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;
215
195
  groupConnection: string;
216
196
  groupCacheTimeouts: string;
217
197
  groupImages: string;
@@ -221,10 +201,8 @@ export declare const en: {
221
201
  usageDisplay_auto: string;
222
202
  usageDisplay_always: string;
223
203
  usageDisplay_off: string;
224
- protocolOverridesLabel: string;
225
- protocolOverridesHint: string;
226
- protocolOverridesAuto: string;
227
- protocolOverridesResponses: string;
204
+ freeBaseURLLabel: string;
205
+ freeBaseURLHint: string;
228
206
  baseURLLabel: string;
229
207
  baseURLHint: string;
230
208
  proxyURLLabel: string;
@@ -256,7 +234,7 @@ export declare const en: {
256
234
  export declare const zh: typeof en;
257
235
  /** Every copy key this page's dictionaries must supply. */
258
236
  export type OpencodeGoKey = keyof typeof en;
259
- /** One palette's six theme colors plus the neutral surface steps. */
237
+ /** Warm paper/charcoal surfaces shared by every plugin-owned view. */
260
238
  export interface GoThemeTokens {
261
239
  readonly bg: string;
262
240
  readonly surface: string;
@@ -266,43 +244,29 @@ export interface GoThemeTokens {
266
244
  readonly muted: string;
267
245
  readonly accent: string;
268
246
  readonly accent2: string;
247
+ readonly accentSoft: string;
248
+ readonly onAccent: string;
249
+ readonly cacheRead: string;
250
+ readonly cacheWrite: string;
251
+ readonly shadow: string;
269
252
  readonly success: string;
270
253
  readonly warning: string;
271
254
  readonly danger: string;
272
255
  }
273
- /** The four selectable styles. */
274
- export declare const GO_THEMES: readonly ["silent-black", "graphite", "sea-salt", "warm-sand"];
275
- export type GoThemeId = typeof GO_THEMES[number];
276
- /** Graphite is the default: it is the quietest match for the Host chrome. */
277
- export declare const DEFAULT_GO_THEME: GoThemeId;
278
- /** Locale key carrying each theme's display name. */
279
- export declare const GO_THEME_LABELS: Record<GoThemeId, keyof typeof en>;
280
- /** Each style in both Host color schemes. */
281
- export declare const GO_THEME_TOKENS: Record<GoThemeId, {
282
- dark: GoThemeTokens;
283
- light: GoThemeTokens;
284
- }>;
285
- /** The selected style, stable until the next write. */
286
- export declare function getGoTheme(): GoThemeId;
287
- /**
288
- * Select a style and persist it for this browser.
289
- * @param id - one of {@link GO_THEMES}; unknown ids are ignored.
290
- */
291
- export declare function setGoTheme(id: GoThemeId): void;
292
- /** Subscribe to style changes (for useSyncExternalStore). */
293
- export declare function subscribeGoTheme(listener: () => void): () => void;
294
- /** Read the selected style in a component. */
295
- export declare function useGoTheme(): GoThemeId;
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>;
296
258
  /**
297
259
  * Follow the Host's light/dark scheme. The layout presenter marks a dark body
298
260
  * with `data-ds-dark-theme`; the attribute is observed so switching the Host
299
261
  * theme updates the surfaces without a reload.
300
262
  */
301
263
  export declare function useHostScheme(): 'dark' | 'light';
302
- /** The active style's tokens for the Host's current scheme. */
264
+ /** The unified tokens for the Host's current scheme. */
303
265
  export declare function useGoThemeTokens(): GoThemeTokens;
304
266
  /**
305
- * Inline custom properties consumed by the pill and dialog styles.
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.
306
270
  * @param tokens - the active palette.
307
271
  * @returns a style object carrying every `--go-*` variable.
308
272
  */