@voctiv/agent-sdk 0.1.3 → 0.2.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.
@@ -1,5 +1,12 @@
1
1
  import { Observable } from 'rxjs';
2
- /** Voice Activity Detection (VAD) tuning parameters. */
2
+ /**
3
+ * Voice Activity Detection (VAD) tuning.
4
+ *
5
+ * SIP sessions use the call-level telephony VAD when available. WS sessions create one
6
+ * VAD instance for the whole socket session on the first `createAsr()` call and merge
7
+ * these options with runtime defaults. When no VAD is available, audio is forwarded to
8
+ * ASR continuously and most VAD observables are empty.
9
+ */
3
10
  export interface AsrVadConfig {
4
11
  /** Energy threshold to start speech detection (0.0–1.0). */
5
12
  positiveThreshold?: number;
@@ -11,70 +18,127 @@ export interface AsrVadConfig {
11
18
  energyFloor?: number;
12
19
  /** Smoothing factor for noise floor estimation (0.0–1.0). */
13
20
  noiseFloorAlpha?: number;
14
- /** Frames of audio to include before detected speech start. */
21
+ /** Frames of PCM (typically 20 ms @ 16 kHz / 640 bytes) to prepend before detected speech start. */
15
22
  preSpeechFrames?: number;
16
- /** Silence frames after speech before confirming end-of-speech. */
23
+ /** Frames of post-speech PCM to still forward to ASR after VAD speech end. */
17
24
  postSpeechFrames?: number;
18
25
  }
19
- /** Smart turn-taking configuration — controls when to finalize ASR during conversation. */
26
+ /**
27
+ * Smart turn-taking — controls when the runtime finalizes an utterance (end-of-turn) while
28
+ * streaming audio to ASR. Reduces cutting off the user mid-sentence when enabled.
29
+ *
30
+ * On WS sessions these values are passed to the telephony VAD/SmartTurn service.
31
+ * On SIP sessions, `enabled: true` also ensures the ASR connector has an
32
+ * `utterance_end_ms` value (defaulting to `1000`) when the resolved connector config
33
+ * did not already provide one.
34
+ */
20
35
  export interface AsrSmartTurnConfig {
21
- /** Enable smart turn-taking (default: false). */
36
+ /** When `true`, turn-taking heuristics are applied (defaults vary by host). */
22
37
  enabled?: boolean;
23
- /** Frames of speech before starting a turn. */
38
+ /** Frames of speech that must be seen before a turn” can start. */
24
39
  triggerFrames?: number;
25
- /** Frames to wait before retrying after a short pause. */
40
+ /** Frames to wait before retrying after a short pause inside an utterance. */
26
41
  retryFrames?: number;
27
- /** Max silence frames before force-finalizing the turn. */
42
+ /** Max silence frames before force-finalizing the current turn. */
28
43
  maxSilenceFrames?: number;
29
- /** Milliseconds to wait for confirmation after potential end-of-turn. */
44
+ /** Milliseconds to wait for confirmation after a candidate end-of-turn. */
30
45
  confirmMs?: number;
31
- /** Hard timeout: finalize after this many ms of silence regardless. */
46
+ /** Hard cap: finalize after this many milliseconds of silence regardless of other rules. */
32
47
  silenceTimeoutMs?: number;
33
48
  }
34
- /** Configuration for creating an ASR (speech recognition) handle. */
49
+ /**
50
+ * Arguments for {@link import('./media-channel').MediaChannel.createAsr}.
51
+ *
52
+ * ### Voctiv platform + logic-executor `key_storage`
53
+ *
54
+ * When Voctiv platform compatibility is on and the connector loaded credentials from PostgreSQL, the session’s
55
+ * `authentication_data` includes **`legacyAsrKeysByName`**: a map from **`key_storage.name`**
56
+ * (string) to flat connector parameters (`api_key`, `base_url`, …) for **this dialog’s agent
57
+ * and company**. You do **not** pass agent UUID in the script — the dialog already belongs to an agent.
58
+ *
59
+ * - **`name`**: pick which row from that map to use (same value as in LE admin for the key).
60
+ * - If omitted, the channel default **`defaultAsrName`** (from Omni / route) is used.
61
+ * - If neither is set, credentials fall back to the usual **`authentication_data.asr.<engine>`**
62
+ * blob for the resolved vendor (main/reserved keys on the agent).
63
+ *
64
+ * You may also set the same selector as **`data.name`**. The runtime treats it as
65
+ * the storage-row selector and strips it before sending connector params to the ASR vendor.
66
+ *
67
+ * ### Vendor
68
+ *
69
+ * **`vendor`** is resolved via internal aliases (`"yandex"`, `"Y"`, `"neuro_v3"`, …). If you set
70
+ * **`name`** but omit **`vendor`**, the runtime may infer vendor from the key row’s **`platform`**
71
+ * in the catalog.
72
+ */
35
73
  export interface AsrConfig {
36
- /** ASR vendor / engine identifier. */
74
+ /**
75
+ * ASR vendor / engine hint: single-letter code (`"Y"`, `"D"`, …) or legacy name
76
+ * (`"yandex"`, `"neuro_v3"`, …). See host `media-vendor-aliases` mapping.
77
+ */
37
78
  vendor?: string;
38
- /** Recognition language (BCP-47, e.g. `"ru-RU"`). */
79
+ /**
80
+ * logic-executor **`key_storage.name`** for this dialog’s agent + company. Selects credentials
81
+ * from **`authentication_data.legacyAsrKeysByName[name]`** when Voctiv platform PostgreSQL key auth is enabled.
82
+ * Overrides channel **`defaultAsrName`**.
83
+ */
84
+ name?: string;
85
+ /** Recognition language (BCP-47), e.g. `"ru-RU"`. Passed through to the connector as `language`. */
39
86
  language?: string;
40
- /** Vendor-specific configuration parameters. */
87
+ /**
88
+ * Vendor-specific connection parameters (URLs, timeouts, model ids, nested JSON, …).
89
+ * Merged last over channel defaults and catalog credentials so the script can override
90
+ * per call. Primitives are stringified; objects and arrays are JSON-serialized.
91
+ *
92
+ * Do not rely on **`name`** here for third-party “model name” fields — the runtime consumes
93
+ * it as the storage row selector and removes it before vendor config is built.
94
+ */
41
95
  data?: Record<string, unknown>;
42
- /** VAD tuning. */
96
+ /** Optional VAD tuning for this session (see host implementation). */
43
97
  vad?: AsrVadConfig;
44
- /** Smart turn-taking tuning. */
98
+ /** Optional smart-turn tuning for this session. */
45
99
  smartTurn?: AsrSmartTurnConfig;
46
100
  }
47
101
  /**
48
- * ASR handle a live speech recognition session.
102
+ * Live speech recognition session returned by {@link import('./media-channel').MediaChannel.createAsr}.
103
+ *
104
+ * Subscribe to **`partial$`** / **`result$`** for transcripts; wire **`speechStart$`** /
105
+ * **`speechEnd$`** / **`interrupt$`** for barge-in and UI. Call **`destroy()`** when done
106
+ * (e.g. on `channel.events.terminated$`) to release connector and subscriptions.
49
107
  *
50
- * Created via `channel.createAsr(config)`. Emits partial and final
51
- * recognition results as Observables. Must be destroyed when no longer needed.
108
+ * If connector creation fails, SIP/WS return a degraded handle: VAD observables still
109
+ * mirror the channel where possible, but `partial$` and `result$` do not emit real STT.
52
110
  */
53
111
  export interface AsrHandle {
54
- /** Unique handle identifier. */
112
+ /** Opaque id (passed to `channel.textInput` helpers in automated tests). */
55
113
  readonly id: string;
56
- /** Emits final recognition results (complete utterances). */
114
+ /**
115
+ * Emits one string per finalized utterance (end-of-turn). Empty strings may occur;
116
+ * filter in application code if needed.
117
+ */
57
118
  readonly result$: Observable<string>;
58
- /** Emits partial (intermediate) recognition results. `isFinal` = true on last partial. */
119
+ /**
120
+ * Streaming partial hypotheses. **`isFinal: true`** marks the last partial before a finalize
121
+ * or end-of-turn aligned with **`result$`**.
122
+ */
59
123
  readonly partial$: Observable<{
60
124
  text: string;
61
125
  isFinal: boolean;
62
126
  }>;
63
- /** Fires when speech is detected in the audio stream. */
127
+ /** Fires when VAD detects speech start (user started talking). */
64
128
  readonly speechStart$: Observable<void>;
65
- /** Fires when speech ends. */
129
+ /** Fires when VAD detects speech end (user stopped). */
66
130
  readonly speechEnd$: Observable<void>;
67
- /** Fires when ASR determines the user is interrupting (barge-in). */
131
+ /** Fires on barge-in / interrupt signals from the ASR stack (host-specific). */
68
132
  readonly interrupt$: Observable<void>;
69
- /** VAD probability stream (0.0–1.0) useful for visualization. */
133
+ /** Normalized voice-activity probability 0–1 when the host exposes it; else may be inert. */
70
134
  readonly vadProbability$: Observable<number>;
71
- /** Temporarily pause recognition (audio is still buffered). */
135
+ /** Pause forwarding new audio frames to the recognizer; skipped audio is not replayed. */
72
136
  pause(): void;
73
- /** Resume recognition after pause. */
137
+ /** Resume after {@link pause}. */
74
138
  resume(): void;
75
- /** Force-finalize the current utterance (trigger result$ immediately). */
139
+ /** Force end of current utterance and flush **`result$`** as soon as possible. */
76
140
  finalize(): void;
77
- /** Destroy this ASR handle and release all resources. */
141
+ /** Tear down streams, connector, and subscriptions. Idempotent-safe on well-behaved hosts. */
78
142
  destroy(): void;
79
143
  }
80
144
  //# sourceMappingURL=asr-handle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"asr-handle.d.ts","sour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I,CAAC,CAAC;IACxC,wDAAwD;IACxD,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,gFAAgF;IAChF,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IACtC,6FAA6F;IAC7F,QAAQ,CAAC,eAAe,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAE7C,0FAA0F;IAC1F,KAAK,IAAI,IAAI,CAAC;IACd,kCAAkC;IAClC,MAAM,IAAI,IAAI,CAAC;IACf,kFAAkF;IAClF,QAAQ,IAAI,IAAI,CAAC;IACjB,8FAA8F;IAC9F,OAAO,IAAI,IAAI,CAAC;CACjB"}
@@ -1,20 +1,20 @@
1
1
  /** DTMF digit event from the remote party. */
2
2
  export interface DtmfEvent {
3
- /** The pressed digit (`"0"`–`"9"`, `"*"`, `"#"`). */
3
+ /** The pressed digit. SIP emits `0`–`9`, `*`, `#`; WS input also accepts `A`–`D`. */
4
4
  digit: string;
5
- /** Duration of the tone in milliseconds. */
5
+ /** Duration of the tone in milliseconds, normalized by the channel when available. */
6
6
  duration: number;
7
7
  }
8
8
  /** Incoming SIP INFO message. */
9
9
  export interface SipInfo {
10
- /** MIME content type (e.g. `"application/dtmf-relay"`). */
10
+ /** MIME content type (e.g. `"application/dtmf-relay"`). May be empty for low-level Sofia events. */
11
11
  contentType: string;
12
- /** Message body. */
12
+ /** Message body. May be empty for low-level Sofia events. */
13
13
  body: string;
14
14
  }
15
15
  /** SIP call state change signal. */
16
16
  export interface SipSignal {
17
- /** Call state (e.g. `"ringing"`, `"confirmed"`, `"terminated"`). */
17
+ /** Raw telephony/Sofia call state, not normalized to SDK `SipState`. */
18
18
  state: string;
19
19
  /** SIP response status code (e.g. `200`, `486`). */
20
20
  statusCode?: number;
@@ -23,11 +23,11 @@ export interface SipSignal {
23
23
  /** SDP body (for media negotiation events). */
24
24
  sdp?: string;
25
25
  }
26
- /** Arbitrary data message (used for WS data channel communication). */
26
+ /** Arbitrary data message used for WS data-channel communication between script and client. */
27
27
  export interface DataMessage {
28
28
  /** Event name / type identifier. */
29
29
  event: string;
30
- /** Event payload (any JSON-serializable data). */
30
+ /** Event payload. Keep it JSON-serializable for WS clients and worker proxying. */
31
31
  payload: unknown;
32
32
  }
33
33
  //# sourceMappingURL=events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,WAAW,SAAS;IACxB,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,iCAAiC;AACjC,MAAM,WAAW,OAAO;IACtB,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,oCAAoC;AACpC,MAAM,WAAW,SAAS;IACxB,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,uEAAuE;AACvE,MAAM,WAAW,WAAW;IAC1B,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,OAAO,EAAE,OAAO,CAAC;CAClB"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,WAAW,SAAS;IACxB,qFAAqF;IACrF,KAAK,EAAE,MAAM,CAAC;IACd,sFAAsF;IACtF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,iCAAiC;AACjC,MAAM,WAAW,OAAO;IACtB,oGAAoG;IACpG,WAAW,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;CACd;AAED,oCAAoC;AACpC,MAAM,WAAW,SAAS;IACxB,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,+FAA+F;AAC/F,MAAM,WAAW,WAAW;IAC1B,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,OAAO,EAAE,OAAO,CAAC;CAClB"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Marker for pre-recorded phrase rows loaded from the Voctiv platform LE PostgreSQL DB
3
+ * ({@link PlatformApi.getRecords}). Pass to {@link ChannelAudio.play} instead of a URL/path string.
4
+ *
5
+ * Only used when Voctiv platform compatibility mode is enabled and the server has resolved
6
+ * a trusted LE agent id/UUID plus `LEGACY_V3_RECORD_PHRASE_ROOT`.
7
+ */
8
+ export declare const LEGACY_PHRASE_RECORD_BRAND: "__legacyPhraseRecord";
9
+ export interface LegacyPhraseRecord {
10
+ readonly [LEGACY_PHRASE_RECORD_BRAND]: true;
11
+ /** Absolute filesystem path passed to the audio decoder (same layout as old logic-executor `nv.say`). */
12
+ readonly path: string;
13
+ /** Phrase transcript / label from DB. */
14
+ readonly text: string;
15
+ /** Phrase name (`record_phrase.name`). */
16
+ readonly phraseName: string;
17
+ }
18
+ export declare function isLegacyPhraseRecord(source: unknown): source is LegacyPhraseRecord;
19
+ /** Parameters for {@link PlatformApi.getRecords} (Voctiv platform LE `RecordPhrase` / `record_phrase_file`). */
20
+ export interface LegacyGetRecordsParams {
21
+ /** Phrase group/name (`record_phrase.name`). */
22
+ phraseName: string;
23
+ /** Business flag used by the phrase catalog, normally `context.flag`. */
24
+ flag: string;
25
+ /** Language key used by the phrase catalog, normally `context.language`. */
26
+ language: string;
27
+ }
28
+ /**
29
+ * When set on {@link PlayOptions}, after TTS the audio is copied under the Voctiv platform
30
+ * record-phrase root and a `record_phrase` / `record_phrase_file` row is inserted so
31
+ * {@link PlatformApi.getRecords} can retrieve it. Also registers the PCM in the TTS file
32
+ * cache for subsequent `say`/`presay`.
33
+ *
34
+ * Only honored when Voctiv platform compatibility mode is active, `LEGACY_V3_RECORD_PHRASE_ROOT`
35
+ * is set, TTS cache is available, and the server resolved a trusted LE agent id/UUID.
36
+ */
37
+ export interface LegacySavePhraseOptions {
38
+ /** Phrase group/name to create or update. */
39
+ phraseName: string;
40
+ /** Defaults to dialog `flag` from channel params when omitted. */
41
+ flag?: string;
42
+ /** Defaults to dialog language from channel params when omitted. */
43
+ language?: string;
44
+ }
45
+ //# sourceMappingURL=legacy-phrase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-phrase.d.ts","sourceRoot":"","sources":["../../src/types/legacy-phrase.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,wBAAkC,CAAC;AAE1E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,CAAC,0BAA0B,CAAC,EAAE,IAAI,CAAC;IAC5C,yGAAyG;IACzG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,kBAAkB,CAOlF;AAED,gHAAgH;AAChH,MAAM,WAAW,sBAAsB;IACrC,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,uBAAuB;IACtC,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LEGACY_PHRASE_RECORD_BRAND = void 0;
4
+ exports.isLegacyPhraseRecord = isLegacyPhraseRecord;
5
+ /**
6
+ * Marker for pre-recorded phrase rows loaded from the Voctiv platform LE PostgreSQL DB
7
+ * ({@link PlatformApi.getRecords}). Pass to {@link ChannelAudio.play} instead of a URL/path string.
8
+ *
9
+ * Only used when Voctiv platform compatibility mode is enabled and the server has resolved
10
+ * a trusted LE agent id/UUID plus `LEGACY_V3_RECORD_PHRASE_ROOT`.
11
+ */
12
+ exports.LEGACY_PHRASE_RECORD_BRAND = '__legacyPhraseRecord';
13
+ function isLegacyPhraseRecord(source) {
14
+ return (typeof source === 'object' &&
15
+ source !== null &&
16
+ source[exports.LEGACY_PHRASE_RECORD_BRAND] === true &&
17
+ typeof source.path === 'string');
18
+ }
19
+ //# sourceMappingURL=legacy-phrase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-phrase.js","sourceRoot":"","sources":["../../src/types/legacy-phrase.ts"],"names":[],"mappings":";;;AAmBA,oDAOC;AA1BD;;;;;;GAMG;AACU,QAAA,0BAA0B,GAAG,sBAA+B,CAAC;AAY1E,SAAgB,oBAAoB,CAAC,MAAe;IAClD,OAAO,CACL,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,KAAK,IAAI;QACd,MAA6B,CAAC,kCAA0B,CAAC,KAAK,IAAI;QACnE,OAAQ,MAA6B,CAAC,IAAI,KAAK,QAAQ,CACxD,CAAC;AACJ,CAAC"}
@@ -1,8 +1,10 @@
1
1
  /**
2
2
  * Structured logger available to scripts.
3
3
  *
4
- * In legacy compat mode, log entries are also batch-written
4
+ * In Voctiv platform compatibility mode, log entries are also batch-written
5
5
  * to the `dialog_stats` DB table (equivalent of old LE `nn.log`).
6
+ * In all modes they go to the API process logger. Debug streaming, when enabled,
7
+ * forwards only logs from the current script session to the configured debug endpoint.
6
8
  */
7
9
  export interface ScriptLogger {
8
10
  /** Info-level log entry. */
@@ -11,7 +13,7 @@ export interface ScriptLogger {
11
13
  warn(message: string, data?: Record<string, unknown>): void;
12
14
  /** Error-level log entry. */
13
15
  error(message: string, data?: Record<string, unknown>): void;
14
- /** Debug-level log entry (not written to DB, only to stdout). */
16
+ /** Debug-level log entry; intended for process/debug stream output rather than legacy DB stats. */
15
17
  debug(message: string, data?: Record<string, unknown>): void;
16
18
  /**
17
19
  * Enable real-time log streaming to a remote debug endpoint.
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/types/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,4BAA4B;IAC5B,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3D,+BAA+B;IAC/B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5D,6BAA6B;IAC7B,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7D,iEAAiE;IACjE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAE7D;;;;;;OAMG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC,kEAAkE;IAClE,YAAY,IAAI,IAAI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