Merge pull request #3 from letta-ai/fix/envelope-chat-id
Add chat ID to message envelope for lettabot-message CLI
This commit is contained in:
@@ -138,12 +138,14 @@ function formatTimestamp(date: Date, options: EnvelopeOptions): string {
|
||||
/**
|
||||
* Format a message with metadata envelope
|
||||
*
|
||||
* Format: [Channel GroupName Sender Timestamp] Message
|
||||
* Format: [Channel:ChatId Sender Timestamp] Message
|
||||
*
|
||||
* The Channel:ChatId format allows the agent to reply using:
|
||||
* lettabot-message send --text "..." --channel telegram --chat 123456789
|
||||
*
|
||||
* Examples:
|
||||
* - [Slack #general @cameron Monday, Jan 27, 4:30 PM PST] Hello!
|
||||
* - [WhatsApp Cameron Monday, Jan 27, 5:00 PM PST] Hi there
|
||||
* - [Signal Family Group +1 (555) 123-4567 Tuesday, Jan 28, 9:30 AM PST] Dinner at 7?
|
||||
* - [telegram:123456789 Sarah Wednesday, Jan 28, 4:30 PM PST] Hello!
|
||||
* - [slack:C1234567 @cameron Monday, Jan 27, 4:30 PM PST] Hello!
|
||||
*/
|
||||
export function formatMessageEnvelope(
|
||||
msg: InboundMessage,
|
||||
@@ -152,13 +154,8 @@ export function formatMessageEnvelope(
|
||||
const opts = { ...DEFAULT_OPTIONS, ...options };
|
||||
const parts: string[] = [];
|
||||
|
||||
// Channel name with format hint
|
||||
const formatHint = CHANNEL_FORMATS[msg.channel];
|
||||
if (formatHint) {
|
||||
parts.push(`${formatChannelName(msg.channel)} (${formatHint})`);
|
||||
} else {
|
||||
parts.push(formatChannelName(msg.channel));
|
||||
}
|
||||
// Channel:ChatId (for lettabot-message CLI)
|
||||
parts.push(`${msg.channel}:${msg.chatId}`);
|
||||
|
||||
// Group name (if group chat and enabled)
|
||||
if (opts.includeGroup !== false && msg.isGroup && msg.groupName?.trim()) {
|
||||
@@ -182,5 +179,9 @@ export function formatMessageEnvelope(
|
||||
// Build envelope
|
||||
const envelope = `[${parts.join(' ')}]`;
|
||||
|
||||
return `${envelope} ${msg.text}`;
|
||||
// Add format hint as a separate note (not cluttering the main envelope)
|
||||
const formatHint = CHANNEL_FORMATS[msg.channel];
|
||||
const hint = formatHint ? `\n(Format: ${formatHint})` : '';
|
||||
|
||||
return `${envelope} ${msg.text}${hint}`;
|
||||
}
|
||||
|
||||
@@ -88,6 +88,55 @@ How to use Skills:
|
||||
|
||||
IMPORTANT: Always unload irrelevant skills using the Skill tool to free up context space.
|
||||
|
||||
# Scheduling
|
||||
|
||||
You can create scheduled tasks using the \`lettabot-schedule\` CLI via Bash.
|
||||
|
||||
## One-Off Reminders
|
||||
|
||||
For reminders at a specific future time, use \`--at\` with an ISO datetime:
|
||||
|
||||
\`\`\`bash
|
||||
# First calculate the datetime (e.g., 30 minutes from now)
|
||||
# new Date(Date.now() + 30*60*1000).toISOString()
|
||||
|
||||
lettabot-schedule create \\
|
||||
--name "Reminder" \\
|
||||
--at "2026-01-28T20:15:00.000Z" \\
|
||||
--message "Time to take a break!"
|
||||
\`\`\`
|
||||
|
||||
One-off reminders auto-delete after running.
|
||||
|
||||
## Recurring Schedules
|
||||
|
||||
For recurring tasks, use \`--schedule\` with a cron expression:
|
||||
|
||||
\`\`\`bash
|
||||
lettabot-schedule create \\
|
||||
--name "Morning Briefing" \\
|
||||
--schedule "0 8 * * *" \\
|
||||
--message "Good morning! What's on today's agenda?"
|
||||
\`\`\`
|
||||
|
||||
## Common Cron Patterns
|
||||
|
||||
| Pattern | When |
|
||||
|---------|------|
|
||||
| \`0 8 * * *\` | Daily at 8:00 AM |
|
||||
| \`0 9 * * 1-5\` | Weekdays at 9:00 AM |
|
||||
| \`0 */2 * * *\` | Every 2 hours |
|
||||
| \`30 17 * * 5\` | Fridays at 5:30 PM |
|
||||
|
||||
## Managing Jobs
|
||||
|
||||
\`\`\`bash
|
||||
lettabot-schedule list # List all jobs
|
||||
lettabot-schedule delete <job-id> # Delete a job
|
||||
lettabot-schedule enable <job-id> # Enable a job
|
||||
lettabot-schedule disable <job-id> # Disable a job
|
||||
\`\`\`
|
||||
|
||||
# Security
|
||||
|
||||
- Assist with defensive security tasks only
|
||||
@@ -99,5 +148,5 @@ IMPORTANT: Always unload irrelevant skills using the Skill tool to free up conte
|
||||
|
||||
If the user asks for help or wants to give feedback:
|
||||
- Discord: Get help on our official Discord channel (discord.gg/letta)
|
||||
- GitHub: Report issues at https://github.com/letta-ai/letta-code/issues
|
||||
- GitHub: Report issues at https://github.com/letta-ai/lettabot/issues
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user