mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 04:00:36 +00:00
feat(channels): make plugin-example package publishable
- Update channel-base to use built dist/ output with proper exports - Add README with quick start guide and usage instructions - Add qwen-extension.json manifest for extension discovery - Add start-server CLI for running the mock WebSocket server - Update dependencies from local file: to npm version This enables the plugin-example package to be published and installed as a standalone extension for testing the channel plugin system. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
987eebd1c4
commit
c97c548acb
7 changed files with 180 additions and 9 deletions
36
packages/channels/plugin-example/src/start-server.ts
Normal file
36
packages/channels/plugin-example/src/start-server.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env node
|
||||
/* eslint-disable no-console */
|
||||
/**
|
||||
* Start the mock WebSocket server for testing the plugin-example channel.
|
||||
*
|
||||
* Usage:
|
||||
* npx qwen-channel-plugin-example-server
|
||||
* # or
|
||||
* node node_modules/@qwen-code/channel-plugin-example/dist/start-server.js
|
||||
*
|
||||
* Environment variables:
|
||||
* HTTP_PORT (default: 9200)
|
||||
* WS_PORT (default: 9201)
|
||||
*/
|
||||
import { createMockServer } from './mock-server.js';
|
||||
|
||||
const httpPort = parseInt(process.env['HTTP_PORT'] || '9200', 10);
|
||||
const wsPort = parseInt(process.env['WS_PORT'] || '9201', 10);
|
||||
|
||||
const server = await createMockServer({ httpPort, wsPort });
|
||||
|
||||
console.log(`Mock server running:`);
|
||||
console.log(` HTTP: http://localhost:${server.httpPort}`);
|
||||
console.log(` WS: ws://localhost:${server.wsPort}`);
|
||||
console.log();
|
||||
console.log(`Send a test message:`);
|
||||
console.log(` curl -sX POST http://localhost:${server.httpPort}/message \\`);
|
||||
console.log(` -H 'Content-Type: application/json' \\`);
|
||||
console.log(
|
||||
` -d '{"senderId":"user1","senderName":"Tester","text":"Hello"}'`,
|
||||
);
|
||||
|
||||
process.on('SIGINT', async () => {
|
||||
await server.close();
|
||||
process.exit(0);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue