mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-08-03 21:34:40 +00:00
* feat(core): propagate trusted daemon invocation context * test(cli): update ACP startup expectation * refactor(core): centralize ACP capability env key * test(cli): update worktree ACP core mock * test(integration): run daemon context smoke on PRs * test(ci): update no-AK smoke expectation * test(core): cover invocation context isolation * fix(cli): compare ACP capability safely * fix(docs): restore GitHub action input names * fix(core): sanitize private ACP capability from child env * fix(core): reuse private ACP capability env constant * test(cli): cover malformed trusted invocation context * test(acp-bridge): assert exact child environment --------- Co-authored-by: qwen-code-dev-bot <qwen-code-dev-bot@users.noreply.github.com> Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> Co-authored-by: 易良 <1204183885@qq.com>
49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
import { appendFile } from 'node:fs/promises';
|
|
import process from 'node:process';
|
|
|
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
import {
|
|
CallToolRequestSchema,
|
|
ListToolsRequestSchema,
|
|
} from '@modelcontextprotocol/sdk/types.js';
|
|
|
|
const outputFile = process.env['INVOCATION_CONTEXT_ECHO_FILE'];
|
|
if (!outputFile) {
|
|
throw new Error('INVOCATION_CONTEXT_ECHO_FILE is required');
|
|
}
|
|
|
|
const server = new Server(
|
|
{ name: 'invocation-context-echo', version: '1.0.0' },
|
|
{ capabilities: { tools: {} } },
|
|
);
|
|
|
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
tools: [
|
|
{
|
|
name: 'capture_invocation_context',
|
|
description: 'Capture this tool request metadata.',
|
|
inputSchema: {
|
|
type: 'object',
|
|
properties: { probe: { type: 'string' } },
|
|
required: ['probe'],
|
|
additionalProperties: false,
|
|
},
|
|
},
|
|
],
|
|
}));
|
|
|
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
const record = {
|
|
arguments: request.params.arguments ?? {},
|
|
metadata: request.params._meta ?? null,
|
|
privateCapabilityInEnv:
|
|
process.env['QWEN_CODE_PRIVATE_ACP_CAPABILITY'] !== undefined,
|
|
};
|
|
await appendFile(outputFile, `${JSON.stringify(record)}\n`);
|
|
return {
|
|
content: [{ type: 'text', text: JSON.stringify(record) }],
|
|
};
|
|
});
|
|
|
|
await server.connect(new StdioServerTransport());
|