mirror of
https://github.com/myronblair/jarvis
synced 2026-06-30 17:50:23 -05:00
Phase 6: Comms v2 — send email, compose, schedule, meeting prep
- arc.php: comms_sent / comms_sent_get / comms_sent_delete + outbox backend - chat.php: Tier 0.9f-0.9h — send_email, compose_email, schedule_event, meeting_prep voice detection - index.html: COMMS tab SEND REPLY button, COMPOSE modal, OUTBOX section, onArcJobStarted routes comms jobs to COMMS tab - admin/index.php: OUTBOX nav + tab, send_reply/compose_email/outbox_list/outbox_delete PHP actions, outboxCompose() modal, triageSendReply() inline Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1261,6 +1261,100 @@ if (!$reply) {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Tier 0.9f: Comms v2 — send_email, compose_email ─────────────────────────
|
||||
if (!$reply) {
|
||||
// "reply to [name/id] saying..." or "send [name] a reply..."
|
||||
if (preg_match('/^(?:jarvis[,\s]+)?(?:reply\s+to|send\s+(?:a\s+)?reply\s+to)\s+(.+?)\s+(?:saying|that|:)\s+(.+)/i', $message, $m)) {
|
||||
$target = trim($m[1]);
|
||||
$content = trim($m[2]);
|
||||
$arcRes = arcSubmitJob('send_email', [
|
||||
'target' => $target,
|
||||
'content' => $content,
|
||||
], $sessionId);
|
||||
if (isset($arcRes['job_id'])) {
|
||||
$arcJobId = $arcRes['job_id'];
|
||||
$reply = "◈ COMMS PROTOCOL — Sending reply to **{$target}** (Job #{$arcJobId}). Drafting and transmitting now, {$userAddr}.";
|
||||
$source = 'arc:send_email';
|
||||
} else {
|
||||
$reply = "Comms Protocol is offline, {$userAddr}. Arc Reactor may be unavailable.";
|
||||
$source = 'arc:offline';
|
||||
}
|
||||
}
|
||||
// "send email to [name] about [subject]" or "compose email to..."
|
||||
elseif (preg_match('/^(?:jarvis[,\s]+)?(?:send\s+(?:an?\s+)?email\s+to|compose\s+(?:an?\s+)?email\s+to|write\s+(?:an?\s+)?email\s+to|draft\s+(?:an?\s+)?email\s+to)\s+(.+?)(?:\s+(?:about|regarding|re:?)\s+(.+))?$/i', $message, $m)) {
|
||||
$recipient = trim($m[1]);
|
||||
$instructions = isset($m[2]) ? trim($m[2]) : $message;
|
||||
$arcRes = arcSubmitJob('compose_email', [
|
||||
'recipient' => $recipient,
|
||||
'instructions' => $instructions,
|
||||
'auto_send' => false,
|
||||
], $sessionId);
|
||||
if (isset($arcRes['job_id'])) {
|
||||
$arcJobId = $arcRes['job_id'];
|
||||
$reply = "◈ COMMS PROTOCOL — Composing email to **{$recipient}** (Job #{$arcJobId}). I'll draft it and show you before sending, {$userAddr}. Check the COMMS tab.";
|
||||
$source = 'arc:compose_email';
|
||||
} else {
|
||||
$reply = "Comms Protocol is offline, {$userAddr}.";
|
||||
$source = 'arc:offline';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── Tier 0.9g: Comms v2 — schedule_event ─────────────────────────────────────
|
||||
if (!$reply) {
|
||||
$schedulePatterns = [
|
||||
'/^(?:jarvis[,\s]+)?(?:schedule|book|set\s+up|create)\s+(?:a\s+)?(?:meeting|call|appointment|event|session)\s+(?:with|for|about)?\s*(.+)/i',
|
||||
'/^(?:jarvis[,\s]+)?(?:add\s+(?:a\s+)?(?:meeting|call|appointment|event)\s+(?:to\s+my\s+calendar)?\s*(?:with|for|about)?\s*(.+))/i',
|
||||
'/^(?:jarvis[,\s]+)?(?:put\s+(?:a\s+)?(?:meeting|call|appointment)\s+(?:on\s+(?:my\s+)?calendar|in\s+my\s+schedule)(?:\s+(?:with|for|about)?\s+(.+))?)/i',
|
||||
];
|
||||
foreach ($schedulePatterns as $pat) {
|
||||
if (preg_match($pat, $message, $m)) {
|
||||
$details = trim($m[1] ?? $message);
|
||||
$arcRes = arcSubmitJob('schedule_event', [
|
||||
'request' => $message,
|
||||
'details' => $details,
|
||||
'provider' => 'claude',
|
||||
], $sessionId);
|
||||
if (isset($arcRes['job_id'])) {
|
||||
$arcJobId = $arcRes['job_id'];
|
||||
$reply = "◈ SCHEDULING PROTOCOL — Processing your calendar request (Job #{$arcJobId}). I'm parsing the details and creating the appointment now, {$userAddr}.";
|
||||
$source = 'arc:schedule_event';
|
||||
} else {
|
||||
$reply = "Scheduling Protocol is offline, {$userAddr}. Arc Reactor may be unavailable.";
|
||||
$source = 'arc:offline';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── Tier 0.9h: Comms v2 — meeting_prep ────────────────────────────────────────
|
||||
if (!$reply) {
|
||||
$meetingPrepPatterns = [
|
||||
'/^(?:jarvis[,\s]+)?(?:prep(?:are)?(?:\s+me)?\s+for|brief(?:ing)?\s+(?:me\s+)?(?:for|on|about)?)\s+(?:my\s+)?(?:next\s+)?(?:meeting|call|appointment)/i',
|
||||
'/^(?:jarvis[,\s]+)?(?:what(?:\'s|\s+do\s+i\s+need\s+to\s+know)?\s+(?:is\s+)?(?:my\s+)?(?:next\s+)?meeting)/i',
|
||||
'/^(?:jarvis[,\s]+)?(?:meeting\s+prep|pre[- ]meeting\s+(?:brief|notes|prep))/i',
|
||||
'/^(?:jarvis[,\s]+)?(?:get\s+(?:me\s+)?ready\s+for\s+my\s+(?:next\s+)?(?:meeting|call))/i',
|
||||
];
|
||||
foreach ($meetingPrepPatterns as $pat) {
|
||||
if (preg_match($pat, $message)) {
|
||||
$arcRes = arcSubmitJob('meeting_prep', [
|
||||
'provider' => 'claude',
|
||||
'research' => true,
|
||||
], $sessionId);
|
||||
if (isset($arcRes['job_id'])) {
|
||||
$arcJobId = $arcRes['job_id'];
|
||||
$reply = "◈ MISSION PROTOCOL — Preparing your meeting briefing (Job #{$arcJobId}). I'm pulling your next appointment details and researching the participants, {$userAddr}. Stand by.";
|
||||
$source = 'arc:meeting_prep';
|
||||
} else {
|
||||
$reply = "Mission Protocol is offline, {$userAddr}. Arc Reactor may be unavailable.";
|
||||
$source = 'arc:offline';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── Tier 1: Intent Engine (instant, no LLM) ───────────────────────────────
|
||||
if (!$reply) {
|
||||
$matched = KBEngine::match($message);
|
||||
|
||||
Reference in New Issue
Block a user