attention-manifest-protocol 0.5.0 → 0.6.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 +33 -0
- package/CHANGELOG.zh-CN.md +33 -0
- package/README.md +5 -1
- package/README.zh-CN.md +5 -1
- package/lib/bayes/calibrationRegistry.d.ts +12 -0
- package/lib/bayes/calibrationRegistry.js +22 -0
- package/lib/database/adapter/filesystemStore.d.ts +7 -0
- package/lib/database/adapter/filesystemStore.js +9 -0
- package/lib/database/entity/entity.d.ts +15 -0
- package/lib/database/entity/entity.js +27 -0
- package/lib/database/repository/fileOutlineRepository.d.ts +12 -0
- package/lib/database/repository/fileOutlineRepository.js +14 -0
- package/lib/file/index.d.ts +2 -0
- package/lib/file/index.js +1 -0
- package/lib/file/runtime.d.ts +2 -0
- package/lib/file/runtime.js +2 -0
- package/lib/file/scopedStore.js +1 -0
- package/lib/file/service.d.ts +16 -0
- package/lib/file/service.js +45 -1
- package/lib/file/types.d.ts +6 -0
- package/lib/knowledge/registry.d.ts +6 -0
- package/lib/knowledge/registry.js +13 -0
- package/lib/module/index.d.ts +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/mcp/binding.d.ts +94 -0
- package/lib/module/mcp/binding.js +97 -0
- package/lib/module/tool/tool.d.ts +6 -0
- package/lib/module/tool/tool.js +18 -0
- package/lib/outline/index.d.ts +1 -0
- package/lib/outline/index.js +1 -0
- package/lib/outline/outline.d.ts +19 -0
- package/lib/outline/outline.js +42 -0
- package/lib/outline/outlineKeywords.d.ts +10 -0
- package/lib/outline/outlineKeywords.js +35 -0
- package/lib/outline/rangeBridge.d.ts +151 -0
- package/lib/outline/rangeBridge.js +122 -0
- package/lib/outline/sqlOutline.d.ts +14 -0
- package/lib/outline/sqlOutline.js +38 -0
- package/lib/protocol/registry.d.ts +49 -0
- package/lib/protocol/registry.js +67 -0
- package/lib/registry/memory.d.ts +22 -0
- package/lib/registry/memory.js +38 -0
- package/lib/runtime/behavior.d.ts +6 -0
- package/lib/runtime/behavior.js +24 -0
- package/lib/skill/registry.d.ts +6 -0
- package/lib/skill/registry.js +13 -0
- package/lib/syntax/syntaxRegistry.d.ts +21 -0
- package/lib/syntax/syntaxRegistry.js +87 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,39 @@ All notable changes to this project are documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this
|
|
6
6
|
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.6.1] - 2026-11-03
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `ProtocolRegistry` can bind a runtime implementation to a registered protocol entry: `bind`, `implementation`, `resolveImplementation` (type-guarded, optional family check) and `bound`. Implementations are stored by reference and never appear in discovery metadata, and `remove`/`clear` drop the bound implementation together with the entry.
|
|
13
|
+
- `ProtocolEntry.family` names the protocol family, so entries registered by `ProtocolRegistry` can be filtered by protocol (`mcp`, `a2a`, ...).
|
|
14
|
+
- MCP is registered as a concrete protocol rather than a separate registry: `mcpProtocolEntry` builds a `family: "mcp"` entry with its protocol version, endpoint and capabilities, and `mcpListTools`, `mcpSyncTools` and `mcpWithdrawTools` read and mirror an endpoint's tools through the bound implementation.
|
|
15
|
+
|
|
16
|
+
### Validation
|
|
17
|
+
|
|
18
|
+
- Joint regression: 189/189 and 50/50 across protocol, registry, discovery, MCP executor, workspace and database suites; source and tools typechecks passed.
|
|
19
|
+
|
|
20
|
+
## [0.6.0] - 2026-11-03
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- `outlineAddress(range, charset, bounds)` and the related line/byte request helpers convert an outline node's `range` into the `startLine`/`endLine` and `offsetBytes`/`endBytes` fields the workspace read and write tools accept, removing the UTF-8 BOM prefix and failing closed on reversed, out-of-bounds or non-representable values.
|
|
25
|
+
- Every mutable registry is read-write: `SkillRegistry`, `KnowledgeRegistry`, `ProtocolRegistry`, `ToolRegistry`, `OutlineRegistry`, `OutlineKeywordRegistry`, `SyntaxRegistry`, `SqlDialectRegistry`, `CalibrationRegistry`, `BehaviorRegistry` and `EntityRegistry` expose `update` and `remove` (plus `clear` for list-shaped containers) on top of `register`.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Writing a file now rebuilds that file's outline and drops its previous cache generation in the same call, so a later outline read never serves the pre-write tree and storage keeps one cache row per file instead of one per edit.
|
|
30
|
+
- `SyntaxRegistry.updateLanguage` and `removeLanguage` release the language's extensions so a new language can claim them.
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- The session-scoped filesystem store did not forward `removeOutline`, silently dropping cache invalidation; it now scopes and forwards it.
|
|
35
|
+
- The calibration registry now accepts a host-supplied model for a scope it has never fitted, so persisted calibration can be restored.
|
|
36
|
+
|
|
37
|
+
### Validation
|
|
38
|
+
|
|
39
|
+
- Joint regression: 168/168 across registry, discovery, outline, runtime and database suites; source and tools typechecks passed.
|
|
40
|
+
|
|
8
41
|
## [0.5.0] - 2026-11-03
|
|
9
42
|
|
|
10
43
|
### Added
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -5,6 +5,39 @@
|
|
|
5
5
|
格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循
|
|
6
6
|
[语义化版本](https://semver.org/lang/zh-CN/)。
|
|
7
7
|
|
|
8
|
+
## [0.6.1] - 2026-11-03
|
|
9
|
+
|
|
10
|
+
### 新增
|
|
11
|
+
|
|
12
|
+
- `ProtocolRegistry` 可为已登记的协议绑定运行时实现:`bind`、`implementation`、`resolveImplementation`(带类型守卫,可选 family 校验)与 `bound`。实现按引用保存,不会出现在发现元数据中;`remove`/`clear` 会连同条目一起丢弃已绑定的实现。
|
|
13
|
+
- `ProtocolEntry.family` 标注协议族,登记到 `ProtocolRegistry` 的条目可按协议(`mcp`、`a2a` 等)筛选。
|
|
14
|
+
- MCP 作为具体协议登记,而不是单开注册中心:`mcpProtocolEntry` 生成携带协议版本、endpoint 与能力的 `family: "mcp"` 条目,`mcpListTools`、`mcpSyncTools` 与 `mcpWithdrawTools` 通过绑定实现读取并镜像该 endpoint 的工具。
|
|
15
|
+
|
|
16
|
+
### 验证
|
|
17
|
+
|
|
18
|
+
- 联合回归 189/189 与 50/50 通过(协议、注册中心、发现、MCP 执行器、工作区与数据库套件);源代码与工具两套类型检查通过。
|
|
19
|
+
|
|
20
|
+
## [0.6.0] - 2026-11-03
|
|
21
|
+
|
|
22
|
+
### 新增
|
|
23
|
+
|
|
24
|
+
- `outlineAddress(range, charset, bounds)` 及配套的行/字节请求辅助函数,把大纲节点的 `range` 转成 workspace 读写工具接受的 `startLine`/`endLine` 与 `offsetBytes`/`endBytes`,扣除 UTF-8 BOM 前缀;倒序、越界或无法精确表示时报错而不静默裁剪。
|
|
25
|
+
- 所有可变注册中心均可读写:`SkillRegistry`、`KnowledgeRegistry`、`ProtocolRegistry`、`ToolRegistry`、`OutlineRegistry`、`OutlineKeywordRegistry`、`SyntaxRegistry`、`SqlDialectRegistry`、`CalibrationRegistry`、`BehaviorRegistry` 与 `EntityRegistry` 在 `register` 之外提供 `update` 与 `remove`(列表型容器另有 `clear`)。
|
|
26
|
+
|
|
27
|
+
### 变更
|
|
28
|
+
|
|
29
|
+
- 写入文件时在同一次调用内重建该文件大纲并删除旧缓存代次,之后读取大纲不会返回写入前的树,存储中也保持每个文件一条缓存而非每次编辑一条。
|
|
30
|
+
- `SyntaxRegistry.updateLanguage` 与 `removeLanguage` 会释放语言的扩展名,允许新语言重新占用。
|
|
31
|
+
|
|
32
|
+
### 修复
|
|
33
|
+
|
|
34
|
+
- 会话限定的文件存储未转发 `removeOutline`,导致缓存失效被静默丢弃;现已按会话键转发。
|
|
35
|
+
- 校准注册中心现在接受宿主为从未拟合过的 scope 提供模型,便于恢复已持久化的校准。
|
|
36
|
+
|
|
37
|
+
### 验证
|
|
38
|
+
|
|
39
|
+
- 联合回归 168/168 通过(注册中心、发现、大纲、运行时与数据库套件);源代码与工具两套类型检查通过。
|
|
40
|
+
|
|
8
41
|
## [0.5.0] - 2026-11-03
|
|
9
42
|
|
|
10
43
|
### 新增
|
package/README.md
CHANGED
|
@@ -59,6 +59,8 @@ The catalog follows `entity → cache → service → repository → SQL → SQL
|
|
|
59
59
|
|
|
60
60
|
These registries are domain-owned catalogs, not a mandate to duplicate every concept as a generic registry. Existing runtime state and policies for ability, cognition, progress and behavior should stay in their domain models; add a read-only catalog/discovery projection only when enumeration is needed. Agents should not write directly to active registries by default. A future contribution flow should create a sourced, versioned proposal and require host authorization, review and audit before activation.
|
|
61
61
|
|
|
62
|
+
Every mutable registry is read-write for the host that owns it: `SkillRegistry`, `KnowledgeRegistry`, `ProtocolRegistry`, `ToolRegistry`, `OutlineRegistry`, `OutlineKeywordRegistry`, `SyntaxRegistry` (languages, token kinds and node kinds), `SqlDialectRegistry`, `CalibrationRegistry`, `BehaviorRegistry` and `EntityRegistry` all expose `update`/`remove` (and `clear` where the container is a list), on top of `register` and their read accessors. An update keeps the entry's registration slot and re-runs the same validation as register, so a host can change or drop an entry in place instead of building a second registry that disagrees with the first; `SyntaxRegistry.updateLanguage`/`removeLanguage` also release and re-use extensions. The host is still the only caller allowed to write these catalogs.
|
|
63
|
+
|
|
62
64
|
The `environment` module describes runtimes, applications, languages and project types as `HostCatalog` modules. `category` is `runtime`, `application`, `language` or `projectType`; `availability` is `unknown`, `available` or `unavailable`, independent of the component lifecycle `status`. Optional `platforms`, `extensions`, `relatedIds`, `skillIds`, `knowledgeIds`, `toolIds` and `protocolIds` link metadata without granting execution access. Hosts explicitly confirm availability; catalog registration does not install software or probe the machine.
|
|
63
65
|
|
|
64
66
|
```ts
|
|
@@ -185,7 +187,7 @@ The `amp_protocol_workspace` v1 response contains `protocol`, `version`, `revisi
|
|
|
185
187
|
| `amp_tool_filesystem_dependency` | Cycles, topological order and bounded closures |
|
|
186
188
|
| `amp_tool_filesystem_ast` | Lossless syntax tree: every non-whitespace token, declaration/markup hierarchy, UTF-8/line ranges; read-only, never executes |
|
|
187
189
|
|
|
188
|
-
The global variant is `amp_tool_globalfs_*`, a naming adapter in [src/global/filesystem.ts](src/global/filesystem.ts) that grants no new root or permission. Outline nodes carry `isFile`/`isDirectory`/`file?`/`directory?`/`path` (for example `add.py#add`) and `range` (UTF-8 bytes plus 1-based lines as bigint; decimal strings on the wire). Strategies cover code, Vue, project manifests, Markdown/TeX/plain text, CSS/SCSS/Sass, HTML, XML/OPML and Office; Office parsing covers DOCX/XLSX/PPTX and treats DOC/XLS/PPT/PUB/ACCDB as best-effort CFB.
|
|
190
|
+
The global variant is `amp_tool_globalfs_*`, a naming adapter in [src/global/filesystem.ts](src/global/filesystem.ts) that grants no new root or permission. Outline nodes carry `isFile`/`isDirectory`/`file?`/`directory?`/`path` (for example `add.py#add`) and `range` (UTF-8 bytes plus 1-based lines as bigint; decimal strings on the wire). `outlineAddress(range, charset, bounds)` in [src/outline/rangeBridge.ts](src/outline/rangeBridge.ts) converts that range into the `startLine`/`endLine` and `offsetBytes`/`endBytes` fields the workspace `read`, `write` and `diff_write` tools accept: it removes the UTF-8 BOM prefix, keeps bytes half-open and lines inclusive, and fails closed on reversed, out-of-bounds or non-representable values instead of clamping. A successful file write rebuilds that file's outline and drops its previous cache generation in the same call, so a later outline read never serves the pre-write tree. Strategies cover code, Vue, project manifests, Markdown/TeX/plain text, CSS/SCSS/Sass, HTML, XML/OPML and Office; Office parsing covers DOCX/XLSX/PPTX and treats DOC/XLS/PPT/PUB/ACCDB as best-effort CFB.
|
|
189
191
|
|
|
190
192
|
### Hooks
|
|
191
193
|
|
|
@@ -206,6 +208,8 @@ await diff.run({ path: "src/new.ts", before: "" });
|
|
|
206
208
|
|
|
207
209
|
### MCP stdio
|
|
208
210
|
|
|
211
|
+
MCP is a concrete protocol, so it is registered in `ProtocolRegistry` rather than a registry of its own. `mcpProtocolEntry(id, name, options)` builds a `family: "mcp"` entry carrying the protocol version (default `2026-07-28`), endpoint and capabilities; `protocols.bind(id, implementation)` attaches the host-built client and transport, and discovery keeps exposing only the entry's metadata. `protocols.resolveImplementation(id, isMcpProtocol, "mcp")` returns the bound endpoint or `undefined` when the family or the object does not match, `mcpListTools(protocol)` reads the advertised tools, `mcpSyncTools(protocol, toolRegistry)` registers new tools, updates changed ones in place and removes tools the endpoint no longer advertises, and `mcpWithdrawTools` drops one endpoint's tools without touching host tools or other protocols. Risk comes only from annotations (`destructiveHint` → destructive, `readOnlyHint` → read, otherwise write), and nothing here turns a URL string into a connection, so registering cannot make the agent reach a host it was not given. `ProtocolRegistry.remove`/`clear` drop the bound implementation together with the entry.
|
|
212
|
+
|
|
209
213
|
```sh
|
|
210
214
|
npm run workspace-agent-demo
|
|
211
215
|
npm run workspace-agent -- --config .cache/workspace-agent.local
|
package/README.zh-CN.md
CHANGED
|
@@ -59,6 +59,8 @@ Context 使用结构树和类型化关系图。项目依赖、导入、调用与
|
|
|
59
59
|
|
|
60
60
|
这些 registry 是各自领域的宿主目录,不要求每个概念都复制成同构 registry。Ability、cognition、progress 等若已有运行时状态、策略或事件模型,应由现有领域模块维护;需要统一枚举时增加只读 catalog/discovery 投影即可。Agent 默认只读正式目录;可选的登记工作流应先创建带来源、版本和提案状态的候选项,再经宿主权限校验、人工审核与审计后发布,不授予模型直接改写已生效条目的能力。
|
|
61
61
|
|
|
62
|
+
每个可变的注册中心对宿主都是可读写的:`SkillRegistry`、`KnowledgeRegistry`、`ProtocolRegistry`、`ToolRegistry`、`OutlineRegistry`、`OutlineKeywordRegistry`、`SyntaxRegistry`(语言、token 类别与节点类别)、`SqlDialectRegistry`、`CalibrationRegistry`、`BehaviorRegistry` 与 `EntityRegistry` 都在 `register` 和读取接口之外提供 `update`/`remove`(列表型容器另有 `clear`)。更新保留原登记位置并执行与注册相同的校验,宿主可以原地修改或删除条目,而不必再建一份与前者不一致的注册中心;`SyntaxRegistry.updateLanguage`/`removeLanguage` 会释放并允许复用扩展名。写这些目录的仍只能是宿主。
|
|
63
|
+
|
|
62
64
|
`environment` 模块将运行时、应用程序、编程语言与项目类型作为 `HostCatalog` 的 module 条目维护。`category` 为 `runtime`、`application`、`language` 或 `projectType`;`availability` 为 `unknown`、`available` 或 `unavailable`,与组件生命周期 `status` 分开。可选的 `platforms`、`extensions`、`relatedIds`、`skillIds`、`knowledgeIds`、`toolIds`、`protocolIds` 描述平台、格式与关联,不授予执行权限。可用性由宿主确认,登记目录不会安装软件或探测本机。
|
|
63
65
|
|
|
64
66
|
```ts
|
|
@@ -188,7 +190,7 @@ import { ToolIds, parseId } from "attention-manifest-protocol/naming";
|
|
|
188
190
|
| `amp_tool_filesystem_ast` | 无损语法树:每个非空白 token、声明/块/标签层级、UTF-8 字节与行范围;只读,不执行 |
|
|
189
191
|
|
|
190
192
|
全局变体为 `amp_tool_globalfs_*`,由 [src/global/filesystem.ts](src/global/filesystem.ts) 做命名适配;它不扩大任何根或权限。
|
|
191
|
-
大纲节点带 `isFile`/`isDirectory`/`file?`/`directory?`/`path`(如 `add.py#add`)与 `range`(UTF-8 字节 + 1-based 行,bigint;JSON
|
|
193
|
+
大纲节点带 `isFile`/`isDirectory`/`file?`/`directory?`/`path`(如 `add.py#add`)与 `range`(UTF-8 字节 + 1-based 行,bigint;JSON 中为十进制字符串)。`outlineAddress(range, charset, bounds)`([src/outline/rangeBridge.ts](src/outline/rangeBridge.ts))把该 range 转成 workspace `read`、`write`、`diff_write` 接受的 `startLine`/`endLine` 与 `offsetBytes`/`endBytes`:扣除 UTF-8 BOM 前缀,字节半开、行闭区间;倒序、越界或无法精确表示时直接报错而不做静默裁剪。文件写入成功后会在同一次调用内重建该文件大纲并删除旧的缓存代次,之后读取大纲不会返回写入前的树。策略覆盖代码、Vue、项目清单、Markdown/TeX/纯文本、CSS/SCSS/Sass、HTML、XML/OPML 与 Office;Office 文件由 `office.ts` 解析 DOCX/XLSX/PPTX,DOC/XLS/PPT/PUB/ACCDB 为 CFB best-effort。
|
|
192
194
|
|
|
193
195
|
### Hooks
|
|
194
196
|
|
|
@@ -209,6 +211,8 @@ await diff.run({ path: "src/new.ts", before: "" });
|
|
|
209
211
|
|
|
210
212
|
### MCP stdio 接入
|
|
211
213
|
|
|
214
|
+
MCP 是一种具体协议,因此登记在 `ProtocolRegistry` 中,而不是单开一个注册中心。`mcpProtocolEntry(id, name, options)` 生成 `family: "mcp"` 的协议条目,携带协议版本(默认 `2026-07-28`)、endpoint 与能力;`protocols.bind(id, implementation)` 绑定宿主自己建好的 client 与 transport,发现接口仍只暴露条目元数据。`protocols.resolveImplementation(id, isMcpProtocol, "mcp")` 在 family 或对象不匹配时返回 `undefined`;`mcpListTools(protocol)` 读取通告的工具,`mcpSyncTools(protocol, toolRegistry)` 注册新工具、原地更新变化的工具、移除 endpoint 不再通告的工具,`mcpWithdrawTools` 撤下一个 endpoint 的工具而不影响宿主工具和其他协议。风险等级只由注解决定(`destructiveHint` → destructive,`readOnlyHint` → read,其余为 write),且不会把 URL 字符串变成连接,因此登记不能让 agent 访问未经宿主的地址。`ProtocolRegistry.remove`/`clear` 会连同条目一起丢弃已绑定的实现。
|
|
215
|
+
|
|
212
216
|
```sh
|
|
213
217
|
npm run workspace-agent-demo
|
|
214
218
|
npm run workspace-agent -- --config .cache/workspace-agent.local
|
|
@@ -35,5 +35,17 @@ export declare class CalibrationRegistry {
|
|
|
35
35
|
register(scope: string, points: readonly CalibrationPoint[], options?: RegisterOptions): RegisterResult;
|
|
36
36
|
calibrate(scope: string, predicted: number): number;
|
|
37
37
|
model(scope: string): CalibrationModel | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Set the model of one scope.
|
|
40
|
+
*
|
|
41
|
+
* Unlike `register`, which fits a model from samples, this stores a complete
|
|
42
|
+
* model as-is: it replaces the scope's current model or creates it. Hosts
|
|
43
|
+
* that persist or hand-author a calibration use this to restore it.
|
|
44
|
+
*/
|
|
45
|
+
update(model: CalibrationModel): CalibrationModel;
|
|
46
|
+
/** Remove one scope's model, returning it to raw probabilities. */
|
|
47
|
+
remove(scope: string): boolean;
|
|
48
|
+
/** Remove every calibrated scope. */
|
|
49
|
+
clear(): number;
|
|
38
50
|
scopes(): string[];
|
|
39
51
|
}
|
|
@@ -55,6 +55,28 @@ export class CalibrationRegistry {
|
|
|
55
55
|
model(scope) {
|
|
56
56
|
return this.models.get(scope);
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Set the model of one scope.
|
|
60
|
+
*
|
|
61
|
+
* Unlike `register`, which fits a model from samples, this stores a complete
|
|
62
|
+
* model as-is: it replaces the scope's current model or creates it. Hosts
|
|
63
|
+
* that persist or hand-author a calibration use this to restore it.
|
|
64
|
+
*/
|
|
65
|
+
update(model) {
|
|
66
|
+
const stored = { ...model };
|
|
67
|
+
this.models.set(stored.scope, stored);
|
|
68
|
+
return { ...stored };
|
|
69
|
+
}
|
|
70
|
+
/** Remove one scope's model, returning it to raw probabilities. */
|
|
71
|
+
remove(scope) {
|
|
72
|
+
return this.models.delete(scope);
|
|
73
|
+
}
|
|
74
|
+
/** Remove every calibrated scope. */
|
|
75
|
+
clear() {
|
|
76
|
+
const count = this.models.size;
|
|
77
|
+
this.models.clear();
|
|
78
|
+
return count;
|
|
79
|
+
}
|
|
58
80
|
scopes() {
|
|
59
81
|
return [...this.models.keys()];
|
|
60
82
|
}
|
|
@@ -88,6 +88,13 @@ export declare class SqliteFilesystemStore implements FilesystemStore {
|
|
|
88
88
|
* @param outline - Parsed outline.
|
|
89
89
|
*/
|
|
90
90
|
saveOutline(rootId: string, outline: OutlineResult): void;
|
|
91
|
+
/**
|
|
92
|
+
* Drop every cached outline of one file, whatever its fingerprint.
|
|
93
|
+
*
|
|
94
|
+
* @param rootId - Session root id.
|
|
95
|
+
* @param path - Root-relative POSIX path.
|
|
96
|
+
*/
|
|
97
|
+
removeOutline(rootId: string, path: string): void;
|
|
91
98
|
/**
|
|
92
99
|
* Load a cached import report by exact fingerprint.
|
|
93
100
|
*
|
|
@@ -236,6 +236,15 @@ export class SqliteFilesystemStore {
|
|
|
236
236
|
saveOutline(rootId, outline) {
|
|
237
237
|
this.outlines.save(rootId, outline, now());
|
|
238
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* Drop every cached outline of one file, whatever its fingerprint.
|
|
241
|
+
*
|
|
242
|
+
* @param rootId - Session root id.
|
|
243
|
+
* @param path - Root-relative POSIX path.
|
|
244
|
+
*/
|
|
245
|
+
removeOutline(rootId, path) {
|
|
246
|
+
this.outlines.remove(rootId, path);
|
|
247
|
+
}
|
|
239
248
|
/**
|
|
240
249
|
* Load a cached import report by exact fingerprint.
|
|
241
250
|
*
|
|
@@ -688,6 +688,21 @@ export declare class EntityRegistry {
|
|
|
688
688
|
* @throws EntityMetadataError for invalid or duplicate metadata.
|
|
689
689
|
*/
|
|
690
690
|
register(entity: Entity): this;
|
|
691
|
+
/**
|
|
692
|
+
* Replace one registered entity, keeping its registration position.
|
|
693
|
+
*
|
|
694
|
+
* @param entity - Validated replacement metadata with the same name.
|
|
695
|
+
* @returns This registry, for chaining.
|
|
696
|
+
* @throws EntityMetadataError for invalid metadata or an unknown name.
|
|
697
|
+
*/
|
|
698
|
+
update(entity: Entity): this;
|
|
699
|
+
/**
|
|
700
|
+
* Remove one entity.
|
|
701
|
+
*
|
|
702
|
+
* @param name - Logical entity name.
|
|
703
|
+
* @returns `true` when it was registered.
|
|
704
|
+
*/
|
|
705
|
+
remove(name: EntityName): boolean;
|
|
691
706
|
/**
|
|
692
707
|
* Look up an entity by logical name.
|
|
693
708
|
*
|
|
@@ -225,6 +225,33 @@ export class EntityRegistry {
|
|
|
225
225
|
this.entities.set(entity.name, entity);
|
|
226
226
|
return this;
|
|
227
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Replace one registered entity, keeping its registration position.
|
|
230
|
+
*
|
|
231
|
+
* @param entity - Validated replacement metadata with the same name.
|
|
232
|
+
* @returns This registry, for chaining.
|
|
233
|
+
* @throws EntityMetadataError for invalid metadata or an unknown name.
|
|
234
|
+
*/
|
|
235
|
+
update(entity) {
|
|
236
|
+
const problems = validateEntity(entity);
|
|
237
|
+
if (problems.length > 0) {
|
|
238
|
+
throw new EntityMetadataError(entity.name, problems);
|
|
239
|
+
}
|
|
240
|
+
if (!this.entities.has(entity.name)) {
|
|
241
|
+
throw new EntityMetadataError(entity.name, ["no entity with this name is registered"]);
|
|
242
|
+
}
|
|
243
|
+
this.entities.set(entity.name, entity);
|
|
244
|
+
return this;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Remove one entity.
|
|
248
|
+
*
|
|
249
|
+
* @param name - Logical entity name.
|
|
250
|
+
* @returns `true` when it was registered.
|
|
251
|
+
*/
|
|
252
|
+
remove(name) {
|
|
253
|
+
return this.entities.delete(name);
|
|
254
|
+
}
|
|
228
255
|
/**
|
|
229
256
|
* Look up an entity by logical name.
|
|
230
257
|
*
|
|
@@ -28,6 +28,18 @@ export declare class FileOutlineRepository extends BaseRepository<FileOutlineRow
|
|
|
28
28
|
* @param at - ISO timestamp for the write.
|
|
29
29
|
*/
|
|
30
30
|
save(rootId: string, outline: OutlineResult, at: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Drop every cached outline of one file regardless of fingerprint.
|
|
33
|
+
*
|
|
34
|
+
* The cache is keyed by content fingerprint, so a write leaves the previous
|
|
35
|
+
* generation behind forever. A writer calls this after it replaces the file
|
|
36
|
+
* and saves the new outline, keeping one row per file instead of one row per
|
|
37
|
+
* edit.
|
|
38
|
+
*
|
|
39
|
+
* @param rootId - Session root id.
|
|
40
|
+
* @param path - Root-relative POSIX path.
|
|
41
|
+
*/
|
|
42
|
+
remove(rootId: string, path: string): void;
|
|
31
43
|
/**
|
|
32
44
|
* Load the outline of one exact fingerprint.
|
|
33
45
|
*
|
|
@@ -73,6 +73,20 @@ export class FileOutlineRepository extends BaseRepository {
|
|
|
73
73
|
created_at: at,
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Drop every cached outline of one file regardless of fingerprint.
|
|
78
|
+
*
|
|
79
|
+
* The cache is keyed by content fingerprint, so a write leaves the previous
|
|
80
|
+
* generation behind forever. A writer calls this after it replaces the file
|
|
81
|
+
* and saves the new outline, keeping one row per file instead of one row per
|
|
82
|
+
* edit.
|
|
83
|
+
*
|
|
84
|
+
* @param rootId - Session root id.
|
|
85
|
+
* @param path - Root-relative POSIX path.
|
|
86
|
+
*/
|
|
87
|
+
remove(rootId, path) {
|
|
88
|
+
this.deleteWhere(conditions(FileOutlineTable, ["root_id", "path"]), rootId, path);
|
|
89
|
+
}
|
|
76
90
|
/**
|
|
77
91
|
* Load the outline of one exact fingerprint.
|
|
78
92
|
*
|
package/lib/file/index.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export { DefaultSyntaxRegistry, SyntaxRegistry, buildSyntaxTreeFromText, createS
|
|
|
32
32
|
export type { SyntaxLanguage, SyntaxLanguageDefinition, SyntaxNode, SyntaxNodeKind, SyntaxNodeKindDefinition, SyntaxToken, SyntaxTokenKind, SyntaxTokenKindDefinition, SyntaxTree, SyntaxTreeOptions, WireSyntaxNode, WireSyntaxToken, WireSyntaxTree, } from "../syntax/syntaxTree.js";
|
|
33
33
|
export { OutlineIndex, buildOutlineIndex, filterOutline, hasLabelPrefix, wireOutline, wireOutlineNode, wireOutlineRange, outlineFromWire } from "../outline/outlineIndex.js";
|
|
34
34
|
export type { OutlinePayload } from "../outline/outlineIndex.js";
|
|
35
|
+
export { OutlineRangeError, outlineAddress, outlineBomOffset, outlineByteRange, outlineLineRange, readByteRequest, readLineRequest, writeByteRequest, writeLineRequest, } from "../outline/rangeBridge.js";
|
|
36
|
+
export type { OutlineAddress, OutlineByteRange, OutlineLineRange, OutlineRangeErrorCode } from "../outline/rangeBridge.js";
|
|
35
37
|
export { extractImports, importedBy, isParseableSource, readSourceFile, resolveImportSpecifier, tokenizeSource } from "./importGraph.js";
|
|
36
38
|
export type { ResolvedSpecifier, SourceFileSnapshot, SourceToken } from "./importGraph.js";
|
|
37
39
|
export { extractExports } from "./exportGraph.js";
|
package/lib/file/index.js
CHANGED
|
@@ -22,6 +22,7 @@ export { DefaultOutlineKeywords, OutlineKeywordRegistry, createOutlineKeywordReg
|
|
|
22
22
|
export { buildSyntaxTree } from "./syntaxTree.js";
|
|
23
23
|
export { DefaultSyntaxRegistry, SyntaxRegistry, buildSyntaxTreeFromText, createSyntaxRegistry, disposeSyntaxNode, syntaxLanguageOf, wireSyntaxTree, } from "../syntax/syntaxTree.js";
|
|
24
24
|
export { OutlineIndex, buildOutlineIndex, filterOutline, hasLabelPrefix, wireOutline, wireOutlineNode, wireOutlineRange, outlineFromWire } from "../outline/outlineIndex.js";
|
|
25
|
+
export { OutlineRangeError, outlineAddress, outlineBomOffset, outlineByteRange, outlineLineRange, readByteRequest, readLineRequest, writeByteRequest, writeLineRequest, } from "../outline/rangeBridge.js";
|
|
25
26
|
export { extractImports, importedBy, isParseableSource, readSourceFile, resolveImportSpecifier, tokenizeSource } from "./importGraph.js";
|
|
26
27
|
export { extractExports } from "./exportGraph.js";
|
|
27
28
|
export { DependencyGraph, buildDependencyReport, graphFromImports } from "./dependency.js";
|
package/lib/file/runtime.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ export declare class SessionRuntime {
|
|
|
50
50
|
persistenceKey(rootId: string): string;
|
|
51
51
|
loadOutline(rootId: string, path: string, fingerprint: string): import("./types.js").OutlineResult | undefined;
|
|
52
52
|
saveOutline(rootId: string, outline: import("../outline/types.js").OutlineResult): void;
|
|
53
|
+
/** Drop every cached generation of one file's outline after it changed. */
|
|
54
|
+
removeOutline(rootId: string, path: string): void;
|
|
53
55
|
/**
|
|
54
56
|
* Resolve a caller path and return the tree that owns it.
|
|
55
57
|
*/
|
package/lib/file/runtime.js
CHANGED
|
@@ -25,6 +25,8 @@ export class SessionRuntime {
|
|
|
25
25
|
persistenceKey(rootId) { return JSON.stringify([this.descriptor.workspaceId ?? "default", this.descriptor.id, rootId]); }
|
|
26
26
|
loadOutline(rootId, path, fingerprint) { return this.store?.loadOutline(rootId, path, fingerprint); }
|
|
27
27
|
saveOutline(rootId, outline) { this.store?.saveOutline(rootId, outline); }
|
|
28
|
+
/** Drop every cached generation of one file's outline after it changed. */
|
|
29
|
+
removeOutline(rootId, path) { this.store?.removeOutline?.(rootId, path); }
|
|
28
30
|
/**
|
|
29
31
|
* Resolve a caller path and return the tree that owns it.
|
|
30
32
|
*/
|
package/lib/file/scopedStore.js
CHANGED
|
@@ -13,6 +13,7 @@ export const scopeFilesystemStore = (store, session) => {
|
|
|
13
13
|
}),
|
|
14
14
|
loadOutline: (rootId, path, fingerprint) => store.loadOutline(key(rootId), path, fingerprint),
|
|
15
15
|
saveOutline: (rootId, outline) => store.saveOutline(key(rootId), outline),
|
|
16
|
+
...(store.removeOutline === (void 0) ? {} : { removeOutline: (rootId, path) => store.removeOutline(key(rootId), path) }),
|
|
16
17
|
loadImports: (rootId, path, fingerprint) => store.loadImports(key(rootId), path, fingerprint),
|
|
17
18
|
saveImports: (rootId, report) => store.saveImports(key(rootId), report),
|
|
18
19
|
loadExports: (rootId, path, fingerprint) => store.loadExports(key(rootId), path, fingerprint),
|
package/lib/file/service.d.ts
CHANGED
|
@@ -152,6 +152,22 @@ export declare class FilesystemService {
|
|
|
152
152
|
*/
|
|
153
153
|
read(runtime: SessionRuntime, request: import("./types.js").ReadRequest): ReadPage;
|
|
154
154
|
write(runtime: SessionRuntime, request: import("./types.js").WriteRequest): Promise<WriteResult>;
|
|
155
|
+
/**
|
|
156
|
+
* Rebuild the outline cache of one written file.
|
|
157
|
+
*
|
|
158
|
+
* A write changes the file's fingerprint, and the cache is keyed by that
|
|
159
|
+
* fingerprint, so a stale row can never be read — but the old generation
|
|
160
|
+
* would linger in storage forever and the next read would parse again. This
|
|
161
|
+
* replaces every generation of the file with the outline of the new content
|
|
162
|
+
* at write time, so "the file changed" and "its outline changed" happen
|
|
163
|
+
* together. A file that cannot be outlined (binary, oversized, Office) is
|
|
164
|
+
* dropped from the cache and is not an error for the write itself.
|
|
165
|
+
*
|
|
166
|
+
* @param runtime - Session runtime owning the root.
|
|
167
|
+
* @param root - The root the written path belongs to.
|
|
168
|
+
* @param path - Caller path of the written file.
|
|
169
|
+
*/
|
|
170
|
+
private refreshOutline;
|
|
155
171
|
outline(runtime: SessionRuntime, request: OutlineRequest): OutlineResult;
|
|
156
172
|
imports(runtime: SessionRuntime, request: ImportRequest): ImportReport;
|
|
157
173
|
exports(runtime: SessionRuntime, request: ExportRequest): ExportReport;
|
package/lib/file/service.js
CHANGED
|
@@ -28,7 +28,7 @@ import { isOfficeFile, officeExports, officeReferences, parseOffice } from "../o
|
|
|
28
28
|
import { buildSyntaxTree } from "./syntaxTree.js";
|
|
29
29
|
import { wireSyntaxTree } from "../syntax/syntaxTree.js";
|
|
30
30
|
import { buildDependencyReport, graphFromImports } from "./dependency.js";
|
|
31
|
-
import { isFilesystemError } from "./errors.js";
|
|
31
|
+
import { fail, isFilesystemError } from "./errors.js";
|
|
32
32
|
import { readPage } from "./read.js";
|
|
33
33
|
import { writeFile } from "./write.js";
|
|
34
34
|
import { SessionRuntime } from "./runtime.js";
|
|
@@ -276,8 +276,52 @@ export class FilesystemService {
|
|
|
276
276
|
};
|
|
277
277
|
const result = await writeFile(runtime.sandbox, runtime.descriptor.id, request, settings);
|
|
278
278
|
runtime.persist(rooted.root, tree.snapshot());
|
|
279
|
+
this.refreshOutline(runtime, rooted.root, request.path);
|
|
279
280
|
return result;
|
|
280
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* Rebuild the outline cache of one written file.
|
|
284
|
+
*
|
|
285
|
+
* A write changes the file's fingerprint, and the cache is keyed by that
|
|
286
|
+
* fingerprint, so a stale row can never be read — but the old generation
|
|
287
|
+
* would linger in storage forever and the next read would parse again. This
|
|
288
|
+
* replaces every generation of the file with the outline of the new content
|
|
289
|
+
* at write time, so "the file changed" and "its outline changed" happen
|
|
290
|
+
* together. A file that cannot be outlined (binary, oversized, Office) is
|
|
291
|
+
* dropped from the cache and is not an error for the write itself.
|
|
292
|
+
*
|
|
293
|
+
* @param runtime - Session runtime owning the root.
|
|
294
|
+
* @param root - The root the written path belongs to.
|
|
295
|
+
* @param path - Caller path of the written file.
|
|
296
|
+
*/
|
|
297
|
+
refreshOutline(runtime, root, path) {
|
|
298
|
+
let relative;
|
|
299
|
+
let node;
|
|
300
|
+
try {
|
|
301
|
+
const rooted = runtime.sandbox.resolve(path, "read");
|
|
302
|
+
relative = rooted.relative;
|
|
303
|
+
node = runtime.treeFor(root).node(relative);
|
|
304
|
+
}
|
|
305
|
+
catch {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
if (node === (void 0) || node.type !== "File") {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
try {
|
|
312
|
+
runtime.removeOutline(root.id, relative);
|
|
313
|
+
}
|
|
314
|
+
catch {
|
|
315
|
+
return fail("store_failure");
|
|
316
|
+
}
|
|
317
|
+
try {
|
|
318
|
+
const outline = buildOutline(runtime.sandbox, relative, { anchor: { file: node } }, { file: node });
|
|
319
|
+
runtime.saveOutline(root.id, outline);
|
|
320
|
+
}
|
|
321
|
+
catch {
|
|
322
|
+
// An unoutlinable file stays uncached; the write already succeeded.
|
|
323
|
+
}
|
|
324
|
+
}
|
|
281
325
|
outline(runtime, request) {
|
|
282
326
|
const { rooted, node, tree } = runtime.node(request.path, "read");
|
|
283
327
|
const cached = runtime.loadOutline(rooted.root.id, rooted.relative, node.fingerprint);
|
package/lib/file/types.d.ts
CHANGED
|
@@ -354,6 +354,12 @@ export interface FilesystemStore {
|
|
|
354
354
|
listWrites(sessionId: string, limit: number): WriteJournalEntry[];
|
|
355
355
|
loadOutline(rootId: string, path: string, fingerprint: string): OutlineResult | undefined;
|
|
356
356
|
saveOutline(rootId: string, outline: OutlineResult): void;
|
|
357
|
+
/**
|
|
358
|
+
* Drop every cached outline of one file. A writer calls this before saving
|
|
359
|
+
* the rebuilt outline so one file keeps one cache row instead of one per
|
|
360
|
+
* edited fingerprint. Optional: in-memory stores may only keep the latest.
|
|
361
|
+
*/
|
|
362
|
+
removeOutline?(rootId: string, path: string): void;
|
|
357
363
|
loadImports(rootId: string, path: string, fingerprint: string): ImportReport | undefined;
|
|
358
364
|
saveImports(rootId: string, report: ImportReport): void;
|
|
359
365
|
loadExports(rootId: string, path: string, fingerprint: string): ExportReport | undefined;
|
|
@@ -13,6 +13,12 @@ export interface KnowledgeEntry {
|
|
|
13
13
|
export declare class KnowledgeRegistry {
|
|
14
14
|
private readonly entries;
|
|
15
15
|
register(knowledge: KnowledgeEntry): KnowledgeEntry;
|
|
16
|
+
/** Replace an existing knowledge entry. The id must stay the same. */
|
|
17
|
+
update(knowledge: KnowledgeEntry): KnowledgeEntry;
|
|
18
|
+
/** Remove one knowledge entry; the result says whether it existed. */
|
|
19
|
+
remove(id: string): boolean;
|
|
20
|
+
/** Remove every knowledge entry and report how many were dropped. */
|
|
21
|
+
clear(): number;
|
|
16
22
|
get(id: string): KnowledgeEntry | undefined;
|
|
17
23
|
list(): KnowledgeEntry[];
|
|
18
24
|
has(id: string): boolean;
|
|
@@ -25,6 +25,19 @@ export class KnowledgeRegistry {
|
|
|
25
25
|
validateKnowledge(knowledge);
|
|
26
26
|
return this.entries.register(knowledge);
|
|
27
27
|
}
|
|
28
|
+
/** Replace an existing knowledge entry. The id must stay the same. */
|
|
29
|
+
update(knowledge) {
|
|
30
|
+
validateKnowledge(knowledge);
|
|
31
|
+
return this.entries.update(knowledge.id, knowledge);
|
|
32
|
+
}
|
|
33
|
+
/** Remove one knowledge entry; the result says whether it existed. */
|
|
34
|
+
remove(id) {
|
|
35
|
+
return this.entries.remove(id);
|
|
36
|
+
}
|
|
37
|
+
/** Remove every knowledge entry and report how many were dropped. */
|
|
38
|
+
clear() {
|
|
39
|
+
return this.entries.clear();
|
|
40
|
+
}
|
|
28
41
|
get(id) {
|
|
29
42
|
return this.entries.get(id);
|
|
30
43
|
}
|
package/lib/module/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from "./tool/globalExecutor.js";
|
|
|
9
9
|
export * from "./tool/controlExecutor.js";
|
|
10
10
|
export * from "./tool/filesystemExecutor.js";
|
|
11
11
|
export * from "./tool/globalFilesystemExecutor.js";
|
|
12
|
+
export * from "./mcp/binding.js";
|
|
12
13
|
export * from "./mcp/workspaceServer.js";
|
|
13
14
|
export * from "./mcp/filesystemServer.js";
|
|
14
15
|
export * from "./sandbox/sandbox.js";
|
package/lib/module/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export * from "./tool/globalExecutor.js";
|
|
|
9
9
|
export * from "./tool/controlExecutor.js";
|
|
10
10
|
export * from "./tool/filesystemExecutor.js";
|
|
11
11
|
export * from "./tool/globalFilesystemExecutor.js";
|
|
12
|
+
export * from "./mcp/binding.js";
|
|
12
13
|
export * from "./mcp/workspaceServer.js";
|
|
13
14
|
export * from "./mcp/filesystemServer.js";
|
|
14
15
|
export * from "./sandbox/sandbox.js";
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP as one concrete protocol registered in the protocol registry.
|
|
3
|
+
*
|
|
4
|
+
* MCP is a specific wire protocol, not an extension of the tool registry: it
|
|
5
|
+
* has its own version, its own capability set and its own transport. Rather
|
|
6
|
+
* than a second registry, an MCP endpoint is an ordinary `ProtocolEntry`
|
|
7
|
+
* (`family: "mcp"`) whose bound implementation is an `McpProtocol`. That keeps
|
|
8
|
+
* "which protocols does this host speak" in one place, next to A2A, the
|
|
9
|
+
* workspace protocol and anything else a host registers.
|
|
10
|
+
*
|
|
11
|
+
* The implementation owns the client the host already built. Nothing here turns
|
|
12
|
+
* a URL string into a connection, so registering cannot widen what the agent
|
|
13
|
+
* can reach.
|
|
14
|
+
*/
|
|
15
|
+
import type { McpClient } from "./client.js";
|
|
16
|
+
import type { McpTool } from "./protocol.js";
|
|
17
|
+
import type { Transport } from "./transport.js";
|
|
18
|
+
import type { ProtocolEntry } from "../../protocol/registry.js";
|
|
19
|
+
import type { ToolDescriptor, ToolRegistry } from "../tool/tool.js";
|
|
20
|
+
/** Family tag every MCP entry carries. */
|
|
21
|
+
export declare const McpProtocolFamily: string;
|
|
22
|
+
/**
|
|
23
|
+
* Implementation bound to an `mcp` protocol entry.
|
|
24
|
+
*/
|
|
25
|
+
export interface McpProtocol {
|
|
26
|
+
readonly family: typeof McpProtocolFamily;
|
|
27
|
+
/** Client used for `listTools`/`callTool`. */
|
|
28
|
+
readonly client: McpClient;
|
|
29
|
+
/** Optional transport, kept so a host can inspect or close it. */
|
|
30
|
+
readonly transport?: Transport;
|
|
31
|
+
/** Tools last read from this endpoint, in advertised order. */
|
|
32
|
+
readonly tools?: readonly string[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Type guard for `resolveImplementation`.
|
|
36
|
+
*/
|
|
37
|
+
export declare const isMcpProtocol: (value: unknown) => value is McpProtocol;
|
|
38
|
+
/**
|
|
39
|
+
* Risk tier for one MCP tool, derived only from its declared annotations.
|
|
40
|
+
* An unannotated tool is `write`: the safest assumption is that it may act.
|
|
41
|
+
*/
|
|
42
|
+
export declare const mcpToolRisk: (tool: McpTool) => ToolDescriptor["risk"];
|
|
43
|
+
/**
|
|
44
|
+
* Convert one advertised MCP tool into a tool descriptor. The executable name
|
|
45
|
+
* is the bare MCP name, so a server cannot rename it into another namespace.
|
|
46
|
+
*/
|
|
47
|
+
export declare const mcpToolDescriptor: (tool: McpTool) => ToolDescriptor;
|
|
48
|
+
/**
|
|
49
|
+
* Protocol entry for one MCP endpoint.
|
|
50
|
+
*
|
|
51
|
+
* @param id - Host-chosen protocol id, unique in the protocol registry.
|
|
52
|
+
* @param name - Human label.
|
|
53
|
+
* @param options - Optional endpoint, version override, description and status.
|
|
54
|
+
* @returns A validated `family: "mcp"` entry carrying the MCP capabilities.
|
|
55
|
+
*/
|
|
56
|
+
export declare const mcpProtocolEntry: (id: string, name: string, options?: {
|
|
57
|
+
endpoint?: string;
|
|
58
|
+
version?: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
status?: ProtocolEntry["status"];
|
|
61
|
+
capabilities?: readonly string[];
|
|
62
|
+
}) => ProtocolEntry;
|
|
63
|
+
/**
|
|
64
|
+
* Read one endpoint's advertised tool list again.
|
|
65
|
+
*
|
|
66
|
+
* @param protocol - Bound implementation.
|
|
67
|
+
* @returns The advertised tools.
|
|
68
|
+
*/
|
|
69
|
+
export declare const mcpListTools: (protocol: McpProtocol) => Promise<McpTool[]>;
|
|
70
|
+
/**
|
|
71
|
+
* Mirror one endpoint's tools into a tool registry.
|
|
72
|
+
*
|
|
73
|
+
* A new tool is registered, a changed schema/description/risk is updated in
|
|
74
|
+
* place, and a tool the endpoint no longer advertises is removed. The reply
|
|
75
|
+
* lists all three sets so a host can audit the change instead of diffing
|
|
76
|
+
* silently.
|
|
77
|
+
*
|
|
78
|
+
* @param protocol - Bound implementation; `tools` is used as the previous set.
|
|
79
|
+
* @param tools - Registry the runtime executes from.
|
|
80
|
+
* @returns Added, updated and removed descriptors.
|
|
81
|
+
*/
|
|
82
|
+
export declare const mcpSyncTools: (protocol: McpProtocol, tools: ToolRegistry) => Promise<{
|
|
83
|
+
added: ToolDescriptor[];
|
|
84
|
+
updated: ToolDescriptor[];
|
|
85
|
+
removed: string[];
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* Withdraw one endpoint's tools from a tool registry.
|
|
89
|
+
*
|
|
90
|
+
* @param protocol - Bound implementation; `tools` is the last advertised set.
|
|
91
|
+
* @param tools - Registry to withdraw from.
|
|
92
|
+
* @returns Names actually removed.
|
|
93
|
+
*/
|
|
94
|
+
export declare const mcpWithdrawTools: (protocol: McpProtocol, tools: ToolRegistry) => string[];
|