@dan-ai-studio/dshopencodego 0.1.39 → 0.1.41
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 +2 -1
- package/README.md +2 -1
- package/lib/client.js +2 -2
- package/lib/index.js +1 -1
- package/lib/types/adapter.js +6 -6
- package/lib/types/catalog/contract.js +1 -1
- package/lib/types/catalog/gateway.js +2 -2
- package/lib/types/catalog/go-doc.js +2 -2
- package/lib/types/catalog/index.js +10 -10
- package/lib/types/catalog/metadata.d.ts +1 -1
- package/lib/types/catalog/metadata.js +2 -2
- package/lib/types/catalog/reading.js +2 -2
- package/lib/types/catalog/service.js +1 -1
- package/lib/types/config.js +1 -1
- package/lib/types/conversion/context.js +1 -1
- package/lib/types/conversion/index.js +3 -3
- package/lib/types/conversion/stream.js +1 -1
- package/lib/types/index.js +13 -13
- package/lib/types/models.js +1 -1
- package/lib/types/remotes.js +3 -3
- package/lib/types/update/index.js +5 -5
- package/lib/types/update/service.js +1 -1
- package/lib/types/usage/index.js +4 -4
- package/lib/types/usage/service.js +2 -2
- package/lib/types/usage/windows.js +1 -1
- package/package.json +10 -7
package/README.en.md
CHANGED
|
@@ -215,12 +215,13 @@ Things to keep in mind when maintaining this:
|
|
|
215
215
|
|
|
216
216
|
```sh
|
|
217
217
|
npm ci
|
|
218
|
+
npm run lint # oxlint: static checks (the release workflow runs this too, and fails on it)
|
|
218
219
|
npm run typecheck # both halves: host and client
|
|
219
220
|
npm test # contract tests against a real local HTTP mock gateway
|
|
220
221
|
npm run build # emits lib/index.js and lib/client.js
|
|
221
222
|
```
|
|
222
223
|
|
|
223
|
-
|
|
224
|
+
The suite covers configuration validation, the protocol ladder, gateway and online metadata, the catalog projection, the adapter on the wire (all three protocols), Remote contracts and services, session-header invariants, usage windows and the meter, the client controller and usage pill, both halves' mounting and registration, and several **structural invariants** (inject declarations match the source's reads, peer coverage holds both ways, the READMEs match the manifest). That is **33 test files** — a number `tests/readme-consistency.spec.ts` checks against the `tests/` directory, so it cannot drift.
|
|
224
225
|
|
|
225
226
|
## Releasing (maintainers)
|
|
226
227
|
|
package/README.md
CHANGED
|
@@ -215,12 +215,13 @@ API Key 通过 Harness 凭证库提供(引用名 `OPENCODE_GO_API_KEY`),
|
|
|
215
215
|
|
|
216
216
|
```sh
|
|
217
217
|
npm ci
|
|
218
|
+
npm run lint # oxlint:静态检查(发布流程也会跑,失败即阻断)
|
|
218
219
|
npm run typecheck # host 与 client 两半
|
|
219
220
|
npm test # 契约测试:真实 HTTP mock 网关,断言请求头/体、目录阶梯、用量
|
|
220
221
|
npm run build # 产出 lib/index.js 与 lib/client.js
|
|
221
222
|
```
|
|
222
223
|
|
|
223
|
-
|
|
224
|
+
测试覆盖配置校验、协议阶梯、网关与在线元数据、目录投影、适配器(三种协议的线上请求)、Remote 契约与服务、会话头不变量、用量窗口与计量、客户端控制器与用量组件、两半的挂载与登记、以及几条**结构性不变量**(inject 声明与源码读取一致、peer 覆盖双向、README 与 manifest 一致)。共 **33 个测试文件**——这个数字由 `tests/readme-consistency.spec.ts` 对着 `tests/` 目录校验,不会漂移。
|
|
224
225
|
|
|
225
226
|
## 发布(维护者)
|
|
226
227
|
|
package/lib/client.js
CHANGED
|
@@ -562,7 +562,7 @@ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id) + "]")
|
|
|
562
562
|
style.textContent = ".d7lz0W_root{color:var(--dsw-alias-label-primary);flex-direction:column;gap:1.25rem;display:flex}.d7lz0W_title{margin:0;font-size:1.05rem}.d7lz0W_hint{color:var(--dsw-alias-label-secondary);margin:0;font-size:.8rem}.d7lz0W_warn{color:var(--dsw-alias-state-warn-primary);margin:0;font-size:.8rem}.d7lz0W_ok{color:var(--dsw-alias-state-success-primary);font-size:.8rem}.d7lz0W_block{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:.6rem;flex-direction:column;gap:.5rem;padding:.85rem;display:flex}.d7lz0W_row{flex-wrap:wrap;align-items:center;gap:.5rem;display:flex}.d7lz0W_row>strong{margin-right:auto}.d7lz0W_input{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);min-width:10rem;color:var(--dsw-alias-label-primary);font:inherit;border-radius:.35rem;flex:14rem;padding:.35rem .5rem;font-size:.85rem}.d7lz0W_button{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border-radius:.35rem;padding:.35rem .7rem;font-size:.8rem}.d7lz0W_button:disabled{color:var(--dsw-alias-state-idle-primary);cursor:default}.d7lz0W_number{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);width:5rem;color:var(--dsw-alias-label-primary);font:inherit;border-radius:.35rem;padding:.25rem .4rem;font-size:.8rem}.d7lz0W_select{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);width:auto;max-width:100%;color:var(--dsw-alias-label-primary);font:inherit;border-radius:.35rem;padding:.25rem .4rem;font-size:.8rem}.d7lz0W_list{flex-direction:column;display:flex}.d7lz0W_item{border-top:1px solid var(--dsw-alias-border-l1);align-items:flex-start;gap:.5rem;padding:.45rem .15rem;display:flex}.d7lz0W_item input[type=checkbox]{accent-color:var(--dsw-alias-brand-primary);margin-top:.15rem}.d7lz0W_itemBody{flex-direction:column;gap:.15rem;min-width:0;display:flex}.d7lz0W_itemMain{flex-wrap:wrap;align-items:baseline;gap:.6rem;display:flex}.d7lz0W_itemMeta{color:var(--dsw-alias-label-secondary);flex-wrap:wrap;gap:.75rem;font-size:.75rem;display:flex}.d7lz0W_itemModalities{color:var(--dsw-alias-label-secondary);font-size:.75rem}.d7lz0W_name{color:var(--dsw-alias-label-primary)}.d7lz0W_mono{color:var(--dsw-alias-label-secondary);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.d7lz0W_badge{color:var(--dsw-alias-brand-primary)}";
|
|
563
563
|
document.head.appendChild(style);
|
|
564
564
|
}
|
|
565
|
-
var section_default = { "
|
|
565
|
+
var section_default = { "badge": "d7lz0W_badge", "block": "d7lz0W_block", "button": "d7lz0W_button", "hint": "d7lz0W_hint", "input": "d7lz0W_input", "item": "d7lz0W_item", "itemBody": "d7lz0W_itemBody", "itemMain": "d7lz0W_itemMain", "itemMeta": "d7lz0W_itemMeta", "itemModalities": "d7lz0W_itemModalities", "list": "d7lz0W_list", "mono": "d7lz0W_mono", "name": "d7lz0W_name", "number": "d7lz0W_number", "ok": "d7lz0W_ok", "root": "d7lz0W_root", "row": "d7lz0W_row", "select": "d7lz0W_select", "title": "d7lz0W_title", "warn": "d7lz0W_warn" };
|
|
566
566
|
|
|
567
567
|
// src/client/Section.tsx
|
|
568
568
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -1335,7 +1335,7 @@ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id2) + "]"
|
|
|
1335
1335
|
style.textContent = ".mMNkkW_root{align-items:center;display:inline-flex;position:relative}.mMNkkW_trigger{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;white-space:nowrap;border-radius:999px;padding:.35rem .6rem;font-size:.8rem;line-height:1}.mMNkkW_trigger:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l2)}.mMNkkW_panel{z-index:20;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-overlay);width:18rem;color:var(--dsw-alias-label-primary);border-radius:.6rem;flex-direction:column;gap:.6rem;padding:.75rem .85rem;display:flex;position:absolute;bottom:calc(100% + .5rem);right:0;box-shadow:0 8px 24px #0000002e}.mMNkkW_window{flex-direction:column;gap:.25rem;display:flex}.mMNkkW_row{justify-content:space-between;gap:.5rem;font-size:.85rem;display:flex}.mMNkkW_hint{color:var(--dsw-alias-label-secondary);margin:0;font-size:.75rem}.mMNkkW_progress{width:100%;height:.35rem;accent-color:var(--dsw-alias-brand-primary)}.mMNkkW_limited{color:var(--dsw-alias-state-warn-primary);font-size:.75rem}.mMNkkW_warning{border:1px solid var(--dsw-alias-state-warn-primary);color:var(--dsw-alias-label-primary);border-radius:.4rem;padding:.4rem .5rem;font-size:.75rem}.mMNkkW_retry{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border-radius:.35rem;align-self:flex-start;padding:.25rem .5rem;font-size:.75rem}.mMNkkW_local{border-top:1px solid var(--dsw-alias-border-l1);flex-direction:column;gap:.2rem;padding-top:.5rem;display:flex}";
|
|
1336
1336
|
document.head.appendChild(style);
|
|
1337
1337
|
}
|
|
1338
|
-
var pill_default = { "hint": "mMNkkW_hint", "
|
|
1338
|
+
var pill_default = { "hint": "mMNkkW_hint", "limited": "mMNkkW_limited", "local": "mMNkkW_local", "panel": "mMNkkW_panel", "progress": "mMNkkW_progress", "retry": "mMNkkW_retry", "root": "mMNkkW_root", "row": "mMNkkW_row", "trigger": "mMNkkW_trigger", "warning": "mMNkkW_warning", "window": "mMNkkW_window" };
|
|
1339
1339
|
|
|
1340
1340
|
// src/client/UsagePill.tsx
|
|
1341
1341
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
package/lib/index.js
CHANGED
|
@@ -45505,7 +45505,7 @@ function createUpdateChecker(deps) {
|
|
|
45505
45505
|
}
|
|
45506
45506
|
|
|
45507
45507
|
// src/update/version.ts
|
|
45508
|
-
var PLUGIN_VERSION = true ? "0.1.
|
|
45508
|
+
var PLUGIN_VERSION = true ? "0.1.41" : "0.0.0-dev";
|
|
45509
45509
|
|
|
45510
45510
|
// src/update/service.ts
|
|
45511
45511
|
import { TypertRemoteService as TypertRemoteService2 } from "@deepseek-ai/dsh-typert-protocol";
|
package/lib/types/adapter.js
CHANGED
|
@@ -70,12 +70,12 @@ import { getSupportedThinkingLevels } from '@earendil-works/pi-ai/models';
|
|
|
70
70
|
import { normalizeContext } from '@earendil-works/pi-ai/utils/transcript';
|
|
71
71
|
import { attributionHeaders, contentHasImage, LlmAdapter, LlmError, ReasoningEffortId, resolveRetryPolicy, } from '@deepseek-ai/dsh-llm';
|
|
72
72
|
import { idleWatchdog, timeoutOf } from '@deepseek-ai/dsh-timeout';
|
|
73
|
-
import { DISPLAY_NAME, PROVIDER_ID, OpencodeGoCatalog } from
|
|
74
|
-
import { toPiModel } from
|
|
75
|
-
import { assertBaseURL } from
|
|
76
|
-
import { toPiContext, toStreamChunks } from
|
|
77
|
-
import { isModelEnabled, recommendedIds } from
|
|
78
|
-
import { providerHeaders } from
|
|
73
|
+
import { DISPLAY_NAME, PROVIDER_ID, OpencodeGoCatalog } from './catalog/index.js';
|
|
74
|
+
import { toPiModel } from './catalog/metadata.js';
|
|
75
|
+
import { assertBaseURL } from './config.js';
|
|
76
|
+
import { toPiContext, toStreamChunks } from './conversion/index.js';
|
|
77
|
+
import { isModelEnabled, recommendedIds } from './models.js';
|
|
78
|
+
import { providerHeaders } from './session-header.js';
|
|
79
79
|
/**
|
|
80
80
|
* pi-ai thinking formats that answer an unset effort with an explicit disable.
|
|
81
81
|
* Every other format omits the parameter and lets the provider decide, so only
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @module @dan-ai-studio/dshopencodego/catalog/contract
|
|
11
11
|
*/
|
|
12
|
-
import { INPUT_MODALITIES } from
|
|
12
|
+
import { INPUT_MODALITIES } from './metadata.js';
|
|
13
13
|
function parseGoQuota(value) {
|
|
14
14
|
if (value === null || typeof value !== 'object')
|
|
15
15
|
throw new Error('invalid go quota');
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* @module @dan-ai-studio/dshopencodego/catalog/gateway
|
|
9
9
|
*/
|
|
10
10
|
import { attributionHeaders, LlmError } from '@deepseek-ai/dsh-llm';
|
|
11
|
-
import { MODEL_LISTING_MAX_BYTES, METADATA_FETCH_TIMEOUT_MS } from
|
|
12
|
-
import { readBoundedJson } from
|
|
11
|
+
import { MODEL_LISTING_MAX_BYTES, METADATA_FETCH_TIMEOUT_MS } from './constants.js';
|
|
12
|
+
import { readBoundedJson } from './json-response.js';
|
|
13
13
|
/** Read the ids out of a model-listing body. */
|
|
14
14
|
export function readModelIds(body) {
|
|
15
15
|
const data = body?.data;
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* @module @dan-ai-studio/dshopencodego/catalog/go-doc
|
|
15
15
|
*/
|
|
16
16
|
import { attributionHeaders, LlmError } from '@deepseek-ai/dsh-llm';
|
|
17
|
-
import { METADATA_FETCH_TIMEOUT_MS } from
|
|
18
|
-
import { readBoundedText } from
|
|
17
|
+
import { METADATA_FETCH_TIMEOUT_MS } from './constants.js';
|
|
18
|
+
import { readBoundedText } from './json-response.js';
|
|
19
19
|
/**
|
|
20
20
|
* Documentation sources, tried in order.
|
|
21
21
|
*
|
|
@@ -29,16 +29,16 @@ import { anthropicMessagesApi } from '@earendil-works/pi-ai/api/anthropic-messag
|
|
|
29
29
|
import { openAICompletionsApi } from '@earendil-works/pi-ai/api/openai-completions.lazy';
|
|
30
30
|
import { openAIResponsesApi } from '@earendil-works/pi-ai/api/openai-responses.lazy';
|
|
31
31
|
import { attributionHeaders, LlmError } from '@deepseek-ai/dsh-llm';
|
|
32
|
-
import { DISPLAY_NAME, MODEL_METADATA_MAX_BYTES, MODEL_METADATA_URL, PROVIDER_ID, METADATA_FETCH_TIMEOUT_MS, } from
|
|
33
|
-
import { fetchModelIds } from
|
|
34
|
-
import { fetchGoDocument, GO_DOC_URLS } from
|
|
35
|
-
import { readBoundedJson } from
|
|
36
|
-
import { readOnlineMetadata, toPiModel } from
|
|
37
|
-
import { asWireProtocol } from
|
|
38
|
-
export { PROVIDER_ID, DISPLAY_NAME, DEFAULT_BASE_URL, CONSOLE_BASE_URL } from
|
|
39
|
-
export { readModelIds, fetchModelIds } from
|
|
40
|
-
export { readOnlineMetadata, toPiModel, modelBaseURL } from
|
|
41
|
-
export { decideProtocol, inferProtocol, protocolOfNpm } from
|
|
32
|
+
import { DISPLAY_NAME, MODEL_METADATA_MAX_BYTES, MODEL_METADATA_URL, PROVIDER_ID, METADATA_FETCH_TIMEOUT_MS, } from './constants.js';
|
|
33
|
+
import { fetchModelIds } from './gateway.js';
|
|
34
|
+
import { fetchGoDocument, GO_DOC_URLS } from './go-doc.js';
|
|
35
|
+
import { readBoundedJson } from './json-response.js';
|
|
36
|
+
import { readOnlineMetadata, toPiModel } from './metadata.js';
|
|
37
|
+
import { asWireProtocol } from './protocol.js';
|
|
38
|
+
export { PROVIDER_ID, DISPLAY_NAME, DEFAULT_BASE_URL, CONSOLE_BASE_URL } from './constants.js';
|
|
39
|
+
export { readModelIds, fetchModelIds } from './gateway.js';
|
|
40
|
+
export { readOnlineMetadata, toPiModel, modelBaseURL } from './metadata.js';
|
|
41
|
+
export { decideProtocol, inferProtocol, protocolOfNpm } from './protocol.js';
|
|
42
42
|
/**
|
|
43
43
|
* The installed catalog, re-pointed at the configured gateway.
|
|
44
44
|
*
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import type { Api, Model, ModelCost, ThinkingLevelMap } from '@earendil-works/pi-ai';
|
|
18
18
|
import type { ProtocolSource, WireProtocol } from './protocol.ts';
|
|
19
19
|
/** Input modalities this build can name, in display order. */
|
|
20
|
-
export declare const INPUT_MODALITIES: readonly [
|
|
20
|
+
export declare const INPUT_MODALITIES: readonly ['text', 'image', 'audio', 'video', 'pdf'];
|
|
21
21
|
/** One input modality a model document may declare. */
|
|
22
22
|
export type InputModality = (typeof INPUT_MODALITIES)[number];
|
|
23
23
|
/** Everything this plugin knows about one advertised model. */
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @module @dan-ai-studio/dshopencodego/catalog/metadata
|
|
16
16
|
*/
|
|
17
|
-
import { asWireProtocol, decideProtocol, protocolOfNpm } from
|
|
18
|
-
import { MODEL_METADATA_PROVIDER } from
|
|
17
|
+
import { asWireProtocol, decideProtocol, protocolOfNpm } from './protocol.js';
|
|
18
|
+
import { MODEL_METADATA_PROVIDER } from './constants.js';
|
|
19
19
|
/** Input modalities this build can name, in display order. */
|
|
20
20
|
export const INPUT_MODALITIES = ['text', 'image', 'audio', 'video', 'pdf'];
|
|
21
21
|
const LEVELS = ['off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @module @dan-ai-studio/dshopencodego/catalog/reading
|
|
11
11
|
*/
|
|
12
|
-
import { isModelEnabled, recommendedIds, sortModels } from
|
|
13
|
-
import { goQuotaFor } from
|
|
12
|
+
import { isModelEnabled, recommendedIds, sortModels } from '../models.js';
|
|
13
|
+
import { goQuotaFor } from '../go-limits.js';
|
|
14
14
|
/**
|
|
15
15
|
* Project one snapshot for the settings page.
|
|
16
16
|
* @param snapshot - the catalog snapshot, live or retained.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { RemoteError, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
11
11
|
import { LlmError } from '@deepseek-ai/dsh-llm';
|
|
12
|
-
import { catalogReading } from
|
|
12
|
+
import { catalogReading } from './reading.js';
|
|
13
13
|
/** Catalog Remote: what the gateway serves, and how each model is called. */
|
|
14
14
|
export class OpencodeGoCatalogService extends TypertRemoteService {
|
|
15
15
|
options;
|
package/lib/types/config.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import { RetryPolicySchema } from '@deepseek-ai/dsh-llm';
|
|
15
15
|
import { MAX_TIMER_DELAY_MS } from '@deepseek-ai/dsh-timeout';
|
|
16
16
|
import z from '@deepseek-ai/schemastery';
|
|
17
|
-
import { DEFAULT_BASE_URL } from
|
|
17
|
+
import { DEFAULT_BASE_URL } from './catalog/constants.js';
|
|
18
18
|
/** Credential reference resolving the OpenCode Go API key. */
|
|
19
19
|
export const DEFAULT_API_KEY_ENV = 'OPENCODE_GO_API_KEY';
|
|
20
20
|
/** Requests and pickers share this cache lifetime; explicit discovery revalidates immediately. */
|
|
@@ -25,7 +25,7 @@ import { brandString } from '@deepseek-ai/dsh-brand';
|
|
|
25
25
|
import * as llm from '@deepseek-ai/dsh-llm';
|
|
26
26
|
import { contentHasImage, LlmError, requestImageHandleText } from '@deepseek-ai/dsh-llm';
|
|
27
27
|
import { requestImageDimensions } from '@deepseek-ai/dsh-attachment';
|
|
28
|
-
import { toPiAssistant } from
|
|
28
|
+
import { toPiAssistant } from './replay.js';
|
|
29
29
|
/** Join the text blocks of one Harness message. */
|
|
30
30
|
function flattenText(message) {
|
|
31
31
|
return message.content.filter(block => block.type === 'text').map(block => block.text).join('');
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Harness ⇄ pi-ai conversion.
|
|
3
3
|
* @module @dan-ai-studio/dshopencodego/conversion
|
|
4
4
|
*/
|
|
5
|
-
export { toPiContext } from
|
|
6
|
-
export { classifyPiAiError, mapStopReason, mapUsage, toStreamChunks } from
|
|
7
|
-
export { toPiAssistant, toPiReplayState } from
|
|
5
|
+
export { toPiContext } from './context.js';
|
|
6
|
+
export { classifyPiAiError, mapStopReason, mapUsage, toStreamChunks } from './stream.js';
|
|
7
|
+
export { toPiAssistant, toPiReplayState } from './replay.js';
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { brandString } from '@deepseek-ai/dsh-brand';
|
|
11
11
|
import { CONTEXT_WINDOW_EXCEEDED_CODE, EMPTY_RESPONSE_CODE, isContextWindowExceededError, isQuotaExceededError, LlmError, } from '@deepseek-ai/dsh-llm';
|
|
12
12
|
import { isContextOverflow } from '@earendil-works/pi-ai/utils/overflow';
|
|
13
|
-
import { toPiReplayState } from
|
|
13
|
+
import { toPiReplayState } from './replay.js';
|
|
14
14
|
/**
|
|
15
15
|
* Map pi-ai usage (reasoning already folded into output).
|
|
16
16
|
* @param usage - the terminal event's cumulative usage.
|
package/lib/types/index.js
CHANGED
|
@@ -31,19 +31,19 @@ import { credentialRef } from '@deepseek-ai/dsh-credentials';
|
|
|
31
31
|
import { launchEnvironmentOf } from '@deepseek-ai/dsh-launch-environment';
|
|
32
32
|
import * as llm from '@deepseek-ai/dsh-llm';
|
|
33
33
|
import { LlmError } from '@deepseek-ai/dsh-llm';
|
|
34
|
-
import { OpencodeGoAdapter } from
|
|
35
|
-
import { DISPLAY_NAME, PROVIDER_ID, discoverCatalogModels } from
|
|
36
|
-
import { assertBaseURL, PlainConfig, readConfig } from
|
|
37
|
-
import { registerRemotes } from
|
|
38
|
-
import { OpencodeGoCatalogService } from
|
|
39
|
-
import { OpencodeGoUpdateService } from
|
|
40
|
-
import { PLUGIN_VERSION } from
|
|
41
|
-
import { OpencodeGoUsageService, UsageMeter } from
|
|
42
|
-
export { OpencodeGoAdapter } from
|
|
43
|
-
export { DEFAULT_BASE_URL, CONSOLE_BASE_URL, DISPLAY_NAME, PROVIDER_ID, OpencodeGoCatalog, discoverCatalogModels } from
|
|
44
|
-
export { Config, PlainConfig, assertBaseURL, DEFAULT_API_KEY_ENV } from
|
|
45
|
-
export { SESSION_HEADER, SESSION_AFFINITY_HEADER, opencodeSessionValue, providerHeaders } from
|
|
46
|
-
export { isModelEnabled, sortModels } from
|
|
34
|
+
import { OpencodeGoAdapter } from './adapter.js';
|
|
35
|
+
import { DISPLAY_NAME, PROVIDER_ID, discoverCatalogModels } from './catalog/index.js';
|
|
36
|
+
import { assertBaseURL, PlainConfig, readConfig } from './config.js';
|
|
37
|
+
import { registerRemotes } from './remotes.js';
|
|
38
|
+
import { OpencodeGoCatalogService } from './catalog/service.js';
|
|
39
|
+
import { OpencodeGoUpdateService } from './update/index.js';
|
|
40
|
+
import { PLUGIN_VERSION } from './update/index.js';
|
|
41
|
+
import { OpencodeGoUsageService, UsageMeter } from './usage/index.js';
|
|
42
|
+
export { OpencodeGoAdapter } from './adapter.js';
|
|
43
|
+
export { DEFAULT_BASE_URL, CONSOLE_BASE_URL, DISPLAY_NAME, PROVIDER_ID, OpencodeGoCatalog, discoverCatalogModels } from './catalog/index.js';
|
|
44
|
+
export { Config, PlainConfig, assertBaseURL, DEFAULT_API_KEY_ENV } from './config.js';
|
|
45
|
+
export { SESSION_HEADER, SESSION_AFFINITY_HEADER, opencodeSessionValue, providerHeaders } from './session-header.js';
|
|
46
|
+
export { isModelEnabled, sortModels } from './models.js';
|
|
47
47
|
export const name = 'dshopencodego';
|
|
48
48
|
export const inject = ['llm'];
|
|
49
49
|
/** True when a loader handed this plugin its live field references. */
|
package/lib/types/models.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module @dan-ai-studio/dshopencodego/models
|
|
10
10
|
*/
|
|
11
|
-
import { goQuotaFor, monthlyRequestsRank } from
|
|
11
|
+
import { goQuotaFor, monthlyRequestsRank } from './go-limits.js';
|
|
12
12
|
/** How many models the default configuration keeps enabled. */
|
|
13
13
|
export const DEFAULT_ENABLED_COUNT = 5;
|
|
14
14
|
/**
|
package/lib/types/remotes.js
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module @dan-ai-studio/dshopencodego/remotes
|
|
9
9
|
*/
|
|
10
|
-
import { catalogRemote } from
|
|
11
|
-
import { updateRemote } from
|
|
12
|
-
import { usageRemote } from
|
|
10
|
+
import { catalogRemote } from './catalog/contract.js';
|
|
11
|
+
import { updateRemote } from './update/contract.js';
|
|
12
|
+
import { usageRemote } from './usage/contract.js';
|
|
13
13
|
/** Every Remote method this package owns, mounted as one contribution. */
|
|
14
14
|
const contribution = {
|
|
15
15
|
package: usageRemote.package,
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module @dan-ai-studio/dshopencodego/update
|
|
5
5
|
*/
|
|
6
|
-
export { PACKAGE_NAME, REGISTRY_LATEST_URL, CHECK_CACHE_MS, CHECK_TIMEOUT_MS } from
|
|
7
|
-
export { compareVersions, createUpdateChecker, isUpdateAvailable, parseLatestVersion, parseVersion } from
|
|
8
|
-
export { PLUGIN_VERSION } from
|
|
9
|
-
export { OpencodeGoUpdateService } from
|
|
10
|
-
export { parseUpdateStatus, updateRemote } from
|
|
6
|
+
export { PACKAGE_NAME, REGISTRY_LATEST_URL, CHECK_CACHE_MS, CHECK_TIMEOUT_MS } from './check.js';
|
|
7
|
+
export { compareVersions, createUpdateChecker, isUpdateAvailable, parseLatestVersion, parseVersion } from './check.js';
|
|
8
|
+
export { PLUGIN_VERSION } from './version.js';
|
|
9
|
+
export { OpencodeGoUpdateService } from './service.js';
|
|
10
|
+
export { parseUpdateStatus, updateRemote } from './contract.js';
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* @module @dan-ai-studio/dshopencodego/update/service
|
|
13
13
|
*/
|
|
14
14
|
import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
15
|
-
import { createUpdateChecker } from
|
|
15
|
+
import { createUpdateChecker } from './check.js';
|
|
16
16
|
/** Update Remote: the cached registry reading for the settings page. */
|
|
17
17
|
export class OpencodeGoUpdateService extends TypertRemoteService {
|
|
18
18
|
check;
|
package/lib/types/usage/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Usage readings for the `opencode-go` route.
|
|
3
3
|
* @module @dan-ai-studio/dshopencodego/usage
|
|
4
4
|
*/
|
|
5
|
-
export { UsageMeter } from
|
|
6
|
-
export { parseGoUsage, readUsageWindows } from
|
|
7
|
-
export { parseGoMeter, parseUsageWindows, usageRemote } from
|
|
8
|
-
export { OpencodeGoUsageService } from
|
|
5
|
+
export { UsageMeter } from './meter.js';
|
|
6
|
+
export { parseGoUsage, readUsageWindows } from './windows.js';
|
|
7
|
+
export { parseGoMeter, parseUsageWindows, usageRemote } from './contract.js';
|
|
8
|
+
export { OpencodeGoUsageService } from './service.js';
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
import { randomUUID } from 'node:crypto';
|
|
13
13
|
import { RemoteError, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
14
14
|
import { LlmError } from '@deepseek-ai/dsh-llm';
|
|
15
|
-
import { assertBaseURL } from
|
|
16
|
-
import { readUsageWindows } from
|
|
15
|
+
import { assertBaseURL } from '../config.js';
|
|
16
|
+
import { readUsageWindows } from './windows.js';
|
|
17
17
|
/**
|
|
18
18
|
* Decide what one failed read means for the client.
|
|
19
19
|
*
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @module @dan-ai-studio/dshopencodego/usage/windows
|
|
11
11
|
*/
|
|
12
12
|
import { attributionHeaders, LlmError } from '@deepseek-ai/dsh-llm';
|
|
13
|
-
import { readBoundedJson } from
|
|
13
|
+
import { readBoundedJson } from '../catalog/json-response.js';
|
|
14
14
|
/** Response cap: this document is a few hundred bytes. */
|
|
15
15
|
const USAGE_MAX_BYTES = 1024 * 1024;
|
|
16
16
|
/** Timeout for one usage read. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dan-ai-studio/dshopencodego",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.41",
|
|
4
4
|
"description": "OpenCode Go provider for DeepSeek Harness: live gateway catalog, per-conversation session header, usage",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,6 +58,8 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
|
+
"lint": "oxlint",
|
|
62
|
+
"lint:fix": "oxlint --fix",
|
|
61
63
|
"build": "node scripts/build.mjs",
|
|
62
64
|
"typecheck": "tsc -p tsconfig.host.json --noEmit && tsc -p tsconfig.client.json --noEmit && tsc -p tsconfig.tests.json --noEmit",
|
|
63
65
|
"test": "vitest run",
|
|
@@ -129,21 +131,22 @@
|
|
|
129
131
|
"@deepseek-ai/dsh-timeout": "0.2.1-alpha.5",
|
|
130
132
|
"@deepseek-ai/dsh-typert-protocol": "0.2.1-alpha.5",
|
|
131
133
|
"@deepseek-ai/dsh-typert-registry": "0.2.1-alpha.5",
|
|
134
|
+
"@deepseek-ai/schemastery": "~3.18.5-alpha.2",
|
|
135
|
+
"@earendil-works/pi-ai": "~1.3.0",
|
|
132
136
|
"@testing-library/dom": "^10.4.1",
|
|
133
137
|
"@testing-library/react": "^16.3.0",
|
|
134
138
|
"@types/node": "^22.20.0",
|
|
135
139
|
"@types/react": "~18.3.1",
|
|
136
140
|
"@types/react-dom": "~18.3.0",
|
|
137
|
-
"@vitest/coverage-v8": "^
|
|
141
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
138
142
|
"esbuild": "^0.28.2",
|
|
139
|
-
"jsdom": "^
|
|
143
|
+
"jsdom": "^30.1.3",
|
|
140
144
|
"lightningcss": "^1.32.0",
|
|
145
|
+
"oxlint": "^1.88.0",
|
|
141
146
|
"react": "^18.3.1",
|
|
142
147
|
"react-dom": "^18.3.1",
|
|
143
|
-
"typescript": "^
|
|
144
|
-
"vitest": "^
|
|
145
|
-
"@earendil-works/pi-ai": "~1.3.0",
|
|
146
|
-
"@deepseek-ai/schemastery": "~3.18.5-alpha.2"
|
|
148
|
+
"typescript": "^7.0.2",
|
|
149
|
+
"vitest": "^5.0.5"
|
|
147
150
|
},
|
|
148
151
|
"keywords": [
|
|
149
152
|
"deepseek-harness",
|