@umbraco-ai/core 1.0.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 ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@umbraco-ai/core",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "types": "./types/umbraco-ai-public-types.d.ts",
6
+ "files": [
7
+ "types/umbraco-ai-public-types.d.ts",
8
+ "README.md"
9
+ ],
10
+ "peerDependencies": {
11
+ "chart.js": "^4.5.1",
12
+ "diff": "^8.0.3",
13
+ "@umbraco-cms/backoffice": "^17.1.0"
14
+ }
15
+ }
@@ -0,0 +1,1130 @@
1
+ import { CSSResult } from 'lit';
2
+ import { HTMLElementConstructor } from '@umbraco-cms/backoffice/extension-api';
3
+ import type { ManifestBase } from '@umbraco-cms/backoffice/extension-api';
4
+ import { Observable } from '@umbraco-cms/backoffice/external/rxjs';
5
+ import { Observable as Observable_2 } from 'rxjs';
6
+ import { TemplateResult } from 'lit-html';
7
+ import type { TemplateResult as TemplateResult_2 } from '@umbraco-cms/backoffice/external/lit';
8
+ import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
9
+ import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
10
+ import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
11
+ import type { UmbDetailRepository } from '@umbraco-cms/backoffice/repository';
12
+ import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action';
13
+ import { UmbEntityActionEvent } from '@umbraco-cms/backoffice/entity-action';
14
+ import { UmbEntityBulkActionBase } from '@umbraco-cms/backoffice/entity-bulk-action';
15
+ import { UmbFormControlMixinElement } from '@umbraco-cms/backoffice/validation';
16
+ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
17
+ import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal';
18
+ import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
19
+ import { UUIFormControlMixinElement } from '@umbraco-ui/uui-base';
20
+
21
+ /**
22
+ * Helper to create context item from serialized entity.
23
+ */
24
+ export declare function createEntityContextItem(entity: UaiSerializedEntity): UaiRequestContextItem;
25
+
26
+ /**
27
+ * Helper to create context item from user text selection.
28
+ */
29
+ export declare function createSelectionContextItem(selectedText: string): UaiRequestContextItem;
30
+
31
+ /**
32
+ * Dispatches an event through the action event context.
33
+ *
34
+ * Note: The host parameter uses `any` to avoid cross-package type coupling.
35
+ * When consumers import from different @umbraco-cms/backoffice instances,
36
+ * strict typing on UmbClassInterface causes TypeScript errors even with identical versions.
37
+ * @public
38
+ */
39
+ export declare function dispatchActionEvent(host: any, event: Event): void;
40
+
41
+ declare type EntityVersionComparisonResponseModel = {
42
+ fromVersion: number;
43
+ toVersion: number;
44
+ changes: Array<PropertyChangeModel>;
45
+ };
46
+
47
+ declare type EntityVersionHistoryResponseModel = {
48
+ currentVersion: number;
49
+ totalVersions: number;
50
+ versions: Array<EntityVersionResponseModel>;
51
+ };
52
+
53
+ declare type EntityVersionResponseModel = {
54
+ id: string;
55
+ entityId: string;
56
+ version: number;
57
+ dateCreated: string;
58
+ createdByUserId?: string | null;
59
+ createdByUserName?: string | null;
60
+ changeDescription?: string | null;
61
+ };
62
+
63
+ export declare function formatDateTime(input: string | Date, locale?: string): string;
64
+
65
+ /**
66
+ * Check if an entity adapter is registered for the given entity type.
67
+ *
68
+ * @param entityType - The entity type to check (e.g., "document", "media")
69
+ * @returns True if an adapter is registered for this entity type
70
+ */
71
+ export declare function hasEntityAdapter(entityType: string): boolean;
72
+
73
+ /**
74
+ * Manifest for entity adapter extensions.
75
+ */
76
+ export declare interface ManifestEntityAdapter extends ManifestBase {
77
+ type: typeof UAI_ENTITY_ADAPTER_EXTENSION_TYPE;
78
+ /** The entity type this adapter handles (e.g., "document", "media") */
79
+ forEntityType: string;
80
+ /** The adapter API class loader */
81
+ api: () => Promise<{
82
+ default: new () => UaiEntityAdapterApi;
83
+ }>;
84
+ }
85
+
86
+ declare type PropertyChangeModel = {
87
+ propertyName: string;
88
+ oldValue?: string | null;
89
+ newValue?: string | null;
90
+ };
91
+
92
+ /**
93
+ * Resolve an entity adapter by entity type.
94
+ *
95
+ * Looks up the extension registry for an adapter manifest matching the entity type,
96
+ * loads the adapter API module, and returns an instance.
97
+ *
98
+ * @param entityType - The entity type to find an adapter for (e.g., "document", "media")
99
+ * @returns The adapter instance, or undefined if no matching adapter is found
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * const entityType = workspaceContext.getEntityType();
104
+ * const adapter = await resolveEntityAdapterByType(entityType);
105
+ * if (adapter) {
106
+ * const serialized = await adapter.serializeForLlm(workspaceContext);
107
+ * }
108
+ * ```
109
+ */
110
+ export declare function resolveEntityAdapterByType(entityType: string): Promise<UaiEntityAdapterApi | undefined>;
111
+
112
+ /**
113
+ * A constant representing an empty GUID.
114
+ * @public
115
+ */
116
+ export declare const UAI_EMPTY_GUID = "00000000-0000-0000-0000-000000000000";
117
+
118
+ /**
119
+ * Extension type alias for entity adapters.
120
+ */
121
+ export declare const UAI_ENTITY_ADAPTER_EXTENSION_TYPE = "uaiEntityAdapter";
122
+
123
+ export declare const UAI_ITEM_PICKER_MODAL: UmbModalToken<UaiItemPickerModalData, UaiItemPickerModalValue>;
124
+
125
+ /**
126
+ * Modal token for the rollback confirmation modal.
127
+ */
128
+ export declare const UAI_ROLLBACK_MODAL: UmbModalToken<UaiRollbackModalData, UaiRollbackModalValue>;
129
+
130
+ /**
131
+ * Context token for consuming the Workspace Registry.
132
+ * Use this to access active workspaces from any component.
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * this.consumeContext(UAI_WORKSPACE_REGISTRY_CONTEXT, (context) => {
137
+ * const workspaces = context.getAll();
138
+ * context.changes$.subscribe(event => console.log(event));
139
+ * });
140
+ * ```
141
+ */
142
+ export declare const UAI_WORKSPACE_REGISTRY_CONTEXT: UmbContextToken<UaiWorkspaceRegistryContext, UaiWorkspaceRegistryContext>;
143
+
144
+ /**
145
+ * Configuration for the bulk delete action.
146
+ * @public
147
+ */
148
+ export declare interface UaiBulkDeleteActionArgs {
149
+ /** Localization key or text for the dialog headline */
150
+ headline: string;
151
+ /** Localization key for the confirmation message (will be interpolated with count) */
152
+ confirmMessage: string;
153
+ /** Factory function to create the detail repository */
154
+ getRepository: (host: UmbControllerHost) => UmbDetailRepository<unknown>;
155
+ }
156
+
157
+ /**
158
+ * Reusable bulk delete action for Umbraco.AI entities.
159
+ * Extend this class and provide configuration via getArgs().
160
+ *
161
+ * Note: Event dispatching is handled by the repository for each deleted item.
162
+ * @public
163
+ */
164
+ export declare abstract class UaiBulkDeleteActionBase extends UmbEntityBulkActionBase<never> {
165
+ #private;
166
+ /**
167
+ * Override this method to provide the bulk delete action configuration.
168
+ */
169
+ protected abstract getArgs(): UaiBulkDeleteActionArgs;
170
+ execute(): Promise<void>;
171
+ }
172
+
173
+ /**
174
+ * Public API for performing chat completions.
175
+ * @public
176
+ */
177
+ export declare class UaiChatController extends UmbControllerBase {
178
+ #private;
179
+ constructor(host: UmbControllerHost);
180
+ /**
181
+ * Performs a chat completion.
182
+ * @param messages - The conversation messages.
183
+ * @param options - Optional configuration (profile ID/alias, abort signal).
184
+ * @returns The AI response or error.
185
+ */
186
+ complete(messages: UaiChatMessage[], options?: UaiChatOptions): Promise<{
187
+ data?: UaiChatResult;
188
+ error?: unknown;
189
+ }>;
190
+ }
191
+
192
+ /**
193
+ * Represents a chat message.
194
+ * @public
195
+ */
196
+ export declare interface UaiChatMessage {
197
+ role: UaiChatRole;
198
+ content: string;
199
+ }
200
+
201
+ /**
202
+ * Options for chat completion (public API).
203
+ * @public
204
+ */
205
+ export declare interface UaiChatOptions {
206
+ /** Profile ID (GUID) or alias. If omitted, uses the default chat profile. */
207
+ profileIdOrAlias?: string;
208
+ /** AbortSignal for cancellation. */
209
+ signal?: AbortSignal;
210
+ }
211
+
212
+ /* Excluded from this release type: UaiChatRequest */
213
+
214
+ /**
215
+ * Result of a chat completion.
216
+ * @public
217
+ */
218
+ export declare interface UaiChatResult {
219
+ message: UaiChatMessage;
220
+ finishReason?: string | null;
221
+ usage?: UaiChatUsage | null;
222
+ }
223
+
224
+ /**
225
+ * Chat message role.
226
+ * @public
227
+ */
228
+ export declare type UaiChatRole = 'user' | 'assistant' | 'system';
229
+
230
+ /**
231
+ * Streaming chunk from chat completion.
232
+ * @public
233
+ */
234
+ export declare interface UaiChatStreamChunk {
235
+ content: string;
236
+ finishReason?: string | null;
237
+ }
238
+
239
+ /**
240
+ * Token usage statistics.
241
+ * @public
242
+ */
243
+ export declare interface UaiChatUsage {
244
+ inputTokens?: number | null;
245
+ outputTokens?: number | null;
246
+ totalTokens?: number | null;
247
+ }
248
+
249
+ /**
250
+ * Defines the contract for a command in the UAI system.
251
+ * @public
252
+ */
253
+ export declare interface UaiCommand {
254
+ correlationId?: string;
255
+ execute(receiver: unknown): void;
256
+ }
257
+
258
+ /**
259
+ * Base class for UAI commands, providing common functionality.
260
+ * @public
261
+ */
262
+ export declare abstract class UaiCommandBase<TReceiver> implements UaiCommand {
263
+ correlationId?: string;
264
+ constructor(correlationId?: string);
265
+ abstract execute(receiver: TReceiver): void;
266
+ }
267
+
268
+ /**
269
+ * A store for UaiCommand instances, allowing addition, retrieval, muting, and clearing of commands.
270
+ * @public
271
+ */
272
+ export declare class UaiCommandStore {
273
+ #private;
274
+ add(command: UaiCommand): void;
275
+ getAll(): UaiCommand[];
276
+ mute(): void;
277
+ unmute(): void;
278
+ clear(): void;
279
+ reset(): void;
280
+ }
281
+
282
+ export declare class UaiContextPickerElement extends UaiContextPickerElement_base {
283
+ #private;
284
+ /**
285
+ * Allow selecting multiple contexts.
286
+ */
287
+ multiple: boolean;
288
+ /**
289
+ * Readonly mode - cannot add or remove.
290
+ */
291
+ readonly: boolean;
292
+ /**
293
+ * Minimum number of required contexts.
294
+ */
295
+ min?: number;
296
+ /**
297
+ * Maximum number of allowed contexts.
298
+ */
299
+ max?: number;
300
+ /**
301
+ * The selected context ID(s).
302
+ * - Single mode: string | undefined
303
+ * - Multiple mode: string[] | undefined
304
+ */
305
+ set value(val: string | string[] | undefined);
306
+ get value(): string | string[] | undefined;
307
+ private _selection;
308
+ private _items;
309
+ private _loading;
310
+ render(): TemplateResult<1>;
311
+ static styles: CSSResult[];
312
+ }
313
+
314
+ declare const UaiContextPickerElement_base: HTMLElementConstructor<UmbFormControlMixinElement<string | string[] | undefined>> & typeof UmbLitElement;
315
+
316
+ /**
317
+ * Configuration for the delete action.
318
+ * @public
319
+ */
320
+ export declare interface UaiDeleteActionArgs {
321
+ /** Localization key or text for the dialog headline */
322
+ headline: string;
323
+ /** Localization key or text for the confirmation message */
324
+ confirmMessage: string;
325
+ /** Factory function to create the detail repository */
326
+ getRepository: (host: UmbControllerHost) => UmbDetailRepository<unknown>;
327
+ }
328
+
329
+ /**
330
+ * Reusable delete action for Umbraco.AI entities.
331
+ * Extend this class and provide configuration via getArgs().
332
+ *
333
+ * Note: Event dispatching is handled by the repository, not the action.
334
+ * @public
335
+ */
336
+ export declare abstract class UaiDeleteActionBase extends UmbEntityActionBase<never> {
337
+ /**
338
+ * Override this method to provide the delete action configuration.
339
+ */
340
+ protected abstract getArgs(): UaiDeleteActionArgs;
341
+ execute(): Promise<void>;
342
+ }
343
+
344
+ /**
345
+ * Detected entity with its adapter and workspace context.
346
+ * Used internally by the entity adapter context.
347
+ */
348
+ export declare interface UaiDetectedEntity {
349
+ /** Unique key: entityType:unique */
350
+ key: string;
351
+ /** Display name for UI */
352
+ name: string;
353
+ /** Icon name for UI */
354
+ icon?: string;
355
+ /** Entity identity */
356
+ entityContext: UaiEntityContext;
357
+ /** The adapter that handles this entity */
358
+ adapter: UaiEntityAdapterApi;
359
+ /** Live workspace context instance */
360
+ workspaceContext: object;
361
+ }
362
+
363
+ /**
364
+ * Adapter for Umbraco document entities.
365
+ */
366
+ export declare class UaiDocumentAdapter implements UaiEntityAdapterApi {
367
+ #private;
368
+ readonly entityType = "document";
369
+ /**
370
+ * Check if the workspace context is a document workspace.
371
+ * Uses duck-typing to check for document-specific methods.
372
+ */
373
+ canHandle(workspaceContext: unknown): boolean;
374
+ /**
375
+ * Extract entity identity from document workspace context.
376
+ */
377
+ extractEntityContext(workspaceContext: unknown): UaiEntityContext;
378
+ /**
379
+ * Get the current display name for the document.
380
+ */
381
+ getName(workspaceContext: unknown): string;
382
+ /**
383
+ * Get an observable for the document name for reactive updates.
384
+ * Uses the variants observable which properly tracks name changes.
385
+ */
386
+ getNameObservable(workspaceContext: unknown): Observable<string | undefined> | undefined;
387
+ /**
388
+ * Get the icon for the document from its content type.
389
+ * Returns undefined initially - use getIconObservable for reactive updates.
390
+ */
391
+ getIcon(workspaceContext: unknown): string | undefined;
392
+ /**
393
+ * Get an observable for the document icon for reactive updates.
394
+ * Uses the structure manager's ownerContentType observable to get the icon.
395
+ */
396
+ getIconObservable(workspaceContext: unknown): Observable<string | undefined> | undefined;
397
+ /**
398
+ * Serialize document for LLM context.
399
+ * Uses structure to get all properties, then merges with values.
400
+ * Only includes TextBox and TextArea properties for now.
401
+ */
402
+ serializeForLlm(workspaceContext: unknown): Promise<UaiSerializedEntity>;
403
+ /**
404
+ * Apply a property change to the document workspace.
405
+ * Changes are staged in the workspace - user must save to persist.
406
+ * Only supports text-based properties (TextBox, TextArea) for now.
407
+ */
408
+ applyPropertyChange(workspaceContext: unknown, change: UaiPropertyChange): Promise<UaiPropertyChangeResult>;
409
+ }
410
+
411
+ /**
412
+ * Editable model field for UI consumption.
413
+ */
414
+ export declare interface UaiEditableModelFieldModel {
415
+ key: string;
416
+ label: string;
417
+ description?: string;
418
+ editorUiAlias?: string;
419
+ editorConfig?: unknown;
420
+ defaultValue?: unknown;
421
+ sortOrder: number;
422
+ isRequired: boolean;
423
+ }
424
+
425
+ /**
426
+ * Editable model schema for UI consumption.
427
+ */
428
+ export declare interface UaiEditableModelSchemaModel {
429
+ type?: string;
430
+ fields: UaiEditableModelFieldModel[];
431
+ }
432
+
433
+ /**
434
+ * A single embedding vector with its index.
435
+ * @public
436
+ */
437
+ export declare interface UaiEmbeddingItem {
438
+ index: number;
439
+ vector: number[];
440
+ }
441
+
442
+ /**
443
+ * Options for embedding generation (public API).
444
+ * @public
445
+ */
446
+ export declare interface UaiEmbeddingOptions {
447
+ /** Profile ID (GUID) or alias. If omitted, uses the default embedding profile. */
448
+ profile?: string;
449
+ /** AbortSignal for cancellation. */
450
+ signal?: AbortSignal;
451
+ }
452
+
453
+ /* Excluded from this release type: UaiEmbeddingRequest */
454
+
455
+ /**
456
+ * Result of an embedding generation request.
457
+ * @public
458
+ */
459
+ export declare interface UaiEmbeddingResult {
460
+ embeddings: UaiEmbeddingItem[];
461
+ }
462
+
463
+ /**
464
+ * Public API for generating embeddings.
465
+ * @public
466
+ */
467
+ export declare class UaiEmbeddingsController extends UmbControllerBase {
468
+ #private;
469
+ constructor(host: UmbControllerHost);
470
+ /**
471
+ * Generates embeddings for a single value.
472
+ * @param value - The text to generate an embedding for.
473
+ * @param options - Optional configuration (profile ID/alias, abort signal).
474
+ * @returns The embedding vector or error.
475
+ */
476
+ generate(value: string, options?: UaiEmbeddingOptions): Promise<{
477
+ data?: number[];
478
+ error?: unknown;
479
+ }>;
480
+ /**
481
+ * Generates embeddings for multiple values.
482
+ * @param values - The texts to generate embeddings for.
483
+ * @param options - Optional configuration (profile ID/alias, abort signal).
484
+ * @returns The embedding result or error.
485
+ */
486
+ generateMany(values: string[], options?: UaiEmbeddingOptions): Promise<{
487
+ data?: UaiEmbeddingResult;
488
+ error?: unknown;
489
+ }>;
490
+ }
491
+
492
+ /**
493
+ * Custom event for Umbraco.AI entity actions.
494
+ * Dispatched by repositories after successful CRUD operations.
495
+ * @public
496
+ */
497
+ export declare class UaiEntityActionEvent extends UmbEntityActionEvent {
498
+ static readonly CREATED = "uai-entity-created";
499
+ static readonly UPDATED = "uai-entity-updated";
500
+ static readonly DELETED = "uai-entity-deleted";
501
+ static created(unique: string, entityType: string): UaiEntityActionEvent;
502
+ static updated(unique: string, entityType: string): UaiEntityActionEvent;
503
+ static deleted(unique: string, entityType: string): UaiEntityActionEvent;
504
+ constructor(type: string, unique: string, entityType: string);
505
+ }
506
+
507
+ /**
508
+ * Entity adapter API interface.
509
+ * Adapters are responsible for:
510
+ * - Detecting if they can handle a workspace context
511
+ * - Extracting entity identity from workspace context
512
+ * - Serializing entity data for LLM consumption
513
+ * - Applying property changes (optional)
514
+ */
515
+ export declare interface UaiEntityAdapterApi {
516
+ readonly entityType: string;
517
+ /**
518
+ * Check if this adapter can handle the given workspace context.
519
+ */
520
+ canHandle(workspaceContext: unknown): boolean;
521
+ /**
522
+ * Extract entity identity from workspace context.
523
+ */
524
+ extractEntityContext(workspaceContext: unknown): UaiEntityContext;
525
+ /**
526
+ * Get the current display name for the entity.
527
+ * Used for initial name population.
528
+ */
529
+ getName(workspaceContext: unknown): string;
530
+ /**
531
+ * Get an observable for the entity name for reactive updates.
532
+ * Returns undefined if the adapter doesn't support reactive names.
533
+ */
534
+ getNameObservable?(workspaceContext: unknown): Observable<string | undefined> | undefined;
535
+ /**
536
+ * Get the icon for the entity.
537
+ * Used for initial icon population.
538
+ */
539
+ getIcon?(workspaceContext: unknown): string | undefined;
540
+ /**
541
+ * Get an observable for the entity icon for reactive updates.
542
+ * Returns undefined if the adapter doesn't support reactive icons.
543
+ */
544
+ getIconObservable?(workspaceContext: unknown): Observable<string | undefined> | undefined;
545
+ /**
546
+ * Serialize the entity for LLM context.
547
+ */
548
+ serializeForLlm(workspaceContext: unknown): Promise<UaiSerializedEntity>;
549
+ /**
550
+ * Apply a property change to the workspace (staged, not persisted).
551
+ * Optional - some entity types may be read-only.
552
+ * @param workspaceContext The workspace context to modify
553
+ * @param change The property change to apply
554
+ * @returns Result indicating success or failure with error message
555
+ */
556
+ applyPropertyChange?(workspaceContext: unknown, change: UaiPropertyChange): Promise<UaiPropertyChangeResult>;
557
+ }
558
+
559
+ /**
560
+ * Context for entity adapter operations.
561
+ *
562
+ * Responsibilities:
563
+ * - Watch workspace registry for active workspaces
564
+ * - Match workspaces to entity adapters (from extension registry)
565
+ * - Track detected entities with adapters
566
+ * - Manage selected entity for context injection
567
+ * - Serialize selected entity for LLM context
568
+ */
569
+ export declare class UaiEntityAdapterContext extends UmbControllerBase {
570
+ #private;
571
+ constructor(host: UmbControllerHost);
572
+ destroy(): void;
573
+ /** Observable of all detected entities */
574
+ get detectedEntities$(): Observable<UaiDetectedEntity[]>;
575
+ /** Observable of the currently selected entity */
576
+ get selectedEntity$(): Observable<UaiDetectedEntity | undefined>;
577
+ /**
578
+ * Set the selected entity by key.
579
+ * Called by UI when user selects a different entity context.
580
+ */
581
+ setSelectedEntityKey(key: string | undefined): void;
582
+ /**
583
+ * Get all detected entities synchronously.
584
+ */
585
+ getDetectedEntities(): UaiDetectedEntity[];
586
+ /**
587
+ * Get the selected entity synchronously.
588
+ */
589
+ getSelectedEntity(): UaiDetectedEntity | undefined;
590
+ /**
591
+ * Serialize the selected entity for LLM context injection.
592
+ * Returns undefined if no entity is selected.
593
+ */
594
+ serializeSelectedEntity(): Promise<UaiSerializedEntity | undefined>;
595
+ /**
596
+ * Apply a property change to the currently selected entity.
597
+ * Changes are staged in the workspace - user must save to persist.
598
+ * @param change The property change to apply
599
+ * @returns Result indicating success or failure with error message
600
+ */
601
+ applyPropertyChange(change: UaiPropertyChange): Promise<UaiPropertyChangeResult>;
602
+ }
603
+
604
+ /**
605
+ * Entity Adapter Types
606
+ *
607
+ * Minimal interfaces for the entity adapter system that enables
608
+ * AI tools to interact with Umbraco entities being edited.
609
+ */
610
+ /**
611
+ * Represents the identity of an entity being edited.
612
+ * Supports hierarchical relationships via recursive parentContext.
613
+ */
614
+ export declare interface UaiEntityContext {
615
+ entityType: string;
616
+ unique: string | null;
617
+ parentContext?: UaiEntityContext;
618
+ }
619
+
620
+ /**
621
+ * Configuration for the entity deleted redirect controller.
622
+ * @public
623
+ */
624
+ export declare interface UaiEntityDeletedRedirectArgs {
625
+ /** Function to get the current entity's unique identifier */
626
+ getUnique: () => string | undefined;
627
+ /** Function to get the current entity's type */
628
+ getEntityType: () => string | undefined;
629
+ /** Path to redirect to after the entity is deleted */
630
+ collectionPath: string;
631
+ }
632
+
633
+ /**
634
+ * Controller that redirects to the collection view when the current entity is deleted.
635
+ * Add this to workspace contexts that support deletion.
636
+ * @public
637
+ */
638
+ export declare class UaiEntityDeletedRedirectController extends UmbControllerBase {
639
+ #private;
640
+ static readonly ALIAS = "UaiEntityDeletedRedirectController";
641
+ constructor(host: UmbControllerHost, args: UaiEntityDeletedRedirectArgs);
642
+ }
643
+
644
+ export declare interface UaiItemPickerModalData {
645
+ items?: UaiPickableItemModel[];
646
+ fetchItems?: () => Promise<UaiPickableItemModel[]>;
647
+ selectionMode?: 'single' | 'multiple';
648
+ tagTemplate?: (item: UaiPickableItemModel) => TemplateResult_2;
649
+ title?: string;
650
+ buttonLabel?: string;
651
+ noResultsMessage?: string;
652
+ }
653
+
654
+ export declare class UaiItemPickerModalElement extends UmbModalBaseElement<UaiItemPickerModalData, UaiItemPickerModalValue> {
655
+ #private;
656
+ private _loaded;
657
+ private _items;
658
+ private _filteredItems;
659
+ private _selectedItems;
660
+ connectedCallback(): Promise<void>;
661
+ render(): TemplateResult<1> | undefined;
662
+ static styles: CSSResult[];
663
+ }
664
+
665
+ export declare interface UaiItemPickerModalValue {
666
+ selection: UaiPickableItemModel[];
667
+ }
668
+
669
+ /**
670
+ * Event detail for model editor value changes.
671
+ */
672
+ export declare interface UaiModelEditorChangeEventDetail {
673
+ model: Record<string, unknown>;
674
+ }
675
+
676
+ /**
677
+ * Reusable model editor component that renders a dynamic form based on a schema.
678
+ * Uses Umbraco's property dataset and property elements for rendering fields.
679
+ *
680
+ * @fires change - Fired when field values change
681
+ *
682
+ * @example
683
+ * ```html
684
+ * <uai-model-editor
685
+ * .schema=${providerSchema}
686
+ * .model=${currentSettings}
687
+ * @change=${this.#onSettingsChange}>
688
+ * </uai-model-editor>
689
+ * ```
690
+ */
691
+ export declare class UaiModelEditorElement extends UmbLitElement {
692
+ #private;
693
+ /**
694
+ * The schema defining the fields to render.
695
+ */
696
+ schema?: UaiEditableModelSchemaModel;
697
+ /**
698
+ * The current model values for the fields (key-value pairs).
699
+ */
700
+ model?: Record<string, unknown>;
701
+ /**
702
+ * Placeholder text shown when the schema has no fields.
703
+ */
704
+ emptyMessage?: string;
705
+ private _propertyValues;
706
+ shouldUpdate(changedProperties: Map<string, unknown>): boolean;
707
+ updated(changedProperties: Map<string, unknown>): void;
708
+ render(): TemplateResult<1>;
709
+ static styles: CSSResult[];
710
+ }
711
+
712
+ /**
713
+ * A command that updates a receiver object with a partial set of properties.
714
+ * @public
715
+ */
716
+ export declare class UaiPartialUpdateCommand<TReceiver> extends UaiCommandBase<TReceiver> {
717
+ #private;
718
+ constructor(partial: Partial<TReceiver>, correlationId?: string);
719
+ execute(receiver: TReceiver): void;
720
+ }
721
+
722
+ export declare type UaiPickableItemModel = {
723
+ value: string;
724
+ label: string;
725
+ description?: string;
726
+ icon?: string;
727
+ color?: string;
728
+ meta?: any;
729
+ };
730
+
731
+ /**
732
+ * Profile picker component that allows selecting one or more AI profiles.
733
+ * Can be filtered by capability (e.g., "Chat", "Embedding").
734
+ *
735
+ * @fires change - Fires when the selection changes (UmbChangeEvent).
736
+ *
737
+ * @example
738
+ * Single selection (default):
739
+ * ```html
740
+ * <uai-profile-picker
741
+ * capability="Chat"
742
+ * .value=${"profile-id"}
743
+ * @change=${(e) => console.log(e.target.value)}
744
+ * ></uai-profile-picker>
745
+ * ```
746
+ * Multiple selection:
747
+ * ```html
748
+ * <uai-profile-picker
749
+ * multiple
750
+ * .value=${["profile-id-1", "profile-id-2"]}
751
+ * @change=${(e) => console.log(e.target.value)}
752
+ * ></uai-profile-picker>
753
+ * ```
754
+ * @public
755
+ */
756
+ export declare class UaiProfilePickerElement extends UaiProfilePickerElement_base {
757
+ #private;
758
+ /**
759
+ * Filter profiles by capability. If not set, all profiles are shown.
760
+ */
761
+ capability?: string;
762
+ /**
763
+ * Allow selecting multiple profiles.
764
+ */
765
+ multiple: boolean;
766
+ /**
767
+ * Readonly mode - cannot add or remove.
768
+ */
769
+ readonly: boolean;
770
+ /**
771
+ * Minimum number of required profiles.
772
+ */
773
+ min?: number;
774
+ /**
775
+ * Maximum number of allowed profiles.
776
+ */
777
+ max?: number;
778
+ /**
779
+ * The selected profile ID(s).
780
+ * - Single mode: string | undefined
781
+ * - Multiple mode: string[] | undefined
782
+ */
783
+ set value(val: string | string[] | undefined);
784
+ get value(): string | string[] | undefined;
785
+ private _selection;
786
+ private _items;
787
+ private _loading;
788
+ render(): TemplateResult<1>;
789
+ static styles: CSSResult[];
790
+ }
791
+
792
+ declare const UaiProfilePickerElement_base: HTMLElementConstructor<UmbFormControlMixinElement<string | string[] | undefined>> & typeof UmbLitElement;
793
+
794
+ /**
795
+ * Request to change a property value.
796
+ * Changes are staged in the workspace - user must save to persist.
797
+ */
798
+ export declare interface UaiPropertyChange {
799
+ /** Property alias */
800
+ alias: string;
801
+ /** New value to set */
802
+ value: unknown;
803
+ /** Culture for variant content (undefined = invariant) */
804
+ culture?: string;
805
+ /** Segment for segmented content (undefined = no segment) */
806
+ segment?: string;
807
+ }
808
+
809
+ /**
810
+ * Result of a property change operation.
811
+ */
812
+ export declare interface UaiPropertyChangeResult {
813
+ /** Whether the change was applied successfully */
814
+ success: boolean;
815
+ /** Human-readable error message if failed */
816
+ error?: string;
817
+ }
818
+
819
+ /**
820
+ * Request Context Types
821
+ *
822
+ * Simple context item interface for passing context to AI operations.
823
+ * Matches the backend AIRequestContextItem model.
824
+ */
825
+ /**
826
+ * Simple context item - matches backend AIRequestContextItem.
827
+ * Intentionally flexible - processors on backend extract meaning.
828
+ */
829
+ export declare interface UaiRequestContextItem {
830
+ /** Human-readable description */
831
+ description: string;
832
+ /** The context data */
833
+ value?: string;
834
+ }
835
+
836
+ /**
837
+ * Data passed to the rollback modal.
838
+ */
839
+ export declare interface UaiRollbackModalData {
840
+ /** The source version being compared (the version to rollback to). */
841
+ fromVersion: number;
842
+ /** The target version being compared (usually the current version). */
843
+ toVersion: number;
844
+ /** The list of property changes between the versions. */
845
+ changes: UaiVersionPropertyChange[];
846
+ }
847
+
848
+ /**
849
+ * Value returned from the rollback modal.
850
+ */
851
+ export declare interface UaiRollbackModalValue {
852
+ /** Whether the user confirmed the rollback. */
853
+ rollback: boolean;
854
+ }
855
+
856
+ /**
857
+ * Event emitted when an item is selected.
858
+ * @public
859
+ */
860
+ export declare class UaiSelectedEvent extends Event {
861
+ static readonly TYPE = "selected";
862
+ unique: string | null;
863
+ item: any;
864
+ constructor(unique: string | null, item?: any, args?: EventInit);
865
+ }
866
+
867
+ /**
868
+ * Serialized representation of an entity for LLM context.
869
+ */
870
+ export declare interface UaiSerializedEntity {
871
+ entityType: string;
872
+ unique: string;
873
+ name: string;
874
+ contentType?: string;
875
+ /** Parent unique when creating a new entity. Undefined for existing entities. */
876
+ parentUnique?: string | null;
877
+ properties: UaiSerializedProperty[];
878
+ }
879
+
880
+ /**
881
+ * Serialized property for LLM context.
882
+ */
883
+ export declare interface UaiSerializedProperty {
884
+ alias: string;
885
+ label: string;
886
+ editorAlias: string;
887
+ value: unknown;
888
+ }
889
+
890
+ /**
891
+ * Response model for tag lookup results.
892
+ * @public
893
+ */
894
+ export declare interface UaiTagItem {
895
+ /** Unique identifier for the tag */
896
+ id: string;
897
+ /** Display text of the tag */
898
+ text: string;
899
+ /** Optional group the tag belongs to */
900
+ group?: string;
901
+ }
902
+
903
+ /**
904
+ * Callback type for looking up existing tags.
905
+ * @param query - The search query string
906
+ * @returns Promise resolving to an array of matching tag items
907
+ * @public
908
+ */
909
+ export declare type UaiTagLookupCallback = (query: string) => Promise<UaiTagItem[]>;
910
+
911
+ /**
912
+ * A configurable tags input component that allows creating and selecting tags.
913
+ * The tag lookup mechanism is configurable via a callback function.
914
+ *
915
+ * @fires change - Fires when tags are added or removed
916
+ *
917
+ * @example
918
+ * ```html
919
+ * <uai-tags-input
920
+ * .items=${['tag1', 'tag2']}
921
+ * .lookup=${async (query) => {
922
+ * const response = await fetch(`/api/tags?q=${query}`);
923
+ * return response.json();
924
+ * }}
925
+ * @change=${(e) => console.log(e.target.items)}
926
+ * ></uai-tags-input>
927
+ * ```
928
+ *
929
+ * @example Strict mode - only allow values from suggestions
930
+ * ```html
931
+ * <uai-tags-input
932
+ * strict
933
+ * .lookup=${async (query) => fetchAllowedTags(query)}
934
+ * @change=${(e) => console.log(e.target.items)}
935
+ * ></uai-tags-input>
936
+ * ```
937
+ * @public
938
+ */
939
+ export declare class UaiTagsInputElement extends UaiTagsInputElement_base {
940
+ #private;
941
+ /**
942
+ * Callback function for looking up existing tags.
943
+ * When provided, enables autocomplete suggestions as the user types.
944
+ */
945
+ lookup?: UaiTagLookupCallback;
946
+ required: boolean;
947
+ requiredMessage: string;
948
+ set items(newTags: string[]);
949
+ get items(): string[];
950
+ /**
951
+ * Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content.
952
+ * @type {boolean}
953
+ * @attr
954
+ * @default false
955
+ */
956
+ readonly: boolean;
957
+ /**
958
+ * Placeholder text shown in the input field.
959
+ * @type {string}
960
+ * @attr
961
+ * @default 'Enter tag'
962
+ */
963
+ placeholder: string;
964
+ /**
965
+ * When enabled, only allows values that come from the lookup suggestions.
966
+ * Users cannot create arbitrary tags - they must select from the dropdown.
967
+ * @type {boolean}
968
+ * @attr
969
+ * @default false
970
+ */
971
+ strict: boolean;
972
+ private _matches;
973
+ private _currentInput;
974
+ private _mainTag;
975
+ private _tagInput;
976
+ private _widthTracker;
977
+ private _optionCollection?;
978
+ private _tagEls?;
979
+ connectedCallback(): void;
980
+ disconnectedCallback(): void;
981
+ focus(): void;
982
+ protected getFormElement(): undefined;
983
+ protected updated(): void;
984
+ /** Render */
985
+ render(): TemplateResult<1>;
986
+ static styles: CSSResult[];
987
+ }
988
+
989
+ declare const UaiTagsInputElement_base: (new (...args: any[]) => UUIFormControlMixinElement<FormData | FormDataEntryValue>) & typeof UmbLitElement;
990
+
991
+ /**
992
+ * Unified repository for version history operations across all entity types.
993
+ * Uses the unified versioning API endpoint instead of entity-specific endpoints.
994
+ */
995
+ export declare class UaiUnifiedVersionHistoryRepository {
996
+ #private;
997
+ constructor(host: UmbControllerHost);
998
+ /**
999
+ * Gets the version history for an entity.
1000
+ * @param entityType - The type of entity (profile, connection, context).
1001
+ * @param entityId - The entity ID.
1002
+ * @param skip - Number of versions to skip (for pagination).
1003
+ * @param take - Number of versions to return.
1004
+ * @returns The version history response.
1005
+ */
1006
+ getVersionHistory(entityType: string, entityId: string, skip: number, take: number): Promise<UaiVersionHistoryResponse | undefined>;
1007
+ /**
1008
+ * Compares two versions of an entity.
1009
+ * @param entityType - The type of entity (profile, connection, context).
1010
+ * @param entityId - The entity ID.
1011
+ * @param fromVersion - The source version number.
1012
+ * @param toVersion - The target version number.
1013
+ * @returns The comparison response with property changes.
1014
+ */
1015
+ compareVersions(entityType: string, entityId: string, fromVersion: number, toVersion: number): Promise<UaiVersionComparisonResponse | undefined>;
1016
+ /**
1017
+ * Rolls back an entity to a previous version.
1018
+ * @param entityType - The type of entity (profile, connection, context).
1019
+ * @param entityId - The entity ID.
1020
+ * @param version - The version number to rollback to.
1021
+ * @returns True if rollback was successful.
1022
+ */
1023
+ rollback(entityType: string, entityId: string, version: number): Promise<boolean>;
1024
+ }
1025
+
1026
+ /**
1027
+ * Response model for version comparison.
1028
+ */
1029
+ export declare interface UaiVersionComparisonResponse {
1030
+ /** The source version number. */
1031
+ fromVersion: number;
1032
+ /** The target version number. */
1033
+ toVersion: number;
1034
+ /** The list of property changes. */
1035
+ changes: UaiVersionPropertyChange[];
1036
+ }
1037
+
1038
+ /**
1039
+ * Represents a single version history item.
1040
+ */
1041
+ export declare interface UaiVersionHistoryItem {
1042
+ /** The unique identifier of this version record. */
1043
+ id: string;
1044
+ /** The ID of the entity this version belongs to. */
1045
+ entityId: string;
1046
+ /** The version number (1, 2, 3, etc.). */
1047
+ version: number;
1048
+ /** The date and time when this version was created. */
1049
+ dateCreated: string;
1050
+ /** The user ID who created this version, if available. */
1051
+ createdByUserId?: string | null;
1052
+ /** The user name who created this version, if available. */
1053
+ createdByUserName?: string | null;
1054
+ /** Optional description of what changed in this version. */
1055
+ changeDescription?: string | null;
1056
+ }
1057
+
1058
+ /**
1059
+ * Response model for version history with pagination info.
1060
+ */
1061
+ export declare interface UaiVersionHistoryResponse {
1062
+ /** The current version of the entity. */
1063
+ currentVersion: number;
1064
+ /** Total number of versions. */
1065
+ totalVersions: number;
1066
+ /** The versions in this page. */
1067
+ versions: UaiVersionHistoryItem[];
1068
+ }
1069
+
1070
+ export declare const UaiVersionHistoryTypeMapper: {
1071
+ mapToVersionHistoryResponse(data: EntityVersionHistoryResponseModel): UaiVersionHistoryResponse;
1072
+ mapToComparisonResponse(data: EntityVersionComparisonResponseModel): UaiVersionComparisonResponse;
1073
+ };
1074
+
1075
+ /**
1076
+ * Represents a property change between two versions.
1077
+ */
1078
+ export declare interface UaiVersionPropertyChange {
1079
+ /** The name of the property that changed. */
1080
+ propertyName: string;
1081
+ /** The old value (from the source version). */
1082
+ oldValue?: string | null;
1083
+ /** The new value (from the target version). */
1084
+ newValue?: string | null;
1085
+ }
1086
+
1087
+ /**
1088
+ * Global context providing workspace registry functionality.
1089
+ * Registered as a globalContext manifest - auto-instantiated at backoffice root.
1090
+ */
1091
+ export declare class UaiWorkspaceRegistryContext extends UmbControllerBase {
1092
+ #private;
1093
+ /** Type guard marker for context resolution. */
1094
+ readonly IS_WORKSPACE_REGISTRY_CONTEXT = true;
1095
+ constructor(host: UmbControllerHost);
1096
+ /** Observable of workspace change events */
1097
+ get changes$(): Observable_2<WorkspaceChangeEvent>;
1098
+ /** Get a workspace by its entity type and unique ID */
1099
+ getByEntity(entityType: string, unique: string): WorkspaceEntry | undefined;
1100
+ /** Get all registered workspaces */
1101
+ getAll(): WorkspaceEntry[];
1102
+ /* Excluded from this release type: _register */
1103
+ /* Excluded from this release type: _rekey */
1104
+ /* Excluded from this release type: _unregister */
1105
+ }
1106
+
1107
+ /**
1108
+ * Event emitted when workspace registration changes
1109
+ */
1110
+ export declare interface WorkspaceChangeEvent {
1111
+ type: "added" | "removed" | "updated";
1112
+ key: string;
1113
+ entry: WorkspaceEntry;
1114
+ }
1115
+
1116
+ /**
1117
+ * Represents a registered workspace context
1118
+ */
1119
+ export declare interface WorkspaceEntry {
1120
+ /** The workspace context instance */
1121
+ context: object;
1122
+ /** The manifest alias (e.g., "Umb.Workspace.Document") */
1123
+ alias: string;
1124
+ /** Entity type (e.g., "document", "media", "block") */
1125
+ entityType: string | undefined;
1126
+ /** Entity unique ID (GUID) */
1127
+ entityUnique: string | undefined;
1128
+ }
1129
+
1130
+ export { }