tirtc-devtools-cli 0.0.10 → 0.0.12
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 +17 -11
- package/USAGE.md +148 -41
- package/bin/tirtc-devtools-cli.js +1 -1
- package/dist/cli/src/bootstrap_flows.d.ts +46 -0
- package/dist/cli/src/bootstrap_flows.js +249 -0
- package/dist/{devtools/cli → cli}/src/config.d.ts +4 -15
- package/dist/{devtools/cli → cli}/src/config.js +8 -8
- package/dist/cli/src/default_paths.d.ts +3 -0
- package/dist/cli/src/default_paths.js +23 -0
- package/dist/{devtools/cli → cli}/src/embedded_paths.d.ts +1 -0
- package/dist/{devtools/cli → cli}/src/embedded_paths.js +18 -1
- package/dist/{devtools/cli → cli}/src/facade.d.ts +41 -235
- package/dist/{devtools/cli → cli}/src/facade.js +8 -27
- package/dist/cli/src/guide.js +47 -0
- package/dist/{devtools/cli → cli}/src/index.js +67 -153
- package/dist/{devtools/cli → cli}/src/session_manager.js +9 -11
- package/dist/{devtools/cli → cli}/src/token_command.js +80 -16
- package/dist/cli/src/token_tool.d.ts +55 -0
- package/dist/{devtools/cli → cli}/src/token_tool.js +143 -47
- package/dist/{devtools/cli → cli}/src/transport.d.ts +1 -1
- package/package.json +6 -2
- package/script/ensure_ffmpeg.sh +1 -1
- package/vendor/app-server/bin/native/linux-x64/credential_napi.node +0 -0
- package/vendor/app-server/bin/native/macos-arm64/credential_napi.node +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/credential.h +34 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/error.h +13 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/foundation/build_info.h +27 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/http.h +57 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/logging.h +3 -1
- package/vendor/app-server/bin/runtime/linux-x64/lib/libcrypto.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_credential.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_http.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_foundation_logging.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libssl.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/manifest.txt +2 -32
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/audio.h +44 -305
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/av.h +52 -372
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/error.h +2 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/media_downlink.h +6 -0
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/transport.h +58 -133
- package/vendor/app-server/bin/runtime/macos-arm64/include/tirtc/trp.h +56 -511
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libTGTRP.a +0 -0
- package/vendor/app-server/bin/runtime/macos-arm64/lib/libTiRTC.a +0 -0
- 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 +19 -15
- package/vendor/app-server/dist/host/HostCommandCoordinator.d.ts +19 -0
- package/vendor/app-server/dist/host/HostCommandCoordinator.js +196 -0
- package/vendor/app-server/dist/host/HostProtocol.d.ts +1 -11
- package/vendor/app-server/dist/host/HostProtocol.js +3 -37
- package/vendor/app-server/dist/host/HostServer.d.ts +1 -4
- package/vendor/app-server/dist/host/HostServer.js +16 -152
- package/vendor/app-server/dist/host/RuntimeAdapter.js +2 -2
- package/vendor/app-server/dist/host/native/RuntimeCredentialTokenIssuer.js +3 -3
- package/vendor/app-server/dist/host/native/RuntimeHostBridge.js +4 -4
- package/vendor/app-server/dist/host/runtime_backed_preflight.js +2 -2
- package/vendor/app-server/dist/host/tests/helpers/runtime_e2e_local_config.js +1 -1
- package/vendor/app-server/dist/protocol/contract.d.ts +5 -64
- package/vendor/app-server/dist/protocol/contract.js +3 -12
- package/dist/devtools/cli/src/guide.js +0 -50
- package/dist/devtools/cli/src/token_tool.d.ts +0 -38
- package/dist/dummy.d.ts +0 -0
- package/dist/dummy.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -48
- package/vendor/app-server/bin/native/macos-arm64/libcrypto.dylib +0 -0
- package/vendor/app-server/bin/native/macos-arm64/libssl.dylib +0 -0
- package/vendor/app-server/bin/native/macos-arm64/runtime_host_napi.node +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_codec.h +0 -23
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_frame.h +0 -36
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io.h +0 -56
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_android.h +0 -19
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_apple.h +0 -19
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_harmony.h +0 -19
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_io_windows.h +0 -19
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_processing.h +0 -56
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/audio_sample_rate.h +0 -18
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_codec.h +0 -21
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_downlink.h +0 -89
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/media_uplink.h +0 -115
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/runtime.h +0 -236
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_codec.h +0 -57
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_frame.h +0 -55
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io.h +0 -46
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_android.h +0 -32
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_apple.h +0 -34
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_harmony.h +0 -32
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_io_windows.h +0 -26
- package/vendor/app-server/bin/runtime/linux-x64/include/tirtc/video_processing.h +0 -34
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_audio.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_facade.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_media.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libmatrix_runtime_video.a +0 -0
- package/vendor/app-server/bin/runtime/linux-x64/lib/libwebrtc_apm.a +0 -0
- package/vendor/app-server/dist/host/RuntimeCredentialTokenIssuer.d.ts +0 -30
- package/vendor/app-server/dist/host/RuntimeCredentialTokenIssuer.js +0 -224
- /package/dist/{devtools/cli → cli}/src/dummy.d.ts +0 -0
- /package/dist/{devtools/cli → cli}/src/dummy.js +0 -0
- /package/dist/{devtools/cli → cli}/src/ffmpeg_tool.d.ts +0 -0
- /package/dist/{devtools/cli → cli}/src/ffmpeg_tool.js +0 -0
- /package/dist/{devtools/cli → cli}/src/guide.d.ts +0 -0
- /package/dist/{devtools/cli → cli}/src/index.d.ts +0 -0
- /package/dist/{devtools/cli → cli}/src/media_assets.d.ts +0 -0
- /package/dist/{devtools/cli → cli}/src/media_assets.js +0 -0
- /package/dist/{devtools/cli → cli}/src/progress.d.ts +0 -0
- /package/dist/{devtools/cli → cli}/src/progress.js +0 -0
- /package/dist/{devtools/cli → cli}/src/session_manager.d.ts +0 -0
- /package/dist/{devtools/cli → cli}/src/token_command.d.ts +0 -0
- /package/dist/{devtools/cli → cli}/src/transport.js +0 -0
- /package/vendor/app-server/bin/{native/macos-arm64 → runtime/macos-arm64/lib}/libtgrtc.dylib +0 -0
|
@@ -36,8 +36,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.HostServer = void 0;
|
|
37
37
|
const fs = __importStar(require("fs"));
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
|
+
const HostCommandCoordinator_1 = require("./HostCommandCoordinator");
|
|
39
40
|
const TokenTool_1 = require("./TokenTool");
|
|
40
|
-
const RuntimeCredentialTokenIssuer_1 = require("./native/RuntimeCredentialTokenIssuer");
|
|
41
41
|
const HostState_1 = require("./HostState");
|
|
42
42
|
const HostProtocol_1 = require("./HostProtocol");
|
|
43
43
|
function streamBindingKey(streamId, media) {
|
|
@@ -64,48 +64,15 @@ function resolveLocalAssetsDir(source) {
|
|
|
64
64
|
}
|
|
65
65
|
return assetsDir;
|
|
66
66
|
}
|
|
67
|
-
function normalizeCommandPayload(payload) {
|
|
68
|
-
if (typeof payload === 'string') {
|
|
69
|
-
return {
|
|
70
|
-
payloadEncoding: 'utf8',
|
|
71
|
-
payload,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
if (payload instanceof Uint8Array) {
|
|
75
|
-
return {
|
|
76
|
-
payloadEncoding: 'base64',
|
|
77
|
-
payload: Buffer.from(payload).toString('base64'),
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
if (Array.isArray(payload) && payload.every((value) => typeof value === 'number')) {
|
|
81
|
-
return {
|
|
82
|
-
payloadEncoding: 'base64',
|
|
83
|
-
payload: Buffer.from(payload).toString('base64'),
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
if (typeof payload === 'object' && payload !== null && 'type' in payload && payload.type === 'Buffer') {
|
|
87
|
-
const data = payload.data;
|
|
88
|
-
if (Array.isArray(data) && data.every((value) => typeof value === 'number')) {
|
|
89
|
-
return {
|
|
90
|
-
payloadEncoding: 'base64',
|
|
91
|
-
payload: Buffer.from(data).toString('base64'),
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return {
|
|
96
|
-
payloadEncoding: 'utf8',
|
|
97
|
-
payload: '',
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
67
|
class HostServer {
|
|
101
68
|
state;
|
|
102
69
|
artifactManager;
|
|
103
70
|
runtimeAdapter;
|
|
71
|
+
commandCoordinator;
|
|
104
72
|
isInitialized = false;
|
|
105
73
|
eventCounter = 1;
|
|
106
74
|
commandSequence = 1;
|
|
107
75
|
tokenTool;
|
|
108
|
-
runtimeCredentialTokenIssuer;
|
|
109
76
|
eventSinks = new Set();
|
|
110
77
|
constructor(artifactManager, runtimeAdapter, hostEndpoint) {
|
|
111
78
|
this.state = new HostState_1.HostState();
|
|
@@ -114,11 +81,7 @@ class HostServer {
|
|
|
114
81
|
this.state.runtimeTarget = runtimeAdapter.runtimeTarget;
|
|
115
82
|
this.state.hostEndpoint = hostEndpoint ?? runtimeAdapter.hostEndpoint;
|
|
116
83
|
this.tokenTool = new TokenTool_1.TokenTool(this.artifactManager.getPaths().rootPath);
|
|
117
|
-
this.
|
|
118
|
-
repoRoot: runtimeAdapter.repoRoot,
|
|
119
|
-
platform: runtimeAdapter.platform,
|
|
120
|
-
runtimeBundleRoot: runtimeAdapter.runtimeBundleRoot,
|
|
121
|
-
});
|
|
84
|
+
this.commandCoordinator = new HostCommandCoordinator_1.HostCommandCoordinator(this.state, this.runtimeAdapter, (family, kind, payload) => this.writeEvent(family, kind, payload), () => this.snapshotPendingConnectionSummary(), (payload) => this.noteIncomingConnection(payload));
|
|
122
85
|
this.runtimeAdapter.setEventHandler((family, kind, payload) => {
|
|
123
86
|
this.handleRuntimeEvent(family, kind, payload);
|
|
124
87
|
});
|
|
@@ -218,7 +181,7 @@ class HostServer {
|
|
|
218
181
|
return;
|
|
219
182
|
}
|
|
220
183
|
if (kind === 'command.remote.requested') {
|
|
221
|
-
this.handleInboundRemoteCommandRequest(payload);
|
|
184
|
+
this.commandCoordinator.handleInboundRemoteCommandRequest(payload);
|
|
222
185
|
return;
|
|
223
186
|
}
|
|
224
187
|
if (kind === 'transport.remote.request_audio' ||
|
|
@@ -240,46 +203,6 @@ class HostServer {
|
|
|
240
203
|
peerId: this.state.connection.peerId,
|
|
241
204
|
};
|
|
242
205
|
}
|
|
243
|
-
handleInboundRemoteCommandRequest(payload) {
|
|
244
|
-
const remoteRequestId = Number(payload.remoteRequestId);
|
|
245
|
-
const commandId = Number(payload.commandId);
|
|
246
|
-
if (!Number.isInteger(remoteRequestId) || remoteRequestId <= 0 || !Number.isInteger(commandId)) {
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
this.noteIncomingConnection(payload);
|
|
250
|
-
const normalizedPayload = normalizeCommandPayload(payload.payload);
|
|
251
|
-
const entry = {
|
|
252
|
-
remoteRequestId,
|
|
253
|
-
commandId,
|
|
254
|
-
payloadEncoding: normalizedPayload.payloadEncoding,
|
|
255
|
-
payload: normalizedPayload.payload,
|
|
256
|
-
receivedAt: new Date().toISOString(),
|
|
257
|
-
connection: this.snapshotPendingConnectionSummary(),
|
|
258
|
-
};
|
|
259
|
-
this.state.pendingRemoteCommands.set(remoteRequestId, entry);
|
|
260
|
-
this.writeEvent('command', 'command.remote.requested', {
|
|
261
|
-
...entry,
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
clearPendingRemoteCommands(reason) {
|
|
265
|
-
if (this.state.pendingRemoteCommands.size === 0) {
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
const clearedAt = new Date().toISOString();
|
|
269
|
-
for (const entry of this.state.pendingRemoteCommands.values()) {
|
|
270
|
-
this.writeEvent('command', 'command.remote.cleared', {
|
|
271
|
-
remoteRequestId: entry.remoteRequestId,
|
|
272
|
-
commandId: entry.commandId,
|
|
273
|
-
payloadEncoding: entry.payloadEncoding,
|
|
274
|
-
payload: entry.payload,
|
|
275
|
-
receivedAt: entry.receivedAt,
|
|
276
|
-
connection: entry.connection,
|
|
277
|
-
reason,
|
|
278
|
-
clearedAt,
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
this.state.pendingRemoteCommands.clear();
|
|
282
|
-
}
|
|
283
206
|
noteIncomingConnection(payload) {
|
|
284
207
|
if (this.state.connection.state === 'connected') {
|
|
285
208
|
return;
|
|
@@ -295,7 +218,7 @@ class HostServer {
|
|
|
295
218
|
if (this.state.connection.state === 'idle' || this.state.connection.state === 'disconnected') {
|
|
296
219
|
return;
|
|
297
220
|
}
|
|
298
|
-
this.clearPendingRemoteCommands('connection_disconnect');
|
|
221
|
+
this.commandCoordinator.clearPendingRemoteCommands('connection_disconnect');
|
|
299
222
|
const disconnectedAt = new Date().toISOString();
|
|
300
223
|
this.state.connection = {
|
|
301
224
|
state: 'disconnected',
|
|
@@ -442,7 +365,7 @@ class HostServer {
|
|
|
442
365
|
};
|
|
443
366
|
}
|
|
444
367
|
async handleHostShutdown() {
|
|
445
|
-
this.clearPendingRemoteCommands('host_shutdown');
|
|
368
|
+
this.commandCoordinator.clearPendingRemoteCommands('host_shutdown');
|
|
446
369
|
return {
|
|
447
370
|
acceptedAt: new Date().toISOString(),
|
|
448
371
|
service: this.state.service,
|
|
@@ -513,7 +436,7 @@ class HostServer {
|
|
|
513
436
|
};
|
|
514
437
|
}
|
|
515
438
|
await this.runtimeAdapter.stopService();
|
|
516
|
-
this.clearPendingRemoteCommands('service_stop');
|
|
439
|
+
this.commandCoordinator.clearPendingRemoteCommands('service_stop');
|
|
517
440
|
this.state.service.state = 'stopped';
|
|
518
441
|
this.state.service.stoppedAt = new Date().toISOString();
|
|
519
442
|
return {
|
|
@@ -525,29 +448,6 @@ class HostServer {
|
|
|
525
448
|
async handleConnectionGet() {
|
|
526
449
|
return this.state.connection;
|
|
527
450
|
}
|
|
528
|
-
async resolveConnectionToken(params) {
|
|
529
|
-
const trimmedToken = params.token?.trim();
|
|
530
|
-
const wantsAuto = params.tokenMode === "auto" || (!trimmedToken && params.autoToken !== undefined);
|
|
531
|
-
if (!wantsAuto) {
|
|
532
|
-
if (!trimmedToken || trimmedToken.length === 0) {
|
|
533
|
-
throw new HostProtocol_1.HostProtocolError("invalid_request", "token is required when tokenMode is manual", false);
|
|
534
|
-
}
|
|
535
|
-
return { token: trimmedToken, mode: "manual" };
|
|
536
|
-
}
|
|
537
|
-
if (!params.autoToken) {
|
|
538
|
-
throw new HostProtocol_1.HostProtocolError("invalid_request", "auto token mode requires autoToken config", false);
|
|
539
|
-
}
|
|
540
|
-
const issued = await this.runtimeCredentialTokenIssuer.issueToken({
|
|
541
|
-
openapiEntry: params.autoToken.openapiEntry,
|
|
542
|
-
accessId: params.autoToken.accessId,
|
|
543
|
-
secretKey: params.autoToken.secretKey,
|
|
544
|
-
localId: params.autoToken.localId ?? params.peerId,
|
|
545
|
-
peerId: params.peerId,
|
|
546
|
-
userTtlSeconds: params.autoToken.userTtlSeconds,
|
|
547
|
-
channelTtlSeconds: params.autoToken.channelTtlSeconds,
|
|
548
|
-
});
|
|
549
|
-
return { token: issued, mode: "auto" };
|
|
550
|
-
}
|
|
551
451
|
async handleConnectionConnect(params) {
|
|
552
452
|
if (this.state.connection.state !== "idle" &&
|
|
553
453
|
this.state.connection.state !== "disconnected" &&
|
|
@@ -557,14 +457,13 @@ class HostServer {
|
|
|
557
457
|
if (this.state.service.state !== "stopped") {
|
|
558
458
|
throw new HostProtocol_1.HostProtocolError("busy", "Service is not stopped", false);
|
|
559
459
|
}
|
|
560
|
-
const tokenResolve = await this.resolveConnectionToken(params);
|
|
561
460
|
this.writeEvent("connection", "token.prepared", {
|
|
562
|
-
mode:
|
|
461
|
+
mode: 'manual',
|
|
563
462
|
peerId: params.peerId,
|
|
564
|
-
tokenLength:
|
|
463
|
+
tokenLength: params.token.length,
|
|
565
464
|
at: new Date().toISOString(),
|
|
566
465
|
});
|
|
567
|
-
const resolvedServiceEntry = await this.runtimeAdapter.connect(params.serviceEntry, params.peerId,
|
|
466
|
+
const resolvedServiceEntry = await this.runtimeAdapter.connect(params.serviceEntry, params.peerId, params.token, params.timeoutMs);
|
|
568
467
|
this.state.connection = {
|
|
569
468
|
state: 'connecting',
|
|
570
469
|
direction: 'outgoing',
|
|
@@ -640,7 +539,7 @@ class HostServer {
|
|
|
640
539
|
};
|
|
641
540
|
}
|
|
642
541
|
await this.runtimeAdapter.disconnect();
|
|
643
|
-
this.clearPendingRemoteCommands('connection_disconnect');
|
|
542
|
+
this.commandCoordinator.clearPendingRemoteCommands('connection_disconnect');
|
|
644
543
|
this.state.connection.state = 'disconnected';
|
|
645
544
|
this.state.connection.disconnectedAt = new Date().toISOString();
|
|
646
545
|
return {
|
|
@@ -765,50 +664,15 @@ class HostServer {
|
|
|
765
664
|
};
|
|
766
665
|
}
|
|
767
666
|
async handleCommandSend(params) {
|
|
768
|
-
const
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
commandId: params.commandId,
|
|
772
|
-
acceptedAt: new Date().toISOString(),
|
|
773
|
-
response,
|
|
774
|
-
};
|
|
667
|
+
const result = await this.commandCoordinator.handleCommandSend(params, this.commandSequence);
|
|
668
|
+
this.commandSequence += 1;
|
|
669
|
+
return result;
|
|
775
670
|
}
|
|
776
671
|
async handleCommandReply(params) {
|
|
777
|
-
|
|
778
|
-
if (!entry) {
|
|
779
|
-
throw new HostProtocol_1.HostProtocolError('invalid_request', `remoteRequestId ${params.remoteRequestId} is not pending`, false);
|
|
780
|
-
}
|
|
781
|
-
if (entry.commandId !== params.commandId) {
|
|
782
|
-
throw new HostProtocol_1.HostProtocolError('invalid_request', 'commandId does not match pending entry', false);
|
|
783
|
-
}
|
|
784
|
-
if (this.state.connection.state !== 'connected') {
|
|
785
|
-
throw new HostProtocol_1.HostProtocolError('connection_not_ready', 'connection is not established', true);
|
|
786
|
-
}
|
|
787
|
-
await this.runtimeAdapter.replyRemoteCommand(params.remoteRequestId, params.commandId, params.payloadEncoding, params.payload);
|
|
788
|
-
this.state.pendingRemoteCommands.delete(params.remoteRequestId);
|
|
789
|
-
const repliedAt = new Date().toISOString();
|
|
790
|
-
this.writeEvent('command', 'command.remote.replied', {
|
|
791
|
-
remoteRequestId: params.remoteRequestId,
|
|
792
|
-
commandId: params.commandId,
|
|
793
|
-
payloadEncoding: entry.payloadEncoding,
|
|
794
|
-
payload: entry.payload,
|
|
795
|
-
receivedAt: entry.receivedAt,
|
|
796
|
-
connection: entry.connection,
|
|
797
|
-
repliedAt,
|
|
798
|
-
});
|
|
799
|
-
return {
|
|
800
|
-
remoteRequestId: params.remoteRequestId,
|
|
801
|
-
commandId: params.commandId,
|
|
802
|
-
repliedAt,
|
|
803
|
-
};
|
|
672
|
+
return this.commandCoordinator.handleCommandReply(params);
|
|
804
673
|
}
|
|
805
674
|
async handleCommandPendingList() {
|
|
806
|
-
|
|
807
|
-
.sort((left, right) => left.receivedAt.localeCompare(right.receivedAt));
|
|
808
|
-
return {
|
|
809
|
-
items,
|
|
810
|
-
listedAt: new Date().toISOString(),
|
|
811
|
-
};
|
|
675
|
+
return this.commandCoordinator.handleCommandPendingList();
|
|
812
676
|
}
|
|
813
677
|
async handleEventsSubscribe(params) {
|
|
814
678
|
const families = params.families ?? [];
|
|
@@ -78,8 +78,8 @@ function resolveRepoRoot() {
|
|
|
78
78
|
const normalized = path.resolve(candidate);
|
|
79
79
|
if (pathExists(path.join(normalized, 'bin/runtime')) ||
|
|
80
80
|
pathExists(path.join(normalized, 'bin/native')) ||
|
|
81
|
-
pathExists(path.join(normalized, 'app-server/bin/runtime')) ||
|
|
82
|
-
pathExists(path.join(normalized, 'app-server'))) {
|
|
81
|
+
pathExists(path.join(normalized, 'products/app-server/bin/runtime')) ||
|
|
82
|
+
pathExists(path.join(normalized, 'products/app-server'))) {
|
|
83
83
|
return normalized;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -63,9 +63,9 @@ class RuntimeCredentialTokenIssuer {
|
|
|
63
63
|
const candidates = [
|
|
64
64
|
explicit,
|
|
65
65
|
path.join(this.repoRoot, `bin/native/${this.platform}/credential_napi.node`),
|
|
66
|
-
path.join(this.repoRoot, `app-server/bin/native/${this.platform}/credential_napi.node`),
|
|
66
|
+
path.join(this.repoRoot, `products/app-server/bin/native/${this.platform}/credential_napi.node`),
|
|
67
67
|
path.join(this.repoRoot, `.build/app-server/native/${this.platform}/credential_napi.node`),
|
|
68
|
-
path.resolve(process.cwd(), `app-server/bin/native/${this.platform}/credential_napi.node`),
|
|
68
|
+
path.resolve(process.cwd(), `products/app-server/bin/native/${this.platform}/credential_napi.node`),
|
|
69
69
|
path.resolve(process.cwd(), `.build/app-server/native/${this.platform}/credential_napi.node`),
|
|
70
70
|
].filter((entry) => typeof entry === 'string' && entry.trim().length > 0);
|
|
71
71
|
for (const candidate of candidates) {
|
|
@@ -75,7 +75,7 @@ class RuntimeCredentialTokenIssuer {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
throw new Error('credential addon missing for platform ' + this.platform +
|
|
78
|
-
'; run: npm --prefix app-server run build:native');
|
|
78
|
+
'; run: npm --prefix products/app-server run build:native');
|
|
79
79
|
}
|
|
80
80
|
ensureBinding() {
|
|
81
81
|
if (this.binding) {
|
|
@@ -54,9 +54,9 @@ class RuntimeHostBridge {
|
|
|
54
54
|
const candidates = [
|
|
55
55
|
explicit,
|
|
56
56
|
path.join(this.repoRoot, `bin/native/${this.platform}/runtime_host_napi.node`),
|
|
57
|
-
path.join(this.repoRoot, `app-server/bin/native/${this.platform}/runtime_host_napi.node`),
|
|
57
|
+
path.join(this.repoRoot, `products/app-server/bin/native/${this.platform}/runtime_host_napi.node`),
|
|
58
58
|
path.join(this.repoRoot, `.build/app-server/native/${this.platform}/runtime_host_napi.node`),
|
|
59
|
-
path.resolve(process.cwd(), `app-server/bin/native/${this.platform}/runtime_host_napi.node`),
|
|
59
|
+
path.resolve(process.cwd(), `products/app-server/bin/native/${this.platform}/runtime_host_napi.node`),
|
|
60
60
|
path.resolve(process.cwd(), `.build/app-server/native/${this.platform}/runtime_host_napi.node`),
|
|
61
61
|
].filter((entry) => typeof entry === 'string' && entry.trim().length > 0);
|
|
62
62
|
for (const candidate of candidates) {
|
|
@@ -66,7 +66,7 @@ class RuntimeHostBridge {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
throw new Error('runtime host addon missing for platform ' + this.platform +
|
|
69
|
-
'; run: npm --prefix app-server run build:native');
|
|
69
|
+
'; run: npm --prefix products/app-server run build:native');
|
|
70
70
|
}
|
|
71
71
|
resolveRuntimeLibDirs() {
|
|
72
72
|
const dirs = [];
|
|
@@ -75,7 +75,7 @@ class RuntimeHostBridge {
|
|
|
75
75
|
? path.join(path.resolve(envBundleRoot.trim()), 'lib')
|
|
76
76
|
: '';
|
|
77
77
|
const runtimeBundleLib = path.join(this.repoRoot, `bin/runtime/${this.platform}/lib`);
|
|
78
|
-
const repoRuntimeBundleLib = path.join(this.repoRoot, `app-server/bin/runtime/${this.platform}/lib`);
|
|
78
|
+
const repoRuntimeBundleLib = path.join(this.repoRoot, `products/app-server/bin/runtime/${this.platform}/lib`);
|
|
79
79
|
const nanoLib = path.join(this.repoRoot, `runtime/core/3rd/tirtc-nano/install/${this.platform}/TIRTC_NANO/lib`);
|
|
80
80
|
if (runtimeBundleLibFromEnv && pathExists(runtimeBundleLibFromEnv)) {
|
|
81
81
|
dirs.push(runtimeBundleLibFromEnv);
|
|
@@ -32,7 +32,7 @@ function resolveRuntimeBundleRoot(repoRoot, runtimePlatform) {
|
|
|
32
32
|
if (pathExists(path_1.default.resolve(repoRoot, 'bin/runtime', runtimePlatform))) {
|
|
33
33
|
return path_1.default.resolve(repoRoot, 'bin/runtime', runtimePlatform);
|
|
34
34
|
}
|
|
35
|
-
return path_1.default.resolve(repoRoot, 'app-server/bin/runtime', runtimePlatform);
|
|
35
|
+
return path_1.default.resolve(repoRoot, 'products/app-server/bin/runtime', runtimePlatform);
|
|
36
36
|
}
|
|
37
37
|
function dockerAvailable() {
|
|
38
38
|
try {
|
|
@@ -57,7 +57,7 @@ function probeRuntimeBackedPreflight(repoRoot) {
|
|
|
57
57
|
if (required.some((entry) => !pathExists(entry))) {
|
|
58
58
|
return {
|
|
59
59
|
ready: false,
|
|
60
|
-
reason: 'runtime-backed sdk bundle is missing under app-server/bin/runtime/<platform>',
|
|
60
|
+
reason: 'runtime-backed sdk bundle is missing under products/app-server/bin/runtime/<platform>',
|
|
61
61
|
runtimePlatform,
|
|
62
62
|
runtimeBundleRoot,
|
|
63
63
|
};
|
|
@@ -13,7 +13,7 @@ function asBoolean(value) {
|
|
|
13
13
|
return typeof value === 'boolean' ? value : undefined;
|
|
14
14
|
}
|
|
15
15
|
function resolveConfigPath(repoRoot) {
|
|
16
|
-
return path_1.default.resolve(repoRoot, 'app-server/host/tests/.local/runtime-backed.e2e.local.json');
|
|
16
|
+
return path_1.default.resolve(repoRoot, 'products/app-server/host/tests/.local/runtime-backed.e2e.local.json');
|
|
17
17
|
}
|
|
18
18
|
function requireString(raw, key) {
|
|
19
19
|
const value = asString(raw[key]);
|
|
@@ -977,87 +977,28 @@ export declare const ServiceStartRequestSchema: z.ZodObject<{
|
|
|
977
977
|
export declare const ConnectionConnectRequestSchema: z.ZodEffects<z.ZodObject<{
|
|
978
978
|
serviceEntry: z.ZodOptional<z.ZodString>;
|
|
979
979
|
peerId: z.ZodString;
|
|
980
|
-
token: z.
|
|
981
|
-
tokenMode: z.ZodOptional<z.ZodEnum<["manual", "auto"]>>;
|
|
982
|
-
autoToken: z.ZodOptional<z.ZodObject<{
|
|
983
|
-
openapiEntry: z.ZodOptional<z.ZodString>;
|
|
984
|
-
accessId: z.ZodString;
|
|
985
|
-
secretKey: z.ZodString;
|
|
986
|
-
localId: z.ZodOptional<z.ZodString>;
|
|
987
|
-
userTtlSeconds: z.ZodOptional<z.ZodNumber>;
|
|
988
|
-
channelTtlSeconds: z.ZodOptional<z.ZodNumber>;
|
|
989
|
-
}, "strip", z.ZodTypeAny, {
|
|
990
|
-
accessId: string;
|
|
991
|
-
secretKey: string;
|
|
992
|
-
openapiEntry?: string | undefined;
|
|
993
|
-
localId?: string | undefined;
|
|
994
|
-
userTtlSeconds?: number | undefined;
|
|
995
|
-
channelTtlSeconds?: number | undefined;
|
|
996
|
-
}, {
|
|
997
|
-
accessId: string;
|
|
998
|
-
secretKey: string;
|
|
999
|
-
openapiEntry?: string | undefined;
|
|
1000
|
-
localId?: string | undefined;
|
|
1001
|
-
userTtlSeconds?: number | undefined;
|
|
1002
|
-
channelTtlSeconds?: number | undefined;
|
|
1003
|
-
}>>;
|
|
980
|
+
token: z.ZodString;
|
|
1004
981
|
timeoutMs: z.ZodNumber;
|
|
1005
982
|
}, "strip", z.ZodTypeAny, {
|
|
1006
983
|
peerId: string;
|
|
984
|
+
token: string;
|
|
1007
985
|
timeoutMs: number;
|
|
1008
986
|
serviceEntry?: string | undefined;
|
|
1009
|
-
token?: string | undefined;
|
|
1010
|
-
tokenMode?: "manual" | "auto" | undefined;
|
|
1011
|
-
autoToken?: {
|
|
1012
|
-
accessId: string;
|
|
1013
|
-
secretKey: string;
|
|
1014
|
-
openapiEntry?: string | undefined;
|
|
1015
|
-
localId?: string | undefined;
|
|
1016
|
-
userTtlSeconds?: number | undefined;
|
|
1017
|
-
channelTtlSeconds?: number | undefined;
|
|
1018
|
-
} | undefined;
|
|
1019
987
|
}, {
|
|
1020
988
|
peerId: string;
|
|
989
|
+
token: string;
|
|
1021
990
|
timeoutMs: number;
|
|
1022
991
|
serviceEntry?: string | undefined;
|
|
1023
|
-
token?: string | undefined;
|
|
1024
|
-
tokenMode?: "manual" | "auto" | undefined;
|
|
1025
|
-
autoToken?: {
|
|
1026
|
-
accessId: string;
|
|
1027
|
-
secretKey: string;
|
|
1028
|
-
openapiEntry?: string | undefined;
|
|
1029
|
-
localId?: string | undefined;
|
|
1030
|
-
userTtlSeconds?: number | undefined;
|
|
1031
|
-
channelTtlSeconds?: number | undefined;
|
|
1032
|
-
} | undefined;
|
|
1033
992
|
}>, {
|
|
1034
993
|
peerId: string;
|
|
994
|
+
token: string;
|
|
1035
995
|
timeoutMs: number;
|
|
1036
996
|
serviceEntry?: string | undefined;
|
|
1037
|
-
token?: string | undefined;
|
|
1038
|
-
tokenMode?: "manual" | "auto" | undefined;
|
|
1039
|
-
autoToken?: {
|
|
1040
|
-
accessId: string;
|
|
1041
|
-
secretKey: string;
|
|
1042
|
-
openapiEntry?: string | undefined;
|
|
1043
|
-
localId?: string | undefined;
|
|
1044
|
-
userTtlSeconds?: number | undefined;
|
|
1045
|
-
channelTtlSeconds?: number | undefined;
|
|
1046
|
-
} | undefined;
|
|
1047
997
|
}, {
|
|
1048
998
|
peerId: string;
|
|
999
|
+
token: string;
|
|
1049
1000
|
timeoutMs: number;
|
|
1050
1001
|
serviceEntry?: string | undefined;
|
|
1051
|
-
token?: string | undefined;
|
|
1052
|
-
tokenMode?: "manual" | "auto" | undefined;
|
|
1053
|
-
autoToken?: {
|
|
1054
|
-
accessId: string;
|
|
1055
|
-
secretKey: string;
|
|
1056
|
-
openapiEntry?: string | undefined;
|
|
1057
|
-
localId?: string | undefined;
|
|
1058
|
-
userTtlSeconds?: number | undefined;
|
|
1059
|
-
channelTtlSeconds?: number | undefined;
|
|
1060
|
-
} | undefined;
|
|
1061
1002
|
}>;
|
|
1062
1003
|
export declare const StreamSendStartRequestSchema: z.ZodObject<{
|
|
1063
1004
|
streamId: z.ZodNumber;
|
|
@@ -173,19 +173,10 @@ exports.ServiceStartRequestSchema = zod_1.z.object({
|
|
|
173
173
|
exports.ConnectionConnectRequestSchema = zod_1.z.object({
|
|
174
174
|
serviceEntry: zod_1.z.string().optional(),
|
|
175
175
|
peerId: zod_1.z.string(),
|
|
176
|
-
token: zod_1.z.string().
|
|
177
|
-
tokenMode: zod_1.z.enum(["manual", "auto"]).optional(),
|
|
178
|
-
autoToken: zod_1.z.object({
|
|
179
|
-
openapiEntry: zod_1.z.string().optional(),
|
|
180
|
-
accessId: zod_1.z.string(),
|
|
181
|
-
secretKey: zod_1.z.string(),
|
|
182
|
-
localId: zod_1.z.string().optional(),
|
|
183
|
-
userTtlSeconds: zod_1.z.number().int().optional(),
|
|
184
|
-
channelTtlSeconds: zod_1.z.number().int().optional(),
|
|
185
|
-
}).optional(),
|
|
176
|
+
token: zod_1.z.string().min(1),
|
|
186
177
|
timeoutMs: zod_1.z.number().int()
|
|
187
|
-
}).refine((value) =>
|
|
188
|
-
message: "token
|
|
178
|
+
}).refine((value) => value.token.trim().length > 0, {
|
|
179
|
+
message: "token is required",
|
|
189
180
|
});
|
|
190
181
|
exports.StreamSendStartRequestSchema = zod_1.z.object({
|
|
191
182
|
streamId: zod_1.z.number().int(),
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.printQuickstartGuide = printQuickstartGuide;
|
|
4
|
-
function printQuickstartGuide() {
|
|
5
|
-
const lines = [
|
|
6
|
-
'TiRTC CLI 新手快速入口(服务端 -> 安卓扫码)',
|
|
7
|
-
'',
|
|
8
|
-
'前置条件:',
|
|
9
|
-
'1) 已构建最新 CLI:',
|
|
10
|
-
' npm --prefix app-server run build',
|
|
11
|
-
' npm --prefix devtools/cli run build',
|
|
12
|
-
'2) 准备一份 server-only TOML 配置,并把 mp4_path 指向可发送媒体(示例:.refers/simple.mp4)',
|
|
13
|
-
'',
|
|
14
|
-
'步骤 1:启动服务(自动创建 session)',
|
|
15
|
-
' node devtools/cli/bin/tirtc-devtools-cli.js --config ./server.toml service start',
|
|
16
|
-
' # 记下输出里的 sessionId,后续命令都显式带 --session',
|
|
17
|
-
'',
|
|
18
|
-
'步骤 2:CLI 会自动 prepare MP4 并绑定音视频 stream,不再需要手工 prepare assets_dir',
|
|
19
|
-
' [server] service_entry = "" license = "<LICENSE>" mp4_path = "./.refers/simple.mp4" video_stream_id = 11 audio_stream_id = 10',
|
|
20
|
-
' # service start 成功后会自动 prepare 并按 AUTO_ON_CONNECTED 进入待发流语义',
|
|
21
|
-
'',
|
|
22
|
-
'步骤 3:生成连接 bootstrap 二维码(给安卓扫码)',
|
|
23
|
-
' node devtools/cli/bin/tirtc-devtools-cli.js --session <SESSION_ID> debug bootstrap qrcode \\',
|
|
24
|
-
' "<ACCESS_ID>" "<SECRET_KEY>" "<PEER_ID>" "<SERVICE_ENTRY>"',
|
|
25
|
-
'',
|
|
26
|
-
'步骤 4:安卓扫码后流程(客户端侧)',
|
|
27
|
-
' - 解析二维码 JSON(type=tirtc-connect-bootstrap)',
|
|
28
|
-
' - 用 access_id + secret_key 在客户端/外部系统签发 token',
|
|
29
|
-
' - 持 token + peer_id 连接服务端;连接成功后请求 audio_stream_id/video_stream_id',
|
|
30
|
-
'',
|
|
31
|
-
'额外:如果你只想本地直接签发并拿到可扫码 payload,可执行:',
|
|
32
|
-
' export TIRTC_CONN_ACCESS_ID="<ACCESS_ID>"',
|
|
33
|
-
' export TIRTC_CONN_SECRET_KEY="<SECRET_KEY>"',
|
|
34
|
-
' node devtools/cli/bin/tirtc-devtools-cli.js token issue "<PEER_ID>" \\',
|
|
35
|
-
' --local-id "<LOCAL_ID>" --service-entry "<SERVICE_ENTRY>"',
|
|
36
|
-
' # CLI 会直接打印摘要、payload JSON、token,并生成本地二维码 PNG 路径',
|
|
37
|
-
' # 如需临时覆盖,也可显式传 --access-id / --secret-key',
|
|
38
|
-
'',
|
|
39
|
-
'步骤 5:服务端观测',
|
|
40
|
-
' node devtools/cli/bin/tirtc-devtools-cli.js --session <SESSION_ID> events tail',
|
|
41
|
-
' node devtools/cli/bin/tirtc-devtools-cli.js --session <SESSION_ID> report show',
|
|
42
|
-
'',
|
|
43
|
-
'补充:',
|
|
44
|
-
'- debug bootstrap qrcode 仅生成连接信息二维码,不签发 token',
|
|
45
|
-
'- 机器可读输出:在命令后追加 --json',
|
|
46
|
-
'- 查看全部命令:node devtools/cli/bin/tirtc-devtools-cli.js --help',
|
|
47
|
-
'- 查看单命令说明:node devtools/cli/bin/tirtc-devtools-cli.js <command> --help',
|
|
48
|
-
];
|
|
49
|
-
console.log(lines.join('\n'));
|
|
50
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export type TokenIssueInput = {
|
|
2
|
-
accessId: string;
|
|
3
|
-
secretKey: string;
|
|
4
|
-
localId: string;
|
|
5
|
-
peerId: string;
|
|
6
|
-
openapiEntry?: string;
|
|
7
|
-
serviceEntry?: string;
|
|
8
|
-
userTtlSeconds?: number;
|
|
9
|
-
channelTtlSeconds?: number;
|
|
10
|
-
qrErrorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H';
|
|
11
|
-
asciiMaxColumns?: number;
|
|
12
|
-
};
|
|
13
|
-
export type IssuedTokenPayload = {
|
|
14
|
-
version: 1;
|
|
15
|
-
type: 'tirtc-connect-token';
|
|
16
|
-
peer_id: string;
|
|
17
|
-
local_id: string;
|
|
18
|
-
service_entry: string;
|
|
19
|
-
token: string;
|
|
20
|
-
openapi_entry: string;
|
|
21
|
-
user_ttl_seconds: number;
|
|
22
|
-
channel_ttl_seconds: number;
|
|
23
|
-
generated_at: string;
|
|
24
|
-
};
|
|
25
|
-
export type TokenIssueOutput = {
|
|
26
|
-
payload: IssuedTokenPayload;
|
|
27
|
-
payloadJson: string;
|
|
28
|
-
token: string;
|
|
29
|
-
qrCodePngPath: string;
|
|
30
|
-
qrCodeAscii: string;
|
|
31
|
-
qrCodeAsciiIncluded: boolean;
|
|
32
|
-
};
|
|
33
|
-
export declare function issueToken(input: TokenIssueInput): Promise<string>;
|
|
34
|
-
export declare function buildIssuedTokenPayload(input: TokenIssueInput, token: string): IssuedTokenPayload;
|
|
35
|
-
export declare function writePngQrcode(payloadJson: string, outputPath: string, errorCorrectionLevel: 'L' | 'M' | 'Q' | 'H'): Promise<string>;
|
|
36
|
-
export declare function buildAsciiQrcode(payloadJson: string, terminalColumns?: number, errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H'): Promise<string>;
|
|
37
|
-
export declare function issueTokenWithQrcode(input: TokenIssueInput): Promise<TokenIssueOutput>;
|
|
38
|
-
export declare function formatTokenIssueConsoleOutput(output: TokenIssueOutput): string;
|
package/dist/dummy.d.ts
DELETED
|
File without changes
|
package/dist/dummy.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/index.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const commander_1 = require("commander");
|
|
7
|
-
const child_process_1 = require("child_process");
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const fs_1 = __importDefault(require("fs"));
|
|
10
|
-
const program = new commander_1.Command();
|
|
11
|
-
const CLI_VERSION = '1.0.0';
|
|
12
|
-
function getHostBinaryPath() {
|
|
13
|
-
// Local development path relative to dist/index.js
|
|
14
|
-
const localDevPath = path_1.default.resolve(__dirname, '../../../app-server/bin/tirtc-devtool-host.js');
|
|
15
|
-
if (fs_1.default.existsSync(localDevPath)) {
|
|
16
|
-
return localDevPath;
|
|
17
|
-
}
|
|
18
|
-
// Fallback to globally installed or in PATH
|
|
19
|
-
return 'tirtc-devtool-host';
|
|
20
|
-
}
|
|
21
|
-
program
|
|
22
|
-
.name('tirtc-devtool')
|
|
23
|
-
.description('TiRTC Developer Tool CLI')
|
|
24
|
-
.option('-v, --version', 'output the version number')
|
|
25
|
-
.action((options) => {
|
|
26
|
-
if (options.version) {
|
|
27
|
-
console.log(`CLI Version: ${CLI_VERSION}`);
|
|
28
|
-
const hostPath = getHostBinaryPath();
|
|
29
|
-
let hostCmdPath = hostPath;
|
|
30
|
-
let hostArgs = ['--version'];
|
|
31
|
-
if (hostPath.endsWith('.js')) {
|
|
32
|
-
hostArgs = [hostPath, '--version'];
|
|
33
|
-
hostCmdPath = process.execPath;
|
|
34
|
-
}
|
|
35
|
-
try {
|
|
36
|
-
const result = (0, child_process_1.spawnSync)(hostCmdPath, hostArgs, { encoding: 'utf-8' });
|
|
37
|
-
if (result.stdout) {
|
|
38
|
-
process.stdout.write(result.stdout);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
catch (e) {
|
|
42
|
-
console.log('Host Version: unknown');
|
|
43
|
-
console.log('Protocol Version: unknown');
|
|
44
|
-
}
|
|
45
|
-
process.exit(0);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
program.parse(process.argv);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#ifndef TIRTC_AUDIO_CODEC_H_
|
|
2
|
-
#define TIRTC_AUDIO_CODEC_H_
|
|
3
|
-
|
|
4
|
-
#include <stddef.h>
|
|
5
|
-
|
|
6
|
-
#include "tirtc/audio_frame.h"
|
|
7
|
-
#include "tirtc/error.h"
|
|
8
|
-
|
|
9
|
-
#ifdef __cplusplus
|
|
10
|
-
extern "C" {
|
|
11
|
-
#endif
|
|
12
|
-
|
|
13
|
-
TirtcError tirtc_audio_g711a_encode(const TirtcAudioPcmFrame* pcm_frame, void* out_buffer,
|
|
14
|
-
size_t out_buffer_capacity, TirtcAudioEncodedFrame* out_frame);
|
|
15
|
-
|
|
16
|
-
TirtcError tirtc_audio_g711a_decode(const TirtcAudioEncodedFrame* in_frame, void* out_buffer,
|
|
17
|
-
size_t out_buffer_capacity, TirtcAudioPcmFrame* out_frame);
|
|
18
|
-
|
|
19
|
-
#ifdef __cplusplus
|
|
20
|
-
}
|
|
21
|
-
#endif
|
|
22
|
-
|
|
23
|
-
#endif // TIRTC_AUDIO_CODEC_H_
|