@crvouga/mockingbird-service-livekit 2.1.0 → 2.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/CHANGELOG.md +12 -4
- package/README.md +8 -4
- package/SUPPORT.md +6 -3
- package/dist/{chunk-RIGGRABC.js → chunk-FPXRYSAN.js} +122 -8
- package/dist/{chunk-RIGGRABC.js.map → chunk-FPXRYSAN.js.map} +2 -2
- package/dist/{chunk-2GG6WCKV.js → chunk-LCGGA6VQ.js} +2 -2
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +47 -3
- package/dist/index.js +1 -1
- package/dist/server.d.ts +44 -0
- package/dist/server.js +2 -2
- package/openapi.yaml +183 -1
- package/package.json +3 -2
- /package/dist/{chunk-2GG6WCKV.js.map → chunk-LCGGA6VQ.js.map} +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
createRuntime,
|
|
4
4
|
parseDuration,
|
|
5
5
|
resolveAdminPrefix
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FPXRYSAN.js";
|
|
7
7
|
|
|
8
8
|
// ../../adapters/node/dist/cli.js
|
|
9
9
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
@@ -818,4 +818,4 @@ export {
|
|
|
818
818
|
createServer2 as createServer,
|
|
819
819
|
serveTarget
|
|
820
820
|
};
|
|
821
|
-
//# sourceMappingURL=chunk-
|
|
821
|
+
//# sourceMappingURL=chunk-LCGGA6VQ.js.map
|
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -818,8 +818,8 @@ type OpenAPIDocument = {
|
|
|
818
818
|
};
|
|
819
819
|
|
|
820
820
|
declare const document: OpenAPIDocument;
|
|
821
|
-
declare const operationIds: readonly ["RoomService", "EgressService", "SipService"];
|
|
822
|
-
declare const supportedOperationIds: readonly ["RoomService", "EgressService", "SipService"];
|
|
821
|
+
declare const operationIds: readonly ["CreateDispatch", "ListDispatch", "DeleteDispatch", "RoomService", "EgressService", "SipService"];
|
|
822
|
+
declare const supportedOperationIds: readonly ["CreateDispatch", "ListDispatch", "DeleteDispatch", "RoomService", "EgressService", "SipService"];
|
|
823
823
|
|
|
824
824
|
/** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
|
|
825
825
|
type SqliteValue = null | number | bigint | string | Uint8Array | boolean;
|
|
@@ -897,8 +897,42 @@ type AsyncResource = {
|
|
|
897
897
|
input: Record<string, unknown>;
|
|
898
898
|
error?: string;
|
|
899
899
|
};
|
|
900
|
+
declare const JOB_STATUSES: readonly ["JS_PENDING", "JS_RUNNING", "JS_SUCCESS", "JS_FAILED"];
|
|
901
|
+
type JobStatus = (typeof JOB_STATUSES)[number];
|
|
902
|
+
type AgentJob = {
|
|
903
|
+
id: string;
|
|
904
|
+
dispatchId: string;
|
|
905
|
+
type: "JT_ROOM";
|
|
906
|
+
room: Omit<LiveKitRoom, "creationTime"> & {
|
|
907
|
+
creationTime: string;
|
|
908
|
+
};
|
|
909
|
+
metadata: string;
|
|
910
|
+
agentName: string;
|
|
911
|
+
state: {
|
|
912
|
+
status: JobStatus;
|
|
913
|
+
error: string;
|
|
914
|
+
startedAt: string;
|
|
915
|
+
endedAt: string;
|
|
916
|
+
updatedAt: string;
|
|
917
|
+
participantIdentity: string;
|
|
918
|
+
workerId: string;
|
|
919
|
+
agentId: string;
|
|
920
|
+
};
|
|
921
|
+
};
|
|
922
|
+
type AgentDispatch = {
|
|
923
|
+
id: string;
|
|
924
|
+
agentName: string;
|
|
925
|
+
room: string;
|
|
926
|
+
metadata: string;
|
|
927
|
+
state: {
|
|
928
|
+
jobs: AgentJob[];
|
|
929
|
+
createdAt: string;
|
|
930
|
+
deletedAt: string;
|
|
931
|
+
};
|
|
932
|
+
};
|
|
900
933
|
declare class LiveKitState {
|
|
901
934
|
readonly rooms: Collection<LiveKitRoom>;
|
|
935
|
+
readonly dispatches: Collection<AgentDispatch>;
|
|
902
936
|
readonly participants: Collection<LiveKitParticipant & {
|
|
903
937
|
room: string;
|
|
904
938
|
}>;
|
|
@@ -991,6 +1025,16 @@ declare class LiveKitAPI {
|
|
|
991
1025
|
kind: "egress" | "sip";
|
|
992
1026
|
roomName?: string;
|
|
993
1027
|
} | undefined;
|
|
1028
|
+
/** Script a single room job; workers and media transport are outside the mock. */
|
|
1029
|
+
assignJob(dispatchId: string, input: {
|
|
1030
|
+
status?: JobStatus;
|
|
1031
|
+
workerId?: string;
|
|
1032
|
+
agentId?: string;
|
|
1033
|
+
participantIdentity?: string;
|
|
1034
|
+
error?: string;
|
|
1035
|
+
}): AgentJob | undefined;
|
|
1036
|
+
private dispatchView;
|
|
1037
|
+
private dispatchService;
|
|
994
1038
|
private authorize;
|
|
995
1039
|
private roomService;
|
|
996
1040
|
private asyncService;
|
|
@@ -998,4 +1042,4 @@ declare class LiveKitAPI {
|
|
|
998
1042
|
}
|
|
999
1043
|
|
|
1000
1044
|
export { LIVEKIT_NAMESPACE, LIVEKIT_PRESETS, LiveKitAPI, createRuntime, document, operationIds, supportedOperationIds };
|
|
1001
|
-
export type { AsyncResource, DataMessage, LiveKitAPIOptions, LiveKitEvent, LiveKitParticipant, LiveKitRoom, LiveKitRuntime, LiveKitRuntimeOptions, LiveKitTrack };
|
|
1045
|
+
export type { AgentDispatch, AgentJob, AsyncResource, DataMessage, JobStatus, LiveKitAPIOptions, LiveKitEvent, LiveKitParticipant, LiveKitRoom, LiveKitRuntime, LiveKitRuntimeOptions, LiveKitTrack };
|
package/dist/index.js
CHANGED
package/dist/server.d.ts
CHANGED
|
@@ -1331,8 +1331,42 @@ type AsyncResource = {
|
|
|
1331
1331
|
input: Record<string, unknown>;
|
|
1332
1332
|
error?: string;
|
|
1333
1333
|
};
|
|
1334
|
+
declare const JOB_STATUSES: readonly ["JS_PENDING", "JS_RUNNING", "JS_SUCCESS", "JS_FAILED"];
|
|
1335
|
+
type JobStatus = (typeof JOB_STATUSES)[number];
|
|
1336
|
+
type AgentJob = {
|
|
1337
|
+
id: string;
|
|
1338
|
+
dispatchId: string;
|
|
1339
|
+
type: "JT_ROOM";
|
|
1340
|
+
room: Omit<LiveKitRoom, "creationTime"> & {
|
|
1341
|
+
creationTime: string;
|
|
1342
|
+
};
|
|
1343
|
+
metadata: string;
|
|
1344
|
+
agentName: string;
|
|
1345
|
+
state: {
|
|
1346
|
+
status: JobStatus;
|
|
1347
|
+
error: string;
|
|
1348
|
+
startedAt: string;
|
|
1349
|
+
endedAt: string;
|
|
1350
|
+
updatedAt: string;
|
|
1351
|
+
participantIdentity: string;
|
|
1352
|
+
workerId: string;
|
|
1353
|
+
agentId: string;
|
|
1354
|
+
};
|
|
1355
|
+
};
|
|
1356
|
+
type AgentDispatch = {
|
|
1357
|
+
id: string;
|
|
1358
|
+
agentName: string;
|
|
1359
|
+
room: string;
|
|
1360
|
+
metadata: string;
|
|
1361
|
+
state: {
|
|
1362
|
+
jobs: AgentJob[];
|
|
1363
|
+
createdAt: string;
|
|
1364
|
+
deletedAt: string;
|
|
1365
|
+
};
|
|
1366
|
+
};
|
|
1334
1367
|
declare class LiveKitState {
|
|
1335
1368
|
readonly rooms: Collection<LiveKitRoom>;
|
|
1369
|
+
readonly dispatches: Collection<AgentDispatch>;
|
|
1336
1370
|
readonly participants: Collection<LiveKitParticipant & {
|
|
1337
1371
|
room: string;
|
|
1338
1372
|
}>;
|
|
@@ -1404,6 +1438,16 @@ declare class LiveKitAPI {
|
|
|
1404
1438
|
kind: "egress" | "sip";
|
|
1405
1439
|
roomName?: string;
|
|
1406
1440
|
} | undefined;
|
|
1441
|
+
/** Script a single room job; workers and media transport are outside the mock. */
|
|
1442
|
+
assignJob(dispatchId: string, input: {
|
|
1443
|
+
status?: JobStatus;
|
|
1444
|
+
workerId?: string;
|
|
1445
|
+
agentId?: string;
|
|
1446
|
+
participantIdentity?: string;
|
|
1447
|
+
error?: string;
|
|
1448
|
+
}): AgentJob | undefined;
|
|
1449
|
+
private dispatchView;
|
|
1450
|
+
private dispatchService;
|
|
1407
1451
|
private authorize;
|
|
1408
1452
|
private roomService;
|
|
1409
1453
|
private asyncService;
|
package/dist/server.js
CHANGED
package/openapi.yaml
CHANGED
|
@@ -2,10 +2,85 @@ openapi: 3.1.0
|
|
|
2
2
|
info:
|
|
3
3
|
title: LiveKit Server API (Mockingbird subset)
|
|
4
4
|
version: "2.19.1"
|
|
5
|
-
description: Twirp JSON room, participant, egress, and SIP contract.
|
|
5
|
+
description: Twirp JSON room, participant, agent dispatch, egress, and SIP contract.
|
|
6
6
|
servers:
|
|
7
7
|
- url: https://example.livekit.cloud
|
|
8
8
|
paths:
|
|
9
|
+
/twirp/livekit.AgentDispatchService/CreateDispatch:
|
|
10
|
+
post:
|
|
11
|
+
operationId: CreateDispatch
|
|
12
|
+
description: Agent dispatch with a signed roomAdmin JWT; protobuf JSON names accept snake_case or camelCase.
|
|
13
|
+
security:
|
|
14
|
+
- bearerAuth: []
|
|
15
|
+
x-mockingbird:
|
|
16
|
+
supported: true
|
|
17
|
+
parity: { enabled: true, safe: false }
|
|
18
|
+
requestBody:
|
|
19
|
+
required: true
|
|
20
|
+
content:
|
|
21
|
+
application/json:
|
|
22
|
+
schema: { $ref: "#/components/schemas/CreateDispatchRequest" }
|
|
23
|
+
responses:
|
|
24
|
+
"200":
|
|
25
|
+
description: Protobuf JSON result
|
|
26
|
+
content:
|
|
27
|
+
application/json:
|
|
28
|
+
schema: { $ref: "#/components/schemas/AgentDispatch" }
|
|
29
|
+
"400": { $ref: "#/components/responses/TwirpError" }
|
|
30
|
+
"401": { $ref: "#/components/responses/TwirpError" }
|
|
31
|
+
"404": { $ref: "#/components/responses/TwirpError" }
|
|
32
|
+
"429": { $ref: "#/components/responses/TwirpError" }
|
|
33
|
+
"500": { $ref: "#/components/responses/TwirpError" }
|
|
34
|
+
/twirp/livekit.AgentDispatchService/ListDispatch:
|
|
35
|
+
post:
|
|
36
|
+
operationId: ListDispatch
|
|
37
|
+
description: Agent dispatch with a signed roomAdmin JWT; protobuf JSON names accept snake_case or camelCase.
|
|
38
|
+
security:
|
|
39
|
+
- bearerAuth: []
|
|
40
|
+
x-mockingbird:
|
|
41
|
+
supported: true
|
|
42
|
+
parity: { enabled: true, safe: true }
|
|
43
|
+
requestBody:
|
|
44
|
+
required: true
|
|
45
|
+
content:
|
|
46
|
+
application/json:
|
|
47
|
+
schema: { $ref: "#/components/schemas/ListDispatchRequest" }
|
|
48
|
+
responses:
|
|
49
|
+
"200":
|
|
50
|
+
description: Protobuf JSON result
|
|
51
|
+
content:
|
|
52
|
+
application/json:
|
|
53
|
+
schema: { $ref: "#/components/schemas/DispatchPage" }
|
|
54
|
+
"400": { $ref: "#/components/responses/TwirpError" }
|
|
55
|
+
"401": { $ref: "#/components/responses/TwirpError" }
|
|
56
|
+
"404": { $ref: "#/components/responses/TwirpError" }
|
|
57
|
+
"429": { $ref: "#/components/responses/TwirpError" }
|
|
58
|
+
"500": { $ref: "#/components/responses/TwirpError" }
|
|
59
|
+
/twirp/livekit.AgentDispatchService/DeleteDispatch:
|
|
60
|
+
post:
|
|
61
|
+
operationId: DeleteDispatch
|
|
62
|
+
description: Agent dispatch with a signed roomAdmin JWT; protobuf JSON names accept snake_case or camelCase.
|
|
63
|
+
security:
|
|
64
|
+
- bearerAuth: []
|
|
65
|
+
x-mockingbird:
|
|
66
|
+
supported: true
|
|
67
|
+
parity: { enabled: true, safe: false }
|
|
68
|
+
requestBody:
|
|
69
|
+
required: true
|
|
70
|
+
content:
|
|
71
|
+
application/json:
|
|
72
|
+
schema: { $ref: "#/components/schemas/DeleteDispatchRequest" }
|
|
73
|
+
responses:
|
|
74
|
+
"200":
|
|
75
|
+
description: Protobuf JSON result
|
|
76
|
+
content:
|
|
77
|
+
application/json:
|
|
78
|
+
schema: { $ref: "#/components/schemas/AgentDispatch" }
|
|
79
|
+
"400": { $ref: "#/components/responses/TwirpError" }
|
|
80
|
+
"401": { $ref: "#/components/responses/TwirpError" }
|
|
81
|
+
"404": { $ref: "#/components/responses/TwirpError" }
|
|
82
|
+
"429": { $ref: "#/components/responses/TwirpError" }
|
|
83
|
+
"500": { $ref: "#/components/responses/TwirpError" }
|
|
9
84
|
/twirp/livekit.RoomService/{method}:
|
|
10
85
|
post:
|
|
11
86
|
operationId: RoomService
|
|
@@ -35,3 +110,110 @@ paths:
|
|
|
35
110
|
requestBody: { required: true, content: { application/json: { schema: { type: object, additionalProperties: true } } } }
|
|
36
111
|
responses:
|
|
37
112
|
"200": { description: Protobuf JSON response, content: { application/json: { schema: { type: object, additionalProperties: true } } } }
|
|
113
|
+
components:
|
|
114
|
+
securitySchemes:
|
|
115
|
+
bearerAuth: { type: http, scheme: bearer, bearerFormat: JWT }
|
|
116
|
+
responses:
|
|
117
|
+
TwirpError:
|
|
118
|
+
description: Twirp error
|
|
119
|
+
content:
|
|
120
|
+
application/json:
|
|
121
|
+
schema: { $ref: "#/components/schemas/TwirpError" }
|
|
122
|
+
schemas:
|
|
123
|
+
TwirpError:
|
|
124
|
+
type: object
|
|
125
|
+
required: [code, msg, meta]
|
|
126
|
+
properties:
|
|
127
|
+
code: { type: string }
|
|
128
|
+
msg: { type: string }
|
|
129
|
+
meta: { type: object, additionalProperties: { type: string } }
|
|
130
|
+
RoomName: { type: string, minLength: 1, maxLength: 128 }
|
|
131
|
+
CreateDispatchRequest:
|
|
132
|
+
type: object
|
|
133
|
+
required: [room]
|
|
134
|
+
anyOf:
|
|
135
|
+
- required: [agentName]
|
|
136
|
+
- required: [agent_name]
|
|
137
|
+
properties:
|
|
138
|
+
room: { $ref: "#/components/schemas/RoomName" }
|
|
139
|
+
agentName: { type: string, minLength: 1, maxLength: 128 }
|
|
140
|
+
agent_name: { type: string, minLength: 1, maxLength: 128 }
|
|
141
|
+
metadata: { type: string, maxLength: 1024 }
|
|
142
|
+
ListDispatchRequest:
|
|
143
|
+
type: object
|
|
144
|
+
required: [room]
|
|
145
|
+
properties:
|
|
146
|
+
room: { $ref: "#/components/schemas/RoomName" }
|
|
147
|
+
dispatchId:
|
|
148
|
+
type: string
|
|
149
|
+
x-mockingbird-resource-ref: { type: agent_dispatch, missing: AD_missing }
|
|
150
|
+
dispatch_id:
|
|
151
|
+
type: string
|
|
152
|
+
x-mockingbird-resource-ref: { type: agent_dispatch, missing: AD_missing }
|
|
153
|
+
DeleteDispatchRequest:
|
|
154
|
+
allOf:
|
|
155
|
+
- $ref: "#/components/schemas/ListDispatchRequest"
|
|
156
|
+
- type: object
|
|
157
|
+
anyOf:
|
|
158
|
+
- required: [dispatchId]
|
|
159
|
+
- required: [dispatch_id]
|
|
160
|
+
AgentDispatch:
|
|
161
|
+
type: object
|
|
162
|
+
required: [id, agentName, room, metadata, state]
|
|
163
|
+
properties:
|
|
164
|
+
id:
|
|
165
|
+
type: string
|
|
166
|
+
x-mockingbird-resource: { type: agent_dispatch, identity: true }
|
|
167
|
+
agentName: { type: string }
|
|
168
|
+
room: { type: string }
|
|
169
|
+
metadata: { type: string }
|
|
170
|
+
state:
|
|
171
|
+
type: object
|
|
172
|
+
required: [jobs, createdAt, deletedAt]
|
|
173
|
+
properties:
|
|
174
|
+
createdAt:
|
|
175
|
+
type: string
|
|
176
|
+
pattern: "^[0-9]+$"
|
|
177
|
+
x-mockingbird-volatile: { kind: timestamp }
|
|
178
|
+
deletedAt:
|
|
179
|
+
type: string
|
|
180
|
+
pattern: "^[0-9]+$"
|
|
181
|
+
x-mockingbird-volatile: { kind: timestamp }
|
|
182
|
+
jobs:
|
|
183
|
+
type: array
|
|
184
|
+
items: { $ref: "#/components/schemas/AgentJob" }
|
|
185
|
+
AgentJob:
|
|
186
|
+
type: object
|
|
187
|
+
required: [id, dispatchId, type, room, metadata, agentName, state]
|
|
188
|
+
properties:
|
|
189
|
+
id: { type: string }
|
|
190
|
+
dispatchId: { type: string }
|
|
191
|
+
type: { type: string, enum: [JT_ROOM] }
|
|
192
|
+
room:
|
|
193
|
+
type: object
|
|
194
|
+
required: [sid, name, creationTime]
|
|
195
|
+
properties:
|
|
196
|
+
sid: { type: string }
|
|
197
|
+
name: { type: string }
|
|
198
|
+
creationTime: { type: string }
|
|
199
|
+
metadata: { type: string }
|
|
200
|
+
agentName: { type: string }
|
|
201
|
+
state:
|
|
202
|
+
type: object
|
|
203
|
+
required: [status, error, startedAt, endedAt, updatedAt, participantIdentity, workerId, agentId]
|
|
204
|
+
properties:
|
|
205
|
+
status: { type: string, enum: [JS_PENDING, JS_RUNNING, JS_SUCCESS, JS_FAILED] }
|
|
206
|
+
error: { type: string }
|
|
207
|
+
startedAt: { type: string }
|
|
208
|
+
endedAt: { type: string }
|
|
209
|
+
updatedAt: { type: string }
|
|
210
|
+
participantIdentity: { type: string }
|
|
211
|
+
workerId: { type: string }
|
|
212
|
+
agentId: { type: string }
|
|
213
|
+
DispatchPage:
|
|
214
|
+
type: object
|
|
215
|
+
required: [agentDispatches]
|
|
216
|
+
properties:
|
|
217
|
+
agentDispatches:
|
|
218
|
+
type: array
|
|
219
|
+
items: { $ref: "#/components/schemas/AgentDispatch" }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crvouga/mockingbird-service-livekit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Stateful LiveKit mock with Twirp room APIs, JWT grants, participants, data, SIP/egress controls, and signed webhooks.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
"@crvouga/mockingbird-sqlite": "0.0.0-development",
|
|
112
112
|
"@crvouga/mockingbird-testing": "0.1.0",
|
|
113
113
|
"fast-check": "4.9.0",
|
|
114
|
-
"livekit-server-sdk": "2.19.1"
|
|
114
|
+
"livekit-server-sdk": "2.19.1",
|
|
115
|
+
"livekit-reconciliation": "npm:livekit-server-sdk@2.19.0"
|
|
115
116
|
}
|
|
116
117
|
}
|
|
File without changes
|