kloudy 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/entry.mjs +4 -2
- package/package.json +1 -1
- package/src/connect-card.mjs +7 -6
- package/src/connect-ui.mjs +2 -1
- package/src/preferences-card.mjs +21 -0
- package/src/preferences-ui.mjs +2 -0
- package/src/remote.mjs +27 -25
- package/src/sample-cards.mjs +6 -6
- package/src/sample-ui.mjs +1 -1
package/bin/entry.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {readFileSync} from 'node:fs';
|
|
3
|
+
const version=JSON.parse(readFileSync(new URL('../package.json',import.meta.url),'utf8')).version;
|
|
2
4
|
import {createInterface} from 'node:readline/promises';
|
|
3
5
|
import {installEditors} from '../src/editor-install.mjs';
|
|
4
6
|
import {askRemote,serveRemote} from '../src/remote.mjs';
|
|
@@ -9,11 +11,11 @@ try{
|
|
|
9
11
|
let rl;
|
|
10
12
|
const confirm=async({client,path,authenticated})=>{if(!process.stdin.isTTY){console.log(`${client}: skipped — run in an interactive terminal to approve ${path}`);return false;}rl??=createInterface({input:process.stdin,output:process.stdout});return /^(y|yes)$/i.test((await rl.question(`Add Kloudy to ${client}? ${path}${authenticated?' (stores your key)':''} [y/N] `)).trim());};
|
|
11
13
|
let results;try{results=await installEditors({confirm,key:process.env.KLOUDY_MCP_TOKEN,onResult:r=>console.log(`${r.client}: ${r.state}`)});}finally{rl?.close();}
|
|
12
|
-
if(!results.length)console.log('No supported editor configuration found. Open https://kloudy.ai/install for
|
|
14
|
+
if(!results.length)console.log('No supported editor configuration found. Open https://kloudy.ai/install for setup help.');
|
|
13
15
|
else console.log('Existing servers were preserved. Restart configured clients to connect.');
|
|
14
16
|
if(results.some(r=>r.state==='unchanged_error'))process.exitCode=1;
|
|
15
17
|
}else if(args[0]==='mcp'&&args.length===1){await serveRemote();}
|
|
16
|
-
else if(args[0]==='--version'){console.log(
|
|
18
|
+
else if(args[0]==='--version'){console.log(version);}
|
|
17
19
|
else if(['--help','help'].includes(args[0]))console.log('npx kloudy Add to detected editors (asks before each write)\nnpx kloudy <question> Ask the public Kloudy MCP endpoint\nnpx kloudy mcp Remote MCP over local stdio\nnpx kloudy legacy <args> Existing SDK/engine CLI commands\n\nFree discovery needs no key. For authorized account actions set KLOUDY_MCP_TOKEN privately; never put a key in command arguments. Node 20.19+ required.');
|
|
18
20
|
else if(args[0]==='legacy'){process.argv.splice(2,1);await import('./kloudy.mjs');}
|
|
19
21
|
else{if(args[0]?.startsWith('--'))throw Error('Unknown option');const result=await askRemote(args.join(' '));for(const c of result.content||[])if(c.type==='text')process.stdout.write((process.env.KLOUDY_MCP_TOKEN?c.text.replaceAll(process.env.KLOUDY_MCP_TOKEN,'[redacted]'):c.text)+'\n');if(result.isError)process.exitCode=1;}
|
package/package.json
CHANGED
package/src/connect-card.mjs
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import {connectHTML} from './connect-ui.mjs';
|
|
1
|
+
import {connectHTML,publicConnectHTML} from './connect-ui.mjs';
|
|
2
2
|
|
|
3
3
|
export const CONNECT_URI='ui://widget/kloudy-connect-v1.html';
|
|
4
4
|
export const connectResource={uri:CONNECT_URI,name:'Kloudy setup',description:'Sign in or choose a Kloudy front door. Navigation only.',mimeType:'text/html;profile=mcp-app'};
|
|
5
5
|
export const connectTool={
|
|
6
6
|
name:'kloudy_connect_card',
|
|
7
|
-
|
|
7
|
+
title:'Kloudy sign-in and install card',
|
|
8
|
+
description:'Show sign-in or install choices. First call find_mcp_tools with operation ask and a short setup request. If it returns kind account or connect, call this card once with the returned mode. Opening setup does not finish sign-in or installation. Text-only hosts show the returned links.',
|
|
8
9
|
annotations:{readOnlyHint:true,destructiveHint:false,idempotentHint:true,openWorldHint:false},
|
|
9
|
-
inputSchema:{type:'object',properties:{mode:{type:'string',enum:['signin','install']}},required:['mode'],additionalProperties:false},
|
|
10
|
+
inputSchema:{type:'object',properties:{mode:{type:'string',enum:['signin','install'],description:'Use the mode returned by find_mcp_tools: signin for account sign-in, or install for editor setup.'}},required:['mode'],additionalProperties:false},
|
|
10
11
|
_meta:{ui:{resourceUri:CONNECT_URI},'openai/outputTemplate':CONNECT_URI,'openai/toolInvocation/invoking':'Opening Kloudy setup…','openai/toolInvocation/invoked':'Kloudy setup choices'}
|
|
11
12
|
};
|
|
12
13
|
export function connectArguments(value){return !!value&&typeof value==='object'&&!Array.isArray(value)&&Object.keys(value).length===1&&['signin','install'].includes(value.mode);}
|
|
13
|
-
export function connectResult(mode){
|
|
14
|
+
export function connectResult(mode,{publicOnly=false}={}){
|
|
14
15
|
const install=mode==='install';
|
|
15
16
|
const message=install?'Choose where to connect Kloudy. Opening setup is not a finished connection.':'Kloudy finds MCP tools and SDKs for your task. Sign in or keep using free discovery.';
|
|
16
17
|
const actions=install?[
|
|
17
18
|
{label:'Add to an IDE',url:'https://kloudy.ai/install#clients'},
|
|
18
|
-
{label:'Connect to Muse',url:'https://kloudy.ai/install#muse'},
|
|
19
|
+
...(!publicOnly?[{label:'Connect to Muse',url:'https://kloudy.ai/install#muse'}]:[]),
|
|
19
20
|
{label:'Sign in',url:'https://kloudy.ai/install'}
|
|
20
21
|
]:[{label:'Sign in to Kloudy',url:'https://kloudy.ai/install'},{label:'Add to an IDE',url:'https://kloudy.ai/install#clients'}];
|
|
21
22
|
return {content:[{type:'text',text:message+'\n\n'+actions.map(a=>`[${a.label}](${a.url})`).join('\n')}],structuredContent:{tier:'public',kind:install?'connect':'account',mode,items:[],message,actions,model_calls:0,executed:false}};
|
|
22
23
|
}
|
|
23
|
-
export function connectContents(){return {contents:[{uri:CONNECT_URI,mimeType:connectResource.mimeType,text:connectHTML,_meta:{
|
|
24
|
+
export function connectContents({publicOnly=false}={}){return {contents:[{uri:CONNECT_URI,mimeType:connectResource.mimeType,text:publicOnly?publicConnectHTML:connectHTML,_meta:{
|
|
24
25
|
ui:{prefersBorder:true,domain:'https://kloudy.ai',csp:{connectDomains:[],resourceDomains:[]}},
|
|
25
26
|
'openai/widgetDescription':'Kloudy sign-in and setup choices. No account is created and no tool is authorized by opening a link.',
|
|
26
27
|
'openai/widgetPrefersBorder':true,'openai/widgetDomain':'https://kloudy.ai',
|