@dan-ai-studio/dshopencodego 0.1.62 → 0.1.64

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 CHANGED
@@ -115,6 +115,9 @@ Configuration lives in the profile's `cordis.patch.yml`:
115
115
  some-new-model: openai-responses # the only legal values are anthropic-messages / openai-completions / openai-responses
116
116
  pinnedAddresses: # fixed IP: host -> address (only the gateway host counts)
117
117
  opencode.ai: 104.18.32.47 # IPv4 or IPv6; an invalid or absent address uses the system DNS
118
+ requestLogEnabled: false # request-log master switch, default off: off reads byte-for-byte as without the log
119
+ requestLogDebug: false # debug detail: pool events and full session ids; otherwise sessions keep 8 chars
120
+ requestLogMaxEntries: 200 # most entries to keep, 50 to 500; oldest are dropped first
118
121
  retryPolicy: # optional: this route's retry policy, executed by dsh-llm-retry
119
122
  mode: normal # or always (retry every failure; maxRetries is ignored)
120
123
  maxRetries: 2 # default 5
@@ -125,7 +128,7 @@ Configuration lives in the profile's `cordis.patch.yml`:
125
128
  jitterRatio: 0.1 # default 0.1, range 0 ~ 1
126
129
  ```
127
130
 
128
- **Validated on save**: those constraints are checked when the profile is **written**, not at the first request — `baseURL` must be http(s) with no query or fragment; `refreshMinutes` ranges from 1 to 10080; `keepAliveTimeoutMs` ranges from 1 to 1800000; every `modelLimits` field may be `null`, meaning "select the catalog value explicitly" (`modelLimits.<id>: null` sends both fields back); `modelProtocols` accepts only those three values, and a wrong one makes that model appear as *configuration missing* (switch off, not selectable) rather than falling back to a guess; `retryPolicy` is a union (`normal` reads `maxRetries`/`retryableCodes`/`backoff`, `always` reads only `backoff`) and unknown keys are rejected.
131
+ **Validated on save**: those constraints are checked when the profile is **written**, not at the first request — `baseURL` must be http(s) with no query or fragment; `refreshMinutes` ranges from 1 to 10080; `keepAliveTimeoutMs` ranges from 1 to 1800000; `requestLogMaxEntries` ranges from 50 to 500; every `modelLimits` field may be `null`, meaning "select the catalog value explicitly" (`modelLimits.<id>: null` sends both fields back); `modelProtocols` accepts only those three values, and a wrong one makes that model appear as *configuration missing* (switch off, not selectable) rather than falling back to a guess; `retryPolicy` is a union (`normal` reads `maxRetries`/`retryableCodes`/`backoff`, `always` reads only `backoff`) and unknown keys are rejected.
129
132
 
130
133
  The API key comes from the Harness credential store (reference name `OPENCODE_GO_API_KEY`), or from `export OPENCODE_GO_API_KEY=...`.
131
134
 
@@ -138,6 +141,11 @@ The API key comes from the Harness credential store (reference name `OPENCODE_GO
138
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.
139
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.
140
143
 
144
+ **Request log**: per-request records, off by default; enabling them changes nothing about what requests do. The settings page's "Request log" group holds the master switch, the debug switch (pool events and full session ids), and the retention count (default 200). The viewer filters by model / result / slow requests / session, groups by session / model / result, pages, and expands one row into its HTTP detail (method, URL, redacted headers, timing, result and usage).
145
+
146
+ - The log is a ring buffer (oldest dropped first) that dies with the process; snapshots are read on demand, never polled, so a closed viewer costs no traffic.
147
+ - The credential never enters a record: the recorder takes no headers argument at all, only the allowlisted session id and user agent. Failed requests are recorded with their error code; a request cut off before any terminal event is not recorded — no total reported, none invented.
148
+
141
149
  **Images**: three fields, one layer each. An image outside a bound is refused explicitly rather than silently downscaled or dropped:
142
150
 
143
151
  | Field | What it bounds | Default |
@@ -273,7 +281,7 @@ npm test # contract tests against a real local HTTP mock gateway
273
281
 
274
282
  **Order matters**: `npm run build` must come before `npm test` — `tests/pack-contents.spec.ts` walks every `exports` target, and whether `lib/` exists decides whether that check runs or is silently skipped (it does not fail, it just stops protecting you). `package.json` no longer carries `prepare`, so `npm ci` will not build for you; all three CI workflows run `npm run build` explicitly.
275
283
 
276
- 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, the error mapping for stream idle timeouts and aborts, the exit-code contract of the verification scripts, and several **structural invariants** (inject declarations match the source's reads, peer coverage holds both ways, the READMEs match the manifest, and the READMEs' claims about the upstream match the upstream actually installed). That is **57 test files** — a number `tests/readme-consistency.spec.ts` checks against the `tests/` directory, so it cannot drift.
284
+ 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, the error mapping for stream idle timeouts and aborts, the exit-code contract of the verification scripts, and several **structural invariants** (inject declarations match the source's reads, peer coverage holds both ways, the READMEs match the manifest, and the READMEs' claims about the upstream match the upstream actually installed). That is **58 test files** — a number `tests/readme-consistency.spec.ts` checks against the `tests/` directory, so it cannot drift.
277
285
 
278
286
  ## Releasing (maintainers)
279
287
 
package/README.md CHANGED
@@ -114,6 +114,9 @@ DSH 桌面端是 Electron 壳 + 完整的 dsh Web 应用,本插件对它同样
114
114
  some-new-model: openai-responses # 合法值只有 anthropic-messages / openai-completions / openai-responses
115
115
  pinnedAddresses: # 固定 IP:域名 → 地址(只对网关域名生效)
116
116
  opencode.ai: 104.18.32.47 # 可写 IPv4 或 IPv6;不合法或未设置时走系统 DNS
117
+ requestLogEnabled: false # 请求日志总开关,默认关闭:关闭时请求路径与没有该日志逐字节一致
118
+ requestLogDebug: false # 排错详情:连接池事件与完整会话 id;不开启则会话只保留前 8 位
119
+ requestLogMaxEntries: 200 # 最多保留条数,50 ~ 500,超限丢弃最旧的
117
120
  retryPolicy: # 可选:本路由的重试策略(由 dsh-llm-retry 执行)
118
121
  mode: normal # 也可用 always(对所有失败重试,maxRetries 被忽略)
119
122
  maxRetries: 2 # 默认 5
@@ -124,7 +127,7 @@ DSH 桌面端是 Electron 壳 + 完整的 dsh Web 应用,本插件对它同样
124
127
  jitterRatio: 0.1 # 默认 0.1,取值 0 ~ 1
125
128
  ```
126
129
 
127
- **保存即校验**:上面这些约束在**写入 profile 时**就检查,不会拖到第一次请求——`baseURL` 必须是 http(s) 且不带 query/fragment;`refreshMinutes` 取值 1 ~ 10080;`keepAliveTimeoutMs` 取值 1 ~ 1800000;`modelLimits` 的每个字段都可以写 `null`,语义是"显式选回目录值"(`modelLimits.<模型>: null` 表示两个字段一起回退);`modelProtocols` 只接受那三个合法值,写错会让该模型以"配置缺失"出现(开关关闭、不可选),而不是回退到猜测;`retryPolicy` 是联合类型(`normal` 读 `maxRetries`/`retryableCodes`/`backoff`,`always` 只读 `backoff`),未知字段会被拒绝。
130
+ **保存即校验**:上面这些约束在**写入 profile 时**就检查,不会拖到第一次请求——`baseURL` 必须是 http(s) 且不带 query/fragment;`refreshMinutes` 取值 1 ~ 10080;`keepAliveTimeoutMs` 取值 1 ~ 1800000;`requestLogMaxEntries` 取值 50 ~ 500;`modelLimits` 的每个字段都可以写 `null`,语义是"显式选回目录值"(`modelLimits.<模型>: null` 表示两个字段一起回退);`modelProtocols` 只接受那三个合法值,写错会让该模型以"配置缺失"出现(开关关闭、不可选),而不是回退到猜测;`retryPolicy` 是联合类型(`normal` 读 `maxRetries`/`retryableCodes`/`backoff`,`always` 只读 `backoff`),未知字段会被拒绝。
128
131
 
129
132
  API Key 通过 Harness 凭证库提供(引用名 `OPENCODE_GO_API_KEY`),也可以直接 `export OPENCODE_GO_API_KEY=...`。
130
133
 
@@ -137,6 +140,11 @@ API Key 通过 Harness 凭证库提供(引用名 `OPENCODE_GO_API_KEY`),
137
140
  - 设置页里以**秒**显示与填写(毫秒的数字人读不出量级),存储时换算成毫秒。取值 1 ~ 1800000 毫秒。
138
141
  - 空闲满这个时间之后,连接由连接池**自己回收**,不需要额外的清理机制(实际释放时间比设置值多约 2 秒,那是客户端在服务端给的期限之外自留的一点缓冲)。插件被卸载时,连接池也会**一并关掉**——它是插件的,不该留在机器上。
139
142
 
143
+ **请求日志**:默认关闭的逐请求记录,打开它不改变请求的任何行为。设置页"请求日志"分组里有总开关、排错详情开关(连接池事件与完整会话 id)、保留条数(默认 200)。查看器支持按模型/结果/慢请求/会话筛选、按会话/模型/结果分组、分页,以及点击看单条 HTTP 明细(方法、地址、脱敏后的请求头、耗时线、结果与用量)。
144
+
145
+ - 记录的是环形缓冲(超限丢最旧),进程重启即清;只读快照,不轮询,关闭查看器零流量。
146
+ - 凭据永远不进记录:记录器根本不接收请求头参数,只收白名单里的会话 id 与 UA;失败的请求同样记一条(含错误码),中断到没有终端事件的不记(网关没报总数就不编数)。
147
+
140
148
  **图片**:三个字段各管一层,超限的图片会被明确拒绝,而不是静默降质或丢弃:
141
149
 
142
150
  | 字段 | 约束对象 | 默认 |
@@ -272,7 +280,7 @@ npm test # 契约测试:真实 HTTP mock 网关,断言请求头/
272
280
 
273
281
  **顺序有讲究**:`npm run build` 要排在 `npm test` 之前——`tests/pack-contents.spec.ts` 会遍历 `exports` 的每个目标,`lib/` 存在与否决定这条检查是执行还是被跳过(不报错,但会少一层保护)。`package.json` 已移除 `prepare`,因此 `npm ci` 不会再替你隐式构建;三个 CI workflow 都显式跑了 `npm run build`。
274
282
 
275
- 测试覆盖配置校验、协议阶梯、网关与在线元数据、目录投影、适配器(三种协议的线上请求)、Remote 契约与服务、会话头不变量、用量窗口与计量、客户端控制器与用量组件、两半的挂载与登记、流空闲超时与中止的错误映射、验证脚本的退出码契约、以及几条**结构性不变量**(inject 声明与源码读取一致、peer 覆盖双向、README 与 manifest 一致、README 对上游的断言与实装的上游一致)。共 **57 个测试文件**——这个数字由 `tests/readme-consistency.spec.ts` 对着 `tests/` 目录校验,不会漂移。
283
+ 测试覆盖配置校验、协议阶梯、网关与在线元数据、目录投影、适配器(三种协议的线上请求)、Remote 契约与服务、会话头不变量、用量窗口与计量、客户端控制器与用量组件、两半的挂载与登记、流空闲超时与中止的错误映射、验证脚本的退出码契约、以及几条**结构性不变量**(inject 声明与源码读取一致、peer 覆盖双向、README 与 manifest 一致、README 对上游的断言与实装的上游一致)。共 **58 个测试文件**——这个数字由 `tests/readme-consistency.spec.ts` 对着 `tests/` 目录校验,不会漂移。
276
284
 
277
285
  ## 发布(维护者)
278
286