@umbraco-ai/core 18.0.0 → 18.1.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": "18.0.0",
3
+ "version": "18.1.0",
4
4
  "type": "module",
5
5
  "types": "./types/umbraco-ai-public-types.d.ts",
6
6
  "files": [
@@ -30,40 +30,21 @@ export declare type AiDocumentMetadataModel = {
30
30
  variants: Array<AiVariantIdModel>;
31
31
  isVariant: boolean;
32
32
  isSegmented: boolean;
33
- name?: string | null;
34
- };
35
-
36
- export declare type AiDocumentMetadataModelWritable = {
37
- contentTypeKey: string;
38
- variants: Array<AiVariantIdModelWritable>;
39
- isVariant: boolean;
40
- isSegmented: boolean;
41
- name?: string | null;
33
+ name?: null | string;
42
34
  };
43
35
 
44
36
  export declare type AiPropertyOperationModel = 'AddItem' | 'RemoveItem' | 'MoveItem' | 'SetValue' | 'ClearValue';
45
37
 
46
- declare type AiPropertyPathSegmentModel = {
47
- [key: string]: never;
48
- };
49
-
50
38
  export declare type AiPropertyValueOperationErrorModel = {
51
39
  code: string;
52
40
  message: string;
53
- details?: {
54
- [key: string]: JsonNode;
55
- } | null;
41
+ details?: null | JsonObject;
56
42
  };
57
43
 
58
44
  export declare type AiVariantIdModel = {
59
- culture?: string | null;
60
- segment?: string | null;
61
- readonly isInvariant: boolean;
62
- };
63
-
64
- export declare type AiVariantIdModelWritable = {
65
- culture?: string | null;
66
- segment?: string | null;
45
+ culture: null | string;
46
+ segment: null | string;
47
+ isInvariant: boolean;
67
48
  };
68
49
 
69
50
  declare type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
@@ -285,12 +266,16 @@ declare type EntityVersionResponseModel = {
285
266
  entityId: string;
286
267
  version: number;
287
268
  dateCreated: string;
288
- createdByUserId?: string | null;
289
- createdByUserName?: string | null;
290
- changeDescription?: string | null;
269
+ createdByUserId?: null | string;
270
+ createdByUserName?: null | string;
271
+ changeDescription?: null | string;
291
272
  };
292
273
 
293
- declare type ErrInterceptor<Err, Res, Req, Options> = (error: Err, response: Res, request: Req, options: Options) => Err | Promise<Err>;
274
+ declare type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
275
+ /** response may be undefined due to a network error where no response object is produced */
276
+ response: Res | undefined,
277
+ /** request may be undefined, because error may be from building the request object itself */
278
+ request: Req | undefined, options: Options) => Err | Promise<Err>;
294
279
 
295
280
  export declare function formatDateTime(input: string | Date, locale?: string): string;
296
281
 
@@ -315,7 +300,7 @@ declare class Interceptors<Interceptor> {
315
300
  }
316
301
 
317
302
  declare type InvokeData = {
318
- body?: PropertyValueOperationRequestModelWritable;
303
+ body: PropertyValueOperationRequestModel;
319
304
  path?: never;
320
305
  query?: never;
321
306
  url: '/umbraco/ai/management/api/v1/property-value-operation';
@@ -339,18 +324,10 @@ declare type InvokeResponses = {
339
324
  200: PropertyValueOperationResponseModel;
340
325
  };
341
326
 
342
- declare type JsonNode = {
343
- options?: JsonNodeOptions | null;
344
- parent?: JsonNode | null;
345
- root: JsonNode;
346
- };
347
-
348
- declare type JsonNodeOptions = {
349
- propertyNameCaseInsensitive: boolean;
350
- };
327
+ declare type JsonNode = unknown;
351
328
 
352
- declare type JsonNodeWritable = {
353
- [key: string]: never;
329
+ declare type JsonObject = {
330
+ [key: string]: unknown;
354
331
  };
355
332
 
356
333
  /**
@@ -480,32 +457,22 @@ declare type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
480
457
  declare type Options_2<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
481
458
 
482
459
  export declare type PropertyValueOperationRequestModel = {
483
- path: Array<AiPropertyPathSegmentModel>;
460
+ path: Array<unknown>;
484
461
  operation: AiPropertyOperationModel;
485
- args?: JsonNode | null;
486
- rootValue?: JsonNode | null;
487
- rootEditorSchemaAlias: string;
462
+ args?: null | JsonNode;
463
+ rootValue?: null | JsonNode;
488
464
  documentMetadata: AiDocumentMetadataModel;
489
465
  };
490
466
 
491
- export declare type PropertyValueOperationRequestModelWritable = {
492
- path: Array<AiPropertyPathSegmentModel>;
493
- operation: AiPropertyOperationModel;
494
- args?: JsonNodeWritable | null;
495
- rootValue?: JsonNodeWritable | null;
496
- rootEditorSchemaAlias: string;
497
- documentMetadata: AiDocumentMetadataModelWritable;
498
- };
499
-
500
467
  export declare type PropertyValueOperationResponseModel = {
501
468
  success: boolean;
502
- newRootValue?: JsonNode | null;
503
- blockKey?: string | null;
504
- error?: AiPropertyValueOperationErrorModel | null;
469
+ newRootValue?: null | JsonNode;
470
+ blockKey?: null | string;
471
+ error?: null | AiPropertyValueOperationErrorModel;
505
472
  };
506
473
 
507
474
  export declare class PropertyValueOperationsService {
508
- static invoke<ThrowOnError extends boolean = false>(options?: Options<InvokeData, ThrowOnError>): RequestResult<InvokeResponses, InvokeErrors, ThrowOnError, "fields">;
475
+ static invoke<ThrowOnError extends boolean = false>(options: Options<InvokeData, ThrowOnError>): RequestResult<InvokeResponses, InvokeErrors, ThrowOnError, "fields">;
509
476
  }
510
477
 
511
478
  declare type QuerySerializer = (query: Record<string, unknown>) => string;
@@ -558,8 +525,10 @@ declare type RequestResult<TData = unknown, TError = unknown, ThrowOnError exten
558
525
  data: undefined;
559
526
  error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
560
527
  }) & {
561
- request: Request;
562
- response: Response;
528
+ /** request may be undefined, because error may be from building the request object itself */
529
+ request?: Request;
530
+ /** response may be undefined, because error may be from building the request object itself or from a network error */
531
+ response?: Response;
563
532
  }>;
564
533
 
565
534
  declare type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
@@ -671,7 +640,7 @@ declare type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unk
671
640
  stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
672
641
  };
673
642
 
674
- declare type SseFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData, TError>>;
643
+ declare type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData>>;
675
644
 
676
645
  declare interface StreamEvent<TData = unknown> {
677
646
  data: TData;
@@ -1393,6 +1362,85 @@ export declare interface UaiFrontendToolRepositoryApi extends UmbApi {
1393
1362
  getTools(): Promise<UaiFrontendToolData[]>;
1394
1363
  }
1395
1364
 
1365
+ /**
1366
+ * A single generated image, returned as base64 data and/or a URL.
1367
+ * @public
1368
+ */
1369
+ export declare interface UaiGeneratedImage {
1370
+ /** Base64-encoded image data, when the provider returned inline data. */
1371
+ data?: string;
1372
+ /** Image URL, when the provider returned a hosted/URI image. */
1373
+ url?: string;
1374
+ /** Media type of the image (e.g. "image/png"). */
1375
+ mediaType?: string;
1376
+ }
1377
+
1378
+ /**
1379
+ * Public API for generating images from a text prompt.
1380
+ *
1381
+ * Image generation is experimental and only available when the
1382
+ * `Umbraco:AI:Experimental:ImageGeneration` feature flag is enabled server-side;
1383
+ * otherwise the server returns 404.
1384
+ * @public
1385
+ */
1386
+ export declare class UaiImageGenerationController extends UmbControllerBase {
1387
+ #private;
1388
+ constructor(host: UmbControllerHost);
1389
+ /**
1390
+ * Generates one or more images from a text prompt.
1391
+ * @param prompt - The text prompt describing the desired image(s).
1392
+ * @param options - Optional configuration (profile ID/alias, count, size, original images, abort signal).
1393
+ * @returns The generation result or error.
1394
+ */
1395
+ generate(prompt: string, options?: UaiImageGenerationOptions): Promise<{
1396
+ data?: UaiImageGenerationResult;
1397
+ error?: unknown;
1398
+ }>;
1399
+ }
1400
+
1401
+ /**
1402
+ * Options for image generation (public API).
1403
+ * @public
1404
+ */
1405
+ export declare interface UaiImageGenerationOptions {
1406
+ /** Profile ID (GUID) or alias. If omitted, uses the default image-generation profile. */
1407
+ profileIdOrAlias?: string;
1408
+ /** Number of images to generate. */
1409
+ count?: number;
1410
+ /** Image size as "{width}x{height}" (e.g. "1024x1024"). */
1411
+ size?: string;
1412
+ /** Response format: "url", "data", or "hosted". */
1413
+ responseFormat?: string;
1414
+ /** Original images to edit (maskless edit). */
1415
+ originalImages?: UaiImageInput[];
1416
+ /** AbortSignal for cancellation. */
1417
+ signal?: AbortSignal;
1418
+ }
1419
+
1420
+ /* Excluded from this release type: UaiImageGenerationRequest */
1421
+
1422
+ /**
1423
+ * Result of an image-generation request.
1424
+ * @public
1425
+ */
1426
+ export declare interface UaiImageGenerationResult {
1427
+ images: UaiGeneratedImage[];
1428
+ usage?: {
1429
+ inputTokens?: number;
1430
+ outputTokens?: number;
1431
+ totalTokens?: number;
1432
+ };
1433
+ }
1434
+
1435
+ /**
1436
+ * A base64-encoded input image for maskless editing.
1437
+ * @public
1438
+ */
1439
+ export declare interface UaiImageInput {
1440
+ data: string;
1441
+ mediaType: string;
1442
+ }
1443
+
1396
1444
  /**
1397
1445
  * A card with background/border chrome wrapping a labeled field.
1398
1446
  */
@@ -2600,8 +2648,8 @@ export declare class UaiWorkspaceRegistryContext extends UmbControllerBase {
2600
2648
 
2601
2649
  declare type ValueChangeModel = {
2602
2650
  path: string;
2603
- oldValue?: string | null;
2604
- newValue?: string | null;
2651
+ oldValue?: null | string;
2652
+ newValue?: null | string;
2605
2653
  };
2606
2654
 
2607
2655
  /**