@limetech/lime-web-components 6.9.0 → 6.10.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/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [6.10.0](https://github.com/Lundalogik/lime-web-components/compare/v6.9.0...v6.10.0) (2026-02-13)
2
+
3
+
4
+ ### Features
5
+
6
+
7
+ * **ai-context:** add GatheredAIContext and update element registration ([e1ebb1d](https://github.com/Lundalogik/lime-web-components/commit/e1ebb1d51eb89290cbd64a252b1b42145c833d12))
8
+ * **ai-context:** allow getContext() to return null ([35209a4](https://github.com/Lundalogik/lime-web-components/commit/35209a4a6a456d2b3a7254b848d4af46d86cc380))
9
+
1
10
  ## [6.9.0](https://github.com/Lundalogik/lime-web-components/compare/v6.8.0...v6.9.0) (2026-01-28)
2
11
 
3
12
 
@@ -1,3 +1,5 @@
1
+ import { LimeWebComponent } from '../core/lime-web-component';
2
+ import { LimeWebComponentContext } from '../core/context';
1
3
  /**
2
4
  * A value that can be safely serialized to JSON via JSON.stringify().
3
5
  *
@@ -70,6 +72,28 @@ export interface AIContextContribution {
70
72
  */
71
73
  purpose?: string;
72
74
  }
75
+ /**
76
+ * A fully enriched context contribution ready for the AI.
77
+ *
78
+ * This is the "output" of context gathering — includes the provider's
79
+ * contribution plus UI context information added by the registry.
80
+ *
81
+ * @alpha
82
+ * @group AI Context
83
+ */
84
+ export interface GatheredAIContext extends AIContextContribution {
85
+ /**
86
+ * The component's LimeWebComponentContext at the time of gathering.
87
+ *
88
+ * Provides rich information about where this context originates:
89
+ * - `limetype`: What type of business object the component is working with
90
+ * - `id`: Which specific record (if any)
91
+ * - `parent`: Parent context for nested components
92
+ *
93
+ * Only present when the provider registered with an element reference.
94
+ */
95
+ componentContext?: LimeWebComponentContext;
96
+ }
73
97
  /**
74
98
  * A provider that contributes context information to the AI chat.
75
99
  *
@@ -89,6 +113,9 @@ export interface AIContextContribution {
89
113
  * ```typescript
90
114
  * @Component({ tag: 'my-custom-panel' })
91
115
  * export class MyCustomPanel {
116
+ * @Element()
117
+ * private host: HTMLElement & LimeWebComponent;
118
+ *
92
119
  * private unregisterContext: () => void;
93
120
  *
94
121
  * connectedCallback() {
@@ -103,7 +130,7 @@ export interface AIContextContribution {
103
130
  * selectionCount: this.selectedItems.length
104
131
  * }
105
132
  * })
106
- * });
133
+ * }, this.host);
107
134
  * }
108
135
  *
109
136
  * disconnectedCallback() {
@@ -138,9 +165,10 @@ export interface AIContextProvider {
138
165
  * The implementation should be fast and avoid expensive operations
139
166
  * since it's called on every message.
140
167
  *
141
- * @returns The context contribution.
168
+ * @returns The context contribution, or `null` if no context is available
169
+ * (e.g., required state hasn't loaded yet).
142
170
  */
143
- getContext(): AIContextContribution;
171
+ getContext(): AIContextContribution | null;
144
172
  }
145
173
  /**
146
174
  * Registry for AI context providers.
@@ -171,6 +199,10 @@ export interface AIContextRegistry {
171
199
  * gets a unique internal key.
172
200
  *
173
201
  * @param provider - The provider to register.
202
+ * @param element - Optional host element of the component registering this
203
+ * provider. When provided, enables the registry to:
204
+ * - Read the component's `LimeWebComponentContext` to enrich contributions
205
+ * - Skip providers whose elements are not currently connected to the DOM
174
206
  * @returns A function to unregister the provider. Call this when the
175
207
  * component is disconnected or the context is no longer relevant.
176
208
  *
@@ -187,13 +219,13 @@ export interface AIContextRegistry {
187
219
  * descriptive: this.deal.descriptive
188
220
  * }
189
221
  * })
190
- * });
222
+ * }, this.host);
191
223
  *
192
224
  * // Later, when component is disconnected:
193
225
  * unregister();
194
226
  * ```
195
227
  */
196
- register(provider: AIContextProvider): () => void;
228
+ register(provider: AIContextProvider, element?: HTMLElement & LimeWebComponent): () => void;
197
229
  /**
198
230
  * Get all registered providers.
199
231
  *
@@ -206,11 +238,15 @@ export interface AIContextRegistry {
206
238
  * Gather context from all registered providers.
207
239
  *
208
240
  * Calls `getContext()` on each provider and collects the results.
209
- * Providers that throw errors are skipped (with a warning logged).
241
+ * Providers that return `null` (indicating no context available) and
242
+ * providers that throw errors are skipped (errors log a warning).
243
+ *
244
+ * Each contribution is enriched with the component's `LimeWebComponentContext`
245
+ * if the provider was registered with an element reference.
210
246
  *
211
- * @returns An array of context contributions, one from each provider
212
- * that returned successfully.
247
+ * @returns An array of enriched context contributions, one from each
248
+ * provider that returned a non-null contribution.
213
249
  */
214
- gatherContext(): AIContextContribution[];
250
+ gatherContext(): GatheredAIContext[];
215
251
  }
216
252
  //# sourceMappingURL=ai-context-registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ai-context-registry.d.ts","sourceRoot":"","sources":["../../src/ai-context/ai-context-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,SAAS,GACf,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,EAAE,GACX;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEnC;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IAClC;;;;;;;;;;;;;;;;;;OAkBG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAEjC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B;;;;;;;;;;;;OAYG;IACH,UAAU,IAAI,qBAAqB,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,IAAI,CAAC;IAElD;;;;;;OAMG;IACH,YAA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E,WAAW,GAAG,gBAAgB,GACzC,MAAM,IAAI,CAAC;IAEd;;;;;;OAMG;IACH,YAAY,IAAI,iBAAiB,EAAE,CAAC;IAEpC;;;;;;;;;;;;OAYG;IACH,aAAa,IAAI,iBAAiB,EAAE,CAAC;CACxC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@limetech/lime-web-components",
3
- "version": "6.9.0",
3
+ "version": "6.10.0",
4
4
  "description": "Lime Web Components",
5
5
  "author": "Lime Technologies",
6
6
  "license": "Apache-2.0",
@@ -35,13 +35,13 @@
35
35
  "tslib": "^2.8.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@commitlint/config-conventional": "^20.3.1",
38
+ "@commitlint/config-conventional": "^20.4.1",
39
39
  "@limetech/eslint-config": "^4.0.0",
40
- "@microsoft/api-extractor": "^7.55.2",
40
+ "@microsoft/api-extractor": "^7.56.3",
41
41
  "eslint": "^9.39.2",
42
42
  "expect-type": "^1.3.0",
43
- "globals": "^17.2.0",
44
- "jsdom": "^27.4.0",
43
+ "globals": "^17.3.0",
44
+ "jsdom": "^28.0.0",
45
45
  "replace-in-file": "^8.4.0",
46
46
  "shelljs": "0.10.0",
47
47
  "typedoc": "^0.23.24",