fix: improve agent output schema, tool descriptions, and shutdown robustness

- Rename status→outputType, responded/silent→message/log for clarity
- Remove scheduled task special-casing: userMessage now sent for all contexts
- Update schema, tool, and CLAUDE.md descriptions to be clear and
  non-contradictory about communication mechanisms
- Use full tool name mcp__nanoclaw__send_message in docs
- Change schedule_task target_group to accept JID instead of folder name
- Only show target_group_jid parameter to main group agents
- Add defense-in-depth sanitization and error callback to exec() in shutdown
- Use "user or group" consistently (supports both 1:1 and group chats)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
gavrielc
2026-02-06 20:22:45 +02:00
parent ae177156ec
commit 44f0b3d99c
8 changed files with 68 additions and 63 deletions

View File

@@ -4,6 +4,7 @@ import fs from 'fs';
import path from 'path';
import {
ASSISTANT_NAME,
GROUPS_DIR,
MAIN_GROUP_FOLDER,
SCHEDULER_POLL_INTERVAL,
@@ -104,6 +105,9 @@ async function runTask(
if (output.status === 'error') {
error = output.error || 'Unknown error';
} else if (output.result) {
if (output.result.outputType === 'message' && output.result.userMessage) {
await deps.sendMessage(task.chat_jid, `${ASSISTANT_NAME}: ${output.result.userMessage}`);
}
result = output.result.userMessage || output.result.internalLog || null;
}