@umbraco-ai/core 1.1.0 → 1.2.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.1.0",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "types": "./types/umbraco-ai-public-types.d.ts",
6
6
  "files": [
@@ -1,11 +1,13 @@
1
1
  import { CSSResult } from 'lit';
2
2
  import { HTMLElementConstructor } from '@umbraco-cms/backoffice/extension-api';
3
+ import type { ManifestApi } from '@umbraco-cms/backoffice/extension-api';
3
4
  import type { ManifestBase } from '@umbraco-cms/backoffice/extension-api';
5
+ import type { ManifestMenuItem } from '@umbraco-cms/backoffice/menu';
4
6
  import { Observable } from '@umbraco-cms/backoffice/external/rxjs';
5
7
  import { Observable as Observable_2 } from 'rxjs';
6
8
  import { TemplateResult } from 'lit-html';
7
9
  import { TemplateResult as TemplateResult_2 } from '@umbraco-cms/backoffice/external/lit';
8
- import type { UmbApi } from '@umbraco-cms/backoffice/extension-api';
10
+ import { UmbApi } from '@umbraco-cms/backoffice/extension-api';
9
11
  import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
10
12
  import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
11
13
  import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
@@ -19,6 +21,8 @@ import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal';
19
21
  import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
20
22
  import { UUIFormControlMixinElement } from '@umbraco-ui/uui-base';
21
23
 
24
+ export declare const coreClientReady: Promise<void>;
25
+
22
26
  /**
23
27
  * Helper to create context item from serialized entity.
24
28
  */
@@ -42,7 +46,7 @@ export declare function dispatchActionEvent(host: any, event: Event): void;
42
46
  declare type EntityVersionComparisonResponseModel = {
43
47
  fromVersion: number;
44
48
  toVersion: number;
45
- changes: Array<PropertyChangeModel>;
49
+ changes: Array<ValueChangeModel>;
46
50
  };
47
51
 
48
52
  declare type EntityVersionHistoryResponseModel = {
@@ -84,11 +88,43 @@ export declare interface ManifestEntityAdapter extends ManifestBase {
84
88
  }>;
85
89
  }
86
90
 
87
- declare type PropertyChangeModel = {
88
- propertyName: string;
89
- oldValue?: string | null;
90
- newValue?: string | null;
91
- };
91
+ /**
92
+ * Manifest for request context contributor extensions.
93
+ *
94
+ * Request context contributors are invoked before each AI request to gather
95
+ * ambient context (current section, entity, surface, etc.) into
96
+ * UaiRequestContextItem[] for the backend.
97
+ *
98
+ * Core contributors are unconditional (always run).
99
+ * Product-specific contributors can use Umbraco's conditions framework
100
+ * to gate when they contribute.
101
+ *
102
+ * @example
103
+ * ```typescript
104
+ * // Unconditional contributor (always contributes)
105
+ * const manifest: ManifestUaiRequestContextContributor = {
106
+ * type: "uaiRequestContextContributor",
107
+ * alias: "UmbracoAI.RequestContextContributor.Section",
108
+ * name: "Section Request Context Contributor",
109
+ * api: () => import("./section.contributor.js"),
110
+ * weight: 100,
111
+ * };
112
+ *
113
+ * // Kind-based contributor (api provided by kind, meta configures it)
114
+ * const surfaceManifest: ManifestUaiRequestContextContributor = {
115
+ * type: "uaiRequestContextContributor",
116
+ * kind: "agentSurface",
117
+ * alias: "UmbracoAI.Copilot.RequestContextContributor.AgentSurface",
118
+ * name: "Copilot Agent Surface Request Context Contributor",
119
+ * meta: { surface: "copilot" },
120
+ * };
121
+ * ```
122
+ */
123
+ export declare interface ManifestUaiRequestContextContributor extends ManifestApi<UaiRequestContextContributorApi> {
124
+ type: typeof UAI_REQUEST_CONTEXT_CONTRIBUTOR_EXTENSION_TYPE;
125
+ /** Optional metadata passed to the contributor's `contribute()` method. */
126
+ meta?: Record<string, unknown>;
127
+ }
92
128
 
93
129
  /**
94
130
  * Resolve an entity adapter by entity type.
@@ -137,6 +173,12 @@ export declare type ToolScopeItemResponseModel = {
137
173
  domain: string;
138
174
  };
139
175
 
176
+ export declare const UAI_ADDONS_MENU_ALIAS = "Uai.Menu.Addons";
177
+
178
+ export declare const UAI_AI_SECTION_PATHNAME = "ai";
179
+
180
+ export declare const UAI_CORE_MENU_ALIAS = "Uai.Menu.Core";
181
+
140
182
  /**
141
183
  * A constant representing an empty GUID.
142
184
  * @public
@@ -150,11 +192,18 @@ export declare const UAI_ENTITY_ADAPTER_EXTENSION_TYPE = "uaiEntityAdapter";
150
192
 
151
193
  export declare const UAI_ITEM_PICKER_MODAL: UmbModalToken<UaiItemPickerModalData, UaiItemPickerModalValue>;
152
194
 
195
+ /**
196
+ * Extension type alias for request context contributors.
197
+ */
198
+ declare const UAI_REQUEST_CONTEXT_CONTRIBUTOR_EXTENSION_TYPE = "uaiRequestContextContributor";
199
+
153
200
  /**
154
201
  * Modal token for the rollback confirmation modal.
155
202
  */
156
203
  export declare const UAI_ROLLBACK_MODAL: UmbModalToken<UaiRollbackModalData, UaiRollbackModalValue>;
157
204
 
205
+ export declare const UAI_SECTION_ALIAS = "Uai.Section.AI";
206
+
158
207
  /**
159
208
  * Context token for consuming the Workspace Registry.
160
209
  * Use this to access active workspaces from any component.
@@ -429,11 +478,17 @@ export declare class UaiDocumentAdapter implements UaiEntityAdapterApi {
429
478
  */
430
479
  serializeForLlm(workspaceContext: unknown): Promise<UaiSerializedEntity>;
431
480
  /**
432
- * Apply a property change to the document workspace.
481
+ * Apply a value change to the document workspace.
433
482
  * Changes are staged in the workspace - user must save to persist.
483
+ * For CMS documents, the path is treated as the property alias.
434
484
  * Only supports text-based properties (TextBox, TextArea) for now.
435
485
  */
436
- applyPropertyChange(workspaceContext: unknown, change: UaiPropertyChange): Promise<UaiPropertyChangeResult>;
486
+ applyValueChange(workspaceContext: unknown, change: UaiValueChange): Promise<UaiValueChangeResult>;
487
+ /**
488
+ * Cleanup method required by UmbApi base type.
489
+ * Currently no resources to clean up as the adapter is stateless.
490
+ */
491
+ destroy(): void;
437
492
  }
438
493
 
439
494
  /**
@@ -448,6 +503,7 @@ export declare interface UaiEditableModelFieldModel {
448
503
  defaultValue?: unknown;
449
504
  sortOrder: number;
450
505
  isRequired: boolean;
506
+ group?: string;
451
507
  }
452
508
 
453
509
  /**
@@ -540,7 +596,7 @@ export declare class UaiEntityActionEvent extends UmbEntityActionEvent {
540
596
  * - Serializing entity data for LLM consumption
541
597
  * - Applying property changes (optional)
542
598
  */
543
- export declare interface UaiEntityAdapterApi {
599
+ export declare interface UaiEntityAdapterApi extends UmbApi {
544
600
  readonly entityType: string;
545
601
  /**
546
602
  * Check if this adapter can handle the given workspace context.
@@ -575,13 +631,13 @@ export declare interface UaiEntityAdapterApi {
575
631
  */
576
632
  serializeForLlm(workspaceContext: unknown): Promise<UaiSerializedEntity>;
577
633
  /**
578
- * Apply a property change to the workspace (staged, not persisted).
634
+ * Apply a value change to the workspace (staged, not persisted).
579
635
  * Optional - some entity types may be read-only.
580
636
  * @param workspaceContext The workspace context to modify
581
- * @param change The property change to apply
637
+ * @param change The value change to apply
582
638
  * @returns Result indicating success or failure with error message
583
639
  */
584
- applyPropertyChange?(workspaceContext: unknown, change: UaiPropertyChange): Promise<UaiPropertyChangeResult>;
640
+ applyValueChange?(workspaceContext: unknown, change: UaiValueChange): Promise<UaiValueChangeResult>;
585
641
  }
586
642
 
587
643
  /**
@@ -618,23 +674,33 @@ export declare class UaiEntityAdapterContext extends UmbControllerBase {
618
674
  /**
619
675
  * Serialize the selected entity for LLM context injection.
620
676
  * Returns undefined if no entity is selected.
677
+ * Waits for initialization to complete before attempting to serialize.
621
678
  */
622
679
  serializeSelectedEntity(): Promise<UaiSerializedEntity | undefined>;
623
680
  /**
624
- * Apply a property change to the currently selected entity.
681
+ * Apply a value change to the currently selected entity.
625
682
  * Changes are staged in the workspace - user must save to persist.
626
- * @param change The property change to apply
683
+ * Waits for initialization to complete before attempting to apply changes.
684
+ * @param change The value change to apply
627
685
  * @returns Result indicating success or failure with error message
628
686
  */
629
- applyPropertyChange(change: UaiPropertyChange): Promise<UaiPropertyChangeResult>;
687
+ applyValueChange(change: UaiValueChange): Promise<UaiValueChangeResult>;
630
688
  }
631
689
 
632
690
  /**
633
- * Entity Adapter Types
634
- *
635
- * Minimal interfaces for the entity adapter system that enables
636
- * AI tools to interact with Umbraco entities being edited.
691
+ * Extended menu item manifest that supports child entity types for entity container menu items.
637
692
  */
693
+ export declare interface UaiEntityContainerMenuItemManifest extends ManifestMenuItem {
694
+ kind: 'entityContainer';
695
+ meta: ManifestMenuItem['meta'] & {
696
+ /**
697
+ * Child entity types that should keep this menu item highlighted when active.
698
+ * Used by the entityContainer menu item kind to maintain highlighting when navigating to child entities.
699
+ */
700
+ childEntityTypes?: string[];
701
+ };
702
+ }
703
+
638
704
  /**
639
705
  * Represents the identity of an entity being edited.
640
706
  * Supports hierarchical relationships via recursive parentContext.
@@ -757,6 +823,10 @@ export declare class UaiModelEditorElement extends UmbLitElement {
757
823
  * Placeholder text shown when the schema has no fields.
758
824
  */
759
825
  emptyMessage?: string;
826
+ /**
827
+ * Placeholder text shown when the schema has no fields.
828
+ */
829
+ defaultGroup?: string;
760
830
  private _propertyValues;
761
831
  shouldUpdate(changedProperties: Map<string, unknown>): boolean;
762
832
  updated(changedProperties: Map<string, unknown>): void;
@@ -847,28 +917,68 @@ export declare class UaiProfilePickerElement extends UaiProfilePickerElement_bas
847
917
  declare const UaiProfilePickerElement_base: HTMLElementConstructor<UmbFormControlMixinElement<string | string[] | undefined>> & typeof UmbLitElement;
848
918
 
849
919
  /**
850
- * Request to change a property value.
851
- * Changes are staged in the workspace - user must save to persist.
920
+ * Mutable context bag passed to each contributor.
921
+ * Mirrors the backend AIRuntimeContext pattern -- contributors
922
+ * call `add()` to push context items rather than returning them.
852
923
  */
853
- export declare interface UaiPropertyChange {
854
- /** Property alias */
855
- alias: string;
856
- /** New value to set */
857
- value: unknown;
858
- /** Culture for variant content (undefined = invariant) */
859
- culture?: string;
860
- /** Segment for segmented content (undefined = no segment) */
861
- segment?: string;
924
+ export declare class UaiRequestContext {
925
+ #private;
926
+ /**
927
+ * Add a context item to the request context.
928
+ */
929
+ add(item: UaiRequestContextItem): void;
930
+ /**
931
+ * Get all contributed context items.
932
+ */
933
+ getItems(): UaiRequestContextItem[];
862
934
  }
863
935
 
864
936
  /**
865
- * Result of a property change operation.
937
+ * Collects request context from all registered contributors.
938
+ *
939
+ * Queries uaiRequestContextContributor extensions and uses
940
+ * `loadManifestApi` to load + instantiate each API (same pattern
941
+ * as UaiFrontendToolManager).
942
+ *
943
+ * API instances are cached for the lifetime of the collector.
866
944
  */
867
- export declare interface UaiPropertyChangeResult {
868
- /** Whether the change was applied successfully */
869
- success: boolean;
870
- /** Human-readable error message if failed */
871
- error?: string;
945
+ export declare class UaiRequestContextCollector extends UmbControllerBase {
946
+ #private;
947
+ constructor(host: UmbControllerHost);
948
+ /**
949
+ * Collect request context items from all resolved contributors.
950
+ * Creates a mutable UaiRequestContext, passes it through each
951
+ * contributor (mirroring the backend Contribute pattern), and
952
+ * returns the accumulated items.
953
+ *
954
+ * @returns Aggregated request context items from all contributors.
955
+ */
956
+ collect(): Promise<UaiRequestContextItem[]>;
957
+ }
958
+
959
+ /**
960
+ * API interface for request context contributors.
961
+ * Implement this to contribute context items to AI requests.
962
+ *
963
+ * Frontend counterpart of the backend IAIRuntimeContextContributor.
964
+ * While the backend contributors *process* request context items into
965
+ * runtime context, frontend contributors *produce* the request context
966
+ * items that get sent in the request.
967
+ *
968
+ * Mirrors the backend signature: `void Contribute(AIRuntimeContext context)`
969
+ */
970
+ export declare interface UaiRequestContextContributorApi extends UmbApi {
971
+ /**
972
+ * Contribute context items to the request context.
973
+ * Called once per message send / prompt execution.
974
+ * Add items via `context.add(item)`. No-op to contribute nothing.
975
+ *
976
+ * @param context The mutable request context to contribute to.
977
+ * @param meta Optional manifest meta – passed from the manifest's `meta`
978
+ * property so kind-based contributors can read configuration
979
+ * without hardcoding values.
980
+ */
981
+ contribute(context: UaiRequestContext, meta?: Record<string, unknown>): Promise<void>;
872
982
  }
873
983
 
874
984
  /**
@@ -897,7 +1007,7 @@ export declare interface UaiRollbackModalData {
897
1007
  /** The target version being compared (usually the current version). */
898
1008
  toVersion: number;
899
1009
  /** The list of property changes between the versions. */
900
- changes: UaiVersionPropertyChange[];
1010
+ changes: UaiVersionValueChange[];
901
1011
  }
902
1012
 
903
1013
  /**
@@ -921,19 +1031,45 @@ export declare class UaiSelectedEvent extends Event {
921
1031
 
922
1032
  /**
923
1033
  * Serialized representation of an entity for LLM context.
1034
+ * Adapters decide the structure of the data field based on entity type.
924
1035
  */
925
1036
  export declare interface UaiSerializedEntity {
926
1037
  entityType: string;
927
1038
  unique: string;
928
1039
  name: string;
929
- contentType?: string;
930
1040
  /** Parent unique when creating a new entity. Undefined for existing entities. */
931
1041
  parentUnique?: string | null;
932
- properties: UaiSerializedProperty[];
1042
+ /**
1043
+ * Free-form entity data as JSON object.
1044
+ * Adapters decide the structure based on entity type.
1045
+ *
1046
+ * For CMS entities, typically contains:
1047
+ * ```typescript
1048
+ * {
1049
+ * contentType: "blogPost",
1050
+ * properties: [
1051
+ * { alias: "title", label: "Title", editorAlias: "Umbraco.TextBox", value: "Hello" }
1052
+ * ]
1053
+ * }
1054
+ * ```
1055
+ *
1056
+ * For third-party entities, can be any domain-appropriate structure:
1057
+ * ```typescript
1058
+ * {
1059
+ * sku: "12345",
1060
+ * price: { amount: 29.99, currency: "USD" },
1061
+ * variants: [{ color: "red", size: "large" }]
1062
+ * }
1063
+ * ```
1064
+ */
1065
+ data: Record<string, unknown>;
933
1066
  }
934
1067
 
935
1068
  /**
936
1069
  * Serialized property for LLM context.
1070
+ * @deprecated Entity data is now stored in UaiSerializedEntity.data as free-form JSON.
1071
+ * For CMS entities, properties are nested inside the data field.
1072
+ * This interface is kept for reference only.
937
1073
  */
938
1074
  export declare interface UaiSerializedProperty {
939
1075
  alias: string;
@@ -1205,6 +1341,10 @@ export declare class UaiToolScopePermissionsElement extends UaiToolScopePermissi
1205
1341
  * Readonly mode - cannot toggle permissions.
1206
1342
  */
1207
1343
  readonly: boolean;
1344
+ /**
1345
+ * Hide scopes that have no tools.
1346
+ */
1347
+ hideEmptyScopes: boolean;
1208
1348
  /**
1209
1349
  * The selected tool scope IDs.
1210
1350
  */
@@ -1213,7 +1353,9 @@ export declare class UaiToolScopePermissionsElement extends UaiToolScopePermissi
1213
1353
  private _selection;
1214
1354
  private _groups;
1215
1355
  private _loading;
1356
+ private _toolCounts;
1216
1357
  connectedCallback(): void;
1358
+ updated(changedProperties: Map<string, unknown>): void;
1217
1359
  render(): TemplateResult<1>;
1218
1360
  static styles: CSSResult[];
1219
1361
  }
@@ -1234,6 +1376,10 @@ export declare class UaiToolScopePermissionsOverrideElement extends UmbLitElemen
1234
1376
  * Map of scope ID to full scope data.
1235
1377
  */
1236
1378
  private _scopeDataMap;
1379
+ /**
1380
+ * Tool counts by scope ID.
1381
+ */
1382
+ private _toolCounts;
1237
1383
  /**
1238
1384
  * Inherited scope IDs from agent defaults.
1239
1385
  */
@@ -1250,12 +1396,20 @@ export declare class UaiToolScopePermissionsOverrideElement extends UmbLitElemen
1250
1396
  * Whether the component is in readonly mode.
1251
1397
  */
1252
1398
  readonly: boolean;
1399
+ /**
1400
+ * Hide scopes that have no tools.
1401
+ */
1402
+ hideEmptyScopes: boolean;
1253
1403
  connectedCallback(): void;
1254
1404
  updated(changedProperties: Map<string, unknown>): void;
1255
1405
  /**
1256
1406
  * Load full scope data for all scopes.
1257
1407
  */
1258
1408
  private _loadScopeData;
1409
+ /**
1410
+ * Load tool counts for all scopes.
1411
+ */
1412
+ private _loadToolCounts;
1259
1413
  /**
1260
1414
  * Computed list of all scopes with their permission states.
1261
1415
  */
@@ -1318,6 +1472,10 @@ export declare class UaiToolScopePickerElement extends UaiToolScopePickerElement
1318
1472
  * Readonly mode - cannot add or remove.
1319
1473
  */
1320
1474
  readonly: boolean;
1475
+ /**
1476
+ * Hide scopes that have no tools.
1477
+ */
1478
+ hideEmptyScopes: boolean;
1321
1479
  /**
1322
1480
  * The selected tool scope ID(s).
1323
1481
  */
@@ -1326,6 +1484,8 @@ export declare class UaiToolScopePickerElement extends UaiToolScopePickerElement
1326
1484
  private _selection;
1327
1485
  private _items;
1328
1486
  private _loading;
1487
+ private _toolCounts;
1488
+ connectedCallback(): Promise<void>;
1329
1489
  render(): TemplateResult<1>;
1330
1490
  static styles: CSSResult[];
1331
1491
  }
@@ -1485,6 +1645,31 @@ export declare class UaiUserGroupSettingsListElement<TSettings> extends UmbLitEl
1485
1645
  static styles: CSSResult[];
1486
1646
  }
1487
1647
 
1648
+ /**
1649
+ * Request to change a value at a JSON path in the entity data.
1650
+ * Changes are staged in the workspace - user must save to persist.
1651
+ */
1652
+ export declare interface UaiValueChange {
1653
+ /** JSON path to the value (e.g., "title", "price.amount", "inventory.quantity") */
1654
+ path: string;
1655
+ /** New value to set */
1656
+ value: unknown;
1657
+ /** Culture for variant content (undefined = invariant) */
1658
+ culture?: string;
1659
+ /** Segment for segmented content (undefined = no segment) */
1660
+ segment?: string;
1661
+ }
1662
+
1663
+ /**
1664
+ * Result of a value change operation.
1665
+ */
1666
+ export declare interface UaiValueChangeResult {
1667
+ /** Whether the change was applied successfully */
1668
+ success: boolean;
1669
+ /** Human-readable error message if failed */
1670
+ error?: string;
1671
+ }
1672
+
1488
1673
  /**
1489
1674
  * Response model for version comparison.
1490
1675
  */
@@ -1493,8 +1678,8 @@ export declare interface UaiVersionComparisonResponse {
1493
1678
  fromVersion: number;
1494
1679
  /** The target version number. */
1495
1680
  toVersion: number;
1496
- /** The list of property changes. */
1497
- changes: UaiVersionPropertyChange[];
1681
+ /** The list of value changes. */
1682
+ changes: UaiVersionValueChange[];
1498
1683
  }
1499
1684
 
1500
1685
  /**
@@ -1535,11 +1720,11 @@ export declare const UaiVersionHistoryTypeMapper: {
1535
1720
  };
1536
1721
 
1537
1722
  /**
1538
- * Represents a property change between two versions.
1723
+ * Represents a value change between two versions.
1539
1724
  */
1540
- export declare interface UaiVersionPropertyChange {
1541
- /** The name of the property that changed. */
1542
- propertyName: string;
1725
+ export declare interface UaiVersionValueChange {
1726
+ /** The path of the value that changed. */
1727
+ path: string;
1543
1728
  /** The old value (from the source version). */
1544
1729
  oldValue?: string | null;
1545
1730
  /** The new value (from the target version). */
@@ -1566,6 +1751,12 @@ export declare class UaiWorkspaceRegistryContext extends UmbControllerBase {
1566
1751
  /* Excluded from this release type: _unregister */
1567
1752
  }
1568
1753
 
1754
+ declare type ValueChangeModel = {
1755
+ path: string;
1756
+ oldValue?: string | null;
1757
+ newValue?: string | null;
1758
+ };
1759
+
1569
1760
  /**
1570
1761
  * Event emitted when workspace registration changes
1571
1762
  */