feat: support MCP elicitation and rebuild release
This commit is contained in:
11
fixtures/gitea-workflow/bot-self-comment.json
Normal file
11
fixtures/gitea-workflow/bot-self-comment.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "bot-self-comment",
|
||||
"headers": {"x-gitea-event": "issue_comment", "x-gitea-delivery": "delivery-bot-001"},
|
||||
"payload": {
|
||||
"repository": {"owner": "acme", "name": "widget"},
|
||||
"issue": {"number": 42, "pull_request": false},
|
||||
"comment": {"id": 303, "body": "@ccweb-bot 状态更新", "user": {"login": "ccweb-bot", "type": "Bot"}},
|
||||
"sender": {"login": "ccweb-bot", "is_bot": true}
|
||||
},
|
||||
"expected": {"accepted": false, "reason": "bot_self_comment"}
|
||||
}
|
||||
19
fixtures/gitea-workflow/ignored-events.json
Normal file
19
fixtures/gitea-workflow/ignored-events.json
Normal file
@@ -0,0 +1,19 @@
|
||||
[
|
||||
{
|
||||
"name": "push-event",
|
||||
"headers": {"x-gitea-event": "push", "x-gitea-delivery": "delivery-push-001"},
|
||||
"payload": {"repository": {"owner": "acme", "name": "widget"}, "sender": {"login": "alice"}},
|
||||
"expected": {"accepted": false, "reason": "unsupported_event"}
|
||||
},
|
||||
{
|
||||
"name": "comment-without-mention",
|
||||
"headers": {"x-gitea-event": "issue_comment", "x-gitea-delivery": "delivery-no-mention-001"},
|
||||
"payload": {
|
||||
"repository": {"owner": "acme", "name": "widget"},
|
||||
"issue": {"number": 42, "pull_request": false},
|
||||
"comment": {"id": 404, "body": "请看看这个问题", "user": {"login": "alice"}},
|
||||
"sender": {"login": "alice", "is_bot": false}
|
||||
},
|
||||
"expected": {"accepted": false, "reason": "missing_mention"}
|
||||
}
|
||||
]
|
||||
16
fixtures/gitea-workflow/mcp-thread-config.json
Normal file
16
fixtures/gitea-workflow/mcp-thread-config.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"cwd": "/var/lib/ccweb/workspaces/default/acme/widget",
|
||||
"mcpServer": {
|
||||
"name": "gitea",
|
||||
"command": "gitea-mcp",
|
||||
"args": ["-t", "stdio", "-H", "https://gitea.example"],
|
||||
"env": {"GITEA_ACCESS_TOKEN": "secret-ref:gitea-bot-token"}
|
||||
},
|
||||
"collaborationMode": {
|
||||
"settings": {
|
||||
"model": "configured-model",
|
||||
"reasoning_effort": "medium",
|
||||
"developer_instructions": "只在授权工作区内操作并回帖"
|
||||
}
|
||||
}
|
||||
}
|
||||
28
fixtures/gitea-workflow/mock-gitea-mcp.js
Normal file
28
fixtures/gitea-workflow/mock-gitea-mcp.js
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
// 仅用于离线回归:模拟官方 gitea-mcp 的 JSONL initialize 行为。
|
||||
const readline = require('readline');
|
||||
|
||||
const mode = String(process.env.GITEA_MCP_FIXTURE_MODE || 'success');
|
||||
const reader = readline.createInterface({ input: process.stdin });
|
||||
reader.on('line', (line) => {
|
||||
let request;
|
||||
try { request = JSON.parse(line); } catch { return; }
|
||||
if (request.method !== 'initialize') return;
|
||||
if (mode === 'timeout') return;
|
||||
if (mode === 'exit') process.exit(17);
|
||||
if (mode === 'error') {
|
||||
process.stdout.write(`${JSON.stringify({
|
||||
jsonrpc: '2.0', id: request.id, error: { code: -32000, message: 'fixture handshake failed' },
|
||||
})}\n`);
|
||||
return;
|
||||
}
|
||||
process.stdout.write(`${JSON.stringify({
|
||||
jsonrpc: '2.0', id: request.id,
|
||||
result: {
|
||||
protocolVersion: '2024-11-05',
|
||||
capabilities: { tools: {} },
|
||||
serverInfo: { name: 'fixture-gitea-mcp', version: '0.0.0' },
|
||||
},
|
||||
})}\n`);
|
||||
});
|
||||
9
fixtures/gitea-workflow/queue-recovery.json
Normal file
9
fixtures/gitea-workflow/queue-recovery.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"tasks": [
|
||||
{"taskId": "task-queued", "state": "queued", "attempt": 0},
|
||||
{"taskId": "task-running", "state": "running", "attempt": 0},
|
||||
{"taskId": "task-waiting", "state": "waiting_user", "attempt": 0},
|
||||
{"taskId": "task-terminal", "state": "succeeded", "attempt": 0},
|
||||
{"taskId": "task-exhausted", "state": "running", "attempt": 1}
|
||||
]
|
||||
}
|
||||
9
fixtures/gitea-workflow/reply-failure.json
Normal file
9
fixtures/gitea-workflow/reply-failure.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"taskId": "task-reply-001",
|
||||
"turnId": "turn-001",
|
||||
"resourceKey": "default:acme/widget:issue:42",
|
||||
"mcpAccepted": true,
|
||||
"mcpCommentVisible": false,
|
||||
"retryCommentVisible": false,
|
||||
"restFallbackVisible": true
|
||||
}
|
||||
19
fixtures/gitea-workflow/valid-issue-comment.json
Normal file
19
fixtures/gitea-workflow/valid-issue-comment.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "valid-issue-comment",
|
||||
"headers": {
|
||||
"x-gitea-event": "issue_comment",
|
||||
"x-gitea-delivery": "delivery-issue-001"
|
||||
},
|
||||
"payload": {
|
||||
"repository": {
|
||||
"owner": "acme",
|
||||
"name": "widget",
|
||||
"clone_url": "https://gitea.example/acme/widget.git",
|
||||
"default_branch": "main"
|
||||
},
|
||||
"issue": {"number": 42, "pull_request": false},
|
||||
"comment": {"id": 101, "body": "@ccweb-bot 请修复登录校验", "user": {"login": "alice"}},
|
||||
"sender": {"login": "alice", "is_bot": false}
|
||||
},
|
||||
"expected": {"accepted": true, "resourceKind": "issue", "instruction": "请修复登录校验"}
|
||||
}
|
||||
23
fixtures/gitea-workflow/valid-pr-comment.json
Normal file
23
fixtures/gitea-workflow/valid-pr-comment.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "valid-pr-comment",
|
||||
"headers": {
|
||||
"x-gitea-event": "pull_request_comment",
|
||||
"x-gitea-delivery": "delivery-pr-001"
|
||||
},
|
||||
"payload": {
|
||||
"repository": {
|
||||
"owner": "acme",
|
||||
"name": "widget",
|
||||
"clone_url": "https://gitea.example/acme/widget.git",
|
||||
"default_branch": "main"
|
||||
},
|
||||
"pull_request": {
|
||||
"number": 7,
|
||||
"base": {"ref": "main"},
|
||||
"head": {"ref": "feature/login", "repo": {"clone_url": "https://gitea.example/alice/widget.git"}}
|
||||
},
|
||||
"comment": {"id": 202, "body": "请继续处理 @ccweb-bot 的 review 意见", "user": {"login": "bob"}},
|
||||
"sender": {"login": "bob", "is_bot": false}
|
||||
},
|
||||
"expected": {"accepted": true, "resourceKind": "pull_request", "base": "main", "head": "feature/login"}
|
||||
}
|
||||
Reference in New Issue
Block a user