@dan-ai-studio/dshopencodego 0.1.64 → 0.1.66
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 +13 -6
- package/README.md +13 -6
- package/lib/client.js +765 -560
- package/lib/index.js +22 -11
- package/lib/types/config.d.ts +3 -3
- package/lib/types/request-log/store.d.ts +18 -6
- package/package.json +18 -1
package/lib/index.js
CHANGED
|
@@ -74081,11 +74081,11 @@ function validReleaseDate(value) {
|
|
|
74081
74081
|
}
|
|
74082
74082
|
function rates(value) {
|
|
74083
74083
|
const cost = record(value);
|
|
74084
|
-
const
|
|
74084
|
+
const rate2 = (key) => {
|
|
74085
74085
|
const entry = cost[key];
|
|
74086
74086
|
return typeof entry === "number" && Number.isFinite(entry) && entry >= 0 ? entry : 0;
|
|
74087
74087
|
};
|
|
74088
|
-
return { input:
|
|
74088
|
+
return { input: rate2("input"), output: rate2("output"), cacheRead: rate2("cache_read"), cacheWrite: rate2("cache_write") };
|
|
74089
74089
|
}
|
|
74090
74090
|
function thinkingLevels(metadata, known) {
|
|
74091
74091
|
const options = metadata["reasoning_options"];
|
|
@@ -76931,16 +76931,16 @@ function parseGoQuota(value) {
|
|
|
76931
76931
|
function parseCost(value) {
|
|
76932
76932
|
if (value === null || typeof value !== "object") throw new Error("invalid model cost");
|
|
76933
76933
|
const row = value;
|
|
76934
|
-
const
|
|
76934
|
+
const rate2 = (key) => {
|
|
76935
76935
|
const entry = row[key];
|
|
76936
76936
|
if (typeof entry !== "number" || !Number.isFinite(entry) || entry < 0) throw new Error(`invalid model cost "${key}"`);
|
|
76937
76937
|
return entry;
|
|
76938
76938
|
};
|
|
76939
76939
|
return {
|
|
76940
|
-
input:
|
|
76941
|
-
output:
|
|
76942
|
-
...typeof row["cacheRead"] === "number" ? { cacheRead:
|
|
76943
|
-
...typeof row["cacheWrite"] === "number" ? { cacheWrite:
|
|
76940
|
+
input: rate2("input"),
|
|
76941
|
+
output: rate2("output"),
|
|
76942
|
+
...typeof row["cacheRead"] === "number" ? { cacheRead: rate2("cacheRead") } : {},
|
|
76943
|
+
...typeof row["cacheWrite"] === "number" ? { cacheWrite: rate2("cacheWrite") } : {}
|
|
76944
76944
|
};
|
|
76945
76945
|
}
|
|
76946
76946
|
function parseModalities(value) {
|
|
@@ -77122,6 +77122,8 @@ function parseEntry(value) {
|
|
|
77122
77122
|
...row["cacheReadTokens"] === void 0 ? {} : { cacheReadTokens: count("cacheReadTokens", row) },
|
|
77123
77123
|
...row["durationMs"] === void 0 ? {} : { durationMs: count("durationMs", row) },
|
|
77124
77124
|
...row["firstTokenMs"] === void 0 ? {} : { firstTokenMs: count("firstTokenMs", row) },
|
|
77125
|
+
...row["decodeMs"] === void 0 ? {} : { decodeMs: count("decodeMs", row) },
|
|
77126
|
+
...row["tps"] === void 0 ? {} : { tps: rate("tps", row) },
|
|
77125
77127
|
ok: row["ok"] === true,
|
|
77126
77128
|
...typeof row["code"] === "string" ? { code: row["code"] } : {},
|
|
77127
77129
|
...typeof row["poolKey"] === "string" ? { poolKey: row["poolKey"] } : {},
|
|
@@ -77140,6 +77142,13 @@ function parseEntry(value) {
|
|
|
77140
77142
|
} : {}
|
|
77141
77143
|
};
|
|
77142
77144
|
}
|
|
77145
|
+
function rate(key, row) {
|
|
77146
|
+
const entry = row[key];
|
|
77147
|
+
if (typeof entry !== "number" || !Number.isFinite(entry) || entry < 0) {
|
|
77148
|
+
throw new Error(`invalid request-log entry "${key}"`);
|
|
77149
|
+
}
|
|
77150
|
+
return entry;
|
|
77151
|
+
}
|
|
77143
77152
|
function parsePoolEvent(value) {
|
|
77144
77153
|
if (value === null || typeof value !== "object") throw new Error("invalid request-log pool event");
|
|
77145
77154
|
const row = value;
|
|
@@ -77656,7 +77665,6 @@ var OpencodeGoRequestLogService = class extends TypertRemoteService3 {
|
|
|
77656
77665
|
};
|
|
77657
77666
|
|
|
77658
77667
|
// src/request-log/store.ts
|
|
77659
|
-
var SESSION_PREFIX_LENGTH = 8;
|
|
77660
77668
|
var MAX_POOL_EVENTS = 20;
|
|
77661
77669
|
var RequestLog = class {
|
|
77662
77670
|
gates;
|
|
@@ -77697,8 +77705,7 @@ var RequestLog = class {
|
|
|
77697
77705
|
if (!this.gates.enabled()) return void 0;
|
|
77698
77706
|
const debug = this.gates.debug();
|
|
77699
77707
|
const startedAt = Date.now();
|
|
77700
|
-
const
|
|
77701
|
-
const session = debug || full.length === 0 ? full : full.slice(0, SESSION_PREFIX_LENGTH);
|
|
77708
|
+
const session = detail.sessionId ?? "";
|
|
77702
77709
|
let firstTokenAt;
|
|
77703
77710
|
let method;
|
|
77704
77711
|
let url;
|
|
@@ -77721,6 +77728,8 @@ var RequestLog = class {
|
|
|
77721
77728
|
if (finished) return;
|
|
77722
77729
|
finished = true;
|
|
77723
77730
|
const endedAt = Date.now();
|
|
77731
|
+
const decodeMs = firstTokenAt === void 0 ? void 0 : Math.max(0, endedAt - firstTokenAt);
|
|
77732
|
+
const tps = decodeMs === void 0 || decodeMs <= 0 || usage === void 0 ? void 0 : usage.outputTokens / (decodeMs / 1e3);
|
|
77724
77733
|
const entry = {
|
|
77725
77734
|
seq: ++this.seq,
|
|
77726
77735
|
atMs: startedAt,
|
|
@@ -77736,6 +77745,8 @@ var RequestLog = class {
|
|
|
77736
77745
|
},
|
|
77737
77746
|
durationMs: Math.max(0, endedAt - startedAt),
|
|
77738
77747
|
...firstTokenAt === void 0 ? {} : { firstTokenMs: Math.max(0, firstTokenAt - startedAt) },
|
|
77748
|
+
...decodeMs === void 0 ? {} : { decodeMs },
|
|
77749
|
+
...tps === void 0 ? {} : { tps },
|
|
77739
77750
|
ok,
|
|
77740
77751
|
...code === void 0 ? {} : { code },
|
|
77741
77752
|
// The pool in force when the request finished. Pool switches are
|
|
@@ -77875,7 +77886,7 @@ function createUpdateChecker(deps) {
|
|
|
77875
77886
|
}
|
|
77876
77887
|
|
|
77877
77888
|
// src/update/version.ts
|
|
77878
|
-
var PLUGIN_VERSION = true ? "0.1.
|
|
77889
|
+
var PLUGIN_VERSION = true ? "0.1.66" : "0.0.0-dev";
|
|
77879
77890
|
|
|
77880
77891
|
// src/update/service.ts
|
|
77881
77892
|
import { TypertRemoteService as TypertRemoteService4 } from "@deepseek-ai/dsh-typert-protocol";
|
package/lib/types/config.d.ts
CHANGED
|
@@ -82,9 +82,9 @@ export interface OpencodeGoConfig {
|
|
|
82
82
|
*/
|
|
83
83
|
requestLogEnabled: boolean;
|
|
84
84
|
/**
|
|
85
|
-
* Whether the request log also records pool lifecycle and
|
|
86
|
-
*
|
|
87
|
-
*
|
|
85
|
+
* Whether the request log also records pool lifecycle and request headers.
|
|
86
|
+
* Debug only: the common log carries no pool events and no header detail,
|
|
87
|
+
* which is enough to follow one conversation.
|
|
88
88
|
*/
|
|
89
89
|
requestLogDebug: boolean;
|
|
90
90
|
/**
|
|
@@ -13,14 +13,12 @@
|
|
|
13
13
|
* - Authorization never enters a record. The recorder takes no headers
|
|
14
14
|
* argument at all; the only header-derived value it stores is the session
|
|
15
15
|
* id it is handed, already separated from the credential by the caller.
|
|
16
|
-
* - The session id is stored
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* - The session id is stored whole. It is a conversation identity, not a
|
|
17
|
+
* secret, and a truncated one cannot group a conversation's requests —
|
|
18
|
+
* two conversations sharing an eight-character prefix would read as one.
|
|
19
19
|
*
|
|
20
20
|
* @module @dan-ai-studio/dshopencodego/request-log/store
|
|
21
21
|
*/
|
|
22
|
-
/** How many session-id characters the common (non-debug) log keeps. */
|
|
23
|
-
export declare const SESSION_PREFIX_LENGTH = 8;
|
|
24
22
|
/** One recorded request. Counts are provider-reported; timings are Host-measured. */
|
|
25
23
|
export interface RequestLogEntry {
|
|
26
24
|
/** Monotonic sequence within this process; gaps mean nothing was recorded. */
|
|
@@ -29,7 +27,7 @@ export interface RequestLogEntry {
|
|
|
29
27
|
readonly atMs: number;
|
|
30
28
|
/** The model id the request was made with. */
|
|
31
29
|
readonly model: string;
|
|
32
|
-
/** The session id
|
|
30
|
+
/** The session id the request belonged to, whole. */
|
|
33
31
|
readonly session: string;
|
|
34
32
|
/** HTTP method used. */
|
|
35
33
|
readonly method: string;
|
|
@@ -47,6 +45,20 @@ export interface RequestLogEntry {
|
|
|
47
45
|
readonly durationMs?: number;
|
|
48
46
|
/** Wall time from request start to the first token delta, in milliseconds. */
|
|
49
47
|
readonly firstTokenMs?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Wall time from the first token delta to the terminal event, in
|
|
50
|
+
* milliseconds — the decode window, on the same scale as the Harness's own
|
|
51
|
+
* per-turn reading.
|
|
52
|
+
*/
|
|
53
|
+
readonly decodeMs?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Output tokens per second over the decode window.
|
|
56
|
+
*
|
|
57
|
+
* Absent when the request produced no token, or when the decode window
|
|
58
|
+
* rounds to zero milliseconds: a rate divided by zero is not a rate, and
|
|
59
|
+
* inventing one would misreport a fast reply as infinitely quick.
|
|
60
|
+
*/
|
|
61
|
+
readonly tps?: number;
|
|
50
62
|
/** Whether the request completed. */
|
|
51
63
|
readonly ok: boolean;
|
|
52
64
|
/** Failure code (`TIMEOUT`, `TRANSPORT`, …) for a request that did not complete. */
|
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.66",
|
|
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",
|
|
@@ -51,6 +51,8 @@
|
|
|
51
51
|
"inject": [
|
|
52
52
|
"@deepseek-ai/dsh-client-locale",
|
|
53
53
|
"@deepseek-ai/dsh-client-ui-settings",
|
|
54
|
+
"@deepseek-ai/dsh-client-ui-layout",
|
|
55
|
+
"@deepseek-ai/dsh-client-ui-sidebar",
|
|
54
56
|
"@deepseek-ai/dsh-api-remotes",
|
|
55
57
|
"@deepseek-ai/dsh-client-ui-model-selection"
|
|
56
58
|
],
|
|
@@ -75,9 +77,12 @@
|
|
|
75
77
|
"@deepseek-ai/dsh-client-locale": ">=0.2.0-rc.1 <0.3.0-0",
|
|
76
78
|
"@deepseek-ai/dsh-client-store": ">=0.2.0-rc.1 <0.3.0-0",
|
|
77
79
|
"@deepseek-ai/dsh-client-ui-conversation": ">=0.2.0-rc.1 <0.3.0-0",
|
|
80
|
+
"@deepseek-ai/dsh-client-ui-layout": ">=0.2.0-rc.1 <0.3.0-0",
|
|
78
81
|
"@deepseek-ai/dsh-client-ui-model-selection": ">=0.2.0-rc.1 <0.3.0-0",
|
|
82
|
+
"@deepseek-ai/dsh-client-ui-primitives": ">=0.2.0-rc.1 <0.3.0-0",
|
|
79
83
|
"@deepseek-ai/dsh-client-ui-renderer": ">=0.2.0-rc.1 <0.3.0-0",
|
|
80
84
|
"@deepseek-ai/dsh-client-ui-settings": ">=0.2.0-rc.1 <0.3.0-0",
|
|
85
|
+
"@deepseek-ai/dsh-client-ui-sidebar": ">=0.2.0-rc.1 <0.3.0-0",
|
|
81
86
|
"@deepseek-ai/dsh-client-ui-slots": ">=0.2.0-rc.1 <0.3.0-0",
|
|
82
87
|
"@deepseek-ai/dsh-credentials": ">=0.2.0-rc.1 <0.3.0-0",
|
|
83
88
|
"@deepseek-ai/dsh-fs": ">=0.2.0-rc.1 <0.3.0-0",
|
|
@@ -100,6 +105,15 @@
|
|
|
100
105
|
"@deepseek-ai/dsh-client-ui-model-selection": {
|
|
101
106
|
"optional": true
|
|
102
107
|
},
|
|
108
|
+
"@deepseek-ai/dsh-client-ui-layout": {
|
|
109
|
+
"optional": true
|
|
110
|
+
},
|
|
111
|
+
"@deepseek-ai/dsh-client-ui-primitives": {
|
|
112
|
+
"optional": true
|
|
113
|
+
},
|
|
114
|
+
"@deepseek-ai/dsh-client-ui-sidebar": {
|
|
115
|
+
"optional": true
|
|
116
|
+
},
|
|
103
117
|
"@deepseek-ai/dsh-client-ui-settings": {
|
|
104
118
|
"optional": true
|
|
105
119
|
},
|
|
@@ -115,9 +129,12 @@
|
|
|
115
129
|
"@deepseek-ai/dsh-client-locale": "0.2.1-rc.2",
|
|
116
130
|
"@deepseek-ai/dsh-client-store": "0.2.1-rc.2",
|
|
117
131
|
"@deepseek-ai/dsh-client-ui-conversation": "0.2.1-rc.2",
|
|
132
|
+
"@deepseek-ai/dsh-client-ui-layout": "0.2.1-rc.2",
|
|
118
133
|
"@deepseek-ai/dsh-client-ui-model-selection": "0.2.1-rc.2",
|
|
134
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.2.1-rc.2",
|
|
119
135
|
"@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.2",
|
|
120
136
|
"@deepseek-ai/dsh-client-ui-settings": "0.2.1-rc.2",
|
|
137
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "0.2.1-rc.2",
|
|
121
138
|
"@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.2",
|
|
122
139
|
"@deepseek-ai/dsh-credentials": "0.2.1-rc.2",
|
|
123
140
|
"@deepseek-ai/dsh-fs": "0.2.1-rc.2",
|