@umbraco-ai/core 1.7.0 → 1.9.0

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": "@umbraco-ai/core",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "type": "module",
5
5
  "types": "./types/umbraco-ai-public-types.d.ts",
6
6
  "files": [
@@ -25,6 +25,12 @@ import { UUIFormControlMixinElement } from '@umbraco-ui/uui-base';
25
25
 
26
26
  export declare const coreClientReady: Promise<void>;
27
27
 
28
+ /**
29
+ * Helper to create context item from a serialized element (e.g., a block within a document).
30
+ * Uses "elementType" instead of "entityType" so the backend can distinguish element from entity context.
31
+ */
32
+ export declare function createElementContextItem(entity: UaiSerializedEntity): UaiRequestContextItem;
33
+
28
34
  /**
29
35
  * Helper to create context item from serialized entity.
30
36
  */
@@ -185,22 +191,6 @@ export declare function resolveEntityAdapterByType(entityType: string): Promise<
185
191
  */
186
192
  export declare function toCamelCase(str: string): string;
187
193
 
188
- export declare type ToolItemResponseModel = {
189
- id: string;
190
- name: string;
191
- description: string;
192
- scopeId: string;
193
- isDestructive: boolean;
194
- tags: Array<string>;
195
- };
196
-
197
- export declare type ToolScopeItemResponseModel = {
198
- id: string;
199
- icon: string;
200
- isDestructive: boolean;
201
- domain: string;
202
- };
203
-
204
194
  export declare const UAI_ADDONS_MENU_ALIAS = "Uai.Menu.Addons";
205
195
 
206
196
  export declare const UAI_AI_SECTION_PATHNAME = "ai";
@@ -253,6 +243,53 @@ export declare const UAI_SECTION_ALIAS = "ai";
253
243
  */
254
244
  export declare const UAI_WORKSPACE_REGISTRY_CONTEXT: UmbContextToken<UaiWorkspaceRegistryContext, UaiWorkspaceRegistryContext>;
255
245
 
246
+ /**
247
+ * Manages browser audio recording via the MediaRecorder API.
248
+ *
249
+ * Extends `UmbControllerBase` so the recording is automatically cancelled
250
+ * when the host element is destroyed (e.g., navigating away in the SPA).
251
+ *
252
+ * Returns the recorded audio as a `Blob` — transcription is the caller's responsibility
253
+ * via {@link UaiSpeechToTextController}.
254
+ *
255
+ * State is exposed as an observable so Lit elements can bind to it with `this.observe()`.
256
+ *
257
+ * @example
258
+ * ```ts
259
+ * const recorder = new UaiAudioRecorder(this);
260
+ * this.observe(recorder.state$, (state) => { this._recorderState = state; });
261
+ * await recorder.start();
262
+ * const audioBlob = await recorder.stop();
263
+ * const { data } = await sttController.transcribe(audioBlob);
264
+ * ```
265
+ *
266
+ * @public
267
+ */
268
+ export declare class UaiAudioRecorder extends UmbControllerBase {
269
+ #private;
270
+ /** Observable of the current recorder state. */
271
+ get state$(): Observable<UaiAudioRecorderState>;
272
+ /** Current state (synchronous read). */
273
+ get state(): UaiAudioRecorderState;
274
+ constructor(host: UmbControllerHost);
275
+ /**
276
+ * Request microphone access and begin recording.
277
+ * @throws Error if microphone access is denied.
278
+ */
279
+ start(): Promise<void>;
280
+ /**
281
+ * Stop recording and return the captured audio.
282
+ * @returns The recorded audio as a Blob.
283
+ * @throws Error if no active recording exists.
284
+ */
285
+ stop(): Promise<Blob>;
286
+ /** Cancel any active recording without returning audio. */
287
+ cancel(): void;
288
+ destroy(): void;
289
+ }
290
+
291
+ export declare type UaiAudioRecorderState = "idle" | "recording";
292
+
256
293
  /**
257
294
  * Configuration for the bulk delete action.
258
295
  * @public
@@ -563,7 +600,7 @@ export declare interface UaiEmbeddingItem {
563
600
  */
564
601
  export declare interface UaiEmbeddingOptions {
565
602
  /** Profile ID (GUID) or alias. If omitted, uses the default embedding profile. */
566
- profile?: string;
603
+ profileIdOrAlias?: string;
567
604
  /** AbortSignal for cancellation. */
568
605
  signal?: AbortSignal;
569
606
  }
@@ -1140,6 +1177,48 @@ export declare interface UaiSerializedProperty {
1140
1177
  value: unknown;
1141
1178
  }
1142
1179
 
1180
+ /**
1181
+ * Public API for transcribing audio to text.
1182
+ * @public
1183
+ */
1184
+ export declare class UaiSpeechToTextController extends UmbControllerBase {
1185
+ #private;
1186
+ constructor(host: UmbControllerHost);
1187
+ /**
1188
+ * Transcribes an audio file to text.
1189
+ * @param audioFile - The audio blob to transcribe.
1190
+ * @param options - Optional configuration (profile ID/alias, language, abort signal).
1191
+ * @returns The transcription result or error.
1192
+ */
1193
+ transcribe(audioFile: Blob, options?: UaiSpeechToTextOptions): Promise<{
1194
+ data?: UaiSpeechToTextResult;
1195
+ error?: unknown;
1196
+ }>;
1197
+ }
1198
+
1199
+ /**
1200
+ * Options for speech-to-text transcription (public API).
1201
+ * @public
1202
+ */
1203
+ export declare interface UaiSpeechToTextOptions {
1204
+ /** Profile ID (GUID) or alias. If omitted, uses the default speech-to-text profile. */
1205
+ profileIdOrAlias?: string;
1206
+ /** BCP-47 language hint (e.g., "en", "de"). */
1207
+ language?: string;
1208
+ /** AbortSignal for cancellation. */
1209
+ signal?: AbortSignal;
1210
+ }
1211
+
1212
+ /* Excluded from this release type: UaiSpeechToTextRequest */
1213
+
1214
+ /**
1215
+ * Result of a speech-to-text transcription.
1216
+ * @public
1217
+ */
1218
+ export declare interface UaiSpeechToTextResult {
1219
+ text: string;
1220
+ }
1221
+
1143
1222
  /**
1144
1223
  * Response model for tag lookup results.
1145
1224
  * @public
@@ -1277,6 +1356,47 @@ export declare interface UaiTestFeatureEntityRepositoryApi extends UmbApi {
1277
1356
  getEntity(idOrAlias: string): Promise<UaiTestFeatureEntityData | undefined>;
1278
1357
  }
1279
1358
 
1359
+ /**
1360
+ * Public API for tool operations including scope and counting.
1361
+ * @public
1362
+ */
1363
+ export declare class UaiToolController extends UmbControllerBase {
1364
+ #private;
1365
+ constructor(host: UmbControllerHost);
1366
+ /**
1367
+ * Gets all registered tool scopes.
1368
+ */
1369
+ getToolScopes(): Promise<{
1370
+ data?: UaiToolScope[];
1371
+ error?: unknown;
1372
+ }>;
1373
+ /**
1374
+ * Gets all registered tools.
1375
+ */
1376
+ getTools(): Promise<{
1377
+ data?: UaiToolItem[];
1378
+ error?: unknown;
1379
+ }>;
1380
+ /**
1381
+ * Gets tool counts grouped by scope ID.
1382
+ * Combines backend and frontend tools.
1383
+ */
1384
+ getToolCountsByScope(): Promise<Record<string, number>>;
1385
+ }
1386
+
1387
+ /**
1388
+ * Represents a tool item.
1389
+ * @public
1390
+ */
1391
+ export declare interface UaiToolItem {
1392
+ id: string;
1393
+ name: string;
1394
+ description: string;
1395
+ scopeId: string;
1396
+ isDestructive: boolean;
1397
+ tags: string[];
1398
+ }
1399
+
1280
1400
  /**
1281
1401
  * Tool with permission state.
1282
1402
  */
@@ -1404,25 +1524,14 @@ export declare class UaiToolPickerElement extends UaiToolPickerElement_base {
1404
1524
  declare const UaiToolPickerElement_base: HTMLElementConstructor<UmbFormControlMixinElement<string[] | undefined>> & typeof UmbLitElement;
1405
1525
 
1406
1526
  /**
1407
- * Repository for tool operations.
1527
+ * Represents a tool scope item.
1528
+ * @public
1408
1529
  */
1409
- export declare class UaiToolRepository extends UmbControllerBase {
1410
- #private;
1411
- constructor(host: UmbControllerHost);
1412
- /**
1413
- * Gets all registered tool scopes.
1414
- */
1415
- getToolScopes(): Promise<{
1416
- data?: Array<ToolScopeItemResponseModel>;
1417
- error?: unknown;
1418
- }>;
1419
- /**
1420
- * Gets all registered tools.
1421
- */
1422
- getTools(): Promise<{
1423
- data?: Array<ToolItemResponseModel>;
1424
- error?: unknown;
1425
- }>;
1530
+ export declare interface UaiToolScope {
1531
+ id: string;
1532
+ icon: string;
1533
+ isDestructive: boolean;
1534
+ domain: string;
1426
1535
  }
1427
1536
 
1428
1537
  /**