@dalmasonto/taskflow-mcp 1.0.9 → 1.0.10
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/agent-registry.js +7 -2
- package/dist/sse.js +1 -1
- package/dist/tmux-bridge.js +5 -3
- package/dist/tools/agent-inbox.js +1 -1
- package/package.json +1 -1
package/dist/agent-registry.js
CHANGED
|
@@ -47,14 +47,19 @@ export function registerAgent(options) {
|
|
|
47
47
|
const agentPid = process.ppid;
|
|
48
48
|
const projectPath = process.cwd();
|
|
49
49
|
const folderName = projectPath.split('/').pop() || 'unknown';
|
|
50
|
-
// Check if this PID already has a registration — reuse it
|
|
50
|
+
// Check if this PID already has a registration — reuse it (or rename if customName provided)
|
|
51
51
|
const existingByPid = db.prepare('SELECT * FROM agent_registry WHERE pid = ? AND status = ?').get(agentPid, 'connected');
|
|
52
52
|
if (existingByPid) {
|
|
53
|
-
// Update tmux pane in case it changed, but keep the same name
|
|
54
53
|
const tmuxPane = detectTmuxPane(agentPid);
|
|
55
54
|
if (tmuxPane !== existingByPid.tmux_pane) {
|
|
56
55
|
db.prepare('UPDATE agent_registry SET tmux_pane = ? WHERE id = ?').run(tmuxPane, existingByPid.id);
|
|
57
56
|
}
|
|
57
|
+
// Allow renaming via customName
|
|
58
|
+
if (options?.customName && options.customName !== existingByPid.name) {
|
|
59
|
+
db.prepare('UPDATE agent_registry SET name = ? WHERE id = ?').run(options.customName, existingByPid.id);
|
|
60
|
+
broadcast('agent_connected', { entity: 'agent', action: 'agent_connected', payload: { ...existingByPid, name: options.customName, tmux_pane: tmuxPane ?? existingByPid.tmux_pane } });
|
|
61
|
+
return options.customName;
|
|
62
|
+
}
|
|
58
63
|
return existingByPid.name;
|
|
59
64
|
}
|
|
60
65
|
// Clean up dead agents first to free up names
|
package/dist/sse.js
CHANGED
|
@@ -287,7 +287,7 @@ export async function startSSEServer() {
|
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
289
|
const ts = new Date().toISOString();
|
|
290
|
-
db.prepare('UPDATE agent_messages SET response = ?, status = ?, answered_at =
|
|
290
|
+
db.prepare('UPDATE agent_messages SET response = ?, status = ?, answered_at = ?, delivered = NULL WHERE id = ?')
|
|
291
291
|
.run(response, 'answered', ts, id);
|
|
292
292
|
const updated = db.prepare('SELECT * FROM agent_messages WHERE id = ?').get(id);
|
|
293
293
|
broadcast('agent_question_answered', { entity: 'agent_message', action: 'agent_question_answered', payload: updated });
|
package/dist/tmux-bridge.js
CHANGED
|
@@ -75,7 +75,7 @@ function handleSSEEvent(event, data, options) {
|
|
|
75
75
|
const id = payload.id;
|
|
76
76
|
const delivered = payload.delivered;
|
|
77
77
|
const agentPidField = payload.agent_pid;
|
|
78
|
-
const isOurs =
|
|
78
|
+
const isOurs = sender === agentName || agentPidField === agentPid;
|
|
79
79
|
if (!isOurs || status !== 'answered' || delivered === 1)
|
|
80
80
|
return;
|
|
81
81
|
const question = (payload.question || '').slice(0, 60);
|
|
@@ -89,6 +89,8 @@ function injectAndMarkDelivered(id, text, tmuxPane) {
|
|
|
89
89
|
db.prepare('UPDATE agent_messages SET delivered = 1 WHERE id = ?').run(id);
|
|
90
90
|
try {
|
|
91
91
|
execSync(`tmux send-keys -t ${tmuxPane} ${JSON.stringify(text)} Enter`, { stdio: 'ignore', timeout: 5000 });
|
|
92
|
+
// Long text triggers tmux bracketed paste — delay then send extra Enter to confirm
|
|
93
|
+
execSync(`sleep 1 && tmux send-keys -t ${tmuxPane} Enter`, { stdio: 'ignore', timeout: 5000 });
|
|
92
94
|
console.error(`[bridge] delivered message ${id} to tmux pane ${tmuxPane}`);
|
|
93
95
|
}
|
|
94
96
|
catch (err) {
|
|
@@ -100,8 +102,8 @@ function deliverUndelivered(options) {
|
|
|
100
102
|
const db = getDb();
|
|
101
103
|
const incoming = db.prepare(`SELECT * FROM agent_messages WHERE delivered IS NULL AND (
|
|
102
104
|
(recipient_name = ? AND status = 'pending') OR
|
|
103
|
-
(sender_name = ? AND
|
|
104
|
-
(agent_pid = ? AND
|
|
105
|
+
(sender_name = ? AND status = 'answered') OR
|
|
106
|
+
(agent_pid = ? AND status = 'answered')
|
|
105
107
|
)`).all(agentName, agentName, agentPid);
|
|
106
108
|
for (const msg of incoming) {
|
|
107
109
|
let text;
|
|
@@ -123,7 +123,7 @@ export function registerAgentInboxTools(server) {
|
|
|
123
123
|
if (message.status !== 'pending')
|
|
124
124
|
return errorResponse(`Message ${params.message_id} is already ${message.status}`, 'VALIDATION_ERROR');
|
|
125
125
|
const ts = now();
|
|
126
|
-
db.prepare('UPDATE agent_messages SET response = ?, status = ?, answered_at =
|
|
126
|
+
db.prepare('UPDATE agent_messages SET response = ?, status = ?, answered_at = ?, delivered = NULL WHERE id = ?')
|
|
127
127
|
.run(params.response, 'answered', ts, params.message_id);
|
|
128
128
|
const updated = db.prepare('SELECT * FROM agent_messages WHERE id = ?').get(params.message_id);
|
|
129
129
|
broadcastChange('agent_message', 'agent_question_answered', updated);
|