-
Notifications
You must be signed in to change notification settings - Fork 0
feat(agents): parameterized agent selection via agentName #349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
684270e
1b2491e
4dc8669
0f6cec7
e84d1ca
745f280
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| import { describe, it, expect } from 'vitest'; | ||
| import { buildMeetingPrepPrompt, buildMeetingContext } from '../calendar-utils'; | ||
| import type { CalendarEvent } from '../../hooks/useCalendarData'; | ||
|
|
||
| function makeEvent(overrides: Partial<CalendarEvent> = {}): CalendarEvent { | ||
| return { | ||
| id: 'evt-1', | ||
| type: 'meeting', | ||
| title: 'Standup', | ||
| start: '2026-05-22T10:00:00Z', | ||
| end: '2026-05-22T10:30:00Z', | ||
| ...overrides, | ||
| }; | ||
| } | ||
|
|
||
| describe('buildMeetingPrepPrompt', () => { | ||
| it('includes title and formatted time range', () => { | ||
| const result = buildMeetingPrepPrompt(makeEvent()); | ||
| expect(result).toContain('Prepare for "Standup"'); | ||
| expect(result).toContain(' at '); | ||
| }); | ||
|
|
||
| it('omits time for all-day events (no T in start)', () => { | ||
| const result = buildMeetingPrepPrompt(makeEvent({ start: '2026-05-22', end: '2026-05-23' })); | ||
| expect(result).toBe('Prepare for "Standup"'); | ||
| }); | ||
|
|
||
| it('omits time when start is empty', () => { | ||
| const result = buildMeetingPrepPrompt(makeEvent({ start: '' })); | ||
| expect(result).toBe('Prepare for "Standup"'); | ||
| }); | ||
| }); | ||
|
|
||
| describe('buildMeetingContext', () => { | ||
| it('includes meeting title', () => { | ||
| const result = buildMeetingContext(makeEvent()); | ||
| expect(result).toContain('**Meeting:** Standup'); | ||
| }); | ||
|
|
||
| it('includes location when present', () => { | ||
| const result = buildMeetingContext(makeEvent({ location: 'Room 42' })); | ||
| expect(result).toContain('**Where:** Room 42'); | ||
| }); | ||
|
|
||
| it('omits location when absent', () => { | ||
| const result = buildMeetingContext(makeEvent()); | ||
| expect(result).not.toContain('**Where:**'); | ||
| }); | ||
|
|
||
| it('formats attendees from email addresses', () => { | ||
| const result = buildMeetingContext( | ||
| makeEvent({ attendees: ['alice@example.com', 'bob@example.com'] }), | ||
| ); | ||
| expect(result).toContain('**Attendees:** alice, bob'); | ||
| }); | ||
|
|
||
| it('truncates attendees beyond 10 with count', () => { | ||
| const attendees = Array.from({ length: 12 }, (_, i) => `user${i}@example.com`); | ||
| const result = buildMeetingContext(makeEvent({ attendees })); | ||
| expect(result).toContain('(+2 more)'); | ||
| expect(result).not.toContain('user10'); | ||
| }); | ||
|
|
||
| it('includes video link when present', () => { | ||
| const result = buildMeetingContext(makeEvent({ hangoutLink: 'https://meet.google.com/abc' })); | ||
| expect(result).toContain('**Video:** [Join call](https://meet.google.com/abc)'); | ||
| }); | ||
|
|
||
| it('includes context prompts at the end', () => { | ||
| const result = buildMeetingContext(makeEvent()); | ||
| expect(result).toContain('Review recent Jira activity'); | ||
| expect(result).toContain('key topics and decisions'); | ||
| }); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| import type { CalendarEvent } from '../hooks/useCalendarData'; | ||
|
|
||
| export function buildMeetingPrepPrompt(event: CalendarEvent): string { | ||
| const time = formatEventTime(event); | ||
| const when = time ? ` at ${time}` : ''; | ||
|
|
||
| return `Prepare for "${event.title}"${when}`; | ||
| } | ||
|
|
||
| export function buildMeetingContext(event: CalendarEvent): string { | ||
| const lines: string[] = []; | ||
|
|
||
| lines.push(`**Meeting:** ${event.title}`); | ||
|
|
||
| if (event.start) { | ||
| const startDate = new Date(event.start); | ||
| const dateStr = startDate.toLocaleDateString([], { | ||
| weekday: 'short', | ||
| month: 'short', | ||
| day: 'numeric', | ||
| hour: 'numeric', | ||
| minute: '2-digit', | ||
| }); | ||
| lines.push(`**When:** ${dateStr}`); | ||
| } | ||
|
|
||
| if (event.location) { | ||
| lines.push(`**Where:** ${event.location}`); | ||
| } | ||
|
|
||
| if (event.attendees && event.attendees.length > 0) { | ||
| const displayAttendees = event.attendees | ||
| .slice(0, 10) | ||
| .map((email) => { | ||
| const name = email.split('@')[0]; | ||
| return name; | ||
| }) | ||
| .join(', '); | ||
|
|
||
| const suffix = event.attendees.length > 10 ? ` (+${event.attendees.length - 10} more)` : ''; | ||
| lines.push(`**Attendees:** ${displayAttendees}${suffix}`); | ||
| } | ||
|
|
||
| if (event.hangoutLink) { | ||
| lines.push(`**Video:** [Join call](${event.hangoutLink})`); | ||
| } | ||
|
|
||
| lines.push(''); | ||
| lines.push('**Context for this meeting:**'); | ||
| lines.push('- Review recent Jira activity for attendees'); | ||
| lines.push('- Check relevant docs and recent conversations'); | ||
| lines.push('- Identify key topics and decisions needed'); | ||
|
|
||
| return lines.join('\n'); | ||
| } | ||
|
|
||
| function formatEventTime(event: CalendarEvent): string { | ||
| if (!event.start || !event.start.includes('T')) return ''; | ||
|
|
||
| const start = new Date(event.start); | ||
| const end = event.end ? new Date(event.end) : null; | ||
|
|
||
| const startTime = start.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' }); | ||
| if (!end) return startTime; | ||
|
|
||
| const endTime = end.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' }); | ||
| return `${startTime}–${endTime}`; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,7 @@ | |
| defaultCollapsed: boolean; | ||
| } | ||
|
|
||
| export function groupIntoSections(items: TodoItem[]): TodoSection[] { | ||
| const focus: TodoItem[] = []; | ||
| const active: TodoItem[] = []; | ||
| const seen: TodoItem[] = []; | ||
|
|
@@ -190,6 +190,8 @@ | |
| setPendingSession({ | ||
| prompt: buildPrompt(item), | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 regressions: Adding |
||
| context: buildTodoContext(item), | ||
| telosTaskId: item.id, | ||
| agentName: 'mitzo-telos', | ||
| }); | ||
| navigate('/chat'); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 style: Multi-line JSDoc comments on buildMeetingPrepPrompt and buildMeetingContext restate what the function name already says. CLAUDE.md says 'default to writing no comments' and 'don't explain WHAT the code does'. Remove the doc blocks.
[fixable]