@hyperweb/telescope 1.15.2 → 1.17.0

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/README.md CHANGED
@@ -755,11 +755,10 @@ See [Helper Functions Configuration](#helper-functions-configuration) for more i
755
755
  | ------------------------------ | -------------------------------------------------------------- | ---------- |
756
756
  | `mcpServer.enabled` | generate MCP (Model Context Protocol) servers alongside TypeScript clients for AI agent integration | `false` |
757
757
 
758
- When enabled, Telescope generates a complete MCP server package (`{packageName}-mcp`) that includes:
759
- - Mock blockchain tools for demonstration and development
760
- - Complete telescope codebase reference for AI agents
761
- - Self-contained package with all necessary telescope code
762
- - Ready-to-extend structure for implementing real blockchain functionality
758
+ When enabled, Telescope generates an MCP server package (`{packageName}-mcp`) that includes:
759
+ - **Function generator tool** for creating custom blockchain functions
760
+ - **Telescope examples** as reference patterns for implementation
761
+ - **AI prompts** for usage guidelines and best practices
763
762
 
764
763
  See [MCP Integration](https://docs.hyperweb.io/telescope/developing/mcp-integration) for detailed documentation.
765
764
 
@@ -1588,3 +1587,4 @@ Thanks to these engineers, teams and projects for inspiring Telescope:
1588
1587
  AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
1589
1588
 
1590
1589
  No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.
1590
+
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.plugin = void 0;
4
+ const path_1 = require("path");
5
+ const ast_1 = require("@cosmology/ast");
6
+ const case_1 = require("case");
7
+ const utils_1 = require("@cosmology/utils");
8
+ const imports_1 = require("../imports");
9
+ const files_1 = require("../utils/files");
10
+ const plugin = (builder, allRegistries, allConverters) => {
11
+ builder.options.rpcClients.combinedClient.map((currentClient) => {
12
+ if (!allRegistries || !allRegistries.length) {
13
+ return;
14
+ }
15
+ const registryImports = [];
16
+ const converterImports = [];
17
+ const clientFile = currentClient.fileName;
18
+ const ctxRef = {
19
+ absolute: '/',
20
+ filename: '/',
21
+ proto: {
22
+ imports: [],
23
+ package: currentClient.name,
24
+ root: {},
25
+ }
26
+ };
27
+ const ctx = new ast_1.GenericParseContext(ctxRef, null, builder.options);
28
+ const registryVariables = [];
29
+ const converterVariables = [];
30
+ const filteredRegistries = allRegistries.filter(item => (0, utils_1.isPackageIncluded)(item.package, currentClient.include.patterns));
31
+ filteredRegistries.forEach(registry => {
32
+ let rel = (0, path_1.relative)((0, path_1.dirname)(clientFile), registry.localname);
33
+ if (!rel.startsWith('.'))
34
+ rel = `./${rel}`;
35
+ rel = (0, utils_1.toPosixPath)(rel);
36
+ const variable = (0, utils_1.variableSlug)(registry.localname);
37
+ registryVariables.push(variable);
38
+ registryImports.push((0, ast_1.importNamespace)(variable, rel));
39
+ });
40
+ const filteredConverters = allConverters.filter(item => (0, utils_1.isPackageIncluded)(item.package, currentClient.include.patterns));
41
+ filteredConverters.forEach(converter => {
42
+ let rel = (0, path_1.relative)((0, path_1.dirname)(clientFile), converter.localname);
43
+ if (!rel.startsWith('.'))
44
+ rel = `./${rel}`;
45
+ rel = (0, utils_1.toPosixPath)(rel);
46
+ const variable = (0, utils_1.variableSlug)(converter.localname);
47
+ converterVariables.push(variable);
48
+ converterImports.push((0, ast_1.importNamespace)(variable, rel));
49
+ });
50
+ const name = 'get' + (0, case_1.pascal)(currentClient.name + 'SigningClient');
51
+ const txRpcName = 'get' + (0, case_1.pascal)(currentClient.name + 'SigningTxRpc');
52
+ const prefix = (0, case_1.camel)(currentClient.name);
53
+ const aminos = (0, ast_1.createStargateClientAminoRegistry)({
54
+ context: ctx,
55
+ aminos: converterVariables,
56
+ aminoConverters: prefix + 'AminoConverters'
57
+ });
58
+ const protos = (0, ast_1.createStargateClientProtoRegistry)({
59
+ context: ctx,
60
+ registries: registryVariables,
61
+ protoTypeRegistry: prefix + 'ProtoRegistry'
62
+ });
63
+ const clientOptions = (0, ast_1.createStargateClientOptions)({
64
+ context: ctx,
65
+ name: name + 'Options',
66
+ protoTypeRegistry: prefix + 'ProtoRegistry',
67
+ aminoConverters: prefix + 'AminoConverters'
68
+ });
69
+ const clientBody = (0, ast_1.createStargateClient)({
70
+ context: ctx,
71
+ name,
72
+ options: name + 'Options',
73
+ });
74
+ let getTxRpc;
75
+ if (ctx.pluginValue("stargateClients.addGetTxRpc")) {
76
+ getTxRpc = (0, ast_1.createGetTxRpc)(ctx, txRpcName, name);
77
+ }
78
+ const imports = (0, imports_1.buildAllImportsFromGenericContext)(ctx, clientFile);
79
+ let importDecls = [...imports, ...registryImports, ...converterImports];
80
+ importDecls = (0, utils_1.duplicateImportPathsWithExt)(importDecls, builder.options.restoreImportExtension);
81
+ let cProg = importDecls
82
+ .concat(aminos)
83
+ .concat(protos)
84
+ .concat(clientOptions)
85
+ .concat(clientBody);
86
+ // replace all backslash path for windows
87
+ for (let i = 0; i < cProg.length; i++) {
88
+ if (cProg[i].source?.value) {
89
+ cProg[i].source.value = (0, utils_1.toPosixPath)(cProg[i].source?.value);
90
+ }
91
+ }
92
+ if (getTxRpc) {
93
+ cProg = cProg.concat(getTxRpc);
94
+ }
95
+ const clientOutFile = (0, path_1.join)(builder.outPath, clientFile);
96
+ (0, files_1.writeAstToFile)(builder.outPath, builder.options, cProg, clientOutFile);
97
+ });
98
+ };
99
+ exports.plugin = plugin;