fix: align Lingma tool event lifecycle handling
Handle tool/invokeResult and richer tool/call/sync payloads in the client, and document/retest the verified VSCode monitoring workflow for tool events. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
39
DESIGN.md
39
DESIGN.md
@@ -708,6 +708,45 @@ uvicorn app.main:app --reload --port 8317
|
||||
| → | `chat/ask` (notify!) | 见 `_build_payload` | 不回 result;通过 server push 下推 |
|
||||
| ← | `chat/answer` | `{requestId, text, content}` | 流式 token |
|
||||
| ← | `chat/finish` | `{requestId, sessionId, ...其它元数据}` | 结束信号,含上游真实 sessionId |
|
||||
| ← | `tool/call/sync` | `{requestId?, toolCallId, toolCallStatus, parameters, results?}` | 工具状态与结果回流 |
|
||||
| ← | `tool/invoke` | `{requestId?, toolCallId, ...}` | 工具调用中间事件(兼容旧链路) |
|
||||
| ← | `tool/call/approve` | `{requestId?, toolCallId, approval, ...}` | 工具审批事件 |
|
||||
| ← | `tool/invokeResult` | `{requestId?, toolCallId, name, success, errorMessage, result}` | 工具执行结果事件 |
|
||||
|
||||
### 9.1 Tool call 监控 SOP(VSCode 真实环境)
|
||||
|
||||
目标:拿到 Lingma 扩展真实 method/字段,避免猜测协议。
|
||||
|
||||
1. 确认入口文件
|
||||
- `~/.vscode/extensions/alibaba-cloud.tongyi-lingma-*/package.json`
|
||||
- 查 `main`(当前是 `dist/extension.js`)
|
||||
|
||||
2. 在发送侧打点
|
||||
- 在 `sendRequest` / `sendNotification` 处记录 method 与参数 keys
|
||||
- 优先写文件,不依赖 console
|
||||
|
||||
3. 在入站 `tool/call/sync` handler 打点
|
||||
- 记录 `toolCallId`、`toolCallStatus`、是否包含 `results`
|
||||
|
||||
4. 用真实交互触发
|
||||
- VSCode 内发起会话并触发工具
|
||||
- 点击 Accept/Reject,观察事件闭环
|
||||
|
||||
5. 验证闭环
|
||||
- `tool/call/sync(pending|processing)`
|
||||
- `tool/call/approve`
|
||||
- `tool/invokeResult`
|
||||
- `tool/call/sync(results)`
|
||||
|
||||
6. 回滚
|
||||
- 用备份文件恢复 `dist/extension.js`
|
||||
- 避免长期携带探针到日常环境
|
||||
|
||||
**建议日志位置**:
|
||||
- `~/.lingma/vscode/sharedClientCache/logs/lingma-probe.log`
|
||||
- `~/.lingma/vscode/sharedClientCache/logs/lingma-extension.log`
|
||||
|
||||
**注意**:优先使用 VSCode,不混用 Cursor 扩展环境;`pipe` 连接模式下,扩展层探针最稳定。
|
||||
|
||||
**`chat/ask` payload 关键字段**:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user