@dalmasonto/taskflow-mcp 1.0.14 → 1.0.15
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/sse.js +14 -5
- package/dist/tools/terminal.js +18 -5
- package/package.json +1 -1
package/dist/sse.js
CHANGED
|
@@ -394,17 +394,26 @@ export async function startSSEServer() {
|
|
|
394
394
|
}
|
|
395
395
|
const keys = body.keys;
|
|
396
396
|
const enter = body.enter !== false; // default: send Enter after keys
|
|
397
|
+
const literal = body.literal !== false; // default: send as literal text
|
|
397
398
|
if (typeof keys !== 'string') {
|
|
398
399
|
jsonResponse(res, 400, { error: 'keys must be a string' });
|
|
399
400
|
return;
|
|
400
401
|
}
|
|
401
402
|
try {
|
|
402
|
-
const
|
|
403
|
-
if (
|
|
404
|
-
|
|
405
|
-
|
|
403
|
+
const pane = agent.tmux_pane;
|
|
404
|
+
if (literal) {
|
|
405
|
+
execFileSync('tmux', ['send-keys', '-t', pane, '-l', keys], { stdio: 'ignore', timeout: 5000 });
|
|
406
|
+
if (enter)
|
|
407
|
+
execFileSync('tmux', ['send-keys', '-t', pane, 'Enter'], { stdio: 'ignore', timeout: 5000 });
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
const args = ['send-keys', '-t', pane, keys];
|
|
411
|
+
if (enter)
|
|
412
|
+
args.push('Enter');
|
|
413
|
+
execFileSync('tmux', args, { stdio: 'ignore', timeout: 5000 });
|
|
414
|
+
}
|
|
406
415
|
logActivity('terminal_send_keys', `Sent keys to ${agentName}: ${keys.slice(0, 50)}`, { entityType: 'agent' });
|
|
407
|
-
jsonResponse(res, 200, { agent: agentName, pane: agent.tmux_pane, keys, enter, sent: true });
|
|
416
|
+
jsonResponse(res, 200, { agent: agentName, pane: agent.tmux_pane, keys, enter, literal, sent: true });
|
|
408
417
|
}
|
|
409
418
|
catch (err) {
|
|
410
419
|
jsonResponse(res, 500, { error: `Failed to send keys: ${err.message}` });
|
package/dist/tools/terminal.js
CHANGED
|
@@ -32,18 +32,31 @@ export function registerTerminalTools(server) {
|
|
|
32
32
|
});
|
|
33
33
|
server.tool('send_keys', 'Send raw keystrokes to an agent\'s tmux pane. Use this to respond to interactive prompts (yes/no, numbered choices, permission approvals) displayed in an agent\'s terminal. By default appends Enter after the keys.', {
|
|
34
34
|
agent_name: z.string().describe('Name of the agent whose terminal to send keys to'),
|
|
35
|
-
keys: z.string().describe('The keys/text to send (e.g. "yes", "1", "y")'),
|
|
35
|
+
keys: z.string().describe('The keys/text to send (e.g. "yes", "1", "y") or tmux key names (e.g. "Escape", "Up", "Down", "BTab")'),
|
|
36
36
|
enter: z.boolean().optional().describe('Whether to press Enter after the keys (default: true)'),
|
|
37
|
+
literal: z.boolean().optional().describe('Send as literal text with -l flag (default: true). Set false for tmux key names like Escape, Up, Down, Left, Right, BTab'),
|
|
37
38
|
}, { destructiveHint: true }, async (params) => {
|
|
38
39
|
const result = getAgentPane(params.agent_name);
|
|
39
40
|
if (result.error)
|
|
40
41
|
return result.error;
|
|
41
42
|
const sendEnter = params.enter !== false;
|
|
43
|
+
const isLiteral = params.literal !== false;
|
|
42
44
|
try {
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const pane = result.agent.tmux_pane;
|
|
46
|
+
if (isLiteral) {
|
|
47
|
+
// Send as literal text (like typing on a keyboard)
|
|
48
|
+
execFileSync('tmux', ['send-keys', '-t', pane, '-l', params.keys], { stdio: 'ignore', timeout: 5000 });
|
|
49
|
+
if (sendEnter) {
|
|
50
|
+
execFileSync('tmux', ['send-keys', '-t', pane, 'Enter'], { stdio: 'ignore', timeout: 5000 });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
// Send as tmux key names (Escape, Up, Down, etc.)
|
|
55
|
+
const args = ['send-keys', '-t', pane, params.keys];
|
|
56
|
+
if (sendEnter)
|
|
57
|
+
args.push('Enter');
|
|
58
|
+
execFileSync('tmux', args, { stdio: 'ignore', timeout: 5000 });
|
|
59
|
+
}
|
|
47
60
|
logActivity('terminal_send_keys', `Sent keys to ${params.agent_name}: ${params.keys.slice(0, 50)}`, { entityType: 'agent' });
|
|
48
61
|
return successResponse({
|
|
49
62
|
agent: params.agent_name,
|