@plosson/agentio 0.4.2 → 0.4.3

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.
@@ -1,17 +1,52 @@
1
+ export interface GatewayApiConfig {
2
+ port?: number;
3
+ host?: string;
4
+ secret?: string;
5
+ }
6
+
7
+ export interface GatewayWebhookConfig {
8
+ url?: string;
9
+ secret?: string;
10
+ debounceMs?: number;
11
+ }
12
+
13
+ export interface GatewayMediaConfig {
14
+ download?: boolean;
15
+ maxSizeMb?: number;
16
+ }
17
+
18
+ export interface GatewayRetentionConfig {
19
+ doneMessagesDays?: number;
20
+ sentMessagesDays?: number;
21
+ }
22
+
23
+ export interface GatewayConfig {
24
+ name?: string; // Gateway identity name
25
+ secret?: string; // Shared secret for API auth and teleport
26
+ api?: GatewayApiConfig;
27
+ webhook?: GatewayWebhookConfig;
28
+ media?: GatewayMediaConfig;
29
+ retention?: GatewayRetentionConfig;
30
+ }
31
+
1
32
  export interface Config {
2
33
  profiles: {
3
34
  gdocs?: string[];
4
35
  gdrive?: string[];
5
36
  gmail?: string[];
37
+ gcal?: string[];
38
+ gtasks?: string[];
6
39
  gchat?: string[];
7
40
  github?: string[];
8
41
  jira?: string[];
9
42
  slack?: string[];
10
43
  telegram?: string[];
44
+ whatsapp?: string[];
11
45
  discourse?: string[];
12
46
  sql?: string[];
13
47
  };
14
48
  env?: Record<string, string>;
49
+ gateway?: GatewayConfig;
15
50
  }
16
51
 
17
- export type ServiceName = 'gdocs' | 'gdrive' | 'gmail' | 'gchat' | 'github' | 'jira' | 'slack' | 'telegram' | 'discourse' | 'sql';
52
+ export type ServiceName = 'gdocs' | 'gdrive' | 'gmail' | 'gcal' | 'gtasks' | 'gchat' | 'github' | 'jira' | 'slack' | 'telegram' | 'whatsapp' | 'discourse' | 'sql';
@@ -0,0 +1,135 @@
1
+ import type { OAuthTokens } from './tokens';
2
+
3
+ export type GCalCredentials = OAuthTokens & { email?: string };
4
+
5
+ export interface GCalCalendar {
6
+ id: string;
7
+ summary: string;
8
+ description?: string;
9
+ accessRole: string;
10
+ primary?: boolean;
11
+ timeZone?: string;
12
+ }
13
+
14
+ export interface GCalEventDateTime {
15
+ dateTime?: string; // RFC3339 timestamp with timezone
16
+ date?: string; // YYYY-MM-DD for all-day events
17
+ timeZone?: string; // IANA timezone name
18
+ }
19
+
20
+ export interface GCalAttendee {
21
+ email: string;
22
+ displayName?: string;
23
+ responseStatus?: string; // needsAction, declined, tentative, accepted
24
+ optional?: boolean;
25
+ organizer?: boolean;
26
+ self?: boolean;
27
+ comment?: string;
28
+ }
29
+
30
+ export interface GCalReminder {
31
+ method: 'email' | 'popup';
32
+ minutes: number;
33
+ }
34
+
35
+ export interface GCalEvent {
36
+ id: string;
37
+ summary?: string;
38
+ description?: string;
39
+ location?: string;
40
+ start: GCalEventDateTime;
41
+ end: GCalEventDateTime;
42
+ status?: string; // confirmed, tentative, cancelled
43
+ htmlLink?: string;
44
+ created?: string;
45
+ updated?: string;
46
+ colorId?: string;
47
+ creator?: { email: string; displayName?: string };
48
+ organizer?: { email: string; displayName?: string };
49
+ attendees?: GCalAttendee[];
50
+ recurrence?: string[];
51
+ recurringEventId?: string;
52
+ transparency?: string; // opaque (busy) or transparent (free)
53
+ visibility?: string; // default, public, private, confidential
54
+ reminders?: {
55
+ useDefault: boolean;
56
+ overrides?: GCalReminder[];
57
+ };
58
+ hangoutLink?: string;
59
+ conferenceData?: {
60
+ entryPoints?: Array<{
61
+ entryPointType: string;
62
+ uri: string;
63
+ label?: string;
64
+ }>;
65
+ };
66
+ eventType?: string; // default, focusTime, outOfOffice, workingLocation
67
+ }
68
+
69
+ export interface GCalFreeBusyResponse {
70
+ calendars: Record<string, {
71
+ busy: Array<{ start: string; end: string }>;
72
+ errors?: Array<{ domain: string; reason: string }>;
73
+ }>;
74
+ }
75
+
76
+ export interface GCalListOptions {
77
+ calendarId?: string;
78
+ timeMin?: string; // RFC3339
79
+ timeMax?: string; // RFC3339
80
+ maxResults?: number;
81
+ pageToken?: string;
82
+ query?: string;
83
+ singleEvents?: boolean;
84
+ orderBy?: 'startTime' | 'updated';
85
+ }
86
+
87
+ export interface GCalCreateOptions {
88
+ calendarId?: string;
89
+ summary: string;
90
+ description?: string;
91
+ location?: string;
92
+ start: string; // RFC3339 or YYYY-MM-DD for all-day
93
+ end: string;
94
+ allDay?: boolean;
95
+ attendees?: string[]; // email addresses
96
+ recurrence?: string[]; // RRULE strings
97
+ reminders?: Array<{ method: 'email' | 'popup'; minutes: number }>;
98
+ colorId?: string;
99
+ visibility?: 'default' | 'public' | 'private' | 'confidential';
100
+ transparency?: 'opaque' | 'transparent';
101
+ sendUpdates?: 'all' | 'externalOnly' | 'none';
102
+ withMeet?: boolean;
103
+ }
104
+
105
+ export interface GCalUpdateOptions {
106
+ calendarId?: string;
107
+ eventId: string;
108
+ summary?: string;
109
+ description?: string;
110
+ location?: string;
111
+ start?: string;
112
+ end?: string;
113
+ allDay?: boolean;
114
+ attendees?: string[];
115
+ addAttendees?: string[];
116
+ recurrence?: string[];
117
+ reminders?: Array<{ method: 'email' | 'popup'; minutes: number }>;
118
+ colorId?: string;
119
+ visibility?: 'default' | 'public' | 'private' | 'confidential';
120
+ transparency?: 'opaque' | 'transparent';
121
+ sendUpdates?: 'all' | 'externalOnly' | 'none';
122
+ }
123
+
124
+ export interface GCalRespondOptions {
125
+ calendarId?: string;
126
+ eventId: string;
127
+ status: 'accepted' | 'declined' | 'tentative';
128
+ comment?: string;
129
+ }
130
+
131
+ export interface GCalFreeBusyOptions {
132
+ calendarIds: string[];
133
+ timeMin: string;
134
+ timeMax: string;
135
+ }
@@ -0,0 +1,58 @@
1
+ import type { OAuthTokens } from './tokens';
2
+
3
+ export type GTasksCredentials = OAuthTokens & { email?: string };
4
+
5
+ export interface GTaskList {
6
+ id: string;
7
+ title: string;
8
+ updated?: string;
9
+ selfLink?: string;
10
+ }
11
+
12
+ export interface GTask {
13
+ id: string;
14
+ title: string;
15
+ status: 'needsAction' | 'completed';
16
+ notes?: string;
17
+ due?: string;
18
+ completed?: string;
19
+ parent?: string;
20
+ position?: string;
21
+ updated?: string;
22
+ selfLink?: string;
23
+ webViewLink?: string;
24
+ hidden?: boolean;
25
+ deleted?: boolean;
26
+ }
27
+
28
+ export interface GTasksListOptions {
29
+ tasklistId: string;
30
+ maxResults?: number;
31
+ pageToken?: string;
32
+ showCompleted?: boolean;
33
+ showDeleted?: boolean;
34
+ showHidden?: boolean;
35
+ dueMin?: string;
36
+ dueMax?: string;
37
+ completedMin?: string;
38
+ completedMax?: string;
39
+ updatedMin?: string;
40
+ }
41
+
42
+ export interface GTasksCreateOptions {
43
+ tasklistId: string;
44
+ title: string;
45
+ notes?: string;
46
+ due?: string;
47
+ parent?: string;
48
+ previous?: string;
49
+ }
50
+
51
+ export interface GTasksUpdateOptions {
52
+ tasklistId: string;
53
+ taskId: string;
54
+ title?: string;
55
+ notes?: string;
56
+ due?: string;
57
+ status?: 'needsAction' | 'completed';
58
+ }
@@ -0,0 +1,8 @@
1
+ declare module 'qrcode-terminal' {
2
+ interface Options {
3
+ small?: boolean;
4
+ }
5
+
6
+ export function generate(text: string, options?: Options, callback?: (qrcode: string) => void): void;
7
+ export function setErrorLevel(level: 'L' | 'M' | 'Q' | 'H'): void;
8
+ }
@@ -0,0 +1,116 @@
1
+ /**
2
+ * WhatsApp credentials stored for a profile
3
+ * Note: The actual auth state (keys, session) is stored in the gateway SQLite database
4
+ */
5
+ export interface WhatsAppCredentials {
6
+ // Profile identifier (phone number after pairing)
7
+ phoneNumber?: string;
8
+ // Display name of the WhatsApp account
9
+ displayName?: string;
10
+ // Whether this profile has been paired
11
+ paired: boolean;
12
+ // Timestamp of last successful connection
13
+ lastConnected?: number;
14
+ }
15
+
16
+ /**
17
+ * WhatsApp message types
18
+ */
19
+ export type WhatsAppMessageType = 'text' | 'image' | 'video' | 'audio' | 'document' | 'sticker' | 'location' | 'contact';
20
+
21
+ /**
22
+ * WhatsApp contact info
23
+ */
24
+ export interface WhatsAppContact {
25
+ id: string; // JID (e.g., "1234567890@s.whatsapp.net")
26
+ name?: string; // Push name
27
+ notify?: string; // Notify name
28
+ verifiedName?: string; // Business verified name
29
+ phone: string; // Phone number extracted from JID
30
+ }
31
+
32
+ /**
33
+ * WhatsApp chat info
34
+ */
35
+ export interface WhatsAppChat {
36
+ id: string; // JID
37
+ name?: string; // Chat name (contact name or group name)
38
+ isGroup: boolean;
39
+ participantCount?: number;
40
+ unreadCount?: number;
41
+ lastMessageTime?: number;
42
+ }
43
+
44
+ /**
45
+ * WhatsApp message
46
+ */
47
+ export interface WhatsAppMessage {
48
+ id: string; // Message ID
49
+ chatId: string; // Chat JID
50
+ senderId: string; // Sender JID
51
+ senderName?: string;
52
+ timestamp: number;
53
+ type: WhatsAppMessageType;
54
+ content?: string; // Text content
55
+ caption?: string; // Media caption
56
+ mediaUrl?: string; // URL for media
57
+ quotedMessageId?: string;
58
+ isFromMe: boolean;
59
+ }
60
+
61
+ /**
62
+ * WhatsApp send options
63
+ */
64
+ export interface WhatsAppSendOptions {
65
+ quotedMessageId?: string;
66
+ }
67
+
68
+ /**
69
+ * WhatsApp group information
70
+ */
71
+ export interface WhatsAppGroup {
72
+ id: string; // Group JID (e.g., "120363xxx@g.us")
73
+ name: string; // Group subject/name
74
+ description?: string;
75
+ owner?: string; // Owner JID
76
+ creation?: number; // Creation timestamp
77
+ participantCount: number;
78
+ participants?: WhatsAppGroupParticipant[];
79
+ isAdmin: boolean; // Whether current user is admin
80
+ isSuperAdmin: boolean; // Whether current user is super admin (creator)
81
+ announce: boolean; // Only admins can send messages
82
+ restrict: boolean; // Only admins can modify group info
83
+ inviteCode?: string;
84
+ }
85
+
86
+ /**
87
+ * WhatsApp group participant
88
+ */
89
+ export interface WhatsAppGroupParticipant {
90
+ id: string; // Participant JID
91
+ name?: string; // Push name
92
+ phone: string; // Phone number
93
+ isAdmin: boolean;
94
+ isSuperAdmin: boolean;
95
+ }
96
+
97
+ /**
98
+ * Options for creating a group
99
+ */
100
+ export interface WhatsAppGroupCreateOptions {
101
+ name: string;
102
+ participants: string[]; // Phone numbers or JIDs
103
+ }
104
+
105
+ /**
106
+ * Options for updating a group
107
+ */
108
+ export interface WhatsAppGroupUpdateOptions {
109
+ subject?: string; // Group name
110
+ description?: string; // Group description
111
+ }
112
+
113
+ /**
114
+ * Participant update action
115
+ */
116
+ export type WhatsAppParticipantAction = 'add' | 'remove' | 'promote' | 'demote';