@mikoto_zero/minigame-open-mcp 1.2.0-beta.8 → 1.2.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.
Files changed (150) hide show
  1. package/README.md +266 -153
  2. package/dist/{auth → core/auth}/deviceFlow.d.ts +28 -2
  3. package/dist/core/auth/deviceFlow.d.ts.map +1 -0
  4. package/dist/{auth → core/auth}/deviceFlow.js +130 -12
  5. package/dist/core/auth/deviceFlow.js.map +1 -0
  6. package/dist/core/handlers/appHandlers.d.ts +9 -0
  7. package/dist/core/handlers/appHandlers.d.ts.map +1 -0
  8. package/dist/core/handlers/appHandlers.js +9 -0
  9. package/dist/core/handlers/appHandlers.js.map +1 -0
  10. package/dist/core/handlers/environmentHandlers.d.ts.map +1 -0
  11. package/dist/core/handlers/environmentHandlers.js +57 -0
  12. package/dist/core/handlers/environmentHandlers.js.map +1 -0
  13. package/dist/{network → core/network}/httpClient.d.ts +4 -0
  14. package/dist/core/network/httpClient.d.ts.map +1 -0
  15. package/dist/{network → core/network}/httpClient.js +66 -22
  16. package/dist/core/network/httpClient.js.map +1 -0
  17. package/dist/core/types/index.d.ts +96 -0
  18. package/dist/core/types/index.d.ts.map +1 -0
  19. package/dist/core/types/index.js.map +1 -0
  20. package/dist/core/utils/cache.d.ts.map +1 -0
  21. package/dist/core/utils/cache.js.map +1 -0
  22. package/dist/core/utils/docHelpers.d.ts +92 -0
  23. package/dist/core/utils/docHelpers.d.ts.map +1 -0
  24. package/dist/core/utils/docHelpers.js +138 -0
  25. package/dist/core/utils/docHelpers.js.map +1 -0
  26. package/dist/core/utils/logger.d.ts +102 -0
  27. package/dist/core/utils/logger.d.ts.map +1 -0
  28. package/dist/core/utils/logger.js +353 -0
  29. package/dist/core/utils/logger.js.map +1 -0
  30. package/dist/features/app/api.d.ts +144 -0
  31. package/dist/features/app/api.d.ts.map +1 -0
  32. package/dist/features/app/api.js +231 -0
  33. package/dist/features/app/api.js.map +1 -0
  34. package/dist/{handlers/appHandlers.d.ts → features/app/handlers.d.ts} +9 -7
  35. package/dist/features/app/handlers.d.ts.map +1 -0
  36. package/dist/{handlers/appHandlers.js → features/app/handlers.js} +46 -2
  37. package/dist/{handlers/appHandlers.js.map → features/app/handlers.js.map} +1 -1
  38. package/dist/features/app/index.d.ts +10 -0
  39. package/dist/features/app/index.d.ts.map +1 -0
  40. package/dist/features/app/index.js +14 -0
  41. package/dist/features/app/index.js.map +1 -0
  42. package/dist/features/app/tools.d.ts +11 -0
  43. package/dist/features/app/tools.d.ts.map +1 -0
  44. package/dist/features/app/tools.js +169 -0
  45. package/dist/features/app/tools.js.map +1 -0
  46. package/dist/features/h5Game/api.d.ts +20 -0
  47. package/dist/features/h5Game/api.d.ts.map +1 -0
  48. package/dist/features/h5Game/api.js +16 -0
  49. package/dist/features/h5Game/api.js.map +1 -0
  50. package/dist/features/h5Game/handlers.d.ts +49 -0
  51. package/dist/features/h5Game/handlers.d.ts.map +1 -0
  52. package/dist/features/h5Game/handlers.js +321 -0
  53. package/dist/features/h5Game/handlers.js.map +1 -0
  54. package/dist/features/h5Game/index.d.ts +7 -0
  55. package/dist/features/h5Game/index.d.ts.map +1 -0
  56. package/dist/features/h5Game/index.js +11 -0
  57. package/dist/features/h5Game/index.js.map +1 -0
  58. package/dist/features/h5Game/messages.d.ts +79 -0
  59. package/dist/features/h5Game/messages.d.ts.map +1 -0
  60. package/dist/features/h5Game/messages.js +141 -0
  61. package/dist/features/h5Game/messages.js.map +1 -0
  62. package/dist/features/h5Game/tools.d.ts +14 -0
  63. package/dist/features/h5Game/tools.d.ts.map +1 -0
  64. package/dist/features/h5Game/tools.js +181 -0
  65. package/dist/features/h5Game/tools.js.map +1 -0
  66. package/dist/features/h5Game/types.d.ts +113 -0
  67. package/dist/features/h5Game/types.d.ts.map +1 -0
  68. package/dist/features/h5Game/types.js +2 -0
  69. package/dist/features/h5Game/types.js.map +1 -0
  70. package/dist/{network/leaderboardApi.d.ts → features/leaderboard/api.d.ts} +1 -64
  71. package/dist/features/leaderboard/api.d.ts.map +1 -0
  72. package/dist/{network/leaderboardApi.js → features/leaderboard/api.js} +3 -151
  73. package/dist/features/leaderboard/api.js.map +1 -0
  74. package/dist/{tools/leaderboardTools.d.ts → features/leaderboard/docTools.d.ts} +6 -1
  75. package/dist/features/leaderboard/docTools.d.ts.map +1 -0
  76. package/dist/{tools/leaderboardTools.js → features/leaderboard/docTools.js} +125 -51
  77. package/dist/features/leaderboard/docTools.js.map +1 -0
  78. package/dist/features/leaderboard/docs.d.ts +11 -0
  79. package/dist/features/leaderboard/docs.d.ts.map +1 -0
  80. package/dist/{data/leaderboardDocs.js → features/leaderboard/docs.js} +5 -127
  81. package/dist/features/leaderboard/docs.js.map +1 -0
  82. package/dist/{handlers/leaderboardHandlers.d.ts → features/leaderboard/handlers.d.ts} +1 -1
  83. package/dist/features/leaderboard/handlers.d.ts.map +1 -0
  84. package/dist/{handlers/leaderboardHandlers.js → features/leaderboard/handlers.js} +37 -20
  85. package/dist/features/leaderboard/handlers.js.map +1 -0
  86. package/dist/features/leaderboard/index.d.ts +10 -0
  87. package/dist/features/leaderboard/index.d.ts.map +1 -0
  88. package/dist/features/leaderboard/index.js +27 -0
  89. package/dist/features/leaderboard/index.js.map +1 -0
  90. package/dist/features/leaderboard/resources.d.ts +11 -0
  91. package/dist/features/leaderboard/resources.d.ts.map +1 -0
  92. package/dist/features/leaderboard/resources.js +68 -0
  93. package/dist/features/leaderboard/resources.js.map +1 -0
  94. package/dist/features/leaderboard/tools.d.ts +11 -0
  95. package/dist/features/leaderboard/tools.d.ts.map +1 -0
  96. package/dist/features/leaderboard/tools.js +146 -0
  97. package/dist/features/leaderboard/tools.js.map +1 -0
  98. package/dist/server.js +366 -159
  99. package/dist/server.js.map +1 -1
  100. package/dist/version.d.ts +2 -0
  101. package/dist/version.d.ts.map +1 -0
  102. package/dist/version.js +15 -0
  103. package/dist/version.js.map +1 -0
  104. package/package.json +17 -10
  105. package/dist/auth/deviceFlow.d.ts.map +0 -1
  106. package/dist/auth/deviceFlow.js.map +0 -1
  107. package/dist/config/promptDefinitions.d.ts +0 -19
  108. package/dist/config/promptDefinitions.d.ts.map +0 -1
  109. package/dist/config/promptDefinitions.js +0 -28
  110. package/dist/config/promptDefinitions.js.map +0 -1
  111. package/dist/config/resourceDefinitions.d.ts +0 -19
  112. package/dist/config/resourceDefinitions.d.ts.map +0 -1
  113. package/dist/config/resourceDefinitions.js +0 -93
  114. package/dist/config/resourceDefinitions.js.map +0 -1
  115. package/dist/config/toolDefinitions.d.ts +0 -10
  116. package/dist/config/toolDefinitions.d.ts.map +0 -1
  117. package/dist/config/toolDefinitions.js +0 -250
  118. package/dist/config/toolDefinitions.js.map +0 -1
  119. package/dist/data/leaderboardDocs.d.ts +0 -37
  120. package/dist/data/leaderboardDocs.d.ts.map +0 -1
  121. package/dist/data/leaderboardDocs.js.map +0 -1
  122. package/dist/handlers/appHandlers.d.ts.map +0 -1
  123. package/dist/handlers/environmentHandlers.d.ts.map +0 -1
  124. package/dist/handlers/environmentHandlers.js +0 -21
  125. package/dist/handlers/environmentHandlers.js.map +0 -1
  126. package/dist/handlers/leaderboardHandlers.d.ts.map +0 -1
  127. package/dist/handlers/leaderboardHandlers.js.map +0 -1
  128. package/dist/handlers/promptHandlers.d.ts +0 -26
  129. package/dist/handlers/promptHandlers.d.ts.map +0 -1
  130. package/dist/handlers/promptHandlers.js +0 -336
  131. package/dist/handlers/promptHandlers.js.map +0 -1
  132. package/dist/network/httpClient.d.ts.map +0 -1
  133. package/dist/network/httpClient.js.map +0 -1
  134. package/dist/network/leaderboardApi.d.ts.map +0 -1
  135. package/dist/network/leaderboardApi.js.map +0 -1
  136. package/dist/tools/leaderboardTools.d.ts.map +0 -1
  137. package/dist/tools/leaderboardTools.js.map +0 -1
  138. package/dist/types/index.d.ts +0 -18
  139. package/dist/types/index.d.ts.map +0 -1
  140. package/dist/types/index.js.map +0 -1
  141. package/dist/utils/cache.d.ts.map +0 -1
  142. package/dist/utils/cache.js.map +0 -1
  143. package/dist/utils/logger.d.ts +0 -45
  144. package/dist/utils/logger.d.ts.map +0 -1
  145. package/dist/utils/logger.js +0 -192
  146. package/dist/utils/logger.js.map +0 -1
  147. /package/dist/{handlers → core/handlers}/environmentHandlers.d.ts +0 -0
  148. /package/dist/{types → core/types}/index.js +0 -0
  149. /package/dist/{utils → core/utils}/cache.d.ts +0 -0
  150. /package/dist/{utils → core/utils}/cache.js +0 -0
@@ -0,0 +1,231 @@
1
+ /**
2
+ * Application Management API
3
+ * Handles developer and app operations
4
+ */
5
+ import { HttpClient } from '../../core/network/httpClient.js';
6
+ import { readAppCache, saveAppCache } from '../../core/utils/cache.js';
7
+ /**
8
+ * Selection required error - thrown when multiple options exist
9
+ */
10
+ export class SelectionRequiredError extends Error {
11
+ constructor(message, developers) {
12
+ super(message);
13
+ this.developers = developers;
14
+ this.name = 'SelectionRequiredError';
15
+ }
16
+ }
17
+ /**
18
+ * Get app/level list information for current user
19
+ * Returns all developers and their apps/games
20
+ * @param projectPath - Optional project path for cache lookup
21
+ * @param autoSelect - If true, automatically selects first option. If false, throws SelectionRequiredError when multiple options exist
22
+ * @returns App information including developer_id and app_id
23
+ * @throws SelectionRequiredError when multiple developers/apps exist and autoSelect is false
24
+ */
25
+ export async function getAppInfo(projectPath, autoSelect = true) {
26
+ const client = new HttpClient();
27
+ try {
28
+ const response = await client.get('/level/v1/list');
29
+ // Get first developer and first app by default
30
+ if (!response.list || response.list.length === 0) {
31
+ throw new Error('No developers or apps found for current user');
32
+ }
33
+ // Count total developers and apps
34
+ const totalDevelopers = response.list.length;
35
+ const totalApps = response.list.reduce((sum, dev) => sum + (dev.levels?.length || dev.crafts?.length || 0), 0);
36
+ // If multiple options exist and autoSelect is false, throw error for AI to decide
37
+ if (!autoSelect && (totalDevelopers > 1 || totalApps > 1)) {
38
+ let errorMsg = `Multiple options found:\n`;
39
+ errorMsg += `- ${totalDevelopers} developer(s)\n`;
40
+ errorMsg += `- ${totalApps} app(s) in total\n\n`;
41
+ errorMsg += `Please use 'list_developers_and_apps' tool to see all options and 'select_app' to make a selection.`;
42
+ throw new SelectionRequiredError(errorMsg, response.list);
43
+ }
44
+ const firstDeveloper = response.list[0];
45
+ // Support both 'levels' (actual API response) and 'crafts' (backward compatibility)
46
+ const apps = firstDeveloper.levels || firstDeveloper.crafts || [];
47
+ if (apps.length === 0) {
48
+ throw new Error(`Developer ${firstDeveloper.developer_name} has no apps/games`);
49
+ }
50
+ const firstApp = apps[0];
51
+ const appInfo = {
52
+ developer_id: firstDeveloper.developer_id,
53
+ developer_name: firstDeveloper.developer_name,
54
+ app_id: firstApp.app_id,
55
+ app_title: firstApp.app_title,
56
+ miniapp_id: firstApp.miniapp_id
57
+ };
58
+ // Save to cache
59
+ saveAppCache(appInfo, projectPath);
60
+ return appInfo;
61
+ }
62
+ catch (error) {
63
+ // Re-throw SelectionRequiredError
64
+ if (error instanceof SelectionRequiredError) {
65
+ throw error;
66
+ }
67
+ // If API fails, try to use cached data
68
+ const cached = readAppCache(projectPath);
69
+ if (cached?.developer_id && cached?.app_id) {
70
+ return cached;
71
+ }
72
+ if (error instanceof Error) {
73
+ throw new Error(`Failed to get app info: ${error.message}`);
74
+ }
75
+ throw new Error(`Failed to get app info: ${String(error)}`);
76
+ }
77
+ }
78
+ /**
79
+ * Get or fetch app information with automatic caching
80
+ * @param projectPath - Optional project path
81
+ * @param autoSelect - If true, automatically selects first option. If false, throws SelectionRequiredError when multiple options exist
82
+ * @returns App information from cache or API
83
+ * @throws SelectionRequiredError when multiple developers/apps exist and autoSelect is false
84
+ */
85
+ export async function ensureAppInfo(projectPath, autoSelect = true) {
86
+ // Check cache first
87
+ const cached = readAppCache(projectPath);
88
+ if (cached?.developer_id && cached?.app_id) {
89
+ return cached;
90
+ }
91
+ // No cache, fetch from API
92
+ return await getAppInfo(projectPath, autoSelect);
93
+ }
94
+ /**
95
+ * Select and cache a specific developer and app
96
+ * @param developerId - Developer ID to select
97
+ * @param appId - App ID to select
98
+ * @param projectPath - Optional project path for cache storage
99
+ * @returns Selected app information
100
+ */
101
+ export async function selectApp(developerId, appId, projectPath) {
102
+ const client = new HttpClient();
103
+ try {
104
+ // Fetch full list to validate selection
105
+ const response = await client.get('/level/v1/list');
106
+ if (!response.list || response.list.length === 0) {
107
+ throw new Error('No developers or apps found for current user');
108
+ }
109
+ // Find the selected developer and app
110
+ const developer = response.list.find(dev => dev.developer_id === developerId);
111
+ if (!developer) {
112
+ throw new Error(`Developer with ID ${developerId} not found`);
113
+ }
114
+ // Support both 'levels' (actual API response) and 'crafts' (backward compatibility)
115
+ const apps = developer.levels || developer.crafts || [];
116
+ const app = apps.find(craft => craft.app_id === appId);
117
+ if (!app) {
118
+ throw new Error(`App with ID ${appId} not found for developer ${developer.developer_name}`);
119
+ }
120
+ const appInfo = {
121
+ developer_id: developer.developer_id,
122
+ developer_name: developer.developer_name,
123
+ app_id: app.app_id,
124
+ app_title: app.app_title,
125
+ miniapp_id: app.miniapp_id
126
+ };
127
+ // Save to cache
128
+ saveAppCache(appInfo, projectPath);
129
+ return appInfo;
130
+ }
131
+ catch (error) {
132
+ if (error instanceof Error) {
133
+ throw new Error(`Failed to select app: ${error.message}`);
134
+ }
135
+ throw new Error(`Failed to select app: ${String(error)}`);
136
+ }
137
+ }
138
+ /**
139
+ * Get all developers and apps for selection
140
+ * @returns List of all developers and their apps
141
+ */
142
+ export async function getAllDevelopersAndApps() {
143
+ const client = new HttpClient();
144
+ try {
145
+ const response = await client.get('/level/v1/list');
146
+ return response;
147
+ }
148
+ catch (error) {
149
+ if (error instanceof Error) {
150
+ throw new Error(`Failed to get developers and apps list: ${error.message}`);
151
+ }
152
+ throw new Error(`Failed to get developers and apps list: ${String(error)}`);
153
+ }
154
+ }
155
+ /**
156
+ * Create unverified developer
157
+ */
158
+ export async function createDeveloper() {
159
+ const client = new HttpClient();
160
+ return await client.post('/v1/developer/create-register');
161
+ }
162
+ /**
163
+ * Create a new app/game
164
+ */
165
+ export async function createAppForDeveloper(developer_id, title, genre) {
166
+ const client = new HttpClient();
167
+ return await client.post('/level/v1/create', {
168
+ body: {
169
+ developer_id,
170
+ title,
171
+ category: genre,
172
+ },
173
+ });
174
+ }
175
+ /**
176
+ * Edit app/game information
177
+ */
178
+ export async function editAppInfo(app_id, developer_id, package_id, appName, genre, description, chatting_label, chatting_number, screen_orientation) {
179
+ const client = new HttpClient();
180
+ return await client.post('/level/v1/submit', {
181
+ body: {
182
+ app_id,
183
+ developer_id,
184
+ package_id,
185
+ title: appName,
186
+ category: genre,
187
+ description,
188
+ chatting_label,
189
+ chatting_number,
190
+ screen_orientation,
191
+ },
192
+ });
193
+ }
194
+ /**
195
+ * Get app review status
196
+ */
197
+ export async function getAppStatus(app_id) {
198
+ const client = new HttpClient();
199
+ return await client.get('/level/v1/status', {
200
+ params: {
201
+ app_id: app_id.toString(),
202
+ },
203
+ });
204
+ }
205
+ /**
206
+ * Get app detail information
207
+ */
208
+ export async function getAppDetail(appId) {
209
+ const client = new HttpClient();
210
+ try {
211
+ const response = await client.get('/level/v1/latest', {
212
+ params: {
213
+ app_id: appId.toString(),
214
+ },
215
+ });
216
+ if (response.level && response.upload_level) {
217
+ return {
218
+ appId: response.upload_level.app_id,
219
+ appTitle: response.upload_level.form_data.info.title,
220
+ displayAppTitle: response.level.display_app_title || '',
221
+ developerId: response.level.developer_id || 0,
222
+ developerName: response.level.developer_name || '',
223
+ };
224
+ }
225
+ return undefined;
226
+ }
227
+ catch (error) {
228
+ return undefined;
229
+ }
230
+ }
231
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/features/app/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAgB,MAAM,2BAA2B,CAAC;AA8BrF;;GAEG;AACH,MAAM,OAAO,sBAAuB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AM,GAAG,IAAI,UAAU,EAAE,CAAC;IAEhC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAuB,kBAAkB,EAAE;YAC1E,MAAM,EAAE;gBACN,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE;aACzB;SACF,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,YAAY,EAAE,CAAC;YAC5C,OAAO;gBACL,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,MAAM;gBACnC,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK;gBACpD,eAAe,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,IAAI,EAAE;gBACvD,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC;gBAC7C,aAAa,EAAE,QAAQ,CAAC,KAAK,CAAC,cAAc,IAAI,EAAE;aACnD,CAAC;QACJ,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -2,12 +2,7 @@
2
2
  * Application Management Handlers
3
3
  * Handles developer and app selection operations
4
4
  */
5
- /**
6
- * Handler context for accessing environment variables
7
- */
8
- export interface HandlerContext {
9
- projectPath?: string;
10
- }
5
+ import type { HandlerContext } from '../../core/types/index.js';
11
6
  /**
12
7
  * List all developers and apps for the current user
13
8
  */
@@ -19,4 +14,11 @@ export declare function selectApp(args: {
19
14
  developer_id: number;
20
15
  app_id: number;
21
16
  }, context: HandlerContext): Promise<string>;
22
- //# sourceMappingURL=appHandlers.d.ts.map
17
+ /**
18
+ * Clear authentication data and app cache
19
+ */
20
+ export declare function clearAuthData(args: {
21
+ clear_token?: boolean;
22
+ clear_cache?: boolean;
23
+ }, context: HandlerContext): Promise<string>;
24
+ //# sourceMappingURL=handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/features/app/handlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAMhE;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA6CpF;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAC9C,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,MAAM,CAAC,CAsBjB;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,EACtD,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,MAAM,CAAC,CA0CjB"}
@@ -2,7 +2,10 @@
2
2
  * Application Management Handlers
3
3
  * Handles developer and app selection operations
4
4
  */
5
- import { getAllDevelopersAndApps, selectApp as selectAppApi } from '../network/leaderboardApi.js';
5
+ import { getAllDevelopersAndApps, selectApp as selectAppApi } from './api.js';
6
+ import { clearAppCache } from '../../core/utils/cache.js';
7
+ import { DeviceFlowAuth } from '../../core/auth/deviceFlow.js';
8
+ import { ApiConfig } from '../../core/network/httpClient.js';
6
9
  /**
7
10
  * List all developers and apps for the current user
8
11
  */
@@ -71,4 +74,45 @@ export async function selectApp(args, context) {
71
74
  return `❌ 选择应用失败:\n${errorMsg}\n\n请使用 list_developers_and_apps 查看可用的开发者和应用列表。`;
72
75
  }
73
76
  }
74
- //# sourceMappingURL=appHandlers.js.map
77
+ /**
78
+ * Clear authentication data and app cache
79
+ */
80
+ export async function clearAuthData(args, context) {
81
+ const clearToken = args.clear_token !== false; // Default true
82
+ const clearCache = args.clear_cache !== false; // Default true
83
+ let message = `🗑️ 清理认证数据\n\n`;
84
+ const clearedItems = [];
85
+ // Clear OAuth token file
86
+ if (clearToken) {
87
+ try {
88
+ const apiConfig = ApiConfig.getInstance();
89
+ const environment = apiConfig.environment;
90
+ const deviceAuth = new DeviceFlowAuth(environment);
91
+ deviceAuth.clearToken();
92
+ // Also clear in-memory token
93
+ apiConfig.setMacToken({});
94
+ clearedItems.push('✅ OAuth Token 文件已清除');
95
+ }
96
+ catch (error) {
97
+ clearedItems.push(`⚠️ OAuth Token 清除失败: ${error instanceof Error ? error.message : String(error)}`);
98
+ }
99
+ }
100
+ // Clear app cache
101
+ if (clearCache) {
102
+ try {
103
+ clearAppCache(context.projectPath);
104
+ clearedItems.push('✅ 应用选择缓存已清除');
105
+ }
106
+ catch (error) {
107
+ clearedItems.push(`⚠️ 缓存清除失败: ${error instanceof Error ? error.message : String(error)}`);
108
+ }
109
+ }
110
+ message += clearedItems.join('\n');
111
+ message += `\n\n📋 下一步:\n`;
112
+ message += `1. 调用需要认证的工具(如 list_developers_and_apps)\n`;
113
+ message += `2. 系统会自动生成新的授权链接\n`;
114
+ message += `3. 使用 TapTap App 扫码授权\n`;
115
+ message += `4. 调用 complete_oauth_authorization 完成授权`;
116
+ return message;
117
+ }
118
+ //# sourceMappingURL=handlers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"appHandlers.js","sourceRoot":"","sources":["../../src/handlers/appHandlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,8BAA8B,CAAC;AASlG;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAAuB;IACjE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,uBAAuB,EAAE,CAAC;QAE/C,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7C,OAAO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W,CAAC,EAAS,CAAC,CAAC;YAEjC,YAAY,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,YAAY,CAAC,IAAI,CAAC,wBAAwB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACtG,CAAC;IACH,CAAC;IAED,kBAAkB;IAClB,IAAI,UAAU,EAAE,CAAC;QACf,IAAI,CAAC;YACH,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACnC,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,YAAY,CAAC,IAAI,CAAC,cAAc,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;IAED,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,IAAI,eAAe,CAAC;IAC3B,OAAO,IAAI,4CAA4C,CAAC;IACxD,OAAO,IAAI,oBAAoB,CAAC;IAChC,OAAO,IAAI,yBAAyB,CAAC;IACrC,OAAO,IAAI,yCAAyC,CAAC;IAErD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Application Management Feature Module
3
+ * Provides app and developer selection functionality
4
+ */
5
+ import type { FeatureModule } from '../../core/types/index.js';
6
+ /**
7
+ * App Module Definition
8
+ */
9
+ export declare const appModule: FeatureModule;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/app/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,aAIvB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Application Management Feature Module
3
+ * Provides app and developer selection functionality
4
+ */
5
+ import { appTools } from './tools.js';
6
+ /**
7
+ * App Module Definition
8
+ */
9
+ export const appModule = {
10
+ name: 'app',
11
+ tools: appTools,
12
+ resources: []
13
+ };
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/app/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAkB;IACtC,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,QAAQ;IACf,SAAS,EAAE,EAAE;CACd,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Application Management Tools
3
+ * Unified definitions and handlers for app operations
4
+ */
5
+ import type { ToolRegistration } from '../../core/types/index.js';
6
+ /**
7
+ * Application Management Tools
8
+ * Each tool combines its definition and handler in one place
9
+ */
10
+ export declare const appTools: ToolRegistration[];
11
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/features/app/tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,2BAA2B,CAAC;AAMlF;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,gBAAgB,EAkKtC,CAAC"}
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Application Management Tools
3
+ * Unified definitions and handlers for app operations
4
+ */
5
+ import * as appHandlers from './handlers.js';
6
+ import * as appApi from './api.js';
7
+ import { leaderboardTools as leaderboardDocTools } from '../leaderboard/docTools.js';
8
+ import * as environmentHandlers from '../../core/handlers/environmentHandlers.js';
9
+ /**
10
+ * Application Management Tools
11
+ * Each tool combines its definition and handler in one place
12
+ */
13
+ export const appTools = [
14
+ // 📱 Get Current App Info
15
+ {
16
+ definition: {
17
+ name: 'get_current_app_info',
18
+ description: '[General] Get currently selected app/game information including developer_id, app_id, miniapp_id, and app name. Use this for: 1) Checking current selection, 2) Building preview links, 3) Verifying cached app. Not for H5 upload workflow.',
19
+ inputSchema: {
20
+ type: 'object',
21
+ properties: {}
22
+ }
23
+ },
24
+ handler: async (args, context) => {
25
+ return leaderboardDocTools.getCurrentAppInfo();
26
+ }
27
+ },
28
+ // 📱 Check Environment
29
+ {
30
+ definition: {
31
+ name: 'check_environment',
32
+ description: 'Check environment configuration and user authentication status. Use this to verify if TDS_MCP_MAC_TOKEN and TDS_MCP_CLIENT_ID are configured.',
33
+ inputSchema: {
34
+ type: 'object',
35
+ properties: {}
36
+ }
37
+ },
38
+ handler: async (args, context) => {
39
+ return environmentHandlers.checkEnvironment(context);
40
+ }
41
+ },
42
+ // 🔐 Complete OAuth Authorization
43
+ {
44
+ definition: {
45
+ name: 'complete_oauth_authorization',
46
+ description: 'Complete OAuth authorization after user has scanned QR code. Call this after user confirms they have completed authorization in browser. This tool will poll for the authorization result and save the token.',
47
+ inputSchema: {
48
+ type: 'object',
49
+ properties: {}
50
+ }
51
+ },
52
+ handler: async (args, context) => {
53
+ // This handler is replaced in server.ts (needs access to deviceAuth)
54
+ throw new Error('This handler is implemented in server.ts');
55
+ }
56
+ },
57
+ // 📁 List Developers and Apps
58
+ {
59
+ definition: {
60
+ name: 'list_developers_and_apps',
61
+ description: '[General App Management] List all developers and their apps/games for the current user. Use this for: 1) Initial exploration of available apps, 2) Switching between apps, 3) General app management (not H5 upload workflow). For H5 game upload, use h5_game_info_gatherer instead.',
62
+ inputSchema: {
63
+ type: 'object',
64
+ properties: {}
65
+ }
66
+ },
67
+ handler: async (args, context) => {
68
+ return appHandlers.listDevelopersAndApps(context);
69
+ },
70
+ requiresAuth: true
71
+ },
72
+ // 📁 Select App
73
+ {
74
+ definition: {
75
+ name: 'select_app',
76
+ description: '[General] Select a specific developer and app to use for subsequent operations. This will cache the selection for all modules (leaderboard, H5, etc.). Use this for: 1) General app selection, 2) Switching accounts, 3) After listing with list_developers_and_apps. For H5 upload, you can also pass developerId/appId to h5_game_info_gatherer directly.',
77
+ inputSchema: {
78
+ type: 'object',
79
+ properties: {
80
+ developer_id: {
81
+ type: 'number',
82
+ description: 'Developer ID to select (required)'
83
+ },
84
+ app_id: {
85
+ type: 'number',
86
+ description: 'App/Game ID to select (required)'
87
+ }
88
+ },
89
+ required: ['developer_id', 'app_id']
90
+ }
91
+ },
92
+ handler: async (args, context) => {
93
+ return appHandlers.selectApp(args, context);
94
+ },
95
+ requiresAuth: true
96
+ },
97
+ // 👤 Create Developer
98
+ {
99
+ definition: {
100
+ name: 'create_developer',
101
+ description: 'Create a new unverified developer identity on TapTap platform. Use this when user wants to create a new developer account.',
102
+ inputSchema: {
103
+ type: 'object',
104
+ properties: {}
105
+ }
106
+ },
107
+ handler: async (args, context) => {
108
+ const result = await appApi.createDeveloper();
109
+ return `✅ 创建开发者身份成功!\n\n` +
110
+ `📋 开发者信息:\n` +
111
+ `- 名称: ${result.developer_name}\n` +
112
+ `- ID: ${result.developer_id}\n\n` +
113
+ `💡 下一步:使用 create_app 创建应用,或使用 select_app 选择此开发者。`;
114
+ },
115
+ requiresAuth: true
116
+ },
117
+ // 🎮 Get App Status
118
+ {
119
+ definition: {
120
+ name: 'get_app_status',
121
+ description: 'Get the review status of an app/game. Use this to check if the app is published, under review, or rejected.',
122
+ inputSchema: {
123
+ type: 'object',
124
+ properties: {
125
+ app_id: {
126
+ type: 'number',
127
+ description: 'App ID to check status for'
128
+ }
129
+ },
130
+ required: ['app_id']
131
+ }
132
+ },
133
+ handler: async (args, context) => {
134
+ const result = await appApi.getAppStatus(args.app_id);
135
+ const statusText = ['未发布', '审核中', '审核失败', '已上线'][result.review_status] || '未知状态';
136
+ return `📋 应用审核状态:${statusText}\n\n` +
137
+ `状态码: ${result.review_status}\n` +
138
+ `- 0: 未发布\n` +
139
+ `- 1: 审核中\n` +
140
+ `- 2: 审核失败\n` +
141
+ `- 3: 已上线`;
142
+ },
143
+ requiresAuth: true
144
+ },
145
+ // 🗑️ Clear Auth Data
146
+ {
147
+ definition: {
148
+ name: 'clear_auth_data',
149
+ description: 'Clear all cached authentication data and app selection. Use this when: 1) MAC Token expired or invalid, 2) Want to switch accounts, 3) Need to reset authentication. This will clear both OAuth token file and app cache.',
150
+ inputSchema: {
151
+ type: 'object',
152
+ properties: {
153
+ clear_token: {
154
+ type: 'boolean',
155
+ description: 'Clear OAuth token file (default: true)'
156
+ },
157
+ clear_cache: {
158
+ type: 'boolean',
159
+ description: 'Clear app selection cache (default: true)'
160
+ }
161
+ }
162
+ }
163
+ },
164
+ handler: async (args, context) => {
165
+ return appHandlers.clearAuthData(args, context);
166
+ }
167
+ }
168
+ ];
169
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/features/app/tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,gBAAgB,IAAI,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,mBAAmB,MAAM,4CAA4C,CAAC;AAElF;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAuB;IAC1C,0BAA0B;IAC1B;QACE,UAAU,EAAE;YACV,IAAI,EAAE,sBAAsB;YAC5B,WAAW,EAAE,8OAA8O;YAC3P,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,EAAE;aACf;SACF;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;YAC/B,O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EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,MAAM,CAAC;YACjF,OAAO,aAAa,UAAU,MAAM;gBAC7B,QAAQ,MAAM,CAAC,aAAa,IAAI;gBAChC,YAAY;gBACZ,YAAY;gBACZ,aAAa;gBACb,UAAU,CAAC;QACpB,CAAC;QACD,YAAY,EAAE,IAAI;KACnB;IAED,sBAAsB;IACtB;QACE,UAAU,EAAE;YACV,IAAI,EAAE,iBAAiB;YACvB,WAAW,EAAE,2NAA2N;YACxO,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,WAAW,EAAE;wBACX,IAAI,EAAE,SAAS;wBACf,WAAW,EAAE,wCAAwC;qBACtD;oBACD,WAAW,EAAE;wBACX,IAAI,EAAE,SAAS;wBACf,WAAW,EAAE,2CAA2C;qBACzD;iBACF;aACF;SACF;QACD,OAAO,EAAE,KAAK,EAAE,IAAsD,EAAE,OAAO,EAAE,EAAE;YACjF,OAAO,WAAW,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAClD,CAAC;KACF;CACF,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * H5 Game API Functions
3
+ * Only H5-specific APIs (upload parameters)
4
+ * All common app management APIs are in app/api.ts
5
+ */
6
+ /**
7
+ * Upload parameters for H5 game package
8
+ */
9
+ export interface UploadParams {
10
+ h5_package_id: number;
11
+ url: string;
12
+ method: string;
13
+ headers: Record<string, string>;
14
+ }
15
+ /**
16
+ * 获取 H5 游戏包上传参数
17
+ * This is H5-specific functionality
18
+ */
19
+ export declare function getH5PackageUploadParams(app_id?: number): Promise<UploadParams>;
20
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/features/h5Game/api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAKrF"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * H5 Game API Functions
3
+ * Only H5-specific APIs (upload parameters)
4
+ * All common app management APIs are in app/api.ts
5
+ */
6
+ import { HttpClient } from '../../core/network/httpClient.js';
7
+ /**
8
+ * 获取 H5 游戏包上传参数
9
+ * This is H5-specific functionality
10
+ */
11
+ export async function getH5PackageUploadParams(app_id) {
12
+ const client = new HttpClient();
13
+ const params = app_id ? { app_id: app_id.toString() } : undefined;
14
+ return await client.get('/level/v1/upload', { params });
15
+ }
16
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/features/h5Game/api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAY9D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,MAAe;IAC5D,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAChC,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAElE,OAAO,MAAM,MAAM,CAAC,GAAG,CAAe,kBAAkB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AACxE,CAAC"}