@openclaw/facetime 2026.10.2 → 2026.10.5-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.
@@ -15,6 +15,7 @@ import {
15
15
  } from "./helper-results.js";
16
16
  import type { FaceTimeHelperSocketServer } from "./helper-rpc.js";
17
17
  import { terminateExactCarrierProcesses } from "./runtime-carrier-process.js";
18
+ import { retainHelperResultPeers } from "./runtime-helper-results.js";
18
19
  import type { ActiveFaceTimeCall } from "./runtime-state.js";
19
20
  import { startFaceTimeTalkDriver } from "./talk-driver.js";
20
21
 
@@ -28,7 +29,6 @@ export function createFaceTimeCallControl(params: {
28
29
  captureBinary: string;
29
30
  isStopping: () => boolean;
30
31
  getHelperTopologyVersion: () => number;
31
- retainHelperResultPeers: (call: ActiveFaceTimeCall, result: HelperActionResult) => void;
32
32
  }) {
33
33
  const runCarrierActionAcrossAliases = async (request: {
34
34
  call: ActiveFaceTimeCall;
@@ -112,14 +112,14 @@ export function createFaceTimeCallControl(params: {
112
112
  action: async () => await params.helper.setMuted(call.carrierCallUUID, false),
113
113
  });
114
114
  call.lastHelperAction = mutedResult;
115
- params.retainHelperResultPeers(call, mutedResult);
115
+ retainHelperResultPeers(call, mutedResult);
116
116
  projectFaceTimeNativeAction("unmute", mutedResult);
117
117
  const transmissionResult = await call.runCarrierCommand({
118
118
  generation,
119
119
  action: async () => await params.helper.startTransmission(call.carrierCallUUID),
120
120
  });
121
121
  call.lastHelperAction = transmissionResult;
122
- params.retainHelperResultPeers(call, transmissionResult);
122
+ retainHelperResultPeers(call, transmissionResult);
123
123
  projectFaceTimeNativeAction("activate", transmissionResult);
124
124
  call.markCarrierActive(generation);
125
125
  if (call.audioTransport) {
@@ -136,26 +136,13 @@ export function createFaceTimeCallControl(params: {
136
136
  call.carrierHangupRetryTimer = undefined;
137
137
  }
138
138
  call.beginClosing();
139
- await call.audioRouting?.catch((error: unknown) => {
140
- params.logger.debug?.(
141
- `[facetime] audio routing cancellation for active call: ${formatErrorMessage(error)}`,
142
- );
143
- });
144
- await call.talkStarting?.catch((error: unknown) => {
145
- params.logger.debug?.(
146
- `[facetime] talk startup cancellation for active call: ${formatErrorMessage(error)}`,
147
- );
148
- });
149
- await call.talk?.close(reason).catch((error: unknown) => {
150
- params.logger.debug?.(
151
- `[facetime] talk close ignored for active call: ${formatErrorMessage(error)}`,
152
- );
153
- });
154
- await call.talkActivation?.catch((error: unknown) => {
155
- params.logger.debug?.(
156
- `[facetime] talk activation cancellation for active call: ${formatErrorMessage(error)}`,
157
- );
158
- });
139
+ const logCleanupFailure = (stage: string) => (error: unknown) => {
140
+ params.logger.debug?.(`[facetime] ${stage} for active call: ${formatErrorMessage(error)}`);
141
+ };
142
+ await call.audioRouting?.catch(logCleanupFailure("audio routing cancellation"));
143
+ await call.talkStarting?.catch(logCleanupFailure("talk startup cancellation"));
144
+ await call.talk?.close(reason).catch(logCleanupFailure("talk close ignored"));
145
+ await call.talkActivation?.catch(logCleanupFailure("talk activation cancellation"));
159
146
  call.audioReady = false;
160
147
  call.audioTransport = undefined;
161
148
  params.calls.close(call);
@@ -196,34 +183,22 @@ export function createFaceTimeCallControl(params: {
196
183
  return undefined;
197
184
  }
198
185
  };
199
- try {
200
- const muted = await runCarrierActionAcrossAliases({
201
- call,
202
- generation,
203
- action: "safe-mute",
204
- run: async (callUUID) => await params.helper.safetyMute(callUUID),
205
- });
206
- params.retainHelperResultPeers(call, muted);
207
- } catch (error) {
208
- if (readCompleteAbsenceGeneration(error) === undefined) {
209
- params.logger.warn(
210
- `[facetime] failed to confirm carrier safety mute: ${formatErrorMessage(error)}`,
211
- );
212
- }
213
- }
214
- try {
215
- const leave = await runCarrierActionAcrossAliases({
216
- call,
217
- generation,
218
- action: "terminate",
219
- run: async (callUUID) => await params.helper.leaveCall(callUUID),
220
- });
221
- params.retainHelperResultPeers(call, leave);
222
- } catch (error) {
223
- if (readCompleteAbsenceGeneration(error) === undefined) {
224
- params.logger.warn(
225
- `[facetime] carrier termination request failed: ${formatErrorMessage(error)}`,
226
- );
186
+ for (const [action, method, failure] of [
187
+ ["safe-mute", "safetyMute", "failed to confirm carrier safety mute"],
188
+ ["terminate", "leaveCall", "carrier termination request failed"],
189
+ ] as const) {
190
+ try {
191
+ const result = await runCarrierActionAcrossAliases({
192
+ call,
193
+ generation,
194
+ action,
195
+ run: async (callUUID) => await params.helper[method](callUUID),
196
+ });
197
+ retainHelperResultPeers(call, result);
198
+ } catch (error) {
199
+ if (readCompleteAbsenceGeneration(error) === undefined) {
200
+ params.logger.warn(`[facetime] ${failure}: ${formatErrorMessage(error)}`);
201
+ }
227
202
  }
228
203
  }
229
204
  // Action replies cover connected helpers only. Closure also requires
@@ -388,16 +363,14 @@ export function createFaceTimeCallControl(params: {
388
363
  }
389
364
  }
390
365
  };
391
- const activateCallTalk = async (call: ActiveFaceTimeCall, options: { unmute: boolean }) => {
366
+ const activateCallTalk = async (call: ActiveFaceTimeCall) => {
392
367
  const generation = call.captureGeneration();
393
368
  if (!call.talkActivation) {
394
369
  call.talkActivation = (async () => {
395
370
  await call.talk?.readyForAudio();
396
371
  call.assertCurrent(generation);
397
372
  call.markModelReady(generation);
398
- if (options.unmute) {
399
- await enableCallAudio(call);
400
- }
373
+ await enableCallAudio(call);
401
374
  call.assertCurrent(generation);
402
375
  call.markModelActive(generation);
403
376
  call.talk?.activate();
@@ -407,7 +380,7 @@ export function createFaceTimeCallControl(params: {
407
380
  try {
408
381
  await activation;
409
382
  call.assertCurrent(generation);
410
- if (options.unmute && call.carrierMode !== "active") {
383
+ if (call.carrierMode !== "active") {
411
384
  await enableCallAudio(call);
412
385
  }
413
386
  } finally {
@@ -21,22 +21,16 @@ import {
21
21
  retainFaceTimeDialCallUUID,
22
22
  type PendingFaceTimeDial,
23
23
  } from "./outbound-call.js";
24
+ import type { createFaceTimeCallControl } from "./runtime-call-control.js";
24
25
  import { retainHelperResultPeers } from "./runtime-helper-results.js";
25
26
  import { ActiveFaceTimeCall, updateCallStatus } from "./runtime-state.js";
26
27
 
27
- type CallControl = {
28
- activateCallTalk(call: ActiveFaceTimeCall, options: { unmute: boolean }): Promise<void>;
29
- attemptCarrierHangup(call: ActiveFaceTimeCall, reason: string): Promise<boolean>;
30
- closeCall(call: ActiveFaceTimeCall, reason: string): Promise<void>;
31
- startCallTalk(call: ActiveFaceTimeCall): Promise<void>;
32
- };
33
-
34
28
  export function createFaceTimeCallEventHandler(params: {
35
29
  calls: FaceTimeCallRegistry<ActiveFaceTimeCall>;
36
30
  helper: FaceTimeHelperSocketServer;
37
31
  config: FaceTimeConfig;
38
32
  logger: RuntimeLogger;
39
- callControl: CallControl;
33
+ callControl: ReturnType<typeof createFaceTimeCallControl>;
40
34
  isStopping: () => boolean;
41
35
  isDriverInstallPending: () => boolean;
42
36
  getPendingDial: () => PendingFaceTimeDial | undefined;
@@ -172,7 +166,7 @@ export function createFaceTimeCallEventHandler(params: {
172
166
  });
173
167
  projectFaceTimeNativeAction("answer", answerResult);
174
168
  retainHelperResultPeers(call, answerResult);
175
- await params.callControl.activateCallTalk(call, { unmute: true });
169
+ await params.callControl.activateCallTalk(call);
176
170
  params.logger.info("[facetime] answered authorized FaceTime call");
177
171
  } catch (error) {
178
172
  params.logger.warn(`[facetime] failed to answer FaceTime call: ${formatErrorMessage(error)}`);
@@ -230,7 +224,7 @@ export function createFaceTimeCallEventHandler(params: {
230
224
  updateCallStatus(call, event);
231
225
  try {
232
226
  await params.callControl.startCallTalk(call);
233
- await params.callControl.activateCallTalk(call, { unmute: true });
227
+ await params.callControl.activateCallTalk(call);
234
228
  params.logger.info("[facetime] realtime talk session active");
235
229
  } catch (error) {
236
230
  if (call.lifecycleAbort.signal.aborted || params.calls.active !== call) {
package/src/runtime.ts CHANGED
@@ -39,7 +39,6 @@ import {
39
39
  retainOutboundDialHelperPeers,
40
40
  readOutboundCallUUID,
41
41
  readOutboundProxyIdentifier,
42
- retainHelperResultPeers,
43
42
  } from "./runtime-helper-results.js";
44
43
  import type { ActiveFaceTimeCall, FaceTimeRuntimeStatus } from "./runtime-state.js";
45
44
  import { buildFaceTimeRuntimeStatus } from "./runtime-status.js";
@@ -334,7 +333,6 @@ export async function createFaceTimeRuntime(params: {
334
333
  captureBinary,
335
334
  isStopping: () => stopping,
336
335
  getHelperTopologyVersion: () => helperTopologyVersion,
337
- retainHelperResultPeers,
338
336
  });
339
337
  const { attemptCarrierHangup, stopCall } = callControl;
340
338
  const callEvents = createFaceTimeCallEventHandler({
@@ -375,7 +373,6 @@ export async function createFaceTimeRuntime(params: {
375
373
  config,
376
374
  fullConfig: params.fullConfig,
377
375
  runtime: params.runtime,
378
- logger: params.logger,
379
376
  helperConnected: helper.connectedSockets > 0,
380
377
  captureBinary,
381
378
  });
@@ -596,7 +593,6 @@ export async function createFaceTimeRuntime(params: {
596
593
  driverInstallTask = installFaceTimeDriver({
597
594
  pluginRoot: params.pluginRoot,
598
595
  runCommandWithTimeout: params.runtime.system.runCommandWithTimeout,
599
- callActive: false,
600
596
  signal: installAbortController.signal,
601
597
  })
602
598
  .then((result) => {
package/src/setup.ts CHANGED
@@ -52,7 +52,6 @@ type SetupParams = {
52
52
  runtimeStatus?: FaceTimeRuntimeStatus | Promise<FaceTimeRuntimeStatus>;
53
53
  runtimeError?: string;
54
54
  preflight?: FaceTimePreflightResult | Promise<FaceTimePreflightResult>;
55
- readAssertionsFile?: () => Promise<string>;
56
55
  };
57
56
 
58
57
  const XCODE_APP = "/Applications/Xcode.app";
@@ -196,12 +195,11 @@ function hasActiveFocusAssertion(raw: string): boolean {
196
195
  return visit(parsed);
197
196
  }
198
197
 
199
- async function checkFocusMode(params: SetupParams): Promise<FaceTimeSetupCheck> {
200
- const readAssertions =
201
- params.readAssertionsFile ??
202
- (() => readFile(resolve(homedir(), "Library/DoNotDisturb/DB/Assertions.json"), "utf8"));
198
+ async function checkFocusMode(): Promise<FaceTimeSetupCheck> {
203
199
  try {
204
- const active = hasActiveFocusAssertion(await readAssertions());
200
+ const active = hasActiveFocusAssertion(
201
+ await readFile(resolve(homedir(), "Library/DoNotDisturb/DB/Assertions.json"), "utf8"),
202
+ );
205
203
  return {
206
204
  id: "focus-mode",
207
205
  label: "Focus mode",
@@ -484,7 +482,7 @@ export async function runFaceTimeSetup(params: SetupParams): Promise<FaceTimeSet
484
482
  }
485
483
  }
486
484
 
487
- checks.push(await checkFocusMode(params));
485
+ checks.push(await checkFocusMode());
488
486
  checks.push(await checkNotificationsDuringSharing(params.runCommandWithTimeout));
489
487
 
490
488
  checks.push({
@@ -22,7 +22,7 @@ export async function inspectFaceTimeStaticStatus(params: {
22
22
  runCommandWithTimeout: PluginRuntime["system"]["runCommandWithTimeout"];
23
23
  }): Promise<FaceTimeStaticStatus> {
24
24
  const [artifacts, driver] = await Promise.all([
25
- inspectFaceTimeArtifacts({}),
25
+ inspectFaceTimeArtifacts(),
26
26
  inspectFaceTimeDriver(params).then(
27
27
  (status) => ({ status }),
28
28
  (error: unknown) => ({ error: formatErrorMessage(error) }),
@@ -15,8 +15,8 @@ export type FaceTimeTalkEventSummary = {
15
15
  message?: string;
16
16
  };
17
17
 
18
- export function summarizeRecentTalkEvents(events: readonly unknown[], limit = 12) {
19
- return events.slice(-limit).map((event): FaceTimeTalkEventSummary => {
18
+ export function summarizeRecentTalkEvents(events: readonly unknown[]) {
19
+ return events.slice(-12).map((event): FaceTimeTalkEventSummary => {
20
20
  const record = asRecord(event);
21
21
  const payload = asRecord(record.payload);
22
22
  return {
@@ -6,10 +6,7 @@ const FACETIME_INITIAL_GREETING =
6
6
  "Greet the caller briefly, introduce yourself using your configured identity, and ask how you can help.";
7
7
  const FACETIME_GREETING_MEDIA_SETTLE_MS = 100;
8
8
 
9
- export function createFaceTimeInitialGreeting(params: {
10
- delayMs?: number;
11
- speak: (instructions: string) => void;
12
- }): {
9
+ export function createFaceTimeInitialGreeting(params: { speak: (instructions: string) => void }): {
13
10
  readonly instructions: string;
14
11
  schedule(): void;
15
12
  cancel(): void;
@@ -34,7 +31,7 @@ export function createFaceTimeInitialGreeting(params: {
34
31
  timer = undefined;
35
32
  dismissed = true;
36
33
  params.speak(FACETIME_INITIAL_GREETING);
37
- }, params.delayMs ?? FACETIME_GREETING_MEDIA_SETTLE_MS);
34
+ }, FACETIME_GREETING_MEDIA_SETTLE_MS);
38
35
  timer.unref?.();
39
36
  },
40
37
  cancel() {