mirror of
https://github.com/Kaelio/ktx.git
synced 2026-07-10 11:12:10 +02:00
Add MCP agent client setup support
This commit is contained in:
parent
658024dcf3
commit
0361449c8a
19 changed files with 745 additions and 146 deletions
|
|
@ -138,9 +138,13 @@ export function createKtxSetupPromptAdapter(options: KtxSetupPromptAdapterOption
|
|||
};
|
||||
}
|
||||
|
||||
interface KtxSetupNoteOptions {
|
||||
format?: (line: string) => string;
|
||||
}
|
||||
|
||||
export interface KtxSetupUiAdapter {
|
||||
intro(title: string, io: KtxCliIo): void;
|
||||
note(message: string, title: string, io: KtxCliIo): void;
|
||||
note(message: string, title: string, io: KtxCliIo, options?: KtxSetupNoteOptions): void;
|
||||
}
|
||||
|
||||
function isWritableTtyOutput(output: KtxCliIo['stdout']): output is KtxCliIo['stdout'] & Writable {
|
||||
|
|
@ -160,9 +164,12 @@ export function createKtxSetupUiAdapter(): KtxSetupUiAdapter {
|
|||
}
|
||||
io.stdout.write(`${title}\n`);
|
||||
},
|
||||
note(message, title, io) {
|
||||
note(message, title, io, options) {
|
||||
if (isWritableTtyOutput(io.stdout)) {
|
||||
note(message, title, { output: io.stdout });
|
||||
note(message, title, {
|
||||
output: io.stdout,
|
||||
...(options?.format ? { format: options.format } : {}),
|
||||
});
|
||||
return;
|
||||
}
|
||||
io.stdout.write(`\n${title}:\n`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue