@contextvm/ctxcn 1.0.1
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/LICENSE +21 -0
- package/README.md +178 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/src/__mocks__/mock-server.d.ts +2 -0
- package/dist/src/__mocks__/mock-server.d.ts.map +1 -0
- package/dist/src/__mocks__/mock-server.js +24 -0
- package/dist/src/__mocks__/mock-server.js.map +1 -0
- package/dist/src/commands/add.d.ts +2 -0
- package/dist/src/commands/add.d.ts.map +1 -0
- package/dist/src/commands/add.js +106 -0
- package/dist/src/commands/add.js.map +1 -0
- package/dist/src/commands/help.d.ts +2 -0
- package/dist/src/commands/help.d.ts.map +1 -0
- package/dist/src/commands/help.js +15 -0
- package/dist/src/commands/help.js.map +1 -0
- package/dist/src/commands/init.d.ts +2 -0
- package/dist/src/commands/init.d.ts.map +1 -0
- package/dist/src/commands/init.js +61 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/update.d.ts +2 -0
- package/dist/src/commands/update.d.ts.map +1 -0
- package/dist/src/commands/update.js +145 -0
- package/dist/src/commands/update.js.map +1 -0
- package/dist/src/config.d.ts +10 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +31 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/ctxcn/DemoServerClient.d.ts +38 -0
- package/dist/src/ctxcn/DemoServerClient.d.ts.map +1 -0
- package/dist/src/ctxcn/DemoServerClient.js +53 -0
- package/dist/src/ctxcn/DemoServerClient.js.map +1 -0
- package/dist/src/ctxcn/ExampleServersEverythingClient.d.ts +149 -0
- package/dist/src/ctxcn/ExampleServersEverythingClient.d.ts.map +1 -0
- package/dist/src/ctxcn/ExampleServersEverythingClient.js +118 -0
- package/dist/src/ctxcn/ExampleServersEverythingClient.js.map +1 -0
- package/dist/src/ctxcn/TestClient.d.ts +149 -0
- package/dist/src/ctxcn/TestClient.d.ts.map +1 -0
- package/dist/src/ctxcn/TestClient.js +118 -0
- package/dist/src/ctxcn/TestClient.js.map +1 -0
- package/dist/src/utils/cli.d.ts +7 -0
- package/dist/src/utils/cli.d.ts.map +1 -0
- package/dist/src/utils/cli.js +77 -0
- package/dist/src/utils/cli.js.map +1 -0
- package/dist/src/utils/schema.d.ts +11 -0
- package/dist/src/utils/schema.d.ts.map +1 -0
- package/dist/src/utils/schema.js +333 -0
- package/dist/src/utils/schema.js.map +1 -0
- package/dist/src/utils.d.ts +2 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +12 -0
- package/dist/src/utils.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { type NostrTransportOptions } from "@contextvm/sdk";
|
|
2
|
+
export type Test = {
|
|
3
|
+
echo: (message: string) => Promise<{
|
|
4
|
+
[k: string]: unknown;
|
|
5
|
+
}>;
|
|
6
|
+
add: (a: number, b: number) => Promise<{
|
|
7
|
+
[k: string]: unknown;
|
|
8
|
+
}>;
|
|
9
|
+
longRunningOperation: (duration?: number, steps?: number) => Promise<{
|
|
10
|
+
[k: string]: unknown;
|
|
11
|
+
}>;
|
|
12
|
+
printEnv: (args: {}) => Promise<{
|
|
13
|
+
[k: string]: unknown;
|
|
14
|
+
}>;
|
|
15
|
+
sampleLLM: (prompt: string, maxTokens?: number) => Promise<{
|
|
16
|
+
[k: string]: unknown;
|
|
17
|
+
}>;
|
|
18
|
+
getTinyImage: (args: {}) => Promise<{
|
|
19
|
+
[k: string]: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
annotatedMessage: (messageType: string, includeImage?: boolean) => Promise<{
|
|
22
|
+
[k: string]: unknown;
|
|
23
|
+
}>;
|
|
24
|
+
getResourceReference: (resourceId: number) => Promise<{
|
|
25
|
+
[k: string]: unknown;
|
|
26
|
+
}>;
|
|
27
|
+
getResourceLinks: (count?: number) => Promise<{
|
|
28
|
+
[k: string]: unknown;
|
|
29
|
+
}>;
|
|
30
|
+
structuredContent: (location: string) => Promise<{
|
|
31
|
+
/**
|
|
32
|
+
* Temperature in celsius
|
|
33
|
+
*/
|
|
34
|
+
temperature: number;
|
|
35
|
+
/**
|
|
36
|
+
* Weather conditions description
|
|
37
|
+
*/
|
|
38
|
+
conditions: string;
|
|
39
|
+
/**
|
|
40
|
+
* Humidity percentage
|
|
41
|
+
*/
|
|
42
|
+
humidity: number;
|
|
43
|
+
}>;
|
|
44
|
+
};
|
|
45
|
+
export declare class TestClient implements Test {
|
|
46
|
+
static readonly SERVER_PUBKEY = "e6bc4af0a6434e2486d382810d31092f27f616f08d76283f4c6017357f1b09f6";
|
|
47
|
+
private client;
|
|
48
|
+
private transport;
|
|
49
|
+
constructor(options?: Partial<NostrTransportOptions> & {
|
|
50
|
+
privateKey?: string;
|
|
51
|
+
relays?: string[];
|
|
52
|
+
});
|
|
53
|
+
disconnect(): Promise<void>;
|
|
54
|
+
private call;
|
|
55
|
+
/**
|
|
56
|
+
* Echoes back the input
|
|
57
|
+
* @param {string} message Message to echo
|
|
58
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the echo operation
|
|
59
|
+
*/
|
|
60
|
+
echo(message: string): Promise<{
|
|
61
|
+
[k: string]: unknown;
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* Adds two numbers
|
|
65
|
+
* @param {number} a First number
|
|
66
|
+
* @param {number} b Second number
|
|
67
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the add operation
|
|
68
|
+
*/
|
|
69
|
+
add(a: number, b: number): Promise<{
|
|
70
|
+
[k: string]: unknown;
|
|
71
|
+
}>;
|
|
72
|
+
/**
|
|
73
|
+
* Demonstrates a long running operation with progress updates
|
|
74
|
+
* @param {number} duration [optional] Duration of the operation in seconds
|
|
75
|
+
* @param {number} steps [optional] Number of steps in the operation
|
|
76
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the longRunningOperation operation
|
|
77
|
+
*/
|
|
78
|
+
longRunningOperation(duration?: number, steps?: number): Promise<{
|
|
79
|
+
[k: string]: unknown;
|
|
80
|
+
}>;
|
|
81
|
+
/**
|
|
82
|
+
* Prints all environment variables, helpful for debugging MCP server configuration
|
|
83
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the printEnv operation
|
|
84
|
+
*/
|
|
85
|
+
printEnv(args: {}): Promise<{
|
|
86
|
+
[k: string]: unknown;
|
|
87
|
+
}>;
|
|
88
|
+
/**
|
|
89
|
+
* Samples from an LLM using MCP's sampling feature
|
|
90
|
+
* @param {string} prompt The prompt to send to the LLM
|
|
91
|
+
* @param {number} maxTokens [optional] Maximum number of tokens to generate
|
|
92
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the sampleLLM operation
|
|
93
|
+
*/
|
|
94
|
+
sampleLLM(prompt: string, maxTokens?: number): Promise<{
|
|
95
|
+
[k: string]: unknown;
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* Returns the MCP_TINY_IMAGE
|
|
99
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the getTinyImage operation
|
|
100
|
+
*/
|
|
101
|
+
getTinyImage(args: {}): Promise<{
|
|
102
|
+
[k: string]: unknown;
|
|
103
|
+
}>;
|
|
104
|
+
/**
|
|
105
|
+
* Demonstrates how annotations can be used to provide metadata about content
|
|
106
|
+
* @param {string} messageType Type of message to demonstrate different annotation patterns
|
|
107
|
+
* @param {boolean} includeImage [optional] Whether to include an example image
|
|
108
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the annotatedMessage operation
|
|
109
|
+
*/
|
|
110
|
+
annotatedMessage(messageType: string, includeImage?: boolean): Promise<{
|
|
111
|
+
[k: string]: unknown;
|
|
112
|
+
}>;
|
|
113
|
+
/**
|
|
114
|
+
* Returns a resource reference that can be used by MCP clients
|
|
115
|
+
* @param {number} resourceId ID of the resource to reference (1-100)
|
|
116
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the getResourceReference operation
|
|
117
|
+
*/
|
|
118
|
+
getResourceReference(resourceId: number): Promise<{
|
|
119
|
+
[k: string]: unknown;
|
|
120
|
+
}>;
|
|
121
|
+
/**
|
|
122
|
+
* Returns multiple resource links that reference different types of resources
|
|
123
|
+
* @param {number} count [optional] Number of resource links to return (1-10)
|
|
124
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the getResourceLinks operation
|
|
125
|
+
*/
|
|
126
|
+
getResourceLinks(count?: number): Promise<{
|
|
127
|
+
[k: string]: unknown;
|
|
128
|
+
}>;
|
|
129
|
+
/**
|
|
130
|
+
* Returns structured content along with an output schema for client data validation
|
|
131
|
+
* @param {string} location City name or zip code
|
|
132
|
+
* @returns {Promise<{ temperature: number; conditions: string; humidity: number; }>} The result of the structuredContent operation
|
|
133
|
+
*/
|
|
134
|
+
structuredContent(location: string): Promise<{
|
|
135
|
+
/**
|
|
136
|
+
* Temperature in celsius
|
|
137
|
+
*/
|
|
138
|
+
temperature: number;
|
|
139
|
+
/**
|
|
140
|
+
* Weather conditions description
|
|
141
|
+
*/
|
|
142
|
+
conditions: string;
|
|
143
|
+
/**
|
|
144
|
+
* Humidity percentage
|
|
145
|
+
*/
|
|
146
|
+
humidity: number;
|
|
147
|
+
}>;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=TestClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestClient.d.ts","sourceRoot":"","sources":["../../../src/ctxcn/TestClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,qBAAqB,EAG3B,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,IAAI,GAAG;IACjB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;QACjC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC,CAAC;IACH,GAAG,EAAE,CACH,CAAC,EAAE,MAAM,EACT,CA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,OAAO,CAAC;KACtB,CAAC;IAIF;;;;;OAKG;IACG,gBAAgB,CACpB,WAAW,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,OAAO,GACrB,OAAO,CAAC;QACT,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;IAIF;;;;OAIG;IACG,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;QACtD,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;IAIF;;;;OAIG;IACG,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAC9C,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;KACtB,CAAC;IAIF;;;;OAIG;IACG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;QACjD;;WAEG;QACH,WAAW,EAAE,MAAM,CAAC;QACpB;;WAEG;QACH,UAAU,EAAE,MAAM,CAAC;QACnB;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CAGH"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Client } from "@modelcontextprotocol/sdk/client";
|
|
2
|
+
import { NostrClientTransport, PrivateKeySigner, ApplesauceRelayPool, } from "@contextvm/sdk";
|
|
3
|
+
export class TestClient {
|
|
4
|
+
static SERVER_PUBKEY = "e6bc4af0a6434e2486d382810d31092f27f616f08d76283f4c6017357f1b09f6";
|
|
5
|
+
client;
|
|
6
|
+
transport;
|
|
7
|
+
constructor(options = {}) {
|
|
8
|
+
this.client = new Client({
|
|
9
|
+
name: "TestClient",
|
|
10
|
+
version: "1.0.0",
|
|
11
|
+
});
|
|
12
|
+
const { privateKey, relays = ["ws://localhost:10547"], signer = new PrivateKeySigner(privateKey), relayHandler = new ApplesauceRelayPool(relays), ...rest } = options;
|
|
13
|
+
this.transport = new NostrClientTransport({
|
|
14
|
+
serverPubkey: TestClient.SERVER_PUBKEY,
|
|
15
|
+
signer,
|
|
16
|
+
relayHandler,
|
|
17
|
+
isStateless: true,
|
|
18
|
+
...rest,
|
|
19
|
+
});
|
|
20
|
+
// Auto-connect in constructor
|
|
21
|
+
this.client.connect(this.transport).catch((error) => {
|
|
22
|
+
console.error(`Failed to connect to server: ${error}`);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async disconnect() {
|
|
26
|
+
await this.transport.close();
|
|
27
|
+
}
|
|
28
|
+
async call(name, args) {
|
|
29
|
+
const result = await this.client.callTool({
|
|
30
|
+
name,
|
|
31
|
+
arguments: { ...args },
|
|
32
|
+
});
|
|
33
|
+
return result.structuredContent;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Echoes back the input
|
|
37
|
+
* @param {string} message Message to echo
|
|
38
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the echo operation
|
|
39
|
+
*/
|
|
40
|
+
async echo(message) {
|
|
41
|
+
return this.call("echo", { message });
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Adds two numbers
|
|
45
|
+
* @param {number} a First number
|
|
46
|
+
* @param {number} b Second number
|
|
47
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the add operation
|
|
48
|
+
*/
|
|
49
|
+
async add(a, b) {
|
|
50
|
+
return this.call("add", { a, b });
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Demonstrates a long running operation with progress updates
|
|
54
|
+
* @param {number} duration [optional] Duration of the operation in seconds
|
|
55
|
+
* @param {number} steps [optional] Number of steps in the operation
|
|
56
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the longRunningOperation operation
|
|
57
|
+
*/
|
|
58
|
+
async longRunningOperation(duration, steps) {
|
|
59
|
+
return this.call("longRunningOperation", { duration, steps });
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Prints all environment variables, helpful for debugging MCP server configuration
|
|
63
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the printEnv operation
|
|
64
|
+
*/
|
|
65
|
+
async printEnv(args) {
|
|
66
|
+
return this.call("printEnv", args);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Samples from an LLM using MCP's sampling feature
|
|
70
|
+
* @param {string} prompt The prompt to send to the LLM
|
|
71
|
+
* @param {number} maxTokens [optional] Maximum number of tokens to generate
|
|
72
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the sampleLLM operation
|
|
73
|
+
*/
|
|
74
|
+
async sampleLLM(prompt, maxTokens) {
|
|
75
|
+
return this.call("sampleLLM", { prompt, maxTokens });
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Returns the MCP_TINY_IMAGE
|
|
79
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the getTinyImage operation
|
|
80
|
+
*/
|
|
81
|
+
async getTinyImage(args) {
|
|
82
|
+
return this.call("getTinyImage", args);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Demonstrates how annotations can be used to provide metadata about content
|
|
86
|
+
* @param {string} messageType Type of message to demonstrate different annotation patterns
|
|
87
|
+
* @param {boolean} includeImage [optional] Whether to include an example image
|
|
88
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the annotatedMessage operation
|
|
89
|
+
*/
|
|
90
|
+
async annotatedMessage(messageType, includeImage) {
|
|
91
|
+
return this.call("annotatedMessage", { messageType, includeImage });
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Returns a resource reference that can be used by MCP clients
|
|
95
|
+
* @param {number} resourceId ID of the resource to reference (1-100)
|
|
96
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the getResourceReference operation
|
|
97
|
+
*/
|
|
98
|
+
async getResourceReference(resourceId) {
|
|
99
|
+
return this.call("getResourceReference", { resourceId });
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Returns multiple resource links that reference different types of resources
|
|
103
|
+
* @param {number} count [optional] Number of resource links to return (1-10)
|
|
104
|
+
* @returns {Promise<{ [k: string]: unknown; }>} The result of the getResourceLinks operation
|
|
105
|
+
*/
|
|
106
|
+
async getResourceLinks(count) {
|
|
107
|
+
return this.call("getResourceLinks", { count });
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Returns structured content along with an output schema for client data validation
|
|
111
|
+
* @param {string} location City name or zip code
|
|
112
|
+
* @returns {Promise<{ temperature: number; conditions: string; humidity: number; }>} The result of the structuredContent operation
|
|
113
|
+
*/
|
|
114
|
+
async structuredContent(location) {
|
|
115
|
+
return this.call("structuredContent", { location });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=TestClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestClient.js","sourceRoot":"","sources":["../../../src/ctxcn/TestClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAE1D,OAAO,EACL,oBAAoB,EAEpB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AA0DxB,MAAM,OAAO,UAAU;IACrB,MAAM,CAAU,aAAa,GAC3B,kEAAkE,CAAC;IAC7D,MAAM,CAAS;IACf,SAAS,CAAY;IAE7B,YACE,UAGI,EAAE;QAEN,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC;YACvB,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;QAEH,MAAM,EACJ,UAAU,EACV,MAAM,GAAG,CAAC,sBAAsB,CAAC,EACjC,MAAM,GAAG,IAAI,gBAAgB,CAAC,UAAU,CAAC,EACzC,YAAY,GAAG,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAC9C,GAAG,IAAI,EACR,GAAG,OAAO,CAAC;QAEZ,IAAI,CAAC,SAAS,GAAG,IAAI,oBAAoB,CAAC;YACxC,YAAY,EAAE,UAAU,CAAC,aAAa;YACtC,MAAM;YACN,YAAY;YACZ,WAAW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C,SAAS,CACb,MAAc,EACd,SAAkB;QAIlB,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACvD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,YAAY,CAAC,IAAQ;QAGzB,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,gBAAgB,CACpB,WAAmB,EACnB,YAAsB;QAItB,OAAO,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,oBAAoB,CAAC,UAAkB;QAG3C,OAAO,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,gBAAgB,CAAC,KAAc;QAGnC,OAAO,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,iBAAiB,CAAC,QAAgB;QActC,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IACtD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as readline from "readline";
|
|
2
|
+
export declare function createReadlineInterface(): readline.Interface;
|
|
3
|
+
export declare function closeReadlineInterface(): void;
|
|
4
|
+
export declare function askQuestion(query: string, defaultValue: string): Promise<string>;
|
|
5
|
+
export declare function askYesNo(query: string, defaultValue: boolean): Promise<boolean>;
|
|
6
|
+
export declare function askChoice(query: string, options: string[], defaultIndex?: number): Promise<string>;
|
|
7
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/utils/cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAIrC,wBAAgB,uBAAuB,IAAI,QAAQ,CAAC,SAAS,CAQ5D;AAED,wBAAgB,sBAAsB,IAAI,IAAI,CAK7C;AAED,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED,wBAAgB,QAAQ,CACtB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,OAAO,GACpB,OAAO,CAAC,OAAO,CAAC,CAmBlB;AAED,wBAAgB,SAAS,CACvB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EAAE,EACjB,YAAY,GAAE,MAAU,GACvB,OAAO,CAAC,MAAM,CAAC,CA0BjB"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as readline from "readline";
|
|
2
|
+
let rl = null;
|
|
3
|
+
export function createReadlineInterface() {
|
|
4
|
+
if (!rl) {
|
|
5
|
+
rl = readline.createInterface({
|
|
6
|
+
input: process.stdin,
|
|
7
|
+
output: process.stdout,
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
return rl;
|
|
11
|
+
}
|
|
12
|
+
export function closeReadlineInterface() {
|
|
13
|
+
if (rl) {
|
|
14
|
+
rl.close();
|
|
15
|
+
rl = null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function askQuestion(query, defaultValue) {
|
|
19
|
+
const readlineInterface = createReadlineInterface();
|
|
20
|
+
return new Promise((resolve) => {
|
|
21
|
+
try {
|
|
22
|
+
readlineInterface.question(`${query} (${defaultValue}): `, (answer) => {
|
|
23
|
+
resolve(answer || defaultValue);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.error("Error reading input:", error);
|
|
28
|
+
resolve(defaultValue);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export function askYesNo(query, defaultValue) {
|
|
33
|
+
const readlineInterface = createReadlineInterface();
|
|
34
|
+
return new Promise((resolve) => {
|
|
35
|
+
try {
|
|
36
|
+
const defaultStr = defaultValue ? "Y/n" : "y/N";
|
|
37
|
+
readlineInterface.question(`${query} (${defaultStr}): `, (answer) => {
|
|
38
|
+
if (!answer) {
|
|
39
|
+
resolve(defaultValue);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
console.error("Error reading input:", error);
|
|
48
|
+
resolve(defaultValue);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export function askChoice(query, options, defaultIndex = 0) {
|
|
53
|
+
const readlineInterface = createReadlineInterface();
|
|
54
|
+
return new Promise((resolve) => {
|
|
55
|
+
try {
|
|
56
|
+
console.log(query);
|
|
57
|
+
options.forEach((option, index) => {
|
|
58
|
+
const marker = index === defaultIndex ? " (default)" : "";
|
|
59
|
+
console.log(` ${index + 1}. ${option}${marker}`);
|
|
60
|
+
});
|
|
61
|
+
readlineInterface.question(`Choose an option (1-${options.length})`, (answer) => {
|
|
62
|
+
const choice = parseInt(answer);
|
|
63
|
+
if (isNaN(choice) || choice < 1 || choice > options.length) {
|
|
64
|
+
resolve(options[defaultIndex] || "");
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
resolve(options[choice - 1] || "");
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
console.error("Error reading input:", error);
|
|
73
|
+
resolve(options[defaultIndex] || "");
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|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,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;gBAChC,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;oBAC3D,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;gBACvC,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;gBACrC,CAAC;YACH,CAAC,CACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;YAC7C,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;QACvC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { JSONSchema } from "json-schema-to-typescript/dist/src/types/JSONSchema";
|
|
2
|
+
export declare function sanitizeSchema(schema: unknown): object | boolean;
|
|
3
|
+
export declare function extractInlineType(typeDefinition: string): string;
|
|
4
|
+
export declare function extractSchemaProperties(schema: JSONSchema): Array<{
|
|
5
|
+
name: string;
|
|
6
|
+
type: string;
|
|
7
|
+
required: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function generateTypeFromSchema(schema: JSONSchema | boolean, typeName: string): Promise<string>;
|
|
10
|
+
export declare function generateClientCode(pubkey: string, serverDetails: any, toolListResult: any, serverName: string): Promise<string>;
|
|
11
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/utils/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qDAAqD,CAAC;AAItF,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAuChE;AAED,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAiBhE;AAoBD,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,UAAU,GACjB,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC,CAmB1D;AAeD,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,UAAU,GAAG,OAAO,EAC5B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CAejB;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,GAAG,EAClB,cAAc,EAAE,GAAG,EACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CA0BjB"}
|