@openclaw/facetime 2026.10.10 → 2026.11.5-beta.1
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/.setup/{setup-C3uKLO8_.mjs → setup-ByISvnBj.mjs} +51 -99
- package/dist/.source-module-urls/38481bccca5fbb406e50ac928748f9f04f5a6cf5623980901b3cebc6ee82dfb6.json +1 -1
- package/dist/index.js +9 -21
- package/dist/runtime-api.js +225 -337
- package/docs/phase1-verification.md +1 -1
- package/index.ts +13 -20
- package/node_modules/typebox/build/format/duration.d.mts +2 -2
- package/node_modules/typebox/build/format/duration.mjs +2 -2
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_email.mjs +1 -0
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
- package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
- package/node_modules/typebox/build/format/ipv4.mjs +2 -2
- package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
- package/node_modules/typebox/build/format/ipv6.mjs +1 -1
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/schema/build.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
- package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
- package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
- package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
- package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
- package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
- package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
- package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
- package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
- package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
- package/node_modules/typebox/build/system/memory/create.mjs +18 -13
- package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
- package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
- package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
- package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
- package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
- package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
- package/node_modules/typebox/build/system/memory/update.mjs +43 -16
- package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
- package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
- package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
- package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
- package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
- package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
- package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
- package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +1 -1
- package/package.json +5 -6
- package/scripts/inject-helper-terminal.sh +1 -1
- package/scripts/inject-helper.sh +3 -7
- package/scripts/install-driver.sh +1 -1
- package/src/audio-pump.ts +5 -13
- package/src/command-output.ts +3 -0
- package/src/driver-setup.ts +15 -23
- package/src/helper-results.ts +31 -37
- package/src/helper-rpc.ts +55 -68
- package/src/helper-supervisor.ts +20 -28
- package/src/outbound-call.ts +2 -13
- package/src/plugin-paths.ts +13 -23
- package/src/preflight.ts +10 -33
- package/src/runtime-call-control.ts +11 -23
- package/src/runtime-call-events.ts +10 -7
- package/src/runtime-carrier-process.ts +1 -5
- package/src/runtime-helper-results.ts +5 -38
- package/src/runtime-state.ts +178 -10
- package/src/runtime-status.ts +2 -3
- package/src/runtime.ts +5 -7
- package/src/setup.ts +58 -69
- package/src/talk-consult-controller.ts +1 -19
- package/src/talk-driver.ts +31 -25
- package/src/talk-events-summary.ts +8 -19
- package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
- package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
- package/src/call-lifecycle.ts +0 -171
- package/src/runtime-lifecycle.ts +0 -17
- package/src/talk-initial-greeting.ts +0 -42
package/src/runtime-state.ts
CHANGED
|
@@ -1,19 +1,37 @@
|
|
|
1
|
+
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
1
2
|
import type { FaceTimeCallStatusEvent, AuthenticatedFaceTimeOwner } from "./call-events.js";
|
|
2
|
-
import { FaceTimeCallInstance } from "./call-lifecycle.js";
|
|
3
3
|
import type { HelperActionResult } from "./helper-results.js";
|
|
4
4
|
import type { FaceTimeHelperPeer } from "./helper-rpc.js";
|
|
5
5
|
import type { FaceTimeHelperSupervisorStatus } from "./helper-supervisor.js";
|
|
6
6
|
import type { FaceTimeDialMode, PendingFaceTimeDial } from "./outbound-call.js";
|
|
7
|
-
import type {
|
|
8
|
-
|
|
7
|
+
import type { startFaceTimeTalkDriver } from "./talk-driver.js";
|
|
8
|
+
|
|
9
|
+
type FaceTimeCarrierMode = "ringing" | "muted" | "active" | "closing" | "closed";
|
|
10
|
+
|
|
11
|
+
type FaceTimeModelMediaMode = "starting" | "ready" | "active" | "suspended" | "closed";
|
|
12
|
+
|
|
13
|
+
type FaceTimeCallPhase = "ringing" | "answering" | "active" | "closing" | "closed";
|
|
14
|
+
|
|
15
|
+
function normalizeCallIdentity(value: string): string {
|
|
16
|
+
return value.trim().toLowerCase();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class ActiveFaceTimeCall {
|
|
20
|
+
readonly lifecycleAbort = new AbortController();
|
|
21
|
+
readonly aliases = new Set<string>();
|
|
22
|
+
generation = 1;
|
|
23
|
+
phase: FaceTimeCallPhase;
|
|
24
|
+
carrierMode: FaceTimeCarrierMode;
|
|
25
|
+
modelMediaMode: FaceTimeModelMediaMode = "starting";
|
|
26
|
+
#carrierClosure = createDeferred<void>();
|
|
27
|
+
readonly carrierClosure = this.#carrierClosure.promise;
|
|
28
|
+
#commandTail: Promise<void> = Promise.resolve();
|
|
9
29
|
|
|
10
|
-
export class ActiveFaceTimeCall extends FaceTimeCallInstance {
|
|
11
30
|
readonly carrierCallUUIDs: Set<string>;
|
|
12
31
|
readonly retiredCarrierCallUUIDs = new Set<string>();
|
|
13
32
|
carrierCallUUID: string;
|
|
14
33
|
readonly carrierPeers = new Map<number, FaceTimeHelperPeer>();
|
|
15
34
|
readonly senderId: string;
|
|
16
|
-
readonly senderIsOwner: true = true;
|
|
17
35
|
handle?: string;
|
|
18
36
|
callStatus?: number;
|
|
19
37
|
isSendingAudio?: boolean;
|
|
@@ -36,12 +54,11 @@ export class ActiveFaceTimeCall extends FaceTimeCallInstance {
|
|
|
36
54
|
feedDevice: string;
|
|
37
55
|
microphoneDevice: string;
|
|
38
56
|
processInputVerified: boolean;
|
|
39
|
-
processOutputSuppressed: boolean;
|
|
40
57
|
};
|
|
41
58
|
lastHelperAction?: HelperActionResult;
|
|
42
59
|
lastRoutingError?: string;
|
|
43
60
|
audioRouting?: Promise<void>;
|
|
44
|
-
talk?:
|
|
61
|
+
talk?: Awaited<ReturnType<typeof startFaceTimeTalkDriver>>;
|
|
45
62
|
talkStarting?: Promise<void>;
|
|
46
63
|
talkActivation?: Promise<void>;
|
|
47
64
|
carrierHangupPending?: boolean;
|
|
@@ -56,7 +73,9 @@ export class ActiveFaceTimeCall extends FaceTimeCallInstance {
|
|
|
56
73
|
handle?: string;
|
|
57
74
|
peer?: FaceTimeHelperPeer;
|
|
58
75
|
}) {
|
|
59
|
-
|
|
76
|
+
this.phase = params.phase;
|
|
77
|
+
this.carrierMode = params.phase === "ringing" ? "ringing" : "muted";
|
|
78
|
+
this.aliases.add(normalizeCallIdentity(params.callUUID));
|
|
60
79
|
this.callUUID = params.callUUID;
|
|
61
80
|
this.carrierCallUUID = params.callUUID;
|
|
62
81
|
this.carrierCallUUIDs = new Set([params.callUUID]);
|
|
@@ -67,6 +86,96 @@ export class ActiveFaceTimeCall extends FaceTimeCallInstance {
|
|
|
67
86
|
}
|
|
68
87
|
}
|
|
69
88
|
|
|
89
|
+
assertCurrent(generation: number, allowClosing = false): void {
|
|
90
|
+
const phaseAllowed = allowClosing
|
|
91
|
+
? this.phase !== "closed" && this.carrierMode !== "closed"
|
|
92
|
+
: this.phase !== "closing" && this.phase !== "closed";
|
|
93
|
+
if (
|
|
94
|
+
generation !== this.generation ||
|
|
95
|
+
!phaseAllowed ||
|
|
96
|
+
(!allowClosing && this.lifecycleAbort.signal.aborted)
|
|
97
|
+
) {
|
|
98
|
+
throw new Error("FaceTime call lifecycle changed during carrier command");
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async runCarrierCommand<T>(params: {
|
|
103
|
+
generation: number;
|
|
104
|
+
allowClosing?: boolean;
|
|
105
|
+
action: () => Promise<T>;
|
|
106
|
+
}): Promise<T> {
|
|
107
|
+
const previous = this.#commandTail;
|
|
108
|
+
const { promise, resolve: release } = createDeferred<void>();
|
|
109
|
+
this.#commandTail = promise;
|
|
110
|
+
await previous;
|
|
111
|
+
try {
|
|
112
|
+
this.assertCurrent(params.generation, params.allowClosing);
|
|
113
|
+
const result = await params.action();
|
|
114
|
+
this.assertCurrent(params.generation, params.allowClosing);
|
|
115
|
+
return result;
|
|
116
|
+
} finally {
|
|
117
|
+
release();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
beginAnswering(): number {
|
|
122
|
+
if (this.phase !== "ringing") {
|
|
123
|
+
throw new Error(`cannot answer FaceTime call in ${this.phase} phase`);
|
|
124
|
+
}
|
|
125
|
+
this.phase = "answering";
|
|
126
|
+
this.carrierMode = "muted";
|
|
127
|
+
return this.generation;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
markCarrierActive(generation: number): void {
|
|
131
|
+
this.assertCurrent(generation);
|
|
132
|
+
this.phase = "active";
|
|
133
|
+
this.carrierMode = "active";
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
markModelReady(generation: number): void {
|
|
137
|
+
this.assertCurrent(generation);
|
|
138
|
+
this.modelMediaMode = "ready";
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
markModelActive(generation: number): void {
|
|
142
|
+
this.assertCurrent(generation);
|
|
143
|
+
this.modelMediaMode = "active";
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
suspendModelMedia(): void {
|
|
147
|
+
if (this.modelMediaMode !== "closed") {
|
|
148
|
+
this.modelMediaMode = "suspended";
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
beginClosing(): number {
|
|
153
|
+
if (this.phase === "closed") {
|
|
154
|
+
return this.generation;
|
|
155
|
+
}
|
|
156
|
+
if (this.phase !== "closing") {
|
|
157
|
+
this.generation += 1;
|
|
158
|
+
this.phase = "closing";
|
|
159
|
+
this.carrierMode = "closing";
|
|
160
|
+
this.suspendModelMedia();
|
|
161
|
+
this.lifecycleAbort.abort(new Error("FaceTime call is closing"));
|
|
162
|
+
}
|
|
163
|
+
return this.generation;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Carrier proof releases startup before local media teardown can be joined.
|
|
167
|
+
markCarrierClosed(): void {
|
|
168
|
+
this.beginClosing();
|
|
169
|
+
this.carrierMode = "closed";
|
|
170
|
+
this.#carrierClosure.resolve(undefined);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
markClosed(): void {
|
|
174
|
+
this.phase = "closed";
|
|
175
|
+
this.carrierMode = "closed";
|
|
176
|
+
this.modelMediaMode = "closed";
|
|
177
|
+
}
|
|
178
|
+
|
|
70
179
|
promoteCarrierCallUUID(callUUID: string): void {
|
|
71
180
|
if (callUUID !== this.carrierCallUUID) {
|
|
72
181
|
this.retiredCarrierCallUUIDs.add(this.carrierCallUUID);
|
|
@@ -77,6 +186,54 @@ export class ActiveFaceTimeCall extends FaceTimeCallInstance {
|
|
|
77
186
|
}
|
|
78
187
|
}
|
|
79
188
|
|
|
189
|
+
export class FaceTimeCallRegistry {
|
|
190
|
+
#active: ActiveFaceTimeCall | undefined;
|
|
191
|
+
|
|
192
|
+
get active(): ActiveFaceTimeCall | undefined {
|
|
193
|
+
return this.#active;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
get size(): number {
|
|
197
|
+
return this.#active && this.#active.phase !== "closed" ? 1 : 0;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
values(): IterableIterator<ActiveFaceTimeCall> {
|
|
201
|
+
return (this.#active && this.#active.phase !== "closed" ? [this.#active] : [])[
|
|
202
|
+
Symbol.iterator
|
|
203
|
+
]();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
get(identity: string): ActiveFaceTimeCall | undefined {
|
|
207
|
+
return this.#active?.aliases.has(normalizeCallIdentity(identity)) ? this.#active : undefined;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
has(identity: string): boolean {
|
|
211
|
+
return this.get(identity) !== undefined;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
create(call: ActiveFaceTimeCall): void {
|
|
215
|
+
if (this.#active && this.#active.phase !== "closed") {
|
|
216
|
+
throw new Error("another FaceTime call lifecycle is already active");
|
|
217
|
+
}
|
|
218
|
+
this.#active = call;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
retainAlias(call: ActiveFaceTimeCall, identity: string): void {
|
|
222
|
+
if (this.#active !== call || call.phase === "closed") {
|
|
223
|
+
throw new Error("cannot retain an alias for an inactive FaceTime call");
|
|
224
|
+
}
|
|
225
|
+
call.aliases.add(normalizeCallIdentity(identity));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
close(call: ActiveFaceTimeCall): void {
|
|
229
|
+
if (this.#active !== call) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
call.markClosed();
|
|
233
|
+
this.#active = undefined;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
80
237
|
export type FaceTimeRuntimeStatus = {
|
|
81
238
|
enabled: true;
|
|
82
239
|
helperConnected: boolean;
|
|
@@ -129,11 +286,22 @@ export type FaceTimeRuntimeStatus = {
|
|
|
129
286
|
maxRemoteMeterLevel?: number;
|
|
130
287
|
realtimeActive: boolean;
|
|
131
288
|
audioReady: boolean;
|
|
132
|
-
audioTransport?: ActiveFaceTimeCall["audioTransport"]
|
|
289
|
+
audioTransport?: ActiveFaceTimeCall["audioTransport"] & {
|
|
290
|
+
processOutputSuppressed: boolean;
|
|
291
|
+
};
|
|
133
292
|
lastHelperAction?: HelperActionResult;
|
|
134
293
|
lastRoutingError?: string;
|
|
135
294
|
carrierHangupPending?: boolean;
|
|
136
|
-
recentTalkEvents?:
|
|
295
|
+
recentTalkEvents?: Array<{
|
|
296
|
+
type: string;
|
|
297
|
+
turnId?: string;
|
|
298
|
+
callId?: string;
|
|
299
|
+
final?: boolean;
|
|
300
|
+
byteLength?: number;
|
|
301
|
+
name?: string;
|
|
302
|
+
text?: string;
|
|
303
|
+
message?: string;
|
|
304
|
+
}>;
|
|
137
305
|
}>;
|
|
138
306
|
};
|
|
139
307
|
|
package/src/runtime-status.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { FaceTimeCallRegistry } from "./call-lifecycle.js";
|
|
2
1
|
import type { FaceTimeHelperSupervisorStatus } from "./helper-supervisor.js";
|
|
3
2
|
import type { PendingFaceTimeDial } from "./outbound-call.js";
|
|
4
|
-
import type {
|
|
3
|
+
import type { FaceTimeCallRegistry, FaceTimeRuntimeStatus } from "./runtime-state.js";
|
|
5
4
|
import { summarizeRecentTalkEvents } from "./talk-events-summary.js";
|
|
6
5
|
|
|
7
6
|
export function buildFaceTimeRuntimeStatus(params: {
|
|
8
|
-
calls: FaceTimeCallRegistry
|
|
7
|
+
calls: FaceTimeCallRegistry;
|
|
9
8
|
helperConnected: boolean;
|
|
10
9
|
helperTargets: FaceTimeHelperSupervisorStatus;
|
|
11
10
|
driverInstall: FaceTimeRuntimeStatus["driverInstall"];
|
package/src/runtime.ts
CHANGED
|
@@ -4,11 +4,11 @@ import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
|
4
4
|
import type { PluginRuntime, RuntimeLogger } from "openclaw/plugin-sdk/plugin-runtime";
|
|
5
5
|
import { sleep } from "openclaw/plugin-sdk/runtime-env";
|
|
6
6
|
import { normalizeFaceTimeCallEvent } from "./call-events.js";
|
|
7
|
-
import { FaceTimeCallRegistry } from "./call-lifecycle.js";
|
|
8
7
|
import { resolveFaceTimeConfig, validateFaceTimeConfig, type FaceTimeConfig } from "./config.js";
|
|
9
8
|
import { installFaceTimeDriver } from "./driver-setup.js";
|
|
10
9
|
import { resolveFaceTimeHelperEndpoint } from "./helper-endpoint.js";
|
|
11
10
|
import {
|
|
11
|
+
DIAL_BUNDLES,
|
|
12
12
|
FaceTimeHelperAmbiguousError,
|
|
13
13
|
FaceTimeHelperUnavailableError,
|
|
14
14
|
readHelperResults,
|
|
@@ -33,14 +33,13 @@ import { terminateExactCarrierProcesses } from "./runtime-carrier-process.js";
|
|
|
33
33
|
import {
|
|
34
34
|
reconcilePendingFaceTimeCarrier,
|
|
35
35
|
hasDialHelperConfirmation,
|
|
36
|
-
OUTBOUND_DIAL_HELPER_BUNDLES,
|
|
37
36
|
OUTBOUND_RECONCILE_ATTEMPTS,
|
|
38
37
|
OUTBOUND_RECONCILE_INTERVAL_MS,
|
|
39
38
|
retainOutboundDialHelperPeers,
|
|
40
39
|
readOutboundCallUUID,
|
|
41
40
|
readOutboundProxyIdentifier,
|
|
42
41
|
} from "./runtime-helper-results.js";
|
|
43
|
-
import
|
|
42
|
+
import { FaceTimeCallRegistry, type FaceTimeRuntimeStatus } from "./runtime-state.js";
|
|
44
43
|
import { buildFaceTimeRuntimeStatus } from "./runtime-status.js";
|
|
45
44
|
import { runFaceTimeSetup, type FaceTimeSetupReport } from "./setup.js";
|
|
46
45
|
|
|
@@ -75,7 +74,7 @@ export async function createFaceTimeRuntime(params: {
|
|
|
75
74
|
throw new Error(`Invalid facetime config: ${validation.errors.join("; ")}`);
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
const calls = new FaceTimeCallRegistry
|
|
77
|
+
const calls = new FaceTimeCallRegistry();
|
|
79
78
|
const pendingDialStore = new PendingFaceTimeDialStore(
|
|
80
79
|
params.runtime.state.openKeyedStoreV2({
|
|
81
80
|
namespace: "pending-dial",
|
|
@@ -241,8 +240,7 @@ export async function createFaceTimeRuntime(params: {
|
|
|
241
240
|
.finally(scheduleOutboundReconciliation);
|
|
242
241
|
const helperResults = readHelperResults(result);
|
|
243
242
|
const cancelled = helperResults.some((entry) => entry.cancelled === true);
|
|
244
|
-
const helpersContacted =
|
|
245
|
-
typeof result.helpersContacted === "number" ? result.helpersContacted : helperResults.length;
|
|
243
|
+
const helpersContacted = result.helpersContacted ?? helperResults.length;
|
|
246
244
|
const definitivelyAbsent =
|
|
247
245
|
helperResults.length === helpersContacted &&
|
|
248
246
|
hasDialHelperConfirmation(helperResults) &&
|
|
@@ -273,7 +271,7 @@ export async function createFaceTimeRuntime(params: {
|
|
|
273
271
|
}
|
|
274
272
|
const outboundIdentity = normalizeFaceTimeOutboundIdentityEvent(message);
|
|
275
273
|
if (outboundIdentity && outboundCallPending?.dialID === outboundIdentity.data.dial_id) {
|
|
276
|
-
if (
|
|
274
|
+
if (DIAL_BUNDLES.has(peer.bundleIdentifier)) {
|
|
277
275
|
outboundCarrierPeers.set(peer.processId, peer);
|
|
278
276
|
}
|
|
279
277
|
retainFaceTimeDialCallUUID(outboundCallPending, outboundIdentity.data.call_uuid);
|
package/src/setup.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { resolve } from "node:path";
|
|
|
4
4
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
5
5
|
import type { PluginRuntime } from "openclaw/plugin-sdk/plugin-runtime";
|
|
6
6
|
import { asRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
|
+
import { firstLine } from "./command-output.js";
|
|
7
8
|
import type { FaceTimeConfig } from "./config.js";
|
|
8
9
|
import { inspectFaceTimeDriver, type FaceTimeDriverStatus } from "./driver-setup.js";
|
|
9
10
|
import type { FaceTimePreflightCheck, FaceTimePreflightResult } from "./preflight.js";
|
|
@@ -57,82 +58,75 @@ type SetupParams = {
|
|
|
57
58
|
const XCODE_APP = "/Applications/Xcode.app";
|
|
58
59
|
const XCODE_CLANG = `${XCODE_APP}/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang`;
|
|
59
60
|
const XCODE_MACOS_SDK = `${XCODE_APP}/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk`;
|
|
61
|
+
function commandAction(label: string, command: string) {
|
|
62
|
+
return { kind: "command" as const, label, command };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function settingsAction(label: string, settingsPath: string) {
|
|
66
|
+
return { kind: "system-settings" as const, label, settingsPath };
|
|
67
|
+
}
|
|
68
|
+
|
|
60
69
|
const SETUP_ACTIONS = {
|
|
61
|
-
"install-native-package":
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
kind: "command",
|
|
74
|
-
label: "Enable developer tools access",
|
|
75
|
-
command: "sudo /usr/sbin/DevToolsSecurity -enable",
|
|
76
|
-
},
|
|
70
|
+
"install-native-package": commandAction(
|
|
71
|
+
"Install or reinstall the FaceTime native package with Homebrew",
|
|
72
|
+
"if brew list --versions openclaw-facetime >/dev/null 2>&1; then brew reinstall openclaw/tap/openclaw-facetime; else brew install openclaw/tap/openclaw-facetime; fi",
|
|
73
|
+
),
|
|
74
|
+
"install-xcode-tools": commandAction(
|
|
75
|
+
"Install full Xcode in /Applications",
|
|
76
|
+
"open 'https://apps.apple.com/us/app/xcode/id497799835'",
|
|
77
|
+
),
|
|
78
|
+
"enable-developer-tools": commandAction(
|
|
79
|
+
"Enable developer tools access",
|
|
80
|
+
"sudo /usr/sbin/DevToolsSecurity -enable",
|
|
81
|
+
),
|
|
77
82
|
"disable-sip-debugging": {
|
|
78
83
|
kind: "recovery",
|
|
79
84
|
label: "Disable SIP debugging restrictions from macOS Recovery, then reboot and rerun setup",
|
|
80
85
|
command: "csrutil enable --without debug",
|
|
81
86
|
settingsPath: "macOS Recovery > Utilities > Terminal",
|
|
82
87
|
},
|
|
83
|
-
"verify-sip-status":
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
"restart-gateway": {
|
|
94
|
-
kind: "command",
|
|
95
|
-
label: "Stop the stale gateway process, then restart OpenClaw",
|
|
96
|
-
command: "openclaw gateway restart",
|
|
97
|
-
},
|
|
88
|
+
"verify-sip-status": commandAction(
|
|
89
|
+
"Verify SIP status, then rerun setup",
|
|
90
|
+
"/usr/bin/csrutil status",
|
|
91
|
+
),
|
|
92
|
+
"configure-owner-handles": commandAction("Configure ownerHandles", "openclaw configure"),
|
|
93
|
+
"restart-gateway": commandAction(
|
|
94
|
+
"Stop the stale gateway process, then restart OpenClaw",
|
|
95
|
+
"openclaw gateway restart",
|
|
96
|
+
),
|
|
98
97
|
"wait-for-helper": {
|
|
99
98
|
kind: "automatic",
|
|
100
99
|
label: "Wait for automatic helper injection to finish",
|
|
101
100
|
},
|
|
102
101
|
"restart-call-apps": {
|
|
103
102
|
kind: "manual-test",
|
|
104
|
-
label: "Quit and reopen FaceTime
|
|
103
|
+
label: "Quit and reopen FaceTime, then let OpenClaw reinject the helper",
|
|
105
104
|
},
|
|
106
105
|
"install-driver": {
|
|
107
106
|
kind: "gateway",
|
|
108
107
|
label: "Install or update the paired FaceTime audio driver",
|
|
109
108
|
gatewayMethod: "facetime.installDriver",
|
|
110
109
|
},
|
|
111
|
-
"select-physical-output":
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
"allow-sharing-notifications": {
|
|
132
|
-
kind: "system-settings",
|
|
133
|
-
label: "Allow notifications while mirroring or sharing the display",
|
|
134
|
-
settingsPath: "System Settings > Notifications",
|
|
135
|
-
},
|
|
110
|
+
"select-physical-output": settingsAction(
|
|
111
|
+
"Select MacBook Speakers or another physical output",
|
|
112
|
+
"System Settings > Sound > Output",
|
|
113
|
+
),
|
|
114
|
+
"grant-system-audio": settingsAction(
|
|
115
|
+
"Allow OpenClaw to capture FaceTime app audio",
|
|
116
|
+
"System Settings > Privacy & Security > Screen & System Audio Recording",
|
|
117
|
+
),
|
|
118
|
+
"configure-realtime-provider": commandAction(
|
|
119
|
+
"Configure authentication for a registered realtime voice provider",
|
|
120
|
+
"openclaw configure",
|
|
121
|
+
),
|
|
122
|
+
"verify-focus": settingsAction(
|
|
123
|
+
"Verify Focus is off or allows the expected caller",
|
|
124
|
+
"Control Center > Focus",
|
|
125
|
+
),
|
|
126
|
+
"allow-sharing-notifications": settingsAction(
|
|
127
|
+
"Allow notifications while mirroring or sharing the display",
|
|
128
|
+
"System Settings > Notifications",
|
|
129
|
+
),
|
|
136
130
|
"live-outbound-test": {
|
|
137
131
|
kind: "manual-test",
|
|
138
132
|
label: "Place one outbound FaceTime audio call with facetime.dial",
|
|
@@ -142,11 +136,10 @@ const SETUP_ACTIONS = {
|
|
|
142
136
|
kind: "manual-test",
|
|
143
137
|
label: "Run one inbound and one outbound FaceTime audio call",
|
|
144
138
|
},
|
|
145
|
-
"review-live-voicemail":
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
},
|
|
139
|
+
"review-live-voicemail": settingsAction(
|
|
140
|
+
"Review Live Voicemail if inbound audio calls are screened",
|
|
141
|
+
"Phone > Settings > Live Voicemail",
|
|
142
|
+
),
|
|
150
143
|
} satisfies Record<string, Omit<FaceTimeSetupAction, "id">>;
|
|
151
144
|
|
|
152
145
|
const PRECHECK_ACTIONS: Record<string, keyof typeof SETUP_ACTIONS> = {
|
|
@@ -158,10 +151,6 @@ const PRECHECK_ACTIONS: Record<string, keyof typeof SETUP_ACTIONS> = {
|
|
|
158
151
|
"realtime-provider": "configure-realtime-provider",
|
|
159
152
|
};
|
|
160
153
|
|
|
161
|
-
function firstLine(value: unknown): string | undefined {
|
|
162
|
-
return typeof value === "string" ? value.trim().split(/\r?\n/u)[0] || undefined : undefined;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
154
|
function addPreflightCheck(checks: FaceTimeSetupCheck[], check: FaceTimePreflightCheck): void {
|
|
166
155
|
if (check.id === "call-app-running") {
|
|
167
156
|
return;
|
|
@@ -332,7 +321,7 @@ export async function runFaceTimeSetup(params: SetupParams): Promise<FaceTimeSet
|
|
|
332
321
|
required: true,
|
|
333
322
|
message: developerSecurityEnabled
|
|
334
323
|
? developerSecurity.message
|
|
335
|
-
: "Developer tools access is disabled; helper injection cannot attach to FaceTime
|
|
324
|
+
: "Developer tools access is disabled; helper injection cannot attach to FaceTime",
|
|
336
325
|
...(!developerSecurityEnabled ? { actionId: "enable-developer-tools" } : {}),
|
|
337
326
|
});
|
|
338
327
|
|
|
@@ -358,7 +347,7 @@ export async function runFaceTimeSetup(params: SetupParams): Promise<FaceTimeSet
|
|
|
358
347
|
status: debuggingRestrictionsDisabled ? "ready" : "action-required",
|
|
359
348
|
required: true,
|
|
360
349
|
message: debuggingRestrictionsDisabled
|
|
361
|
-
? "SIP permits debugger attachment to FaceTime
|
|
350
|
+
? "SIP permits debugger attachment to FaceTime; a connected helper must still be verified separately"
|
|
362
351
|
: debuggingRestrictionsEnabled
|
|
363
352
|
? "SIP debugging restrictions block LLDB helper injection into protected Apple apps"
|
|
364
353
|
: "Could not verify SIP debugging restrictions; run csrutil status before changing protection settings",
|
|
@@ -421,7 +410,7 @@ export async function runFaceTimeSetup(params: SetupParams): Promise<FaceTimeSet
|
|
|
421
410
|
id: `helper-${target.target.toLowerCase()}`,
|
|
422
411
|
label: `${target.target} helper`,
|
|
423
412
|
status,
|
|
424
|
-
required:
|
|
413
|
+
required: true,
|
|
425
414
|
message: target.connected
|
|
426
415
|
? "Authenticated helper connected"
|
|
427
416
|
: target.stale
|
|
@@ -27,7 +27,6 @@ type PendingAgentConsult = {
|
|
|
27
27
|
terminalSubmitted: boolean;
|
|
28
28
|
generation: number;
|
|
29
29
|
abortController: AbortController;
|
|
30
|
-
runRegistration?: { runId: string; controller: AbortController };
|
|
31
30
|
};
|
|
32
31
|
|
|
33
32
|
export function createFaceTimeConsultController(params: {
|
|
@@ -40,7 +39,6 @@ export function createFaceTimeConsultController(params: {
|
|
|
40
39
|
requesterSessionKey: string;
|
|
41
40
|
normalizedCallUUID: string;
|
|
42
41
|
senderId: string;
|
|
43
|
-
senderIsOwner: true;
|
|
44
42
|
transcript: RealtimeVoiceTranscriptEntry[];
|
|
45
43
|
getBridge: () => RealtimeVoiceBridgeSession | undefined;
|
|
46
44
|
getGeneration: () => number;
|
|
@@ -86,7 +84,6 @@ export function createFaceTimeConsultController(params: {
|
|
|
86
84
|
|
|
87
85
|
const abortConsult = (consult: PendingAgentConsult, reason: string) => {
|
|
88
86
|
consult.abortController.abort(new Error(`FaceTime agent consult ${reason}`));
|
|
89
|
-
consult.runRegistration?.controller.abort(new Error(`FaceTime agent consult run ${reason}`));
|
|
90
87
|
};
|
|
91
88
|
const abortForClose = () => {
|
|
92
89
|
for (const consult of pending.values()) {
|
|
@@ -318,7 +315,7 @@ export function createFaceTimeConsultController(params: {
|
|
|
318
315
|
sessionKey: params.consultSessionKey,
|
|
319
316
|
spawnedBy: params.requesterSessionKey,
|
|
320
317
|
senderId: params.senderId,
|
|
321
|
-
senderIsOwner:
|
|
318
|
+
senderIsOwner: true,
|
|
322
319
|
contextMode: "fork",
|
|
323
320
|
messageProvider: AGENT_CONSULT_MESSAGE_PROVIDER,
|
|
324
321
|
lane: `facetime:${params.normalizedCallUUID}`,
|
|
@@ -333,21 +330,6 @@ export function createFaceTimeConsultController(params: {
|
|
|
333
330
|
extraSystemPrompt: CONSULT_SYSTEM_PROMPT,
|
|
334
331
|
thinkLevel: "off",
|
|
335
332
|
abortSignal: consult.abortController.signal,
|
|
336
|
-
onRunStarted: ({ runId }) => {
|
|
337
|
-
const registration = { runId, controller: new AbortController() };
|
|
338
|
-
consult.runRegistration = registration;
|
|
339
|
-
if (consult.cancelRequested || pending.get(consult.callId) !== consult) {
|
|
340
|
-
registration.controller.abort(new Error("FaceTime agent consult was already cancelled"));
|
|
341
|
-
}
|
|
342
|
-
return {
|
|
343
|
-
abortSignal: registration.controller.signal,
|
|
344
|
-
cleanup: () => {
|
|
345
|
-
if (consult.runRegistration === registration) {
|
|
346
|
-
consult.runRegistration = undefined;
|
|
347
|
-
}
|
|
348
|
-
},
|
|
349
|
-
};
|
|
350
|
-
},
|
|
351
333
|
}).then(
|
|
352
334
|
(result) => deliverResult(result),
|
|
353
335
|
async (error: unknown) => {
|