tirtc-devtools-cli 0.0.5 → 0.0.7
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 +4 -2
- package/USAGE.md +152 -365
- package/dist/devtools/cli/src/config.d.ts +4 -13
- package/dist/devtools/cli/src/config.js +7 -19
- package/dist/devtools/cli/src/facade.d.ts +39 -154
- package/dist/devtools/cli/src/facade.js +9 -23
- package/dist/devtools/cli/src/guide.js +7 -9
- package/dist/devtools/cli/src/index.js +146 -248
- package/dist/devtools/cli/src/progress.d.ts +19 -0
- package/dist/devtools/cli/src/progress.js +63 -0
- package/dist/devtools/cli/src/token_command.d.ts +7 -0
- package/dist/devtools/cli/src/token_command.js +139 -0
- package/package.json +1 -1
- package/vendor/app-server/bin/native/macos-arm64/credential_napi.node +0 -0
- package/vendor/app-server/bin/native/macos-arm64/runtime_host_napi.node +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/trp.h +30 -17
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_audio.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_credential.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_facade.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_http.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_foundation_logging.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_media.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_transport.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libmatrix_runtime_video.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/manifest.txt +10 -10
- package/vendor/app-server/dist/host/HostProtocol.d.ts +7 -5
- package/vendor/app-server/dist/host/HostProtocol.js +21 -10
- package/vendor/app-server/dist/host/HostServer.d.ts +2 -2
- package/vendor/app-server/dist/host/HostServer.js +93 -35
- package/vendor/app-server/dist/host/HostState.d.ts +0 -5
- package/vendor/app-server/dist/host/HostState.js +0 -1
- package/vendor/app-server/dist/host/RuntimeAdapter.d.ts +12 -0
- package/vendor/app-server/dist/host/RuntimeAdapter.js +42 -3
- package/vendor/app-server/dist/host/RuntimeSendWorker.d.ts +4 -0
- package/vendor/app-server/dist/host/RuntimeSendWorker.js +17 -0
- package/vendor/app-server/dist/protocol/contract.d.ts +72 -14
- package/vendor/app-server/dist/protocol/contract.js +11 -8
|
@@ -28,7 +28,13 @@ export interface RuntimeAdapter {
|
|
|
28
28
|
connect(serviceEntry: string | undefined, peerId: string, token: string, timeoutMs: number): Promise<string>;
|
|
29
29
|
disconnect(): Promise<void>;
|
|
30
30
|
startSendStream(streamId: number, media: string, source: StreamSource): Promise<RuntimeSendStartResult>;
|
|
31
|
+
startSendStreams?(streams: Array<{
|
|
32
|
+
streamId: number;
|
|
33
|
+
media: string;
|
|
34
|
+
source: StreamSource;
|
|
35
|
+
}>): Promise<RuntimeSendStartResult[]>;
|
|
31
36
|
stopSendStream(streamId: number): Promise<void>;
|
|
37
|
+
sendStreamMessage(streamId: number, payload: string): Promise<void>;
|
|
32
38
|
startReceiveStream(streamId: number, media: string): Promise<void>;
|
|
33
39
|
stopReceiveStream(streamId: number): Promise<void>;
|
|
34
40
|
attachOutput(streamId: number, consumer: string, mediaView: string, format: string, delivery: string, targetPath?: string, maxFiles?: number): Promise<OutputAttachResult>;
|
|
@@ -71,7 +77,13 @@ export declare class RuntimeBackedAdapter implements RuntimeAdapter {
|
|
|
71
77
|
connect(serviceEntry: string | undefined, peerId: string, token: string, timeoutMs: number): Promise<string>;
|
|
72
78
|
disconnect(): Promise<void>;
|
|
73
79
|
startSendStream(streamId: number, media: string, source: StreamSource): Promise<RuntimeSendStartResult>;
|
|
80
|
+
startSendStreams(streams: Array<{
|
|
81
|
+
streamId: number;
|
|
82
|
+
media: string;
|
|
83
|
+
source: StreamSource;
|
|
84
|
+
}>): Promise<RuntimeSendStartResult[]>;
|
|
74
85
|
stopSendStream(streamId: number): Promise<void>;
|
|
86
|
+
sendStreamMessage(streamId: number, payload: string): Promise<void>;
|
|
75
87
|
startReceiveStream(streamId: number, media: string): Promise<void>;
|
|
76
88
|
stopReceiveStream(streamId: number): Promise<void>;
|
|
77
89
|
attachOutput(streamId: number, consumer: string, mediaView: string, format: string, delivery: string, targetPath?: string, maxFiles?: number): Promise<OutputAttachResult>;
|
|
@@ -262,7 +262,6 @@ class RuntimeBackedAdapter {
|
|
|
262
262
|
async startService(serviceEntry, license, timeoutMs) {
|
|
263
263
|
this.assertRuntimeBundleReady();
|
|
264
264
|
const resolvedServiceEntry = this.resolveServiceEntry(serviceEntry);
|
|
265
|
-
const senderBootstrap = await this.sendWorker.ensureServiceSession(resolvedServiceEntry, license);
|
|
266
265
|
this.activeService = {
|
|
267
266
|
serviceEntry: resolvedServiceEntry,
|
|
268
267
|
license,
|
|
@@ -272,8 +271,7 @@ class RuntimeBackedAdapter {
|
|
|
272
271
|
serviceEntry: resolvedServiceEntry,
|
|
273
272
|
licensePresent: license.length > 0,
|
|
274
273
|
timeoutMs,
|
|
275
|
-
senderBootstrapStarted:
|
|
276
|
-
senderWorkerPid: senderBootstrap.pid,
|
|
274
|
+
senderBootstrapStarted: false,
|
|
277
275
|
at: nowIsoString(),
|
|
278
276
|
});
|
|
279
277
|
return resolvedServiceEntry;
|
|
@@ -365,6 +363,36 @@ class RuntimeBackedAdapter {
|
|
|
365
363
|
});
|
|
366
364
|
return { autoStarted, workerPid };
|
|
367
365
|
}
|
|
366
|
+
async startSendStreams(streams) {
|
|
367
|
+
const activeService = this.activeService;
|
|
368
|
+
if (!activeService || streams.length === 0) {
|
|
369
|
+
return streams.map(() => ({ autoStarted: false }));
|
|
370
|
+
}
|
|
371
|
+
const bindings = streams.map((stream) => ({
|
|
372
|
+
key: String(stream.streamId) + '/' + stream.media,
|
|
373
|
+
serviceEntry: activeService.serviceEntry,
|
|
374
|
+
license: activeService.license,
|
|
375
|
+
assetsDir: resolveStreamAssetsDir(stream.source),
|
|
376
|
+
streamId: stream.streamId,
|
|
377
|
+
media: stream.media === 'audio' ? 'audio' : 'video',
|
|
378
|
+
}));
|
|
379
|
+
const startResult = await this.sendWorker.startDeviceStreams(bindings);
|
|
380
|
+
const startedAt = nowIsoString();
|
|
381
|
+
for (const binding of bindings) {
|
|
382
|
+
this.emit('stream', 'send.start.requested', {
|
|
383
|
+
streamId: binding.streamId,
|
|
384
|
+
media: binding.media,
|
|
385
|
+
sourceMode: 'local_assets',
|
|
386
|
+
assetsDir: binding.assetsDir,
|
|
387
|
+
connected: this.connected,
|
|
388
|
+
workerPid: startResult.pid,
|
|
389
|
+
autoStarted: startResult.started,
|
|
390
|
+
deferred: false,
|
|
391
|
+
at: startedAt,
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
return bindings.map(() => ({ autoStarted: startResult.started, workerPid: startResult.pid }));
|
|
395
|
+
}
|
|
368
396
|
async stopSendStream(streamId) {
|
|
369
397
|
const keys = [String(streamId) + '/audio', String(streamId) + '/video'];
|
|
370
398
|
for (const key of keys) {
|
|
@@ -372,6 +400,17 @@ class RuntimeBackedAdapter {
|
|
|
372
400
|
}
|
|
373
401
|
this.emit('stream', 'send.stop.requested', { streamId, at: nowIsoString() });
|
|
374
402
|
}
|
|
403
|
+
async sendStreamMessage(streamId, payload) {
|
|
404
|
+
if (!this.connected) {
|
|
405
|
+
throw new Error('connection is not established');
|
|
406
|
+
}
|
|
407
|
+
this.emit('stream', 'message.runtime.send', {
|
|
408
|
+
streamId,
|
|
409
|
+
payloadPreview: payload.slice(0, 120),
|
|
410
|
+
payloadLength: payload.length,
|
|
411
|
+
at: nowIsoString(),
|
|
412
|
+
});
|
|
413
|
+
}
|
|
375
414
|
async startReceiveStream(streamId, media) {
|
|
376
415
|
if (!this.connected) {
|
|
377
416
|
throw new Error('connection is not established');
|
|
@@ -36,6 +36,10 @@ export declare class RuntimeSendWorkerManager {
|
|
|
36
36
|
started: boolean;
|
|
37
37
|
pid?: number;
|
|
38
38
|
}>;
|
|
39
|
+
startDeviceStreams(optionsList: SendWorkerStartOptions[]): Promise<{
|
|
40
|
+
started: boolean;
|
|
41
|
+
pid?: number;
|
|
42
|
+
}>;
|
|
39
43
|
stopStream(key: string): Promise<void>;
|
|
40
44
|
stopAll(): Promise<void>;
|
|
41
45
|
}
|
|
@@ -258,6 +258,23 @@ class RuntimeSendWorkerManager {
|
|
|
258
258
|
});
|
|
259
259
|
return await this.ensureSharedSession(options.serviceEntry, options.license, true);
|
|
260
260
|
}
|
|
261
|
+
async startDeviceStreams(optionsList) {
|
|
262
|
+
if (optionsList.length === 0) {
|
|
263
|
+
return { started: false };
|
|
264
|
+
}
|
|
265
|
+
for (const options of optionsList) {
|
|
266
|
+
this.bindings.set(options.key, {
|
|
267
|
+
key: options.key,
|
|
268
|
+
serviceEntry: options.serviceEntry,
|
|
269
|
+
license: options.license,
|
|
270
|
+
assetsDir: ensureValidAssetsDir(options.assetsDir),
|
|
271
|
+
streamId: options.streamId,
|
|
272
|
+
media: options.media,
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
const first = optionsList[0];
|
|
276
|
+
return await this.ensureSharedSession(first.serviceEntry, first.license, true);
|
|
277
|
+
}
|
|
261
278
|
async stopStream(key) {
|
|
262
279
|
this.bindings.delete(key);
|
|
263
280
|
const current = this.sharedSession;
|
|
@@ -748,14 +748,76 @@ export declare const ServiceStartRequestSchema: z.ZodObject<{
|
|
|
748
748
|
serviceEntry: z.ZodOptional<z.ZodString>;
|
|
749
749
|
license: z.ZodString;
|
|
750
750
|
timeoutMs: z.ZodNumber;
|
|
751
|
+
bootstrapSendStreams: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
752
|
+
streamId: z.ZodNumber;
|
|
753
|
+
media: z.ZodEnum<["audio", "video"]>;
|
|
754
|
+
source: z.ZodObject<{
|
|
755
|
+
mode: z.ZodLiteral<"local_assets">;
|
|
756
|
+
local_assets: z.ZodObject<{
|
|
757
|
+
assets_dir: z.ZodString;
|
|
758
|
+
}, "strip", z.ZodTypeAny, {
|
|
759
|
+
assets_dir: string;
|
|
760
|
+
}, {
|
|
761
|
+
assets_dir: string;
|
|
762
|
+
}>;
|
|
763
|
+
}, "strip", z.ZodTypeAny, {
|
|
764
|
+
mode: "local_assets";
|
|
765
|
+
local_assets: {
|
|
766
|
+
assets_dir: string;
|
|
767
|
+
};
|
|
768
|
+
}, {
|
|
769
|
+
mode: "local_assets";
|
|
770
|
+
local_assets: {
|
|
771
|
+
assets_dir: string;
|
|
772
|
+
};
|
|
773
|
+
}>;
|
|
774
|
+
}, "strip", z.ZodTypeAny, {
|
|
775
|
+
streamId: number;
|
|
776
|
+
media: "audio" | "video";
|
|
777
|
+
source: {
|
|
778
|
+
mode: "local_assets";
|
|
779
|
+
local_assets: {
|
|
780
|
+
assets_dir: string;
|
|
781
|
+
};
|
|
782
|
+
};
|
|
783
|
+
}, {
|
|
784
|
+
streamId: number;
|
|
785
|
+
media: "audio" | "video";
|
|
786
|
+
source: {
|
|
787
|
+
mode: "local_assets";
|
|
788
|
+
local_assets: {
|
|
789
|
+
assets_dir: string;
|
|
790
|
+
};
|
|
791
|
+
};
|
|
792
|
+
}>, "many">>;
|
|
751
793
|
}, "strip", z.ZodTypeAny, {
|
|
752
794
|
license: string;
|
|
753
795
|
timeoutMs: number;
|
|
754
796
|
serviceEntry?: string | undefined;
|
|
797
|
+
bootstrapSendStreams?: {
|
|
798
|
+
streamId: number;
|
|
799
|
+
media: "audio" | "video";
|
|
800
|
+
source: {
|
|
801
|
+
mode: "local_assets";
|
|
802
|
+
local_assets: {
|
|
803
|
+
assets_dir: string;
|
|
804
|
+
};
|
|
805
|
+
};
|
|
806
|
+
}[] | undefined;
|
|
755
807
|
}, {
|
|
756
808
|
license: string;
|
|
757
809
|
timeoutMs: number;
|
|
758
810
|
serviceEntry?: string | undefined;
|
|
811
|
+
bootstrapSendStreams?: {
|
|
812
|
+
streamId: number;
|
|
813
|
+
media: "audio" | "video";
|
|
814
|
+
source: {
|
|
815
|
+
mode: "local_assets";
|
|
816
|
+
local_assets: {
|
|
817
|
+
assets_dir: string;
|
|
818
|
+
};
|
|
819
|
+
};
|
|
820
|
+
}[] | undefined;
|
|
759
821
|
}>;
|
|
760
822
|
export declare const ConnectionConnectRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
761
823
|
serviceEntry: z.ZodOptional<z.ZodString>;
|
|
@@ -884,6 +946,16 @@ export declare const StreamSendStartRequestSchema: z.ZodObject<{
|
|
|
884
946
|
};
|
|
885
947
|
};
|
|
886
948
|
}>;
|
|
949
|
+
export declare const StreamMessageSendRequestSchema: z.ZodObject<{
|
|
950
|
+
streamId: z.ZodNumber;
|
|
951
|
+
payload: z.ZodString;
|
|
952
|
+
}, "strip", z.ZodTypeAny, {
|
|
953
|
+
payload: string;
|
|
954
|
+
streamId: number;
|
|
955
|
+
}, {
|
|
956
|
+
payload: string;
|
|
957
|
+
streamId: number;
|
|
958
|
+
}>;
|
|
887
959
|
export declare const OutputAttachRequestSchema: z.ZodObject<{
|
|
888
960
|
streamId: z.ZodNumber;
|
|
889
961
|
consumer: z.ZodString;
|
|
@@ -941,20 +1013,6 @@ export declare const EventsSubscribeRequestSchema: z.ZodObject<{
|
|
|
941
1013
|
}, {
|
|
942
1014
|
families: string[];
|
|
943
1015
|
}>;
|
|
944
|
-
export declare const StreamRequestPolicySchema: z.ZodObject<{
|
|
945
|
-
mode: z.ZodEnum<["manual", "auto-if-bound"]>;
|
|
946
|
-
}, "strip", z.ZodTypeAny, {
|
|
947
|
-
mode: "manual" | "auto-if-bound";
|
|
948
|
-
}, {
|
|
949
|
-
mode: "manual" | "auto-if-bound";
|
|
950
|
-
}>;
|
|
951
|
-
export declare const StreamRequestPolicySetRequestSchema: z.ZodObject<{
|
|
952
|
-
mode: z.ZodEnum<["manual", "auto-if-bound"]>;
|
|
953
|
-
}, "strip", z.ZodTypeAny, {
|
|
954
|
-
mode: "manual" | "auto-if-bound";
|
|
955
|
-
}, {
|
|
956
|
-
mode: "manual" | "auto-if-bound";
|
|
957
|
-
}>;
|
|
958
1016
|
export declare const DebugTokenQrcodeRequestSchema: z.ZodObject<{
|
|
959
1017
|
payload: z.ZodString;
|
|
960
1018
|
outputStem: z.ZodOptional<z.ZodString>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DebugTokenQrcodeResultSchema = exports.DebugTokenQrcodeRequestSchema = exports.
|
|
3
|
+
exports.DebugTokenQrcodeResultSchema = exports.DebugTokenQrcodeRequestSchema = exports.EventsSubscribeRequestSchema = exports.CommandSendRequestSchema = exports.OutputAttachRequestSchema = exports.StreamMessageSendRequestSchema = exports.StreamSendStartRequestSchema = exports.ConnectionConnectRequestSchema = exports.ServiceStartRequestSchema = exports.ArtifactExportResultSchema = exports.ReportDocumentSchema = exports.ErrorSummarySchema = exports.CommandSendResultSchema = exports.CommandResponseSchema = exports.OutputAttachmentSchema = exports.HostStatusSchema = exports.ArtifactPathsSchema = exports.StreamSnapshotSchema = exports.StreamSourceSchema = exports.StreamLocalAssetsSchema = exports.ConnectionSnapshotSchema = exports.ServiceSnapshotSchema = exports.EventEnvelopeSchema = exports.ErrorResponseSchema = exports.InitializedNotificationSchema = exports.InitializeResultSchema = exports.InitializeRequestSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.InitializeRequestSchema = zod_1.z.object({
|
|
6
6
|
protocolVersion: zod_1.z.string(),
|
|
@@ -135,7 +135,12 @@ exports.ArtifactExportResultSchema = zod_1.z.object({
|
|
|
135
135
|
exports.ServiceStartRequestSchema = zod_1.z.object({
|
|
136
136
|
serviceEntry: zod_1.z.string().optional(),
|
|
137
137
|
license: zod_1.z.string(),
|
|
138
|
-
timeoutMs: zod_1.z.number().int()
|
|
138
|
+
timeoutMs: zod_1.z.number().int(),
|
|
139
|
+
bootstrapSendStreams: zod_1.z.array(zod_1.z.object({
|
|
140
|
+
streamId: zod_1.z.number().int(),
|
|
141
|
+
media: zod_1.z.enum(['audio', 'video']),
|
|
142
|
+
source: exports.StreamSourceSchema,
|
|
143
|
+
})).optional(),
|
|
139
144
|
});
|
|
140
145
|
exports.ConnectionConnectRequestSchema = zod_1.z.object({
|
|
141
146
|
serviceEntry: zod_1.z.string().optional(),
|
|
@@ -159,6 +164,10 @@ exports.StreamSendStartRequestSchema = zod_1.z.object({
|
|
|
159
164
|
media: zod_1.z.string(),
|
|
160
165
|
source: exports.StreamSourceSchema,
|
|
161
166
|
});
|
|
167
|
+
exports.StreamMessageSendRequestSchema = zod_1.z.object({
|
|
168
|
+
streamId: zod_1.z.number().int(),
|
|
169
|
+
payload: zod_1.z.string(),
|
|
170
|
+
});
|
|
162
171
|
exports.OutputAttachRequestSchema = zod_1.z.object({
|
|
163
172
|
streamId: zod_1.z.number().int(),
|
|
164
173
|
consumer: zod_1.z.string(),
|
|
@@ -180,12 +189,6 @@ exports.CommandSendRequestSchema = zod_1.z.object({
|
|
|
180
189
|
exports.EventsSubscribeRequestSchema = zod_1.z.object({
|
|
181
190
|
families: zod_1.z.array(zod_1.z.string())
|
|
182
191
|
});
|
|
183
|
-
exports.StreamRequestPolicySchema = zod_1.z.object({
|
|
184
|
-
mode: zod_1.z.enum(['manual', 'auto-if-bound'])
|
|
185
|
-
});
|
|
186
|
-
exports.StreamRequestPolicySetRequestSchema = zod_1.z.object({
|
|
187
|
-
mode: zod_1.z.enum(['manual', 'auto-if-bound'])
|
|
188
|
-
});
|
|
189
192
|
exports.DebugTokenQrcodeRequestSchema = zod_1.z.object({
|
|
190
193
|
payload: zod_1.z.string(),
|
|
191
194
|
outputStem: zod_1.z.string().optional()
|