@umbraco-ai/core 1.9.0 → 1.10.1

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.9.0",
3
+ "version": "1.10.1",
4
4
  "type": "module",
5
5
  "types": "./types/umbraco-ai-public-types.d.ts",
6
6
  "files": [
@@ -8,8 +8,8 @@
8
8
  "README.md"
9
9
  ],
10
10
  "peerDependencies": {
11
+ "@umbraco-cms/backoffice": "^17.3.0",
11
12
  "chart.js": "^4.5.1",
12
- "diff": "^8.0.3",
13
- "@umbraco-cms/backoffice": "^17.1.0"
13
+ "diff": "^8.0.3"
14
14
  }
15
15
  }
@@ -14,6 +14,7 @@ import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
14
14
  import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
15
15
  import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
16
16
  import type { UmbDetailRepository } from '@umbraco-cms/backoffice/repository';
17
+ import type { UmbElement } from '@umbraco-cms/backoffice/element-api';
17
18
  import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action';
18
19
  import { UmbEntityActionEvent } from '@umbraco-cms/backoffice/entity-action';
19
20
  import { UmbEntityBulkActionBase } from '@umbraco-cms/backoffice/entity-bulk-action';
@@ -23,6 +24,33 @@ import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal';
23
24
  import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
24
25
  import { UUIFormControlMixinElement } from '@umbraco-ui/uui-base';
25
26
 
27
+ declare interface AiHttpClient {
28
+ setConfig: (config: any) => unknown;
29
+ interceptors: {
30
+ response: {
31
+ use: (fn: (response: Response, request: Request, opts?: unknown) => Response | Promise<Response>) => unknown;
32
+ };
33
+ };
34
+ }
35
+
36
+ /**
37
+ * Configures a generated hey-api client with the backoffice auth callback
38
+ * and attaches a silent 401 recovery interceptor.
39
+ *
40
+ * The interceptor calls `authContext.makeRefreshTokenRequest()` on a 401
41
+ * and retries the request once. This is a workaround for CMS issue
42
+ * https://github.com/umbraco/Umbraco-CMS/issues/22647 — the default
43
+ * `UmbApiInterceptorController.bindDefaultInterceptors` is unusable from
44
+ * third-party entry-point hosts because its `UmbAuthSignalerContext`
45
+ * ends up scoped below `umb-app` and emissions never reach `UmbAuthContext`.
46
+ *
47
+ * @param host The entry point's `host` parameter (`UmbElement`).
48
+ * @param client The generated hey-api client to configure.
49
+ * @returns A Promise that resolves once auth is configured on the client.
50
+ * @public
51
+ */
52
+ export declare function configureAiClient(host: UmbElement, client: AiHttpClient): Promise<void>;
53
+
26
54
  export declare const coreClientReady: Promise<void>;
27
55
 
28
56
  /**
@@ -529,7 +557,10 @@ export declare class UaiDocumentAdapter implements UaiEntityAdapterApi {
529
557
  getName(workspaceContext: unknown): string;
530
558
  /**
531
559
  * Get an observable for the document name for reactive updates.
532
- * Uses the variants observable which properly tracks name changes.
560
+ * Uses the variants observable which properly tracks name changes, and
561
+ * picks the variant whose culture matches what the editor currently has
562
+ * focused so the AI context selector shows the right name on multi-
563
+ * variant documents.
533
564
  */
534
565
  getNameObservable(workspaceContext: unknown): Observable<string | undefined> | undefined;
535
566
  /**
@@ -545,7 +576,12 @@ export declare class UaiDocumentAdapter implements UaiEntityAdapterApi {
545
576
  /**
546
577
  * Serialize document for LLM context.
547
578
  * Uses structure to get all properties, then merges with values.
548
- * Only includes TextBox and TextArea properties for now.
579
+ *
580
+ * Multi-variant content: `getValues()` returns one entry per
581
+ * (alias, culture, segment). We pick the entry that matches the variant
582
+ * the editor currently has focused, falling back to the invariant entry
583
+ * for properties that don't vary, so prompt template variables like
584
+ * `{{header}}` resolve to the active culture's value.
549
585
  */
550
586
  serializeForLlm(workspaceContext: unknown): Promise<UaiSerializedEntity>;
551
587
  /**
@@ -1138,6 +1174,14 @@ export declare interface UaiSerializedEntity {
1138
1174
  name: string;
1139
1175
  /** Parent unique when creating a new entity. Undefined for existing entities. */
1140
1176
  parentUnique?: string | null;
1177
+ /**
1178
+ * Active culture the editor was on when the entity was serialized.
1179
+ * Null/undefined for invariant entities. Used by the server to pick the
1180
+ * matching property entry from `data.properties` on multi-variant content.
1181
+ */
1182
+ culture?: string | null;
1183
+ /** Active segment when the entity was serialized. */
1184
+ segment?: string | null;
1141
1185
  /**
1142
1186
  * Free-form entity data as JSON object.
1143
1187
  * Adapters decide the structure based on entity type.
@@ -1147,7 +1191,7 @@ export declare interface UaiSerializedEntity {
1147
1191
  * {
1148
1192
  * contentType: "blogPost",
1149
1193
  * properties: [
1150
- * { alias: "title", label: "Title", editorAlias: "Umbraco.TextBox", value: "Hello" }
1194
+ * { alias: "title", label: "Title", editorAlias: "Umbraco.TextBox", value: "Hello", culture: "en-US", segment: null }
1151
1195
  * ]
1152
1196
  * }
1153
1197
  * ```
@@ -1166,15 +1210,18 @@ export declare interface UaiSerializedEntity {
1166
1210
 
1167
1211
  /**
1168
1212
  * Serialized property for LLM context.
1169
- * @deprecated Entity data is now stored in UaiSerializedEntity.data as free-form JSON.
1170
- * For CMS entities, properties are nested inside the data field.
1171
- * This interface is kept for reference only.
1213
+ * Used as the element type of `UaiSerializedEntity.data.properties` for CMS entities.
1214
+ *
1215
+ * `culture` and `segment` describe which variant this property value belongs to:
1216
+ * `null` means invariant (no culture/segment dimension on the property).
1172
1217
  */
1173
1218
  export declare interface UaiSerializedProperty {
1174
1219
  alias: string;
1175
1220
  label: string;
1176
1221
  editorAlias: string;
1177
1222
  value: unknown;
1223
+ culture: string | null;
1224
+ segment: string | null;
1178
1225
  }
1179
1226
 
1180
1227
  /**