@qawolf/run-globals-android 1.0.0 → 1.2.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/dist/emulator/adb.d.ts +23 -0
- package/dist/emulator/adb.d.ts.map +1 -0
- package/dist/emulator/adb.js +43 -0
- package/dist/emulator/adb.js.map +1 -0
- package/dist/emulator/captureAudioOutput.d.ts +40 -0
- package/dist/emulator/captureAudioOutput.d.ts.map +1 -0
- package/dist/emulator/captureAudioOutput.js +73 -0
- package/dist/emulator/captureAudioOutput.js.map +1 -0
- package/dist/emulator/index.d.ts +3 -0
- package/dist/emulator/index.d.ts.map +1 -1
- package/dist/emulator/index.js +3 -0
- package/dist/emulator/index.js.map +1 -1
- package/dist/emulator/passAudioAsMicrophoneInput.d.ts +28 -0
- package/dist/emulator/passAudioAsMicrophoneInput.d.ts.map +1 -0
- package/dist/emulator/passAudioAsMicrophoneInput.js +69 -0
- package/dist/emulator/passAudioAsMicrophoneInput.js.map +1 -0
- package/dist/emulator/playAutomation.d.ts +1 -6
- package/dist/emulator/playAutomation.d.ts.map +1 -1
- package/dist/emulator/playAutomation.js +1 -1
- package/dist/emulator/playAutomation.js.map +1 -1
- package/dist/emulator/setVirtualSceneImage.d.ts +1 -4
- package/dist/emulator/setVirtualSceneImage.d.ts.map +1 -1
- package/dist/emulator/setVirtualSceneImage.js +1 -1
- package/dist/emulator/setVirtualSceneImage.js.map +1 -1
- package/dist/emulator/typings.d.ts +83 -10
- package/package.json +2 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type RunCommandOptions } from "./runCommand.js";
|
|
2
|
+
/**
|
|
3
|
+
* Run an `adb` command and return its combined stdout/stderr.
|
|
4
|
+
*
|
|
5
|
+
* Pass the arguments either as a single string for convenience, or as an array.
|
|
6
|
+
* A string is split on whitespace and supports quoting a single value that
|
|
7
|
+
* contains spaces; it does not go through a shell. When building arguments
|
|
8
|
+
* programmatically, prefer the array form so no quoting is needed.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // adb shell input keyevent 26
|
|
12
|
+
* await adb("shell input keyevent 26");
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // a path with spaces, quoted in a string...
|
|
16
|
+
* await adb("pull '/sdcard/Recordings/My recording 1.m4a' /tmp/out.m4a");
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // ...or as a single array element, with no quoting to reason about
|
|
20
|
+
* await adb(["pull", "/sdcard/Recordings/My recording 1.m4a", destination]);
|
|
21
|
+
*/
|
|
22
|
+
export declare function adb(command: string | string[], runCommandOptions?: Omit<RunCommandOptions, "args">): Promise<string>;
|
|
23
|
+
//# sourceMappingURL=adb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adb.d.ts","sourceRoot":"","sources":["../../src/emulator/adb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAc,MAAM,iBAAiB,CAAC;AAuBrE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,GAAG,CACvB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,iBAAiB,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,GAClD,OAAO,CAAC,MAAM,CAAC,CAIjB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { runCommand } from "./runCommand.js";
|
|
2
|
+
/**
|
|
3
|
+
* Split an `adb` command string into arguments, honoring single or double
|
|
4
|
+
* quotes around a value that contains spaces (for example a file path).
|
|
5
|
+
*
|
|
6
|
+
* This is a deliberately small tokenizer, not a shell: it does not expand
|
|
7
|
+
* variables, run pipes, or handle escaped or mid-token quotes. For anything
|
|
8
|
+
* beyond quoting a value with spaces, pass the arguments as an array instead.
|
|
9
|
+
*/
|
|
10
|
+
function splitCommand(command) {
|
|
11
|
+
const tokens = command.match(/'[^']*'|"[^"]*"|\S+/g) ?? [];
|
|
12
|
+
return tokens.map((token) => {
|
|
13
|
+
const isQuoted = token.length >= 2 &&
|
|
14
|
+
((token.startsWith("'") && token.endsWith("'")) ||
|
|
15
|
+
(token.startsWith('"') && token.endsWith('"')));
|
|
16
|
+
return isQuoted ? token.slice(1, -1) : token;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Run an `adb` command and return its combined stdout/stderr.
|
|
21
|
+
*
|
|
22
|
+
* Pass the arguments either as a single string for convenience, or as an array.
|
|
23
|
+
* A string is split on whitespace and supports quoting a single value that
|
|
24
|
+
* contains spaces; it does not go through a shell. When building arguments
|
|
25
|
+
* programmatically, prefer the array form so no quoting is needed.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // adb shell input keyevent 26
|
|
29
|
+
* await adb("shell input keyevent 26");
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // a path with spaces, quoted in a string...
|
|
33
|
+
* await adb("pull '/sdcard/Recordings/My recording 1.m4a' /tmp/out.m4a");
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // ...or as a single array element, with no quoting to reason about
|
|
37
|
+
* await adb(["pull", "/sdcard/Recordings/My recording 1.m4a", destination]);
|
|
38
|
+
*/
|
|
39
|
+
export async function adb(command, runCommandOptions) {
|
|
40
|
+
const args = typeof command === "string" ? splitCommand(command) : command;
|
|
41
|
+
return await runCommand("adb", { args, ...runCommandOptions });
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=adb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adb.js","sourceRoot":"","sources":["../../src/emulator/adb.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAErE;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,OAAe;IACnC,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,sBAAsB,CAAC,IAAI,EAAE,CAAC;IAE3D,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1B,MAAM,QAAQ,GACZ,KAAK,CAAC,MAAM,IAAI,CAAC;YACjB,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBAC7C,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAEpD,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CACvB,OAA0B,EAC1B,iBAAmD;IAEnD,MAAM,IAAI,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAE3E,OAAO,MAAM,UAAU,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,GAAG,iBAAiB,EAAE,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type RunCommandOptions } from "./runCommand.js";
|
|
3
|
+
declare const captureAudioOutputOptions: z.ZodObject<{
|
|
4
|
+
delaySeconds: z.ZodOptional<z.ZodNumber>;
|
|
5
|
+
durationSeconds: z.ZodNumber;
|
|
6
|
+
outputPath: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export type CaptureAudioOutputOptions = z.input<typeof captureAudioOutputOptions>;
|
|
9
|
+
/**
|
|
10
|
+
* Capture the emulator's audio output to a file on the runner host.
|
|
11
|
+
*
|
|
12
|
+
* The mirror of `passAudioAsMicrophoneInput`: where injection plays audio into
|
|
13
|
+
* the emulator's microphone with `ffplay`, this records what the emulator plays
|
|
14
|
+
* out of its speaker. The emulator's output sink exposes a PulseAudio monitor
|
|
15
|
+
* source (`virtual_speaker.monitor`), and `ffmpeg` reads from it on the runner
|
|
16
|
+
* host over the existing pulse tunnel (`PULSE_SERVER`). This wraps the recording
|
|
17
|
+
* flags so flow authors do not have to know them.
|
|
18
|
+
*
|
|
19
|
+
* Recording from a live source has no natural end, so `durationSeconds` is
|
|
20
|
+
* required.
|
|
21
|
+
*
|
|
22
|
+
* Note: `virtual_mic` is mastered on `virtual_speaker.monitor`, so audio
|
|
23
|
+
* injected via `passAudioAsMicrophoneInput` also passes through the sink. A
|
|
24
|
+
* recording taken while injecting concurrently will therefore include the
|
|
25
|
+
* injected audio; pure output capture (no simultaneous injection) is clean.
|
|
26
|
+
*
|
|
27
|
+
* @param options recording options
|
|
28
|
+
* @param runCommandOptions optional options forwarded to runCommand
|
|
29
|
+
* @returns the path the recording was written to (the given `outputPath`)
|
|
30
|
+
* @throws if the command failed
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* await captureAudioOutput({
|
|
34
|
+
* outputPath: `${process.env.TEAM_STORAGE_DIR}/output.wav`,
|
|
35
|
+
* durationSeconds: 5,
|
|
36
|
+
* });
|
|
37
|
+
*/
|
|
38
|
+
export declare function captureAudioOutput(options: CaptureAudioOutputOptions, runCommandOptions?: Omit<RunCommandOptions, "args">): Promise<string>;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=captureAudioOutput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captureAudioOutput.d.ts","sourceRoot":"","sources":["../../src/emulator/captureAudioOutput.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,iBAAiB,EAAc,MAAM,iBAAiB,CAAC;AAErE,QAAA,MAAM,yBAAyB;;;;iBAO7B,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,yBAAyB,CACjC,CAAC;AAUF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,yBAAyB,EAClC,iBAAiB,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,GAClD,OAAO,CAAC,MAAM,CAAC,CAiCjB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import ms from "ms";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { runCommand } from "./runCommand.js";
|
|
4
|
+
const captureAudioOutputOptions = z.object({
|
|
5
|
+
/** Delay in seconds before recording starts. */
|
|
6
|
+
delaySeconds: z.number().nonnegative().optional(),
|
|
7
|
+
/** How long to record, in seconds. */
|
|
8
|
+
durationSeconds: z.number().positive(),
|
|
9
|
+
/** File path on the runner host to write the recording to. */
|
|
10
|
+
outputPath: z.string().min(1),
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* ffmpeg records for `durationSeconds`, and `runCommand` kills it at its
|
|
14
|
+
* timeout (1 minute by default). When the requested duration would exceed that
|
|
15
|
+
* default, we raise the timeout to cover it plus this margin (startup/teardown
|
|
16
|
+
* slack).
|
|
17
|
+
*/
|
|
18
|
+
const timeoutMarginSeconds = 30;
|
|
19
|
+
/**
|
|
20
|
+
* Capture the emulator's audio output to a file on the runner host.
|
|
21
|
+
*
|
|
22
|
+
* The mirror of `passAudioAsMicrophoneInput`: where injection plays audio into
|
|
23
|
+
* the emulator's microphone with `ffplay`, this records what the emulator plays
|
|
24
|
+
* out of its speaker. The emulator's output sink exposes a PulseAudio monitor
|
|
25
|
+
* source (`virtual_speaker.monitor`), and `ffmpeg` reads from it on the runner
|
|
26
|
+
* host over the existing pulse tunnel (`PULSE_SERVER`). This wraps the recording
|
|
27
|
+
* flags so flow authors do not have to know them.
|
|
28
|
+
*
|
|
29
|
+
* Recording from a live source has no natural end, so `durationSeconds` is
|
|
30
|
+
* required.
|
|
31
|
+
*
|
|
32
|
+
* Note: `virtual_mic` is mastered on `virtual_speaker.monitor`, so audio
|
|
33
|
+
* injected via `passAudioAsMicrophoneInput` also passes through the sink. A
|
|
34
|
+
* recording taken while injecting concurrently will therefore include the
|
|
35
|
+
* injected audio; pure output capture (no simultaneous injection) is clean.
|
|
36
|
+
*
|
|
37
|
+
* @param options recording options
|
|
38
|
+
* @param runCommandOptions optional options forwarded to runCommand
|
|
39
|
+
* @returns the path the recording was written to (the given `outputPath`)
|
|
40
|
+
* @throws if the command failed
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* await captureAudioOutput({
|
|
44
|
+
* outputPath: `${process.env.TEAM_STORAGE_DIR}/output.wav`,
|
|
45
|
+
* durationSeconds: 5,
|
|
46
|
+
* });
|
|
47
|
+
*/
|
|
48
|
+
export async function captureAudioOutput(options, runCommandOptions) {
|
|
49
|
+
const { delaySeconds, durationSeconds, outputPath } = captureAudioOutputOptions.parse(options);
|
|
50
|
+
if (delaySeconds)
|
|
51
|
+
await new Promise((resolve) => setTimeout(resolve, delaySeconds * 1000));
|
|
52
|
+
const args = [
|
|
53
|
+
"-hide_banner",
|
|
54
|
+
"-loglevel",
|
|
55
|
+
"error",
|
|
56
|
+
"-f",
|
|
57
|
+
"pulse",
|
|
58
|
+
"-i",
|
|
59
|
+
"virtual_speaker.monitor",
|
|
60
|
+
"-t",
|
|
61
|
+
String(durationSeconds),
|
|
62
|
+
"-y",
|
|
63
|
+
outputPath,
|
|
64
|
+
];
|
|
65
|
+
const timeout = Math.max(ms("1m"), (durationSeconds + timeoutMarginSeconds) * 1000);
|
|
66
|
+
await runCommand("ffmpeg", {
|
|
67
|
+
args,
|
|
68
|
+
timeout,
|
|
69
|
+
...runCommandOptions,
|
|
70
|
+
});
|
|
71
|
+
return outputPath;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=captureAudioOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"captureAudioOutput.js","sourceRoot":"","sources":["../../src/emulator/captureAudioOutput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAA0B,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAErE,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,gDAAgD;IAChD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IACjD,sCAAsC;IACtC,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACtC,8DAA8D;IAC9D,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC9B,CAAC,CAAC;AAMH;;;;;GAKG;AACH,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,OAAkC,EAClC,iBAAmD;IAEnD,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,GACjD,yBAAyB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAE3C,IAAI,YAAY;QACd,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC;IAE3E,MAAM,IAAI,GAAG;QACX,cAAc;QACd,WAAW;QACX,OAAO;QACP,IAAI;QACJ,OAAO;QACP,IAAI;QACJ,yBAAyB;QACzB,IAAI;QACJ,MAAM,CAAC,eAAe,CAAC;QACvB,IAAI;QACJ,UAAU;KACX,CAAC;IAEF,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CACtB,EAAE,CAAC,IAAI,CAAC,EACR,CAAC,eAAe,GAAG,oBAAoB,CAAC,GAAG,IAAI,CAChD,CAAC;IAEF,MAAM,UAAU,CAAC,QAAQ,EAAE;QACzB,IAAI;QACJ,OAAO;QACP,GAAG,iBAAiB;KACrB,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
package/dist/emulator/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export { adb } from "./adb.js";
|
|
2
|
+
export { type CaptureAudioOutputOptions, captureAudioOutput, } from "./captureAudioOutput.js";
|
|
3
|
+
export { type PassAudioAsMicrophoneInputOptions, passAudioAsMicrophoneInput, } from "./passAudioAsMicrophoneInput.js";
|
|
1
4
|
export { type PlayAutomationOptions, playAutomation, } from "./playAutomation.js";
|
|
2
5
|
export { type GeoLocationOptions, setGeoLocation } from "./setGeoLocation.js";
|
|
3
6
|
export { type ProxyOptions, clearProxy, setProxy } from "./setProxy.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/emulator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAC1B,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,kBAAkB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,KAAK,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EACL,KAAK,wBAAwB,EAC7B,oBAAoB,GACrB,MAAM,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/emulator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EACL,KAAK,yBAAyB,EAC9B,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,KAAK,iCAAiC,EACtC,0BAA0B,GAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,KAAK,qBAAqB,EAC1B,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,kBAAkB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,KAAK,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EACL,KAAK,wBAAwB,EAC7B,oBAAoB,GACrB,MAAM,2BAA2B,CAAC"}
|
package/dist/emulator/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export { adb } from "./adb.js";
|
|
2
|
+
export { captureAudioOutput, } from "./captureAudioOutput.js";
|
|
3
|
+
export { passAudioAsMicrophoneInput, } from "./passAudioAsMicrophoneInput.js";
|
|
1
4
|
export { playAutomation, } from "./playAutomation.js";
|
|
2
5
|
export { setGeoLocation } from "./setGeoLocation.js";
|
|
3
6
|
export { clearProxy, setProxy } from "./setProxy.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/emulator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAA2B,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAqB,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAEL,oBAAoB,GACrB,MAAM,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/emulator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAEL,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,0BAA0B,GAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEL,cAAc,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAA2B,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAqB,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAEL,oBAAoB,GACrB,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type RunCommandOptions } from "./runCommand.js";
|
|
3
|
+
declare const passAudioAsMicrophoneInputOptions: z.ZodObject<{
|
|
4
|
+
data: z.ZodString;
|
|
5
|
+
delaySeconds: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export type PassAudioAsMicrophoneInputOptions = z.input<typeof passAudioAsMicrophoneInputOptions>;
|
|
9
|
+
/**
|
|
10
|
+
* Pass an audio file to the emulator as microphone input.
|
|
11
|
+
*
|
|
12
|
+
* The emulator routes host audio into its microphone, and `ffplay` performs the
|
|
13
|
+
* playback on the runner host. This wraps the playback flags so flow authors do
|
|
14
|
+
* not have to know them.
|
|
15
|
+
*
|
|
16
|
+
* @param options playback options
|
|
17
|
+
* @param runCommandOptions optional options forwarded to runCommand
|
|
18
|
+
* @throws if the command failed
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* await passAudioAsMicrophoneInput({ data: `${process.env.TEAM_STORAGE_DIR}/audio.mp3` });
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* await passAudioAsMicrophoneInput({ data: `${process.env.TEAM_STORAGE_DIR}/audio.mp3`, durationSeconds: 10 });
|
|
25
|
+
*/
|
|
26
|
+
export declare function passAudioAsMicrophoneInput(options: PassAudioAsMicrophoneInputOptions, runCommandOptions?: Omit<RunCommandOptions, "args">): Promise<string>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=passAudioAsMicrophoneInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passAudioAsMicrophoneInput.d.ts","sourceRoot":"","sources":["../../src/emulator/passAudioAsMicrophoneInput.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,iBAAiB,EAAc,MAAM,iBAAiB,CAAC;AAErE,QAAA,MAAM,iCAAiC;;;;iBAWrC,CAAC;AAEH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,iCAAiC,CACzC,CAAC;AAUF;;;;;;;;;;;;;;;;GAgBG;AAQH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,iCAAiC,EAC1C,iBAAiB,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,GAClD,OAAO,CAAC,MAAM,CAAC,CA2BjB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import ms from "ms";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { runCommand } from "./runCommand.js";
|
|
4
|
+
const passAudioAsMicrophoneInputOptions = z.object({
|
|
5
|
+
/** File path on the runner host, or URL, for the audio to play. */
|
|
6
|
+
data: z.string().min(1),
|
|
7
|
+
/** Delay in seconds before playback starts. */
|
|
8
|
+
delaySeconds: z.number().nonnegative().optional(),
|
|
9
|
+
/**
|
|
10
|
+
* Maximum playback duration in seconds (`ffplay -t`). Omit to play the whole
|
|
11
|
+
* file, but note playback is still bounded by the command timeout (1 minute
|
|
12
|
+
* by default — pass a larger `runCommandOptions.timeout` for longer audio).
|
|
13
|
+
*/
|
|
14
|
+
durationSeconds: z.number().positive().optional(),
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* ffplay blocks until playback finishes, and `runCommand` kills it at its
|
|
18
|
+
* timeout (1 minute by default). For audio longer than that default, the
|
|
19
|
+
* command would be cut off mid-playback, so when a duration is requested we
|
|
20
|
+
* raise the timeout to cover it plus this margin (network/startup slack).
|
|
21
|
+
*/
|
|
22
|
+
const timeoutMarginSeconds = 30;
|
|
23
|
+
/**
|
|
24
|
+
* Pass an audio file to the emulator as microphone input.
|
|
25
|
+
*
|
|
26
|
+
* The emulator routes host audio into its microphone, and `ffplay` performs the
|
|
27
|
+
* playback on the runner host. This wraps the playback flags so flow authors do
|
|
28
|
+
* not have to know them.
|
|
29
|
+
*
|
|
30
|
+
* @param options playback options
|
|
31
|
+
* @param runCommandOptions optional options forwarded to runCommand
|
|
32
|
+
* @throws if the command failed
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* await passAudioAsMicrophoneInput({ data: `${process.env.TEAM_STORAGE_DIR}/audio.mp3` });
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* await passAudioAsMicrophoneInput({ data: `${process.env.TEAM_STORAGE_DIR}/audio.mp3`, durationSeconds: 10 });
|
|
39
|
+
*/
|
|
40
|
+
// Named `passAudioAsMicrophoneInput`, not `injectAudio`: the name describes what
|
|
41
|
+
// actually happens (the emulator receives the audio as microphone input, it is
|
|
42
|
+
// not played back on a speaker), and it avoids the iOS `injectAudio` clash —
|
|
43
|
+
// `@qawolf/flows/ios` exports its own `injectAudio`, and the generated
|
|
44
|
+
// editor-type bundles flatten both platforms' declarations into one file, where
|
|
45
|
+
// a shared name would be renamed to `injectAudio_2` and leak into iOS author
|
|
46
|
+
// autocomplete.
|
|
47
|
+
export async function passAudioAsMicrophoneInput(options, runCommandOptions) {
|
|
48
|
+
const { data, delaySeconds, durationSeconds } = passAudioAsMicrophoneInputOptions.parse(options);
|
|
49
|
+
if (delaySeconds)
|
|
50
|
+
await new Promise((resolve) => setTimeout(resolve, delaySeconds * 1000));
|
|
51
|
+
const args = [
|
|
52
|
+
"-nodisp",
|
|
53
|
+
"-autoexit",
|
|
54
|
+
"-hide_banner",
|
|
55
|
+
"-loglevel",
|
|
56
|
+
"error",
|
|
57
|
+
...(durationSeconds !== undefined ? ["-t", String(durationSeconds)] : []),
|
|
58
|
+
data,
|
|
59
|
+
];
|
|
60
|
+
const timeout = durationSeconds !== undefined
|
|
61
|
+
? Math.max(ms("1m"), (durationSeconds + timeoutMarginSeconds) * 1000)
|
|
62
|
+
: ms("1m");
|
|
63
|
+
return await runCommand("ffplay", {
|
|
64
|
+
args,
|
|
65
|
+
timeout,
|
|
66
|
+
...runCommandOptions,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=passAudioAsMicrophoneInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passAudioAsMicrophoneInput.js","sourceRoot":"","sources":["../../src/emulator/passAudioAsMicrophoneInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAA0B,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAErE,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,mEAAmE;IACnE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,+CAA+C;IAC/C,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IACjD;;;;OAIG;IACH,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAClD,CAAC,CAAC;AAMH;;;;;GAKG;AACH,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC;;;;;;;;;;;;;;;;GAgBG;AACH,iFAAiF;AACjF,+EAA+E;AAC/E,6EAA6E;AAC7E,uEAAuE;AACvE,gFAAgF;AAChF,6EAA6E;AAC7E,gBAAgB;AAChB,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,OAA0C,EAC1C,iBAAmD;IAEnD,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,eAAe,EAAE,GAC3C,iCAAiC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEnD,IAAI,YAAY;QACd,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC;IAE3E,MAAM,IAAI,GAAG;QACX,SAAS;QACT,WAAW;QACX,cAAc;QACd,WAAW;QACX,OAAO;QACP,GAAG,CAAC,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACzE,IAAI;KACL,CAAC;IAEF,MAAM,OAAO,GACX,eAAe,KAAK,SAAS;QAC3B,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,eAAe,GAAG,oBAAoB,CAAC,GAAG,IAAI,CAAC;QACrE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAEf,OAAO,MAAM,UAAU,CAAC,QAAQ,EAAE;QAChC,IAAI;QACJ,OAAO;QACP,GAAG,iBAAiB;KACrB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -4,12 +4,7 @@ import { type RunCommandOptions } from "./runCommand.js";
|
|
|
4
4
|
* Options for playing back an automation macro.
|
|
5
5
|
*/
|
|
6
6
|
declare const PlayAutomationOptions: z.ZodUnion<readonly [z.ZodObject<{
|
|
7
|
-
macro: z.
|
|
8
|
-
Reset_position: "Reset_position";
|
|
9
|
-
Track_horizontal_plane: "Track_horizontal_plane";
|
|
10
|
-
Track_vertical_plane: "Track_vertical_plane";
|
|
11
|
-
Walk_to_image_room: "Walk_to_image_room";
|
|
12
|
-
}>;
|
|
7
|
+
macro: z.ZodLiteral<"Reset_position" | "Track_horizontal_plane" | "Track_vertical_plane" | "Walk_to_image_room">;
|
|
13
8
|
overrideMacroPath: z.ZodOptional<z.ZodString>;
|
|
14
9
|
}, z.core.$strip>, z.ZodObject<{
|
|
15
10
|
file: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playAutomation.d.ts","sourceRoot":"","sources":["../../src/emulator/playAutomation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,iBAAiB,EAAc,MAAM,iBAAiB,CAAC;AAErE;;GAEG;AACH,QAAA,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"playAutomation.d.ts","sourceRoot":"","sources":["../../src/emulator/playAutomation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,iBAAiB,EAAc,MAAM,iBAAiB,CAAC;AAErE;;GAEG;AACH,QAAA,MAAM,qBAAqB;;;;;mBAgBzB,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,EAC9B,iBAAiB,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,GAClD,OAAO,CAAC,MAAM,CAAC,CAgBjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playAutomation.js","sourceRoot":"","sources":["../../src/emulator/playAutomation.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAA0B,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAErE;;GAEG;AACH,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC;IACpC,CAAC,CAAC,MAAM,CAAC;QACP,6BAA6B;QAC7B,KAAK,EAAE,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"playAutomation.js","sourceRoot":"","sources":["../../src/emulator/playAutomation.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAA0B,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAErE;;GAEG;AACH,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC;IACpC,CAAC,CAAC,MAAM,CAAC;QACP,6BAA6B;QAC7B,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC;YACf,gBAAgB;YAChB,wBAAwB;YACxB,sBAAsB;YACtB,oBAAoB;SACrB,CAAC;QACF,oEAAoE;QACpE,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KACzC,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACP,0CAA0C;QAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;KACjB,CAAC;CACH,CAAC,CAAC;AAIH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAA8B,EAC9B,iBAAmD;IAEnD,MAAM,aAAa,GAAG,qBAAqB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAE3D,MAAM,SAAS,GACb,CAAC,mBAAmB,IAAI,aAAa,IAAI,aAAa,CAAC,iBAAiB,CAAC;QACzE,wCAAwC,CAAC;IAE3C,MAAM,IAAI,GACR,OAAO,IAAI,aAAa;QACtB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,KAAK,CAAC;QAC3C,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC;IAEzB,OAAO,MAAM,UAAU,CAAC,KAAK,EAAE;QAC7B,IAAI,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC;QACzC,GAAG,iBAAiB;KACrB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -2,10 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { type RunCommandOptions } from "./runCommand.js";
|
|
3
3
|
declare const VirtualSceneImageOptions: z.ZodObject<{
|
|
4
4
|
image: z.ZodDefault<z.ZodString>;
|
|
5
|
-
location: z.
|
|
6
|
-
wall: "wall";
|
|
7
|
-
table: "table";
|
|
8
|
-
}>;
|
|
5
|
+
location: z.ZodLiteral<"wall" | "table">;
|
|
9
6
|
}, z.core.$strip>;
|
|
10
7
|
export type VirtualSceneImageOptions = z.input<typeof VirtualSceneImageOptions>;
|
|
11
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setVirtualSceneImage.d.ts","sourceRoot":"","sources":["../../src/emulator/setVirtualSceneImage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,iBAAiB,EAAc,MAAM,iBAAiB,CAAC;AAGrE,QAAA,MAAM,wBAAwB
|
|
1
|
+
{"version":3,"file":"setVirtualSceneImage.d.ts","sourceRoot":"","sources":["../../src/emulator/setVirtualSceneImage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,iBAAiB,EAAc,MAAM,iBAAiB,CAAC;AAGrE,QAAA,MAAM,wBAAwB;;;iBAK5B,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEhF;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,wBAAwB,EACjC,iBAAiB,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,GAClD,OAAO,CAAC,MAAM,CAAC,CAgBjB"}
|
|
@@ -5,7 +5,7 @@ const VirtualSceneImageOptions = z.object({
|
|
|
5
5
|
/** Optional absolute path to image file. Leave empty to reset to default. */
|
|
6
6
|
image: z.string().default(""),
|
|
7
7
|
/** Virtual scene location to update the image. */
|
|
8
|
-
location: z.
|
|
8
|
+
location: z.literal(["wall", "table"]),
|
|
9
9
|
});
|
|
10
10
|
/**
|
|
11
11
|
* Set or reset the virtual scene image.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setVirtualSceneImage.js","sourceRoot":"","sources":["../../src/emulator/setVirtualSceneImage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAA0B,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,6EAA6E;IAC7E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC7B,kDAAkD;IAClD,QAAQ,EAAE,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"setVirtualSceneImage.js","sourceRoot":"","sources":["../../src/emulator/setVirtualSceneImage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAA0B,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,6EAA6E;IAC7E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC7B,kDAAkD;IAClD,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC,CAAC,CAAC;AAIH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,OAAiC,EACjC,iBAAmD;IAEnD,MAAM,aAAa,GAAG,wBAAwB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9D,IAAI,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC;IAEpC,qFAAqF;IACrF,gFAAgF;IAChF,oFAAoF;IACpF,OAAO,CAAC,GAAG,CACT,yDAAyD,SAAS,EAAE,CACrE,CAAC;IACF,SAAS,GAAG,MAAM,yBAAyB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAEjE,OAAO,MAAM,UAAU,CAAC,KAAK,EAAE;QAC7B,IAAI,EAAE,CAAC,KAAK,EAAE,oBAAoB,EAAE,aAAa,CAAC,QAAQ,EAAE,SAAS,CAAC;QACtE,GAAG,iBAAiB;KACrB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -12,14 +12,90 @@ declare const RunCommandOptions: z.ZodObject<{
|
|
|
12
12
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
13
13
|
}, z.core.$strip>;
|
|
14
14
|
type RunCommandOptions = z.input<typeof RunCommandOptions>;
|
|
15
|
+
/**
|
|
16
|
+
* Run an `adb` command and return its combined stdout/stderr.
|
|
17
|
+
*
|
|
18
|
+
* Pass the arguments either as a single string for convenience, or as an array.
|
|
19
|
+
* A string is split on whitespace and supports quoting a single value that
|
|
20
|
+
* contains spaces; it does not go through a shell. When building arguments
|
|
21
|
+
* programmatically, prefer the array form so no quoting is needed.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // adb shell input keyevent 26
|
|
25
|
+
* await adb("shell input keyevent 26");
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // a path with spaces, quoted in a string...
|
|
29
|
+
* await adb("pull '/sdcard/Recordings/My recording 1.m4a' /tmp/out.m4a");
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // ...or as a single array element, with no quoting to reason about
|
|
33
|
+
* await adb(["pull", "/sdcard/Recordings/My recording 1.m4a", destination]);
|
|
34
|
+
*/
|
|
35
|
+
export declare function adb(command: string | string[], runCommandOptions?: Omit<RunCommandOptions, "args">): Promise<string>;
|
|
36
|
+
declare const captureAudioOutputOptions: z.ZodObject<{
|
|
37
|
+
delaySeconds: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
durationSeconds: z.ZodNumber;
|
|
39
|
+
outputPath: z.ZodString;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export type CaptureAudioOutputOptions = z.input<typeof captureAudioOutputOptions>;
|
|
42
|
+
/**
|
|
43
|
+
* Capture the emulator's audio output to a file on the runner host.
|
|
44
|
+
*
|
|
45
|
+
* The mirror of `passAudioAsMicrophoneInput`: where injection plays audio into
|
|
46
|
+
* the emulator's microphone with `ffplay`, this records what the emulator plays
|
|
47
|
+
* out of its speaker. The emulator's output sink exposes a PulseAudio monitor
|
|
48
|
+
* source (`virtual_speaker.monitor`), and `ffmpeg` reads from it on the runner
|
|
49
|
+
* host over the existing pulse tunnel (`PULSE_SERVER`). This wraps the recording
|
|
50
|
+
* flags so flow authors do not have to know them.
|
|
51
|
+
*
|
|
52
|
+
* Recording from a live source has no natural end, so `durationSeconds` is
|
|
53
|
+
* required.
|
|
54
|
+
*
|
|
55
|
+
* Note: `virtual_mic` is mastered on `virtual_speaker.monitor`, so audio
|
|
56
|
+
* injected via `passAudioAsMicrophoneInput` also passes through the sink. A
|
|
57
|
+
* recording taken while injecting concurrently will therefore include the
|
|
58
|
+
* injected audio; pure output capture (no simultaneous injection) is clean.
|
|
59
|
+
*
|
|
60
|
+
* @param options recording options
|
|
61
|
+
* @param runCommandOptions optional options forwarded to runCommand
|
|
62
|
+
* @returns the path the recording was written to (the given `outputPath`)
|
|
63
|
+
* @throws if the command failed
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* await captureAudioOutput({
|
|
67
|
+
* outputPath: `${process.env.TEAM_STORAGE_DIR}/output.wav`,
|
|
68
|
+
* durationSeconds: 5,
|
|
69
|
+
* });
|
|
70
|
+
*/
|
|
71
|
+
export declare function captureAudioOutput(options: CaptureAudioOutputOptions, runCommandOptions?: Omit<RunCommandOptions, "args">): Promise<string>;
|
|
72
|
+
declare const passAudioAsMicrophoneInputOptions: z.ZodObject<{
|
|
73
|
+
data: z.ZodString;
|
|
74
|
+
delaySeconds: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
durationSeconds: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export type PassAudioAsMicrophoneInputOptions = z.input<typeof passAudioAsMicrophoneInputOptions>;
|
|
78
|
+
/**
|
|
79
|
+
* Pass an audio file to the emulator as microphone input.
|
|
80
|
+
*
|
|
81
|
+
* The emulator routes host audio into its microphone, and `ffplay` performs the
|
|
82
|
+
* playback on the runner host. This wraps the playback flags so flow authors do
|
|
83
|
+
* not have to know them.
|
|
84
|
+
*
|
|
85
|
+
* @param options playback options
|
|
86
|
+
* @param runCommandOptions optional options forwarded to runCommand
|
|
87
|
+
* @throws if the command failed
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* await passAudioAsMicrophoneInput({ data: `${process.env.TEAM_STORAGE_DIR}/audio.mp3` });
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* await passAudioAsMicrophoneInput({ data: `${process.env.TEAM_STORAGE_DIR}/audio.mp3`, durationSeconds: 10 });
|
|
94
|
+
*/
|
|
95
|
+
export declare function passAudioAsMicrophoneInput(options: PassAudioAsMicrophoneInputOptions, runCommandOptions?: Omit<RunCommandOptions, "args">): Promise<string>;
|
|
15
96
|
declare const PlayAutomationOptions: z.ZodUnion<readonly [
|
|
16
97
|
z.ZodObject<{
|
|
17
|
-
macro: z.
|
|
18
|
-
Reset_position: "Reset_position";
|
|
19
|
-
Track_horizontal_plane: "Track_horizontal_plane";
|
|
20
|
-
Track_vertical_plane: "Track_vertical_plane";
|
|
21
|
-
Walk_to_image_room: "Walk_to_image_room";
|
|
22
|
-
}>;
|
|
98
|
+
macro: z.ZodLiteral<"Reset_position" | "Track_horizontal_plane" | "Track_vertical_plane" | "Walk_to_image_room">;
|
|
23
99
|
overrideMacroPath: z.ZodOptional<z.ZodString>;
|
|
24
100
|
}, z.core.$strip>,
|
|
25
101
|
z.ZodObject<{
|
|
@@ -92,10 +168,7 @@ export declare function setProxy(options: ProxyOptions$1, runCommandOptions?: Om
|
|
|
92
168
|
export declare function clearProxy(runCommandOptions?: Omit<RunCommandOptions, "args">): Promise<string>;
|
|
93
169
|
declare const VirtualSceneImageOptions: z.ZodObject<{
|
|
94
170
|
image: z.ZodDefault<z.ZodString>;
|
|
95
|
-
location: z.
|
|
96
|
-
wall: "wall";
|
|
97
|
-
table: "table";
|
|
98
|
-
}>;
|
|
171
|
+
location: z.ZodLiteral<"wall" | "table">;
|
|
99
172
|
}, z.core.$strip>;
|
|
100
173
|
type VirtualSceneImageOptions$1 = z.input<typeof VirtualSceneImageOptions>;
|
|
101
174
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qawolf/run-globals-android",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"dts-bundle-generator": "^9.5.1",
|
|
43
|
-
"typescript": "^5.9.
|
|
43
|
+
"typescript": "^5.9.3"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=22.22.0 <25"
|