@mcpc-tech/unplugin-dev-inspector-mcp 0.1.28 → 0.1.30

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 (41) hide show
  1. package/client/dist/{PromptParamsDialog-CtCaLYaq.js → PromptParamsDialog-D0TaQM5I.js} +146 -68
  2. package/client/dist/architecture-U656AL7Q-DLZFIEaG.js +1 -0
  3. package/client/dist/{architectureDiagram-VXUJARFQ-mTEFN4g1.js → architectureDiagram-VXUJARFQ-DNc0rX0p.js} +1 -1
  4. package/client/dist/{chunk-76Q3JFCE-naB4GsSN.js → chunk-76Q3JFCE-CAXIRKnn.js} +1 -1
  5. package/client/dist/chunk-FPAJGGOC-BjlYzVzU.js +80 -0
  6. package/client/dist/{chunk-FWNWRKHM-DESdnxaO.js → chunk-FWNWRKHM-VOvXoVoT.js} +1 -1
  7. package/client/dist/{chunk-LBM3YZW2-D1UaPZ0s.js → chunk-LBM3YZW2-CvtIRI2w.js} +1 -1
  8. package/client/dist/{chunk-LHMN2FUI-DvMeDi1w.js → chunk-LHMN2FUI-Ca-4316E.js} +1 -1
  9. package/client/dist/{chunk-O7ZBX7Z2-CzEL6GEY.js → chunk-O7ZBX7Z2-CECReL7o.js} +1 -1
  10. package/client/dist/{chunk-S6J4BHB3-dkKq153Y.js → chunk-S6J4BHB3-BHybUXml.js} +1 -1
  11. package/client/dist/{chunk-T53DSG4Q-m8YxcxT5.js → chunk-T53DSG4Q-7987HmnS.js} +1 -1
  12. package/client/dist/{diagram-PSM6KHXK-BxJGiGPe.js → diagram-PSM6KHXK-DTb9CVoz.js} +1 -1
  13. package/client/dist/{diagram-QEK2KX5R-DYp7ZFqv.js → diagram-QEK2KX5R-B2o1-dFI.js} +1 -1
  14. package/client/dist/{diagram-S2PKOQOG-DJkha_WW.js → diagram-S2PKOQOG-DPPFE3hr.js} +1 -1
  15. package/client/dist/gitGraph-F6HP7TQM-l-NE_Osd.js +1 -0
  16. package/client/dist/{gitGraphDiagram-NY62KEGX-Cr6_VXUM.js → gitGraphDiagram-NY62KEGX-Jp7zkjZT.js} +1 -1
  17. package/client/dist/info-NVLQJR56-EuF5TjLZ.js +1 -0
  18. package/client/dist/{infoDiagram-ER5ION4S-CtrGb0So.js → infoDiagram-ER5ION4S-CXN8mVBL.js} +1 -1
  19. package/client/dist/inspector.js +21 -98
  20. package/client/dist/{mermaid-parser.core-lVkskdol.js → mermaid-parser.core-B4UmuquT.js} +1 -1
  21. package/client/dist/{mermaid.core-DfenwpGd.js → mermaid.core-Bb_NaryS.js} +2 -2
  22. package/client/dist/packet-BFZMPI3H-BeBassQF.js +1 -0
  23. package/client/dist/pie-7BOR55EZ-CaiOg9Y8.js +1 -0
  24. package/client/dist/{pieDiagram-ADFJNKIX-10ENr3pD.js → pieDiagram-ADFJNKIX-C2tbuWJp.js} +1 -1
  25. package/client/dist/radar-NHE76QYJ-Dig7Z189.js +1 -0
  26. package/client/dist/sidebar.js +1 -1
  27. package/client/dist/treemap-KMMF4GRG-CTX-6nPT.js +1 -0
  28. package/dist/cli.cjs +24 -5
  29. package/dist/cli.js +24 -5
  30. package/dist/config-updater.cjs +99 -7
  31. package/dist/config-updater.js +99 -7
  32. package/dist/react/react.js +28 -1
  33. package/package.json +2 -2
  34. package/client/dist/architecture-U656AL7Q-BbnkeEk-.js +0 -1
  35. package/client/dist/chunk-FPAJGGOC-_ax7LrI6.js +0 -81
  36. package/client/dist/gitGraph-F6HP7TQM-KAtjK5Ox.js +0 -1
  37. package/client/dist/info-NVLQJR56-DiZxlu_o.js +0 -1
  38. package/client/dist/packet-BFZMPI3H-Co0kmFAY.js +0 -1
  39. package/client/dist/pie-7BOR55EZ-27A0zi3z.js +0 -1
  40. package/client/dist/radar-NHE76QYJ-BNuOm017.js +0 -1
  41. package/client/dist/treemap-KMMF4GRG-Cs32ogTY.js +0 -1
@@ -171,7 +171,7 @@ var StandaloneServer = class {
171
171
  }
172
172
  async start(options = {}) {
173
173
  const startPort = options.port || getDefaultPort();
174
- this.host = options.host ? "localhost" : "0.0.0.0";
174
+ this.host = typeof options.host === "string" ? options.host : options.host === true ? "0.0.0.0" : "localhost";
175
175
  this.allowedHosts = options.allowedHosts || [];
176
176
  for (let port = startPort; port < startPort + 100; port++) try {
177
177
  await new Promise((resolve$2, reject) => {
@@ -87937,7 +87937,7 @@ function setupInspectorMiddleware(middlewares, config) {
87937
87937
  }
87938
87938
 
87939
87939
  //#endregion
87940
- //#region ../../node_modules/.pnpm/@mcpc-tech+acp-ai-provider@0.1.49/node_modules/@mcpc-tech/acp-ai-provider/index.mjs
87940
+ //#region ../../node_modules/.pnpm/@mcpc-tech+acp-ai-provider@0.1.50/node_modules/@mcpc-tech/acp-ai-provider/index.mjs
87941
87941
  createRequire(import.meta.url);
87942
87942
  function formatToolError(toolResult) {
87943
87943
  if (!toolResult || toolResult.length === 0) return "Unknown tool error";
@@ -88168,10 +88168,21 @@ var ToolProxyHost = class {
88168
88168
  return;
88169
88169
  }
88170
88170
  if (!tool2.execute) {
88171
- this.sendResponse(socket, createErrorResponse(request.id, JsonRpcErrorCode.INTERNAL_ERROR, `Tool has no execute function: ${params.name}`));
88171
+ const clientToolResult = {
88172
+ content: [{
88173
+ type: "text",
88174
+ text: JSON.stringify({
88175
+ isClientTool: true,
88176
+ toolName: params.name,
88177
+ args: params.args
88178
+ })
88179
+ }],
88180
+ isError: false
88181
+ };
88182
+ this.sendResponse(socket, createResponse(request.id, clientToolResult));
88172
88183
  return;
88173
88184
  }
88174
- const result = await tool2.execute?.(params.args, {
88185
+ const result = await tool2.execute(params.args, {
88175
88186
  toolCallId: params.name,
88176
88187
  messages: []
88177
88188
  });
@@ -88213,7 +88224,7 @@ var ToolProxyHost = class {
88213
88224
  var ACP_PROVIDER_AGENT_DYNAMIC_TOOL_NAME = "acp.acp_provider_agent_dynamic_tool";
88214
88225
  var executeRegistry = /* @__PURE__ */ new Map();
88215
88226
  function acpTools(tools) {
88216
- for (const [name, toolDef] of Object.entries(tools)) if (toolDef.execute) executeRegistry.set(name, toolDef.execute);
88227
+ for (const [name, toolDef] of Object.entries(tools)) executeRegistry.set(name, toolDef.execute);
88217
88228
  return {
88218
88229
  ...tools,
88219
88230
  ...getACPDynamicTool()
@@ -88298,7 +88309,7 @@ function extractACPTools(tools, prepared = true) {
88298
88309
  const toolInputSchema = t.inputSchema;
88299
88310
  if (hasRegisteredExecute(t.name) && toolInputSchema) {
88300
88311
  const execute = getExecuteByName(t.name);
88301
- if (execute) acpTools2.push({
88312
+ acpTools2.push({
88302
88313
  ...t,
88303
88314
  name: t.name,
88304
88315
  inputSchema: prepared ? toolInputSchema : asSchema(toolInputSchema).jsonSchema,
@@ -88362,6 +88373,7 @@ var ACPLanguageModel = class {
88362
88373
  currentThinkingId = null;
88363
88374
  toolCallsMap = /* @__PURE__ */ new Map();
88364
88375
  toolProxyHost = null;
88376
+ clientToolAbort = null;
88365
88377
  constructor(modelId, modeId, config) {
88366
88378
  this.modelId = modelId;
88367
88379
  this.modeId = modeId;
@@ -88376,6 +88388,7 @@ var ACPLanguageModel = class {
88376
88388
  this.currentTextId = null;
88377
88389
  this.currentThinkingId = null;
88378
88390
  this.toolCallsMap.clear();
88391
+ this.clientToolAbort = null;
88379
88392
  }
88380
88393
  /**
88381
88394
  * Parses a 'tool_call' notification update into a structured object.
@@ -88404,6 +88417,27 @@ var ACPLanguageModel = class {
88404
88417
  };
88405
88418
  }
88406
88419
  /**
88420
+ * Checks if a tool result is from a client-side tool (no execute function).
88421
+ * Client tools return a special response with `isClientTool: true`.
88422
+ * Handles both MCP format (type: "text") and ACP ToolCallContent format (type: "content").
88423
+ */
88424
+ isClientToolResult(toolResult) {
88425
+ if (!Array.isArray(toolResult) || toolResult.length === 0) return { isClientTool: false };
88426
+ const content = toolResult[0];
88427
+ if (!content?.type) return { isClientTool: false };
88428
+ const textContent$1 = content.type === "text" && typeof content.text === "string" ? content.text : content.type === "content" && content.content?.type === "text" ? content.content.text : void 0;
88429
+ if (!textContent$1) return { isClientTool: false };
88430
+ try {
88431
+ const parsed = JSON.parse(textContent$1);
88432
+ if (parsed.isClientTool === true) return {
88433
+ isClientTool: true,
88434
+ toolName: parsed.toolName,
88435
+ args: parsed.args
88436
+ };
88437
+ } catch {}
88438
+ return { isClientTool: false };
88439
+ }
88440
+ /**
88407
88441
  * Converts AI SDK prompt messages into ACP ContentBlock objects.
88408
88442
  * When session exists, only extracts the last user message (history is in session).
88409
88443
  * Prefixes text with role since ACP ContentBlock has no role field.
@@ -88641,6 +88675,25 @@ var ACPLanguageModel = class {
88641
88675
  });
88642
88676
  }
88643
88677
  /**
88678
+ * Flushes any pending tool calls that haven't emitted tool-call yet.
88679
+ * This handles the case where a tool emits {} first, then the next message is a different type.
88680
+ */
88681
+ flushPendingToolCalls(controller) {
88682
+ for (const [toolCallId, toolInfo] of this.toolCallsMap.entries()) if (!toolInfo.inputAvailable) {
88683
+ toolInfo.inputAvailable = true;
88684
+ controller.enqueue({
88685
+ type: "tool-call",
88686
+ toolCallId,
88687
+ toolName: ACP_PROVIDER_AGENT_DYNAMIC_TOOL_NAME2,
88688
+ input: JSON.stringify({
88689
+ toolCallId,
88690
+ toolName: toolInfo.name,
88691
+ args: {}
88692
+ })
88693
+ });
88694
+ }
88695
+ }
88696
+ /**
88644
88697
  * Standardized handler for converting SessionNotifications into
88645
88698
  * LanguageModelV2StreamPart objects, pushing them onto a stream controller.
88646
88699
  */
@@ -88648,12 +88701,14 @@ var ACPLanguageModel = class {
88648
88701
  const update$1 = notification.update;
88649
88702
  switch (update$1.sessionUpdate) {
88650
88703
  case "plan":
88704
+ this.flushPendingToolCalls(controller);
88651
88705
  this.emitRawContent(controller, {
88652
88706
  type: "plan",
88653
88707
  entries: update$1.entries
88654
88708
  });
88655
88709
  break;
88656
88710
  case "agent_thought_chunk":
88711
+ this.flushPendingToolCalls(controller);
88657
88712
  if (!this.currentThinkingId) {
88658
88713
  this.currentThinkingId = `reasoning - ${this.thinkBlockIndex++} `;
88659
88714
  controller.enqueue({
@@ -88668,6 +88723,7 @@ var ACPLanguageModel = class {
88668
88723
  });
88669
88724
  break;
88670
88725
  case "agent_message_chunk":
88726
+ this.flushPendingToolCalls(controller);
88671
88727
  if (this.currentThinkingId) {
88672
88728
  controller.enqueue({
88673
88729
  type: "reasoning-end",
@@ -88817,6 +88873,30 @@ var ACPLanguageModel = class {
88817
88873
  })
88818
88874
  });
88819
88875
  }
88876
+ const clientToolInfo = this.isClientToolResult(toolResult);
88877
+ if (clientToolInfo.isClientTool) {
88878
+ console.log(`[acp-ai-provider] Detected client tool: ${clientToolInfo.toolName}, stopping stream`);
88879
+ const content2 = update$1.content ?? [];
88880
+ if (content2.length > 0) this.emitRawContent(controller, {
88881
+ content: content2,
88882
+ toolCallId
88883
+ });
88884
+ if (this.clientToolAbort) {
88885
+ controller.enqueue({
88886
+ type: "finish",
88887
+ finishReason: "tool-calls",
88888
+ usage: {
88889
+ inputTokens: void 0,
88890
+ outputTokens: void 0,
88891
+ totalTokens: void 0
88892
+ }
88893
+ });
88894
+ controller.close();
88895
+ this.clientToolAbort.resolve();
88896
+ this.cleanup();
88897
+ }
88898
+ break;
88899
+ }
88820
88900
  controller.enqueue({
88821
88901
  type: "tool-result",
88822
88902
  toolCallId,
@@ -88934,14 +89014,26 @@ var ACPLanguageModel = class {
88934
89014
  warnings: []
88935
89015
  });
88936
89016
  this.resetStreamState();
89017
+ const clientToolPromise = new Promise((resolve$2) => {
89018
+ this.clientToolAbort = {
89019
+ controller,
89020
+ resolve: resolve$2
89021
+ };
89022
+ });
88937
89023
  try {
88938
89024
  if (client) client.setSessionUpdateHandler((notification) => {
88939
89025
  streamHandler(controller, notification);
88940
89026
  });
88941
- const response = await connection.prompt({
89027
+ const promptPromise = connection.prompt({
88942
89028
  sessionId,
88943
89029
  prompt: promptContent
88944
89030
  });
89031
+ const result = await Promise.race([promptPromise.then((response2) => ({
89032
+ type: "response",
89033
+ response: response2
89034
+ })), clientToolPromise.then(() => ({ type: "client-tool" }))]);
89035
+ if (result.type === "client-tool") return;
89036
+ const response = result.response;
88945
89037
  controller.enqueue({
88946
89038
  type: "finish",
88947
89039
  finishReason: response.stopReason === "end_turn" ? "stop" : "other",
@@ -349,6 +349,28 @@ async function getDefaultAgent() {
349
349
  return DEFAULT_AGENT;
350
350
  }
351
351
 
352
+ //#endregion
353
+ //#region client/utils/format.ts
354
+ /**
355
+ * Format element annotations (notes) from primary and related elements
356
+ */
357
+ function formatElementAnnotations(options) {
358
+ const { primaryNote, primaryTag, relatedElements } = options;
359
+ const notes = [];
360
+ if (primaryNote) {
361
+ const tag = primaryTag || "element";
362
+ notes.push(`- **Primary element** (${tag}): ${primaryNote}`);
363
+ }
364
+ if (relatedElements && relatedElements.length > 0) relatedElements.forEach((el, idx) => {
365
+ if (el.note) {
366
+ const tag = el.elementInfo?.tagName?.toLowerCase() || el.component;
367
+ const location = el.file && el.line ? ` at ${el.file}:${el.line}` : "";
368
+ notes.push(`- **Related element #${idx + 1}** (${tag}${location}): ${el.note}`);
369
+ }
370
+ });
371
+ return notes.length > 0 ? `\n**Element Annotations**:\n${notes.join("\n")}\n` : "";
372
+ }
373
+
352
374
  //#endregion
353
375
  //#region client/hooks/useMcp.ts
354
376
  const STORAGE_KEY = "inspector-inspection-items";
@@ -396,6 +418,11 @@ function getAllFeedbacks() {
396
418
  const feedbackList = items.map((item, index) => {
397
419
  const { id, sourceInfo, description, status, progress, result } = item;
398
420
  const statusText = status === "loading" && progress ? `LOADING (${progress.completed}/${progress.total} steps)` : status.toUpperCase();
421
+ const notesSection = formatElementAnnotations({
422
+ primaryNote: sourceInfo.note,
423
+ primaryTag: sourceInfo.elementInfo?.tagName?.toLowerCase() || sourceInfo.component,
424
+ relatedElements: sourceInfo.relatedElements
425
+ });
399
426
  return `## ${index + 1}. Feedback ID: \`${id}\`
400
427
 
401
428
  **Status**: ${statusText}
@@ -405,7 +432,7 @@ function getAllFeedbacks() {
405
432
  ${formatElementInfoSimple(sourceInfo.elementInfo)}
406
433
  **User Request**:
407
434
  ${description}
408
-
435
+ ${notesSection}
409
436
  ${result ? `**Result**: ${result}\n` : ""}---`;
410
437
  }).join("\n\n");
411
438
  const content = [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpc-tech/unplugin-dev-inspector-mcp",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "Universal dev inspector plugin for React/Vue - inspect component sources and API calls in any bundler",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -121,7 +121,7 @@
121
121
  "@babel/parser": "^7.28.5",
122
122
  "@babel/traverse": "^7.28.5",
123
123
  "@code-inspector/core": "^1.3.0",
124
- "@mcpc-tech/acp-ai-provider": "^0.1.49",
124
+ "@mcpc-tech/acp-ai-provider": "^0.1.50",
125
125
  "@mcpc-tech/cmcp": "^0.0.15",
126
126
  "@mcpc-tech/core": "^0.3.8",
127
127
  "@modelcontextprotocol/sdk": "^1.20.1",
@@ -1 +0,0 @@
1
- import"./chunk-FPAJGGOC-_ax7LrI6.js";import{n as e,t}from"./chunk-O7ZBX7Z2-CzEL6GEY.js";export{e as createArchitectureServices};