@ai-matrx/meet 0.7.8 → 0.7.10
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/CHANGELOG.md +34 -0
- package/dist/index.cjs +77 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +77 -18
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +77 -18
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +77 -18
- package/dist/react.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1188,6 +1188,7 @@ declare const MEET_ANSWER_EVENTS: {
|
|
|
1188
1188
|
};
|
|
1189
1189
|
/** The `info` event carrying what the answer was built from. */
|
|
1190
1190
|
declare const MEET_ANSWER_CONTEXT_EVENT = "meet_intelligence_context";
|
|
1191
|
+
|
|
1191
1192
|
interface ServerRefusal {
|
|
1192
1193
|
readonly reason: string;
|
|
1193
1194
|
readonly remedy: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1188,6 +1188,7 @@ declare const MEET_ANSWER_EVENTS: {
|
|
|
1188
1188
|
};
|
|
1189
1189
|
/** The `info` event carrying what the answer was built from. */
|
|
1190
1190
|
declare const MEET_ANSWER_CONTEXT_EVENT = "meet_intelligence_context";
|
|
1191
|
+
|
|
1191
1192
|
interface ServerRefusal {
|
|
1192
1193
|
readonly reason: string;
|
|
1193
1194
|
readonly remedy: string;
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,20 @@ var MeetError = class extends Error {
|
|
|
23
23
|
return this.code === "permission-denied" || this.code === "device-not-found" || this.code === "device-in-use" || this.code === "insecure-context";
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
+
var SERVER_FAILED_SENTENCE = "The server hit an unexpected problem and nothing was changed.";
|
|
27
|
+
function isRawServerText(value) {
|
|
28
|
+
const text3 = value.trim();
|
|
29
|
+
return /^internal server error\b/i.test(text3) || /^[A-Z][A-Za-z0-9]*(Error|Exception)$/.test(text3) || /^[a-z][a-z0-9]*(_[a-z0-9]+)+$/.test(text3);
|
|
30
|
+
}
|
|
31
|
+
function humanDatabaseSentence(message) {
|
|
32
|
+
const text3 = message.trim();
|
|
33
|
+
if (text3.length === 0 || isRawServerText(text3)) return null;
|
|
34
|
+
if (/permission denied for|violates|relation "|does not exist|syntax error|column "|jwt|pgrst|duplicate key|null value in/i.test(
|
|
35
|
+
text3
|
|
36
|
+
))
|
|
37
|
+
return null;
|
|
38
|
+
return text3;
|
|
39
|
+
}
|
|
26
40
|
var FORBIDDEN_CODES = /* @__PURE__ */ new Set(["42501", "PGRST301", "PGRST302"]);
|
|
27
41
|
var NOT_FOUND_CODES = /* @__PURE__ */ new Set(["PGRST116", "PGRST205"]);
|
|
28
42
|
var CONFLICT_CODES = /* @__PURE__ */ new Set(["23505", "40001", "55000"]);
|
|
@@ -50,8 +64,8 @@ function normalizeMeetError(error, operation) {
|
|
|
50
64
|
if (code !== void 0 && FORBIDDEN_CODES.has(code)) {
|
|
51
65
|
return new MeetError(
|
|
52
66
|
"forbidden",
|
|
53
|
-
|
|
54
|
-
"
|
|
67
|
+
humanDatabaseSentence(message) ?? "You don't have access to do that in this meeting.",
|
|
68
|
+
"Ask the meeting's host to do it, or to give you access.",
|
|
55
69
|
error
|
|
56
70
|
);
|
|
57
71
|
}
|
|
@@ -66,15 +80,16 @@ function normalizeMeetError(error, operation) {
|
|
|
66
80
|
if (code !== void 0 && CONFLICT_CODES.has(code)) {
|
|
67
81
|
return new MeetError(
|
|
68
82
|
"conflict",
|
|
69
|
-
|
|
70
|
-
"
|
|
83
|
+
humanDatabaseSentence(message) ?? "This meeting changed a moment ago, so nothing was saved.",
|
|
84
|
+
"Reload to see the latest, then try again.",
|
|
71
85
|
error
|
|
72
86
|
);
|
|
73
87
|
}
|
|
88
|
+
const hint = error?.hint;
|
|
74
89
|
return new MeetError(
|
|
75
90
|
"transport",
|
|
76
|
-
|
|
77
|
-
|
|
91
|
+
/failed to fetch|networkerror|load failed|network request failed/i.test(message) ? "The server could not be reached." : humanDatabaseSentence(message) ?? SERVER_FAILED_SENTENCE,
|
|
92
|
+
typeof hint === "string" && humanDatabaseSentence(hint) !== null ? hint.trim() : "Nothing was changed \u2014 retry in a moment; if it keeps happening, reload the page.",
|
|
78
93
|
error
|
|
79
94
|
);
|
|
80
95
|
}
|
|
@@ -482,11 +497,6 @@ function readText(data) {
|
|
|
482
497
|
}
|
|
483
498
|
return "";
|
|
484
499
|
}
|
|
485
|
-
var SERVER_FAILED_SENTENCE = "The server hit an unexpected problem and nothing was changed.";
|
|
486
|
-
function isRawServerText(value) {
|
|
487
|
-
const text3 = value.trim();
|
|
488
|
-
return /^internal server error\b/i.test(text3) || /^[A-Z][A-Za-z0-9]*(Error|Exception)$/.test(text3) || /^[a-z][a-z0-9]*(_[a-z0-9]+)+$/.test(text3);
|
|
489
|
-
}
|
|
490
500
|
async function refusalFromResponse(response, operation, fallbackRemedy) {
|
|
491
501
|
let body = null;
|
|
492
502
|
try {
|
|
@@ -2800,6 +2810,15 @@ function createLiveKitDriver(handlers, options = {}) {
|
|
|
2800
2810
|
handlers.participants([local, ...remotes]);
|
|
2801
2811
|
};
|
|
2802
2812
|
projectRoster = roster;
|
|
2813
|
+
created.on(RoomEvent.TrackSubscribed, (track) => {
|
|
2814
|
+
if (track.kind !== Track.Kind.Audio || typeof document === "undefined") return;
|
|
2815
|
+
const element = track.attach();
|
|
2816
|
+
element.setAttribute("data-mx-meet-audio", "");
|
|
2817
|
+
audioSink().appendChild(element);
|
|
2818
|
+
}).on(RoomEvent.TrackUnsubscribed, (track) => {
|
|
2819
|
+
if (track.kind !== Track.Kind.Audio) return;
|
|
2820
|
+
for (const element of track.detach()) element.remove();
|
|
2821
|
+
});
|
|
2803
2822
|
created.on(RoomEvent.ParticipantConnected, roster).on(RoomEvent.ParticipantDisconnected, roster).on(RoomEvent.TrackSubscribed, roster).on(RoomEvent.TrackUnsubscribed, roster).on(RoomEvent.TrackMuted, roster).on(RoomEvent.TrackUnmuted, roster).on(RoomEvent.LocalTrackPublished, roster).on(RoomEvent.LocalTrackUnpublished, roster).on(RoomEvent.ParticipantNameChanged, roster).on(RoomEvent.ParticipantAttributesChanged, roster).on(RoomEvent.ParticipantMetadataChanged, roster).on(RoomEvent.RoomMetadataChanged, (metadata) => {
|
|
2804
2823
|
handlers.roomMetadata?.(metadata ?? "");
|
|
2805
2824
|
}).on(RoomEvent.ActiveSpeakersChanged, (speakers) => {
|
|
@@ -2815,6 +2834,8 @@ function createLiveKitDriver(handlers, options = {}) {
|
|
|
2815
2834
|
participant?.identity ?? null
|
|
2816
2835
|
);
|
|
2817
2836
|
}).on(RoomEvent.Disconnected, (reason) => {
|
|
2837
|
+
audioContainer?.remove();
|
|
2838
|
+
audioContainer = null;
|
|
2818
2839
|
handlers.disconnected(reason === void 0 ? null : String(reason));
|
|
2819
2840
|
});
|
|
2820
2841
|
try {
|
|
@@ -2856,10 +2877,26 @@ function createLiveKitDriver(handlers, options = {}) {
|
|
|
2856
2877
|
microphone: Track.Source.Microphone,
|
|
2857
2878
|
screen: Track.Source.ScreenShare
|
|
2858
2879
|
};
|
|
2880
|
+
trackEvents = {
|
|
2881
|
+
subscribed: RoomEvent.TrackSubscribed,
|
|
2882
|
+
localPublished: RoomEvent.LocalTrackPublished
|
|
2883
|
+
};
|
|
2859
2884
|
room = created;
|
|
2860
2885
|
return created;
|
|
2861
2886
|
}
|
|
2862
2887
|
let sources = null;
|
|
2888
|
+
let trackEvents = null;
|
|
2889
|
+
let audioContainer = null;
|
|
2890
|
+
function audioSink() {
|
|
2891
|
+
if (audioContainer !== null && audioContainer.isConnected) return audioContainer;
|
|
2892
|
+
const container = document.createElement("div");
|
|
2893
|
+
container.setAttribute("data-mx-meet-audio-sink", "");
|
|
2894
|
+
container.setAttribute("aria-hidden", "true");
|
|
2895
|
+
container.style.display = "none";
|
|
2896
|
+
document.body.appendChild(container);
|
|
2897
|
+
audioContainer = container;
|
|
2898
|
+
return container;
|
|
2899
|
+
}
|
|
2863
2900
|
function requireRoom(operation) {
|
|
2864
2901
|
if (room === null) {
|
|
2865
2902
|
throw new MeetError(
|
|
@@ -2890,6 +2927,8 @@ function createLiveKitDriver(handlers, options = {}) {
|
|
|
2890
2927
|
} catch {
|
|
2891
2928
|
}
|
|
2892
2929
|
projectRoster = null;
|
|
2930
|
+
audioContainer?.remove();
|
|
2931
|
+
audioContainer = null;
|
|
2893
2932
|
await target.disconnect();
|
|
2894
2933
|
},
|
|
2895
2934
|
async setMicrophoneEnabled(enabled) {
|
|
@@ -2955,14 +2994,33 @@ function createLiveKitDriver(handlers, options = {}) {
|
|
|
2955
2994
|
attach(identity, kind, element) {
|
|
2956
2995
|
const target = requireRoom("attach");
|
|
2957
2996
|
const source = sources?.[kind];
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
const
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2997
|
+
if (source === void 0) return () => void 0;
|
|
2998
|
+
let current = null;
|
|
2999
|
+
const sync = () => {
|
|
3000
|
+
const participant = target.localParticipant.identity === identity ? target.localParticipant : target.remoteParticipants.get(identity);
|
|
3001
|
+
const track = participant?.getTrackPublication(source)?.track;
|
|
3002
|
+
if (track === void 0 || track === current) return;
|
|
3003
|
+
current?.detach(element);
|
|
3004
|
+
track.attach(element);
|
|
3005
|
+
current = track;
|
|
3006
|
+
};
|
|
3007
|
+
const onTrack = (...args) => {
|
|
3008
|
+
const who = args[args.length - 1];
|
|
3009
|
+
if (who?.identity === identity) sync();
|
|
3010
|
+
};
|
|
3011
|
+
sync();
|
|
3012
|
+
const events = trackEvents;
|
|
3013
|
+
if (events !== null) {
|
|
3014
|
+
target.on(events.subscribed, onTrack);
|
|
3015
|
+
target.on(events.localPublished, onTrack);
|
|
3016
|
+
}
|
|
2964
3017
|
return () => {
|
|
2965
|
-
|
|
3018
|
+
if (events !== null) {
|
|
3019
|
+
target.off(events.subscribed, onTrack);
|
|
3020
|
+
target.off(events.localPublished, onTrack);
|
|
3021
|
+
}
|
|
3022
|
+
current?.detach(element);
|
|
3023
|
+
current = null;
|
|
2966
3024
|
};
|
|
2967
3025
|
},
|
|
2968
3026
|
activeDevices() {
|
|
@@ -3891,6 +3949,7 @@ function kindOf(person) {
|
|
|
3891
3949
|
if (person.role === "host") return "host";
|
|
3892
3950
|
if (person.role === "cohost") return "cohost";
|
|
3893
3951
|
if (person.role === "guest") return person.userId !== null ? "signed-in guest" : "guest";
|
|
3952
|
+
if (person.userId === null) return "guest";
|
|
3894
3953
|
return "member";
|
|
3895
3954
|
}
|
|
3896
3955
|
function ms(iso) {
|