@memberjunction/ai-bridge-teams 0.0.1 → 5.42.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/README.md +109 -43
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/register-native.d.ts +19 -0
- package/dist/register-native.d.ts.map +1 -0
- package/dist/register-native.js +32 -0
- package/dist/register-native.js.map +1 -0
- package/dist/teams-bridge.d.ts +155 -0
- package/dist/teams-bridge.d.ts.map +1 -0
- package/dist/teams-bridge.js +356 -0
- package/dist/teams-bridge.js.map +1 -0
- package/dist/teams-meeting-controls.d.ts +80 -0
- package/dist/teams-meeting-controls.d.ts.map +1 -0
- package/dist/teams-meeting-controls.js +130 -0
- package/dist/teams-meeting-controls.js.map +1 -0
- package/dist/teams-native-sdk.d.ts +291 -0
- package/dist/teams-native-sdk.d.ts.map +1 -0
- package/dist/teams-native-sdk.js +320 -0
- package/dist/teams-native-sdk.js.map +1 -0
- package/dist/teams-sdk.d.ts +173 -0
- package/dist/teams-sdk.d.ts.map +1 -0
- package/dist/teams-sdk.js +35 -0
- package/dist/teams-sdk.js.map +1 -0
- package/package.json +32 -7
package/README.md
CHANGED
|
@@ -1,45 +1,111 @@
|
|
|
1
1
|
# @memberjunction/ai-bridge-teams
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
##
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
3
|
+
The **Microsoft Teams** Realtime Bridge driver in MemberJunction's Realtime Bridges program. It connects
|
|
4
|
+
the one realtime agent engine to a **Teams meeting**: bidirectional audio, a diarized participant roster,
|
|
5
|
+
participant mute, Teams meeting chat, and a **Meeting Controls** facilitator channel — all behind an
|
|
6
|
+
injectable Teams calling-bot SDK seam so the driver builds and unit-tests with **no network and no real
|
|
7
|
+
Teams / Azure Communication Services SDK**. It is a structural mirror of the reference
|
|
8
|
+
[`@memberjunction/ai-bridge-zoom`](../BridgeZoom/README.md) driver.
|
|
9
|
+
|
|
10
|
+
See the [Realtime Bridges Guide](../../../../guides/REALTIME_BRIDGES_GUIDE.md) and
|
|
11
|
+
[`/plans/realtime/realtime-bridges-architecture.md`](../../../../plans/realtime/realtime-bridges-architecture.md)
|
|
12
|
+
(§3 provider abstraction, §4b channels, §8 Microsoft Teams capability row) for the full architecture.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @memberjunction/ai-bridge-teams
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## What it provides
|
|
21
|
+
|
|
22
|
+
- **`TeamsBridge`** — `@RegisterClass(BaseRealtimeBridge, 'TeamsBridge')`. The `MJ: AI Bridge Providers`
|
|
23
|
+
row with `DriverClass = 'TeamsBridge'` resolves to this driver via the `ClassFactory`. Implements the
|
|
24
|
+
four `BaseRealtimeBridge` abstracts (`Connect` / `Disconnect` / `SendMedia` / `OnMedia`) and the
|
|
25
|
+
capability-gated virtuals Teams supports (`GetParticipants`, `OnParticipantChange`), plus
|
|
26
|
+
`GetMeetingControlsEventSource` for the facilitator channel and a `PostChatMessage` helper.
|
|
27
|
+
- **`ITeamsMeetingSdk`** — the **injectable seam** the driver depends on instead of the real SDK.
|
|
28
|
+
- **`TeamsMeetingControlsEventSource`** — adapts the seam's roster / hand-raise / speaking / mute into
|
|
29
|
+
the bridge's `IBridgeMeetingControlsEventSource`, so the engine wires the Meeting Controls channel.
|
|
30
|
+
|
|
31
|
+
## Capability coverage (the Microsoft Teams seed row)
|
|
32
|
+
|
|
33
|
+
| Capability | Status |
|
|
34
|
+
|---|---|
|
|
35
|
+
| On-demand + scheduled + invite + **native invite** join | ✅ |
|
|
36
|
+
| Inbound routing | ✅ |
|
|
37
|
+
| Audio in / out | ✅ |
|
|
38
|
+
| Video in/out, Screen in/out (directional flags) | ✅ (transport carries them; models light audio first) |
|
|
39
|
+
| Speaker diarization (roster + per-speaker labels) | ✅ |
|
|
40
|
+
| Participant mute (Meeting Controls) | ✅ |
|
|
41
|
+
| Teams meeting chat | ✅ |
|
|
42
|
+
| Native raised-hand | ⚠️ Partial — wired where the calling-bot API surfaces it; tolerant of it never firing |
|
|
43
|
+
| DTMF / call transfer / recording | ➖ not Teams-meeting features here — the gated base methods throw `BridgeCapabilityNotSupportedError` |
|
|
44
|
+
|
|
45
|
+
Capability gating is two-layer (defense-in-depth): the engine checks the provider's `SupportedFeatures`
|
|
46
|
+
first, and the driver re-asserts each flag with `RequireFeature` at the top of its overrides.
|
|
47
|
+
|
|
48
|
+
### Teams vs. Zoom capability differences
|
|
49
|
+
|
|
50
|
+
Teams advertises everything Zoom does, **plus** `InviteJoin`, `NativeInvite`, and `InboundRouting` (the
|
|
51
|
+
calendar-invite / marketplace-native-invite / inbound-routing UX), and its native raised-hand is **partial**
|
|
52
|
+
rather than fully reliable. Everything else (audio in/out, directional video/screen, diarized roster,
|
|
53
|
+
mute, meeting chat) maps one-to-one onto the Zoom reference driver.
|
|
54
|
+
|
|
55
|
+
## The Teams calling-bot SDK seam (`ITeamsMeetingSdk`)
|
|
56
|
+
|
|
57
|
+
The driver never imports the real Teams / ACS SDK. It depends only on this minimal interface, named after
|
|
58
|
+
Microsoft Teams / Azure Communication Services calling-bot concepts:
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
export interface ITeamsMeetingSdk {
|
|
62
|
+
join(args: TeamsJoinArgs): Promise<TeamsJoinResult>;
|
|
63
|
+
leave(): Promise<void>;
|
|
64
|
+
sendAudioFrame(pcm: ArrayBuffer): void; // agent's voice out (outbound audio socket)
|
|
65
|
+
onAudioFrame(cb: (frame: TeamsAudioFrame) => void): void; // raw per-participant audio in (diarization)
|
|
66
|
+
onParticipantJoin(cb: (p: TeamsParticipant) => void): void;
|
|
67
|
+
onParticipantLeave(cb: (id: string) => void): void;
|
|
68
|
+
onHandRaise(cb: (id: string, raised: boolean) => void): void; // ⚠️ partial on Teams
|
|
69
|
+
getParticipants(): Promise<TeamsParticipant[]>;
|
|
70
|
+
postChatMessage(text: string): Promise<void>; // Teams meeting chat thread
|
|
71
|
+
muteParticipant(participantId: string): Promise<void>;
|
|
72
|
+
onMeetingEnded(cb: () => void): void;
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Production binding (deployment TODO)
|
|
77
|
+
|
|
78
|
+
In production this is bound to the **Azure Communication Services (ACS) calling-bot** SDK plus the
|
|
79
|
+
**Microsoft Graph cloud-communications API** (`/communications/calls`, application-hosted media) for
|
|
80
|
+
per-participant PCM audio, roster events, mute, and Teams meeting-chat posting. Supply a factory via the
|
|
81
|
+
creation seam:
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
import { TeamsBridge } from '@memberjunction/ai-bridge-teams';
|
|
85
|
+
|
|
86
|
+
// Once, where bridge drivers are configured:
|
|
87
|
+
// bridge.SetSdkFactory((config) => new RealTeamsSdkAdapter(config));
|
|
88
|
+
// The adapter implements ITeamsMeetingSdk over the real ACS/Graph SDK. The driver + its tests do not change.
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Out of the box, `TeamsBridge` ships **without** the real SDK adapter — `Connect` throws an explicit
|
|
92
|
+
"bind the real Microsoft Teams SDK" error until `SetSdkFactory` is called. Tests inject a `FakeTeamsSdk`.
|
|
93
|
+
|
|
94
|
+
## Usage (engine-driven)
|
|
95
|
+
|
|
96
|
+
The bridge is not used directly — `AIBridgeEngine.StartBridgeSession` (`@memberjunction/ai-bridge-server`)
|
|
97
|
+
resolves it from the provider's `DriverClass`, wires the transport seam to the injected
|
|
98
|
+
`IRealtimeSession`, and (when a channel host is supplied) wires the Meeting Controls channel from
|
|
99
|
+
`GetMeetingControlsEventSource`. See the bridge-server package and the guide's "Channel plane" section.
|
|
100
|
+
|
|
101
|
+
## Testing
|
|
102
|
+
|
|
103
|
+
`FakeTeamsSdk` (in `src/__tests__/`) is an in-memory `ITeamsMeetingSdk` with drive helpers and capture
|
|
104
|
+
sinks. The suite covers connect/disconnect (incl. parsing the meeting thread id out of the join URL),
|
|
105
|
+
audio in→`OnMedia` (speaker labels) and out→seam, participant join/leave → roster + event source, native
|
|
106
|
+
hand-raise → Meeting Controls perception, capability gating (a feature Teams lacks throws), and chat — all
|
|
107
|
+
with no network.
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
cd packages/AI/Providers/BridgeTeams && npm run test
|
|
111
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './teams-sdk.js';
|
|
2
|
+
export * from './teams-meeting-controls.js';
|
|
3
|
+
export * from './teams-bridge.js';
|
|
4
|
+
export * from './teams-native-sdk.js';
|
|
5
|
+
export * from './register-native.js';
|
|
6
|
+
import { LoadTeamsBridge } from './teams-bridge.js';
|
|
7
|
+
import { RegisterTeamsNativeSdk } from './register-native.js';
|
|
8
|
+
// Static reference so bundlers cannot tree-shake the @RegisterClass(BaseRealtimeBridge, 'TeamsBridge')
|
|
9
|
+
// registration. Calling the no-op here keeps the driver resolvable by the engine's ClassFactory.
|
|
10
|
+
LoadTeamsBridge();
|
|
11
|
+
// Register Teams's native two-way SDK binding so the engine auto-binds it at StartBridgeSession.
|
|
12
|
+
RegisterTeamsNativeSdk();
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAElC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,uGAAuG;AACvG,iGAAiG;AACjG,eAAe,EAAE,CAAC;AAClB,iGAAiG;AACjG,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Registers the Teams **native two-way** SDK binding into the {@link BridgeNativeSdkRegistry}
|
|
3
|
+
* so `AIBridgeEngine.StartBridgeSession` auto-binds it onto a resolved `TeamsBridge` before connect — no
|
|
4
|
+
* per-deployment wiring needed. The typed downcast + `SetSdkFactory` stay confined here (where the concrete
|
|
5
|
+
* `TeamsBridge` type is known), keeping the engine seam free of provider types.
|
|
6
|
+
*
|
|
7
|
+
* A host can still override per-session via `StartBridgeSessionParams.BindSdk` — e.g. to use a different
|
|
8
|
+
* Teams binding instead of the native two-way default.
|
|
9
|
+
*
|
|
10
|
+
* @module @memberjunction/ai-bridge-teams
|
|
11
|
+
* @author MemberJunction.com
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Registers Teams's native two-way binding. Idempotent (latest-wins in the registry), and invoked from the
|
|
15
|
+
* package `index.ts` so merely importing `@memberjunction/ai-bridge-teams` wires the default binding. Also
|
|
16
|
+
* exported as a tree-shake-safe no-op-returning function callers can reference to force-retain the module.
|
|
17
|
+
*/
|
|
18
|
+
export declare function RegisterTeamsNativeSdk(): void;
|
|
19
|
+
//# sourceMappingURL=register-native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-native.d.ts","sourceRoot":"","sources":["../src/register-native.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAO7C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Registers the Teams **native two-way** SDK binding into the {@link BridgeNativeSdkRegistry}
|
|
3
|
+
* so `AIBridgeEngine.StartBridgeSession` auto-binds it onto a resolved `TeamsBridge` before connect — no
|
|
4
|
+
* per-deployment wiring needed. The typed downcast + `SetSdkFactory` stay confined here (where the concrete
|
|
5
|
+
* `TeamsBridge` type is known), keeping the engine seam free of provider types.
|
|
6
|
+
*
|
|
7
|
+
* A host can still override per-session via `StartBridgeSessionParams.BindSdk` — e.g. to use a different
|
|
8
|
+
* Teams binding instead of the native two-way default.
|
|
9
|
+
*
|
|
10
|
+
* @module @memberjunction/ai-bridge-teams
|
|
11
|
+
* @author MemberJunction.com
|
|
12
|
+
*/
|
|
13
|
+
import { BridgeNativeSdkRegistry } from '@memberjunction/ai-bridge-base';
|
|
14
|
+
import { BindTeamsNative } from './teams-native-sdk.js';
|
|
15
|
+
/** The `MJ: AI Bridge Providers.DriverClass` value the Teams provider row carries. */
|
|
16
|
+
const TEAMS_DRIVER_CLASS = 'TeamsBridge';
|
|
17
|
+
/**
|
|
18
|
+
* Registers Teams's native two-way binding. Idempotent (latest-wins in the registry), and invoked from the
|
|
19
|
+
* package `index.ts` so merely importing `@memberjunction/ai-bridge-teams` wires the default binding. Also
|
|
20
|
+
* exported as a tree-shake-safe no-op-returning function callers can reference to force-retain the module.
|
|
21
|
+
*/
|
|
22
|
+
export function RegisterTeamsNativeSdk() {
|
|
23
|
+
BridgeNativeSdkRegistry.Instance.Register(TEAMS_DRIVER_CLASS, (driver) => {
|
|
24
|
+
// Safe downcast: the registry is keyed by DriverClass, so the engine only ever applies this to the
|
|
25
|
+
// TeamsBridge it resolved for 'TeamsBridge'. BindTeamsNative() defaults to the lazy native loader,
|
|
26
|
+
// which reads NativeModuleSpecifier from the per-session Configuration.
|
|
27
|
+
driver.SetSdkFactory(BindTeamsNative());
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
// Register on import (mirrors the LoadTeamsBridge() tree-shake pattern in index.ts).
|
|
31
|
+
RegisterTeamsNativeSdk();
|
|
32
|
+
//# sourceMappingURL=register-native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-native.js","sourceRoot":"","sources":["../src/register-native.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,uBAAuB,EAAsB,MAAM,gCAAgC,CAAC;AAE7F,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,sFAAsF;AACtF,MAAM,kBAAkB,GAAG,aAAa,CAAC;AAEzC;;;;GAIG;AACH,MAAM,UAAU,sBAAsB;IAClC,uBAAuB,CAAC,QAAQ,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,MAA0B,EAAE,EAAE;QACzF,mGAAmG;QACnG,mGAAmG;QACnG,wEAAwE;QACvE,MAAsB,CAAC,aAAa,CAAC,eAAe,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACP,CAAC;AAED,qFAAqF;AACrF,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview `TeamsBridge` — the **Microsoft Teams** platform Realtime Bridge driver, connecting the
|
|
3
|
+
* one realtime agent engine to a **Teams meeting**. Implements the {@link BaseRealtimeBridge} contract
|
|
4
|
+
* against an injectable {@link ITeamsMeetingSdk} seam so it builds + unit-tests with NO network and NO
|
|
5
|
+
* real Teams / Azure Communication Services SDK (the Gemini `connectLiveSession` testability pattern).
|
|
6
|
+
* Structurally mirrors `ZoomBridge` (the reference driver) — only the platform names + join-coordinate
|
|
7
|
+
* parsing differ.
|
|
8
|
+
*
|
|
9
|
+
* Teams capability coverage (per the §8 seed row): on-demand + scheduled + invite + native-invite join,
|
|
10
|
+
* inbound routing, audio in/out (video/screen directional flags carried by transport), a diarized roster
|
|
11
|
+
* (`SpeakerDiarization`), participant mute + Teams meeting chat (via the Meeting Controls channel). Native
|
|
12
|
+
* raised-hand is ⚠️ partial over the calling-bot API — wired where the platform surfaces it, tolerant of
|
|
13
|
+
* it never firing. Telephony features (DTMF / transfer / recording) are NOT Teams-meeting features here,
|
|
14
|
+
* so those virtual base methods keep throwing `BridgeCapabilityNotSupportedError`.
|
|
15
|
+
*
|
|
16
|
+
* @module @memberjunction/ai-bridge-teams
|
|
17
|
+
* @author MemberJunction.com
|
|
18
|
+
*/
|
|
19
|
+
import { BaseRealtimeBridge, BridgeConnectResult, BridgeDisconnectReason, BridgeMediaFrame, BridgeMediaTrackKind, BridgeParticipantInfo, RealtimeBridgeContext, IBridgeMeetingControlsEventSource } from '@memberjunction/ai-bridge-base';
|
|
20
|
+
import { TeamsMeetingSdkFactory } from './teams-sdk.js';
|
|
21
|
+
/**
|
|
22
|
+
* The `DriverClass` key {@link TeamsBridge} registers under. A `MJ: AI Bridge Providers` row with
|
|
23
|
+
* `DriverClass = 'TeamsBridge'` resolves to this driver via the `ClassFactory`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const TEAMS_BRIDGE_DRIVER_CLASS = "TeamsBridge";
|
|
26
|
+
/**
|
|
27
|
+
* Realtime Bridge driver for **Microsoft Teams meetings**.
|
|
28
|
+
*
|
|
29
|
+
* Construct the driver with the default constructor (the engine's `ClassFactory` path) — it lazily
|
|
30
|
+
* builds the Teams SDK from the {@link sdkFactory} at {@link Connect} time. Tests inject a `FakeTeamsSdk`
|
|
31
|
+
* by overriding the factory via {@link SetSdkFactory} (the creation seam) before connecting.
|
|
32
|
+
*
|
|
33
|
+
* Registered via `@RegisterClass(BaseRealtimeBridge, 'TeamsBridge')`.
|
|
34
|
+
*/
|
|
35
|
+
export declare class TeamsBridge extends BaseRealtimeBridge {
|
|
36
|
+
/** The live Teams SDK seam for this session, created at {@link Connect}. */
|
|
37
|
+
private sdk;
|
|
38
|
+
/** The bot's own participant id in the joined meeting (set at {@link Connect}). */
|
|
39
|
+
private botParticipantId;
|
|
40
|
+
/** The inbound-media handler registered via {@link OnMedia}; raw audio frames are forwarded to it. */
|
|
41
|
+
private mediaHandler?;
|
|
42
|
+
/** The roster-change handler registered via {@link OnParticipantChange}. */
|
|
43
|
+
private participantHandler?;
|
|
44
|
+
/** The Meeting Controls event source for this session (only when diarization is supported). */
|
|
45
|
+
private meetingControls;
|
|
46
|
+
/**
|
|
47
|
+
* The SDK creation seam. Defaults to a factory that throws an explicit "bind the real Teams SDK"
|
|
48
|
+
* error, since this package ships WITHOUT the real SDK adapter (a deployment concern). Production
|
|
49
|
+
* sets a real factory via {@link SetSdkFactory}; tests inject a `FakeTeamsSdk`.
|
|
50
|
+
*/
|
|
51
|
+
private sdkFactory;
|
|
52
|
+
/**
|
|
53
|
+
* Sets the {@link TeamsMeetingSdkFactory} this driver uses to construct its SDK seam at connect —
|
|
54
|
+
* the creation seam (mirroring Gemini's overridable `connectLiveSession`). Production binds the
|
|
55
|
+
* real Teams ACS calling-bot adapter here; tests inject a `FakeTeamsSdk`.
|
|
56
|
+
*
|
|
57
|
+
* @param factory The factory that builds the {@link ITeamsMeetingSdk} for a session.
|
|
58
|
+
*/
|
|
59
|
+
SetSdkFactory(factory: TeamsMeetingSdkFactory): void;
|
|
60
|
+
/**
|
|
61
|
+
* Joins the Teams meeting and brings the bot online. Captures the capability context, builds the SDK
|
|
62
|
+
* from the {@link sdkFactory}, wires the inbound raw-audio path and meeting-ended callback, joins,
|
|
63
|
+
* and (when the provider diarizes) constructs + seeds the Meeting Controls event source.
|
|
64
|
+
*
|
|
65
|
+
* @param ctx The bridge context (features, provider name, the join URL as `Address`, config).
|
|
66
|
+
* @returns The bot participant + call (external connection) identifiers, persisted by the engine.
|
|
67
|
+
*/
|
|
68
|
+
Connect(ctx: RealtimeBridgeContext): Promise<BridgeConnectResult>;
|
|
69
|
+
/**
|
|
70
|
+
* Leaves the Teams meeting and releases all SDK resources. Tolerant of teardown errors.
|
|
71
|
+
*
|
|
72
|
+
* @param _reason Why the disconnect happened (Teams teardown is uniform; the bot simply leaves).
|
|
73
|
+
*/
|
|
74
|
+
Disconnect(_reason: BridgeDisconnectReason): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Sends an outbound media frame into the meeting. Audio is fed to the SDK's outbound audio-socket
|
|
77
|
+
* path; video/screen frames are gated by the directional capability flags (the transport carries
|
|
78
|
+
* them, and the SDK send is a deployment-time binding TODO — today the models emit audio).
|
|
79
|
+
*
|
|
80
|
+
* @param track The outbound track the frame targets.
|
|
81
|
+
* @param frame The media frame to send.
|
|
82
|
+
*/
|
|
83
|
+
SendMedia(track: BridgeMediaTrackKind, frame: BridgeMediaFrame): void;
|
|
84
|
+
/**
|
|
85
|
+
* Registers the inbound-media handler. The driver forwards each raw per-participant audio frame
|
|
86
|
+
* (with its speaker label) to this handler; the engine routes it to `IRealtimeSession.SendInput`.
|
|
87
|
+
*
|
|
88
|
+
* @param handler Invoked with each inbound media frame.
|
|
89
|
+
*/
|
|
90
|
+
OnMedia(handler: (frame: BridgeMediaFrame) => void): void;
|
|
91
|
+
/**
|
|
92
|
+
* Returns the current Teams participant roster (gated by `SpeakerDiarization`). Re-asserts the flag
|
|
93
|
+
* (defense-in-depth) so even an engine-bypassing caller cannot pull a roster a disabled provider
|
|
94
|
+
* forbids.
|
|
95
|
+
*
|
|
96
|
+
* @returns The current participants.
|
|
97
|
+
* @throws {BridgeCapabilityNotSupportedError} when diarization is not enabled for the provider.
|
|
98
|
+
*/
|
|
99
|
+
GetParticipants(): Promise<BridgeParticipantInfo[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Registers a roster-change handler (gated by `SpeakerDiarization`). The driver fires it from the
|
|
102
|
+
* SDK's participant join/leave stream with the full current roster.
|
|
103
|
+
*
|
|
104
|
+
* @param handler Invoked with the updated participant list on each change.
|
|
105
|
+
* @throws {BridgeCapabilityNotSupportedError} when diarization is not enabled.
|
|
106
|
+
*/
|
|
107
|
+
OnParticipantChange(handler: (participants: BridgeParticipantInfo[]) => void): void;
|
|
108
|
+
/**
|
|
109
|
+
* Returns the Teams Meeting Controls event source for this session (roster · hand-raise · speaking ·
|
|
110
|
+
* mute), or `null` when diarization is off (no roster to facilitate). The engine wires the Meeting
|
|
111
|
+
* Controls channel from this.
|
|
112
|
+
*/
|
|
113
|
+
GetMeetingControlsEventSource(): IBridgeMeetingControlsEventSource | null;
|
|
114
|
+
/**
|
|
115
|
+
* Posts a message to the Teams meeting chat. Exposed for the channel plane / turn-taking hybrid
|
|
116
|
+
* mode (the social-cost-free "raise hand"). Best-effort — a chat failure is logged, never fatal.
|
|
117
|
+
*
|
|
118
|
+
* @param text The chat message to post.
|
|
119
|
+
*/
|
|
120
|
+
PostChatMessage(text: string): Promise<void>;
|
|
121
|
+
/** The bot's participant id in the joined meeting (or `null` before {@link Connect}). */
|
|
122
|
+
get BotParticipantId(): string | null;
|
|
123
|
+
/** Wires the SDK's inbound raw-audio callback to a diarized inbound {@link BridgeMediaFrame}. */
|
|
124
|
+
private wireInboundAudio;
|
|
125
|
+
/**
|
|
126
|
+
* Wires the SDK's participant join/leave + hand-raise streams ONCE (the driver is the single owner;
|
|
127
|
+
* the SDK seam is latest-handler-wins). Each roster change fans out to both the driver's own
|
|
128
|
+
* roster-change handler and the Meeting Controls source; hand-raise signals (⚠️ partial on Teams)
|
|
129
|
+
* feed the source.
|
|
130
|
+
*/
|
|
131
|
+
private wireRoster;
|
|
132
|
+
/** Pulls the current roster from the SDK and fans it out to both the participant handler + Meeting Controls. */
|
|
133
|
+
private refreshRoster;
|
|
134
|
+
/** Handles the SDK's meeting-ended signal: surface an empty roster so the engine sees everyone gone. */
|
|
135
|
+
private handleMeetingEnded;
|
|
136
|
+
/** Builds the SDK join args from the bridge context (Address is the meeting join URL). */
|
|
137
|
+
private buildJoinArgs;
|
|
138
|
+
/**
|
|
139
|
+
* Extracts the meeting thread id from a Teams `meetup-join` URL when present, else `undefined`. The
|
|
140
|
+
* thread id is the `19:meeting_...@thread.v2` segment embedded (URL-encoded) in the join link.
|
|
141
|
+
* Tolerant — a non-matching address yields `undefined` so the SDK can resolve coordinates itself.
|
|
142
|
+
*/
|
|
143
|
+
private parseThreadId;
|
|
144
|
+
/** Returns the PCM bytes of an outbound audio frame, preferring the binary payload. */
|
|
145
|
+
private framePcm;
|
|
146
|
+
/** Decodes a base64 payload to an `ArrayBuffer` (Node `Buffer` fast path, `atob` fallback). */
|
|
147
|
+
private decodeBase64;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Tree-shaking-prevention loader. Modern bundlers cannot see the `@RegisterClass` dynamic registration
|
|
151
|
+
* of {@link TeamsBridge} and may eliminate it. Import and call this no-op from a static code path
|
|
152
|
+
* (the package entry point does) so the `ClassFactory` can resolve `'TeamsBridge'`.
|
|
153
|
+
*/
|
|
154
|
+
export declare function LoadTeamsBridge(): void;
|
|
155
|
+
//# sourceMappingURL=teams-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teams-bridge.d.ts","sourceRoot":"","sources":["../src/teams-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,EACH,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EAErB,qBAAqB,EACrB,iCAAiC,EACpC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAEH,sBAAsB,EAKzB,MAAM,aAAa,CAAC;AAGrB;;;GAGG;AACH,eAAO,MAAM,yBAAyB,gBAAgB,CAAC;AA8BvD;;;;;;;;GAQG;AACH,qBACa,WAAY,SAAQ,kBAAkB;IAC/C,4EAA4E;IAC5E,OAAO,CAAC,GAAG,CAAiC;IAE5C,mFAAmF;IACnF,OAAO,CAAC,gBAAgB,CAAuB;IAE/C,sGAAsG;IACtG,OAAO,CAAC,YAAY,CAAC,CAAoC;IAEzD,4EAA4E;IAC5E,OAAO,CAAC,kBAAkB,CAAC,CAAkD;IAE7E,+FAA+F;IAC/F,OAAO,CAAC,eAAe,CAAgD;IAEvE;;;;OAIG;IACH,OAAO,CAAC,UAAU,CAMhB;IAEF;;;;;;OAMG;IACI,aAAa,CAAC,OAAO,EAAE,sBAAsB,GAAG,IAAI;IAM3D;;;;;;;OAOG;IACU,OAAO,CAAC,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA2B9E;;;;OAIG;IACU,UAAU,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBvE;;;;;;;OAOG;IACI,SAAS,CAAC,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAuB5E;;;;;OAKG;IACI,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,IAAI;IAMhE;;;;;;;OAOG;IACmB,eAAe,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;IASzE;;;;;;OAMG;IACa,mBAAmB,CAAC,OAAO,EAAE,CAAC,YAAY,EAAE,qBAAqB,EAAE,KAAK,IAAI,GAAG,IAAI;IAKnG;;;;OAIG;IACa,6BAA6B,IAAI,iCAAiC,GAAG,IAAI;IAMzF;;;;;OAKG;IACU,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWzD,yFAAyF;IACzF,IAAW,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAE3C;IAID,iGAAiG;IACjG,OAAO,CAAC,gBAAgB;IAWxB;;;;;OAKG;IACH,OAAO,CAAC,UAAU;IAMlB,gHAAgH;YAClG,aAAa;IAU3B,wGAAwG;IACxG,OAAO,CAAC,kBAAkB;IAK1B,0FAA0F;IAC1F,OAAO,CAAC,aAAa;IAWrB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAerB,uFAAuF;IACvF,OAAO,CAAC,QAAQ;IAUhB,+FAA+F;IAC/F,OAAO,CAAC,YAAY;CAevB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAEtC"}
|