@xmov/avatar 2.1.0 → 2.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmov/avatar",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "魔珐数字人 JS-SDK",
5
5
  "type": "module",
6
6
  "source": "src/index.ts",
@@ -10,12 +10,19 @@
10
10
  "default": "./dist/index.modern.js"
11
11
  },
12
12
  "./agent": {
13
- "types": "./src/agent/index.ts",
13
+ "types": "./dist/agent/index.d.ts",
14
14
  "require": "./dist/agent/index.cjs",
15
15
  "default": "./dist/agent/avatar.modern.js"
16
16
  },
17
17
  "./agent/umd": "./dist/agent/index.umd.js"
18
18
  },
19
+ "typesVersions": {
20
+ "*": {
21
+ "agent": [
22
+ "dist/agent/index.d.ts"
23
+ ]
24
+ }
25
+ },
19
26
  "amdName": "XmovAvatar",
20
27
  "main": "./dist/index.cjs",
21
28
  "types": "./dist/index.d.ts",
@@ -23,12 +30,22 @@
23
30
  "unpkg": "./dist/index.umd.js",
24
31
  "files": [
25
32
  "dist/",
26
- "src/"
33
+ "src/",
34
+ "!src/agent/",
35
+ "!dist/agent/**/*.map",
36
+ "!dist/agent/__tests__/",
37
+ "!dist/agent/audio-debug.d.ts",
38
+ "!dist/agent/audio-uplink.d.ts",
39
+ "!dist/agent/cdn-entry.d.ts",
40
+ "!dist/agent/e2e-client.d.ts",
41
+ "!dist/agent/fixed-audio-track.d.ts",
42
+ "!dist/agent/internal-types.d.ts",
43
+ "!dist/agent/microphone.d.ts"
27
44
  ],
28
45
  "scripts": {
29
46
  "build": "pnpm run build:core && pnpm run build:agent && pnpm run build:e2e:cdn && pnpm run test:e2e:cdn && node upload-sdk.js build",
30
47
  "build:core": "microbundle --workers --define ENV=production,VERSION=$npm_package_version --external none --tsconfig tsconfig.json",
31
- "build:agent": "microbundle --entry src/agent/index.ts --output dist/agent --format modern,esm,cjs,umd --external @xmov/avatar --alias ../index=@xmov/avatar --globals @xmov/avatar=XmovAvatar --name XingyunAvatarAgentModule --tsconfig tsconfig.agent.json && node scripts/build-agent-entry.mjs",
48
+ "build:agent": "microbundle --entry src/agent/index.ts --output dist/agent --format modern,esm,cjs,umd --external @xmov/avatar --alias ../index=@xmov/avatar --globals @xmov/avatar=XmovAvatar --name XingyunAvatarAgentModule --tsconfig tsconfig.agent.json --no-sourcemap && node scripts/build-agent-entry.mjs",
32
49
  "build:e2e:cdn": "microbundle --entry src/agent/cdn-entry.ts --output cdn-dist/xmovAvatar_e2e.js --format iife --external none --workers --define ENV=production,VERSION=$npm_package_version --tsconfig tsconfig.agent.json --no-pkg-main --no-sourcemap",
33
50
  "sdk": "pnpm --filter @xmov/avatar run --parallel --no-bail \"/^sdk:.+$/\"",
34
51
  "sdk:core": "microbundle watch --workers --define ENV=development,VERSION=$npm_package_version --external none --tsconfig tsconfig.json",
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- type AudioChunkDebugMetadata = Record<string, unknown>;
2
- export declare function logAudioChunkContent(label: string, chunk: Blob | ArrayBuffer | ArrayBufferView, metadata?: AudioChunkDebugMetadata, previewBytes?: number): Promise<void>;
3
- export {};
@@ -1,62 +0,0 @@
1
- export declare const AU_STREAM_NEAREND: 1;
2
- export declare const AU_STREAM_FAREND: 2;
3
- export type AuStreamId = typeof AU_STREAM_NEAREND | typeof AU_STREAM_FAREND;
4
- export type AuPayload = Blob | ArrayBuffer | ArrayBufferView;
5
- export interface AgentAudioBlock {
6
- data: AuPayload;
7
- /** Epoch timestamp for the beginning of this 100 ms media block. */
8
- timestamp: number;
9
- /** Whether this block starts a new WebM container stream. */
10
- isFirstChunk?: boolean;
11
- }
12
- interface AgentAudioUplinkOptions {
13
- sendBinary(frame: ArrayBuffer): void;
14
- onError?(error: Error): void;
15
- }
16
- export declare function packAuAudioFrame(streamId: AuStreamId, tsMs: number, payload: ArrayBuffer | ArrayBufferView): ArrayBuffer;
17
- /**
18
- * Owns the connection-level AU timeline and serializes nearend/farend writes.
19
- * Nearend/farend are matched by 100 ms bucket. When independent capture clocks
20
- * straddle a bucket boundary, an aged nearend may consume farend from
21
- * the immediately preceding bucket. This keeps farend-before-nearend wire
22
- * order without uploading farend-only buckets or dropping WebM continuations.
23
- */
24
- export declare class AgentAudioUplink {
25
- private readonly options;
26
- private connectionStartedAt;
27
- private connectionGeneration;
28
- private sendChain;
29
- private failed;
30
- private readonly pendingFarend;
31
- private readonly pendingNearend;
32
- private readonly closedNearendBuckets;
33
- private readonly lastTimestampByStream;
34
- private readonly lastSentTimestampByStream;
35
- private readonly pendingWebmPrefixByStream;
36
- private farendStreamState;
37
- constructor(options: AgentAudioUplinkOptions);
38
- reset(connectionStartedAt?: number | null): void;
39
- startInput(): void;
40
- clearFarend(): void;
41
- offerFarend(block: AgentAudioBlock): void;
42
- offerNearend(block: AgentAudioBlock): void;
43
- drain(): Promise<void>;
44
- private normalizeBlock;
45
- private enqueue;
46
- /**
47
- * Chromium may emit the first WebM byte (0x1a) as its own MediaRecorder
48
- * Blob and put the remaining EBML magic in the next Blob. A one-byte AU
49
- * payload is not a valid timed audio block, so keep an incomplete WebM
50
- * magic prefix and prepend it to the next block from the same stream.
51
- */
52
- private coalesceSplitWebmMagic;
53
- private flushOlderNearend;
54
- private flushExpiredNearend;
55
- private flushBucket;
56
- private takeNearend;
57
- private takeFarendThrough;
58
- private abandonFarendStream;
59
- private prune;
60
- }
61
- export declare const AU_AUDIO_BLOCK_MS = 100;
62
- export {};