device-bridge-mobile-pa 1.0.0
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.
- package/build-connector.js +64 -0
- package/dist/actions/calendar-actions.d.ts +35 -0
- package/dist/actions/calendar-actions.js +185 -0
- package/dist/actions/calendar-actions.js.map +1 -0
- package/dist/actions/dnd.d.ts +27 -0
- package/dist/actions/dnd.js +67 -0
- package/dist/actions/dnd.js.map +1 -0
- package/dist/actions/index.d.ts +10 -0
- package/dist/actions/index.js +10 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/messaging.d.ts +18 -0
- package/dist/actions/messaging.js +65 -0
- package/dist/actions/messaging.js.map +1 -0
- package/dist/actions/navigation.d.ts +14 -0
- package/dist/actions/navigation.js +79 -0
- package/dist/actions/navigation.js.map +1 -0
- package/dist/actions/queue-poller.d.ts +45 -0
- package/dist/actions/queue-poller.js +106 -0
- package/dist/actions/queue-poller.js.map +1 -0
- package/dist/background.d.ts +32 -0
- package/dist/background.js +101 -0
- package/dist/background.js.map +1 -0
- package/dist/capabilities.d.ts +18 -0
- package/dist/capabilities.js +128 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/collectors/battery.d.ts +10 -0
- package/dist/collectors/battery.js +37 -0
- package/dist/collectors/battery.js.map +1 -0
- package/dist/collectors/calendar.d.ts +24 -0
- package/dist/collectors/calendar.js +94 -0
- package/dist/collectors/calendar.js.map +1 -0
- package/dist/collectors/connectivity.d.ts +10 -0
- package/dist/collectors/connectivity.js +53 -0
- package/dist/collectors/connectivity.js.map +1 -0
- package/dist/collectors/contacts.d.ts +19 -0
- package/dist/collectors/contacts.js +71 -0
- package/dist/collectors/contacts.js.map +1 -0
- package/dist/collectors/index.d.ts +11 -0
- package/dist/collectors/index.js +12 -0
- package/dist/collectors/index.js.map +1 -0
- package/dist/collectors/location.d.ts +18 -0
- package/dist/collectors/location.js +88 -0
- package/dist/collectors/location.js.map +1 -0
- package/dist/collectors/notifications.d.ts +28 -0
- package/dist/collectors/notifications.js +63 -0
- package/dist/collectors/notifications.js.map +1 -0
- package/dist/device-bridge-connector.js +388 -0
- package/dist/dynamic-connector.d.ts +63 -0
- package/dist/dynamic-connector.js +344 -0
- package/dist/dynamic-connector.js.map +1 -0
- package/dist/index.d.ts +108 -0
- package/dist/index.js +292 -0
- package/dist/index.js.map +1 -0
- package/dist/packages/device-bridge/src/actions/calendar-actions.d.ts +35 -0
- package/dist/packages/device-bridge/src/actions/calendar-actions.js +222 -0
- package/dist/packages/device-bridge/src/actions/calendar-actions.js.map +1 -0
- package/dist/packages/device-bridge/src/actions/dnd.d.ts +27 -0
- package/dist/packages/device-bridge/src/actions/dnd.js +70 -0
- package/dist/packages/device-bridge/src/actions/dnd.js.map +1 -0
- package/dist/packages/device-bridge/src/actions/index.d.ts +10 -0
- package/dist/packages/device-bridge/src/actions/index.js +46 -0
- package/dist/packages/device-bridge/src/actions/index.js.map +1 -0
- package/dist/packages/device-bridge/src/actions/messaging.d.ts +18 -0
- package/dist/packages/device-bridge/src/actions/messaging.js +101 -0
- package/dist/packages/device-bridge/src/actions/messaging.js.map +1 -0
- package/dist/packages/device-bridge/src/actions/navigation.d.ts +14 -0
- package/dist/packages/device-bridge/src/actions/navigation.js +114 -0
- package/dist/packages/device-bridge/src/actions/navigation.js.map +1 -0
- package/dist/packages/device-bridge/src/actions/queue-poller.d.ts +45 -0
- package/dist/packages/device-bridge/src/actions/queue-poller.js +142 -0
- package/dist/packages/device-bridge/src/actions/queue-poller.js.map +1 -0
- package/dist/packages/device-bridge/src/background.d.ts +32 -0
- package/dist/packages/device-bridge/src/background.js +138 -0
- package/dist/packages/device-bridge/src/background.js.map +1 -0
- package/dist/packages/device-bridge/src/capabilities.d.ts +18 -0
- package/dist/packages/device-bridge/src/capabilities.js +169 -0
- package/dist/packages/device-bridge/src/capabilities.js.map +1 -0
- package/dist/packages/device-bridge/src/collectors/battery.d.ts +10 -0
- package/dist/packages/device-bridge/src/collectors/battery.js +72 -0
- package/dist/packages/device-bridge/src/collectors/battery.js.map +1 -0
- package/dist/packages/device-bridge/src/collectors/calendar.d.ts +24 -0
- package/dist/packages/device-bridge/src/collectors/calendar.js +174 -0
- package/dist/packages/device-bridge/src/collectors/calendar.js.map +1 -0
- package/dist/packages/device-bridge/src/collectors/connectivity.d.ts +10 -0
- package/dist/packages/device-bridge/src/collectors/connectivity.js +88 -0
- package/dist/packages/device-bridge/src/collectors/connectivity.js.map +1 -0
- package/dist/packages/device-bridge/src/collectors/contacts.d.ts +19 -0
- package/dist/packages/device-bridge/src/collectors/contacts.js +108 -0
- package/dist/packages/device-bridge/src/collectors/contacts.js.map +1 -0
- package/dist/packages/device-bridge/src/collectors/index.d.ts +11 -0
- package/dist/packages/device-bridge/src/collectors/index.js +47 -0
- package/dist/packages/device-bridge/src/collectors/index.js.map +1 -0
- package/dist/packages/device-bridge/src/collectors/location.d.ts +18 -0
- package/dist/packages/device-bridge/src/collectors/location.js +129 -0
- package/dist/packages/device-bridge/src/collectors/location.js.map +1 -0
- package/dist/packages/device-bridge/src/collectors/notifications.d.ts +28 -0
- package/dist/packages/device-bridge/src/collectors/notifications.js +100 -0
- package/dist/packages/device-bridge/src/collectors/notifications.js.map +1 -0
- package/dist/packages/device-bridge/src/dynamic-connector.d.ts +63 -0
- package/dist/packages/device-bridge/src/dynamic-connector.js +345 -0
- package/dist/packages/device-bridge/src/dynamic-connector.js.map +1 -0
- package/dist/packages/device-bridge/src/index.d.ts +108 -0
- package/dist/packages/device-bridge/src/index.js +334 -0
- package/dist/packages/device-bridge/src/index.js.map +1 -0
- package/dist/packages/device-bridge/src/plugin.d.ts +39 -0
- package/dist/packages/device-bridge/src/plugin.js +57 -0
- package/dist/packages/device-bridge/src/plugin.js.map +1 -0
- package/dist/packages/device-bridge/src/relay-client.d.ts +57 -0
- package/dist/packages/device-bridge/src/relay-client.js +175 -0
- package/dist/packages/device-bridge/src/relay-client.js.map +1 -0
- package/dist/packages/device-bridge/src/types.d.ts +216 -0
- package/dist/packages/device-bridge/src/types.js +5 -0
- package/dist/packages/device-bridge/src/types.js.map +1 -0
- package/dist/plugin.d.ts +40 -0
- package/dist/plugin.js +56 -0
- package/dist/plugin.js.map +1 -0
- package/dist/relay-client.d.ts +53 -0
- package/dist/relay-client.js +168 -0
- package/dist/relay-client.js.map +1 -0
- package/dist/src/bridge/factory.d.ts +8 -0
- package/dist/src/bridge/factory.js +706 -0
- package/dist/src/bridge/factory.js.map +1 -0
- package/dist/src/bridge/index.d.ts +8 -0
- package/dist/src/bridge/index.js +10 -0
- package/dist/src/bridge/index.js.map +1 -0
- package/dist/src/bridge/types.d.ts +188 -0
- package/dist/src/bridge/types.js +8 -0
- package/dist/src/bridge/types.js.map +1 -0
- package/dist/types.d.ts +212 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -0
- package/src/actions/calendar-actions.ts +213 -0
- package/src/actions/dnd.ts +74 -0
- package/src/actions/index.ts +11 -0
- package/src/actions/messaging.ts +74 -0
- package/src/actions/navigation.ts +88 -0
- package/src/actions/queue-poller.ts +139 -0
- package/src/background.ts +124 -0
- package/src/capabilities.ts +138 -0
- package/src/collectors/battery.ts +45 -0
- package/src/collectors/calendar.ts +155 -0
- package/src/collectors/connectivity.ts +60 -0
- package/src/collectors/contacts.ts +77 -0
- package/src/collectors/index.ts +12 -0
- package/src/collectors/location.ts +98 -0
- package/src/collectors/notifications.ts +70 -0
- package/src/dynamic-connector.ts +415 -0
- package/src/index.ts +356 -0
- package/src/plugin.ts +69 -0
- package/src/relay-client.ts +233 -0
- package/src/types/expo.d.ts +97 -0
- package/src/types.ts +278 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build script: Compile device-bridge TypeScript sources to dist/
|
|
3
|
+
*
|
|
4
|
+
* Uses tsc to compile all TypeScript files to CommonJS JavaScript.
|
|
5
|
+
* Exports are defined in package.json.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* node build-connector.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const { exec } = require('child_process');
|
|
14
|
+
const { promisify } = require('util');
|
|
15
|
+
|
|
16
|
+
const execAsync = promisify(exec);
|
|
17
|
+
|
|
18
|
+
async function build() {
|
|
19
|
+
const distDir = path.join(__dirname, 'dist');
|
|
20
|
+
const indexOut = path.join(distDir, 'index.js');
|
|
21
|
+
const pluginOut = path.join(distDir, 'plugin.js');
|
|
22
|
+
|
|
23
|
+
console.log('[build-connector] Starting build...');
|
|
24
|
+
console.log(`[build-connector] Output dir: ${distDir}`);
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
// Create dist directory
|
|
28
|
+
if (!fs.existsSync(distDir)) {
|
|
29
|
+
fs.mkdirSync(distDir, { recursive: true });
|
|
30
|
+
console.log(`[build-connector] Created ${distDir}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Compile TypeScript with tsc - ignore type errors to emit JS
|
|
34
|
+
console.log('[build-connector] Transpiling TypeScript...');
|
|
35
|
+
// Run tsc but don't fail on error - JS still gets emitted
|
|
36
|
+
await execAsync(
|
|
37
|
+
`(npx tsc --outDir ${distDir} --declaration 2>&1 || true)`,
|
|
38
|
+
{ cwd: __dirname, shell: '/bin/bash' }
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
// Verify main output files exist
|
|
42
|
+
const requiredFiles = [indexOut];
|
|
43
|
+
const missing = requiredFiles.filter(f => !fs.existsSync(f));
|
|
44
|
+
|
|
45
|
+
if (missing.length > 0) {
|
|
46
|
+
throw new Error(`Build failed: missing output files: ${missing.join(', ')}`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
console.log(`[build-connector] ✅ Build successful!`);
|
|
50
|
+
console.log(`[build-connector] Output files:`);
|
|
51
|
+
fs.readdirSync(distDir).forEach(file => {
|
|
52
|
+
const filePath = path.join(distDir, file);
|
|
53
|
+
const stats = fs.statSync(filePath);
|
|
54
|
+
if (stats.isFile()) {
|
|
55
|
+
console.log(` - ${file} (${stats.size} bytes)`);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
} catch (err) {
|
|
59
|
+
console.error('[build-connector] ❌ Build failed:', err.message);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
build();
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calendar Action Executor — creates/modifies events via expo-calendar.
|
|
3
|
+
* Executes 'calendar.create', 'calendar.reschedule', 'calendar.cancel' actions.
|
|
4
|
+
*/
|
|
5
|
+
import type { ActionResult } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* Execute a calendar.create action.
|
|
8
|
+
*
|
|
9
|
+
* Params expected:
|
|
10
|
+
* - title: string
|
|
11
|
+
* - date: string (YYYY-MM-DD)
|
|
12
|
+
* - start_time: string (HH:MM)
|
|
13
|
+
* - end_time?: string (HH:MM)
|
|
14
|
+
* - location?: string
|
|
15
|
+
* - attendees?: string[] (names — no email lookup here)
|
|
16
|
+
* - notes?: string
|
|
17
|
+
*/
|
|
18
|
+
export declare function executeCreate(actionId: string, params: Record<string, unknown>): Promise<ActionResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Execute a calendar.reschedule action.
|
|
21
|
+
*
|
|
22
|
+
* Params expected:
|
|
23
|
+
* - event_id: string
|
|
24
|
+
* - new_date?: string (YYYY-MM-DD)
|
|
25
|
+
* - new_start_time?: string (HH:MM)
|
|
26
|
+
* - new_end_time?: string (HH:MM)
|
|
27
|
+
*/
|
|
28
|
+
export declare function executeReschedule(actionId: string, params: Record<string, unknown>): Promise<ActionResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Execute a calendar.cancel action.
|
|
31
|
+
*
|
|
32
|
+
* Params expected:
|
|
33
|
+
* - event_id: string
|
|
34
|
+
*/
|
|
35
|
+
export declare function executeCancel(actionId: string, params: Record<string, unknown>): Promise<ActionResult>;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calendar Action Executor — creates/modifies events via expo-calendar.
|
|
3
|
+
* Executes 'calendar.create', 'calendar.reschedule', 'calendar.cancel' actions.
|
|
4
|
+
*/
|
|
5
|
+
import * as ExpoCalendar from 'expo-calendar';
|
|
6
|
+
/**
|
|
7
|
+
* Get the default calendar ID for creating events.
|
|
8
|
+
*/
|
|
9
|
+
async function getDefaultCalendarId() {
|
|
10
|
+
const calendars = await ExpoCalendar.getCalendarsAsync(ExpoCalendar.EntityTypes.EVENT);
|
|
11
|
+
// Prefer the default calendar
|
|
12
|
+
const defaultCal = calendars.find(c => c.isPrimary) || calendars[0];
|
|
13
|
+
return defaultCal?.id || null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Execute a calendar.create action.
|
|
17
|
+
*
|
|
18
|
+
* Params expected:
|
|
19
|
+
* - title: string
|
|
20
|
+
* - date: string (YYYY-MM-DD)
|
|
21
|
+
* - start_time: string (HH:MM)
|
|
22
|
+
* - end_time?: string (HH:MM)
|
|
23
|
+
* - location?: string
|
|
24
|
+
* - attendees?: string[] (names — no email lookup here)
|
|
25
|
+
* - notes?: string
|
|
26
|
+
*/
|
|
27
|
+
export async function executeCreate(actionId, params) {
|
|
28
|
+
const title = params.title;
|
|
29
|
+
const date = params.date;
|
|
30
|
+
const startTime = params.start_time;
|
|
31
|
+
const endTime = params.end_time;
|
|
32
|
+
if (!title || !date || !startTime) {
|
|
33
|
+
return {
|
|
34
|
+
id: actionId,
|
|
35
|
+
ok: false,
|
|
36
|
+
error: 'Missing title, date, or start_time',
|
|
37
|
+
executed_at: new Date().toISOString(),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const calendarId = await getDefaultCalendarId();
|
|
42
|
+
if (!calendarId) {
|
|
43
|
+
return {
|
|
44
|
+
id: actionId,
|
|
45
|
+
ok: false,
|
|
46
|
+
error: 'No calendar found on device',
|
|
47
|
+
executed_at: new Date().toISOString(),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const [year, month, day] = date.split('-').map(Number);
|
|
51
|
+
const [startH, startM] = startTime.split(':').map(Number);
|
|
52
|
+
const startDate = new Date(year, month - 1, day, startH, startM);
|
|
53
|
+
let endDate;
|
|
54
|
+
if (endTime) {
|
|
55
|
+
const [endH, endM] = endTime.split(':').map(Number);
|
|
56
|
+
endDate = new Date(year, month - 1, day, endH, endM);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// Default 1 hour duration
|
|
60
|
+
endDate = new Date(startDate.getTime() + 60 * 60 * 1000);
|
|
61
|
+
}
|
|
62
|
+
const eventId = await ExpoCalendar.createEventAsync(calendarId, {
|
|
63
|
+
title,
|
|
64
|
+
startDate,
|
|
65
|
+
endDate,
|
|
66
|
+
location: params.location || undefined,
|
|
67
|
+
notes: params.notes || undefined,
|
|
68
|
+
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
id: actionId,
|
|
72
|
+
ok: true,
|
|
73
|
+
result: {
|
|
74
|
+
event_id: eventId,
|
|
75
|
+
title,
|
|
76
|
+
date,
|
|
77
|
+
start: startTime,
|
|
78
|
+
end: endTime || formatTime(endDate),
|
|
79
|
+
message: `Event "${title}" created successfully`,
|
|
80
|
+
},
|
|
81
|
+
executed_at: new Date().toISOString(),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
return {
|
|
86
|
+
id: actionId,
|
|
87
|
+
ok: false,
|
|
88
|
+
error: `Calendar create failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
89
|
+
executed_at: new Date().toISOString(),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Execute a calendar.reschedule action.
|
|
95
|
+
*
|
|
96
|
+
* Params expected:
|
|
97
|
+
* - event_id: string
|
|
98
|
+
* - new_date?: string (YYYY-MM-DD)
|
|
99
|
+
* - new_start_time?: string (HH:MM)
|
|
100
|
+
* - new_end_time?: string (HH:MM)
|
|
101
|
+
*/
|
|
102
|
+
export async function executeReschedule(actionId, params) {
|
|
103
|
+
const eventId = params.event_id;
|
|
104
|
+
if (!eventId) {
|
|
105
|
+
return {
|
|
106
|
+
id: actionId,
|
|
107
|
+
ok: false,
|
|
108
|
+
error: 'Missing event_id',
|
|
109
|
+
executed_at: new Date().toISOString(),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
const updates = {};
|
|
114
|
+
if (params.new_date && params.new_start_time) {
|
|
115
|
+
const [year, month, day] = params.new_date.split('-').map(Number);
|
|
116
|
+
const [h, m] = params.new_start_time.split(':').map(Number);
|
|
117
|
+
updates.startDate = new Date(year, month - 1, day, h, m);
|
|
118
|
+
if (params.new_end_time) {
|
|
119
|
+
const [eh, em] = params.new_end_time.split(':').map(Number);
|
|
120
|
+
updates.endDate = new Date(year, month - 1, day, eh, em);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
updates.endDate = new Date(updates.startDate.getTime() + 60 * 60 * 1000);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
await ExpoCalendar.updateEventAsync(eventId, updates);
|
|
127
|
+
return {
|
|
128
|
+
id: actionId,
|
|
129
|
+
ok: true,
|
|
130
|
+
result: { event_id: eventId, message: 'Event rescheduled successfully' },
|
|
131
|
+
executed_at: new Date().toISOString(),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
return {
|
|
136
|
+
id: actionId,
|
|
137
|
+
ok: false,
|
|
138
|
+
error: `Calendar reschedule failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
139
|
+
executed_at: new Date().toISOString(),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Execute a calendar.cancel action.
|
|
145
|
+
*
|
|
146
|
+
* Params expected:
|
|
147
|
+
* - event_id: string
|
|
148
|
+
*/
|
|
149
|
+
export async function executeCancel(actionId, params) {
|
|
150
|
+
const eventId = params.event_id;
|
|
151
|
+
if (!eventId) {
|
|
152
|
+
return {
|
|
153
|
+
id: actionId,
|
|
154
|
+
ok: false,
|
|
155
|
+
error: 'Missing event_id',
|
|
156
|
+
executed_at: new Date().toISOString(),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
await ExpoCalendar.deleteEventAsync(eventId);
|
|
161
|
+
return {
|
|
162
|
+
id: actionId,
|
|
163
|
+
ok: true,
|
|
164
|
+
result: { event_id: eventId, message: 'Event cancelled successfully' },
|
|
165
|
+
executed_at: new Date().toISOString(),
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
return {
|
|
170
|
+
id: actionId,
|
|
171
|
+
ok: false,
|
|
172
|
+
error: `Calendar cancel failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
173
|
+
executed_at: new Date().toISOString(),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// ─── Helpers ───
|
|
178
|
+
function formatTime(date) {
|
|
179
|
+
return date.toLocaleTimeString('en-US', {
|
|
180
|
+
hour: '2-digit',
|
|
181
|
+
minute: '2-digit',
|
|
182
|
+
hour12: false,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=calendar-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-actions.js","sourceRoot":"","sources":["../../src/actions/calendar-actions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAG9C;;GAEG;AACH,KAAK,UAAU,oBAAoB;IACjC,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,iBAAiB,CAAC,YAAY,CAAC,WAAW,CA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EAAE,KAAK;YACT,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACtC,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,YAAY,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAE7C,OAAO;YACL,EAAE,EAAE,QAAQ;YACZ,EAAE,EAAE,IAAI;YACR,MAAM,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,8BAA8B,EAAE;YACtE,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACtC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,EAAE,EAAE,QAAQ;YACZ,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,2BAA2B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YAC1F,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACtC,CAAC;IACJ,CAAC;AACH,CAAC;AAED,kBAAkB;AAElB,SAAS,UAAU,CAAC,IAAU;IAC5B,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE;QACtC,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DND Action Executor — manages Do Not Disturb via expo-notifications.
|
|
3
|
+
* Executes 'dnd.set' actions from the action queue.
|
|
4
|
+
*
|
|
5
|
+
* Note: True system-level DND control requires platform-specific APIs:
|
|
6
|
+
* - iOS: Focus modes (requires entitlements)
|
|
7
|
+
* - Android: NotificationManager.setInterruptionFilter (requires DND access)
|
|
8
|
+
*
|
|
9
|
+
* For now, this manages DND state within the PA system:
|
|
10
|
+
* - Stores DND state in relay for the connector to read
|
|
11
|
+
* - Controls notification channel behavior in-app
|
|
12
|
+
*/
|
|
13
|
+
import type { ActionResult, DndState } from '../types';
|
|
14
|
+
/**
|
|
15
|
+
* Get current DND state.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getState(): DndState;
|
|
18
|
+
/**
|
|
19
|
+
* Execute a dnd.set action.
|
|
20
|
+
*
|
|
21
|
+
* Params expected:
|
|
22
|
+
* - enabled?: boolean
|
|
23
|
+
* - schedule_start?: string (HH:MM)
|
|
24
|
+
* - schedule_end?: string (HH:MM)
|
|
25
|
+
* - allowlist?: string[]
|
|
26
|
+
*/
|
|
27
|
+
export declare function execute(actionId: string, params: Record<string, unknown>): Promise<ActionResult>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DND Action Executor — manages Do Not Disturb via expo-notifications.
|
|
3
|
+
* Executes 'dnd.set' actions from the action queue.
|
|
4
|
+
*
|
|
5
|
+
* Note: True system-level DND control requires platform-specific APIs:
|
|
6
|
+
* - iOS: Focus modes (requires entitlements)
|
|
7
|
+
* - Android: NotificationManager.setInterruptionFilter (requires DND access)
|
|
8
|
+
*
|
|
9
|
+
* For now, this manages DND state within the PA system:
|
|
10
|
+
* - Stores DND state in relay for the connector to read
|
|
11
|
+
* - Controls notification channel behavior in-app
|
|
12
|
+
*/
|
|
13
|
+
// In-memory DND state (synced to relay)
|
|
14
|
+
let currentDndState = {
|
|
15
|
+
enabled: false,
|
|
16
|
+
schedule: { start: '22:00', end: '07:00' },
|
|
17
|
+
allowlist: [],
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Get current DND state.
|
|
21
|
+
*/
|
|
22
|
+
export function getState() {
|
|
23
|
+
return { ...currentDndState };
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Execute a dnd.set action.
|
|
27
|
+
*
|
|
28
|
+
* Params expected:
|
|
29
|
+
* - enabled?: boolean
|
|
30
|
+
* - schedule_start?: string (HH:MM)
|
|
31
|
+
* - schedule_end?: string (HH:MM)
|
|
32
|
+
* - allowlist?: string[]
|
|
33
|
+
*/
|
|
34
|
+
export async function execute(actionId, params) {
|
|
35
|
+
try {
|
|
36
|
+
if (params.enabled !== undefined) {
|
|
37
|
+
currentDndState.enabled = params.enabled;
|
|
38
|
+
}
|
|
39
|
+
if (params.schedule_start) {
|
|
40
|
+
currentDndState.schedule.start = params.schedule_start;
|
|
41
|
+
}
|
|
42
|
+
if (params.schedule_end) {
|
|
43
|
+
currentDndState.schedule.end = params.schedule_end;
|
|
44
|
+
}
|
|
45
|
+
if (params.allowlist) {
|
|
46
|
+
currentDndState.allowlist = params.allowlist;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
id: actionId,
|
|
50
|
+
ok: true,
|
|
51
|
+
result: {
|
|
52
|
+
message: `DND ${currentDndState.enabled ? 'enabled' : 'disabled'}`,
|
|
53
|
+
dnd: currentDndState,
|
|
54
|
+
},
|
|
55
|
+
executed_at: new Date().toISOString(),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
return {
|
|
60
|
+
id: actionId,
|
|
61
|
+
ok: false,
|
|
62
|
+
error: `DND set failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
63
|
+
executed_at: new Date().toISOString(),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=dnd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dnd.js","sourceRoot":"","sources":["../../src/actions/dnd.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,wCAAwC;AACxC,IAAI,eAAe,GAAa;IAC9B,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE;IAC1C,SAAS,EAAE,EAAE;CACd,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,QAAQ;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 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action Executors — handle write operations queued by MCP skills.
|
|
3
|
+
* The phone polls for pending actions and executes them natively.
|
|
4
|
+
*/
|
|
5
|
+
export { QueuePoller } from './queue-poller';
|
|
6
|
+
export type { QueuePollerConfig } from './queue-poller';
|
|
7
|
+
export * as messaging from './messaging';
|
|
8
|
+
export * as calendarActions from './calendar-actions';
|
|
9
|
+
export * as dnd from './dnd';
|
|
10
|
+
export * as navigation from './navigation';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action Executors — handle write operations queued by MCP skills.
|
|
3
|
+
* The phone polls for pending actions and executes them natively.
|
|
4
|
+
*/
|
|
5
|
+
export { QueuePoller } from './queue-poller';
|
|
6
|
+
export * as messaging from './messaging';
|
|
7
|
+
export * as calendarActions from './calendar-actions';
|
|
8
|
+
export * as dnd from './dnd';
|
|
9
|
+
export * as navigation from './navigation';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,eAAe,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Messaging Action Executor — sends SMS via expo-sms.
|
|
3
|
+
* Executes 'messaging.send' actions from the action queue.
|
|
4
|
+
*/
|
|
5
|
+
import type { ActionResult } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* Check if SMS is available on this device.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isAvailable(): Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* Execute a messaging.send action.
|
|
12
|
+
*
|
|
13
|
+
* Params expected:
|
|
14
|
+
* - contact_name: string (for display only)
|
|
15
|
+
* - phone: string (phone number to send to)
|
|
16
|
+
* - message: string (message text)
|
|
17
|
+
*/
|
|
18
|
+
export declare function execute(actionId: string, params: Record<string, unknown>): Promise<ActionResult>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Messaging Action Executor — sends SMS via expo-sms.
|
|
3
|
+
* Executes 'messaging.send' actions from the action queue.
|
|
4
|
+
*/
|
|
5
|
+
import * as SMS from 'expo-sms';
|
|
6
|
+
/**
|
|
7
|
+
* Check if SMS is available on this device.
|
|
8
|
+
*/
|
|
9
|
+
export async function isAvailable() {
|
|
10
|
+
return SMS.isAvailableAsync();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Execute a messaging.send action.
|
|
14
|
+
*
|
|
15
|
+
* Params expected:
|
|
16
|
+
* - contact_name: string (for display only)
|
|
17
|
+
* - phone: string (phone number to send to)
|
|
18
|
+
* - message: string (message text)
|
|
19
|
+
*/
|
|
20
|
+
export async function execute(actionId, params) {
|
|
21
|
+
const phone = params.phone;
|
|
22
|
+
const message = params.message;
|
|
23
|
+
if (!phone || !message) {
|
|
24
|
+
return {
|
|
25
|
+
id: actionId,
|
|
26
|
+
ok: false,
|
|
27
|
+
error: 'Missing phone or message parameter',
|
|
28
|
+
executed_at: new Date().toISOString(),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const available = await SMS.isAvailableAsync();
|
|
33
|
+
if (!available) {
|
|
34
|
+
return {
|
|
35
|
+
id: actionId,
|
|
36
|
+
ok: false,
|
|
37
|
+
error: 'SMS not available on this device',
|
|
38
|
+
executed_at: new Date().toISOString(),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// Opens the native SMS compose screen with pre-filled content
|
|
42
|
+
const { result } = await SMS.sendSMSAsync([phone], message);
|
|
43
|
+
return {
|
|
44
|
+
id: actionId,
|
|
45
|
+
ok: result === 'sent' || result === 'unknown', // 'unknown' on Android means it was sent
|
|
46
|
+
result: {
|
|
47
|
+
to: params.contact_name || phone,
|
|
48
|
+
phone,
|
|
49
|
+
message,
|
|
50
|
+
status: result,
|
|
51
|
+
sent_at: new Date().toISOString(),
|
|
52
|
+
},
|
|
53
|
+
executed_at: new Date().toISOString(),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
return {
|
|
58
|
+
id: actionId,
|
|
59
|
+
ok: false,
|
|
60
|
+
error: `SMS send failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
61
|
+
executed_at: new Date().toISOString(),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=messaging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messaging.js","sourceRoot":"","sources":["../../src/actions/messaging.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAGhC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,OAAO,GAAG,CAAC,gBAAgB,EAAE,CAAC;AAChC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,QAAgB,EAChB,MAA+B;IAE/B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAe,CAAC;IACrC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAiB,CAAC;IAEzC,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;QACvB,OAAO;YACL,EAAE,EAAE,QAAQ;YACZ,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,oCAAoC;YAC3C,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACtC,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,gBAAgB,EAAE,CAAC;QAC/C,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO;gBACL,EAAE,EAAE,QAAQ;gBACZ,EAAE,EAAE,KAAK;gBACT,KAAK,EAAE,kCAAkC;gBACzC,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACtC,CAAC;QACJ,CAAC;QAED,8DAA8D;QAC9D,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;QAE5D,OAAO;YACL,EAAE,EAAE,QAAQ;YACZ,EAAE,EAAE,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,SAAS,EAAE,yCAAyC;YACxF,MAAM,EAAE;gBACN,EAAE,EAAE,MAAM,CAAC,YAAY,IAAI,KAAK;gBAChC,KAAK;gBACL,OAAO;gBACP,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aAClC;YACD,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACtC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,EAAE,EAAE,QAAQ;YACZ,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,oBAAoB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YACnF,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACtC,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation Action Executor — opens maps app via expo-linking.
|
|
3
|
+
* Executes 'navigation.start' actions from the action queue.
|
|
4
|
+
*/
|
|
5
|
+
import type { ActionResult } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* Execute a navigation.start action.
|
|
8
|
+
* Opens the native maps app with turn-by-turn directions.
|
|
9
|
+
*
|
|
10
|
+
* Params expected:
|
|
11
|
+
* - destination: string (address or place name)
|
|
12
|
+
* - mode?: 'driving' | 'transit' | 'walking' (default: 'driving')
|
|
13
|
+
*/
|
|
14
|
+
export declare function execute(actionId: string, params: Record<string, unknown>): Promise<ActionResult>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation Action Executor — opens maps app via expo-linking.
|
|
3
|
+
* Executes 'navigation.start' actions from the action queue.
|
|
4
|
+
*/
|
|
5
|
+
import * as Linking from 'expo-linking';
|
|
6
|
+
import { Platform } from 'react-native';
|
|
7
|
+
/**
|
|
8
|
+
* Execute a navigation.start action.
|
|
9
|
+
* Opens the native maps app with turn-by-turn directions.
|
|
10
|
+
*
|
|
11
|
+
* Params expected:
|
|
12
|
+
* - destination: string (address or place name)
|
|
13
|
+
* - mode?: 'driving' | 'transit' | 'walking' (default: 'driving')
|
|
14
|
+
*/
|
|
15
|
+
export async function execute(actionId, params) {
|
|
16
|
+
const destination = params.destination;
|
|
17
|
+
const mode = params.mode || 'driving';
|
|
18
|
+
if (!destination) {
|
|
19
|
+
return {
|
|
20
|
+
id: actionId,
|
|
21
|
+
ok: false,
|
|
22
|
+
error: 'Missing destination parameter',
|
|
23
|
+
executed_at: new Date().toISOString(),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const encodedDest = encodeURIComponent(destination);
|
|
28
|
+
let url;
|
|
29
|
+
if (Platform.OS === 'ios') {
|
|
30
|
+
// Apple Maps with directions
|
|
31
|
+
const modeMap = {
|
|
32
|
+
driving: 'd',
|
|
33
|
+
transit: 'r',
|
|
34
|
+
walking: 'w',
|
|
35
|
+
};
|
|
36
|
+
url = `maps://maps.apple.com/?daddr=${encodedDest}&dirflg=${modeMap[mode] || 'd'}`;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
// Google Maps on Android
|
|
40
|
+
const modeMap = {
|
|
41
|
+
driving: 'driving',
|
|
42
|
+
transit: 'transit',
|
|
43
|
+
walking: 'walking',
|
|
44
|
+
};
|
|
45
|
+
url = `google.navigation:q=${encodedDest}&mode=${modeMap[mode] || 'driving'}`;
|
|
46
|
+
}
|
|
47
|
+
const canOpen = await Linking.canOpenURL(url);
|
|
48
|
+
if (!canOpen) {
|
|
49
|
+
// Fallback to Google Maps web URL
|
|
50
|
+
const webModeMap = {
|
|
51
|
+
driving: 'driving',
|
|
52
|
+
transit: 'transit',
|
|
53
|
+
walking: 'walking',
|
|
54
|
+
};
|
|
55
|
+
url = `https://www.google.com/maps/dir/?api=1&destination=${encodedDest}&travelmode=${webModeMap[mode] || 'driving'}`;
|
|
56
|
+
}
|
|
57
|
+
await Linking.openURL(url);
|
|
58
|
+
return {
|
|
59
|
+
id: actionId,
|
|
60
|
+
ok: true,
|
|
61
|
+
result: {
|
|
62
|
+
message: `Navigation started to ${destination} via ${mode}`,
|
|
63
|
+
destination,
|
|
64
|
+
mode,
|
|
65
|
+
status: 'navigating',
|
|
66
|
+
},
|
|
67
|
+
executed_at: new Date().toISOString(),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
return {
|
|
72
|
+
id: actionId,
|
|
73
|
+
ok: false,
|
|
74
|
+
error: `Navigation failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
75
|
+
executed_at: new Date().toISOString(),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=navigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../src/actions/navigation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGxC;;;;;;;GAOG;AAC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AAG,sDAAsD,WAAW,eAAe,UAAU,CAAC,IAAI,CAAC,IAAI,SAAS,EAAE,CAAC;QACxH,CAAC;QAED,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAE3B,OAAO;YACL,EAAE,EAAE,QAAQ;YACZ,EAAE,EAAE,IAAI;YACR,MAAM,EAAE;gBACN,OAAO,EAAE,yBAAyB,WAAW,QAAQ,IAAI,EAAE;gBAC3D,WAAW;gBACX,IAAI;gBACJ,MAAM,EAAE,YAAY;aACrB;YACD,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACtC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,EAAE,EAAE,QAAQ;YACZ,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,sBAAsB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YACrF,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACtC,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action Queue Poller — polls the relay for pending actions and executes them.
|
|
3
|
+
* Routes each action to the appropriate executor based on action type.
|
|
4
|
+
*/
|
|
5
|
+
import type { RelayClient } from '../relay-client';
|
|
6
|
+
import type { ActionResult } from '../types';
|
|
7
|
+
export interface QueuePollerConfig {
|
|
8
|
+
/** Polling interval in ms (default: 5000) */
|
|
9
|
+
pollInterval?: number;
|
|
10
|
+
/** Relay client instance */
|
|
11
|
+
relayClient: RelayClient;
|
|
12
|
+
/** Callback when an action is executed */
|
|
13
|
+
onActionExecuted?: (result: ActionResult) => void;
|
|
14
|
+
/** Callback for errors */
|
|
15
|
+
onError?: (error: Error) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare class QueuePoller {
|
|
18
|
+
private relayClient;
|
|
19
|
+
private pollInterval;
|
|
20
|
+
private timer;
|
|
21
|
+
private running;
|
|
22
|
+
private onActionExecuted?;
|
|
23
|
+
private onError?;
|
|
24
|
+
constructor(config: QueuePollerConfig);
|
|
25
|
+
/**
|
|
26
|
+
* Start polling for actions.
|
|
27
|
+
*/
|
|
28
|
+
start(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Stop polling.
|
|
31
|
+
*/
|
|
32
|
+
stop(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Check if poller is running.
|
|
35
|
+
*/
|
|
36
|
+
isRunning(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Execute a single poll cycle.
|
|
39
|
+
*/
|
|
40
|
+
private poll;
|
|
41
|
+
/**
|
|
42
|
+
* Route an action to the appropriate executor.
|
|
43
|
+
*/
|
|
44
|
+
private executeAction;
|
|
45
|
+
}
|