@dan-ai-studio/dshopencodego 0.1.70 → 0.1.72
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 +0 -3
- package/README.md +0 -3
- package/lib/client.js +0 -39
- package/lib/index.js +9 -35
- package/lib/types/config.d.ts +0 -8
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -101,7 +101,6 @@ Configuration lives in the profile's `cordis.patch.yml`:
|
|
|
101
101
|
# the timer restarts on every answer, so a connection in
|
|
102
102
|
# frequent use is never dropped; a long pause in a
|
|
103
103
|
# conversation costs one handshake (about 200ms)
|
|
104
|
-
requestGzip: true # gzip JSON request bodies of 1 KB or more; turn off if the gateway rejects them
|
|
105
104
|
maxRequestImageBytes: 6291456 # whole-request image payload cap (after base64, bytes)
|
|
106
105
|
requestImagePixelBudget: 1440000 # total-pixel budget for one image
|
|
107
106
|
requestImageMaxBytes: 400000 # encoded-byte target for one image (before base64)
|
|
@@ -142,8 +141,6 @@ The API key comes from the Harness credential store (reference name `OPENCODE_GO
|
|
|
142
141
|
- The settings page shows and accepts the value in **seconds** (a number of milliseconds is not readable at a glance) and stores it in milliseconds. Range: 1 to 1800000 milliseconds.
|
|
143
142
|
- Once a connection has been idle that long, the pool **reclaims it** on its own — no separate mechanism is needed. The actual release comes a couple of seconds later than the setting, which is the client's own small margin beyond the deadline the server states. When the plugin is unloaded, the pool is **closed with it**: the pool belongs to the plugin and should not be left behind on the machine.
|
|
144
143
|
|
|
145
|
-
**Request body gzip**: `requestGzip` is on by default; JSON bodies of 1 KB or more are gzipped (fastest level, off the event loop) with a `Content-Encoding: gzip` header, smaller bodies travel plain. The log's body size is the **actual wire bytes** — compare the same large request with the switch on and off to see what it saved. **If the gateway does not accept gzip it fails requests outright; turn the switch off** (one setting, no other coupling).
|
|
146
|
-
|
|
147
144
|
**Request log**: per-request records, on by default; turning them off returns the request path to exactly as without the log. The settings page's "Request log" group holds the master switch, the debug switch (pool events and the request user agent, default off), and the retention count (default 200).
|
|
148
145
|
|
|
149
146
|
- **Two entries, one page**:
|
package/README.md
CHANGED
|
@@ -100,7 +100,6 @@ DSH 桌面端是 Electron 壳 + 完整的 dsh Web 应用,本插件对它同样
|
|
|
100
100
|
keepAliveTimeoutMs: 600000 # 连接空闲保留:两次请求之间连接留多久(毫秒,1 ~ 1800000)
|
|
101
101
|
# 每次收到回答后重新计时,所以常用时连接不会被断开;
|
|
102
102
|
# 对话中每次停顿较久都要重新握手一次(约 200ms)
|
|
103
|
-
requestGzip: true # 1KB 以上的 JSON 请求体先 gzip 再发;网关如果拒绝就关掉它
|
|
104
103
|
maxRequestImageBytes: 6291456 # 整个请求的图片载荷上限(base64 之后,字节)
|
|
105
104
|
requestImagePixelBudget: 1440000 # 单张图的总像素预算
|
|
106
105
|
requestImageMaxBytes: 400000 # 单张图编码前的字节目标(base64 之前)
|
|
@@ -136,8 +135,6 @@ API Key 通过 Harness 凭证库提供(引用名 `OPENCODE_GO_API_KEY`),
|
|
|
136
135
|
|
|
137
136
|
**连接保留**:`keepAliveTimeoutMs` 决定**与网关的连接在两次请求之间保留多久**。计时器**每次收到回答后重新开始**,所以常用时连接不会被断开,它约束的只是两次请求之间的静默。默认 10 分钟。
|
|
138
137
|
|
|
139
|
-
**请求体压缩**:`requestGzip` 默认开启,1KB 以上的 JSON 请求先 gzip(最快档,异步压,不堵事件循环)再发,`Content-Encoding: gzip` 随行;1KB 以下原样走(压了也省不出什么)。日志里"请求体"记的是** wire 上的实际字节**——同一条大请求,开关两边对比一下就知道压了多少。**网关如果不吃 gzip 会直接 4xx,那时关掉这个开关就行**(一处配置,没有别的连带)。
|
|
140
|
-
|
|
141
138
|
- 背后的原因很实际:连接一旦被断开,下一次请求要重新做一次 TCP 与 TLS 握手,**到网关这一侧约 200 毫秒**,而这笔开销正好落在**下一轮的第一个 token 上**。对话里的停顿(读答案、思考、再打字)通常在 5 ~ 30 秒,正好跨过 HTTP 客户端默认的 4 秒,于是**几乎每一轮都在白付一次握手**。
|
|
142
139
|
- 这条只影响**固定了地址**(`pinnedAddresses`)的部署:没有固定地址时走的是系统自己的 fetch,本插件不加任何东西。
|
|
143
140
|
- 设置页里以**秒**显示与填写(毫秒的数字人读不出量级),存储时换算成毫秒。取值 1 ~ 1800000 毫秒。
|
package/lib/client.js
CHANGED
|
@@ -506,8 +506,6 @@ var en = {
|
|
|
506
506
|
refreshHint: "How long requests and the model picker reuse one listing.",
|
|
507
507
|
keepAliveLabel: "Connection kept idle (seconds)",
|
|
508
508
|
keepAliveHint: "How long a connection to the gateway is held between requests. Longer pauses in a conversation cost one handshake each; the timer restarts on every answer.",
|
|
509
|
-
requestGzipLabel: "Gzip request bodies",
|
|
510
|
-
requestGzipHint: "Compress JSON bodies of 1 KB or more before sending. Turn off if the gateway rejects requests.",
|
|
511
509
|
requestLogTitle: "Request log",
|
|
512
510
|
requestLogHint: "Per-request records for troubleshooting. On by default; turning it off returns the request path to exactly as without the log.",
|
|
513
511
|
requestLogPageHint: "One row per request. Click a column head to sort; the table scrolls and the filters stay put.",
|
|
@@ -698,8 +696,6 @@ var zh = {
|
|
|
698
696
|
refreshHint: "\u8BF7\u6C42\u4E0E\u6A21\u578B\u9009\u62E9\u5668\u590D\u7528\u540C\u4E00\u4EFD\u5217\u8868\u7684\u65F6\u957F\u3002",
|
|
699
697
|
keepAliveLabel: "\u8FDE\u63A5\u7A7A\u95F2\u4FDD\u7559\uFF08\u79D2\uFF09",
|
|
700
698
|
keepAliveHint: "\u4E0E\u7F51\u5173\u7684\u8FDE\u63A5\u5728\u4E24\u6B21\u8BF7\u6C42\u4E4B\u95F4\u4FDD\u7559\u591A\u4E45\u3002\u5BF9\u8BDD\u4E2D\u6BCF\u6B21\u505C\u987F\u8F83\u4E45\u90FD\u8981\u91CD\u65B0\u63E1\u624B\u4E00\u6B21\uFF1B\u6BCF\u6B21\u6536\u5230\u56DE\u7B54\u540E\u8BA1\u65F6\u90FD\u4F1A\u91CD\u65B0\u5F00\u59CB\u3002",
|
|
701
|
-
requestGzipLabel: "\u8BF7\u6C42\u4F53 gzip \u538B\u7F29",
|
|
702
|
-
requestGzipHint: "1KB \u4EE5\u4E0A\u7684 JSON \u8BF7\u6C42\u4F53\u5148\u538B\u7F29\u518D\u53D1\uFF1B\u7F51\u5173\u5982\u679C\u62D2\u7EDD\u8BF7\u6C42\u5C31\u5173\u6389\u5B83\u3002",
|
|
703
699
|
requestLogTitle: "\u8BF7\u6C42\u65E5\u5FD7",
|
|
704
700
|
requestLogHint: "\u6392\u67E5\u7528\u7684\u9010\u8BF7\u6C42\u8BB0\u5F55\u3002\u9ED8\u8BA4\u5F00\u542F\uFF1B\u5173\u95ED\u540E\u8BF7\u6C42\u8DEF\u5F84\u4E0E\u6CA1\u6709\u8BE5\u65E5\u5FD7\u9010\u5B57\u8282\u4E00\u81F4\u3002",
|
|
705
701
|
requestLogPageHint: "\u6BCF\u4E2A\u8BF7\u6C42\u4E00\u884C\u3002\u70B9\u5217\u5934\u53EF\u6392\u5E8F\uFF1B\u8868\u683C\u6EDA\u52A8\uFF0C\u7B5B\u9009\u680F\u56FA\u5B9A\u5728\u4E0A\u65B9\u3002",
|
|
@@ -1035,13 +1031,11 @@ function settingsOf(value) {
|
|
|
1035
1031
|
const requestLogEnabled = record["requestLogEnabled"];
|
|
1036
1032
|
const requestLogDebug = record["requestLogDebug"];
|
|
1037
1033
|
const requestLogMaxEntries = record["requestLogMaxEntries"];
|
|
1038
|
-
const requestGzip = record["requestGzip"];
|
|
1039
1034
|
return {
|
|
1040
1035
|
modelVisibility: Object.fromEntries(entries),
|
|
1041
1036
|
refreshMinutes: minutes,
|
|
1042
1037
|
pinnedAddresses: Object.fromEntries(pinEntries),
|
|
1043
1038
|
keepAliveTimeoutMs: typeof keepAlive === "number" ? keepAlive : DEFAULT_KEEP_ALIVE_TIMEOUT_MS,
|
|
1044
|
-
requestGzip: typeof requestGzip === "boolean" ? requestGzip : true,
|
|
1045
1039
|
requestLogEnabled: typeof requestLogEnabled === "boolean" ? requestLogEnabled : true,
|
|
1046
1040
|
requestLogDebug: typeof requestLogDebug === "boolean" ? requestLogDebug : false,
|
|
1047
1041
|
requestLogMaxEntries: typeof requestLogMaxEntries === "number" ? requestLogMaxEntries : DEFAULT_REQUEST_LOG_MAX_ENTRIES
|
|
@@ -1456,20 +1450,6 @@ var SectionController = class _SectionController {
|
|
|
1456
1450
|
() => this.set({ settings: { ...current, keepAliveTimeoutMs: milliseconds } })
|
|
1457
1451
|
);
|
|
1458
1452
|
}
|
|
1459
|
-
/**
|
|
1460
|
-
* Flip request-body gzip. Off returns every request to plain JSON; it is
|
|
1461
|
-
* the whole fallback plan if the gateway ever rejects a compressed body.
|
|
1462
|
-
*/
|
|
1463
|
-
async setRequestGzip(enabled) {
|
|
1464
|
-
const scope = this.services.scope;
|
|
1465
|
-
const current = this.state.settings;
|
|
1466
|
-
if (scope === void 0 || current === void 0 || !this.state.writable) return;
|
|
1467
|
-
if (typeof enabled !== "boolean") return;
|
|
1468
|
-
await this.write(
|
|
1469
|
-
() => scope.set("requestGzip", enabled),
|
|
1470
|
-
() => this.set({ settings: { ...current, requestGzip: enabled } })
|
|
1471
|
-
);
|
|
1472
|
-
}
|
|
1473
1453
|
/**
|
|
1474
1454
|
* Flip the request-log master switch. Off (the default) means no record is
|
|
1475
1455
|
* kept and the request path reads exactly as without the log.
|
|
@@ -1911,25 +1891,6 @@ function Section({ controller, t, getLocale, openRequestLog }) {
|
|
|
1911
1891
|
),
|
|
1912
1892
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: t("keepAliveHint") })
|
|
1913
1893
|
] }),
|
|
1914
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: section_default.row, children: [
|
|
1915
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: section_default.hint, children: [
|
|
1916
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1917
|
-
"input",
|
|
1918
|
-
{
|
|
1919
|
-
type: "checkbox",
|
|
1920
|
-
checked: state.settings?.requestGzip ?? true,
|
|
1921
|
-
disabled: !editable || state.saving,
|
|
1922
|
-
onChange: (event) => {
|
|
1923
|
-
void act(async () => {
|
|
1924
|
-
await controller.setRequestGzip(event.target.checked);
|
|
1925
|
-
});
|
|
1926
|
-
}
|
|
1927
|
-
}
|
|
1928
|
-
),
|
|
1929
|
-
` ${t("requestGzipLabel")}`
|
|
1930
|
-
] }),
|
|
1931
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: section_default.hint, children: t("requestGzipHint") })
|
|
1932
|
-
] }),
|
|
1933
1894
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: section_default.row, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: t("requestLogTitle") }) }),
|
|
1934
1895
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: section_default.hint, children: t("requestLogHint") }),
|
|
1935
1896
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: section_default.row, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: section_default.hint, children: [
|
package/lib/index.js
CHANGED
|
@@ -59979,7 +59979,7 @@ var require_mock_interceptor = __commonJS({
|
|
|
59979
59979
|
var require_mock_client = __commonJS({
|
|
59980
59980
|
"node_modules/undici/lib/mock/mock-client.js"(exports, module) {
|
|
59981
59981
|
"use strict";
|
|
59982
|
-
var { promisify
|
|
59982
|
+
var { promisify } = __require("node:util");
|
|
59983
59983
|
var Client = require_client();
|
|
59984
59984
|
var { buildMockDispatch } = require_mock_utils();
|
|
59985
59985
|
var {
|
|
@@ -60027,7 +60027,7 @@ var require_mock_client = __commonJS({
|
|
|
60027
60027
|
this[kDispatches] = [];
|
|
60028
60028
|
}
|
|
60029
60029
|
async [kClose]() {
|
|
60030
|
-
await
|
|
60030
|
+
await promisify(this[kOriginalClose])();
|
|
60031
60031
|
this[kConnected] = 0;
|
|
60032
60032
|
this[kMockAgent][Symbols.kClients].delete(this[kOrigin]);
|
|
60033
60033
|
}
|
|
@@ -60240,7 +60240,7 @@ var require_mock_call_history = __commonJS({
|
|
|
60240
60240
|
var require_mock_pool = __commonJS({
|
|
60241
60241
|
"node_modules/undici/lib/mock/mock-pool.js"(exports, module) {
|
|
60242
60242
|
"use strict";
|
|
60243
|
-
var { promisify
|
|
60243
|
+
var { promisify } = __require("node:util");
|
|
60244
60244
|
var Pool = require_pool();
|
|
60245
60245
|
var { buildMockDispatch } = require_mock_utils();
|
|
60246
60246
|
var {
|
|
@@ -60288,7 +60288,7 @@ var require_mock_pool = __commonJS({
|
|
|
60288
60288
|
this[kDispatches] = [];
|
|
60289
60289
|
}
|
|
60290
60290
|
async [kClose]() {
|
|
60291
|
-
await
|
|
60291
|
+
await promisify(this[kOriginalClose])();
|
|
60292
60292
|
this[kConnected] = 0;
|
|
60293
60293
|
this[kMockAgent][Symbols.kClients].delete(this[kOrigin]);
|
|
60294
60294
|
}
|
|
@@ -73563,8 +73563,6 @@ import {
|
|
|
73563
73563
|
resolveRetryPolicy
|
|
73564
73564
|
} from "@deepseek-ai/dsh-llm";
|
|
73565
73565
|
import { idleWatchdog, timeoutOf } from "@deepseek-ai/dsh-timeout";
|
|
73566
|
-
import { promisify } from "node:util";
|
|
73567
|
-
import { constants as zlibConstants, gzip as gzipCallback } from "node:zlib";
|
|
73568
73566
|
|
|
73569
73567
|
// src/catalog/index.ts
|
|
73570
73568
|
init_models();
|
|
@@ -75759,10 +75757,6 @@ var fields = {
|
|
|
75759
75757
|
maxTokens: Schema.union([Schema.const(null), Schema.number().step(1).min(1).max(Number.MAX_SAFE_INTEGER)])
|
|
75760
75758
|
})])).default({}),
|
|
75761
75759
|
modelProtocols: Schema.dict(Schema.string()).default({}),
|
|
75762
|
-
// On by default, off is the whole fallback plan: if the gateway ever
|
|
75763
|
-
// rejects a compressed body, one switch returns every request to plain
|
|
75764
|
-
// JSON with no other change.
|
|
75765
|
-
requestGzip: Schema.boolean().default(true),
|
|
75766
75760
|
// On by default: recording costs one call and one boolean per request
|
|
75767
75761
|
// plus a bounded ring, and buys a per-request trail whenever something
|
|
75768
75762
|
// looks wrong. Off returns the request path to exactly as without the
|
|
@@ -76616,21 +76610,6 @@ function bodyBytes(body) {
|
|
|
76616
76610
|
if (ArrayBuffer.isView(body)) return body.byteLength;
|
|
76617
76611
|
return void 0;
|
|
76618
76612
|
}
|
|
76619
|
-
var MIN_GZIP_BODY_BYTES = 1024;
|
|
76620
|
-
var gzipAsync = promisify(gzipCallback);
|
|
76621
|
-
async function gzipBody(armed, input, init) {
|
|
76622
|
-
const original = init?.body;
|
|
76623
|
-
const originalBytes = bodyBytes(original ?? void 0);
|
|
76624
|
-
if (!armed || typeof input !== "string" && !(input instanceof URL) || originalBytes === void 0 || originalBytes < MIN_GZIP_BODY_BYTES || typeof original !== "string" && !(original instanceof ArrayBuffer) && !ArrayBuffer.isView(original)) {
|
|
76625
|
-
return { body: original ?? null, bytes: originalBytes, headers: void 0 };
|
|
76626
|
-
}
|
|
76627
|
-
const bytes = typeof original === "string" ? Buffer.from(original) : original instanceof ArrayBuffer ? Buffer.from(original) : Buffer.from(original.buffer, original.byteOffset, original.byteLength);
|
|
76628
|
-
const compressed = await gzipAsync(bytes, { level: zlibConstants.Z_BEST_SPEED });
|
|
76629
|
-
const headers = new Headers(init?.headers);
|
|
76630
|
-
headers.delete("content-length");
|
|
76631
|
-
headers.set("content-encoding", "gzip");
|
|
76632
|
-
return { body: compressed, bytes: compressed.byteLength, headers };
|
|
76633
|
-
}
|
|
76634
76613
|
async function* observingTerminalUsage(events, observe) {
|
|
76635
76614
|
for await (const event of events) {
|
|
76636
76615
|
if (event.type === "done") observe(event.message.usage);
|
|
@@ -76816,17 +76795,12 @@ var OpencodeGoAdapter = class extends LlmAdapter {
|
|
|
76816
76795
|
}
|
|
76817
76796
|
});
|
|
76818
76797
|
const fetchFactory = this.options.fetch;
|
|
76819
|
-
const requestFetch =
|
|
76798
|
+
const requestFetch = span === void 0 || fetchFactory === void 0 ? fetchFactory : () => {
|
|
76820
76799
|
const base = fetchFactory();
|
|
76821
76800
|
return (async (input, init) => {
|
|
76822
|
-
const
|
|
76823
|
-
|
|
76824
|
-
|
|
76825
|
-
...outgoing.body === void 0 ? {} : { body: outgoing.body },
|
|
76826
|
-
...outgoing.headers === void 0 ? {} : { headers: outgoing.headers }
|
|
76827
|
-
});
|
|
76828
|
-
span?.request(typeof init?.method === "string" ? init.method : "POST", requestUrl(input), outgoing.bytes);
|
|
76829
|
-
span?.status(response.status);
|
|
76801
|
+
const response = await base(input, init);
|
|
76802
|
+
span.request(typeof init?.method === "string" ? init.method : "POST", requestUrl(input), bodyBytes(init?.body));
|
|
76803
|
+
span.status(response.status);
|
|
76830
76804
|
return response;
|
|
76831
76805
|
});
|
|
76832
76806
|
};
|
|
@@ -77951,7 +77925,7 @@ function createUpdateChecker(deps) {
|
|
|
77951
77925
|
}
|
|
77952
77926
|
|
|
77953
77927
|
// src/update/version.ts
|
|
77954
|
-
var PLUGIN_VERSION = true ? "0.1.
|
|
77928
|
+
var PLUGIN_VERSION = true ? "0.1.72" : "0.0.0-dev";
|
|
77955
77929
|
|
|
77956
77930
|
// src/update/service.ts
|
|
77957
77931
|
import { TypertRemoteService as TypertRemoteService4 } from "@deepseek-ai/dsh-typert-protocol";
|
package/lib/types/config.d.ts
CHANGED
|
@@ -75,14 +75,6 @@ export interface OpencodeGoConfig {
|
|
|
75
75
|
* The escape hatch for a model whose family rule guessed wrong.
|
|
76
76
|
*/
|
|
77
77
|
modelProtocols: Record<string, string>;
|
|
78
|
-
/**
|
|
79
|
-
* Whether JSON request bodies of 1 KB or more are gzip-compressed before
|
|
80
|
-
* sending. On by default: the gateway is expected to accept
|
|
81
|
-
* `Content-Encoding: gzip`, and small bodies are never worth the overhead.
|
|
82
|
-
* If the gateway ever rejects compressed bodies, turn this off — the
|
|
83
|
-
* off switch is the whole fallback plan.
|
|
84
|
-
*/
|
|
85
|
-
requestGzip: boolean;
|
|
86
78
|
/**
|
|
87
79
|
* Whether the request log records anything at all. On by default: one
|
|
88
80
|
* call and one boolean per request, plus a bounded ring. Off returns the
|
package/package.json
CHANGED