dsh-opencode-go 0.1.10 → 0.1.12

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.
@@ -11,7 +11,7 @@
11
11
  import z from '@deepseek-ai/schemastery';
12
12
  /** Environment variable resolving the OpenCode API key. */
13
13
  export declare const DEFAULT_API_KEY_ENV = "OPENCODE_API_KEY";
14
- /** Runtime request cache lifetime; model listing/discovery always revalidates immediately. */
14
+ /** Requests and pickers share this cache lifetime; explicit discovery revalidates immediately. */
15
15
  export declare const DEFAULT_REFRESH_MINUTES = 60;
16
16
  /** Default maximum idle interval while a stream read is outstanding. */
17
17
  export declare const DEFAULT_STREAM_IDLE_TIMEOUT_MS = 300000;
@@ -38,13 +38,13 @@ export interface OpencodeGoConfig {
38
38
  * false registers nothing.
39
39
  */
40
40
  enabled: boolean;
41
- /** Include models marked deprecated by models.dev in conversation pickers. */
42
- showDeprecatedModels: boolean;
41
+ /** Per-model picker switches; absent entries default to enabled unless deprecated. */
42
+ modelVisibility?: Record<string, boolean>;
43
43
  /** Credential reference: the environment variable the key resolves from. */
44
44
  apiKeyEnv: string;
45
45
  /** The gateway endpoint; also the base of the live model listing. */
46
46
  baseURL: string;
47
- /** Runtime request cache lifetime in minutes; explicit catalog reads bypass it. */
47
+ /** Request/picker cache lifetime in minutes; explicit discovery bypasses it. */
48
48
  refreshMinutes: number;
49
49
  /** Largest idle gap between stream events before the request fails. */
50
50
  streamIdleTimeoutMs: number;
@@ -61,7 +61,7 @@ export interface OpencodeGoConfig {
61
61
  export declare const PlainConfig: z<OpencodeGoConfig>;
62
62
  /** 0.1.7's Loader retains these references when profile fields change. */
63
63
  export type LiveConfig = {
64
- [K in keyof OpencodeGoConfig]: {
64
+ [K in keyof OpencodeGoConfig]-?: {
65
65
  get(): OpencodeGoConfig[K];
66
66
  };
67
67
  };
@@ -1,2 +1,11 @@
1
- /** The limit applies both to bytes delivered by fetch and to any fallback decoder's output. */
1
+ /** Describe transport failures without echoing credentials or upstream response text. */
2
+ export declare function transportFailure(error: unknown): string;
3
+ /** Keep the endpoint useful in diagnostics without user information or query secrets. */
4
+ export declare function diagnosticURL(raw: string): string;
5
+ /** The caller's signal covers both attempts, the retry delay, and all response reads. */
6
+ export declare function fetchJsonResponse(url: string, init: RequestInit, maxBytes: number): Promise<{
7
+ response: Response;
8
+ body: unknown;
9
+ }>;
10
+ /** Fetch handles HTTP decoding; this reader bounds the bytes it delivers. */
2
11
  export declare function readJsonResponse(response: Response, maxBytes: number): Promise<unknown>;
@@ -7,16 +7,27 @@ export interface GoModel {
7
7
  maxTokens?: number;
8
8
  deprecated?: boolean;
9
9
  releaseDate?: string;
10
+ /** Advertised by the gateway but lacking a usable protocol and capability configuration. */
11
+ configurationMissing?: boolean;
10
12
  }
13
+ /** A failed refresh retains the Host's last successful listing with an explicit diagnostic. */
14
+ export interface GoModelCatalog {
15
+ readonly models: readonly GoModel[];
16
+ readonly stale: boolean;
17
+ readonly error?: string;
18
+ }
19
+ /** Missing configuration cannot be enabled; configured models follow explicit switches or lifecycle defaults. */
20
+ export declare function isModelEnabled(model: Pick<GoModel, 'id' | 'deprecated' | 'configurationMissing'>, modelVisibility?: Readonly<Record<string, boolean>>): boolean;
11
21
  export declare function validReleaseDate(value: unknown): value is string;
12
22
  /** Calendar dates are supplied without a timezone; compare UTC dates consistently. */
13
23
  export declare function isNewModel(model: GoModel, now?: number): boolean;
14
24
  export declare function sortModels(models: readonly GoModel[], now?: number): GoModel[];
15
25
  export declare function parseGoModels(value: unknown): GoModel[];
26
+ export declare function parseGoModelCatalog(value: unknown): GoModelCatalog;
16
27
  declare module '@deepseek-ai/dsh-typert-protocol' {
17
28
  interface TypertRemoteNamespaceMap {
18
29
  opencodeGoModels: {
19
- read(): Promise<RemoteResult<readonly GoModel[]>>;
30
+ read(): Promise<RemoteResult<GoModelCatalog>>;
20
31
  };
21
32
  }
22
33
  }
@@ -1,12 +1,13 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
2
  import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
3
3
  import { type OpencodeGoCatalog } from './catalog.ts';
4
- import type { GoModel } from './models-contract.ts';
4
+ import type { GoModelCatalog } from './models-contract.ts';
5
5
  /** Uses the same gateway snapshot as the adapter, including models hidden from pickers. */
6
6
  export declare class GoModelsService extends TypertRemoteService {
7
7
  private readonly options;
8
8
  constructor(ctx: Context, options: {
9
9
  catalog: () => OpencodeGoCatalog;
10
+ onRefresh?: () => void;
10
11
  });
11
- read(): Promise<readonly GoModel[]>;
12
+ read(): Promise<GoModelCatalog>;
12
13
  }
@@ -5,6 +5,8 @@ export interface UsageWindow {
5
5
  resetsAt: string;
6
6
  }
7
7
  export interface GoUsage {
8
+ /** Opaque Host identity for this endpoint/account; never a credential or its hash. */
9
+ source?: string;
8
10
  rolling: UsageWindow;
9
11
  weekly: UsageWindow;
10
12
  monthly: UsageWindow;
@@ -12,6 +14,13 @@ export interface GoUsage {
12
14
  /** Reject missing statistics rather than turning unavailable data into zero. */
13
15
  export declare function parseGoUsage(value: unknown): GoUsage;
14
16
  declare module '@deepseek-ai/dsh-typert-protocol' {
17
+ interface RemoteErrorDetailsMap {
18
+ 'opencode-go/usage-unavailable': {
19
+ readonly retryable: boolean;
20
+ readonly retainPrevious: boolean;
21
+ readonly source?: string;
22
+ };
23
+ }
15
24
  interface TypertRemoteNamespaceMap {
16
25
  opencodeGoUsage: {
17
26
  read(): Promise<RemoteResult<GoUsage>>;
@@ -8,6 +8,7 @@ interface UsageOptions {
8
8
  /** Account statistics are fetched on the Host; credentials never enter the browser. */
9
9
  export declare class GoUsageService extends TypertRemoteService {
10
10
  private readonly options;
11
+ private identity?;
11
12
  constructor(ctx: Context, options: UsageOptions);
12
13
  read(): Promise<GoUsage>;
13
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-opencode-go",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "OpenCode Go model provider and settings UI for DeepSeek Harness",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "engines": {
16
16
  "node": "^22.19.0 || >=24.0.0",
17
- "dsh": ">=0.1.5-rc.1 <0.1.6-0 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2"
17
+ "dsh": ">=0.1.5-rc.1 <0.1.6-0 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2"
18
18
  },
19
19
  "main": "./lib/index.js",
20
20
  "types": "./lib/types/index.d.ts",
@@ -61,25 +61,25 @@
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@deepseek-ai/cordis": "4.0.2 || 4.0.3 || 4.0.4",
64
- "@deepseek-ai/dsh-api-gateway": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
65
- "@deepseek-ai/dsh-api-remotes": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
66
- "@deepseek-ai/dsh-api-settings-controller": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
67
- "@deepseek-ai/dsh-attachment": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
68
- "@deepseek-ai/dsh-client-locale": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
69
- "@deepseek-ai/dsh-client-store": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
70
- "@deepseek-ai/dsh-client-ui-conversation": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
71
- "@deepseek-ai/dsh-client-ui-model-selection": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
72
- "@deepseek-ai/dsh-client-ui-renderer": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
73
- "@deepseek-ai/dsh-client-ui-settings": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
74
- "@deepseek-ai/dsh-client-ui-slots": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
75
- "@deepseek-ai/dsh-credentials": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
76
- "@deepseek-ai/dsh-fs": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
77
- "@deepseek-ai/dsh-launch-environment": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
78
- "@deepseek-ai/dsh-llm": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
79
- "@deepseek-ai/dsh-settings": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
80
- "@deepseek-ai/dsh-timeout": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
81
- "@deepseek-ai/dsh-typert-protocol": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2",
82
- "@deepseek-ai/dsh-typert-registry": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2"
64
+ "@deepseek-ai/dsh-api-gateway": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
65
+ "@deepseek-ai/dsh-api-remotes": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
66
+ "@deepseek-ai/dsh-api-settings-controller": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
67
+ "@deepseek-ai/dsh-attachment": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
68
+ "@deepseek-ai/dsh-client-locale": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
69
+ "@deepseek-ai/dsh-client-store": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
70
+ "@deepseek-ai/dsh-client-ui-conversation": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
71
+ "@deepseek-ai/dsh-client-ui-model-selection": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
72
+ "@deepseek-ai/dsh-client-ui-renderer": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
73
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
74
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
75
+ "@deepseek-ai/dsh-credentials": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
76
+ "@deepseek-ai/dsh-fs": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
77
+ "@deepseek-ai/dsh-launch-environment": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
78
+ "@deepseek-ai/dsh-llm": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
79
+ "@deepseek-ai/dsh-settings": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
80
+ "@deepseek-ai/dsh-timeout": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
81
+ "@deepseek-ai/dsh-typert-protocol": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2",
82
+ "@deepseek-ai/dsh-typert-registry": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-alpha.2 || 0.1.7-alpha.1 || 0.1.7-alpha.2 || 0.1.7-rc.1 || 0.1.7-rc.2"
83
83
  },
84
84
  "dependencies": {
85
85
  "@deepseek-ai/dsh-brand": "0.1.6-alpha.1",