dsh-opencode-go 0.1.6 → 0.1.8
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 +130 -0
- package/README.md +39 -60
- package/docs/assets/install-via-dsh.gif +0 -0
- package/docs/verification.md +51 -0
- package/lib/client.js +628 -172
- package/lib/index.js +189 -28
- package/lib/types/adapter.d.ts +2 -3
- package/lib/types/catalog.d.ts +5 -0
- package/lib/types/client/ModelEditor.d.ts +13 -0
- package/lib/types/client/locales.d.ts +30 -0
- package/lib/types/client/section-controller.d.ts +41 -3
- package/lib/types/client/settings.d.ts +18 -0
- package/lib/types/client/staged-form.d.ts +11 -1
- package/lib/types/config.d.ts +31 -5
- package/lib/types/index.d.ts +12 -8
- package/lib/types/model-metadata.d.ts +2 -0
- package/lib/types/models-contract.d.ts +23 -0
- package/lib/types/models.d.ts +12 -0
- package/lib/types/remote-contract.d.ts +3 -0
- package/lib/types/remotes.d.ts +3 -0
- package/package.json +27 -23
package/lib/types/config.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Configuration schema for the OpenCode Go adapter plugin. The section is
|
|
3
|
-
* installed under the `llm-opencode-go` settings namespace
|
|
4
|
-
*
|
|
5
|
-
* field by field
|
|
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
6
|
* (URL shape, numeric bounds) fail at load for the composition layer and
|
|
7
7
|
* refuse the write for the settings layer.
|
|
8
8
|
*
|
|
@@ -15,6 +15,19 @@ export declare const DEFAULT_API_KEY_ENV = "OPENCODE_API_KEY";
|
|
|
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;
|
|
18
|
+
/**
|
|
19
|
+
* One model's configured capacities. Every field is optional so a deployment
|
|
20
|
+
* can override only the value it needs. Null explicitly selects the catalog
|
|
21
|
+
* value even when a lower profile/settings layer supplies an override.
|
|
22
|
+
*/
|
|
23
|
+
export interface OpencodeGoModelLimit {
|
|
24
|
+
/** Context window in tokens, overriding what the catalog advertised. */
|
|
25
|
+
contextWindow?: number | null;
|
|
26
|
+
/** Output cap per request, overriding what the catalog advertised. */
|
|
27
|
+
maxTokens?: number | null;
|
|
28
|
+
}
|
|
29
|
+
/** Per-model capacities; a null entry selects both original catalog values. */
|
|
30
|
+
export type OpencodeGoModelLimits = Record<string, OpencodeGoModelLimit | null>;
|
|
18
31
|
/** Runtime configuration for one plugin mount. */
|
|
19
32
|
export interface OpencodeGoConfig {
|
|
20
33
|
/**
|
|
@@ -25,6 +38,8 @@ export interface OpencodeGoConfig {
|
|
|
25
38
|
* false registers nothing.
|
|
26
39
|
*/
|
|
27
40
|
enabled: boolean;
|
|
41
|
+
/** Include models marked deprecated by models.dev in conversation pickers. */
|
|
42
|
+
showDeprecatedModels: boolean;
|
|
28
43
|
/** Credential reference: the environment variable the key resolves from. */
|
|
29
44
|
apiKeyEnv: string;
|
|
30
45
|
/** The gateway endpoint; also the base of the live model listing. */
|
|
@@ -39,9 +54,20 @@ export interface OpencodeGoConfig {
|
|
|
39
54
|
requestImagePixelBudget: number;
|
|
40
55
|
/** Raw encoded-byte target for one request image before base64 expansion. */
|
|
41
56
|
requestImageMaxBytes: number;
|
|
57
|
+
/** Per-model capacity overrides; an absent field inherits the catalog value. */
|
|
58
|
+
modelLimits: OpencodeGoModelLimits;
|
|
42
59
|
}
|
|
43
|
-
/**
|
|
44
|
-
export declare const
|
|
60
|
+
/** Plain values used by the adapter and by pre-0.1.7 settings documents. */
|
|
61
|
+
export declare const PlainConfig: z<OpencodeGoConfig>;
|
|
62
|
+
/** 0.1.7's Loader retains these references when profile fields change. */
|
|
63
|
+
export type LiveConfig = {
|
|
64
|
+
[K in keyof OpencodeGoConfig]: {
|
|
65
|
+
get(): OpencodeGoConfig[K];
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export declare const Config: z<Partial<OpencodeGoConfig>, LiveConfig>;
|
|
69
|
+
/** Keep the Loader's references: reparsing them would detach live updates. */
|
|
70
|
+
export declare function readConfig(config: LiveConfig): OpencodeGoConfig;
|
|
45
71
|
/**
|
|
46
72
|
* Accept only an http(s) base without a query or fragment. Runs at load for
|
|
47
73
|
* the composition layer and as the settings section's write validator, so a
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Dedicated OpenCode Go adapter plugin. Registers one `opencode-go` route
|
|
3
|
-
* whose catalog
|
|
4
|
-
*
|
|
3
|
+
* whose catalog follows the gateway's live model listing and models.dev
|
|
4
|
+
* metadata, and installs the `llm-opencode-go` settings section: the Web UI
|
|
5
5
|
* renders it as its own settings page where the API key and every knob are
|
|
6
6
|
* edited, and a change reaches the next request without a restart. The plugin
|
|
7
7
|
* exists because the gateway has wire requirements a generic pi-ai route
|
|
8
8
|
* cannot express: a mandatory per-conversation `x-opencode-session` routing
|
|
9
9
|
* header and a model list that rotates faster than any shipped catalog.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* field by field.
|
|
11
|
+
* DSH 0.1.5/0.1.6 layer the settings document over the composition entry;
|
|
12
|
+
* 0.1.7 edits live configuration fields on the profile entry directly.
|
|
14
13
|
*
|
|
15
14
|
* ```yaml
|
|
16
15
|
* - id: llm-opencode-go
|
|
@@ -32,11 +31,16 @@
|
|
|
32
31
|
* @module dsh-opencode-go
|
|
33
32
|
*/
|
|
34
33
|
import type { Context } from '@deepseek-ai/cordis';
|
|
35
|
-
import type { OpencodeGoConfig } from './config.ts';
|
|
34
|
+
import type { LiveConfig, OpencodeGoConfig } from './config.ts';
|
|
35
|
+
declare module '@deepseek-ai/cordis' {
|
|
36
|
+
interface Events {
|
|
37
|
+
'loader/volatile-update'(paths: readonly (readonly string[])[]): void;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
36
40
|
export { OpencodeGoAdapter } from './adapter.ts';
|
|
37
41
|
export type { OpencodeGoAdapterOptions, OpencodeGoImageAccess } from './adapter.ts';
|
|
38
42
|
export { DEFAULT_BASE_URL, DISPLAY_NAME, PROVIDER_ID, OpencodeGoCatalog, discoverCatalogModels, readLiveModelIds, } from './catalog.ts';
|
|
39
|
-
export { Config, assertBaseURL } from './config.ts';
|
|
43
|
+
export { Config, PlainConfig, assertBaseURL } from './config.ts';
|
|
40
44
|
export type { OpencodeGoConfig } from './config.ts';
|
|
41
45
|
export declare const name = "llm-opencode-go";
|
|
42
46
|
export declare const inject: string[];
|
|
@@ -48,4 +52,4 @@ export declare const NS = "llm-opencode-go";
|
|
|
48
52
|
* replaced by the settings section's resolved value once the settings
|
|
49
53
|
* provider attaches; the adapter re-reads it at every operation.
|
|
50
54
|
*/
|
|
51
|
-
export declare function apply(ctx: Context, raw?: OpencodeGoConfig): void;
|
|
55
|
+
export declare function apply(ctx: Context, raw?: OpencodeGoConfig | LiveConfig): void;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/** Convert OpenCode's online models.dev metadata into the SDK's three wire protocols. */
|
|
2
2
|
import type { Api, Model } from '@earendil-works/pi-ai';
|
|
3
|
+
import { type GoModel } from './models-contract.ts';
|
|
3
4
|
export declare const MODEL_METADATA_URL = "https://models.dev/api.json";
|
|
4
5
|
export interface ModelMetadata {
|
|
5
6
|
readonly models: ReadonlyMap<string, Model<Api>>;
|
|
7
|
+
readonly details: ReadonlyMap<string, Pick<GoModel, 'deprecated' | 'releaseDate'>>;
|
|
6
8
|
readonly errors: ReadonlyMap<string, string>;
|
|
7
9
|
}
|
|
8
10
|
/** Anthropic's SDK appends /v1/messages; the OpenAI SDKs append paths below /v1. */
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Settings discovery includes lifecycle data that the host's generic model DTO omits. */
|
|
2
|
+
import type { RemoteResult, TypertRemoteContribution } from '@deepseek-ai/dsh-typert-protocol';
|
|
3
|
+
export interface GoModel {
|
|
4
|
+
id: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
contextWindow?: number;
|
|
7
|
+
maxTokens?: number;
|
|
8
|
+
deprecated?: boolean;
|
|
9
|
+
releaseDate?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function validReleaseDate(value: unknown): value is string;
|
|
12
|
+
/** Calendar dates are supplied without a timezone; compare UTC dates consistently. */
|
|
13
|
+
export declare function isNewModel(model: GoModel, now?: number): boolean;
|
|
14
|
+
export declare function sortModels(models: readonly GoModel[], now?: number): GoModel[];
|
|
15
|
+
export declare function parseGoModels(value: unknown): GoModel[];
|
|
16
|
+
declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
17
|
+
interface TypertRemoteNamespaceMap {
|
|
18
|
+
opencodeGoModels: {
|
|
19
|
+
read(): Promise<RemoteResult<readonly GoModel[]>>;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export declare const modelsRemote: TypertRemoteContribution;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
3
|
+
import { type OpencodeGoCatalog } from './catalog.ts';
|
|
4
|
+
import type { GoModel } from './models-contract.ts';
|
|
5
|
+
/** Uses the same gateway snapshot as the adapter, including models hidden from pickers. */
|
|
6
|
+
export declare class GoModelsService extends TypertRemoteService {
|
|
7
|
+
private readonly options;
|
|
8
|
+
constructor(ctx: Context, options: {
|
|
9
|
+
catalog: () => OpencodeGoCatalog;
|
|
10
|
+
});
|
|
11
|
+
read(): Promise<readonly GoModel[]>;
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-opencode-go",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
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"
|
|
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"
|
|
18
18
|
},
|
|
19
19
|
"main": "./lib/index.js",
|
|
20
20
|
"types": "./lib/types/index.d.ts",
|
|
@@ -60,30 +60,30 @@
|
|
|
60
60
|
"verify:headless": "node scripts/headless-smoke.mjs"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@deepseek-ai/cordis": "4.0.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",
|
|
65
|
-
"@deepseek-ai/dsh-api-remotes": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-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",
|
|
67
|
-
"@deepseek-ai/dsh-attachment": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-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",
|
|
69
|
-
"@deepseek-ai/dsh-client-store": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-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",
|
|
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",
|
|
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",
|
|
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",
|
|
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",
|
|
75
|
-
"@deepseek-ai/dsh-credentials": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-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",
|
|
77
|
-
"@deepseek-ai/dsh-launch-environment": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-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",
|
|
79
|
-
"@deepseek-ai/dsh-settings": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-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",
|
|
81
|
-
"@deepseek-ai/dsh-typert-protocol": ">=0.1.5-rc.1 <0.1.6 || 0.1.6-alpha.1 || 0.1.6-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"
|
|
63
|
+
"@deepseek-ai/cordis": "4.0.2 || 4.0.3",
|
|
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",
|
|
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",
|
|
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",
|
|
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",
|
|
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",
|
|
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",
|
|
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",
|
|
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",
|
|
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",
|
|
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",
|
|
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",
|
|
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",
|
|
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",
|
|
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",
|
|
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",
|
|
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",
|
|
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",
|
|
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",
|
|
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"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@deepseek-ai/dsh-brand": "0.1.6-alpha.1",
|
|
86
|
-
"@deepseek-ai/schemastery": "3.18.
|
|
86
|
+
"@deepseek-ai/schemastery": "3.18.3",
|
|
87
87
|
"@earendil-works/pi-ai": "0.85.1"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
@@ -116,6 +116,7 @@
|
|
|
116
116
|
"@deepseek-ai/dsh-typert-protocol": "0.1.6-alpha.1",
|
|
117
117
|
"@deepseek-ai/dsh-typert-registry": "0.1.6-alpha.1",
|
|
118
118
|
"@shikijs/langs": "^4.3.1",
|
|
119
|
+
"@testing-library/dom": "^10.4.2",
|
|
119
120
|
"@testing-library/react": "^16.3.2",
|
|
120
121
|
"@types/mdast": "^4.0.4",
|
|
121
122
|
"@types/node": "^22.20.0",
|
|
@@ -204,5 +205,8 @@
|
|
|
204
205
|
"opencode-go",
|
|
205
206
|
"llm",
|
|
206
207
|
"cordis"
|
|
208
|
+
],
|
|
209
|
+
"workspaces": [
|
|
210
|
+
"tests/hosts/*"
|
|
207
211
|
]
|
|
208
212
|
}
|