@autoark-ai/eva-client-sdk-ts 0.0.2-dev

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/dist/spi.d.ts ADDED
@@ -0,0 +1,130 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ /** Encoded audio sample format. The built-in browser implementation currently uses `pcm_s16le`. */
4
+ export type AudioFormat = "pcm_s16le" | (string & {});
5
+ /** One interleaved audio chunk exchanged through the media SPI. */
6
+ export interface AudioChunk {
7
+ /** Encoded audio bytes. */
8
+ data: Uint8Array;
9
+ /** Sample rate in Hz. */
10
+ sampleRate: number;
11
+ /** Number of interleaved channels. */
12
+ channels: number;
13
+ /** Encoding used by `data`. */
14
+ format: AudioFormat;
15
+ }
16
+ /**
17
+ * Pull-based audio input owned by the dialogue runtime after agent construction.
18
+ * Consumers implementing this SPI must support sequential start/stop sessions and
19
+ * must not drive the lifecycle concurrently with the agent.
20
+ */
21
+ export interface AudioInputSource {
22
+ /** Acquires the input resource and resolves only after it is ready to produce frames. */
23
+ start(): Promise<void>;
24
+ /**
25
+ * Produces frames for the current started session.
26
+ * Only one active consumer is allowed; abort must stop production promptly.
27
+ */
28
+ frames(signal?: AbortSignal): AsyncIterable<AudioChunk>;
29
+ /** Idempotently releases the current input resource and waits for teardown to finish. */
30
+ stop(): Promise<void>;
31
+ }
32
+ /**
33
+ * Push-based audio output owned by the dialogue runtime after agent construction.
34
+ * The implementation may initialize lazily on the first `enqueue()` call.
35
+ */
36
+ export interface AudioOutputSink {
37
+ /** Queues one audio chunk for playback. */
38
+ enqueue(chunk: AudioChunk): Promise<void> | void;
39
+ /** Immediately discards queued/current playback while keeping the sink reusable. */
40
+ flush(): Promise<void> | void;
41
+ /** Resolves after all audio accepted before the call has finished playing. */
42
+ drain(): Promise<void> | void;
43
+ /** Idempotently releases output resources and prevents further playback. */
44
+ stop(): Promise<void> | void;
45
+ }
46
+ /** One validated still image captured through the environment-neutral camera SPI. */
47
+ export interface CameraSnapshot {
48
+ /** Encoded image bytes. The runtime never persists these bytes in events or conversation history. */
49
+ readonly data: Uint8Array;
50
+ /** Actual encoded MIME type, such as `image/png` or `image/jpeg`. */
51
+ readonly mimeType: string;
52
+ /** Actual captured frame width in pixels. */
53
+ readonly width: number;
54
+ /** Actual captured frame height in pixels. */
55
+ readonly height: number;
56
+ }
57
+ /**
58
+ * Pull-based still-camera source owned exclusively by the dialogue runtime.
59
+ *
60
+ * @remarks
61
+ * `start()` resolves only when one continuously held camera session is ready for capture.
62
+ * `capture()` returns one snapshot from that session. Both operations require an
63
+ * `AbortSignal`; an implementation must reject promptly on cancellation while retaining
64
+ * ownership of any pending acquisition/encode continuation. A stream acquired late must be
65
+ * released immediately, and a snapshot encoded late must be discarded. At most one started
66
+ * session and one in-flight capture are allowed. `stop()` must cancel or settle pending work,
67
+ * release both pending and already-acquired resources, and be idempotent. After a successful
68
+ * stop, a later sequential start is allowed.
69
+ *
70
+ * The runtime allows a cancelled `start()` or `capture()` a fixed 1500ms settlement deadline.
71
+ * If it still cannot settle, or `stop()` cannot confirm release, the runtime marks this camera
72
+ * role faulted; subsequent camera capture/control calls reject deterministically, while other
73
+ * agent capabilities remain usable. Callers must not drive this lifecycle concurrently with
74
+ * the agent.
75
+ */
76
+ export interface CameraSnapshotSource {
77
+ /**
78
+ * Acquires one camera session and resolves only after permission, acquisition, and frame readiness.
79
+ * @param signal - Required cancellation signal owned by the runtime for this start attempt.
80
+ */
81
+ start(signal: AbortSignal): Promise<void>;
82
+ /**
83
+ * Captures one still image from the ready session and rejects promptly when cancelled.
84
+ * @param signal - Required cancellation signal scoped to this single capture attempt.
85
+ * @returns A validated, environment-neutral encoded snapshot descriptor.
86
+ */
87
+ capture(signal: AbortSignal): Promise<CameraSnapshot>;
88
+ /** Idempotently waits for pending acquisition/capture and confirms all owned resources are released. */
89
+ stop(): Promise<void>;
90
+ }
91
+ /** Stable identity and optional capability metadata for an AEC implementation. */
92
+ export interface AecDescriptor {
93
+ id: string;
94
+ supportedPlatforms?: readonly string[];
95
+ metadata?: Record<string, unknown>;
96
+ }
97
+ /** Reserved AEC configuration surface; no public options are defined in the alpha. */
98
+ export type AecProcessorConfiguration = Record<string, never>;
99
+ /** Acoustic echo cancellation role in the media transport pipeline. */
100
+ export interface AecProcessor {
101
+ readonly descriptor: AecDescriptor;
102
+ configure?(config: AecProcessorConfiguration): Promise<void> | void;
103
+ pushFarEnd(chunk: AudioChunk): Promise<void> | void;
104
+ processNearEnd(chunk: AudioChunk): Promise<AudioChunk> | AudioChunk;
105
+ reset(reason?: string): Promise<void> | void;
106
+ release(): Promise<void> | void;
107
+ }
108
+ /**
109
+ * Complete media transport set accepted by the agent.
110
+ * The three audio roles are required and the camera role is optional. After construction,
111
+ * the dialogue runtime exclusively
112
+ * drives their lifecycle; callers should not invoke lifecycle methods concurrently.
113
+ */
114
+ export interface MediaTransportsConfig {
115
+ /** Audio capture implementation. */
116
+ input: AudioInputSource;
117
+ /** Audio playback implementation. */
118
+ output: AudioOutputSink;
119
+ /** Echo cancellation implementation, including the SDK passthrough default. */
120
+ aec: AecProcessor;
121
+ /**
122
+ * Optional still-camera implementation used for one snapshot at each eligible `speech.started`.
123
+ * @remarks Merely configuring this field does not acquire a device: camera capture remains
124
+ * disabled until `setCameraCaptureEnabled(true)` succeeds. Manual text and greeting turns do
125
+ * not capture images.
126
+ */
127
+ camera?: CameraSnapshotSource;
128
+ }
129
+
130
+ export {};
package/dist/spi.js ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "@autoark-ai/eva-client-sdk-ts",
3
+ "version": "0.0.2-dev",
4
+ "description": "Eva 端侧 TypeScript SDK(契约驱动、浏览器优先)。",
5
+ "license": "SEE LICENSE IN LICENSE",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "./spi": {
16
+ "types": "./dist/spi.d.ts",
17
+ "import": "./dist/spi.js",
18
+ "default": "./dist/spi.js"
19
+ },
20
+ "./browser": {
21
+ "types": "./dist/browser.d.ts",
22
+ "import": "./dist/browser.js",
23
+ "default": "./dist/browser.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "LICENSE",
28
+ "GATEWAY_TERMS.md",
29
+ "THIRD_PARTY_NOTICES.md",
30
+ "dist/index.js",
31
+ "dist/index.d.ts",
32
+ "dist/spi.js",
33
+ "dist/spi.d.ts",
34
+ "dist/browser.js",
35
+ "dist/browser.d.ts",
36
+ "dist/assets/silero_vad_v6.onnx"
37
+ ],
38
+ "sideEffects": false,
39
+ "engines": {
40
+ "node": ">=20"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public",
44
+ "registry": "https://registry.npmjs.org/"
45
+ },
46
+ "scripts": {
47
+ "build": "node scripts/build.mjs",
48
+ "check": "npm run build && npm run typecheck && npm run typecheck:test && npm run depcruise && npm test && npm run test:browser && npm run verify:pack",
49
+ "depcruise": "depcruise src --config .dependency-cruiser.cjs",
50
+ "quickstart:prepare": "npm run version:sync && npm run build && node scripts/prepare-browser-quickstart.mjs",
51
+ "test": "vitest run",
52
+ "test:browser": "vitest run --config vitest.browser.config.ts",
53
+ "verify:consumer": "node scripts/verify-clean-consumer.mjs",
54
+ "verify:consumer:browser": "node scripts/verify-clean-browser.mjs",
55
+ "verify:consumer:gateway": "tsx test/e2e/direct-gateway/cli.ts",
56
+ "verify:pack": "node scripts/verify-pack.mjs",
57
+ "verify:release-candidate": "node scripts/verify-release-candidate.mjs",
58
+ "version:sync": "node scripts/sync-package-version.mjs",
59
+ "typecheck": "tsc -p tsconfig.json --noEmit",
60
+ "typecheck:test": "tsc -p tsconfig.test.json"
61
+ },
62
+ "devDependencies": {
63
+ "@types/node": "^22.20.1",
64
+ "@vitest/browser": "^4.1.10",
65
+ "@vitest/browser-playwright": "^4.1.10",
66
+ "dependency-cruiser": "^16.0.0",
67
+ "dts-bundle-generator": "^9.5.1",
68
+ "esbuild": "^0.28.1",
69
+ "playwright": "^1.48.0",
70
+ "tsx": "^4.23.0",
71
+ "typescript": "^5.6.0",
72
+ "vite": "^8.1.4",
73
+ "vitest": "^4.1.10"
74
+ },
75
+ "dependencies": {
76
+ "@alexanderolsen/libsamplerate-js": "2.1.2",
77
+ "onnxruntime-web": "1.26.0"
78
+ }
79
+ }