@mgsoftwarebv/mg-dashboard-mcp 7.0.17 → 7.0.19

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 CHANGED
@@ -6204,55 +6204,43 @@ 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
- const model = args2.model ?? null;
6211
- const metadata = args2.metadata ?? {};
6210
+ const handoffPrompt = args2.prompt.trim().slice(0, HANDOFF_PROMPT_CHARS);
6211
+ const metadata = { ...args2.metadata ?? {}, source: args2.source };
6212
+ await db2.execute(sql`
6213
+ INSERT INTO agent_host_command (host_id, user_id, command_type, payload)
6214
+ VALUES (
6215
+ ${args2.workspace.host_id}, ${args2.userId}, 'open_chat_in_ide',
6216
+ ${JSON.stringify({
6217
+ workspacePath: args2.workspace.path,
6218
+ prompt: handoffPrompt
6219
+ })}::jsonb
6220
+ )
6221
+ `);
6212
6222
  const conversationRows = await db2.execute(sql`
6213
6223
  INSERT INTO agent_conversation (
6214
- user_id, host_id, workspace_id, runtime, source, title, status, model, metadata
6224
+ user_id, host_id, workspace_id, runtime, source,
6225
+ local_conversation_id, title, status, model, last_message_at, metadata
6215
6226
  ) VALUES (
6216
- ${args2.userId}, ${args2.workspace.host_id}, ${args2.workspace.id},
6217
- 'local', ${args2.source}, ${args2.title}, 'running', ${model},
6227
+ ${args2.userId}, ${args2.workspace.host_id}, ${args2.workspace.id}, 'ide',
6228
+ 'ide_import', NULL, ${args2.title}, 'idle', NULL, now(),
6218
6229
  ${JSON.stringify(metadata)}::jsonb
6219
6230
  )
6220
6231
  RETURNING id
6221
6232
  `);
6222
6233
  const conversationId = conversationRows[0]?.id;
6223
6234
  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
6235
  await db2.execute(sql`
6249
- INSERT INTO agent_host_command (host_id, user_id, run_id, command_type, payload)
6250
- VALUES (
6251
- ${args2.workspace.host_id}, ${args2.userId}, ${runId}, 'start_run',
6252
- ${JSON.stringify(payload)}::jsonb
6236
+ INSERT INTO agent_message (
6237
+ conversation_id, user_id, role, content, blocks, is_streaming, local_created_at
6238
+ ) VALUES (
6239
+ ${conversationId}, ${args2.userId}, 'user', ${handoffPrompt},
6240
+ '[]'::jsonb, false, now()
6253
6241
  )
6254
6242
  `);
6255
- return { conversationId, runId };
6243
+ return { conversationId };
6256
6244
  }
6257
6245
  function toTarget(row) {
6258
6246
  return {
@@ -10356,7 +10344,7 @@ var TOOLS = [
10356
10344
  // ----- Cursor Remote (Agent Control) -----
10357
10345
  {
10358
10346
  name: "cursor-remote-list",
10359
- description: "List the paired developer machines (agent hosts) and their workspaces that a headless Cursor agent run can be started on, across the whole team. Each workspace shows its owner, git repository + branch, online status and default git mode. Call this FIRST to discover valid `who` (owner) and `project` (repo/workspace) values before calling cursor-remote-run. Only online hosts can run.",
10347
+ 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
10348
  inputSchema: {
10361
10349
  type: "object",
10362
10350
  properties: {
@@ -10369,7 +10357,7 @@ var TOOLS = [
10369
10357
  },
10370
10358
  {
10371
10359
  name: "cursor-remote-run",
10372
- description: "Start a headless Cursor agent run on a teammate's machine to make a code change. Resolve `who` (workspace owner name/email) + `project` (repo 'org/repo', URL, or workspace name) to a single online workspace, then queue the run via the agent-host daemon (@cursor/sdk). Use this when an AI (e.g. a ticket assistant) should hand a self-contained, well-scoped fix prompt to a developer's PC. Default git mode is 'worktree': the change runs in an isolated worktree and ends in a DIFF APPROVAL the owner reviews on the dashboard/mobile \u2014 nothing lands on their branch automatically. Returns the conversationId + runId and a dashboard link to follow progress. Call cursor-remote-list first if unsure about who/project.",
10360
+ 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. The chat runs on the developer's default Cursor model (no model override). Returns the conversationId and a dashboard link to follow the chat. Call cursor-remote-list first if unsure about who/project.",
10373
10361
  inputSchema: {
10374
10362
  type: "object",
10375
10363
  properties: {
@@ -10385,15 +10373,6 @@ var TOOLS = [
10385
10373
  type: "string",
10386
10374
  description: "The full, self-contained instruction for the agent. Write it as an optimized, scoped task: what to change, relevant files/areas, and acceptance criteria. The agent has no other context."
10387
10375
  },
10388
- model: {
10389
- type: "string",
10390
- description: "Optional Cursor model slug to run with (e.g. a Sonnet-tier model). Omit to use the host default."
10391
- },
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
10376
  branch: {
10398
10377
  type: "string",
10399
10378
  description: "Optional: prefer a workspace already checked out on this branch when several match."
@@ -10660,7 +10639,6 @@ ${facets.join(", ")}` : ""),
10660
10639
  project: w.name,
10661
10640
  repo: w.gitRepository,
10662
10641
  branch: w.gitBranch,
10663
- defaultGitMode: w.defaultGitMode,
10664
10642
  path: w.path,
10665
10643
  lastSyncedAt: w.lastSyncedAt
10666
10644
  }));
@@ -10693,8 +10671,6 @@ ${facets.join(", ")}` : ""),
10693
10671
  }
10694
10672
  const who = typeof a.who === "string" ? a.who.trim() : null;
10695
10673
  const branch = typeof a.branch === "string" ? a.branch.trim() : null;
10696
- const model = typeof a.model === "string" ? a.model.trim() : null;
10697
- const gitMode = a.gitMode === "in_place" ? "in_place" : "worktree";
10698
10674
  const resolution = await resolveRemoteTarget({ who, project, branch });
10699
10675
  if (!resolution.ok) {
10700
10676
  const describe = (c) => ` - ${c.ownerName ?? c.ownerEmail ?? c.ownerUserId} \xB7 ${c.name}${c.gitRepository ? ` (${c.gitRepository}${c.gitBranch ? `@${c.gitBranch}` : ""})` : ""}`;
@@ -10724,8 +10700,6 @@ ${candidates || " (none online \u2014 start the MG Agent Host)"}`
10724
10700
  prompt,
10725
10701
  title,
10726
10702
  source: "mcp_remote",
10727
- model,
10728
- gitMode,
10729
10703
  metadata: {
10730
10704
  requestedBy: ctx.userId,
10731
10705
  who: who ?? null,
@@ -10734,7 +10708,7 @@ ${candidates || " (none online \u2014 start the MG Agent Host)"}`
10734
10708
  });
10735
10709
  if (!queued) {
10736
10710
  return {
10737
- content: [{ type: "text", text: "Error: failed to queue the agent run" }]
10711
+ content: [{ type: "text", text: "Error: failed to open the IDE chat" }]
10738
10712
  };
10739
10713
  }
10740
10714
  const conversationUrl = `${dashboardBaseUrl}/cursor-remote?conversation=${queued.conversationId}`;
@@ -10744,17 +10718,15 @@ ${candidates || " (none online \u2014 start the MG Agent Host)"}`
10744
10718
  type: "text",
10745
10719
  text: JSON.stringify(
10746
10720
  {
10747
- status: "queued",
10721
+ status: "opened",
10748
10722
  owner: target.ownerName ?? target.ownerEmail ?? target.ownerUserId,
10749
10723
  host: target.hostName,
10750
10724
  project: target.name,
10751
10725
  repo: target.gitRepository,
10752
10726
  branch: target.gitBranch,
10753
- gitMode,
10754
10727
  conversationId: queued.conversationId,
10755
- runId: queued.runId,
10756
10728
  conversationUrl,
10757
- note: gitMode === "worktree" ? "Runs in an isolated worktree and ends in a diff approval the owner reviews \u2014 nothing lands on their branch automatically." : "Runs in_place in the working tree (no isolation)."
10729
+ 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
10730
  },
10759
10731
  null,
10760
10732
  2