@kelceyp/caw-server 0.0.2 → 0.0.3
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/dist/main.js +121 -90
- package/dist/main.js.map +3 -3
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -56189,110 +56189,141 @@ var createMcpServer = ({ sessionManager } = {}) => {
|
|
|
56189
56189
|
]
|
|
56190
56190
|
};
|
|
56191
56191
|
});
|
|
56192
|
-
|
|
56193
|
-
|
|
56194
|
-
|
|
56195
|
-
|
|
56196
|
-
|
|
56197
|
-
|
|
56198
|
-
|
|
56199
|
-
|
|
56200
|
-
|
|
56201
|
-
|
|
56202
|
-
|
|
56203
|
-
|
|
56204
|
-
|
|
56205
|
-
|
|
56206
|
-
|
|
56207
|
-
|
|
56208
|
-
|
|
56209
|
-
|
|
56210
|
-
|
|
56211
|
-
|
|
56212
|
-
|
|
56213
|
-
|
|
56214
|
-
|
|
56215
|
-
|
|
56216
|
-
}
|
|
56217
|
-
|
|
56218
|
-
|
|
56219
|
-
|
|
56220
|
-
|
|
56221
|
-
|
|
56222
|
-
|
|
56223
|
-
|
|
56224
|
-
|
|
56225
|
-
|
|
56226
|
-
|
|
56227
|
-
|
|
56228
|
-
|
|
56229
|
-
}
|
|
56230
|
-
}
|
|
56231
|
-
|
|
56232
|
-
|
|
56233
|
-
|
|
56234
|
-
|
|
56235
|
-
|
|
56236
|
-
|
|
56237
|
-
|
|
56192
|
+
server.registerTool("get_state", {
|
|
56193
|
+
title: "Get ChatGPT State",
|
|
56194
|
+
description: "Get the current state of ChatGPT (IDLE, COMPOSING, RESPONDING, or UNKNOWN)",
|
|
56195
|
+
inputSchema: exports_external2.object({
|
|
56196
|
+
pageId: exports_external2.string().describe("Page ID of the ChatGPT tab")
|
|
56197
|
+
})
|
|
56198
|
+
}, async ({ pageId }) => {
|
|
56199
|
+
if (!sessionManager) {
|
|
56200
|
+
return {
|
|
56201
|
+
content: [
|
|
56202
|
+
{
|
|
56203
|
+
type: "text",
|
|
56204
|
+
text: "Error: SessionManager not initialized"
|
|
56205
|
+
}
|
|
56206
|
+
],
|
|
56207
|
+
isError: true
|
|
56208
|
+
};
|
|
56209
|
+
}
|
|
56210
|
+
try {
|
|
56211
|
+
const result = await sessionManager.sendCommand(pageId, "getState", {});
|
|
56212
|
+
return {
|
|
56213
|
+
content: [
|
|
56214
|
+
{
|
|
56215
|
+
type: "text",
|
|
56216
|
+
text: `ChatGPT state: ${result.state}`
|
|
56217
|
+
}
|
|
56218
|
+
]
|
|
56219
|
+
};
|
|
56220
|
+
} catch (error) {
|
|
56221
|
+
return {
|
|
56222
|
+
content: [
|
|
56223
|
+
{
|
|
56224
|
+
type: "text",
|
|
56225
|
+
text: `Error: ${error.message}`
|
|
56226
|
+
}
|
|
56227
|
+
],
|
|
56228
|
+
isError: true
|
|
56229
|
+
};
|
|
56230
|
+
}
|
|
56231
|
+
});
|
|
56232
|
+
server.registerTool("send_message", {
|
|
56233
|
+
title: "Send Message to ChatGPT",
|
|
56234
|
+
description: "Send a message to ChatGPT and wait for the response. Requires ChatGPT to be in IDLE state.",
|
|
56235
|
+
inputSchema: exports_external2.object({
|
|
56236
|
+
pageId: exports_external2.string().describe("Page ID of the ChatGPT tab"),
|
|
56237
|
+
text: exports_external2.string().describe("Message to send to ChatGPT"),
|
|
56238
|
+
timeout: exports_external2.number().optional().describe("Timeout in milliseconds (default: 120000)")
|
|
56239
|
+
})
|
|
56240
|
+
}, async ({ pageId, text, timeout }) => {
|
|
56241
|
+
if (!sessionManager) {
|
|
56242
|
+
return {
|
|
56243
|
+
content: [
|
|
56244
|
+
{
|
|
56245
|
+
type: "text",
|
|
56246
|
+
text: "Error: SessionManager not initialized"
|
|
56247
|
+
}
|
|
56248
|
+
],
|
|
56249
|
+
isError: true
|
|
56250
|
+
};
|
|
56251
|
+
}
|
|
56252
|
+
try {
|
|
56253
|
+
const result = await sessionManager.sendCommand(pageId, "sendMessage", { text, timeout });
|
|
56254
|
+
return {
|
|
56255
|
+
content: [
|
|
56256
|
+
{
|
|
56257
|
+
type: "text",
|
|
56258
|
+
text: `ChatGPT response (turn ${result.turn}, ${result.duration}ms):
|
|
56238
56259
|
|
|
56239
56260
|
${result.text}`
|
|
56240
|
-
|
|
56241
|
-
|
|
56242
|
-
|
|
56243
|
-
|
|
56261
|
+
}
|
|
56262
|
+
]
|
|
56263
|
+
};
|
|
56264
|
+
} catch (error) {
|
|
56265
|
+
return {
|
|
56266
|
+
content: [
|
|
56267
|
+
{
|
|
56268
|
+
type: "text",
|
|
56269
|
+
text: `Error: ${error.message}`
|
|
56270
|
+
}
|
|
56271
|
+
],
|
|
56272
|
+
isError: true
|
|
56273
|
+
};
|
|
56274
|
+
}
|
|
56275
|
+
});
|
|
56276
|
+
server.registerTool("get_last_message", {
|
|
56277
|
+
title: "Get Last ChatGPT Message",
|
|
56278
|
+
description: "Get the most recent message from ChatGPT",
|
|
56279
|
+
inputSchema: exports_external2.object({
|
|
56280
|
+
pageId: exports_external2.string().describe("Page ID of the ChatGPT tab")
|
|
56281
|
+
})
|
|
56282
|
+
}, async ({ pageId }) => {
|
|
56283
|
+
if (!sessionManager) {
|
|
56284
|
+
return {
|
|
56285
|
+
content: [
|
|
56286
|
+
{
|
|
56287
|
+
type: "text",
|
|
56288
|
+
text: "Error: SessionManager not initialized"
|
|
56289
|
+
}
|
|
56290
|
+
],
|
|
56291
|
+
isError: true
|
|
56292
|
+
};
|
|
56293
|
+
}
|
|
56294
|
+
try {
|
|
56295
|
+
const result = await sessionManager.sendCommand(pageId, "getLastMessage", {});
|
|
56296
|
+
if (result.text) {
|
|
56244
56297
|
return {
|
|
56245
56298
|
content: [
|
|
56246
56299
|
{
|
|
56247
56300
|
type: "text",
|
|
56248
|
-
text:
|
|
56301
|
+
text: result.text
|
|
56249
56302
|
}
|
|
56250
|
-
]
|
|
56251
|
-
isError: true
|
|
56303
|
+
]
|
|
56252
56304
|
};
|
|
56253
|
-
}
|
|
56254
|
-
});
|
|
56255
|
-
server.registerTool("get_last_message", {
|
|
56256
|
-
title: "Get Last ChatGPT Message",
|
|
56257
|
-
description: "Get the most recent message from ChatGPT",
|
|
56258
|
-
inputSchema: exports_external2.object({
|
|
56259
|
-
pageId: exports_external2.string().describe("Page ID of the ChatGPT tab")
|
|
56260
|
-
})
|
|
56261
|
-
}, async ({ pageId }) => {
|
|
56262
|
-
try {
|
|
56263
|
-
const result = await sessionManager.sendCommand(pageId, "getLastMessage", {});
|
|
56264
|
-
if (result.text) {
|
|
56265
|
-
return {
|
|
56266
|
-
content: [
|
|
56267
|
-
{
|
|
56268
|
-
type: "text",
|
|
56269
|
-
text: result.text
|
|
56270
|
-
}
|
|
56271
|
-
]
|
|
56272
|
-
};
|
|
56273
|
-
} else {
|
|
56274
|
-
return {
|
|
56275
|
-
content: [
|
|
56276
|
-
{
|
|
56277
|
-
type: "text",
|
|
56278
|
-
text: "No message found"
|
|
56279
|
-
}
|
|
56280
|
-
]
|
|
56281
|
-
};
|
|
56282
|
-
}
|
|
56283
|
-
} catch (error) {
|
|
56305
|
+
} else {
|
|
56284
56306
|
return {
|
|
56285
56307
|
content: [
|
|
56286
56308
|
{
|
|
56287
56309
|
type: "text",
|
|
56288
|
-
text:
|
|
56310
|
+
text: "No message found"
|
|
56289
56311
|
}
|
|
56290
|
-
]
|
|
56291
|
-
isError: true
|
|
56312
|
+
]
|
|
56292
56313
|
};
|
|
56293
56314
|
}
|
|
56294
|
-
})
|
|
56295
|
-
|
|
56315
|
+
} catch (error) {
|
|
56316
|
+
return {
|
|
56317
|
+
content: [
|
|
56318
|
+
{
|
|
56319
|
+
type: "text",
|
|
56320
|
+
text: `Error: ${error.message}`
|
|
56321
|
+
}
|
|
56322
|
+
],
|
|
56323
|
+
isError: true
|
|
56324
|
+
};
|
|
56325
|
+
}
|
|
56326
|
+
});
|
|
56296
56327
|
return server;
|
|
56297
56328
|
};
|
|
56298
56329
|
var McpServer_default = createMcpServer;
|
|
@@ -56912,4 +56943,4 @@ ${signal} received, shutting down gracefully...`);
|
|
|
56912
56943
|
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
56913
56944
|
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
|
56914
56945
|
|
|
56915
|
-
//# debugId=
|
|
56946
|
+
//# debugId=97D4C2DBC51BC61964756E2164756E21
|