mcp-feedback-enhanced 1.2.7 → 1.2.9

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 (2) hide show
  1. package/dist/index.js +9 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -235,5 +235,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
235
235
  }
236
236
  </script>
237
237
  </body>
238
- </html>`}async function mv(t,e,r){return new Promise((n,o)=>{let s=uv.createServer();s.listen(0,"127.0.0.1",()=>{let i=s.address();if(!i||typeof i=="string"){o(new Error("Failed to start HTTP server"));return}let a=i.port;j(`Browser feedback server started on port ${a}`);let c=!1;s.on("request",(d,h)=>{if(d.method==="GET"&&d.url==="/")h.writeHead(200,{"Content-Type":"text/html"}),h.end(_1(e,a));else if(d.method==="POST"&&d.url==="/submit"){let m="";d.on("data",f=>m+=f),d.on("end",()=>{try{let f=JSON.parse(m);c=!0,clearTimeout(l),h.writeHead(200,{"Content-Type":"application/json"}),h.end(JSON.stringify({success:!0})),setTimeout(()=>{s.close(),n({feedback:f.feedback||"",images:[]})},1e3)}catch{h.writeHead(400),h.end("Invalid request")}})}else h.writeHead(404),h.end("Not found")});let u=`http://127.0.0.1:${a}`;j(`Opening browser: ${u}`),g1(u);let l=setTimeout(()=>{c||(s.close(),o(new Error(`Browser feedback timeout after ${r} seconds`)))},r*1e3);s.on("close",()=>{clearTimeout(l)})}),s.on("error",i=>{o(new Error(`Failed to start browser feedback server: ${i.message}`))})})}var na=new Ai({name:"mcp-feedback-enhanced",version:lv});na.tool("interactive_feedback","Collect feedback from user through VSCode extension panel. The feedback panel will display the AI summary and wait for user input.",{project_directory:rs().describe("The project directory path for context"),summary:rs().describe("Summary of AI work completed for user review"),timeout:hf().optional().default(86400).describe("Timeout in seconds (default: 86400 = 24 hours)"),agent_name:rs().optional().describe('Unique identifier for this agent/chat session. You MUST provide this parameter with your current conversation/chat title or a short descriptive name of the task (e.g. "Chat 1", "Pre-credit Implementation", "Bug Fix #123"). If not provided, defaults to "Agent" and all messages will appear in the same tab. Providing a unique name allows multiple agents to have separate conversation tabs.')},async({project_directory:t,summary:e,timeout:r,agent_name:n})=>{j(`interactive_feedback called: project=${t}, agent=${n||"default"}`);let o=r||86400,s;try{s=await m1(t,e,o,n)}catch(a){j(`Panel feedback failed: ${a.message}, falling back to browser`);try{s=await mv(t,e,o)}catch(c){return j(`Browser fallback also failed: ${c.message}`),{content:[{type:"text",text:`Error: Both panel and browser feedback failed. Panel: ${a.message}. Browser: ${c.message}`}],isError:!0}}}let i=[{type:"text",text:`User Feedback:
238
+ </html>`}async function mv(t,e,r){return new Promise((n,o)=>{let s=uv.createServer();s.listen(0,"127.0.0.1",()=>{let i=s.address();if(!i||typeof i=="string"){o(new Error("Failed to start HTTP server"));return}let a=i.port;j(`Browser feedback server started on port ${a}`);let c=!1;s.on("request",(d,h)=>{if(d.method==="GET"&&d.url==="/")h.writeHead(200,{"Content-Type":"text/html"}),h.end(_1(e,a));else if(d.method==="POST"&&d.url==="/submit"){let m="";d.on("data",f=>m+=f),d.on("end",()=>{try{let f=JSON.parse(m);c=!0,clearTimeout(l),h.writeHead(200,{"Content-Type":"application/json"}),h.end(JSON.stringify({success:!0})),setTimeout(()=>{s.close(),n({feedback:f.feedback||"",images:[]})},1e3)}catch{h.writeHead(400),h.end("Invalid request")}})}else h.writeHead(404),h.end("Not found")});let u=`http://127.0.0.1:${a}`;j(`Opening browser: ${u}`),g1(u);let l=setTimeout(()=>{c||(s.close(),o(new Error(`Browser feedback timeout after ${r} seconds`)))},r*1e3);s.on("close",()=>{clearTimeout(l)})}),s.on("error",i=>{o(new Error(`Failed to start browser feedback server: ${i.message}`))})})}var na=new Ai({name:"mcp-feedback-enhanced",version:lv});na.tool("interactive_feedback",`Interactive feedback collection tool for AI agents.
239
+
240
+ USAGE RULES (you MUST follow these):
241
+ 1. During any process, task, or conversation, whether asking, replying, or completing phased tasks, you MUST call this tool to collect user feedback.
242
+ 2. Unless receiving explicit termination instructions (e.g. "end", "stop", "done", "no more"), you MUST repeatedly call this tool after every step.
243
+ 3. Whenever user feedback is received and the feedback content is not empty, you MUST call this tool again after adjusting behavior based on the feedback.
244
+ 4. Only when the user explicitly indicates "end" or "no more interaction needed" can you stop calling this tool.
245
+ 5. You MUST summarize what you have done in the summary parameter, and provide the correct project_directory so the user knows the context.
246
+ 6. NEVER end your turn without calling this tool first. If you are about to finish, call this tool to confirm with the user.`,{project_directory:rs().describe("The project directory path for context"),summary:rs().describe("Summary of AI work completed for user review"),timeout:hf().optional().default(86400).describe("Timeout in seconds (default: 86400 = 24 hours)"),agent_name:rs().optional().describe('Unique identifier for this agent/chat session. You MUST provide this parameter with your current conversation/chat title or a short descriptive name of the task (e.g. "Chat 1", "Pre-credit Implementation", "Bug Fix #123"). If not provided, defaults to "Agent" and all messages will appear in the same tab. Providing a unique name allows multiple agents to have separate conversation tabs.')},async({project_directory:t,summary:e,timeout:r,agent_name:n})=>{j(`interactive_feedback called: project=${t}, agent=${n||"default"}`);let o=r||86400,s;try{s=await m1(t,e,o,n)}catch(a){j(`Panel feedback failed: ${a.message}, falling back to browser`);try{s=await mv(t,e,o)}catch(c){return j(`Browser fallback also failed: ${c.message}`),{content:[{type:"text",text:`Error: Both panel and browser feedback failed. Panel: ${a.message}. Browser: ${c.message}`}],isError:!0}}}let i=[{type:"text",text:`User Feedback:
239
247
  ${s.feedback}`}];if(s.images&&s.images.length>0){j(`Processing ${s.images.length} image(s)`);for(let a of s.images)a&&a.data&&(i.push({type:"image",data:a.data,mimeType:"image/png"}),j(`Added image: ${a.name||"unnamed"}`))}return{content:i}});na.tool("get_system_info","Get system environment information",{},async()=>{let t={platform:Tt.platform(),hostname:Tt.hostname(),user:Tt.userInfo().username,homeDir:Tt.homedir(),nodeVersion:process.version,pid:process.pid,parentPid:process.ppid,extensionConnected:Vt};return{content:[{type:"text",text:JSON.stringify(t,null,2)}]}});na.resource("pending","feedback://pending",async t=>{let e=process.cwd();j(`Reading resource feedback://pending for project: ${e}`);try{let r=await h1(e);return{contents:[{uri:t.href,mimeType:"text/plain",text:r||"No pending comment."}]}}catch(r){return{contents:[{uri:t.href,mimeType:"text/plain",text:`Error fetching pending comment: ${r.message}`}],isError:!0}}});async function y1(){if(j("MCP Feedback Server starting..."),j(`PID: ${process.pid}, Parent PID: ${process.ppid}`),j(`Version: ${lv}`),dv){console.error("[MCP Feedback] Environment:"),Object.keys(process.env).filter(r=>r.includes("CURSOR")||r.includes("VSCODE")||r.includes("MCP")).forEach(r=>console.error(` ${r}=${process.env[r]}`));let e=u1();console.error(`[MCP Feedback] Available servers: ${e.length}`),e.forEach(r=>{console.error(` - port=${r.port}, workspaces=${r.workspaces?.join(", ")}`)})}let t=new qi;await na.connect(t),j("MCP Server running on stdio, will connect to Extension on first feedback request"),setInterval(()=>{Te?.readyState===ea.OPEN&&Te.send(JSON.stringify({type:"ping"}))},n1)}y1().catch(t=>{console.error("Fatal error:",t),process.exit(1)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-feedback-enhanced",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "description": "MCP Feedback Enhanced Server - Interactive feedback collection for AI assistants",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",