@mgsoftwarebv/mg-dashboard-mcp 7.0.17 → 7.0.18
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/index.js +29 -49
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6204,55 +6204,45 @@ function normalizeRepoIdentifier(value) {
|
|
|
6204
6204
|
}
|
|
6205
6205
|
return s || null;
|
|
6206
6206
|
}
|
|
6207
|
+
var HANDOFF_PROMPT_CHARS = 4e3;
|
|
6207
6208
|
async function queueAgentRun(args2) {
|
|
6208
6209
|
const db2 = getDb();
|
|
6209
|
-
const gitMode = args2.gitMode ?? "worktree";
|
|
6210
6210
|
const model = args2.model ?? null;
|
|
6211
|
-
const
|
|
6211
|
+
const handoffPrompt = args2.prompt.trim().slice(0, HANDOFF_PROMPT_CHARS);
|
|
6212
|
+
const metadata = { ...args2.metadata ?? {}, source: args2.source };
|
|
6213
|
+
await db2.execute(sql`
|
|
6214
|
+
INSERT INTO agent_host_command (host_id, user_id, command_type, payload)
|
|
6215
|
+
VALUES (
|
|
6216
|
+
${args2.workspace.host_id}, ${args2.userId}, 'open_chat_in_ide',
|
|
6217
|
+
${JSON.stringify({
|
|
6218
|
+
workspacePath: args2.workspace.path,
|
|
6219
|
+
prompt: handoffPrompt,
|
|
6220
|
+
model
|
|
6221
|
+
})}::jsonb
|
|
6222
|
+
)
|
|
6223
|
+
`);
|
|
6212
6224
|
const conversationRows = await db2.execute(sql`
|
|
6213
6225
|
INSERT INTO agent_conversation (
|
|
6214
|
-
user_id, host_id, workspace_id, runtime, source,
|
|
6226
|
+
user_id, host_id, workspace_id, runtime, source,
|
|
6227
|
+
local_conversation_id, title, status, model, last_message_at, metadata
|
|
6215
6228
|
) VALUES (
|
|
6216
|
-
${args2.userId}, ${args2.workspace.host_id}, ${args2.workspace.id},
|
|
6217
|
-
'
|
|
6229
|
+
${args2.userId}, ${args2.workspace.host_id}, ${args2.workspace.id}, 'ide',
|
|
6230
|
+
'ide_import', NULL, ${args2.title}, 'idle', ${model}, now(),
|
|
6218
6231
|
${JSON.stringify(metadata)}::jsonb
|
|
6219
6232
|
)
|
|
6220
6233
|
RETURNING id
|
|
6221
6234
|
`);
|
|
6222
6235
|
const conversationId = conversationRows[0]?.id;
|
|
6223
6236
|
if (!conversationId) return null;
|
|
6224
|
-
const runRows = await db2.execute(sql`
|
|
6225
|
-
INSERT INTO agent_run (
|
|
6226
|
-
conversation_id, workspace_id, host_id, user_id, runtime, status,
|
|
6227
|
-
prompt, model, git_mode, source
|
|
6228
|
-
) VALUES (
|
|
6229
|
-
${conversationId}, ${args2.workspace.id}, ${args2.workspace.host_id},
|
|
6230
|
-
${args2.userId}, 'local', 'queued', ${args2.prompt}, ${model}, ${gitMode},
|
|
6231
|
-
${args2.source}
|
|
6232
|
-
)
|
|
6233
|
-
RETURNING id
|
|
6234
|
-
`);
|
|
6235
|
-
const runId = runRows[0]?.id;
|
|
6236
|
-
if (!runId) return null;
|
|
6237
|
-
const payload = {
|
|
6238
|
-
runId,
|
|
6239
|
-
conversationId,
|
|
6240
|
-
workspacePath: args2.workspace.path,
|
|
6241
|
-
prompt: args2.prompt,
|
|
6242
|
-
model,
|
|
6243
|
-
gitMode,
|
|
6244
|
-
sdkAgentId: null,
|
|
6245
|
-
contextReplay: null,
|
|
6246
|
-
...metadata
|
|
6247
|
-
};
|
|
6248
6237
|
await db2.execute(sql`
|
|
6249
|
-
INSERT INTO
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
${
|
|
6238
|
+
INSERT INTO agent_message (
|
|
6239
|
+
conversation_id, user_id, role, content, blocks, is_streaming, local_created_at
|
|
6240
|
+
) VALUES (
|
|
6241
|
+
${conversationId}, ${args2.userId}, 'user', ${handoffPrompt},
|
|
6242
|
+
'[]'::jsonb, false, now()
|
|
6253
6243
|
)
|
|
6254
6244
|
`);
|
|
6255
|
-
return { conversationId
|
|
6245
|
+
return { conversationId };
|
|
6256
6246
|
}
|
|
6257
6247
|
function toTarget(row) {
|
|
6258
6248
|
return {
|
|
@@ -10356,7 +10346,7 @@ var TOOLS = [
|
|
|
10356
10346
|
// ----- Cursor Remote (Agent Control) -----
|
|
10357
10347
|
{
|
|
10358
10348
|
name: "cursor-remote-list",
|
|
10359
|
-
description: "List the paired developer machines (agent hosts) and their workspaces that a
|
|
10349
|
+
description: "List the paired developer machines (agent hosts) and their workspaces that a Cursor agent chat can be opened on, across the whole team. Each workspace shows its owner, git repository + branch and online status. Call this FIRST to discover valid `who` (owner) and `project` (repo/workspace) values before calling cursor-remote-run. Only online hosts can be targeted.",
|
|
10360
10350
|
inputSchema: {
|
|
10361
10351
|
type: "object",
|
|
10362
10352
|
properties: {
|
|
@@ -10369,7 +10359,7 @@ var TOOLS = [
|
|
|
10369
10359
|
},
|
|
10370
10360
|
{
|
|
10371
10361
|
name: "cursor-remote-run",
|
|
10372
|
-
description: "
|
|
10362
|
+
description: "Open a Cursor agent chat in a teammate's real IDE to make a code change. Resolve `who` (workspace owner name/email or machine name) + `project` (repo 'org/repo', URL, or workspace name) to a single online workspace, then hand off via the agent-host daemon: it opens that workspace's Cursor window, prefills the prompt and auto-submits it, so the developer sees the agent working live in their IDE. Use this when an AI (e.g. a ticket assistant) should hand a self-contained, well-scoped fix prompt to a developer's PC. There is no headless run and no diff-approval step \u2014 the developer reviews and commits in the IDE itself. Returns the conversationId and a dashboard link to follow the chat. Call cursor-remote-list first if unsure about who/project.",
|
|
10373
10363
|
inputSchema: {
|
|
10374
10364
|
type: "object",
|
|
10375
10365
|
properties: {
|
|
@@ -10389,11 +10379,6 @@ var TOOLS = [
|
|
|
10389
10379
|
type: "string",
|
|
10390
10380
|
description: "Optional Cursor model slug to run with (e.g. a Sonnet-tier model). Omit to use the host default."
|
|
10391
10381
|
},
|
|
10392
|
-
gitMode: {
|
|
10393
|
-
type: "string",
|
|
10394
|
-
enum: ["worktree", "in_place"],
|
|
10395
|
-
description: "'worktree' (default, recommended): isolated worktree + diff approval. 'in_place': applies directly in the working tree (no isolation) \u2014 use only when explicitly desired."
|
|
10396
|
-
},
|
|
10397
10382
|
branch: {
|
|
10398
10383
|
type: "string",
|
|
10399
10384
|
description: "Optional: prefer a workspace already checked out on this branch when several match."
|
|
@@ -10660,7 +10645,6 @@ ${facets.join(", ")}` : ""),
|
|
|
10660
10645
|
project: w.name,
|
|
10661
10646
|
repo: w.gitRepository,
|
|
10662
10647
|
branch: w.gitBranch,
|
|
10663
|
-
defaultGitMode: w.defaultGitMode,
|
|
10664
10648
|
path: w.path,
|
|
10665
10649
|
lastSyncedAt: w.lastSyncedAt
|
|
10666
10650
|
}));
|
|
@@ -10694,7 +10678,6 @@ ${facets.join(", ")}` : ""),
|
|
|
10694
10678
|
const who = typeof a.who === "string" ? a.who.trim() : null;
|
|
10695
10679
|
const branch = typeof a.branch === "string" ? a.branch.trim() : null;
|
|
10696
10680
|
const model = typeof a.model === "string" ? a.model.trim() : null;
|
|
10697
|
-
const gitMode = a.gitMode === "in_place" ? "in_place" : "worktree";
|
|
10698
10681
|
const resolution = await resolveRemoteTarget({ who, project, branch });
|
|
10699
10682
|
if (!resolution.ok) {
|
|
10700
10683
|
const describe = (c) => ` - ${c.ownerName ?? c.ownerEmail ?? c.ownerUserId} \xB7 ${c.name}${c.gitRepository ? ` (${c.gitRepository}${c.gitBranch ? `@${c.gitBranch}` : ""})` : ""}`;
|
|
@@ -10725,7 +10708,6 @@ ${candidates || " (none online \u2014 start the MG Agent Host)"}`
|
|
|
10725
10708
|
title,
|
|
10726
10709
|
source: "mcp_remote",
|
|
10727
10710
|
model,
|
|
10728
|
-
gitMode,
|
|
10729
10711
|
metadata: {
|
|
10730
10712
|
requestedBy: ctx.userId,
|
|
10731
10713
|
who: who ?? null,
|
|
@@ -10734,7 +10716,7 @@ ${candidates || " (none online \u2014 start the MG Agent Host)"}`
|
|
|
10734
10716
|
});
|
|
10735
10717
|
if (!queued) {
|
|
10736
10718
|
return {
|
|
10737
|
-
content: [{ type: "text", text: "Error: failed to
|
|
10719
|
+
content: [{ type: "text", text: "Error: failed to open the IDE chat" }]
|
|
10738
10720
|
};
|
|
10739
10721
|
}
|
|
10740
10722
|
const conversationUrl = `${dashboardBaseUrl}/cursor-remote?conversation=${queued.conversationId}`;
|
|
@@ -10744,17 +10726,15 @@ ${candidates || " (none online \u2014 start the MG Agent Host)"}`
|
|
|
10744
10726
|
type: "text",
|
|
10745
10727
|
text: JSON.stringify(
|
|
10746
10728
|
{
|
|
10747
|
-
status: "
|
|
10729
|
+
status: "opened",
|
|
10748
10730
|
owner: target.ownerName ?? target.ownerEmail ?? target.ownerUserId,
|
|
10749
10731
|
host: target.hostName,
|
|
10750
10732
|
project: target.name,
|
|
10751
10733
|
repo: target.gitRepository,
|
|
10752
10734
|
branch: target.gitBranch,
|
|
10753
|
-
gitMode,
|
|
10754
10735
|
conversationId: queued.conversationId,
|
|
10755
|
-
runId: queued.runId,
|
|
10756
10736
|
conversationUrl,
|
|
10757
|
-
note:
|
|
10737
|
+
note: "Opens the workspace's real Cursor IDE, prefills the prompt and auto-submits it. The developer sees the agent working live and reviews/commits in the IDE \u2014 no diff approval step."
|
|
10758
10738
|
},
|
|
10759
10739
|
null,
|
|
10760
10740
|
2
|