cursor-mcp-feedback 2.0.4 → 2.0.6

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.
@@ -1,12 +1,11 @@
1
1
  #!/usr/bin/env node
2
- // Cursor hook: session lifecycle + subagent protection.
2
+ // Cursor hook: subagent protection + feedback event logging.
3
3
  //
4
4
  // Events (argv[2]):
5
- // sessionStart create per-session directory & meta
6
- // sessionEnd mark session inactive
7
- // subagentStart record subagent to negative list
8
- // subagentStop remove subagent
9
- // beforeMCPExecution — deny cursor-mcp-feedback calls from subagents
5
+ // subagentStart increment active subagent counter
6
+ // subagentStop decrement active subagent counter
7
+ // beforeMCPExecution deny cursor-mcp-feedback calls when subagents active
8
+ // afterMCPExecution log feedback events to events.jsonl
10
9
 
11
10
  'use strict';
12
11
 
@@ -20,42 +19,11 @@ process.stdin.on('end', () => {
20
19
  let input;
21
20
  try { input = JSON.parse(raw); } catch { input = {}; }
22
21
 
23
- if (event === 'sessionStart') {
24
- su.cleanupStaleSessions();
25
- const convId = input.session_id || input.conversation_id;
26
- if (convId) {
27
- const workspace = (input.workspace_roots || [])[0] || '';
28
- su.createSession(convId, {
29
- workspace,
30
- mode: input.composer_mode || 'agent',
31
- model: input.model || '',
32
- is_background: input.is_background_agent || false,
33
- transcript_path: input.transcript_path || null,
34
- });
35
- }
36
- su.writeHookOutput({});
37
- return;
38
- }
39
-
40
- if (event === 'sessionEnd') {
41
- const convId = input.session_id || input.conversation_id;
42
- if (convId) {
43
- su.endSession(convId, input.reason || 'unknown');
44
- su.resetActiveSubagents(convId);
45
- }
46
- su.writeHookOutput({});
47
- return;
48
- }
49
-
50
22
  if (event === 'subagentStart') {
51
23
  const subagentId = input.subagent_id;
52
24
  const parentConvId = input.parent_conversation_id || input.conversation_id;
53
- if (subagentId) {
54
- su.recordSubagent(subagentId, parentConvId);
55
- }
56
- if (parentConvId) {
57
- su.incrementActiveSubagents(parentConvId);
58
- }
25
+ if (subagentId) su.recordSubagent(subagentId, parentConvId);
26
+ if (parentConvId) su.incrementActiveSubagents(parentConvId);
59
27
  su.writeHookOutput({});
60
28
  return;
61
29
  }
@@ -64,41 +32,11 @@ process.stdin.on('end', () => {
64
32
  const subagentId = input.subagent_id || input.conversation_id;
65
33
  const parentConvId = input.parent_conversation_id || input.conversation_id;
66
34
  if (subagentId) su.removeSubagent(subagentId);
67
- if (parentConvId) {
68
- su.decrementActiveSubagents(parentConvId);
69
- }
35
+ if (parentConvId) su.decrementActiveSubagents(parentConvId);
70
36
  su.writeHookOutput({});
71
37
  return;
72
38
  }
73
39
 
74
- if (event === 'preToolUse') {
75
- const toolName = (input.tool_name || '').toLowerCase();
76
- const isFeedbackTool =
77
- toolName.includes('interactive_feedback') ||
78
- toolName.includes('submit_feedback');
79
-
80
- if (!isFeedbackTool) {
81
- su.writeHookOutput({});
82
- return;
83
- }
84
-
85
- const convId = input.conversation_id;
86
- if (convId && su.hasActiveSubagents(convId)) {
87
- su.writeHookOutput({
88
- permission: 'deny',
89
- user_message: '[Hook] Blocked feedback tool call — subagent(s) active',
90
- agent_message:
91
- 'DENIED by preToolUse hook. ' +
92
- 'cursor-mcp-feedback tools are for the MAIN agent only. ' +
93
- 'Active subagents detected for this conversation. ' +
94
- 'Return your results as text in your final response instead.',
95
- });
96
- } else {
97
- su.writeHookOutput({});
98
- }
99
- return;
100
- }
101
-
102
40
  if (event === 'beforeMCPExecution') {
103
41
  const command = (input.command || '').toLowerCase();
104
42
  const isFeedbackApp =
@@ -114,7 +52,7 @@ process.stdin.on('end', () => {
114
52
  if (convId && su.hasActiveSubagents(convId)) {
115
53
  su.writeHookOutput({
116
54
  permission: 'deny',
117
- user_message: '[Hook] Blocked cursor-mcp-feedback call — subagent(s) active',
55
+ user_message: '[Hook] Blocked cursor-mcp-feedback — subagent(s) active',
118
56
  agent_message:
119
57
  'DENIED by beforeMCPExecution hook. ' +
120
58
  'cursor-mcp-feedback tools are for the MAIN agent only. ' +
@@ -137,6 +75,11 @@ process.stdin.on('end', () => {
137
75
 
138
76
  const isFeedback = toolName === 'interactive_feedback' || toolName === 'submit_feedback';
139
77
  if (convId && isFeedback) {
78
+ su.ensureSession(convId, {
79
+ workspace: (input.workspace_roots || [])[0] || '',
80
+ model: input.model || '',
81
+ });
82
+
140
83
  const eventsFile = require('path').join(su.sessionDir(convId), 'events.jsonl');
141
84
  let toolInput = {};
142
85
  try { toolInput = typeof input.tool_input === 'string' ? JSON.parse(input.tool_input) : (input.tool_input || {}); } catch {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cursor-mcp-feedback",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "MCP App for interactive feedback — renders a chat UI directly inside MCP hosts (Claude, Cursor, etc.)",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",