@umbraco-ai/core 17.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 +2 -2
- package/types/umbraco-ai-public-types.d.ts +137 -63
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbraco-ai/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./types/umbraco-ai-public-types.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"README.md"
|
|
9
9
|
],
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@umbraco-cms/backoffice": "^
|
|
11
|
+
"@umbraco-cms/backoffice": "^18.0.0",
|
|
12
12
|
"chart.js": "^4.5.1",
|
|
13
13
|
"diff": "^9.0.0"
|
|
14
14
|
}
|
|
@@ -10,6 +10,7 @@ import { Observable as Observable_2 } from 'rxjs';
|
|
|
10
10
|
import { TemplateResult } from 'lit-html';
|
|
11
11
|
import { TemplateResult as TemplateResult_2 } from '@umbraco-cms/backoffice/external/lit';
|
|
12
12
|
import { UmbApi } from '@umbraco-cms/backoffice/extension-api';
|
|
13
|
+
import { UmbCollectionActionBase } from '@umbraco-cms/backoffice/collection';
|
|
13
14
|
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
|
|
14
15
|
import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
|
|
15
16
|
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
|
@@ -22,47 +23,28 @@ import { UmbFormControlMixinElement } from '@umbraco-cms/backoffice/validation';
|
|
|
22
23
|
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
|
23
24
|
import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal';
|
|
24
25
|
import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
|
|
25
|
-
import { UUIFormControlMixinElement } from '@umbraco-ui/uui
|
|
26
|
+
import { UUIFormControlMixinElement } from '@umbraco-ui/uui';
|
|
26
27
|
|
|
27
28
|
export declare type AiDocumentMetadataModel = {
|
|
28
29
|
contentTypeKey: string;
|
|
29
30
|
variants: Array<AiVariantIdModel>;
|
|
30
31
|
isVariant: boolean;
|
|
31
32
|
isSegmented: boolean;
|
|
32
|
-
name?:
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export declare type AiDocumentMetadataModelWritable = {
|
|
36
|
-
contentTypeKey: string;
|
|
37
|
-
variants: Array<AiVariantIdModelWritable>;
|
|
38
|
-
isVariant: boolean;
|
|
39
|
-
isSegmented: boolean;
|
|
40
|
-
name?: string | null;
|
|
33
|
+
name?: null | string;
|
|
41
34
|
};
|
|
42
35
|
|
|
43
36
|
export declare type AiPropertyOperationModel = 'AddItem' | 'RemoveItem' | 'MoveItem' | 'SetValue' | 'ClearValue';
|
|
44
37
|
|
|
45
|
-
declare type AiPropertyPathSegmentModel = {
|
|
46
|
-
[key: string]: never;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
38
|
export declare type AiPropertyValueOperationErrorModel = {
|
|
50
39
|
code: string;
|
|
51
40
|
message: string;
|
|
52
|
-
details?:
|
|
53
|
-
[key: string]: JsonNode;
|
|
54
|
-
} | null;
|
|
41
|
+
details?: null | JsonObject;
|
|
55
42
|
};
|
|
56
43
|
|
|
57
44
|
export declare type AiVariantIdModel = {
|
|
58
|
-
culture
|
|
59
|
-
segment
|
|
60
|
-
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export declare type AiVariantIdModelWritable = {
|
|
64
|
-
culture?: string | null;
|
|
65
|
-
segment?: string | null;
|
|
45
|
+
culture: null | string;
|
|
46
|
+
segment: null | string;
|
|
47
|
+
isInvariant: boolean;
|
|
66
48
|
};
|
|
67
49
|
|
|
68
50
|
declare type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
|
|
@@ -284,12 +266,16 @@ declare type EntityVersionResponseModel = {
|
|
|
284
266
|
entityId: string;
|
|
285
267
|
version: number;
|
|
286
268
|
dateCreated: string;
|
|
287
|
-
createdByUserId?:
|
|
288
|
-
createdByUserName?:
|
|
289
|
-
changeDescription?:
|
|
269
|
+
createdByUserId?: null | string;
|
|
270
|
+
createdByUserName?: null | string;
|
|
271
|
+
changeDescription?: null | string;
|
|
290
272
|
};
|
|
291
273
|
|
|
292
|
-
declare type ErrInterceptor<Err, Res, Req, Options> = (error: 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>;
|
|
293
279
|
|
|
294
280
|
export declare function formatDateTime(input: string | Date, locale?: string): string;
|
|
295
281
|
|
|
@@ -314,7 +300,7 @@ declare class Interceptors<Interceptor> {
|
|
|
314
300
|
}
|
|
315
301
|
|
|
316
302
|
declare type InvokeData = {
|
|
317
|
-
body
|
|
303
|
+
body: PropertyValueOperationRequestModel;
|
|
318
304
|
path?: never;
|
|
319
305
|
query?: never;
|
|
320
306
|
url: '/umbraco/ai/management/api/v1/property-value-operation';
|
|
@@ -338,18 +324,10 @@ declare type InvokeResponses = {
|
|
|
338
324
|
200: PropertyValueOperationResponseModel;
|
|
339
325
|
};
|
|
340
326
|
|
|
341
|
-
declare type JsonNode =
|
|
342
|
-
options?: JsonNodeOptions | null;
|
|
343
|
-
parent?: JsonNode | null;
|
|
344
|
-
root: JsonNode;
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
declare type JsonNodeOptions = {
|
|
348
|
-
propertyNameCaseInsensitive: boolean;
|
|
349
|
-
};
|
|
327
|
+
declare type JsonNode = unknown;
|
|
350
328
|
|
|
351
|
-
declare type
|
|
352
|
-
[key: string]:
|
|
329
|
+
declare type JsonObject = {
|
|
330
|
+
[key: string]: unknown;
|
|
353
331
|
};
|
|
354
332
|
|
|
355
333
|
/**
|
|
@@ -479,32 +457,22 @@ declare type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
|
|
|
479
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'>);
|
|
480
458
|
|
|
481
459
|
export declare type PropertyValueOperationRequestModel = {
|
|
482
|
-
path: Array<
|
|
460
|
+
path: Array<unknown>;
|
|
483
461
|
operation: AiPropertyOperationModel;
|
|
484
|
-
args?:
|
|
485
|
-
rootValue?:
|
|
486
|
-
rootEditorSchemaAlias: string;
|
|
462
|
+
args?: null | JsonNode;
|
|
463
|
+
rootValue?: null | JsonNode;
|
|
487
464
|
documentMetadata: AiDocumentMetadataModel;
|
|
488
465
|
};
|
|
489
466
|
|
|
490
|
-
export declare type PropertyValueOperationRequestModelWritable = {
|
|
491
|
-
path: Array<AiPropertyPathSegmentModel>;
|
|
492
|
-
operation: AiPropertyOperationModel;
|
|
493
|
-
args?: JsonNodeWritable | null;
|
|
494
|
-
rootValue?: JsonNodeWritable | null;
|
|
495
|
-
rootEditorSchemaAlias: string;
|
|
496
|
-
documentMetadata: AiDocumentMetadataModelWritable;
|
|
497
|
-
};
|
|
498
|
-
|
|
499
467
|
export declare type PropertyValueOperationResponseModel = {
|
|
500
468
|
success: boolean;
|
|
501
|
-
newRootValue?:
|
|
502
|
-
blockKey?:
|
|
503
|
-
error?:
|
|
469
|
+
newRootValue?: null | JsonNode;
|
|
470
|
+
blockKey?: null | string;
|
|
471
|
+
error?: null | AiPropertyValueOperationErrorModel;
|
|
504
472
|
};
|
|
505
473
|
|
|
506
474
|
export declare class PropertyValueOperationsService {
|
|
507
|
-
static invoke<ThrowOnError extends boolean = false>(options
|
|
475
|
+
static invoke<ThrowOnError extends boolean = false>(options: Options<InvokeData, ThrowOnError>): RequestResult<InvokeResponses, InvokeErrors, ThrowOnError, "fields">;
|
|
508
476
|
}
|
|
509
477
|
|
|
510
478
|
declare type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
@@ -557,8 +525,10 @@ declare type RequestResult<TData = unknown, TError = unknown, ThrowOnError exten
|
|
|
557
525
|
data: undefined;
|
|
558
526
|
error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
|
|
559
527
|
}) & {
|
|
560
|
-
request
|
|
561
|
-
|
|
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;
|
|
562
532
|
}>;
|
|
563
533
|
|
|
564
534
|
declare type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
|
|
@@ -670,7 +640,7 @@ declare type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unk
|
|
|
670
640
|
stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
|
|
671
641
|
};
|
|
672
642
|
|
|
673
|
-
declare type SseFn = <TData = unknown,
|
|
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>>;
|
|
674
644
|
|
|
675
645
|
declare interface StreamEvent<TData = unknown> {
|
|
676
646
|
data: TData;
|
|
@@ -1392,6 +1362,85 @@ export declare interface UaiFrontendToolRepositoryApi extends UmbApi {
|
|
|
1392
1362
|
getTools(): Promise<UaiFrontendToolData[]>;
|
|
1393
1363
|
}
|
|
1394
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
|
+
|
|
1395
1444
|
/**
|
|
1396
1445
|
* A card with background/border chrome wrapping a labeled field.
|
|
1397
1446
|
*/
|
|
@@ -1492,6 +1541,31 @@ export declare class UaiModelEditorElement extends UmbLitElement {
|
|
|
1492
1541
|
static styles: CSSResult[];
|
|
1493
1542
|
}
|
|
1494
1543
|
|
|
1544
|
+
/**
|
|
1545
|
+
* No-op `collectionAction` api.
|
|
1546
|
+
*
|
|
1547
|
+
* v18's `collectionAction` extension type is registered via `umb-extension-with-api-slot`, which only
|
|
1548
|
+
* instantiates the element once *both* an element and an api are present (CMS PR #21974). When a
|
|
1549
|
+
* collection action's behaviour is entirely driven by its custom element (popovers, navigation,
|
|
1550
|
+
* dropdowns), there's nothing meaningful for the framework's `execute()` callback to do — but the
|
|
1551
|
+
* api still has to be there for the slot to render. This class is that placeholder.
|
|
1552
|
+
*
|
|
1553
|
+
* Pair it with a custom `element` in the manifest:
|
|
1554
|
+
*
|
|
1555
|
+
* ```ts
|
|
1556
|
+
* {
|
|
1557
|
+
* type: "collectionAction",
|
|
1558
|
+
* alias: "...",
|
|
1559
|
+
* element: () => import("./my-create-action.element.js"),
|
|
1560
|
+
* api: UaiNoOpCollectionAction,
|
|
1561
|
+
* meta: { label: "Create ..." },
|
|
1562
|
+
* }
|
|
1563
|
+
* ```
|
|
1564
|
+
*/
|
|
1565
|
+
export declare class UaiNoOpCollectionAction extends UmbCollectionActionBase {
|
|
1566
|
+
execute(): Promise<void>;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1495
1569
|
/**
|
|
1496
1570
|
* A command that updates a receiver object with a partial set of properties.
|
|
1497
1571
|
* @public
|
|
@@ -2574,8 +2648,8 @@ export declare class UaiWorkspaceRegistryContext extends UmbControllerBase {
|
|
|
2574
2648
|
|
|
2575
2649
|
declare type ValueChangeModel = {
|
|
2576
2650
|
path: string;
|
|
2577
|
-
oldValue?:
|
|
2578
|
-
newValue?:
|
|
2651
|
+
oldValue?: null | string;
|
|
2652
|
+
newValue?: null | string;
|
|
2579
2653
|
};
|
|
2580
2654
|
|
|
2581
2655
|
/**
|