@twinsearth/dsh-fang 3.1.15 → 3.1.16
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/docs/CONTRACT-INTEROP.md
CHANGED
|
@@ -29,6 +29,23 @@ legacy 直接调用 3.1.x 旧服务键(fangForker / fangDecisionCenter 等)
|
|
|
29
29
|
业务错误(如 `ticket-invalid`)**不降级**,避免重复副作用;传输/协议/未知方法才降级。
|
|
30
30
|
每次尝试记录在 `client.attempts()`,状态可观测。
|
|
31
31
|
|
|
32
|
+
## 2.5 零配置(v3.1.16 / 房主 3.2.5)
|
|
33
|
+
|
|
34
|
+
瓮城原身运行态的 spawn 环境新增 `DSH_FANG_MOTHER=<母体 dataDir>`;房主 Router 检测到该变量后
|
|
35
|
+
自动使用 `<母体 dataDir>/contract-outbox` 作为 `dispatch.contractFileDir`,无需手工配置:
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
原身 Host(essence Router)
|
|
39
|
+
env: DSH_FANG_ROLE=fork / DSH_FANG_ESSENCE=1 / DSH_FANG_MOTHER=<母体 dataDir>
|
|
40
|
+
↓ dispatch.contract=true(自动 file 桥)
|
|
41
|
+
<母体 dataDir>/contract-outbox/requests → responses
|
|
42
|
+
↓
|
|
43
|
+
母体 Host(Fang contract service)→ 真实 fork
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
HTTP 桥需要两个凭据:契约 Bearer token + 安装级 `x-fang-auth`;房主通过
|
|
47
|
+
`dispatch.motherToken` 与 `dispatch.motherAuthToken` 提供(SDK 侧为可选 `headers`)。
|
|
48
|
+
|
|
32
49
|
## 3. 两侧实现位置
|
|
33
50
|
|
|
34
51
|
| 侧 | 文件 | 内容 |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twinsearth/dsh-fang",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "dsh-Fang (瓮城) — mother/fork plugin development environment for DeepSeek Harness: one readonly mother, a disposable child dsh-Web per task.",
|
package/src/contract/client.js
CHANGED
|
@@ -28,6 +28,7 @@ export function createContractClient(options = {}) {
|
|
|
28
28
|
if (config.httpBaseUrl) transports.push(createHttpTransport({
|
|
29
29
|
baseUrl: config.httpBaseUrl,
|
|
30
30
|
token: config.httpToken,
|
|
31
|
+
headers: config.httpHeaders,
|
|
31
32
|
fetchImpl,
|
|
32
33
|
timeoutMs: config.timeoutMs,
|
|
33
34
|
pathPrefix: config.pathPrefix,
|
|
@@ -53,7 +53,7 @@ export function createLocalTransport({ ctx, serviceName = 'fangContract' } = {})
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export function createHttpTransport({ baseUrl = '', token = '', fetchImpl = fetch, timeoutMs = 15_000, pathPrefix = '/fang/api/contract' } = {}) {
|
|
56
|
+
export function createHttpTransport({ baseUrl = '', token = '', headers: extraHeaders = {}, fetchImpl = fetch, timeoutMs = 15_000, pathPrefix = '/fang/api/contract' } = {}) {
|
|
57
57
|
const base = baseOf(baseUrl)
|
|
58
58
|
const prefix = `/${String(pathPrefix).replace(/^\/+|\/+$/g, '')}`
|
|
59
59
|
const available = () => Boolean(base)
|
|
@@ -64,7 +64,7 @@ export function createHttpTransport({ baseUrl = '', token = '', fetchImpl = fetc
|
|
|
64
64
|
try {
|
|
65
65
|
const response = await fetchImpl(`${base}${prefix}${endpoint}`, {
|
|
66
66
|
method: 'POST',
|
|
67
|
-
headers: { 'content-type': 'application/json', accept: 'application/json', ...authHeaders(token) },
|
|
67
|
+
headers: { 'content-type': 'application/json', accept: 'application/json', ...authHeaders(token), ...(extraHeaders && typeof extraHeaders === 'object' ? extraHeaders : {}) },
|
|
68
68
|
body: JSON.stringify(role),
|
|
69
69
|
signal: controller.signal,
|
|
70
70
|
})
|
package/src/kernel/types.mjs
CHANGED
|
@@ -2319,7 +2319,9 @@ export function apply(ctx, config) {
|
|
|
2319
2319
|
homeDir,
|
|
2320
2320
|
profile: 'essence-runtime',
|
|
2321
2321
|
cliPath: cliPath(),
|
|
2322
|
-
|
|
2322
|
+
// v3.1.16:原身运行态同样需要母体 dataDir,房主 Router 才能零配置推导
|
|
2323
|
+
// 契约 file 桥(contract-outbox);普通分身在 846/1461/1534 行已有同名注入。
|
|
2324
|
+
env: { DSH_FANG_ROLE: 'fork', DSH_FANG_TASK_ID: forkId, DSH_FANG_ESSENCE: '1', DSH_FANG_MOTHER: layout.dataDir },
|
|
2323
2325
|
})
|
|
2324
2326
|
if (!started.ok) throw new Error(`runtime-spawn-failed: ${started.error ?? 'unknown'} (forkId=${forkId}, homeDir=${homeDir}, profile=essence-runtime)`)
|
|
2325
2327
|
return {
|