@gtkx/mcp 0.21.0 → 1.0.0-rc.2

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 (73) hide show
  1. package/README.md +137 -34
  2. package/bin/gtkx-mcp.js +9 -1
  3. package/dist/app-router.d.ts +35 -0
  4. package/dist/app-router.d.ts.map +1 -0
  5. package/dist/app-router.js +143 -0
  6. package/dist/app-router.js.map +1 -0
  7. package/dist/connection-registry.d.ts +12 -0
  8. package/dist/connection-registry.d.ts.map +1 -0
  9. package/dist/connection-registry.js +39 -0
  10. package/dist/connection-registry.js.map +1 -0
  11. package/dist/internal.d.ts +4 -0
  12. package/dist/internal.d.ts.map +1 -0
  13. package/dist/internal.js +4 -0
  14. package/dist/internal.js.map +1 -0
  15. package/dist/protocol/errors.d.ts +25 -87
  16. package/dist/protocol/errors.d.ts.map +1 -1
  17. package/dist/protocol/errors.js +38 -101
  18. package/dist/protocol/errors.js.map +1 -1
  19. package/dist/protocol/schemas.d.ts +93 -0
  20. package/dist/protocol/schemas.d.ts.map +1 -0
  21. package/dist/protocol/schemas.js +63 -0
  22. package/dist/protocol/schemas.js.map +1 -0
  23. package/dist/reference.d.ts +13 -0
  24. package/dist/reference.d.ts.map +1 -0
  25. package/dist/reference.js +293 -0
  26. package/dist/reference.js.map +1 -0
  27. package/dist/server.d.ts +14 -0
  28. package/dist/server.d.ts.map +1 -0
  29. package/dist/server.js +244 -0
  30. package/dist/server.js.map +1 -0
  31. package/dist/socket-server.d.ts +5 -38
  32. package/dist/socket-server.d.ts.map +1 -1
  33. package/dist/socket-server.js +36 -108
  34. package/dist/socket-server.js.map +1 -1
  35. package/dist/tool.d.ts +22 -0
  36. package/dist/tool.d.ts.map +1 -0
  37. package/dist/tool.js +40 -0
  38. package/dist/tool.js.map +1 -0
  39. package/dist/transport.d.ts +49 -0
  40. package/dist/transport.d.ts.map +1 -0
  41. package/dist/transport.js +152 -0
  42. package/dist/transport.js.map +1 -0
  43. package/package.json +15 -11
  44. package/src/app-router.ts +209 -0
  45. package/src/connection-registry.ts +57 -0
  46. package/src/internal.ts +17 -0
  47. package/src/protocol/errors.ts +67 -110
  48. package/src/protocol/schemas.ts +173 -0
  49. package/src/reference.ts +449 -0
  50. package/src/server.ts +334 -0
  51. package/src/socket-server.ts +46 -147
  52. package/src/tool.ts +73 -0
  53. package/src/transport.ts +242 -0
  54. package/dist/cli.d.ts +0 -3
  55. package/dist/cli.d.ts.map +0 -1
  56. package/dist/cli.js +0 -399
  57. package/dist/cli.js.map +0 -1
  58. package/dist/connection-manager.d.ts +0 -48
  59. package/dist/connection-manager.d.ts.map +0 -1
  60. package/dist/connection-manager.js +0 -185
  61. package/dist/connection-manager.js.map +0 -1
  62. package/dist/index.d.ts +0 -5
  63. package/dist/index.d.ts.map +0 -1
  64. package/dist/index.js +0 -5
  65. package/dist/index.js.map +0 -1
  66. package/dist/protocol/types.d.ts +0 -132
  67. package/dist/protocol/types.d.ts.map +0 -1
  68. package/dist/protocol/types.js +0 -46
  69. package/dist/protocol/types.js.map +0 -1
  70. package/src/cli.ts +0 -449
  71. package/src/connection-manager.ts +0 -247
  72. package/src/index.ts +0 -27
  73. package/src/protocol/types.ts +0 -153
@@ -0,0 +1,242 @@
1
+ import type { Socket } from "node:net";
2
+ import type { Duplex } from "node:stream";
3
+ import { ErrorCode, invalidRequestError, isErrorCode, ProtocolError, requestTimeoutError } from "./protocol/errors.js";
4
+ import { type Message, type Request, RequestSchema, type Response, ResponseSchema } from "./protocol/schemas.js";
5
+
6
+ type ProtocolConnectionEvents = {
7
+ request: Request;
8
+ invalid: { id: string; error: ProtocolError };
9
+ };
10
+
11
+ type PendingRequest = {
12
+ resolve: (result: unknown) => void;
13
+ reject: (error: Error) => void;
14
+ timeout: NodeJS.Timeout;
15
+ };
16
+
17
+ type ConnectionEvent = CustomEvent<ProtocolConnection>;
18
+ type ConnectionRequestEvent = CustomEvent<{ connection: ProtocolConnection; request: Request }>;
19
+ type ConnectionErrorEvent = CustomEvent<Error>;
20
+
21
+ type AppConnections = {
22
+ send(connectionId: string, message: Message): void;
23
+ } & EventTarget;
24
+
25
+ function connectionRequestEvent(connection: ProtocolConnection, request: Request): ConnectionRequestEvent {
26
+ return new CustomEvent("request", { detail: { connection, request } });
27
+ }
28
+
29
+ function connectionDisconnectionEvent(connection: ProtocolConnection): ConnectionEvent {
30
+ return new CustomEvent("disconnection", { detail: connection });
31
+ }
32
+
33
+ function connectionErrorEvent(error: Error): ConnectionErrorEvent {
34
+ return new CustomEvent("error", { detail: error });
35
+ }
36
+
37
+ class ConnectionClosedError extends Error {
38
+ constructor() {
39
+ super("Connection stream is not writable");
40
+ this.name = "ConnectionClosedError";
41
+ }
42
+ }
43
+
44
+ class ProtocolConnection extends EventTarget {
45
+ static fromSocket(
46
+ socket: Socket,
47
+ options: {
48
+ onClose?: () => void;
49
+ onError?: (error: Error) => void;
50
+ } = {},
51
+ ): ProtocolConnection {
52
+ const connection = new ProtocolConnection(socket);
53
+
54
+ socket.on("data", (data: Buffer) => {
55
+ connection.feed(data);
56
+ });
57
+
58
+ socket.on("close", () => {
59
+ connection.rejectPending(new Error("Connection closed"));
60
+ options.onClose?.();
61
+ });
62
+
63
+ if (options.onError) {
64
+ socket.on("error", options.onError);
65
+ }
66
+
67
+ return connection;
68
+ }
69
+
70
+ private buffer = "";
71
+ private pending: Map<string, PendingRequest> = new Map();
72
+ private writer: Duplex;
73
+
74
+ id: string = crypto.randomUUID();
75
+
76
+ constructor(writer: Duplex) {
77
+ super();
78
+ this.writer = writer;
79
+ }
80
+
81
+ private notify<K extends keyof ProtocolConnectionEvents>(type: K, detail: ProtocolConnectionEvents[K]): void {
82
+ this.dispatchEvent(new CustomEvent(type, { detail }));
83
+ }
84
+
85
+ private rejectWhenClosed(id: string, timeoutHandle: NodeJS.Timeout, reject: (error: Error) => void): void {
86
+ if (this.writer.writable) {
87
+ return;
88
+ }
89
+
90
+ clearTimeout(timeoutHandle);
91
+ this.pending.delete(id);
92
+ reject(new ConnectionClosedError());
93
+ }
94
+
95
+ private dispatchParsed(parsed: unknown): boolean {
96
+ const message = parsed as Record<string, unknown>;
97
+
98
+ if (typeof message.method === "string") {
99
+ const requestResult = RequestSchema.safeParse(parsed);
100
+
101
+ if (!requestResult.success) {
102
+ return false;
103
+ }
104
+
105
+ this.notify("request", requestResult.data);
106
+
107
+ return true;
108
+ }
109
+
110
+ const responseResult = ResponseSchema.safeParse(parsed);
111
+
112
+ if (!responseResult.success) {
113
+ return false;
114
+ }
115
+
116
+ this.handleResponse(responseResult.data);
117
+
118
+ return true;
119
+ }
120
+
121
+ private processLine(line: string): void {
122
+ let parsed: unknown;
123
+
124
+ try {
125
+ parsed = JSON.parse(line);
126
+ } catch {
127
+ this.notify("invalid", { id: "unknown", error: invalidRequestError("Invalid JSON") });
128
+
129
+ return;
130
+ }
131
+
132
+ if (this.dispatchParsed(parsed)) {
133
+ return;
134
+ }
135
+
136
+ const message = parsed as Record<string, unknown>;
137
+ const id = typeof message.id === "string" ? message.id : "unknown";
138
+ this.notify("invalid", { id, error: invalidRequestError("Invalid message format") });
139
+ }
140
+
141
+ private handleResponse(response: Response): void {
142
+ const entry = this.pending.get(response.id);
143
+
144
+ if (!entry) {
145
+ return;
146
+ }
147
+
148
+ clearTimeout(entry.timeout);
149
+ this.pending.delete(response.id);
150
+
151
+ if (response.error) {
152
+ const err = response.error;
153
+
154
+ entry.reject(
155
+ new ProtocolError(isErrorCode(err.code) ? err.code : ErrorCode.INTERNAL_ERROR, err.message, err.data),
156
+ );
157
+ } else {
158
+ entry.resolve(response.result);
159
+ }
160
+ }
161
+
162
+ on<K extends keyof ProtocolConnectionEvents>(
163
+ type: K,
164
+ listener: (detail: ProtocolConnectionEvents[K]) => void,
165
+ ): void {
166
+ this.addEventListener(type, (event) => {
167
+ listener((event as CustomEvent<ProtocolConnectionEvents[K]>).detail);
168
+ });
169
+ }
170
+
171
+ feed(data: Buffer | string): void {
172
+ this.buffer += typeof data === "string" ? data : data.toString();
173
+ let newlineIndex = this.buffer.indexOf("\n");
174
+
175
+ while (newlineIndex !== -1) {
176
+ const line = this.buffer.slice(0, newlineIndex);
177
+ this.buffer = this.buffer.slice(newlineIndex + 1);
178
+
179
+ if (line.trim()) {
180
+ this.processLine(line);
181
+ }
182
+
183
+ newlineIndex = this.buffer.indexOf("\n");
184
+ }
185
+ }
186
+
187
+ write(message: Message): void {
188
+ if (!this.writer.writable) {
189
+ return;
190
+ }
191
+
192
+ this.writer.write(`${JSON.stringify(message)}\n`);
193
+ }
194
+
195
+ send<T = unknown>(method: string, params: unknown, timeout: number): Promise<T> {
196
+ return new Promise<T>((resolve, reject) => {
197
+ if (!this.writer.writable) {
198
+ reject(new ConnectionClosedError());
199
+
200
+ return;
201
+ }
202
+
203
+ const id = crypto.randomUUID();
204
+
205
+ const timeoutHandle = setTimeout(() => {
206
+ this.pending.delete(id);
207
+ reject(requestTimeoutError(timeout));
208
+ }, timeout);
209
+
210
+ this.pending.set(id, {
211
+ resolve: resolve as (result: unknown) => void,
212
+ reject,
213
+ timeout: timeoutHandle,
214
+ });
215
+
216
+ this.write({ id, method, params });
217
+ this.rejectWhenClosed(id, timeoutHandle, reject);
218
+ });
219
+ }
220
+
221
+ rejectPending(error: Error): void {
222
+ for (const entry of this.pending.values()) {
223
+ clearTimeout(entry.timeout);
224
+ entry.reject(error);
225
+ }
226
+
227
+ this.pending.clear();
228
+ }
229
+ }
230
+
231
+ export {
232
+ ConnectionClosedError,
233
+ connectionDisconnectionEvent,
234
+ connectionErrorEvent,
235
+ connectionRequestEvent,
236
+ ProtocolConnection,
237
+ type ProtocolConnectionEvents,
238
+ type AppConnections,
239
+ type ConnectionEvent,
240
+ type ConnectionErrorEvent,
241
+ type ConnectionRequestEvent,
242
+ };
package/dist/cli.d.ts DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js DELETED
@@ -1,399 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire } from "node:module";
3
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
4
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
- import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
6
- import { z } from "zod";
7
- import { ConnectionManager } from "./connection-manager.js";
8
- import { DEFAULT_SOCKET_PATH } from "./protocol/types.js";
9
- import { SocketServer } from "./socket-server.js";
10
- const require = createRequire(import.meta.url);
11
- const { version } = require("../package.json");
12
- const AppIdSchema = z.object({
13
- appId: z.string().optional().describe("App ID to query. If not specified, uses the first connected app."),
14
- });
15
- const ListAppsInputSchema = z.object({
16
- waitForApps: z
17
- .boolean()
18
- .optional()
19
- .describe("If true, wait for at least one app to register before returning. Useful when app is still starting."),
20
- timeout: z.number().optional().describe("Timeout in milliseconds when waitForApps is true (default: 10000)"),
21
- });
22
- const GetWidgetTreeInputSchema = AppIdSchema;
23
- const QueryWidgetsInputSchema = AppIdSchema.extend({
24
- by: z.enum(["role", "text", "name", "labelText"]).describe("Query type"),
25
- value: z.union([z.string(), z.number()]).describe("Value to search for"),
26
- options: z
27
- .object({
28
- name: z.string().optional(),
29
- exact: z.boolean().optional(),
30
- timeout: z.number().optional(),
31
- })
32
- .optional()
33
- .describe("Additional query options"),
34
- });
35
- const WidgetIdSchema = AppIdSchema.extend({
36
- widgetId: z.string().describe("Widget ID"),
37
- });
38
- const GetWidgetPropsInputSchema = WidgetIdSchema;
39
- const ClickInputSchema = WidgetIdSchema;
40
- const TypeInputSchema = WidgetIdSchema.extend({
41
- text: z.string().describe("Text to type"),
42
- clear: z.boolean().optional().describe("Clear existing text before typing"),
43
- });
44
- const FireEventInputSchema = WidgetIdSchema.extend({
45
- signal: z.string().describe("GTK signal name to emit"),
46
- args: z.array(z.unknown()).optional().describe("Arguments to pass to the signal"),
47
- });
48
- const TakeScreenshotInputSchema = AppIdSchema.extend({
49
- windowId: z.string().optional().describe("Window ID to capture. If not specified, captures the first window."),
50
- });
51
- const tools = [
52
- {
53
- name: "gtkx_list_apps",
54
- description: "List all connected GTKX applications",
55
- inputSchema: {
56
- type: "object",
57
- properties: {
58
- waitForApps: {
59
- type: "boolean",
60
- description: "If true, wait for at least one app to register before returning. Useful when app is still starting.",
61
- },
62
- timeout: {
63
- type: "number",
64
- description: "Timeout in milliseconds when waitForApps is true (default: 10000)",
65
- },
66
- },
67
- required: [],
68
- },
69
- },
70
- {
71
- name: "gtkx_get_widget_tree",
72
- description: "Get the widget hierarchy for a connected GTKX app. Returns a tree of all widgets with their IDs, types, roles, and properties.",
73
- inputSchema: {
74
- type: "object",
75
- properties: {
76
- appId: {
77
- type: "string",
78
- description: "App ID to query. If not specified, uses the first connected app.",
79
- },
80
- },
81
- required: [],
82
- },
83
- },
84
- {
85
- name: "gtkx_query_widgets",
86
- description: "Find widgets by role, text, name, or label. Returns matching widgets with their IDs and properties.",
87
- inputSchema: {
88
- type: "object",
89
- properties: {
90
- appId: {
91
- type: "string",
92
- description: "App ID to query. If not specified, uses the first connected app.",
93
- },
94
- by: {
95
- type: "string",
96
- enum: ["role", "text", "name", "labelText"],
97
- description: "Query type",
98
- },
99
- value: {
100
- oneOf: [{ type: "string" }, { type: "number" }],
101
- description: "Value to search for",
102
- },
103
- options: {
104
- type: "object",
105
- properties: {
106
- name: { type: "string" },
107
- exact: { type: "boolean" },
108
- timeout: { type: "number" },
109
- },
110
- description: "Additional query options",
111
- },
112
- },
113
- required: ["by", "value"],
114
- },
115
- },
116
- {
117
- name: "gtkx_get_widget_props",
118
- description: "Get all properties of a specific widget by its ID",
119
- inputSchema: {
120
- type: "object",
121
- properties: {
122
- appId: {
123
- type: "string",
124
- description: "App ID to query. If not specified, uses the first connected app.",
125
- },
126
- widgetId: {
127
- type: "string",
128
- description: "Widget ID to get properties for",
129
- },
130
- },
131
- required: ["widgetId"],
132
- },
133
- },
134
- {
135
- name: "gtkx_click",
136
- description: "Click a widget. Works with buttons, checkboxes, and other interactive widgets.",
137
- inputSchema: {
138
- type: "object",
139
- properties: {
140
- appId: {
141
- type: "string",
142
- description: "App ID to query. If not specified, uses the first connected app.",
143
- },
144
- widgetId: {
145
- type: "string",
146
- description: "Widget ID to click",
147
- },
148
- },
149
- required: ["widgetId"],
150
- },
151
- },
152
- {
153
- name: "gtkx_type",
154
- description: "Type text into an editable widget like Entry or TextView",
155
- inputSchema: {
156
- type: "object",
157
- properties: {
158
- appId: {
159
- type: "string",
160
- description: "App ID to query. If not specified, uses the first connected app.",
161
- },
162
- widgetId: {
163
- type: "string",
164
- description: "Widget ID to type into",
165
- },
166
- text: {
167
- type: "string",
168
- description: "Text to type",
169
- },
170
- clear: {
171
- type: "boolean",
172
- description: "Clear existing text before typing",
173
- },
174
- },
175
- required: ["widgetId", "text"],
176
- },
177
- },
178
- {
179
- name: "gtkx_fire_event",
180
- description: "Emit a GTK signal on a widget. Use this for custom interactions.",
181
- inputSchema: {
182
- type: "object",
183
- properties: {
184
- appId: {
185
- type: "string",
186
- description: "App ID to query. If not specified, uses the first connected app.",
187
- },
188
- widgetId: {
189
- type: "string",
190
- description: "Widget ID to emit event on",
191
- },
192
- signal: {
193
- type: "string",
194
- description: "GTK signal name to emit",
195
- },
196
- args: {
197
- type: "array",
198
- items: {},
199
- description: "Arguments to pass to the signal",
200
- },
201
- },
202
- required: ["widgetId", "signal"],
203
- },
204
- },
205
- {
206
- name: "gtkx_take_screenshot",
207
- description: "Capture a screenshot of a window. Returns base64-encoded PNG image data.",
208
- inputSchema: {
209
- type: "object",
210
- properties: {
211
- appId: {
212
- type: "string",
213
- description: "App ID to query. If not specified, uses the first connected app.",
214
- },
215
- windowId: {
216
- type: "string",
217
- description: "Window ID to capture. If not specified, captures the first window.",
218
- },
219
- },
220
- required: [],
221
- },
222
- },
223
- ];
224
- async function main() {
225
- const socketServer = new SocketServer(DEFAULT_SOCKET_PATH);
226
- const connectionManager = new ConnectionManager(socketServer);
227
- socketServer.on("error", (error) => {
228
- const code = error.code;
229
- if (code !== "EPIPE" && code !== "ECONNRESET") {
230
- console.error("[gtkx] Socket error:", error.message);
231
- }
232
- });
233
- await socketServer.start();
234
- console.error(`[gtkx] Socket server listening on ${DEFAULT_SOCKET_PATH}`);
235
- connectionManager.on("appRegistered", (appInfo) => {
236
- console.error(`[gtkx] App registered: ${appInfo.appId} (PID: ${appInfo.pid})`);
237
- });
238
- connectionManager.on("appUnregistered", (appId) => {
239
- console.error(`[gtkx] App unregistered: ${appId}`);
240
- });
241
- const server = new Server({
242
- name: "gtkx-mcp",
243
- version,
244
- }, {
245
- capabilities: {
246
- tools: {},
247
- },
248
- });
249
- server.setRequestHandler(ListToolsRequestSchema, async () => {
250
- return { tools };
251
- });
252
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
253
- const { name, arguments: args } = request.params;
254
- try {
255
- switch (name) {
256
- case "gtkx_list_apps": {
257
- const input = ListAppsInputSchema.parse(args);
258
- if (input.waitForApps && !connectionManager.hasConnectedApps()) {
259
- try {
260
- await connectionManager.waitForApp(input.timeout);
261
- }
262
- catch (error) {
263
- return {
264
- content: [
265
- {
266
- type: "text",
267
- text: error instanceof Error ? error.message : "Timeout waiting for app",
268
- },
269
- ],
270
- isError: true,
271
- };
272
- }
273
- }
274
- const apps = connectionManager.getApps();
275
- const appsWithWindows = await Promise.all(apps.map(async (app) => {
276
- try {
277
- const result = await connectionManager.sendToApp(app.appId, "app.getWindows", {});
278
- return { ...app, windows: result.windows };
279
- }
280
- catch {
281
- return app;
282
- }
283
- }));
284
- return {
285
- content: [{ type: "text", text: JSON.stringify(appsWithWindows, null, 2) }],
286
- };
287
- }
288
- case "gtkx_get_widget_tree": {
289
- const input = GetWidgetTreeInputSchema.parse(args);
290
- const result = await connectionManager.sendToApp(input.appId, "widget.getTree", {});
291
- return {
292
- content: [{ type: "text", text: result.tree }],
293
- };
294
- }
295
- case "gtkx_query_widgets": {
296
- const input = QueryWidgetsInputSchema.parse(args);
297
- const result = await connectionManager.sendToApp(input.appId, "widget.query", {
298
- queryType: input.by,
299
- value: input.value,
300
- options: input.options,
301
- });
302
- return {
303
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
304
- };
305
- }
306
- case "gtkx_get_widget_props": {
307
- const input = GetWidgetPropsInputSchema.parse(args);
308
- const result = await connectionManager.sendToApp(input.appId, "widget.getProps", {
309
- widgetId: input.widgetId,
310
- });
311
- return {
312
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
313
- };
314
- }
315
- case "gtkx_click": {
316
- const input = ClickInputSchema.parse(args);
317
- await connectionManager.sendToApp(input.appId, "widget.click", {
318
- widgetId: input.widgetId,
319
- });
320
- return {
321
- content: [{ type: "text", text: "Click successful" }],
322
- };
323
- }
324
- case "gtkx_type": {
325
- const input = TypeInputSchema.parse(args);
326
- await connectionManager.sendToApp(input.appId, "widget.type", {
327
- widgetId: input.widgetId,
328
- text: input.text,
329
- clear: input.clear,
330
- });
331
- return {
332
- content: [{ type: "text", text: "Type successful" }],
333
- };
334
- }
335
- case "gtkx_fire_event": {
336
- const input = FireEventInputSchema.parse(args);
337
- await connectionManager.sendToApp(input.appId, "widget.fireEvent", {
338
- widgetId: input.widgetId,
339
- signal: input.signal,
340
- args: input.args,
341
- });
342
- return {
343
- content: [{ type: "text", text: "Event fired successfully" }],
344
- };
345
- }
346
- case "gtkx_take_screenshot": {
347
- const input = TakeScreenshotInputSchema.parse(args);
348
- const result = await connectionManager.sendToApp(input.appId, "widget.screenshot", {
349
- windowId: input.windowId,
350
- });
351
- return {
352
- content: [
353
- {
354
- type: "image",
355
- data: result.data,
356
- mimeType: result.mimeType,
357
- },
358
- ],
359
- };
360
- }
361
- default:
362
- return {
363
- content: [{ type: "text", text: `Unknown tool: ${name}` }],
364
- isError: true,
365
- };
366
- }
367
- }
368
- catch (error) {
369
- const message = error instanceof Error ? error.message : String(error);
370
- return {
371
- content: [{ type: "text", text: message }],
372
- isError: true,
373
- };
374
- }
375
- });
376
- const transport = new StdioServerTransport();
377
- await server.connect(transport);
378
- let isShuttingDown = false;
379
- const shutdown = async () => {
380
- if (isShuttingDown)
381
- return;
382
- isShuttingDown = true;
383
- try {
384
- connectionManager.cleanup();
385
- await socketServer.stop();
386
- await server.close();
387
- }
388
- finally {
389
- process.exit(0);
390
- }
391
- };
392
- process.on("SIGINT", shutdown);
393
- process.on("SIGTERM", shutdown);
394
- }
395
- main().catch((error) => {
396
- console.error("[gtkx] Fatal error:", error);
397
- process.exit(1);
398
- });
399
- //# sourceMappingURL=cli.js.map
package/dist/cli.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAEtE,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IACzB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kEA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