@verneuil/dsh-ocg-session-head 0.1.0 → 0.1.1

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +45 -16
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1
4
+
5
+ ### 改进
6
+ - README 新增开篇《先读这段》:明确本插件仅适用于 DeepSeek Harness 0.2.2 及以上,且仅用于「自定义供应商名称」的 OpenCode 接入;官方路径接入无需本插件。
7
+ - README 安装说明更新为 npm 优先,并修正已失效的 DSH_HOME 路径示例。
8
+
9
+ ---
10
+ ### Improvements
11
+ - README now opens with a "Read this first" section: the plugin requires DeepSeek Harness 0.2.2 or newer, and is only needed for OpenCode connected under a custom provider name — the official path needs no plugin.
12
+ - Install instructions now prefer npm, and the outdated DSH_HOME path samples are corrected.
13
+
3
14
  ## 0.1.0
4
15
 
5
16
  ### 新功能
package/README.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  给 **OpenCode Go** 路由按会话注入 `x-opencode-session` 请求头。
4
4
 
5
+ > ### ⚠️ 先读这段:不满足以下任一条,你不需要本插件
6
+ >
7
+ > **1)宿主必须是 DeepSeek Harness 0.2.2 或更高版本**
8
+ >
9
+ > 本插件只做一件事:在宿主官方预留的请求头席位(`llm-pi-ai/request-headers` 瀑布)里写一个头。
10
+ > 该席位自 **0.2.2-alpha.3** 才引入、0.2.2-rc.1 起稳定,**更早的版本没有这个能力底座**。
11
+ > 在低版本上装它不会报错,但**永远不会生效**——看起来像「装了没用」,其实是无处可挂。
12
+ >
13
+ > **2)只对「自定义供应商名称」的 OpenCode 接入才有意义**
14
+ >
15
+ > - 如果你是通过 DSH 的**官方添加路径**接入 OpenCode / OpenCode Go(走 pi-ai 内置的
16
+ > `opencode` / `opencode-go` 路由),新版 pi-ai 已经会**自动**带上会话请求头,
17
+ > **不需要本插件**,装了纯属多余。
18
+ > - 只有当你是这样接入的——**确实在用 OpenCode 服务,但供应商名是自己起的**
19
+ > (手写 `baseURL` + `api: openai-completions`,例如把它叫 `ocg`)——
20
+ > 才拿不到那层自动包装,需要本插件补上这个头。
21
+ >
22
+ > 一句话:**官方路径接入 → 不用装;自定义命名接入 → 装本插件。**
23
+
5
24
  这是 `dsh-opencode-session`(fetch 猴补丁版)的**替代实现**:不替换 `globalThis.fetch`、不使用
6
25
  `AsyncLocalStorage`,只在宿主官方预留的请求头席位里写一个头。
7
26
 
@@ -18,44 +37,54 @@ OpenCode Go 自 2026-09-05 起,推理请求必须携带稳定的 `x-opencode-s
18
37
  400 {"type":"MissingSessionID", ...}
19
38
  ```
20
39
 
21
- 官方对**内置** `opencode` / `opencode-go` 路由已经在 pi-ai 里做了包装;但本机的 OCG 是
22
- **自定义路由 `ocg`**(自写 `baseURL` + `api: openai-completions`),拿不到那层包装,因此需要插件补上。
40
+ 官方对**内置** `opencode` / `opencode-go` 路由已经在 pi-ai 里做了包装;但**自定义命名**的路由
41
+ (自己起个名字、手写 `baseURL` + `api: openai-completions`)拿不到那层包装,因此需要插件补上。
42
+
43
+ > 不确定自己属于哪种情况?回到开篇《先读这段》第 2 条对号入座。
23
44
 
24
45
  ## 2. 版本要求(重要)
25
46
 
26
47
  | 项 | 要求 |
27
48
  |---|---|
28
- | DSH | **≥ 0.2.2-rc.1**(`llm-pi-ai/request-headers` 事件自 0.2.2-alpha.3 引入,rc.1 确认保留) |
49
+ | DSH | **≥ 0.2.2**(`llm-pi-ai/request-headers` 席位自 0.2.2-alpha.3 引入,0.2.2 系列起可用) |
29
50
  | Node | 无额外要求(纯 ESM,零依赖) |
30
51
 
31
52
  在**低于该版本**的宿主上安装是安全的:插件能加载、会打一行 ready 日志,但事件永不触发 →
32
53
  行为等价于不装(OCG 仍会 400)。**可用这一特性做「先装后升级」的分步验证。**
33
54
 
34
- ## 3. 安装(只走 tarball)
55
+ ## 3. 安装
56
+
57
+ ### 3.1 从 npm 安装(推荐)
58
+
59
+ 在 DSH 的插件管理里安装 `@verneuil/dsh-ocg-session-head`(或指定版本 `@verneuil/dsh-ocg-session-head@0.1.1`),
60
+ 或直接在 profile 的 `package.json` 里加:
61
+
62
+ ```json
63
+ "@verneuil/dsh-ocg-session-head": "^0.1.1"
64
+ ```
65
+
66
+ ### 3.2 离线 / 本地 tarball
35
67
 
36
68
  > ⚠️ **绝不要把「包目录」当安装 target。** pnpm 对目录使用 `link:`(junction),模块解析会
37
69
  > 退化成 Node 原生解析,DSH 解析拦截层失效 → 条目 `failed to import`。
38
70
  > **只有 tarball 会被解包成 profile 内的实体目录。**
39
71
 
40
- 正规方式二选一:
41
-
42
- **A. 插件管理页**:设置 → 插件 → 安装本地包 → 选择 `.tgz`。
43
-
44
- **B. profile 依赖**:在 `$DSH_HOME/profiles/desktop/package.json` 的 `dependencies` 加入
72
+ 在 profile 的 `dependencies` 里写成 `file:` 形式:
45
73
 
46
74
  ```json
47
- "@verneuil/dsh-ocg-session-head": "file:D:/.../_pkg/dsh-ocg-session-head-0.1.0-rc.20261105-XXXX.tgz"
75
+ "@verneuil/dsh-ocg-session-head": "file:<你的绝对路径>/dsh-ocg-session-head-<版本>.tgz"
48
76
  ```
49
77
 
50
- 再用 DSH 自带的 node/pnpm 安装(本机不需要系统 npm):
78
+ 写入依赖后,用 DSH 自带的 node/pnpm 安装(本机不需要系统 npm):
51
79
 
52
80
  ```powershell
53
- & 'D:\Others\DeepSeek-Harness\dsh-runtimes\dsh-primary-runtime\dependencies\node\bin\node.exe' `
54
- 'D:\Others\DeepSeek-Harness\dsh-runtimes\dsh-primary-runtime\dependencies\pnpm\bin\pnpm.mjs' `
55
- install --dir 'D:\Others\DeepSeek-Harness\profiles\desktop'
81
+ $node = Join-Path $env:DSH_HOME 'dsh-runtimes\dsh-primary-runtime\dependencies\node\bin\node.exe'
82
+ $pnpm = Join-Path $env:DSH_HOME 'dsh-runtimes\dsh-primary-runtime\dependencies\pnpm\bin\pnpm.mjs'
83
+ $target = Join-Path $env:DSH_HOME 'profiles\desktop'
84
+ & $node $pnpm install --dir $target
56
85
  ```
57
86
 
58
- 安装后**重启 DSH**(重启会杀掉宿主里的 AI 进程,需人工执行)。
87
+ 无论哪种方式,安装后都需要**重启 DSH**(重启会杀掉宿主里的 AI 进程,需人工执行)。
59
88
 
60
89
  ## 4. 配置
61
90
 
@@ -133,7 +162,7 @@ $pnpm = Join-Path $env:DSH_HOME 'dsh-runtimes\dsh-primary-runtime\dependencies\p
133
162
  & $node $pnpm pack
134
163
  ```
135
164
 
136
- 本地测试包命名遵循工作区约定:`0.1.0-rc.<YYYYMMDD-HHmm>`(临时改版本 → 打包 → 立即还原)。
165
+ 本地测试包可命名 `<版本>-rc.<YYYYMMDD-HHmm>`(临时改版本 → 打包 → 立即还原)。
137
166
 
138
167
  ## 9. 已知限制
139
168
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verneuil/dsh-ocg-session-head",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "OpenCode Go 会话头:监听宿主 llm-pi-ai/request-headers 瀑布,按会话为 ocg 路由注入 x-opencode-session(不猴补丁 fetch、不修改宿主)。",
5
5
  "main": "index.js",
6
6
  "type": "module",