doer-agent 0.6.7 → 0.6.8
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/dist/mobile-mcp-server.js +71 -9
- package/package.json +1 -1
|
@@ -42,6 +42,23 @@ async function requestJson(path) {
|
|
|
42
42
|
}
|
|
43
43
|
return data;
|
|
44
44
|
}
|
|
45
|
+
async function postJson(path, body) {
|
|
46
|
+
const config = getConfig();
|
|
47
|
+
const response = await fetch(`${config.serverBaseUrl}${path}`, {
|
|
48
|
+
method: "POST",
|
|
49
|
+
headers: {
|
|
50
|
+
Authorization: `Bearer ${config.agentToken}`,
|
|
51
|
+
Accept: "application/json",
|
|
52
|
+
"Content-Type": "application/json",
|
|
53
|
+
},
|
|
54
|
+
body: JSON.stringify(body),
|
|
55
|
+
});
|
|
56
|
+
const data = await response.json().catch(() => ({}));
|
|
57
|
+
if (!response.ok) {
|
|
58
|
+
throw new Error(typeof data.error === "string" ? data.error : `Doer server returned ${response.status}`);
|
|
59
|
+
}
|
|
60
|
+
return data;
|
|
61
|
+
}
|
|
45
62
|
async function listMobileAgents() {
|
|
46
63
|
const config = getConfig();
|
|
47
64
|
const data = await requestJson(`/api/users/${encodeURIComponent(config.userId)}/agents/${encodeURIComponent(config.agentId)}/mobile-agents`);
|
|
@@ -64,6 +81,24 @@ async function getMobileInfo(deviceId) {
|
|
|
64
81
|
const resolvedDeviceId = await resolveDeviceId(deviceId);
|
|
65
82
|
return await requestJson(`/api/users/${encodeURIComponent(config.userId)}/agents/${encodeURIComponent(config.agentId)}/mobile-agents/${encodeURIComponent(resolvedDeviceId)}/info`);
|
|
66
83
|
}
|
|
84
|
+
async function getMobileActiveNotifications(deviceId) {
|
|
85
|
+
const config = getConfig();
|
|
86
|
+
const resolvedDeviceId = await resolveDeviceId(deviceId);
|
|
87
|
+
const data = await requestJson(`/api/users/${encodeURIComponent(config.userId)}/agents/${encodeURIComponent(config.agentId)}/mobile-agents/${encodeURIComponent(resolvedDeviceId)}/active-notifications`);
|
|
88
|
+
return {
|
|
89
|
+
...data,
|
|
90
|
+
notifications: Array.isArray(data.notifications) ? data.notifications : [],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
async function showMobileNotification(args) {
|
|
94
|
+
const config = getConfig();
|
|
95
|
+
const resolvedDeviceId = await resolveDeviceId(args.deviceId);
|
|
96
|
+
return await postJson(`/api/users/${encodeURIComponent(config.userId)}/agents/${encodeURIComponent(config.agentId)}/mobile-agents/${encodeURIComponent(resolvedDeviceId)}/show-notification`, {
|
|
97
|
+
title: args.title,
|
|
98
|
+
text: args.text,
|
|
99
|
+
notificationId: args.notificationId,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
67
102
|
async function getMobileLogs(args) {
|
|
68
103
|
const config = getConfig();
|
|
69
104
|
const resolvedDeviceId = await resolveDeviceId(args.deviceId);
|
|
@@ -139,9 +174,9 @@ async function main() {
|
|
|
139
174
|
capabilities: {
|
|
140
175
|
tools: {},
|
|
141
176
|
},
|
|
142
|
-
instructions: "Inspect mobile
|
|
177
|
+
instructions: "Inspect and control mobile devices paired with the current Doer agent. Use list/get/read/search tools for device context, and show tools for user-visible mobile actions.",
|
|
143
178
|
});
|
|
144
|
-
server.registerTool("
|
|
179
|
+
server.registerTool("mobile_list_devices", {
|
|
145
180
|
description: "List mobile agents paired with the current Doer agent.",
|
|
146
181
|
inputSchema: {},
|
|
147
182
|
}, async () => {
|
|
@@ -151,7 +186,7 @@ async function main() {
|
|
|
151
186
|
structuredContent: { mobileAgents },
|
|
152
187
|
};
|
|
153
188
|
});
|
|
154
|
-
server.registerTool("
|
|
189
|
+
server.registerTool("mobile_get_device_info", {
|
|
155
190
|
description: "Read info for a mobile agent. Defaults to the first registered device.",
|
|
156
191
|
inputSchema: {
|
|
157
192
|
deviceId: z.string().optional().describe("Mobile device id. Defaults to the first registered mobile agent."),
|
|
@@ -163,7 +198,7 @@ async function main() {
|
|
|
163
198
|
structuredContent: result,
|
|
164
199
|
};
|
|
165
200
|
});
|
|
166
|
-
server.registerTool("
|
|
201
|
+
server.registerTool("mobile_read_event_logs", {
|
|
167
202
|
description: "Read a cursor-based page of mobile log events from the device-local SQLite log.",
|
|
168
203
|
inputSchema: {
|
|
169
204
|
afterSeq: z.number().int().min(0).optional().describe("Return events newer than this seq, in ascending order."),
|
|
@@ -178,7 +213,7 @@ async function main() {
|
|
|
178
213
|
structuredContent: page,
|
|
179
214
|
};
|
|
180
215
|
});
|
|
181
|
-
server.registerTool("
|
|
216
|
+
server.registerTool("mobile_search_event_logs", {
|
|
182
217
|
description: "Search the device-local mobile SQLite event log by kind, text query, cursor, and observed time range.",
|
|
183
218
|
inputSchema: {
|
|
184
219
|
afterSeq: z.number().int().min(0).optional().describe("Return matching events newer than this seq, in ascending order."),
|
|
@@ -197,7 +232,7 @@ async function main() {
|
|
|
197
232
|
structuredContent: page,
|
|
198
233
|
};
|
|
199
234
|
});
|
|
200
|
-
server.registerTool("
|
|
235
|
+
server.registerTool("mobile_get_latest_location", {
|
|
201
236
|
description: "Return the latest location event from recent mobile logs.",
|
|
202
237
|
inputSchema: {
|
|
203
238
|
deviceId: z.string().optional().describe("Mobile device id. Defaults to the first registered mobile agent."),
|
|
@@ -211,7 +246,7 @@ async function main() {
|
|
|
211
246
|
structuredContent: { location },
|
|
212
247
|
};
|
|
213
248
|
});
|
|
214
|
-
server.registerTool("
|
|
249
|
+
server.registerTool("mobile_search_location_logs", {
|
|
215
250
|
description: "Return time-range location events recorded by the mobile agent.",
|
|
216
251
|
inputSchema: {
|
|
217
252
|
afterSeq: z.number().int().min(0).optional().describe("Return location events newer than this seq, in ascending order."),
|
|
@@ -230,8 +265,35 @@ async function main() {
|
|
|
230
265
|
structuredContent: result,
|
|
231
266
|
};
|
|
232
267
|
});
|
|
233
|
-
server.registerTool("
|
|
234
|
-
description: "Return
|
|
268
|
+
server.registerTool("mobile_get_active_notifications", {
|
|
269
|
+
description: "Return the current active notification snapshot from a mobile device without storing it in the log.",
|
|
270
|
+
inputSchema: {
|
|
271
|
+
deviceId: z.string().optional().describe("Mobile device id. Defaults to the first registered mobile agent."),
|
|
272
|
+
},
|
|
273
|
+
}, async ({ deviceId }) => {
|
|
274
|
+
const snapshot = await getMobileActiveNotifications(deviceId);
|
|
275
|
+
return {
|
|
276
|
+
content: [{ type: "text", text: formatJson(snapshot) }],
|
|
277
|
+
structuredContent: snapshot,
|
|
278
|
+
};
|
|
279
|
+
});
|
|
280
|
+
server.registerTool("mobile_show_alert_notification", {
|
|
281
|
+
description: "Show a high-priority notification on a mobile device through the Doer mobile agent.",
|
|
282
|
+
inputSchema: {
|
|
283
|
+
deviceId: z.string().optional().describe("Mobile device id. Defaults to the first registered mobile agent."),
|
|
284
|
+
title: z.string().min(1).describe("Notification title."),
|
|
285
|
+
text: z.string().min(1).describe("Notification body text."),
|
|
286
|
+
notificationId: z.number().int().optional().describe("Optional Android notification id. Reusing an id updates the existing notification."),
|
|
287
|
+
},
|
|
288
|
+
}, async ({ deviceId, title, text, notificationId }) => {
|
|
289
|
+
const result = await showMobileNotification({ deviceId, title, text, notificationId });
|
|
290
|
+
return {
|
|
291
|
+
content: [{ type: "text", text: formatJson(result) }],
|
|
292
|
+
structuredContent: result,
|
|
293
|
+
};
|
|
294
|
+
});
|
|
295
|
+
server.registerTool("mobile_search_notification_logs", {
|
|
296
|
+
description: "Return recent notification events stored in mobile logs.",
|
|
235
297
|
inputSchema: {
|
|
236
298
|
deviceId: z.string().optional().describe("Mobile device id. Defaults to the first registered mobile agent."),
|
|
237
299
|
limit: z.number().int().min(1).max(1000).optional().describe("How many recent events to scan."),
|