@openclaw/google-meet 2026.5.2 → 2026.5.3-beta.2
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/calendar-6EQiwLUb.js +126 -0
- package/dist/chrome-create-B0wV2zaj.js +963 -0
- package/dist/cli-CSyT9_N6.js +1377 -0
- package/dist/create-0ye_2zVk.js +106 -0
- package/dist/index.js +3509 -0
- package/dist/oauth-BJwzuzT-.js +141 -0
- package/package.json +13 -6
- package/google-meet.live.test.ts +0 -85
- package/index.create.test.ts +0 -595
- package/index.test.ts +0 -3616
- package/index.ts +0 -1170
- package/node-host.test.ts +0 -222
- package/src/agent-consult.ts +0 -70
- package/src/calendar.ts +0 -243
- package/src/cli.test.ts +0 -1013
- package/src/cli.ts +0 -2136
- package/src/config.ts +0 -509
- package/src/create.ts +0 -153
- package/src/drive.ts +0 -72
- package/src/google-api-errors.ts +0 -20
- package/src/meet.ts +0 -1024
- package/src/node-host.ts +0 -498
- package/src/oauth.test.ts +0 -71
- package/src/oauth.ts +0 -229
- package/src/realtime-node.ts +0 -271
- package/src/realtime.ts +0 -423
- package/src/runtime.ts +0 -804
- package/src/setup.ts +0 -276
- package/src/test-support/plugin-harness.ts +0 -225
- package/src/transports/chrome-browser-proxy.ts +0 -198
- package/src/transports/chrome-create.ts +0 -367
- package/src/transports/chrome.ts +0 -925
- package/src/transports/twilio.ts +0 -46
- package/src/transports/types.ts +0 -113
- package/src/voice-call-gateway.test.ts +0 -79
- package/src/voice-call-gateway.ts +0 -213
- package/tsconfig.json +0 -16
package/index.create.test.ts
DELETED
|
@@ -1,595 +0,0 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
2
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
-
import plugin, { __testing as googleMeetPluginTesting } from "./index.js";
|
|
4
|
-
import { registerGoogleMeetCli } from "./src/cli.js";
|
|
5
|
-
import { resolveGoogleMeetConfig } from "./src/config.js";
|
|
6
|
-
import type { GoogleMeetRuntime } from "./src/runtime.js";
|
|
7
|
-
import {
|
|
8
|
-
captureStdout,
|
|
9
|
-
invokeGoogleMeetGatewayMethodForTest,
|
|
10
|
-
setupGoogleMeetPlugin,
|
|
11
|
-
} from "./src/test-support/plugin-harness.js";
|
|
12
|
-
import { CREATE_MEET_FROM_BROWSER_SCRIPT } from "./src/transports/chrome-create.js";
|
|
13
|
-
|
|
14
|
-
const voiceCallMocks = vi.hoisted(() => ({
|
|
15
|
-
joinMeetViaVoiceCallGateway: vi.fn(async () => ({
|
|
16
|
-
callId: "call-1",
|
|
17
|
-
dtmfSent: true,
|
|
18
|
-
introSent: true,
|
|
19
|
-
})),
|
|
20
|
-
endMeetVoiceCallGatewayCall: vi.fn(async () => {}),
|
|
21
|
-
speakMeetViaVoiceCallGateway: vi.fn(async () => {}),
|
|
22
|
-
}));
|
|
23
|
-
|
|
24
|
-
const fetchGuardMocks = vi.hoisted(() => ({
|
|
25
|
-
fetchWithSsrFGuard: vi.fn(
|
|
26
|
-
async (params: {
|
|
27
|
-
url: string;
|
|
28
|
-
init?: RequestInit;
|
|
29
|
-
}): Promise<{
|
|
30
|
-
response: Response;
|
|
31
|
-
release: () => Promise<void>;
|
|
32
|
-
}> => ({
|
|
33
|
-
response: await fetch(params.url, params.init),
|
|
34
|
-
release: vi.fn(async () => {}),
|
|
35
|
-
}),
|
|
36
|
-
),
|
|
37
|
-
}));
|
|
38
|
-
|
|
39
|
-
vi.mock("openclaw/plugin-sdk/ssrf-runtime", async (importOriginal) => {
|
|
40
|
-
const actual = await importOriginal<typeof import("openclaw/plugin-sdk/ssrf-runtime")>();
|
|
41
|
-
return {
|
|
42
|
-
...actual,
|
|
43
|
-
fetchWithSsrFGuard: fetchGuardMocks.fetchWithSsrFGuard,
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
vi.mock("./src/voice-call-gateway.js", () => ({
|
|
48
|
-
joinMeetViaVoiceCallGateway: voiceCallMocks.joinMeetViaVoiceCallGateway,
|
|
49
|
-
endMeetVoiceCallGatewayCall: voiceCallMocks.endMeetVoiceCallGatewayCall,
|
|
50
|
-
speakMeetViaVoiceCallGateway: voiceCallMocks.speakMeetViaVoiceCallGateway,
|
|
51
|
-
}));
|
|
52
|
-
|
|
53
|
-
function setup(
|
|
54
|
-
config?: Parameters<typeof setupGoogleMeetPlugin>[1],
|
|
55
|
-
options?: Parameters<typeof setupGoogleMeetPlugin>[2],
|
|
56
|
-
) {
|
|
57
|
-
const harness = setupGoogleMeetPlugin(plugin, config, options);
|
|
58
|
-
googleMeetPluginTesting.setCallGatewayFromCliForTests(
|
|
59
|
-
async (method, _opts, params) =>
|
|
60
|
-
(await invokeGoogleMeetGatewayMethodForTest(harness.methods, method, params)) as Record<
|
|
61
|
-
string,
|
|
62
|
-
unknown
|
|
63
|
-
>,
|
|
64
|
-
);
|
|
65
|
-
googleMeetPluginTesting.setPlatformForTests(() => options?.registerPlatform ?? "darwin");
|
|
66
|
-
return harness;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
async function runCreateMeetBrowserScript(params: { buttonText: string }) {
|
|
70
|
-
const location = {
|
|
71
|
-
href: "https://meet.google.com/new",
|
|
72
|
-
hostname: "meet.google.com",
|
|
73
|
-
};
|
|
74
|
-
const button = {
|
|
75
|
-
disabled: false,
|
|
76
|
-
innerText: params.buttonText,
|
|
77
|
-
textContent: params.buttonText,
|
|
78
|
-
getAttribute: (name: string) => (name === "aria-label" ? params.buttonText : null),
|
|
79
|
-
click: vi.fn(() => {
|
|
80
|
-
location.href = "https://meet.google.com/abc-defg-hij";
|
|
81
|
-
}),
|
|
82
|
-
};
|
|
83
|
-
const document = {
|
|
84
|
-
title: "Meet",
|
|
85
|
-
body: {
|
|
86
|
-
innerText: "Do you want people to hear you in the meeting?",
|
|
87
|
-
textContent: "Do you want people to hear you in the meeting?",
|
|
88
|
-
},
|
|
89
|
-
querySelectorAll: (selector: string) => (selector === "button" ? [button] : []),
|
|
90
|
-
};
|
|
91
|
-
vi.stubGlobal("document", document);
|
|
92
|
-
vi.stubGlobal("location", location);
|
|
93
|
-
const fn = (0, eval)(`(${CREATE_MEET_FROM_BROWSER_SCRIPT})`) as () => Promise<{
|
|
94
|
-
meetingUri?: string;
|
|
95
|
-
manualActionReason?: string;
|
|
96
|
-
notes?: string[];
|
|
97
|
-
retryAfterMs?: number;
|
|
98
|
-
}>;
|
|
99
|
-
return { button, result: await fn() };
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
describe("google-meet create flow", () => {
|
|
103
|
-
beforeEach(() => {
|
|
104
|
-
vi.clearAllMocks();
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
afterEach(() => {
|
|
108
|
-
vi.unstubAllGlobals();
|
|
109
|
-
googleMeetPluginTesting.setCallGatewayFromCliForTests();
|
|
110
|
-
googleMeetPluginTesting.setPlatformForTests();
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it("CLI create can configure API-created space access", async () => {
|
|
114
|
-
const fetchMock = vi.fn(async (input: RequestInfo | URL, _init?: RequestInit) => {
|
|
115
|
-
const url = input instanceof Request ? input.url : input.toString();
|
|
116
|
-
if (url.includes("oauth2.googleapis.com")) {
|
|
117
|
-
return new Response(
|
|
118
|
-
JSON.stringify({
|
|
119
|
-
access_token: "new-access-token",
|
|
120
|
-
expires_in: 3600,
|
|
121
|
-
token_type: "Bearer",
|
|
122
|
-
}),
|
|
123
|
-
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
return new Response(
|
|
127
|
-
JSON.stringify({
|
|
128
|
-
name: "spaces/new-space",
|
|
129
|
-
meetingCode: "new-abcd-xyz",
|
|
130
|
-
meetingUri: "https://meet.google.com/new-abcd-xyz",
|
|
131
|
-
}),
|
|
132
|
-
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
133
|
-
);
|
|
134
|
-
});
|
|
135
|
-
vi.stubGlobal("fetch", fetchMock);
|
|
136
|
-
const program = new Command();
|
|
137
|
-
const stdout = captureStdout();
|
|
138
|
-
registerGoogleMeetCli({
|
|
139
|
-
program,
|
|
140
|
-
config: resolveGoogleMeetConfig({
|
|
141
|
-
oauth: { clientId: "client-id", refreshToken: "refresh-token" },
|
|
142
|
-
}),
|
|
143
|
-
ensureRuntime: async () => ({}) as GoogleMeetRuntime,
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
try {
|
|
147
|
-
await program.parseAsync(
|
|
148
|
-
[
|
|
149
|
-
"googlemeet",
|
|
150
|
-
"create",
|
|
151
|
-
"--no-join",
|
|
152
|
-
"--access-type",
|
|
153
|
-
"OPEN",
|
|
154
|
-
"--entry-point-access",
|
|
155
|
-
"ALL",
|
|
156
|
-
],
|
|
157
|
-
{ from: "user" },
|
|
158
|
-
);
|
|
159
|
-
expect(stdout.output()).toContain("meeting uri: https://meet.google.com/new-abcd-xyz");
|
|
160
|
-
expect(stdout.output()).toContain("space: spaces/new-space");
|
|
161
|
-
expect(fetchMock).toHaveBeenCalledWith(
|
|
162
|
-
"https://meet.googleapis.com/v2/spaces",
|
|
163
|
-
expect.objectContaining({
|
|
164
|
-
method: "POST",
|
|
165
|
-
body: JSON.stringify({ config: { accessType: "OPEN", entryPointAccess: "ALL" } }),
|
|
166
|
-
}),
|
|
167
|
-
);
|
|
168
|
-
} finally {
|
|
169
|
-
stdout.restore();
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
it("can create a Meet through browser fallback without joining when requested", async () => {
|
|
174
|
-
const { methods, nodesInvoke } = setup(
|
|
175
|
-
{
|
|
176
|
-
defaultTransport: "chrome-node",
|
|
177
|
-
chromeNode: { node: "parallels-macos" },
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
nodesInvokeHandler: async (params) => {
|
|
181
|
-
const proxy = params.params as { path?: string; body?: { url?: string } };
|
|
182
|
-
if (proxy.path === "/tabs") {
|
|
183
|
-
return { payload: { result: { tabs: [] } } };
|
|
184
|
-
}
|
|
185
|
-
if (proxy.path === "/tabs/open") {
|
|
186
|
-
return {
|
|
187
|
-
payload: {
|
|
188
|
-
result: {
|
|
189
|
-
targetId: "tab-1",
|
|
190
|
-
title: "Meet",
|
|
191
|
-
url: proxy.body?.url,
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
if (proxy.path === "/act") {
|
|
197
|
-
return {
|
|
198
|
-
payload: {
|
|
199
|
-
result: {
|
|
200
|
-
ok: true,
|
|
201
|
-
targetId: "tab-1",
|
|
202
|
-
result: {
|
|
203
|
-
meetingUri: "https://meet.google.com/browser-made-url",
|
|
204
|
-
browserUrl: "https://meet.google.com/browser-made-url",
|
|
205
|
-
browserTitle: "Meet",
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
return { payload: { result: { ok: true } } };
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
);
|
|
215
|
-
const handler = methods.get("googlemeet.create") as
|
|
216
|
-
| ((ctx: {
|
|
217
|
-
params: Record<string, unknown>;
|
|
218
|
-
respond: ReturnType<typeof vi.fn>;
|
|
219
|
-
}) => Promise<void>)
|
|
220
|
-
| undefined;
|
|
221
|
-
const respond = vi.fn();
|
|
222
|
-
|
|
223
|
-
await handler?.({ params: { join: false }, respond });
|
|
224
|
-
|
|
225
|
-
expect(respond.mock.calls[0]?.[0]).toBe(true);
|
|
226
|
-
expect(respond.mock.calls[0]?.[1]).toMatchObject({
|
|
227
|
-
source: "browser",
|
|
228
|
-
meetingUri: "https://meet.google.com/browser-made-url",
|
|
229
|
-
joined: false,
|
|
230
|
-
browser: { nodeId: "node-1", targetId: "tab-1" },
|
|
231
|
-
});
|
|
232
|
-
expect(nodesInvoke).toHaveBeenCalledWith(
|
|
233
|
-
expect.objectContaining({
|
|
234
|
-
command: "browser.proxy",
|
|
235
|
-
params: expect.objectContaining({
|
|
236
|
-
path: "/tabs/open",
|
|
237
|
-
body: { url: "https://meet.google.com/new" },
|
|
238
|
-
}),
|
|
239
|
-
}),
|
|
240
|
-
);
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
it("rejects access policy flags when tool create would use browser fallback", async () => {
|
|
244
|
-
const { methods } = setup(
|
|
245
|
-
{
|
|
246
|
-
defaultTransport: "chrome-node",
|
|
247
|
-
chromeNode: { node: "parallels-macos" },
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
nodesInvokeHandler: async () => {
|
|
251
|
-
throw new Error("browser fallback should not run");
|
|
252
|
-
},
|
|
253
|
-
},
|
|
254
|
-
);
|
|
255
|
-
|
|
256
|
-
await expect(
|
|
257
|
-
invokeGoogleMeetGatewayMethodForTest(methods, "googlemeet.create", {
|
|
258
|
-
join: false,
|
|
259
|
-
accessType: "OPEN",
|
|
260
|
-
}),
|
|
261
|
-
).rejects.toThrow("access policy options require OAuth/API room creation");
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
it("reports structured manual action when browser creation needs Google login", async () => {
|
|
265
|
-
const { methods } = setup(
|
|
266
|
-
{
|
|
267
|
-
defaultTransport: "chrome-node",
|
|
268
|
-
chromeNode: { node: "parallels-macos" },
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
nodesInvokeHandler: async (params) => {
|
|
272
|
-
const proxy = params.params as { path?: string; body?: { url?: string } };
|
|
273
|
-
if (proxy.path === "/tabs") {
|
|
274
|
-
return { payload: { result: { tabs: [] } } };
|
|
275
|
-
}
|
|
276
|
-
if (proxy.path === "/tabs/open") {
|
|
277
|
-
return {
|
|
278
|
-
payload: {
|
|
279
|
-
result: {
|
|
280
|
-
targetId: "login-tab",
|
|
281
|
-
title: "New Tab",
|
|
282
|
-
url: proxy.body?.url,
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
if (proxy.path === "/act") {
|
|
288
|
-
return {
|
|
289
|
-
payload: {
|
|
290
|
-
result: {
|
|
291
|
-
ok: true,
|
|
292
|
-
targetId: "login-tab",
|
|
293
|
-
result: {
|
|
294
|
-
manualActionReason: "google-login-required",
|
|
295
|
-
manualAction:
|
|
296
|
-
"Sign in to Google in the OpenClaw browser profile, then retry meeting creation.",
|
|
297
|
-
browserUrl: "https://accounts.google.com/signin",
|
|
298
|
-
browserTitle: "Sign in - Google Accounts",
|
|
299
|
-
notes: ["Sign-in page detected."],
|
|
300
|
-
},
|
|
301
|
-
},
|
|
302
|
-
},
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
throw new Error(`unexpected browser proxy path ${proxy.path}`);
|
|
306
|
-
},
|
|
307
|
-
},
|
|
308
|
-
);
|
|
309
|
-
const handler = methods.get("googlemeet.create") as
|
|
310
|
-
| ((ctx: {
|
|
311
|
-
params: Record<string, unknown>;
|
|
312
|
-
respond: ReturnType<typeof vi.fn>;
|
|
313
|
-
}) => Promise<void>)
|
|
314
|
-
| undefined;
|
|
315
|
-
const respond = vi.fn();
|
|
316
|
-
|
|
317
|
-
await handler?.({ params: {}, respond });
|
|
318
|
-
|
|
319
|
-
expect(respond.mock.calls[0]?.[0]).toBe(false);
|
|
320
|
-
expect(respond.mock.calls[0]?.[1]).toMatchObject({
|
|
321
|
-
source: "browser",
|
|
322
|
-
error:
|
|
323
|
-
"google-login-required: Sign in to Google in the OpenClaw browser profile, then retry meeting creation.",
|
|
324
|
-
manualActionRequired: true,
|
|
325
|
-
manualActionReason: "google-login-required",
|
|
326
|
-
manualActionMessage:
|
|
327
|
-
"Sign in to Google in the OpenClaw browser profile, then retry meeting creation.",
|
|
328
|
-
browser: {
|
|
329
|
-
nodeId: "node-1",
|
|
330
|
-
targetId: "login-tab",
|
|
331
|
-
browserUrl: "https://accounts.google.com/signin",
|
|
332
|
-
browserTitle: "Sign in - Google Accounts",
|
|
333
|
-
notes: ["Sign-in page detected."],
|
|
334
|
-
},
|
|
335
|
-
});
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
it("creates and joins a Meet through the create tool action by default", async () => {
|
|
339
|
-
const { tools, nodesInvoke } = setup(
|
|
340
|
-
{
|
|
341
|
-
defaultTransport: "chrome-node",
|
|
342
|
-
defaultMode: "transcribe",
|
|
343
|
-
chromeNode: { node: "parallels-macos" },
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
nodesInvokeHandler: async (params) => {
|
|
347
|
-
if (params.command === "googlemeet.chrome") {
|
|
348
|
-
return { payload: { launched: true } };
|
|
349
|
-
}
|
|
350
|
-
const proxy = params.params as {
|
|
351
|
-
path?: string;
|
|
352
|
-
body?: { url?: string; targetId?: string; fn?: string };
|
|
353
|
-
};
|
|
354
|
-
if (proxy.path === "/tabs") {
|
|
355
|
-
return { payload: { result: { tabs: [] } } };
|
|
356
|
-
}
|
|
357
|
-
if (proxy.path === "/tabs/open") {
|
|
358
|
-
return {
|
|
359
|
-
payload: {
|
|
360
|
-
result: {
|
|
361
|
-
targetId:
|
|
362
|
-
proxy.body?.url === "https://meet.google.com/new" ? "create-tab" : "join-tab",
|
|
363
|
-
title: "Meet",
|
|
364
|
-
url: proxy.body?.url,
|
|
365
|
-
},
|
|
366
|
-
},
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
if (proxy.path === "/act" && proxy.body?.fn?.includes("meetUrlPattern")) {
|
|
370
|
-
return {
|
|
371
|
-
payload: {
|
|
372
|
-
result: {
|
|
373
|
-
ok: true,
|
|
374
|
-
targetId: "create-tab",
|
|
375
|
-
result: {
|
|
376
|
-
meetingUri: "https://meet.google.com/new-abcd-xyz",
|
|
377
|
-
browserUrl: "https://meet.google.com/new-abcd-xyz",
|
|
378
|
-
browserTitle: "Meet",
|
|
379
|
-
},
|
|
380
|
-
},
|
|
381
|
-
},
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
if (proxy.path === "/act") {
|
|
385
|
-
return {
|
|
386
|
-
payload: {
|
|
387
|
-
result: {
|
|
388
|
-
ok: true,
|
|
389
|
-
targetId: "join-tab",
|
|
390
|
-
result: JSON.stringify({
|
|
391
|
-
inCall: true,
|
|
392
|
-
micMuted: false,
|
|
393
|
-
title: "Meet call",
|
|
394
|
-
url: "https://meet.google.com/new-abcd-xyz",
|
|
395
|
-
}),
|
|
396
|
-
},
|
|
397
|
-
},
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
return { payload: { result: { ok: true } } };
|
|
401
|
-
},
|
|
402
|
-
},
|
|
403
|
-
);
|
|
404
|
-
const tool = tools[0] as {
|
|
405
|
-
execute: (
|
|
406
|
-
id: string,
|
|
407
|
-
params: unknown,
|
|
408
|
-
) => Promise<{
|
|
409
|
-
details: { joined?: boolean; meetingUri?: string; join?: { session: { url: string } } };
|
|
410
|
-
}>;
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
const result = await tool.execute("id", { action: "create" });
|
|
414
|
-
|
|
415
|
-
expect(result.details).toMatchObject({
|
|
416
|
-
source: "browser",
|
|
417
|
-
joined: true,
|
|
418
|
-
meetingUri: "https://meet.google.com/new-abcd-xyz",
|
|
419
|
-
join: { session: { url: "https://meet.google.com/new-abcd-xyz" } },
|
|
420
|
-
});
|
|
421
|
-
expect(nodesInvoke).toHaveBeenCalledWith(
|
|
422
|
-
expect.objectContaining({
|
|
423
|
-
command: "googlemeet.chrome",
|
|
424
|
-
params: expect.objectContaining({
|
|
425
|
-
action: "start",
|
|
426
|
-
url: "https://meet.google.com/new-abcd-xyz",
|
|
427
|
-
launch: false,
|
|
428
|
-
}),
|
|
429
|
-
}),
|
|
430
|
-
);
|
|
431
|
-
});
|
|
432
|
-
|
|
433
|
-
it("returns structured manual action from the create tool action", async () => {
|
|
434
|
-
const { tools } = setup(
|
|
435
|
-
{
|
|
436
|
-
defaultTransport: "chrome-node",
|
|
437
|
-
chromeNode: { node: "parallels-macos" },
|
|
438
|
-
},
|
|
439
|
-
{
|
|
440
|
-
nodesInvokeHandler: async (params) => {
|
|
441
|
-
const proxy = params.params as { path?: string; body?: { url?: string } };
|
|
442
|
-
if (proxy.path === "/tabs") {
|
|
443
|
-
return { payload: { result: { tabs: [] } } };
|
|
444
|
-
}
|
|
445
|
-
if (proxy.path === "/tabs/open") {
|
|
446
|
-
return {
|
|
447
|
-
payload: {
|
|
448
|
-
result: {
|
|
449
|
-
targetId: "permission-tab",
|
|
450
|
-
title: "Meet",
|
|
451
|
-
url: proxy.body?.url,
|
|
452
|
-
},
|
|
453
|
-
},
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
if (proxy.path === "/act") {
|
|
457
|
-
return {
|
|
458
|
-
payload: {
|
|
459
|
-
result: {
|
|
460
|
-
ok: true,
|
|
461
|
-
targetId: "permission-tab",
|
|
462
|
-
result: {
|
|
463
|
-
manualActionReason: "meet-permission-required",
|
|
464
|
-
manualAction:
|
|
465
|
-
"Allow microphone/camera permissions for Meet in the OpenClaw browser profile, then retry meeting creation.",
|
|
466
|
-
browserUrl: "https://meet.google.com/new",
|
|
467
|
-
browserTitle: "Meet",
|
|
468
|
-
},
|
|
469
|
-
},
|
|
470
|
-
},
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
throw new Error(`unexpected browser proxy path ${proxy.path}`);
|
|
474
|
-
},
|
|
475
|
-
},
|
|
476
|
-
);
|
|
477
|
-
const tool = tools[0] as {
|
|
478
|
-
execute: (id: string, params: unknown) => Promise<{ details: Record<string, unknown> }>;
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
const result = await tool.execute("id", { action: "create" });
|
|
482
|
-
|
|
483
|
-
expect(result.details).toMatchObject({
|
|
484
|
-
source: "browser",
|
|
485
|
-
manualActionRequired: true,
|
|
486
|
-
manualActionReason: "meet-permission-required",
|
|
487
|
-
manualActionMessage:
|
|
488
|
-
"Allow microphone/camera permissions for Meet in the OpenClaw browser profile, then retry meeting creation.",
|
|
489
|
-
browser: {
|
|
490
|
-
nodeId: "node-1",
|
|
491
|
-
targetId: "permission-tab",
|
|
492
|
-
browserUrl: "https://meet.google.com/new",
|
|
493
|
-
browserTitle: "Meet",
|
|
494
|
-
},
|
|
495
|
-
});
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
it("reuses an existing browser create tab instead of opening duplicates", async () => {
|
|
499
|
-
const { methods, nodesInvoke } = setup(
|
|
500
|
-
{
|
|
501
|
-
defaultTransport: "chrome-node",
|
|
502
|
-
chromeNode: { node: "parallels-macos" },
|
|
503
|
-
},
|
|
504
|
-
{
|
|
505
|
-
nodesInvokeHandler: async (params) => {
|
|
506
|
-
const proxy = params.params as { path?: string; body?: { targetId?: string } };
|
|
507
|
-
if (proxy.path === "/tabs") {
|
|
508
|
-
return {
|
|
509
|
-
payload: {
|
|
510
|
-
result: {
|
|
511
|
-
tabs: [
|
|
512
|
-
{
|
|
513
|
-
targetId: "existing-create-tab",
|
|
514
|
-
title: "Meet",
|
|
515
|
-
url: "https://meet.google.com/new",
|
|
516
|
-
},
|
|
517
|
-
],
|
|
518
|
-
},
|
|
519
|
-
},
|
|
520
|
-
};
|
|
521
|
-
}
|
|
522
|
-
if (proxy.path === "/tabs/focus") {
|
|
523
|
-
return { payload: { result: { ok: true } } };
|
|
524
|
-
}
|
|
525
|
-
if (proxy.path === "/act") {
|
|
526
|
-
return {
|
|
527
|
-
payload: {
|
|
528
|
-
result: {
|
|
529
|
-
ok: true,
|
|
530
|
-
targetId: proxy.body?.targetId ?? "existing-create-tab",
|
|
531
|
-
result: {
|
|
532
|
-
meetingUri: "https://meet.google.com/reu-sedx-tab",
|
|
533
|
-
browserUrl: "https://meet.google.com/reu-sedx-tab",
|
|
534
|
-
browserTitle: "Meet",
|
|
535
|
-
},
|
|
536
|
-
},
|
|
537
|
-
},
|
|
538
|
-
};
|
|
539
|
-
}
|
|
540
|
-
throw new Error(`unexpected browser proxy path ${proxy.path}`);
|
|
541
|
-
},
|
|
542
|
-
},
|
|
543
|
-
);
|
|
544
|
-
const handler = methods.get("googlemeet.create") as
|
|
545
|
-
| ((ctx: {
|
|
546
|
-
params: Record<string, unknown>;
|
|
547
|
-
respond: ReturnType<typeof vi.fn>;
|
|
548
|
-
}) => Promise<void>)
|
|
549
|
-
| undefined;
|
|
550
|
-
const respond = vi.fn();
|
|
551
|
-
|
|
552
|
-
await handler?.({ params: { join: false }, respond });
|
|
553
|
-
|
|
554
|
-
expect(respond.mock.calls[0]?.[0]).toBe(true);
|
|
555
|
-
expect(respond.mock.calls[0]?.[1]).toMatchObject({
|
|
556
|
-
source: "browser",
|
|
557
|
-
meetingUri: "https://meet.google.com/reu-sedx-tab",
|
|
558
|
-
browser: { nodeId: "node-1", targetId: "existing-create-tab" },
|
|
559
|
-
});
|
|
560
|
-
expect(nodesInvoke).toHaveBeenCalledWith(
|
|
561
|
-
expect.objectContaining({
|
|
562
|
-
params: expect.objectContaining({
|
|
563
|
-
path: "/tabs/focus",
|
|
564
|
-
body: { targetId: "existing-create-tab" },
|
|
565
|
-
}),
|
|
566
|
-
}),
|
|
567
|
-
);
|
|
568
|
-
expect(nodesInvoke).not.toHaveBeenCalledWith(
|
|
569
|
-
expect.objectContaining({
|
|
570
|
-
params: expect.objectContaining({ path: "/tabs/open" }),
|
|
571
|
-
}),
|
|
572
|
-
);
|
|
573
|
-
});
|
|
574
|
-
|
|
575
|
-
it.each([
|
|
576
|
-
["Use microphone", "Accepted Meet microphone prompt with browser automation."],
|
|
577
|
-
[
|
|
578
|
-
"Continue without microphone",
|
|
579
|
-
"Continued through Meet microphone prompt with browser automation.",
|
|
580
|
-
],
|
|
581
|
-
])(
|
|
582
|
-
"uses browser automation for Meet's %s choice during browser creation",
|
|
583
|
-
async (buttonText, note) => {
|
|
584
|
-
const { button, result } = await runCreateMeetBrowserScript({ buttonText });
|
|
585
|
-
|
|
586
|
-
expect(result).toMatchObject({
|
|
587
|
-
retryAfterMs: 1000,
|
|
588
|
-
notes: [note],
|
|
589
|
-
});
|
|
590
|
-
expect(button.click).toHaveBeenCalledTimes(1);
|
|
591
|
-
expect(result.meetingUri).toBeUndefined();
|
|
592
|
-
expect(result.manualActionReason).toBeUndefined();
|
|
593
|
-
},
|
|
594
|
-
);
|
|
595
|
-
});
|