mirror of
https://gitcode.com/JianFeeeee/homeagent-sdk.git
synced 2026-10-02 23:24:16 +00:00
docs: 补两篇指南 —— 工具并发声明、流式多 tool_call
`ParallelSafe` / `Serial` / `stream_index` 三个新能力此前**零文档**: README 提到 `Serial` 的那处是 UART 串口,与并发声明无关。插件作者只能 读源码注释才能知道这些字段存在及其优先级。 ## docs/guide/parallel-tool-declaration.md - 保守 opt-in 的理由:存量插件不改一行就得串行,不会被升级意外并发 - 声明 `ParallelSafe` 的三个条件(线程安全 / 不争抢资源 / 顺序无关) - `Serial` 存在的意义:让"我确认过**必须**串行"与"我没想过"可区分 - **`Serial` 胜出**,不允许被 `ParallelSafe` 或默认值覆盖 - 声明字段放在 `ToolDef` 末尾,遵循既有 `NoMemory` 风格 - 压测效果 N=2/4/8 → 1.41×/2.22×/3.88×,并附"必须同时统计实际执行数" 的理由(旧适配器耗时更短但实际处理 0 个工具) ## docs/guide/stream-tool-call-index.md 面向写 Lua 适配器的人: - 上游 `index` 字段的用途:分桶累积 `id`/`name`/`arguments` - **键名是 `stream_index` 不是 `index`** —— 写错会被 Go 解码器静默丢弃 - 不透传的实际后果:name 互相覆盖、args 碎片混拼、工具被当空参数调用 - 顺带记两个易踩点:不能按 name 过滤分片;扁平结构的协议族同样要带 - 自检命令;并注明 `gemini.lua` 不涉及(协议是 `functionCall`) ## 其它 - `mkdocs.yml` nav 登记两篇 —— 之前它们会被 mkdocs 明确警告 "not included in the nav configuration",等于在站点里不可达 - 重跑 `tools/apidoc/build.sh` 同步 `docs/api/*`、`llms.txt`(生成物) 核实过的事实,避免臆造: - 内置工具声明是**核心仓**的 `toolDefOptions`/`parallelOpts()` (`internal/agent/core/tooldefs.go`),不是 `sdk.BuiltinToolDef` —— 初稿写错 - `gemini.lua` 对 `functionCall|tool_calls` 匹配数为 0,确认无流式实现 - `server/kimicode/anthropic/ollama` 四个适配器确有 `stream_index`(2~5 处) - 跨仓相对链接不可解析,故改为纯文本路径指路 `docs/api/tools.md` 属生成物(首行注明"请勿手改"),其 `ToolDef` 签名被截断、 不展示字段 —— 这是生成器既有行为,本次 diff 只是行号漂移,未改它。
This commit is contained in:
@ -30,6 +30,13 @@ SDK 里的取值枚举。其中带「仅内置」标注的取值在内核侧会
|
||||
| `RecallPolicyNone` | |
|
||||
| `RecallPolicyAuto` | |
|
||||
|
||||
## ScenePolicyAuto 等
|
||||
|
||||
| 名称 | 说明 |
|
||||
|---|---|
|
||||
| `ScenePolicyAuto` | |
|
||||
| `ScenePolicyNone` | |
|
||||
|
||||
## PriorityL1 等
|
||||
|
||||
| 名称 | 说明 |
|
||||
|
||||
@ -203,7 +203,7 @@ SetAutoRestart 设置插件崩溃后内核是否自动重启它。
|
||||
| [`a2a`](../examples/index.md#a2a) | `example/a2a/plugin.go:47` | `s.SetAutoRestart(true)` |
|
||||
| [`acp`](../examples/index.md#acp) | `example/acp/plugin.go:47` | `s.SetAutoRestart(true)` |
|
||||
| [`ai_image`](../examples/index.md#ai_image) | `example/ai_image/plugin.go:110` | `s.SetAutoRestart(true)` |
|
||||
| [`bili`](../examples/index.md#bili) | `example/bili/plugin.go:25` | `s.SetAutoRestart(true)` |
|
||||
| [`bili`](../examples/index.md#bili) | `example/bili/plugin.go:63` | `s.SetAutoRestart(true)` |
|
||||
|
||||
<small>`plugin.go:888`</small>
|
||||
|
||||
|
||||
@ -191,7 +191,7 @@ sett 在 New 时一次性写入且无 setter,故不需要加锁。
|
||||
| [`a2a`](../examples/index.md#a2a) | `example/a2a/plugin.go:68` | `s.Settings().RegisterDef(sdk.ConfigDef{` |
|
||||
| [`acp`](../examples/index.md#acp) | `example/acp/plugin.go:63` | `s.Settings().RegisterDef(sdk.ConfigDef{` |
|
||||
| [`ai_image`](../examples/index.md#ai_image) | `example/ai_image/plugin.go:114` | `s.Settings().RegisterDef(sdk.ConfigDef{` |
|
||||
| [`bili`](../examples/index.md#bili) | `example/bili/plugin.go:29` | `s.Settings().RegisterDef(sdk.ConfigDef{` |
|
||||
| [`bili`](../examples/index.md#bili) | `example/bili/plugin.go:67` | `s.Settings().RegisterDef(sdk.ConfigDef{` |
|
||||
|
||||
<small>`plugin.go:505`</small>
|
||||
|
||||
|
||||
@ -24,8 +24,8 @@ func (c *StageContext) Lock()
|
||||
|---|---|---|
|
||||
| [`a2a`](../examples/index.md#a2a) | `example/a2a/plugin.go:158` | `p.sessMu.Lock()` |
|
||||
| [`acp`](../examples/index.md#acp) | `example/acp/plugin.go:128` | `p.srvMu.Lock()` |
|
||||
| [`bili`](../examples/index.md#bili) | `example/bili/plugin.go:37` | `p.runMu.Lock()` |
|
||||
| [`browser`](../examples/index.md#browser) | `example/browser/plugin.go:427` | `p.mu.Lock()` |
|
||||
| [`calendar`](../examples/index.md#calendar) | `example/calendar/plugin.go:433` | `p.mu.Lock()` |
|
||||
|
||||
<small>`plugin.go:211`</small>
|
||||
|
||||
@ -147,8 +147,8 @@ func (c *StageContext) Unlock()
|
||||
|---|---|---|
|
||||
| [`a2a`](../examples/index.md#a2a) | `example/a2a/plugin.go:164` | `p.sessMu.Unlock()` |
|
||||
| [`acp`](../examples/index.md#acp) | `example/acp/plugin.go:129` | `defer p.srvMu.Unlock()` |
|
||||
| [`bili`](../examples/index.md#bili) | `example/bili/plugin.go:40` | `p.runMu.Unlock()` |
|
||||
| [`browser`](../examples/index.md#browser) | `example/browser/plugin.go:432` | `p.mu.Unlock()` |
|
||||
| [`calendar`](../examples/index.md#calendar) | `example/calendar/plugin.go:523` | `p.mu.Unlock()` |
|
||||
|
||||
<small>`plugin.go:212`</small>
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ RegisterTool registers a tool that the LLM can call.
|
||||
| [`a2a`](../examples/index.md#a2a) | `example/a2a/plugin.go:76` | `s.RegisterTool(tp+"a2a_query", sdk.ToolDef{` |
|
||||
| [`acp`](../examples/index.md#acp) | `example/acp/plugin.go:70` | `s.RegisterTool(tp+"acp_query", sdk.ToolDef{` |
|
||||
| [`ai_image`](../examples/index.md#ai_image) | `example/ai_image/plugin.go:159` | `s.RegisterTool(tp+"generate", sdk.ToolDef{` |
|
||||
| [`bili`](../examples/index.md#bili) | `example/bili/plugin.go:47` | `s.RegisterTool(tp+"video", sdk.ToolDef{` |
|
||||
| [`bili`](../examples/index.md#bili) | `example/bili/plugin.go:85` | `s.RegisterTool(tp+"video", sdk.ToolDef{` |
|
||||
|
||||
<small>`plugin.go:557`</small>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user