dsh-agent-control-center 0.2.0 → 0.3.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.
- package/CHANGELOG.md +56 -0
- package/README.md +9 -5
- package/README.zh.md +6 -4
- package/client.js +1998 -148
- package/docs/01-CONTRACT.md +1 -1
- package/docs/05-ACCEPTANCE-EVIDENCE.md +39 -0
- package/docs/07-GUIDE.md +1 -1
- package/docs/09-ARCHITECTURE.md +2 -2
- package/docs/10-INSTRUCTION-PREVIEW.md +41 -0
- package/docs/11-EXPORT.md +45 -0
- package/index.js +3 -1
- package/lib/modules/a-agents.js +90 -0
- package/lib/modules/j-instruction.js +624 -0
- package/lib/modules/k-export.js +540 -0
- package/package.json +1 -1
- package/scripts/verify.mjs +2 -0
- package/src/client/app.js +91 -3
- package/src/client/i18n/common.js +6 -0
- package/src/client/i18n/export.js +174 -0
- package/src/client/i18n/instruction.js +236 -0
- package/src/client/kernel.js +13 -0
- package/src/client/pages/agents.js +1 -0
- package/src/client/pages/diagnostics.js +1 -0
- package/src/client/pages/export.js +664 -0
- package/src/client/pages/instruction.js +648 -0
- package/src/client/pages/meta.js +1 -0
- package/src/client/pages/overview.js +1 -0
- package/src/client/pages/recovery.js +1 -0
- package/src/client/pages/sessions.js +1 -0
- package/src/client/pages/templates.js +1 -0
- package/src/client/pages/tools.js +1 -0
- package/src/client/pages/usage.js +1 -0
package/docs/01-CONTRACT.md
CHANGED
|
@@ -39,7 +39,7 @@ dsh-agent-control-center/
|
|
|
39
39
|
| HTTP 前缀 | `/__agent-control-center`(GET `/health`,POST `/api`) |
|
|
40
40
|
| 自有存储 | `$DSH_HOME/dsh-agent-control-center/` |
|
|
41
41
|
| locale 命名空间 | `acc` |
|
|
42
|
-
| 版本 | `0.
|
|
42
|
+
| 版本 | `0.3.0` |
|
|
43
43
|
| 兼容声明 | `dsh.compatibility.dsh = ">=0.2.1-rc.1 <0.3.0"`,`engines.dsh` 同区间 |
|
|
44
44
|
|
|
45
45
|
`package.json` 关键字段(照抄,勿改语义):
|
|
@@ -245,3 +245,42 @@ curl -s http://127.0.0.1:38080/__agent-control-center/health
|
|
|
245
245
|
`/tmp/acc/security.md`;其中 M2 是「查看历史会话指令链」这一功能的固有代价,
|
|
246
246
|
现在由 `$DSH_HOME` 敏感路径拒绝清单兜底。
|
|
247
247
|
- 安全审计 H1/H2/M1/M3/L1 已修复并有回归测试。
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
# 附:0.3.0 验收补充(2026-11-29)
|
|
252
|
+
|
|
253
|
+
0.1.0 / 0.2.0 的结论仍然有效。0.3.0 新增两个只读模块(指令预览 J、会话导出 K)与导航分组;本节只记录新增证据。
|
|
254
|
+
|
|
255
|
+
## 测试
|
|
256
|
+
|
|
257
|
+
- `node --test tests/*.test.mjs` → **332 / 332 pass**(0.2.0 为 309)。
|
|
258
|
+
- 新增:`tests/instruction.test.mjs`(12)、`tests/export.test.mjs`(11);
|
|
259
|
+
`tests/contract.test.mjs` 的模块清单、order 序列与 `overview.summary.short` 计数同步到 11 模块。
|
|
260
|
+
- `scripts/verify.mjs` 的模块表扩充到 11 项(`instruction` / `export` 就绪才显示 ready)。
|
|
261
|
+
|
|
262
|
+
## 真机(隔离 profile `accverify`,重启后 11 模块实测)
|
|
263
|
+
|
|
264
|
+
| 项 | 结果 |
|
|
265
|
+
|---|---|
|
|
266
|
+
| `/health` | `version 0.3.0`;11 模块:`instruction=FULL(5)`、`export=FULL(4)`,其余与 0.2.0 一致(`recovery=PARTIAL`) |
|
|
267
|
+
| `agents.render` | 346 ms,`exact=true`,76,621 B;两条链均在预算内(用户全局 58,423 B / 项目 17,855 B,maxBytes 65,536) |
|
|
268
|
+
| `instruction.chain` | 581 ms,3 个候选文件;`CLAUDE.md` 与 `AGENTS.md` 内容相同被去重(`dedupedBy` 指向 `AGENTS.md`) |
|
|
269
|
+
| `instruction.preview` | 572 ms,`mode=files`,`exact=true`,76,621 B(与 `agents.render` 逐字节一致) |
|
|
270
|
+
| `instruction.session` | 真实会话取出 **29** 个 `agent-instructions` 块,`exact=true`;首块 31,472 B 且 `baseline=true` |
|
|
271
|
+
| `instruction.compare` | 同一会话:files 76,621 B vs session 57,138 B → `deltaBytes=-19,483`,`sameText=false`,并给出「基线写入后文件变大」等解释 |
|
|
272
|
+
| `export.summary` | 19,345 事件 / 443 用户消息 / 2,470 助手消息 / 2,674 工具调用 / 14 错误;估算 markdown 3,351,935 B、json 5,399,348 B |
|
|
273
|
+
| `export.session` | 6.2 s,输出 262,069 B(默认 256 KiB 上限),`truncated=true`,`omittedEvents=12,623`(按事件边界截断) |
|
|
274
|
+
|
|
275
|
+
## 浏览器(真实 Chrome headless)
|
|
276
|
+
|
|
277
|
+
- 导航 **11 项**、mid 布局 **2 个组分隔符**、顺序 `Overview, Tools, Sessions, Usage, Agent info, Export | AGENTS.md, Instruction preview, Templates | Diagnostics, Restart & Resume`。
|
|
278
|
+
- `Instruction preview` 页渲染真实数据(57.4 KiB / 64 KiB 预算条、指令链表、`In effect` 徽标),42,427 字符;`Export` 页进入空态(未选会话),340 字符。
|
|
279
|
+
- 两页均 **0 个错误态块**、**0 console/pageerror**。
|
|
280
|
+
- 截图:`/tmp/ux/v3-instruction.png`、`/tmp/ux/v3-overview.png`。
|
|
281
|
+
|
|
282
|
+
## 未验证 / 已知限制(0.3.0 新增部分)
|
|
283
|
+
|
|
284
|
+
- `instruction.compare` 的 `sameText` 只对「同一 cwd 且两侧都未被截断」有意义;跨 cwd 比较时差异来自不同目录的指令链,页面已用解释文案区分。
|
|
285
|
+
- 会话导出对超大会话(1.9 万事件)耗时 6.2 s,且必然截断;这是只读导出的固有代价,未做流式/分页。
|
|
286
|
+
- 两个新页面只由各自作者做过 mock 与旧实例降级验证,**合并后未做逐项交互回归**(本轮只做了渲染/空态/错误态断言)。
|
package/docs/07-GUIDE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 用户指南:从「我想做什么」出发
|
|
2
2
|
|
|
3
|
-
> 适用版本 **0.
|
|
3
|
+
> 适用版本 **0.3.0**,目标宿主 DSH **0.2.2-rc.5**(兼容区间 `>=0.2.1-rc.1 <0.3.0`)。
|
|
4
4
|
> 本文按**任务**组织,只描述本插件在真实界面上能做什么、失败时看到什么、提示是什么意思。
|
|
5
5
|
> 安装、权限边界、配置字段和刻意限制见 [README.zh.md](../README.zh.md);
|
|
6
6
|
> 内部实现(模块、请求流、存储、扩展点)见 [09-ARCHITECTURE.md](09-ARCHITECTURE.md);
|
package/docs/09-ARCHITECTURE.md
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
DSH Web GUI (browser)
|
|
27
27
|
├── Settings dialog
|
|
28
28
|
│ └── settings.section id=agent-control-center order=200 ← client.js
|
|
29
|
-
│ └──
|
|
29
|
+
│ └── 11 pages (client-side secondary navigation)
|
|
30
30
|
└── HTTP (same origin)
|
|
31
31
|
└── /__agent-control-center/health GET
|
|
32
32
|
└── /__agent-control-center/api POST {method, params}
|
|
@@ -42,7 +42,7 @@ DSH Web GUI (browser)
|
|
|
42
42
|
|
|
43
43
|
### 2.1 入口 `index.js`
|
|
44
44
|
|
|
45
|
-
- 导出:`name`、`VERSION`(`0.
|
|
45
|
+
- 导出:`name`、`VERSION`(`0.3.0`,与 `package.json` 同步)、`HTTP_PREFIX`(`/__agent-control-center`)、`inject = []`、`apply(ctx, rawConfig)`。
|
|
46
46
|
- `inject = []` 是硬约束:**任何宿主服务缺失都不阻止插件激活**,只让对应模块降级为 PARTIAL/BLOCKED。
|
|
47
47
|
- 启动序列(`apply`):
|
|
48
48
|
1. `normalizeConfig(rawConfig)`:未知字段/类型错误/越界 → **加载期直接抛错**(fail loud,不做静默兜底);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# 模块 J · 指令预览(Instruction preview)
|
|
2
|
+
|
|
3
|
+
> 只读。本模块从不写入、备份、恢复或修改任何指令文件。
|
|
4
|
+
|
|
5
|
+
## 为什么需要它
|
|
6
|
+
|
|
7
|
+
`AGENTS.md` 页面告诉你磁盘上有什么;本页告诉你**模型实际收到了什么**。两者常常不同:预算会省略/截断文件,内容去重会只保留一份,`*.local.md` 覆盖层会追加,而会话里保存的是**写入当时的快照**——之后你改了文件,模型看到的就是旧的。
|
|
8
|
+
|
|
9
|
+
## 三个视图
|
|
10
|
+
|
|
11
|
+
| 视图 | 数据来源 | 性质 | 何时可信 |
|
|
12
|
+
|---|---|---|---|
|
|
13
|
+
| 按文件重组(近似) | 当前 cwd 的指令链 + 宿主预算规则 | `mode:'files'` | `exact:true` 时(两条链都在预算内)与宿主注入字节一致;否则是近似 |
|
|
14
|
+
| 按会话精确 | 真实会话日志里 `user/message` 且 `source.kind==='agent-instructions'` 的记录 | `mode:'session'` | 始终精确——这是宿主**已经写进日志**的原文,含 `seq`/时间/`baseline` 标记 |
|
|
15
|
+
| 对比 | 两者 | `mode:'compare'` | 同 cwd 且两侧都未被截断时,`sameText` 才有判断意义 |
|
|
16
|
+
|
|
17
|
+
## API
|
|
18
|
+
|
|
19
|
+
- `instruction.chain({cwd?})` → 指令链(来源 user-global / agents-home / project / project-local;每文件字节、hash、是否进入有效链、是否被去重(`dedupedBy` 指向胜出文件)、是否被预算省略/截断)+ 每条链的预算。
|
|
20
|
+
- `instruction.preview({cwd?})` → `{mode:'files', exact, text, bytes, budget, sections, omitted, truncated, note}`。
|
|
21
|
+
- `instruction.session({sessionId, includeChanges?})` → `{mode:'session', exact:true, items:[{seq, at, baseline, bytes, text, truncated}], count}`;`includeChanges:false` 只留最后一条基线。
|
|
22
|
+
- `instruction.compare({cwd?, sessionId})` → `{filesBytes, sessionBytes, deltaBytes, sameText, exactFiles, sessionSeq, sessionAt, explanations[]}`。
|
|
23
|
+
- `instruction.summary()` → 两个视图名、模块 A 是否可用、预算是否缺失。
|
|
24
|
+
|
|
25
|
+
## 实现依据
|
|
26
|
+
|
|
27
|
+
- 宿主格式:`@deepseek-ai/dsh-agent-instructions/src/render.ts` —— `<system-reminder>` 框架、`Instructions from: <displayPath>` 段落、`Workspace instruction budget N bytes: omitted …; truncated …` 标记、预算内用完整 intro、超预算退回 compact intro。
|
|
28
|
+
- 注入判定:同包 `src/index.ts` —— 基线消息 `source.kind === 'agent-instructions'` 且 `source.baseline === true`;后续变更批次同 kind 但无 baseline。
|
|
29
|
+
- 文本组装与预算判定由模块 A 的 `agents.render` 提供,本模块不重复实现发现/去重逻辑。
|
|
30
|
+
|
|
31
|
+
## 真机观察(accverify,2026-11-29)
|
|
32
|
+
|
|
33
|
+
- 文件侧:76,621 B,`exact:true`(用户全局 58,423 B + 项目 17,855 B,预算 65,536)。
|
|
34
|
+
- 会话侧:某真实会话取出 29 个指令块,首块 31,472 B 且 `baseline:true`。
|
|
35
|
+
- 对比:同一会话 `files 76,621 B` vs `session 57,138 B` → `deltaBytes -19,483`,`sameText:false`,解释为「基线写入后文件变大」。
|
|
36
|
+
|
|
37
|
+
## 限制
|
|
38
|
+
|
|
39
|
+
- 只能看到**已落盘**的会话;正在运行的会话若尚未写入指令块,会话视图会给 `available:false` + 原因。
|
|
40
|
+
- 重组视图不复制宿主的 candidate-group 去重与截断二分搜索的全部细节,因此超预算时只能标近似;此时以会话视图为准。
|
|
41
|
+
- 单响应上限 2 MiB;超长指令块会按序截断并标 `truncated`。
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# 模块 K · 会话导出(Session export)
|
|
2
|
+
|
|
3
|
+
> 只读。不存在删除、归档、续跑或上传路径。
|
|
4
|
+
|
|
5
|
+
## 行为
|
|
6
|
+
|
|
7
|
+
把**一个**会话的时间线导出成可带走的文本:
|
|
8
|
+
|
|
9
|
+
- `markdown`:标题 + 元信息(session id、cwd、创建/更新时间)+ 逐条时间线(`## User` / `## Assistant` / `### Tool call: <name>` / `> Result ...`),token 用量放在折叠块里。
|
|
10
|
+
- `json`:`{version:1, session:{…}, events:[…]}`,每条含 `seq/at/type/role/…`。
|
|
11
|
+
|
|
12
|
+
字节上限:默认 **256 KiB**,硬上限 **1 MiB**(超出范围直接 `bad_request`,不静默截断)。
|
|
13
|
+
|
|
14
|
+
## 截断语义
|
|
15
|
+
|
|
16
|
+
事件**逐条追加**,在下一个事件会越界前停止:
|
|
17
|
+
|
|
18
|
+
- `truncated` 标明发生了截断;`omittedEvents` 是省略的事件数;
|
|
19
|
+
- **绝不返回半个事件**——Markdown 不会停在代码围栏中间,JSON 永远可 `parse`;
|
|
20
|
+
- 响应里 `bytes` 是实际输出字节,`totalBytes` 是不截断时的完整大小。
|
|
21
|
+
|
|
22
|
+
## 安全与隐私
|
|
23
|
+
|
|
24
|
+
- 工具结果只保留 `isError` 与有界预览(默认 600 字符),不输出原始大 payload;
|
|
25
|
+
- 消息内容里的 ``` 会被转义,避免破坏 Markdown 结构;
|
|
26
|
+
- token 只输出**计数**(input/output/cache read/cache write),不输出 prompt 原文中的密钥;共享脱敏函数仍会处理 `sk-…` 一类前缀;
|
|
27
|
+
- 不读取、不修改宿主文件;导出在内存里完成,下载走浏览器 `Blob`。
|
|
28
|
+
|
|
29
|
+
## API
|
|
30
|
+
|
|
31
|
+
- `export.diagnostics()` → 能力、格式、上限与 `policy`(`readOnly/writesSessionLog/deletesSessions/archivesSessions/externalNetwork`)。
|
|
32
|
+
- `export.sessions({limit, query})` → 可供导出的会话列表(标题、更新时间、事件数、是否归档)。
|
|
33
|
+
- `export.summary({id})` → 计数(events/user/assistant/toolCalls/toolResults/toolErrors/errors)与两种格式的估算字节。
|
|
34
|
+
- `export.session({id, format, maxBytes, includeToolResults})` → 导出正文。
|
|
35
|
+
|
|
36
|
+
## 真机观察(accverify,2026-11-29)
|
|
37
|
+
|
|
38
|
+
- 一个 19,345 事件的会话:`export.summary` 报 443 用户消息 / 2,470 助手消息 / 2,674 工具调用 / 14 错误;估算 Markdown 3.35 MB、JSON 5.40 MB。
|
|
39
|
+
- 同会话按默认 256 KiB 导出:6.2 s,输出 262,069 B,`truncated:true`,省略 12,623 个事件。
|
|
40
|
+
|
|
41
|
+
## 限制
|
|
42
|
+
|
|
43
|
+
- 会话很大时导出必然截断,且耗时随事件数增长(上例 6.2 s);没有流式或分页导出。
|
|
44
|
+
- 只导出本插件能读到的会话(`sessionQuery.readSession`);不可读时会 `available:false` + 原因。
|
|
45
|
+
- 宿主侧若有原生导出能力则本模块会标注 `source:'host'` 并复用;当前版本实测宿主未暴露可直接复用的公开导出方法,因此 `source:'plugin'`,渲染由本模块完成。
|
package/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { createRegistry } from './lib/core/registry.js'
|
|
|
15
15
|
|
|
16
16
|
export const name = 'dsh-agent-control-center'
|
|
17
17
|
/** Plugin version, mirrored in package.json. */
|
|
18
|
-
export const VERSION = '0.
|
|
18
|
+
export const VERSION = '0.3.1'
|
|
19
19
|
/** Browser transport prefix. The client fetches it document-relative. */
|
|
20
20
|
export const HTTP_PREFIX = '/__agent-control-center'
|
|
21
21
|
|
|
@@ -56,6 +56,8 @@ const MODULE_MANIFEST = Object.freeze([
|
|
|
56
56
|
{ id: 'templates', load: () => import('./lib/modules/g-templates.js') },
|
|
57
57
|
{ id: 'overview', load: () => import('./lib/modules/h-overview.js') },
|
|
58
58
|
{ id: 'recovery', load: () => import('./lib/modules/i-recovery.js') },
|
|
59
|
+
{ id: 'instruction', load: () => import('./lib/modules/j-instruction.js') },
|
|
60
|
+
{ id: 'export', load: () => import('./lib/modules/k-export.js') },
|
|
59
61
|
])
|
|
60
62
|
|
|
61
63
|
/**
|
package/lib/modules/a-agents.js
CHANGED
|
@@ -1344,6 +1344,95 @@ export default function createModule(core) {
|
|
|
1344
1344
|
* @param {unknown} params
|
|
1345
1345
|
* @returns {Promise<Record<string, any>>}
|
|
1346
1346
|
*/
|
|
1347
|
+
/**
|
|
1348
|
+
* Reassemble the model-facing instruction text from the files on the chain's
|
|
1349
|
+
* effective set, using the host's own frame, intro and budget decisions
|
|
1350
|
+
* (`dsh-agent-instructions/src/render.ts:255-330`). Read-only: nothing is
|
|
1351
|
+
* written, and `exact` states whether every chain stayed inside its budget
|
|
1352
|
+
* (the host then emits the same bytes from the same files).
|
|
1353
|
+
* @param {{ cwd?: string }} input
|
|
1354
|
+
* @returns {Promise<Record<string, any>>}
|
|
1355
|
+
*/
|
|
1356
|
+
async function renderMethod(input) {
|
|
1357
|
+
const resolved = await resolveCwd(input?.cwd)
|
|
1358
|
+
const chainData = await discover({ cwd: resolved.cwd, session: resolved.session })
|
|
1359
|
+
const maxBytes = chainData.config.maxBytes
|
|
1360
|
+
if (maxBytes === null || !(maxBytes > 0) || !Number.isFinite(maxBytes)) {
|
|
1361
|
+
return {
|
|
1362
|
+
available: false,
|
|
1363
|
+
reason: '未读到宿主的指令预算(maxBytes),无法判断哪些文件会进入模型',
|
|
1364
|
+
hint: '检查宿主 configEditor 的 agent-instructions 配置;只读项',
|
|
1365
|
+
cwd: chainData.cwd,
|
|
1366
|
+
projectRoot: chainData.projectRoot,
|
|
1367
|
+
budget: { maxBytes: null, source: chainData.config.maxBytesSource },
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
/** @param {string} kind @returns {Array<{ displayPath: string, content: string }>} */
|
|
1371
|
+
const chainFiles = (kind) => chainData.items
|
|
1372
|
+
.filter((item) => item.readable && !item.tooLarge && !item.deduped
|
|
1373
|
+
&& (kind === 'global'
|
|
1374
|
+
? item.source === 'user-global' || item.source === 'agents-home'
|
|
1375
|
+
: item.source === 'project' || item.source === 'project-local'))
|
|
1376
|
+
.map((item) => ({ displayPath: item.displayPath, content: String(item.text ?? '') }))
|
|
1377
|
+
/**
|
|
1378
|
+
* Drop what the chain's budget omits and shorten what it truncates.
|
|
1379
|
+
* @param {Array<{ displayPath: string, content: string }>} files
|
|
1380
|
+
* @param {Record<string, any>} budget
|
|
1381
|
+
*/
|
|
1382
|
+
function applyBudget(files, budget) {
|
|
1383
|
+
const omitted = new Set(budget.omitted ?? [])
|
|
1384
|
+
const truncatedEntries = new Map((budget.truncated ?? []).map((entry) => [entry.displayPath, entry]))
|
|
1385
|
+
/** @type {Array<{ displayPath: string, content: string }>} */
|
|
1386
|
+
const kept = []
|
|
1387
|
+
for (const file of files) {
|
|
1388
|
+
if (omitted.has(file.displayPath)) continue
|
|
1389
|
+
const cut = truncatedEntries.get(file.displayPath)
|
|
1390
|
+
kept.push(cut === undefined ? file : { displayPath: file.displayPath, content: truncateUtf8(file.content, cut.includedBytes) })
|
|
1391
|
+
}
|
|
1392
|
+
return kept
|
|
1393
|
+
}
|
|
1394
|
+
const included = [
|
|
1395
|
+
...applyBudget(chainFiles('global'), chainData.chains.userGlobal),
|
|
1396
|
+
...applyBudget(chainFiles('project'), chainData.chains.project),
|
|
1397
|
+
]
|
|
1398
|
+
const omitted = [...(chainData.chains.userGlobal.omitted ?? []), ...(chainData.chains.project.omitted ?? [])]
|
|
1399
|
+
const truncated = [...(chainData.chains.userGlobal.truncated ?? []), ...(chainData.chains.project.truncated ?? [])]
|
|
1400
|
+
const exact = omitted.length === 0 && truncated.length === 0
|
|
1401
|
+
const intro = exact ? AGENT_INSTRUCTIONS_INTRO : COMPACT_AGENT_INSTRUCTIONS_INTRO
|
|
1402
|
+
const text = buildInstructionText(included, maxBytes, omitted, truncated, intro)
|
|
1403
|
+
return {
|
|
1404
|
+
available: true,
|
|
1405
|
+
mode: 'files',
|
|
1406
|
+
exact,
|
|
1407
|
+
cwd: chainData.cwd,
|
|
1408
|
+
projectRoot: chainData.projectRoot,
|
|
1409
|
+
text,
|
|
1410
|
+
bytes: byteLength(text),
|
|
1411
|
+
intro,
|
|
1412
|
+
budget: {
|
|
1413
|
+
maxBytes,
|
|
1414
|
+
source: chainData.config.maxBytesSource,
|
|
1415
|
+
userGlobal: {
|
|
1416
|
+
bytes: chainData.chains.userGlobal.bytes,
|
|
1417
|
+
renderedBytes: chainData.chains.userGlobal.renderedBytes,
|
|
1418
|
+
fits: chainData.chains.userGlobal.fits,
|
|
1419
|
+
},
|
|
1420
|
+
project: {
|
|
1421
|
+
bytes: chainData.chains.project.bytes,
|
|
1422
|
+
renderedBytes: chainData.chains.project.renderedBytes,
|
|
1423
|
+
fits: chainData.chains.project.fits,
|
|
1424
|
+
},
|
|
1425
|
+
},
|
|
1426
|
+
sections: included.map((file) => ({ displayPath: file.displayPath, bytes: byteLength(file.content) })),
|
|
1427
|
+
omitted,
|
|
1428
|
+
truncated,
|
|
1429
|
+
warnings: chainData.warnings ?? [],
|
|
1430
|
+
note: exact
|
|
1431
|
+
? '两条链都在预算内:文本由这些文件按宿主格式重新组合,宿主注入的字节应与此相同;会话精确视图可逐一比对。'
|
|
1432
|
+
: '存在省略或截断:这是按预算规则重组的近似文本,宿主实际注入可能有所不同;请以会话精确视图为准。',
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1347
1436
|
async function filesMethod(params) {
|
|
1348
1437
|
const p = util.paramsObject(params)
|
|
1349
1438
|
const requested = optionalStr(p, 'cwd', 4096)
|
|
@@ -1696,6 +1785,7 @@ export default function createModule(core) {
|
|
|
1696
1785
|
},
|
|
1697
1786
|
methods: {
|
|
1698
1787
|
'agents.files': async (params) => filesMethod(params),
|
|
1788
|
+
'agents.render': async (params) => renderMethod(util.paramsObject(params)),
|
|
1699
1789
|
'agents.list': async (params) => filesMethod(params),
|
|
1700
1790
|
'agents.read': async (params) => readMethod(params),
|
|
1701
1791
|
'agents.save': async (params, context) => saveMethod(params, context),
|