@linxin666/dsh-remote-bridge 0.4.11 → 0.4.12

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.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # node scripts/verify-docs.mjs --write <dir>
5
- README.md: 00e87e9e44a8dd3f38b8940596e761d323a5bf9d
6
- README.zh.md: 3c2e1bfc35813d1b61aa938814168c461754faa8
5
+ README.md: e535b6c20d2c587b910107c33df225d9504f56dc
6
+ README.zh.md: b8f8675b1af492825ef85ff66111776de6ce8c5e
package/README.md CHANGED
@@ -92,7 +92,7 @@ The command channel interprets nothing either. `session.commands` reads both hos
92
92
 
93
93
  The session-admin channel interprets nothing either, and it is two capabilities because reading and writing are two different offers. `workspace.list` answers the host registry's own synchronous projection — one row per registered workspace in registry order, never sorted here, never carrying the workspace's session account — with the archive and pin sets beside it; an archived session is a session-level fact, not an archived workspace, so nothing is filtered out of that list and an archived session keeps its slot, which is where `session.unarchive` puts it back. Pinning is a registry-global set rather than an order inside a workspace: a new pin is prepended, a repeated pin neither writes nor reorders, a pin on an archived session is refused by the host, and archiving drops the pin in the same durable write — the visible order a client shows is therefore its own derivation, exactly as the desktop derives it. Five writes then map one-to-one onto the endpoints that already own their semantics: `session.rename` reaches `session/rename`, which restores a cold session before it writes and answers the title it normalized with the seq that committed it, so a client needs no resume path of its own; `session.pin`, `session.unpin`, `session.archive` and `session.unarchive` reach `workspace/pinSession`, `workspace/unpinSession`, `workspace/archiveSession` and `workspace/unarchiveSession`. No boolean is invented and nothing is branched here: `stopActivity` crosses only when the client sent a boolean, and a session that is still running without it is refused by the host as `workspace/session-active`, which is the refusal that tells a phone to offer the confirmation. This channel pushes no event, because the host announces none of these writes as a cordis event a connection could fold into a delta — a rename appends one `session/title` record and nothing else — so a client re-reads after every write: the pin set through `workspace.list`, the roster through `session.list`, and the new name into its own copy while the title cache expires. The cost is stated rather than hidden: a pin or an archive made on the desktop reaches the phone at its next refresh. A connection that never declared `workspace.v1` or `session.admin.v1` is answered `unknown-method` for the methods behind it, with no registry read and no write on its behalf.
94
94
 
95
- The squads channel is the one that replaces nothing: it reads and drives the agent squads of the `dsh-agents` plugin, and it sits beside `agents.v1` rather than on top of it, so a phone written before it keeps the preset roster and session creation it was built against. Five commands stand behind `squads.v1`. `squads.state` answers `{squads, runs, presets?, host:{ownerPid?}}`; `squads.list` answers `{squads}` and `squads.runs` answers `{runs}`, the two halves of one read cut from the same answer, so a squad listing and a run history can never disagree; `squads.runMember` sends `{squadId, memberId, firstMessage?}` and `squads.runSquad` sends `{squadId, goal?}`, each answering `{run}`. A `Squad` is `{id, name, description?, workspaceId?, leadPreset?, order?, members:[Member]}` and a `Member` is `{id, name, preset?, permission?, model?, reasoningEffort?, brief?}`; a `Run` is `{id, squadId, kind:'squad'|'member', memberId?, sessionId, createdAt, status:'running'|'settled'|'failed', failure?}`, where `kind` is required on this wire and a run recorded before whole-squad runs existed — one carrying no `kind` at all — reads as the member run it is by construction. Nothing the plugin keeps for itself crosses: a definition's `createdAt`/`updatedAt`, a member's `teamId` backlink and the `goal` handed to a Lead stay on the host's side. The domain is the plugin's own, so its refusals are the plugin's own too and cross with the plugin's code and its one bounded sentence — `team-not-found`, `member-not-found`, `preset-registry-unavailable`, `preset-unknown`, `preset-unavailable`, `workspace-required`, `workspace-unavailable`, `workspace-unknown`, `model-pin-invalid`, `session-create-failed` and their neighbours — while this bridge names only the two conditions the plugin cannot: `squads-unavailable`, for a host that serves no squad domain this bridge can reach or answers a body this build cannot read, and `squads-run-unavailable`, for definitions that are readable while no run route can be reached, which is answered instead of a run that never started. A malformed row is refused rather than repaired and an empty answer is never invented, so a host without the plugin answers an error rather than an empty board. How the domain is reached is this bridge's one dependency-free rule: the plugin's own routes over this machine's loopback origin — `GET /dsh-agents/api/state`, `POST /dsh-agents/api/run`, `POST /dsh-agents/api/squad/run`, addressed at the origin `webServer` already serves and carrying that origin in the `origin` header the plugin's browser fence reads as its same-origin signal — and, when no loopback call can connect at all, the plugin's ledger at `$DSH_HOME/dsh-agents/ledger.json` read read-only under the same rules, with `host.ownerPid` then read out of the plugin's own lock beside it. An answer of any status is not a fallback: it is the plugin speaking, and only a call that never connected reaches the ledger. Nothing is called on a connection's behalf, and a client that never declared `squads.v1` is answered `unknown-method` for all five.
95
+ The squads channel is the one that replaces nothing: it reads and drives the agent squads of the `dsh-agents` plugin, and it sits beside `agents.v1` rather than on top of it, so a phone written before it keeps the preset roster and session creation it was built against. Five commands stand behind `squads.v1`. `squads.state` answers `{squads, runs, presets?, host:{ownerPid?}}`; `squads.list` answers `{squads}` and `squads.runs` answers `{runs}`, the two halves of one read cut from the same answer, so a squad listing and a run history can never disagree; `squads.runMember` sends `{squadId, memberId, firstMessage?}` and `squads.runSquad` sends `{squadId, goal?}`, each answering `{run}`. A `Squad` is `{id, name, description?, workspaceId?, leadPreset?, order?, members:[Member]}` and a `Member` is `{id, name, preset?, permission?, model?, reasoningEffort?, brief?}`; a `Run` is `{id, squadId, kind:'squad'|'member', memberId?, sessionId, createdAt, status:'running'|'settled'|'failed', failure?}`, where `kind` is required on this wire and a run recorded before whole-squad runs existed — one carrying no `kind` at all — reads as the member run it is by construction. Nothing the plugin keeps for itself crosses: a definition's `createdAt`/`updatedAt`, a member's `teamId` backlink and the `goal` handed to a Lead stay on the host's side. The domain is the plugin's own, so its refusals are the plugin's own too and cross with the plugin's code and its one bounded sentence — `team-not-found`, `member-not-found`, `preset-registry-unavailable`, `preset-unknown`, `preset-unavailable`, `workspace-unavailable`, `workspace-unknown`, `model-pin-invalid`, `session-create-failed` and their neighbours — while this bridge names only the two conditions the plugin cannot: `squads-unavailable`, for a host that serves no squad domain this bridge can reach or answers a body this build cannot read, and `squads-run-unavailable`, for definitions that are readable while no run route can be reached, which is answered instead of a run that never started. A malformed row is refused rather than repaired and an empty answer is never invented, so a host without the plugin answers an error rather than an empty board. How the domain is reached is this bridge's one dependency-free rule: the plugin's own routes over this machine's loopback origin — `GET /dsh-agents/api/state`, `POST /dsh-agents/api/run`, `POST /dsh-agents/api/squad/run`, addressed at the origin `webServer` already serves and carrying that origin in the `origin` header the plugin's browser fence reads as its same-origin signal — and, when no loopback call can connect at all, the plugin's ledger at `$DSH_HOME/dsh-agents/ledger.json` read read-only under the same rules, with `host.ownerPid` then read out of the plugin's own lock beside it. An answer of any status is not a fallback: it is the plugin speaking, and only a call that never connected reaches the ledger. Nothing is called on a connection's behalf, and a client that never declared `squads.v1` is answered `unknown-method` for all five.
96
96
 
97
97
  The usage channel reads two facts that belong to the host rather than to one device, so one instance serves every connection. `usage.session` names one session and answers `{contextWindow?, composition?}`: the window is the harness's own `RequestContext.contextWindow` from the latest `request/context` event this process saw broadcast, and the composition is this bridge's estimate of what the next request is made of, split three ways — `tools` from the raw tools schema of the latest `request/header`, `system` from the latest `system/message` text, and `messages` from the text of every `user/message`, `assistant/message` and `tool/result` seen since — each component the UTF-8 byte count divided by four and floored, always carrying `estimated: true`, because a phone must never read an estimate as the host's own accounting. A key the host never broadcast is absent rather than zero, and a session that exists while neither reading does answers `{}`: existence has three witnesses — the host's own session roster (the same `session/list` the roster method serves, so a session this bridge never observed and that is not live still counts), the live session store, and the events this process folded — and a session id none of the three names is refused `unknown-session`. The roster is read only when the other two answer nothing, and its answer is reused for five seconds so a burst of opens costs one read; a bridge that cannot read a roster at all falls back to the live store and the fold alone. The fold starts when this row mounts and never reads a session log: an event broadcast before it mounted is not a reading, so a session that ran entirely before it answers `{}` rather than a composition of zeros. `usage.balance` names one provider route and answers either `{provider, currency, total, toppedUp, granted, updatedAt}` — the numbers in yuan, taken from `balance_infos[0]` — or `{provider, unsupported, reason?}` with `no-credential`, `not-deepseek-route` or `probe-failed`. The route must be an official DeepSeek id (`deepseek` or `deepseek-official`) AND its configured `baseURL` absent or on `https://api.deepseek.com`: the balance endpoint reports one origin's account, so probing it for a reseller profile that merely reused the `deepseek` id would print the official account's money under that route's name. The credential is resolved the way the harness's own usage plugin resolves it — the pi-ai record `llm-pi-ai/<provider>`, then the profile's `apiKeyEnv`, then the DeepSeek adapter's own reference (default `DEEPSEEK_API_KEY`) — and an OAuth grant is not a credential here, because the official endpoint accepts an API key only. One reading is cached for 60 seconds per provider and credential, concurrent calls merge into one upstream request, and 401, a timeout or an unrecognized body all answer `probe-failed` instead of a previous reading presented as current. A client that never declared `usage.v1` is answered `unknown-method` for both methods, with no event folded and no upstream request made on its behalf. `usage.stats` reads the ledger another plugin keeps, so it is its own capability behind `usage.stats.v1` and its own read path: one `GET /api/dsh-usage/overview` and, only when the requested window reaches deeper than the 30 days that document already carries, one `GET /api/dsh-usage/day?date=YYYY-MM-DD` per day that ledger actually recorded. Days the ledger holds nothing for cross as real zeros — the host answers those dates as zeroed days itself — while a route that is absent (`no-usage-plugin`), unreachable, shaped differently or too slow answers `probe-failed` with a short reason and never a previous reading. One `days` window is cached for 30 seconds on this side and concurrent calls merge into it, so two phones asking at once cost the host one read. `usage.session` gained one optional key beside the window: when the host has broadcast no `request/context` window, the answer may carry `modelContextWindow`, taken from `GET {baseURL}/models` of the session's current route — the first available of `context_length`, `context_window` and `max_input_tokens` for that exact model id, cached for ten minutes per route, and sent with that route's own credential. The two numbers are never mixed: `contextWindow` is always the host's measurement, `modelContextWindow` is always the model's declaration, and the second never appears beside the first.
98
98
 
@@ -173,7 +173,7 @@ A registered method is dispatched after both protocol gates: a name no plugin re
173
173
  | `malformed` | the frame is not one JSON object with a recognizable shape |
174
174
  | `direction-violation` | the client sent a `res` or `ev` frame, which only the host sends |
175
175
 
176
- A failure raised inside DSH is not re-labelled either: it crosses with the gateway's own code, such as `service-unavailable`, `invocation-unavailable`, `definition-unavailable` or `arguments-invalid`. A refusal the `dsh-agents` plugin raises crosses the same way: its own stable code — `team-not-found`, `member-not-found`, `preset-unknown`, `workspace-required` and their neighbours — with its own one bounded sentence. Only the service-activation window is retried (five tries, two seconds apart), because that is the one failure that succeeds moments later.
176
+ A failure raised inside DSH is not re-labelled either: it crosses with the gateway's own code, such as `service-unavailable`, `invocation-unavailable`, `definition-unavailable` or `arguments-invalid`. A refusal the `dsh-agents` plugin raises crosses the same way: its own stable code — `team-not-found`, `member-not-found`, `preset-unknown`, `workspace-unavailable` and their neighbours — with its own one bounded sentence. Only the service-activation window is retried (five tries, two seconds apart), because that is the one failure that succeeds moments later.
177
177
 
178
178
  ## Authentication
179
179
 
package/README.zh.md CHANGED
@@ -91,7 +91,7 @@ fork 的方法同样什么都不解释。`session.fork` 把 `sessionId` 与客
91
91
 
92
92
  会话管理通道同样什么都不解释,而它分成两个能力,是因为读与写是两份不同的提供。`workspace.list` 回的是宿主注册表自己的同步投影——每个已注册工作区一行、按注册表自己的顺序、这里不排序、也不带工作区自己的会话账本——旁边是两个全局会话集合;归档是会话级的事实而不是"已归档的工作区",因此这张表里什么都不被过滤,已归档会话仍保留原槽位,`session.unarchive` 就把它放回那里。置顶是注册表全局集合而不是某个工作区内的排序:新的置顶前插、重复置顶既不写也不重排、对已归档会话置顶被宿主拒绝、归档在同一次持久写里丢掉置顶——因此客户端展示的可见顺序是它自己推导的,与桌面端一致。五个写方法一对一映射到本来就拥有这些语义的端点:`session.rename` 打到 `session/rename`,后者先恢复冷会话再写,并回它归一化后的标题与提交它的 seq,所以客户端不需要自己的 resume 路径;`session.pin`、`session.unpin`、`session.archive`、`session.unarchive` 分别打到 `workspace/pinSession`、`workspace/unpinSession`、`workspace/archiveSession`、`workspace/unarchiveSession`。这里不发明布尔参数、也不在桥里分支:`stopActivity` 只在客户端发来布尔值时透传,不带它而会话仍在跑时由宿主以 `workspace/session-active` 拒绝,正是这条拒绝告诉手机该弹确认。这条通道不推任何事件,因为宿主并不把这些写公告成连接能折进增量的 cordis 事件——改名只追加一条 `session/title` 记录——所以客户端每次写成功后自己重读:置顶集合读 `workspace.list`,名册读 `session.list`,新名字写进自己的副本并等标题缓存过期。代价写在这里而不是藏起来:桌面上做的置顶或归档,要等手机下一次刷新才看得见。从未声明 `workspace.v1` 或 `session.admin.v1` 的连接,其背后的方法一律回 `unknown-method`,既不为它读一次注册表,也不为它写一次。
93
93
 
94
- 小队通道是唯一一条不替换任何东西的通道:它读并驱动 `dsh-agents` 插件的小队域,与 `agents.v1` 并排而不是叠在它上面,因此早于它写下的手机仍然拿到当初依赖的预设名册与会话创建。`squads.v1` 背后是五条指令。`squads.state` 回 `{squads, runs, presets?, host:{ownerPid?}}`;`squads.list` 回 `{squads}`、`squads.runs` 回 `{runs}`,两者是同一次读取的两个半区、从同一份应答切出,所以小队名册与运行历史不可能互相矛盾;`squads.runMember` 发 `{squadId, memberId, firstMessage?}`、`squads.runSquad` 发 `{squadId, goal?}`,各自回 `{run}`。`Squad` 是 `{id, name, description?, workspaceId?, leadPreset?, order?, members:[Member]}`,`Member` 是 `{id, name, preset?, permission?, model?, reasoningEffort?, brief?}`;`Run` 是 `{id, squadId, kind:'squad'|'member', memberId?, sessionId, createdAt, status:'running'|'settled'|'failed', failure?}`,其中 `kind` 在这条线上必填,而整队运行出现之前记下的运行(压根不带 `kind`)按它本来就成立的成员运行读。插件留给自己的东西一样都不过线:定义的 `createdAt`/`updatedAt`、成员回指团队的 `teamId`、以及交给 Lead 的 `goal` 都留在宿主那一侧。域是插件自己的域,拒绝也是插件自己的拒绝,带着插件自己的码与那一句有界文案过线——`team-not-found`、`member-not-found`、`preset-registry-unavailable`、`preset-unknown`、`preset-unavailable`、`workspace-required`、`workspace-unavailable`、`workspace-unknown`、`model-pin-invalid`、`session-create-failed` 及其邻居——桥自己只命名插件命名不了的两种条件:`squads-unavailable`,本宿主没有它能到达的小队域,或者回的应答体本构建读不懂;`squads-run-unavailable`,定义读得到、却到达不了任何运行路由,那时回的是这条码而不是一个从未启动的运行。畸形行被拒绝而不是被修补,空应答从不被发明,所以没装插件的宿主回错误而不回空板。域怎么到达属于本桥唯一那条不引依赖的规矩:优先走插件自己在这台机器 loopback origin 上的路由——`GET /dsh-agents/api/state`、`POST /dsh-agents/api/run`、`POST /dsh-agents/api/squad/run`,地址取自 `webServer` 已经在服务的 origin,并在 `origin` 头里带上同一个 origin,正是插件浏览器围栏读作同源信号的那个头——当 loopback 调用根本连不上时,改为只读地读插件账本 `$DSH_HOME/dsh-agents/ledger.json`,按同一套规则校验,此时 `host.ownerPid` 从旁边的插件自己的锁文件读出。任何状态码的应答都不是兜底:那是插件在说话,只有根本没连上的调用才走到账本。这两个方法都不替任何连接代调,从未声明 `squads.v1` 的客户端五条一律得到 `unknown-method`。
94
+ 小队通道是唯一一条不替换任何东西的通道:它读并驱动 `dsh-agents` 插件的小队域,与 `agents.v1` 并排而不是叠在它上面,因此早于它写下的手机仍然拿到当初依赖的预设名册与会话创建。`squads.v1` 背后是五条指令。`squads.state` 回 `{squads, runs, presets?, host:{ownerPid?}}`;`squads.list` 回 `{squads}`、`squads.runs` 回 `{runs}`,两者是同一次读取的两个半区、从同一份应答切出,所以小队名册与运行历史不可能互相矛盾;`squads.runMember` 发 `{squadId, memberId, firstMessage?}`、`squads.runSquad` 发 `{squadId, goal?}`,各自回 `{run}`。`Squad` 是 `{id, name, description?, workspaceId?, leadPreset?, order?, members:[Member]}`,`Member` 是 `{id, name, preset?, permission?, model?, reasoningEffort?, brief?}`;`Run` 是 `{id, squadId, kind:'squad'|'member', memberId?, sessionId, createdAt, status:'running'|'settled'|'failed', failure?}`,其中 `kind` 在这条线上必填,而整队运行出现之前记下的运行(压根不带 `kind`)按它本来就成立的成员运行读。插件留给自己的东西一样都不过线:定义的 `createdAt`/`updatedAt`、成员回指团队的 `teamId`、以及交给 Lead 的 `goal` 都留在宿主那一侧。域是插件自己的域,拒绝也是插件自己的拒绝,带着插件自己的码与那一句有界文案过线——`team-not-found`、`member-not-found`、`preset-registry-unavailable`、`preset-unknown`、`preset-unavailable`、`workspace-unavailable`、`workspace-unknown`、`model-pin-invalid`、`session-create-failed` 及其邻居——桥自己只命名插件命名不了的两种条件:`squads-unavailable`,本宿主没有它能到达的小队域,或者回的应答体本构建读不懂;`squads-run-unavailable`,定义读得到、却到达不了任何运行路由,那时回的是这条码而不是一个从未启动的运行。畸形行被拒绝而不是被修补,空应答从不被发明,所以没装插件的宿主回错误而不回空板。域怎么到达属于本桥唯一那条不引依赖的规矩:优先走插件自己在这台机器 loopback origin 上的路由——`GET /dsh-agents/api/state`、`POST /dsh-agents/api/run`、`POST /dsh-agents/api/squad/run`,地址取自 `webServer` 已经在服务的 origin,并在 `origin` 头里带上同一个 origin,正是插件浏览器围栏读作同源信号的那个头——当 loopback 调用根本连不上时,改为只读地读插件账本 `$DSH_HOME/dsh-agents/ledger.json`,按同一套规则校验,此时 `host.ownerPid` 从旁边的插件自己的锁文件读出。任何状态码的应答都不是兜底:那是插件在说话,只有根本没连上的调用才走到账本。这两个方法都不替任何连接代调,从未声明 `squads.v1` 的客户端五条一律得到 `unknown-method`。
95
95
 
96
96
  用量通道读的是两件属于宿主、而不属于某台设备的事实,因此一个实例服务所有连接。`usage.session` 点名一条会话并回 `{contextWindow?, composition?}`:窗口是本进程看到宿主广播的最近一次 `request/context` 里的 `RequestContext.contextWindow`,组成则是本桥对「下一次请求由什么构成」的估算,分三格——`tools` 取最近一次 `request/header` 的 tools schema 原文,`system` 取最近一条 `system/message` 的文本,`messages` 取此后观察到的每一条 `user/message`、`assistant/message` 与 `tool/result` 的文本——每一格都是 UTF-8 字节数除以四再向下取整,并恒带 `estimated: true`,因为手机绝不能把估算当成宿主的读数。宿主没广播过的键是缺席而不是 0;会话存在而两项读数都取不到时回 `{}`——存在有三处证词:宿主自己的会话名册(与名册方法服务的是同一个 `session/list`,因此本桥从未观察过、当前也不 live 的会话同样算存在)、活会话存储,以及本进程折过的事件——三处都不认这条 id 时才回 `unknown-session`。名册只在另外两处都答不上时才读,且它的答案在五秒内复用,所以一次开屏连问几条只花一次读取;读不到名册的桥退回活会话存储与折叠两条证词。折叠从这一行挂载时开始,且从不读会话日志:挂载之前广播的事件不算读数,因此整段都跑在挂载之前的会话回 `{}`,而不是回一份全是 0 的组成。`usage.balance` 点名一条 provider 路由,回 `{provider, currency, total, toppedUp, granted, updatedAt}`(元口径的金额,取自 `balance_infos[0]`),或回 `{provider, unsupported, reason?}`,取值 `no-credential`、`not-deepseek-route`、`probe-failed`。这条路由必须是官方 DeepSeek 的 id(`deepseek` 或 `deepseek-official`),并且它配置的 `baseURL` 缺席或落在 `https://api.deepseek.com`:余额端点报的是某一个 origin 的账户,拿它去查一个只是复用了 `deepseek` 这个 id 的转售 profile,会把官方账户的钱印在那条路由名下。凭据按宿主自己用量插件的同一套顺序解析——先 pi-ai 记录 `llm-pi-ai/<provider>`,再 profile 的 `apiKeyEnv`,最后 DeepSeek 适配器自己的引用(默认 `DEEPSEEK_API_KEY`)——OAuth grant 在这里不算凭据,因为官方端点只认 API key。同一条读数按 provider + 凭据缓存 60 秒,并发调用合并成一次上游请求;401、超时与认不出的应答体都回 `probe-failed`,绝不把上一轮的读数当成当前值发出去。从未声明 `usage.v1` 的客户端,这两个方法都回 `unknown-method`,桥也不会替它折一条事件、更不会替它打一次上游请求。`usage.stats` 读的是另一个插件记的台账,所以它是 `usage.stats.v1` 背后独立的一个能力、也是独立的一条读路:一条 `GET /api/dsh-usage/overview`,外加——只在请求的窗口比那份文档自带的 30 天更深时——对台账确实记过的每一天各一条 `GET /api/dsh-usage/day?date=YYYY-MM-DD`。台账里没有条目的日子按真实的 0 过线(宿主自己对那些日期答的也是全 0 的一天),而路由不存在(`no-usage-plugin`)、连接不上、形状不符或太慢都回 `probe-failed` 并带一句短原因,绝不拿上一轮的读数顶上。同一个 `days` 窗口在本桥这一侧缓存 30 秒,并发调用合并进去,所以两台手机同时问只让宿主读一次。`usage.session` 在窗口旁边多了一个可选键:宿主没广播过 `request/context` 窗口时,应答可以带上 `modelContextWindow`,取自这条会话当前路由的 `GET {baseURL}/models`——按模型 id 精确匹配后依次取 `context_length`、`context_window`、`max_input_tokens` 里第一个可用值,按路由缓存十分钟,并带上这条路由自己的凭据。两个数字永不混用:`contextWindow` 恒为宿主实测,`modelContextWindow` 恒为模型声明,后者也永不与前者同时出现。
97
97
 
@@ -170,7 +170,7 @@ fork 的方法同样什么都不解释。`session.fork` 把 `sessionId` 与客
170
170
  | `malformed` | 该帧不是形状可辨的单个 JSON 对象 |
171
171
  | `direction-violation` | 客户端发来了只有宿主才发的 `res` 或 `ev` 帧 |
172
172
 
173
- 在 DSH 内部产生的失败同样不被改名:它带着 gateway 自己的错误码穿过桥,例如 `service-unavailable`、`invocation-unavailable`、`definition-unavailable`、`arguments-invalid`。`dsh-agents` 插件抛出的拒绝也这样穿过:带它自己的稳定错误码——`team-not-found`、`member-not-found`、`preset-unknown`、`workspace-required` 及其邻居——以及它自己那一句有界文案。只有服务激活窗口会被重试(5 次、间隔 2 秒),因为那是唯一「片刻后即成功」的失败。
173
+ 在 DSH 内部产生的失败同样不被改名:它带着 gateway 自己的错误码穿过桥,例如 `service-unavailable`、`invocation-unavailable`、`definition-unavailable`、`arguments-invalid`。`dsh-agents` 插件抛出的拒绝也这样穿过:带它自己的稳定错误码——`team-not-found`、`member-not-found`、`preset-unknown`、`workspace-unavailable` 及其邻居——以及它自己那一句有界文案。只有服务激活窗口会被重试(5 次、间隔 2 秒),因为那是唯一「片刻后即成功」的失败。
174
174
 
175
175
  ## 鉴权
176
176