billion-context-dsh 0.2.10 → 0.2.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.en.md +41 -12
- package/README.md +40 -12
- package/cordis.patch.yml +29 -8
- package/dist/commands.d.ts +1 -1
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/dist/tools.d.ts +9 -0
- package/dist/window.d.ts +9 -1
- package/package.json +3 -2
package/README.en.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[English](./README.en.md) | [中文](./README.md)
|
|
4
4
|
|
|
5
5
|
> **⚠️ Beta notice — not for production use**
|
|
6
|
-
> This project (**v0.2.
|
|
6
|
+
> This project (**v0.2.12**) is a work-in-progress beta. The [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) itself is also in **public beta**. **Do not use either in engineering / production environments** — expect breaking changes and rough edges.
|
|
7
7
|
|
|
8
8
|
<p align="center">
|
|
9
9
|
<strong>Built with gratitude on top of these projects</strong> — please give them a ⭐:
|
|
@@ -53,25 +53,53 @@ This is the DeepSeek Harness port of [billion-context-pi](https://github.com/ran
|
|
|
53
53
|
|
|
54
54
|
> 💡 **Want DeepSeek Harness to install it for you?** This repo itself runs on DSH: hand [docs/INSTALL.md](docs/INSTALL.md) to an agent in a session and it will read the guide, inspect your profile, wire the composition, and verify the mount. Two preconditions: ① the config lives under `~/.dsh`, so you approve one file-permission prompt; ② afterwards ask it to call `acp_status` as proof.
|
|
55
55
|
|
|
56
|
+
**Path A (recommended): one-command install via the DSH store / `dsh plugin` (bundle) — globally active right after install, zero configuration.**
|
|
57
|
+
|
|
58
|
+
Click install in DSH's plugin store, or run:
|
|
59
|
+
|
|
56
60
|
```bash
|
|
57
|
-
|
|
61
|
+
dsh plugin --profile web add billion-context-dsh
|
|
58
62
|
```
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
The command installs the package and automatically layers this package's bundle patch ([cordis.patch.yml](cordis.patch.yml)) into the profile's composition. The patch does two things:
|
|
65
|
+
|
|
66
|
+
- **Disables the host `compaction-basic`** — so two backends do not both register `ctx.compaction` in the same realm (modern DSH web bundles already ship this disable; the row is an idempotent safety net that holds on every supported DSH);
|
|
67
|
+
- **Mounts the ACP engine at the HOST plane** — the four model tools (`compress` / `decompress` / `search_context` / `acp_status`), the `/acp` command, the advisory nudge, and the ACP guidance section reach **EVERY mode** of the profile (standard / code / minimal / cordis / custom presets). Window auto-detection and the tools/command/nudge defaults are all on — **no manual configuration needed**.
|
|
68
|
+
|
|
69
|
+
Restart `dsh` afterwards (bundle layers are composed at startup), open a new session, and verify: ask the model to call `acp_status`, or run `/acp status`. Shipped presets (standard / code / cordis) keep their realm-local `compaction-basic` fallback (automatic pressure compression still runs there; the ACP tools and nudge coexist); minimal and presets without a compaction realm use this engine directly.
|
|
70
|
+
|
|
71
|
+
> **DSH version compatibility.** The package declares the peer range
|
|
72
|
+
> `^0.1.0-rc.6 || ^0.1.1-rc.1` for `@deepseek-ai/dsh-compaction`, covering both the
|
|
73
|
+
> `0.1.0-rc.x` and `0.1.1-rc.x` release lines (including the current DSH release;
|
|
74
|
+
> the seam's `src/` is unchanged from `0.1.0-rc.6` to `0.1.1-rc.2`, so the public
|
|
75
|
+
> API is identical). The range is two `||` clauses **on purpose**: npm
|
|
76
|
+
> (node-semver) only lets a prerelease version satisfy a range that carries a
|
|
77
|
+
> comparator on the SAME `[major, minor, patch]` tuple as the candidate, so a lone
|
|
78
|
+
> `^0.1.0-rc.6` can never match `0.1.1-rc.x` (issue #68) — older releases fail to
|
|
79
|
+
> install on DSH 0.1.1-rc.x; upgrade to a release containing this fix.
|
|
80
|
+
|
|
81
|
+
**Path B: plain `npm install` (package only — a composition row is required).**
|
|
63
82
|
|
|
64
83
|
```bash
|
|
65
|
-
|
|
84
|
+
npm install billion-context-dsh
|
|
66
85
|
```
|
|
67
86
|
|
|
68
|
-
|
|
69
|
-
(such as `modelContextLimit` / `prompts`), keep the hand-written composition row — the
|
|
70
|
-
bundle patch ([cordis.patch.yml](cordis.patch.yml)) only inserts the default row without `config`.
|
|
87
|
+
This only installs the package into your project/global store; it does **not** touch any profile — add a composition row as shown below or the engine never mounts.
|
|
71
88
|
|
|
72
|
-
|
|
89
|
+
## Scope & customization
|
|
90
|
+
|
|
91
|
+
Two audiences: ① Path B (plain npm install) users, who must write a composition row; ② Path A users who want custom `config` (the bundle already ships sane defaults — override them with a SAME-ID row).
|
|
92
|
+
|
|
93
|
+
**Custom `config` (Path A bundle users).** Append a `compaction-acp` row with `config:` to your profile patch (e.g. `~/.dsh/profiles/web/cordis.patch.yml`) — the same-id row overrides the bundle's default row:
|
|
94
|
+
|
|
95
|
+
```yaml
|
|
96
|
+
- id: compaction-acp
|
|
97
|
+
name: 'billion-context-dsh'
|
|
98
|
+
config:
|
|
99
|
+
modelContextLimit: 128000 # optional; omit to auto-detect the model's real window (fallback 128000)
|
|
100
|
+
```
|
|
73
101
|
|
|
74
|
-
**Global — host plane, every mode** (recommended).
|
|
102
|
+
**Global — host plane, every mode** (recommended). This is what Path A's bundle already does; plain-npm users add all of the following (bundle users skip the first two rows):
|
|
75
103
|
|
|
76
104
|
```yaml
|
|
77
105
|
# ACP as the global compaction backend: four model tools + `/acp` command +
|
|
@@ -79,6 +107,7 @@ That's it. Then add a composition row where a compaction backend is expected —
|
|
|
79
107
|
# (standard / code / minimal / cordis / custom presets).
|
|
80
108
|
# Must also disable the host compaction-basic: two backends providing
|
|
81
109
|
# `ctx.compaction` in the same realm collide.
|
|
110
|
+
# (The bundle install already ships these two rows.)
|
|
82
111
|
- id: compaction-basic
|
|
83
112
|
disabled: true
|
|
84
113
|
|
|
@@ -171,7 +200,7 @@ This project reuses `acp-kernel`'s compression core and `billion-context-pi`'s d
|
|
|
171
200
|
| Key | Default | Meaning |
|
|
172
201
|
|---|---|---|
|
|
173
202
|
| `modelContextLimit` | auto-detected (fallback `128000`) | Context window used for the kernel's pressure decisions; an explicit value wins and skips the probe |
|
|
174
|
-
| `autoModelContextLimit` | `true` | Probe the model's real window from the model API (`agent.ctx.llm.resolveModelInfo`); fall back to the default on failure, the `/acp` command shows the window source (the `acp_status` model tool carries no window info) |
|
|
203
|
+
| `autoModelContextLimit` | `true` | Probe the model's real window from the model API (`agent.ctx.llm.resolveModelInfo`); fall back to the default on failure, the `/acp` command shows the window source (the `acp_status` model tool carries no window info). A failed probe is surfaced in the host log and the `/acp` panel (`restart to re-probe`) — the failure is cached like a success, so fixing the gateway requires a restart or an explicit `modelContextLimit` before the probe retries |
|
|
175
204
|
| `nudgeMinContextLimitPct` | kernel default `0.45` | Nudge window lower bound (usage fraction) — validation only; the growth-driven trigger has no percentage floor — same default as billion-context-pi |
|
|
176
205
|
| `nudgeMaxContextLimitPct` | engine default `0.70` (kernel/pi default `0.75`) | Over-limit line: above this the nudge fires regardless of growth — deliberately below the host compaction-basic 80% auto-compaction line so the forced nudge fires first; an explicit value wins |
|
|
177
206
|
| `nudgeEmergencyThresholdPct` | engine default `0.85` (kernel/pi default `0.95`) | Emergency nudge (bypasses the per-turn dedup) — lowered from `0.95`: at 95% the model has no room to act and the 80% auto-compaction line shadows it; an explicit value wins |
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[中文](./README.md) | [English](./README.en.md)
|
|
4
4
|
|
|
5
5
|
> **⚠️ 测试版声明——请勿用于生产环境**
|
|
6
|
-
> 本项目(**v0.2.
|
|
6
|
+
> 本项目(**v0.2.12**)仍处于开发中的测试版。[DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 本身也处于**公开测试版**阶段。**请勿将两者用于工程化 / 生产环境**——预期会有破坏性变更与粗糙之处。
|
|
7
7
|
|
|
8
8
|
<p align="center">
|
|
9
9
|
<strong>衷心感谢以下项目——请给它们一个 ⭐:</strong>
|
|
@@ -56,30 +56,58 @@
|
|
|
56
56
|
> 你的 profile、编辑组合配置并验证挂载。前提:① 配置写在 `~/.dsh` 下,需要
|
|
57
57
|
> 你批准一次文件权限;② 装完让它调用 `acp_status` 自证。
|
|
58
58
|
|
|
59
|
+
**方式一(推荐):DSH 商店 / `dsh plugin` 一键装(bundle)——装完即全局生效,零配置。**
|
|
60
|
+
|
|
61
|
+
在 DSH 的插件商店里点安装,或命令行执行:
|
|
62
|
+
|
|
59
63
|
```bash
|
|
60
|
-
|
|
64
|
+
dsh plugin --profile web add billion-context-dsh
|
|
61
65
|
```
|
|
62
66
|
|
|
63
|
-
|
|
64
|
-
|
|
67
|
+
命令内部会装包并把本包的 bundle 补丁([cordis.patch.yml](cordis.patch.yml))自动挂进该 profile 的层栈。补丁做了两件事:
|
|
68
|
+
|
|
69
|
+
- **禁用 host 的 `compaction-basic`**——避免同一 realm 内两个后端同时注册 `ctx.compaction` 冲突(现代 DSH 的 web bundle 已自带该禁用,此行为幂等兜底,任何受支持版本下都成立);
|
|
70
|
+
- **把 ACP 引擎挂到 host 平面**——四种模型工具(`compress` / `decompress` / `search_context` / `acp_status`)、`/acp` 命令、nudge、ACP 提示词段对该 profile 的**所有模式**(standard / code / minimal / cordis / 自定义预设)生效。窗口自动探测、工具/命令/nudge 默认全开,**无需任何手工配置**。
|
|
71
|
+
|
|
72
|
+
装完**重启 `dsh`**(bundle 层在启动时组合),新开会话即可用——让模型调用 `acp_status` 或执行 `/acp status` 自证。shipped 预设(standard / code / cordis)内部的 realm 级 `compaction-basic` 自动压缩兜底仍然保留(这些模式里"自动摘要"照旧,ACP 工具与 nudge 并存);minimal 等不带 compaction realm 的预设直接使用本引擎。
|
|
73
|
+
|
|
74
|
+
> **与 DSH 版本的兼容性。** 包声明 peer 依赖 `@deepseek-ai/dsh-compaction` 为
|
|
75
|
+
> `^0.1.0-rc.6 || ^0.1.1-rc.1`,同时覆盖 `0.1.0-rc.x` 与 `0.1.1-rc.x` 两条 rc 线
|
|
76
|
+
> (含当前最新 DSH release;从 `0.1.0-rc.6` 到 `0.1.1-rc.2`,seam 的 `src/` 源码
|
|
77
|
+
> 零改动,公开 API 完全一致)。范围写成两个并集子句是**有意为之**:npm
|
|
78
|
+
> (node-semver)的预发布匹配规则要求 range 里存在与候选版本**相同
|
|
79
|
+
> `[major, minor, patch]` 元组**的比较器,单一 `^0.1.0-rc.6` 永远匹配不了
|
|
80
|
+
> `0.1.1-rc.x`(issue #68)——因此旧发布的包在 DSH 0.1.1-rc.x 上装不上,
|
|
81
|
+
> 升级到含本次修复的新版本即可。
|
|
82
|
+
|
|
83
|
+
**方式二:纯 `npm install`(只装包,需要手写组合行)。**
|
|
65
84
|
|
|
66
85
|
```bash
|
|
67
|
-
|
|
86
|
+
npm install billion-context-dsh
|
|
68
87
|
```
|
|
69
88
|
|
|
70
|
-
|
|
71
|
-
`modelContextLimit` / `prompts`)时仍建议手写组合行——bundle 补丁
|
|
72
|
-
([cordis.patch.yml](cordis.patch.yml))只插入无 `config` 的默认行。
|
|
89
|
+
这只把包装进你的项目/全局,**不会**触碰任何 profile——请按下方「两种生效范围与自定义」手写组合行,引擎才会挂载。
|
|
73
90
|
|
|
74
|
-
|
|
91
|
+
## 两种生效范围与自定义
|
|
92
|
+
|
|
93
|
+
本节服务于两类人:① 方式二(纯 npm 安装,必须手写组合行);② 方式一用户想自定义 `config`(bundle 已有默认行为,只需用**同 id** 行覆盖)。
|
|
94
|
+
|
|
95
|
+
**自定义 config(方式一 bundle 用户)。** 在你的 profile 补丁(如 `~/.dsh/profiles/web/cordis.patch.yml`)里追加一个 `compaction-acp` 行并附 `config:`——同 id 行覆盖 bundle 的默认行:
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
- id: compaction-acp
|
|
99
|
+
name: 'billion-context-dsh'
|
|
100
|
+
config:
|
|
101
|
+
modelContextLimit: 128000 # 可选;省略时自动探测模型真实窗口(回退 128000)
|
|
102
|
+
```
|
|
75
103
|
|
|
76
|
-
**全局生效(host
|
|
104
|
+
**全局生效(host 平面,所有模式)——推荐**。这是方式一 bundle 的默认行为;纯 npm 安装的用户在 profile 补丁中追加以下全部内容(bundle 用户跳过前两行):
|
|
77
105
|
|
|
78
106
|
```yaml
|
|
79
107
|
# ACP 作为全局压缩后端:四个模型工具 + `/acp` 命令 + nudge + ACP 提示词段,
|
|
80
108
|
# 对所有模式(standard / code / minimal / cordis / 自定义预设)生效。
|
|
81
109
|
# 必须同时禁用 host 的 compaction-basic:同一 realm 内两个后端同时
|
|
82
|
-
# provide `ctx.compaction`
|
|
110
|
+
# provide `ctx.compaction` 会冲突。(bundle 安装已自动带上这两行。)
|
|
83
111
|
- id: compaction-basic
|
|
84
112
|
disabled: true
|
|
85
113
|
|
|
@@ -172,7 +200,7 @@ DSH 的每个模型请求都派生自其 append-only 会话日志(*surface*)
|
|
|
172
200
|
| 键 | 默认值 | 含义 |
|
|
173
201
|
|---|---|---|
|
|
174
202
|
| `modelContextLimit` | 自动探测(回退 `128000`) | 用于内核压力决策的上下文窗口;显式配置时优先且跳过探测 |
|
|
175
|
-
| `autoModelContextLimit` | `true` | 从模型 API 自动探测真实窗口(`agent.ctx.llm.resolveModelInfo`);探测失败回退默认值,`/acp` 命令展示窗口来源(模型工具 `acp_status`
|
|
203
|
+
| `autoModelContextLimit` | `true` | 从模型 API 自动探测真实窗口(`agent.ctx.llm.resolveModelInfo`);探测失败回退默认值,`/acp` 命令展示窗口来源(模型工具 `acp_status` 不含窗口信息)。探测失败会在宿主日志与 `/acp` 面板提示(`restart to re-probe`)——失败结果同样被缓存,修复网关后需重启或显式设置 `modelContextLimit` 才会重新探测 |
|
|
176
204
|
| `nudgeMinContextLimitPct` | 内核默认 `0.45` | Nudge 窗口下界(用量占比)——仅作配置校验,增长路径的触发没有百分比下限——与 billion-context-pi 相同的默认值 |
|
|
177
205
|
| `nudgeMaxContextLimitPct` | engine 默认 `0.70`(内核/pi 默认 `0.75`) | 过限线:超过此值则无论增长与否都触发 nudge——刻意低于宿主 compaction-basic 的 80% 自动压缩线,保证强制 nudge 先触发;显式配置优先 |
|
|
178
206
|
| `nudgeEmergencyThresholdPct` | engine 默认 `0.85`(内核/pi 默认 `0.95`) | 紧急 nudge(绕过每轮去重)——从 `0.95` 下调:95% 时模型已无操作空间且会被 80% 自动压缩线遮蔽;显式配置优先 |
|
package/cordis.patch.yml
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
# dsh bundle patch:
|
|
1
|
+
# dsh bundle patch: makes billion-context-dsh ACTIVE right after a one-command
|
|
2
|
+
# install — the plugin store and `dsh plugin --profile web add
|
|
3
|
+
# billion-context-dsh` both run the same command, and this file (declared in
|
|
4
|
+
# package.json as `dsh.bundle.patch`) becomes a layer of the profile's
|
|
5
|
+
# composition automatically. No manual configuration is needed.
|
|
2
6
|
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
7
|
+
# Two rows land in the profile's composition root:
|
|
8
|
+
# 1. `compaction-basic` disabled — the host's own auto-compaction backend
|
|
9
|
+
# would otherwise register `ctx.compaction` at the root realm too, and
|
|
10
|
+
# only one provider per realm may own that service name. (On dsh
|
|
11
|
+
# 0.1.0-rc.6+ the web-app bundle already ships this disable; the row is
|
|
12
|
+
# idempotent and keeps the plugin self-sufficient on every supported DSH.)
|
|
13
|
+
# 2. `compaction-acp` — the ACP engine, mounted at the HOST plane, so its
|
|
14
|
+
# model tools (`compress`, `decompress`, `search_context`, `acp_status`),
|
|
15
|
+
# the `/acp` command, the advisory nudge, and the guidance section reach
|
|
16
|
+
# EVERY mode (standard / code / minimal / cordis / custom presets) of the
|
|
17
|
+
# profile the plugin was installed into.
|
|
18
|
+
#
|
|
19
|
+
# No `config` is set on purpose: the context window is auto-detected from the
|
|
20
|
+
# model API (fallback 128000) and the built-in prompt copy is used. Users who
|
|
21
|
+
# want custom config write a SAME-ID `compaction-acp` row in their profile's
|
|
22
|
+
# own `cordis.patch.yml` — it overrides this row (see README).
|
|
23
|
+
#
|
|
24
|
+
# Shipped presets (standard / code / cordis) keep their realm-local
|
|
25
|
+
# compaction-basic fallback (automatic pressure compression); minimal and
|
|
26
|
+
# presets without a compaction realm use the host ACP engine directly.
|
|
27
|
+
- id: compaction-basic
|
|
28
|
+
disabled: true
|
|
29
|
+
|
|
9
30
|
- insert:
|
|
10
31
|
- id: compaction-acp
|
|
11
|
-
name: 'billion-context-dsh'
|
|
32
|
+
name: 'billion-context-dsh'
|
package/dist/commands.d.ts
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* @module billion-context-dsh/commands
|
|
5
5
|
*/
|
|
6
6
|
import type { CommandDefinition } from '@deepseek-ai/dsh-commands';
|
|
7
|
-
import type
|
|
7
|
+
import { type ToolEnvironment } from './tools.ts';
|
|
8
8
|
/** Register the /acp command (idempotent per engine). */
|
|
9
9
|
export declare function acpCommand(env: ToolEnvironment): CommandDefinition;
|
package/dist/index.js
CHANGED
|
@@ -3836,6 +3836,9 @@ function requireAgent(exec) {
|
|
|
3836
3836
|
}
|
|
3837
3837
|
return exec.agent;
|
|
3838
3838
|
}
|
|
3839
|
+
async function resolveEffectiveWindow(env, agent) {
|
|
3840
|
+
return env.windowFor === void 0 ? { limit: env.modelContextLimit, source: "explicit" } : await env.windowFor(agent);
|
|
3841
|
+
}
|
|
3839
3842
|
var compressParameters = {
|
|
3840
3843
|
// Tolerated wrapped-arguments form: some models emit
|
|
3841
3844
|
// `{ "arguments": "{\"content\": [...]}" }` (double-nested) or
|
|
@@ -3947,7 +3950,8 @@ async function handleCompress(env, args, exec) {
|
|
|
3947
3950
|
const coreMessages = allLogMessages(session);
|
|
3948
3951
|
const surfaceMessages = eventsToCoreMessages(surfaceEventsOf(session));
|
|
3949
3952
|
const tokenCount = resolveTokenCount(agent, surfaceMessages);
|
|
3950
|
-
const
|
|
3953
|
+
const window = await resolveEffectiveWindow(env, agent);
|
|
3954
|
+
const config = kernelConfigFor({ ...env, modelContextLimit: window.limit });
|
|
3951
3955
|
const turn = env.kernel.processTurn({ messages: coreMessages, state, config, tokenCount });
|
|
3952
3956
|
env.store.set(session, turn.state);
|
|
3953
3957
|
const byRaw = turn.state.messageRefs.byRaw;
|
|
@@ -4231,7 +4235,8 @@ async function handleStatus(env, rawArgs, exec) {
|
|
|
4231
4235
|
const coreMessages = allLogMessages(session);
|
|
4232
4236
|
const surfaceMessages = eventsToCoreMessages(surface, toolNames);
|
|
4233
4237
|
const tokenCount = resolveTokenCount(agent, surfaceMessages);
|
|
4234
|
-
const
|
|
4238
|
+
const window = await resolveEffectiveWindow(env, agent);
|
|
4239
|
+
const config = kernelConfigFor({ ...env, modelContextLimit: window.limit });
|
|
4235
4240
|
const turn = env.kernel.processTurn({ messages: coreMessages, state, config, tokenCount });
|
|
4236
4241
|
const statusMessages = eventsToCoreMessages(
|
|
4237
4242
|
surface.filter((event) => !isCheckpointEvent(event)),
|
|
@@ -4304,6 +4309,7 @@ function windowSourceLabel(window) {
|
|
|
4304
4309
|
if (window.source === "auto") {
|
|
4305
4310
|
return `auto-detected from ${window.provider ?? "?"}/${window.model ?? "?"}`;
|
|
4306
4311
|
}
|
|
4312
|
+
if (window.probeFailed === true) return "default (auto-detection failed \u2014 restart to re-probe)";
|
|
4307
4313
|
return "default (auto-detection unavailable)";
|
|
4308
4314
|
}
|
|
4309
4315
|
async function detectContextWindow(agent, provider, model) {
|
|
@@ -4327,7 +4333,7 @@ async function statusText(env, agent) {
|
|
|
4327
4333
|
const coreMessages = allLogMessages(session);
|
|
4328
4334
|
const surfaceMessages = eventsToCoreMessages(surfaceEventsOf(session));
|
|
4329
4335
|
const estimated = resolveTokenCount(agent, surfaceMessages);
|
|
4330
|
-
const window =
|
|
4336
|
+
const window = await resolveEffectiveWindow(env, agent);
|
|
4331
4337
|
const limit = window.limit;
|
|
4332
4338
|
const lines = [
|
|
4333
4339
|
`ACP status \u2014 session ${session.id}`,
|
|
@@ -4336,6 +4342,9 @@ async function statusText(env, agent) {
|
|
|
4336
4342
|
` estimated context: ${estimated} / ${limit} (${Math.round(estimated / limit * 100)}%)`,
|
|
4337
4343
|
` context window: ${limit} (${windowSourceLabel(window)})`
|
|
4338
4344
|
];
|
|
4345
|
+
if (window.probeFailed === true) {
|
|
4346
|
+
lines.push(` \u26A0 window auto-detection failed \u2014 using the ${limit} fallback (restart to re-probe, or set modelContextLimit explicitly)`);
|
|
4347
|
+
}
|
|
4339
4348
|
const state = structuredClone(env.store.stateFor(session));
|
|
4340
4349
|
const config = kernelConfigFor({ ...env, modelContextLimit: limit });
|
|
4341
4350
|
const turn = env.kernel.processTurn({ messages: coreMessages, state, config, tokenCount: estimated });
|
|
@@ -4569,7 +4578,14 @@ var AcpCompactionEngine = class extends CompactionEngine {
|
|
|
4569
4578
|
window = { limit: DEFAULT_CONTEXT_WINDOW, source: "default", provider, model };
|
|
4570
4579
|
} else {
|
|
4571
4580
|
const detected = await detectContextWindow(agent, provider, model);
|
|
4572
|
-
|
|
4581
|
+
if (detected === null) {
|
|
4582
|
+
this.ctx.logger.warn(
|
|
4583
|
+
`billion-context-dsh: context-window auto-detection failed for ${provider}/${model} \u2014 using the ${DEFAULT_CONTEXT_WINDOW} fallback (restart to re-probe, or set modelContextLimit explicitly)`
|
|
4584
|
+
);
|
|
4585
|
+
window = { limit: DEFAULT_CONTEXT_WINDOW, source: "default", provider, model, probeFailed: true };
|
|
4586
|
+
} else {
|
|
4587
|
+
window = { limit: detected, source: "auto", provider, model };
|
|
4588
|
+
}
|
|
4573
4589
|
}
|
|
4574
4590
|
this.windowCache.set(key, window);
|
|
4575
4591
|
return window;
|